Ejemplo n.º 1
0
 static function readProcessList()
 {
     $list = lscandir("/proc");
     foreach ($list as $pid) {
         if (is_numeric($pid) && $pid[0] != ".") {
             $cmdlinearr = lfile("/proc/" . $pid . "/cmdline");
             $return[$pid]['nname'] = $pid;
             if (!$cmdlinearr) {
                 unset($return[$pid]);
                 continue;
             }
             $cmdline = $cmdlinearr[0];
             $cmdline = preg_replace('+\\0+i', " ", $cmdline);
             $return[$pid]["command"] = substr($cmdline, 0, 100);
             if (csa($cmdline, "display.php") && csa($cmdline, "kloxo")) {
                 unset($return[$pid]);
                 continue;
             }
             $arr = lfile("/proc/" . $return[$pid]["nname"] . "/status");
             foreach ($arr as $a) {
                 if (csb($a, "State:")) {
                     $a = trim($a);
                     $a = strtil($a, "(");
                     $a = strfrom($a, "State:");
                     $a = trim($a);
                     $return[$pid]["state"] = $a;
                     $return[$pid]["state"] = $return[$pid]["state"] === "S" ? "ZZ" : $return[$pid]["state"];
                 }
                 if (csa($a, "Uid")) {
                     $uidarr = explode(":", $a);
                     $value = trimSpaces($uidarr[1]);
                     $uidarr2 = explode(" ", $value);
                     $uid = trim($uidarr2[1]);
                     $pwd = posix_getpwuid($uid);
                     $username = $pwd['name'];
                     $return[$pid]["username"] = $username;
                 }
                 if (csa($a, "VmSize")) {
                     $uidarr = explode(":", $a);
                     $uidarr = trimSpaces($uidarr[1]);
                     $uidarr = strtilfirst($uidarr, " ");
                     $return[$pid]['memory'] = round($uidarr / 1024, 2);
                 }
             }
         }
     }
     return $return;
 }
Ejemplo n.º 2
0
 static function generateGraph($oldtime, $newtime)
 {
     $convertedfile = self::convertfile($oldtime, $newtime);
     if (!$convertedfile) {
         return;
     }
     $list = lscandir("__path_mail_root/domains");
     foreach ($list as $l) {
         if (csb($l, "lists.")) {
             continue;
         }
         $total = self::getmail_usage($convertedfile, $l, $oldtime, $newtime);
         execRrdSingle("mailtraffic", "ABSOLUTE", $l, $total * 1024 * 1024);
     }
     lunlink($convertedfile);
 }
function csp_po_get_plugin_mu_capabilities($plug, $values){
	$data = array();
	$data['locale'] = get_locale();
	$data['type'] = 'plugins_mu';	
	$data['img_type'] = 'plugins_mu';	
	$data['type-desc'] = __('μ Plugin',CSP_PO_TEXTDOMAIN);	
	$data['name'] = $values['Name'];
	$data['author'] = $values['Author'];
	$data['version'] = $values['Version'];
	$data['description'] = $values['Description'];
	$data['status'] = __("activated",CSP_PO_TEXTDOMAIN);
	$data['base_path'] = str_replace("\\","/", WPMU_PLUGIN_DIR.'/'.dirname($plug).'/');
	$data['special_path'] = '';
	$data['filename'] = "";
	$data['is-simple'] = true;
	$data['is-path-unclear'] = false;
	$data['gettext_ready'] = false;
	$file = WPMU_PLUGIN_DIR.'/'.$plug;

	$const_list = array();
	$content = file_get_contents($file);
	if (preg_match("/load_(|plugin_)textdomain\s*\(\s*(\'|\"|)([\w\-_]+|[A-Z\-_]+)(\'|\"|)\s*(,|\))\s*([^;]+)\)/", $content, $hits)) {
		$data['textdomain'] = array('identifier' => $hits[3], 'is_const' => empty($hits[2]) );
		$data['gettext_ready'] = true;
		$data['php-path-string'] = $hits[6];
	}
	else if(preg_match("/load_(|plugin_)textdomain\s*\(/", $content, $hits)) {
		//ATTENTION: it is gettext ready but we don't realy know the textdomain name! Assume it's equal to plugin's name.
		//TODO: let's think about it in future to find a better solution.
		$data['textdomain'] = array('identifier' => substr(basename($plug),0,-4), 'is_const' => false );
		$data['gettext_ready'] = true;
		$data['php-path-string'] = '';			
	}
	if (!($data['gettext_ready'] && !$data['textdomain']['is_const'])) {
		if (preg_match_all("/define\s*\(([^\)]+)\)/" , $content, $hits)) {
			$const_list = array_merge($const_list, $hits[1]);
		}
	}

	if ($data['gettext_ready']) {
		
		if ($data['textdomain']['is_const']) {
			foreach($const_list as $e) {
				$a = split(',', $e);
				$c = trim($a[0], "\"' \t");
				if ($c == $data['textdomain']['identifier']) {
					$data['textdomain']['is_const'] = $data['textdomain']['identifier'];
					$data['textdomain']['identifier'] = trim($a[1], "\"' \t");
				}
			}
		}
		$data['filename'] = $data['textdomain']['identifier'];
	}		
	
	$data['languages'] = array();
	if($data['gettext_ready']){
		$tmp = array(); $files = lscandir(str_replace("\\","/",dirname(WPMU_PLUGIN_DIR.'/'.$plug)).'/', "/(.\mo|.po)$/", $tmp); 		
		foreach($files as $filename) {
			$file = str_replace(str_replace("\\","/",WPMU_PLUGIN_DIR).'/'.dirname($plug), '', $filename);
			preg_match("/".$data['filename']."-([a-z][a-z]_[A-Z][A-Z]).(mo|po)$/", $file, $hits);		
			if (empty($hits[2]) === false) {				
				$data['languages'][$hits[1]][$hits[2]] = array(
					'class' => "-".(is_readable($filename) ? 'r' : '').(is_writable($filename) ? 'w' : ''),
					'stamp' => date(__('m/d/Y H:i:s',CSP_PO_TEXTDOMAIN), filemtime($filename))." ".file_permissions($filename)
				);
				$data['special_path'] = '';
			}
		}
	}
	$data['base_file'] = (empty($data['special_path']) ? $data['filename'] : $data['special_path']."/".$data['filename']).'-';		
	return $data;
}
Ejemplo n.º 4
0
 function get_lpanel_file()
 {
     global $gbl, $sgbl, $login, $ghtml;
     $fpath = get_image_path() . "/";
     $path = getreal($fpath);
     $val = lscandir($path);
     return $val;
 }
Ejemplo n.º 5
0
function csp_po_get_bbpress_on_buddypress_capabilities($plug, $values)
{
    $data = array();
    $data['dev-hints'] = null;
    $data['deny_scanning'] = false;
    $data['locale'] = get_locale();
    $data['type'] = 'plugins';
    $data['img_type'] = 'buddypress-bbpress';
    $data['type-desc'] = __('bbPress', CSP_PO_TEXTDOMAIN);
    $data['name'] = "bbPress";
    $data['author'] = "<a href='http://bbpress.org/'>bbPress.org</a>";
    $data['version'] = '-n.a.-';
    $data['description'] = "bbPress is forum software with a twist from the creators of WordPress.";
    $data['status'] = is_plugin_active($plug) ? __("activated", CSP_PO_TEXTDOMAIN) : __("deactivated", CSP_PO_TEXTDOMAIN);
    $data['base_path'] = str_replace("\\", "/", WP_PLUGIN_DIR . '/' . dirname($plug) . '/bp-forums/bbpress/');
    if (!is_dir($data['base_path'])) {
        return false;
    }
    $data['special_path'] = '';
    $data['filename'] = "";
    $data['is-simple'] = false;
    $data['simple-filename'] = '';
    $data['is-path-unclear'] = false;
    $data['gettext_ready'] = true;
    $data['translation_template'] = null;
    $data['textdomain'] = array('identifier' => 'default', 'is_const' => false);
    $data['special_path'] = 'my-languages';
    $data['languages'] = array();
    $data['is_US_Version'] = !is_dir(str_replace("\\", "/", dirname(WP_PLUGIN_DIR . '/' . $plug)) . '/bp-forums/bbpress/my-languages');
    if (!$data['is_US_Version']) {
        $tmp = array();
        $files = lscandir(str_replace("\\", "/", dirname(WP_PLUGIN_DIR . '/' . $plug)) . '/bp-forums/bbpress/my-languages/', "/(\\.mo|\\.po|\\.pot)\$/", $tmp);
        $data['translation_template'] = csp_find_translation_template($files);
        foreach ($files as $filename) {
            $file = str_replace(str_replace("\\", "/", WP_PLUGIN_DIR) . '/' . dirname($plug), '', $filename);
            preg_match("/([a-z][a-z]_[A-Z][A-Z]).(mo|po)\$/", $file, $hits);
            if (empty($hits[2]) === false) {
                $data['languages'][$hits[1]][$hits[2]] = array('class' => "-" . (is_readable($filename) ? 'r' : '') . (is_writable($filename) ? 'w' : ''), 'stamp' => date(__('m/d/Y H:i:s', CSP_PO_TEXTDOMAIN), filemtime($filename)) . " " . file_permissions($filename));
            }
        }
    }
    $data['base_file'] = empty($data['special_path']) ? $data['filename'] : $data['special_path'] . "/";
    return $data;
}
Ejemplo n.º 6
0
function do_recurse_dir($dir, $func)
{
    $list = lscandir($dir);
    if (!$list) {
        return;
    }
    foreach ($list as $file) {
        if ($file === "." || $file === "..") {
            continue;
        }
        $path = $dir . "/" . $file;
        if (lis_dir($path)) {
            do_recurse_dir($path, $func);
        }
        $func($path);
    }
}
Ejemplo n.º 7
0
 static function getCurrentIps()
 {
     global $gbl, $sgbl, $login, $ghtml;
     $path = $sgbl->__path_real_etc_root . "sysconfig/network-scripts/";
     $flist = lscandir($path);
     foreach ($flist as $file) {
         if (char_search_a($file, "ifcfg-")) {
             $result1[] = self::getcontentsof($path . $file);
         }
     }
     $result = "";
     foreach ($result1 as $res) {
         $temp = explode(":", $res['devname']);
         if (count($temp) === 2) {
             $res['devname'] = implode("-", $temp);
         }
         $result[] = $res;
     }
     //dprintr($result);
     return $result;
 }