gid; defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); /* frontend.html compaitable functions*/ function html_module2( $module ,$params='',$itemid='') { global $lm_language,$Itemid,$lm_type; $module_sfx = @$params->get( 'moduleclass_sfx' ,'') ; if (file_exists( "modules/".$module['module'].".".$lm_language.".php" )) { include( "modules/".$module['module'].".".$lm_language.".php" ); } if($lm_type=="html") { ?>
Execute($query); if($conn->RecordCount()==0)return 0; $rsa=$rs->GetArray(); $count=0; foreach($rsa as $row) { if(trim($row['showon'])=='' || strstr($row['showon'],'_'.$Itemid.'_') || strstr($row['showon'],'_0_')) $count++; } return $count; } function mosLoadModules( $position='left', $horiz=false) { global $conn,$Itemid,$access_sql; $horiz=false; $query = "SELECT id,title,message,module,ordering,position,showtitle,showon,params" ."\nFROM #__modules" ."\nWHERE published=1 AND position='$position' $access_sql" ."\nORDER BY ordering ASC"; $rs=$conn->Execute($query); if($rs && $rs->RecordCount()>0 && $rsa = $rs->GetArray() ) { if ($horiz) echo ''; foreach($rsa as $module) { if ($horiz) echo ""; } if ($horiz) echo "\n\n
"; if($module['showon']=='' || strstr($module['showon'],'_'.$Itemid.'_') || strstr($module['showon'],'_0_')) { $params=parseparams(dbdecode($module['params'])); html_module2( $module, $params, $Itemid ); } if ($horiz) echo "
"; } } class param_class { function get($var,$default=NULL) { if(!isset($this->$var))return $default; else return $this->$var; } function def($var,$default=NULL) { if(!isset($this->$var)){$this->$var=$default; return false;} return true; } } function parseparams( $txt ) { $sep1 = "\n"; // line separator $sep2 = "="; // key value separator $temp = explode( $sep1, $txt ); $obj = new param_class(); foreach ($temp as $item) { if($item) { $temp2 = explode( $sep2, $item, 2 ); $k = trim( $temp2[0] ); if (isset( $temp2[1] )) { $obj->$k = trim( $temp2[1] ); } else { $obj->$k = $k; } } } return $obj; } function parselinkparams( $linkid ) { global $conn; $rs=$conn->Execute("SELECT id,params FROM #__menu WHERE id = $linkid "); if($rs && $rs->RecordCount()>0 && $rsa=$rs->GetArray()) { return parseparams( dbdecode($rsa[0]['params']) ); } return false; } function mosNotAuth() { global $my; echo _NOT_AUTH; if ($my->id < 1) { echo "

" . _DO_LOGIN ."
"; } } function moscurrentdate() { global $time; return strftime (_DATE_FORMAT_LC, $time); } function mosShowHead() { global $my,$lm_website,$lm_version_num;?> {_title_} getTemplate(); $lm_template_dir=$lm_absolute_path."templates/".$template; if(is_file($lm_template_dir.$dir.$file))return ""; return ""; } function page_nav($page_url,$count,$display,$class='pagenav',$type=0) { global $page; $num_pages=ceil($count/$display); if($num_pages>1) { $num_pages+=1; $first=""._CMN_PREV_ARROW.' '._PN_START.''; $previous=""._ITEM_PREVIOUS.''; $last=""._PN_END.' '._CMN_NEXT_ARROW.''; $next=""._ITEM_NEXT.''; if($page>1)$first=""._CMN_PREV_ARROW.' '._PN_START.""; if($page>1)$previous=""._ITEM_PREVIOUS.""; if($page<($num_pages-1))$next=""._ITEM_NEXT.""; if($page<($num_pages-1))$last=""._PN_END.' '._CMN_NEXT_ARROW.""; $page_links=''; for($pn=1 ; $pn<$num_pages ; $pn ++) { if($pn == $page)$page_links.="$pn"; else $page_links.=" $pn "; } if($type==1)return "$previous ( "._PN_PAGE." ".($page)." "._PN_OF." ".ceil($count/$display)." ) $next"; return "
$first $previous $page_links $next $last
"; } } //datacase class Class Database { var $rs=false; function setQuery($str) { global $conn; $this->rs=false; $this->rs=$conn->Execute($str); } function loadResult() { $row=$this->rs->GetArray(); if(!$row)return false; //return $row[0]; } function loadObjectList() { $rs=array(); foreach($this->rs->GetArray() as $row) { $obj=new stdClass(); foreach($row as $var=>$val) { $obj->$var = $val; } $rs[]=$obj; } return $obj; } } //Limbots ( something like mambots ) class LimbotHandler { var $_events=null; var $_lists=null; var $_bots=null; var $_loading=null; function LimbotHandler() { $this->_events = array(); } function loadBotGroup( $group , $sectionid='') { global $conn,$lm_absolute_path,$access_sql; global $_LIMBOTS; $rs= $conn->Execute( "SELECT id,type,element,showon,access,ordering,published FROM #__limbots WHERE type='$group' AND published=1 $access_sql ORDER BY ordering ASC"); if(!$rs || $rs->RecordCount()<=0 )return false; $bots=$rs->GetArray(); foreach($bots as $bot) { $path = $lm_absolute_path . '/limbots/' . $bot['element'] .'.php'; if (file_exists( $path ) && ($bot['showon']=='' || strstr($bot['showon'],'_'.$sectionid.'_') || strstr($bot['showon'],'_0_')) ) { $this->_bots[] = $bot; require_once( $path ); } } return true; } function registerFunction( $event, $function ) { $this->_events[$event][] = array( $function, $this->_loading ); } function getList( $group, $listName ) { return $this->_lists[$group][$listName]; } function trigger( $event, $args=null) { $result = array(); if ($args === null) { $args = array(); } if (isset( $this->_events[$event] )) { foreach ($this->_events[$event] as $func) { if (function_exists( $func[0] )) { $result[] = call_user_func_array( $func[0], $args ); } } } return $result; } } $database = new Database(); $_LIMBOTS=new LimbotHandler(); ?>