fromString($xml_data); $rootEl =& $parsedDoc->getRoot(); $tinfo['id']=$dir_name; foreach($req as $var=>$val ){ $obj = $rootEl->getElementByPath($val); //echo $obj->getValue(); $tinfo[$var]=$obj->getValue(); } $info[]=$tinfo; } } } closedir( $dh ); return $info; } function read_folder_xml($dir,$req) { $info=array(); $dh=opendir($dir); $info_file='';; while ( $file_name = readdir( $dh )) { if( $file_name=="." || $file_name==".." ) continue; if(strstr($file_name,".xml")){$info_file=$file_name; break; } } closedir($dh); if($info_file=="")return false; $tinfo=""; $fp=fopen("$dir/$info_file","r"); $xml_data=fread($fp,filesize("$dir/$info_file")); fclose($fp); $parsedDoc = new MiniXMLDoc(); $parsedDoc->fromString($xml_data); $rootEl =& $parsedDoc->getRoot(); $t_info['id']=str_replace(".xml","",$info_file); foreach($req as $var=>$val ){ $obj = $rootEl->getElementByPath($val); $tinfo[$var]=$obj->getValue(); } $info=$tinfo; return $info; } function read_file_xml($info_file,$req) { $info=array(); if(is_file($info_file)) { $tinfo=''; $fp=fopen($info_file,"r"); $xml_data=fread($fp,filesize($info_file)); fclose($fp); $parsedDoc = new MiniXMLDoc(); $parsedDoc->fromString($xml_data); $rootEl =& $parsedDoc->getRoot(); //$tinfo['id']=$dir_name; foreach($req as $var=>$val ){ $obj = $rootEl->getElementByPath($val);//echo $obj->getValue(); $tinfo[$var]=$obj->getValue(); } $info=$tinfo; }else return false; return $info; } function lr_array($select='left') { $pos_array=array(array("name"=>_MODULES_POS_LEFT,"value"=>"left"),array("name"=>_MODULES_POS_RIGHT,"value"=>"right")); return select($pos_array,$select); } /* Various interrface arrays*/ function category_array($category='',$select=0) { global $conn; $rs=$conn->Execute("SELECT id,title FROM #__categories WHERE section = '$category'"); $rsa=$rs->GetArray(); $cat_arr=array(); if($select!=-1)$cat_arr[]=array("name"=>_CMN_SELECTCAT,"value"=>""); foreach($rsa as $row)$cat_arr[]=array("name"=>$row['title'],"value"=>$row['id']); return select($cat_arr,$select); } function select_array($directory='',$default='None',$select=0,$type='file') { global $lm_absolute_path; $img_arr=array(); if($default!=-1)$img_arr=array(array("name"=>$default,"value"=>"")); $file_arr=read_dir($lm_absolute_path.$directory,$type); foreach($file_arr as $var)$img_arr[]=array("name"=>$var,"value"=>$var); return select($img_arr,$select); } function pos_array($default='left') { $pos_array=array(array("name"=>_MODULES_POS_LEFT,"value"=>"left"),array("name"=>_MODULES_POS_RIGHT,"value"=>"right")); return select($pos_array,$default); } $access_level=array(array("name"=>_USERS_GRP_0,"value"=>"0"),array("name"=>_USERS_GRP_1,"value"=>"1")); function access_array($default=0) { global $access_level; return select($access_level,$default); } function insert_published($data,$key,$id) { for($i=0;$iExecute($sql); if(!$rs)return 0; $rsa=$rs->GetArray(); return $rsa[0]['ordering']; } function array_replace($data,$rep_array) { for($i=0;$i$val) { if(isset($data[$i][$var])) { foreach($val as $kvar=>$kval){ if($kval['value']==$data[$i][$var]){$data[$i]["o".$var]=$data[$i][$var];$data[$i][$var]=$kval['name']; break;} } } } } return $data; } // recursively delete a directory function purge($dir) { $handle = opendir($dir); $noerror = true; while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { if (is_dir($dir.$file)) { purge ($dir.$file."/"); if(!rmdir($dir.$file)){$noerror = false;} } else if(!unlink($dir.$file)){$noerror = false;} } } closedir($handle); return $noerror; } function deldir($dir) { if(purge($dir)){ rmdir($dir); return true; } else return false; } function xcopy($basedir,$txtFolderName,$action){ if ($handle = @opendir($basedir)) { while (false !== ($dir = readdir($handle))){ if ($dir != '.' && $dir != '..'){ if (is_dir($basedir."/".$dir)){ $mkSuccess = mkdir($txtFolderName."/".$dir,0777); xcopy($basedir."/".$dir,$txtFolderName."/".$dir,$action); if($action=="cut")purge($basedir."/".$dir); } else{ copy($basedir."/".$dir, $txtFolderName."/".$dir); if($action=="cut")unlink($basedir."/".$dir); } } } closedir($handle); } } function getPerms( $in_Perms ) { $sP= ''; // owner $sP .= (($in_Perms & 0x0100) ? 'r' : '−') . (($in_Perms & 0x0080) ? 'w' : '−') . (($in_Perms & 0x0040) ? (($in_Perms & 0x0800) ? 's' : 'x' ) : (($in_Perms & 0x0800) ? 'S' : '−')); // group $sP .= (($in_Perms & 0x0020) ? 'r' : '−') . (($in_Perms & 0x0010) ? 'w' : '−') . (($in_Perms & 0x0008) ? (($in_Perms & 0x0400) ? 's' : 'x' ) : (($in_Perms & 0x0400) ? 'S' : '−')); // world $sP .= (($in_Perms & 0x0004) ? 'r' : '−') . (($in_Perms & 0x0002) ? 'w' : '−') . (($in_Perms & 0x0001) ? (($in_Perms & 0x0200) ? 't' : 'x' ) : (($in_Perms & 0x0200) ? 'T' : '−')); return $sP; } function split_sql($sql) { $sql = trim($sql); $sql = ereg_replace("\n#[^\n]*\n", "\n", $sql); $buffer = array(); $ret = array(); $in_string = false; for($i=0; $i'jpg','jpg'=>'jpg','gif'=>'gif','png'=>'png'); foreach($img_type as $var=>$val) { if( strpos($str,$var)==(strlen($str)-strlen($var)) ) return $val; } return false; } function not_auth() { echo _USERS_NAUTH; return; } function show_help($file=false) { global $com_option,$option,$task,$lm_absolute_path,$lm_website,$menutype; if(!$file) { $file= isset($com_option)?"$com_option.help.html":""; $jump=(isset($option) && $option!="")?"$option":""; $jump.=(isset($menutype) && $menutype!="")?"menutype":""; $jump.=(isset($task) && $task!="")?"$task":""; $jump="#".$jump; } $file= "admin/components/com_$com_option/".$file; $showfile=is_file($lm_absolute_path.$file)?$lm_website.$file.$jump:$lm_website."admin/help/error.html"; return ' '; } ?>