Beispiel #1
0
function get_entry($argc, $argv, $p)
{
    if ($argc < 4 || $argc > 7) {
        return FALSE;
    }
    if (get_args($argv, &$port, &$team, &$host) == FAlSE) {
        return FALSE;
    }
    if ($host == NULL && $argc != 5) {
        return FALSE;
    }
    if (isset($port) == TRUE && isset($team) == TRUE) {
        if (isset($host) == FALSE) {
            if ($p->init(1, $team, $port) == FALSE) {
                return FALSE;
            }
        } else {
            if ($p->init(1, $team, $port, $host) == FALSE) {
                return FALSE;
            }
        }
    } else {
        return FALSE;
    }
    return TRUE;
}
Beispiel #2
0
function parse_syscall_args($path)
{
    $file = file_get_contents($path);
    $tab = split("};", $file);
    foreach ($tab as $k => $v) {
        $tab_args[] = get_args($v);
        $tab_ret[] = get_ret_value($v);
    }
    $args = merge_args_ret($tab_args, $tab_ret, $tab_name);
    return $args;
}
Beispiel #3
0
/**
 * Parses arguments into commands/options and switches
 */
function parse_switches()
{
	$result=array();
	$args=array_slice(get_args(),1);
	$vals=array();
	for($i=0; $i<count($args);$i++)
		if(preg_match('#--([^=]*)(?:[=]*)(.*)#',$args[$i],$vals)==1)
			$result[$vals[1]]=($vals[2]=='') ? true : $vals[2];			

	return $result;
}
Beispiel #4
0
function main($argv)
{
    $time_start_all = microtime(true);
    $save = getcwd();
    $argument_list = get_args($argv);
    //print_r($argument_list);
    if ($argument_list == 0) {
        return 0;
    }
    if (isset($argument_list['argv']['clean'])) {
        if (chdir($_SERVER['TMPDIR']) == TRUE) {
            if (file_exists($_SERVER['TMPDIR'] . 'no_x')) {
                system("rm -R no_x");
                echo 'Succès de la suppression', "\n";
            } else {
                echo 'Echec de la suppression. Le dossier n\'éxiste peut être pas ?' . "\n";
            }
        } else {
            echo 'Echec de la suppression des fichiers temporaires' . "\n";
        }
        return 0;
    }
    $exist = false;
    chdir($_SERVER['TMPDIR']);
    if (!file_exists($_SERVER['TMPDIR'] . 'no_x')) {
        mkdir($_SERVER['TMPDIR'] . 'no_x');
    }
    chdir($_SERVER['TMPDIR'] . 'no_x/');
    if (!is_writable('~' . $argument_list['cible'] . '_' . $argument_list['source']) || !isset($argument_list['argv']['fast'])) {
        chdir($save);
        $list_dico = get_dico_array($time_start_message, $time_end_message, $argument_list['source']);
        $messages = get_message_array_and_display($sort_time_start, $sort_time_end, $time_end_all, $result, $time_start, $time_end, $time_start_display, $time_end_display, $argument_list['cible'], $list_dico);
        $time_end_all = microtime(true);
        $time = $time_end - $time_start;
        $time_all = $time_end_all - $time_start_all;
        $time_message = $time_end_message - $time_start_message;
        $time_display = $time_end_display - $time_start_display;
        $sort_time = $sort_time_end - $sort_time_start;
        result($sort_time, $time, $time_all, $time_message, $time_display);
        echo count($list_dico), ' valeurs trouve dans le dictionnaire.', "\n";
        echo $messages;
        cache_generator("~" . $argument_list['cible'] . '_' . $argument_list['source'], $result);
    } else {
        chdir($_SERVER['TMPDIR']);
        if (!file_exists($_SERVER['TMPDIR'] . 'no_x')) {
            mkdir($_SERVER['TMPDIR'] . 'no_x');
        }
        chdir($_SERVER['TMPDIR'] . 'no_x/');
        cache_receiver('~' . $argument_list['cible'] . '_' . $argument_list['source'], $select_time, $display_time);
        $time_end_all = microtime(true);
        $time_all = $time_end_all - $time_start_all;
        result_cache($select_time, $display_time, $time_all);
    }
}
Beispiel #5
0
//define ('cue_encoding', 'UTF-8');
//define ('cue_encoding', 'ISO-8859-1');
define('N', "\n");
define('T', "\t");
define('R', "\r");
print '[ ' . script_name . ' ]' . N . N;
// current dir (in use if not defined custom)
$pwd = getcwd();
// $path = dirname(__FILE__);
// for function check_args
$allowed_args = array('/^-h$/', '/^-v$/', '/^-vv$/', '/^-r$/', '/^-f$/', '/^-ro$/', '/^-nl$/', '/^-tl$/', '/^-sf$/', '/^-st$/', '/^[\\w\\/~\\.а-я].*$/iu');
// for function search_ext
$dany_folders = array('.', '..');
// for function search name on last.fm
$hide_realese_info = 'remaster|антология';
$args = get_args();
check_args();
$target = isset($args['path']) ? $args['path'] : $pwd;
$recurs = isset($args['-r']);
printvv(N . 'Путь к папке: ' . $target . N . N);
printvv(N . 'Рекурсивно: ' . ($recurs ? 'Да' : 'Нет') . N . N);
$apes = search_ext('ape', $target, $recurs);
printvv('Найдены файлы:' . N);
var_dump_vv($apes);
foreach ($apes as $ape_file) {
    printv(N);
    printv('Обрабатываем файл: ' . $ape_file . N);
    /*if (($cue = search_cue($ape_file)))
    	{
    		printv(N);
    		printv('Найден файл: ' . $cue . N);*/
Beispiel #6
0
#!/usr/bin/env php
<?php 
require_once dirname(dirname(dirname(__FILE__))) . '/init_env.php';
$opt = get_args('p:', ['ts'], [['p']], 'give me path by -p');
$config = isset($opt['ts']) ? Da\Sys_Config::two_step_conf($opt['p']) : Da\Sys_Config::config($opt['p']);
p($opt['p'], $config);
Beispiel #7
0
if (get_args("add")) {
    $sql = "select * from {$t_backgroup} where gid='{$id}'";
    $group = $dbo->getRow($sql);
    if (!$group) {
        $sql = "insert into {$t_backgroup}(gid,name)values('{$id}','{$value}')";
        $dbo->exeUpdate($sql);
    } else {
        echo $ri_langpackage->ri_isset_id;
        exit;
    }
} else {
    if (get_args('del') == 'del') {
        $sql = "delete from {$t_backgroup} where gid='{$id}'";
        $dbo->exeUpdate($sql);
    } else {
        if (get_args('update')) {
            $sql = "update {$t_backgroup} set name='{$value}' where gid='{$id}'";
            $dbo->exeUpdate($sql);
        }
    }
}
$sql = "select * from {$t_backgroup}";
$elements = $dbo->getRs($sql);
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link rel="stylesheet" type="text/css" media="all" href="../css/admin.css">
    }
    $xml->save($xmlpath);
} else {
    if (get_args('updgroup')) {
        $id = get_args('id');
        $value = get_args('value');
        $xml->updAttr("//group[@id='{$id}']", "value", $value);
        $xml->save($xmlpath);
    }
}
$groups = $xml->query("//group");
if (get_args('submit')) {
    $group_id = get_args('group');
    $id = get_args('id');
    $value = get_args('value');
    if (get_args('op') == 'upd') {
        if (!$xml->query("//group[@id='{$group_id}']/resource[@id='{$id}']")) {
            $xml->delNode("//resource[@id='{$id}']");
            $xml->addNode("//group[@id='{$group_id}']", "resource", "", "id={$id};value={$value}");
        } else {
            $xml->updAttr("//resource[@id='{$id}']", "value", $value);
        }
        $xml->save($xmlpath);
    } else {
        if ($id && $value && strlen($id) == 3) {
            if (!$xml->query("//resource[@id='{$id}']")) {
                if ($xml->addNode("//group[@id='{$group_id}']", "resource", "", "id={$id};value={$value}")) {
                    $xml->save($xmlpath);
                }
            } else {
                echo "资源ID已经存在!";
Beispiel #9
0
     } else {
         $sql = "update {$t_admin} set admin_group='{$group}' where admin_id='{$admin_id}'";
     }
     $dbo->exeUpdate($sql);
 } else {
     if (get_args('op') == 'lock') {
         $id = get_args('id');
         dbtarget('w', $dbServs);
         $sql = "update  {$t_admin} set is_pass=if(is_pass=1,0,1) where admin_id={$id}";
         $dbo->exeUpdate($sql);
     } else {
         if (get_args('op') == 'add') {
             $name = get_args('name');
             $password = md5(get_args('password'));
             $repassword = md5(get_args('repassword'));
             $group = get_args('group');
             if ($name && $password && $group) {
                 if ($password == $repassword) {
                     dbtarget('r', $dbServs);
                     $sql = "select * from {$t_admin} where admin_name='{$name}'";
                     $admin = $dbo->getRow($sql);
                     if (!$admin) {
                         dbtarget('w', $dbServs);
                         $sql = "insert into {$t_admin} (admin_name,admin_password,active_time,admin_group) values('{$name}','{$password}',now(),'{$group}')";
                         $dbo->exeUpdate($sql);
                     } else {
                         echo $ri_langpackage->ri_isset_user;
                     }
                 } else {
                     echo "<script>alert('" . $p_langpackage->p_differ . "')</script>";
                 }
Beispiel #10
0
    if (file_exists($imgpath)) {
        $filesize = abs(filesize($imgpath));
        if ($filesize == 0) {
            unlink($imgpath);
        }
    }
    if (!file_exists($imgpath)) {
        exec("{$engine} -e \"set term png;set output '{$imgpath}'\" {$codepath}", $out, $res);
        if ($res != 0) {
            $ret['imgpath'] = $config['error'];
            $ret['imgtype'] = "png";
        }
    }
    return $ret;
}
$api = get_args();
write_code($api);
$arr = explode(':', $api['cht']);
switch ($arr[0]) {
    case "gv":
        if (array_key_exists("1", $arr)) {
            $api['engine'] = $arr[1];
        } else {
            $api['engine'] = "dot";
        }
        $plot = graphviz($api);
        break;
    case "gp":
        $api['engine'] = "gnuplot";
        $plot = gnuplot($api);
        break;
Beispiel #11
0
function get_args($tokens, $i) {
    $args = array();
    do {
        if (!is_string($tokens[$i])) {
            if ($tokens[$i][0] == T_CONSTANT_ENCAPSED_STRING or
                    $tokens[$i][0] == T_LNUMBER) {
                $args[] = eval("return({$tokens[$i][1]});");
            } elseif ($tokens[$i][0] == T_ARRAY) {
                list($i, $args1) = get_args($tokens, ++$i);
                $args[] = $args1;
            }
        }
        $i++;
    } while ($tokens[$i] != ')');
    return array($i, $args);
}
Beispiel #12
0
require "session_check.php";
$is_check = check_rights("d03");
if (!$is_check) {
    echo $m_langpackage->m_no_pri;
    exit;
}
$pl_langpackage = new pluginslp();
$plugin_table = $tablePreStr . "plugins";
$t_plugin_url = $tablePreStr . "plugin_url";
$t_backgroup = $tablePreStr . "backgroup";
$t_frontgroup = $tablePreStr . "frontgroup";
$plugin_base = dirname(__FILE__) . "/../plugins";
require_once dirname(__FILE__) . "/../foundation/cxmloperator.class.php";
require_once dirname(__FILE__) . "/../foundation/ftpl_compile.php";
$path = get_args('path');
?>
	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
	<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title></title>
</head>
<body style="text-align:center">
	<div style="width:100%" >
<?php 
if (!is_null($path)) {
    //检测是不是有数据库文件
    $create_tables = "{$plugin_base}/{$path}/plugin_create_tables.php";
    $dbo = new dbex();
    dbtarget('w', $dbServs);
Beispiel #13
0
<?php

//引入语言包
$a_langpackage = new albumlp();
//变量取得
$photo_id = intval(get_args('photo_id'));
$information = long_check(get_argp('information_value'));
$user_id = get_sess_userid();
//数据表定义区
$t_photo = $tablePreStr . "photo";
$dbo = new dbex();
//读写分离定义函数
dbtarget('w', $dbServs);
//更改图片信息
$sql = "update {$t_photo} set photo_information='{$information}' where photo_id={$photo_id} and user_id={$user_id}";
$dbo->exeUpdate($sql);
echo filt_word($information);
Beispiel #14
0
 $sqlpath = $dom->createElement("sqlpath", get_args('sqlpath'));
 $plugin->appendChild($sqlpath);
 if (preg_match("/^([^:]+:[^,]+[,]?)*\$/i", get_args('backrights'))) {
     $backrights = $dom->createElement("backrights", get_args('backrights'));
     $plugin->appendChild($backrights);
 } else {
     $check_flag = false;
 }
 if (preg_match("/^([^:]+:[^,]+[,]?)*\$/i", get_args('frontrights'))) {
     $frontrights = $dom->createElement("frontrights", get_args('frontrights'));
     $plugin->appendChild($frontrights);
 } else {
     $check_flag = false;
 }
 $urls = get_args("urls");
 $urlids = get_args("urlids");
 if (count($urls) > 0) {
     $urlsxml = $dom->createElement("urls");
     for ($i = 0; $i < count($urls); $i++) {
         if ($urls[$i] != "") {
             $urlxml = $dom->createElement("url", $urls[$i]);
             $urlxml->setAttribute("id", $urlids[$i]);
             $urlsxml->appendChild($urlxml);
         }
     }
     $plugin->appendChild($urlsxml);
 }
 $dom->appendChild($plugin);
 if ($check_flag) {
     $dom->formatOutput = true;
     $dom->save("plugin.xml");
Beispiel #15
0
<?php

ob_implicit_flush(true);
define('FRAMEWORK_ROOT', substr(__FILE__, 0, -24) . 'framework' . DIRECTORY_SEPARATOR);
$project_types = array('web');
$argmap = array('name' => array('short' => 'n', 'required' => true), 'path' => array('short' => 'p', 'required' => true), 'type' => array('short' => 't', 'default' => 'web', 'required' => true), 'charset' => array('short' => 'c', 'default' => 'utf-8', 'required' => true), 'deploydir' => array('short' => 'd', 'default' => array('web' => './www'), 'required' => true));
$input_args = get_args();
$args = check_args($input_args, $argmap);
if (!is_dir($args['path'])) {
    throw new Exception(sprintf('%s isn\'t a dir', $args['path']));
}
$project_dir = trim($args['path'], '/\\') . DIRECTORY_SEPARATOR . $args['name'] . DIRECTORY_SEPARATOR;
if (is_dir($project_dir)) {
    throw new Exception(sprintf('%s is already existed', $project_dir));
}
if (!mkdir($project_dir)) {
    throw new Exception(sprintf('can\'t create dir %s', $project_dir));
}
if (!in_array($args['type'], $project_types)) {
    throw new Exception(sprintf('incognizant project type %s', $args['type']));
}
$deploydir = is_array($args['deploydir']) ? $args['deploydir'][$args['type']] : $args['deploydir'];
$deploydir = 0 === strpos($deploydir, './') ? $project_dir . substr($deploydir, 2) : $deploydir;
$deploydir = trim($deploydir, '/\\') . DIRECTORY_SEPARATOR;
if (is_dir($deploydir)) {
    throw new Exception(sprintf('%s is already existed', $deploydir));
}
if (!mkdir($deploydir)) {
    throw new Exception(sprintf('can\'t create deploy dir %s', $deploydir));
}
copy_dir("./template/{$args['type']}/project", $project_dir);
Beispiel #16
0
require dirname(__FILE__) . "/../session_check.php";
require_once dirname(__FILE__) . "/../../foundation/cxmloperator.class.php";
$ri_langpackage = new rightlp();
$ad_langpackage = new adminmenulp();
if (get_session('admin_group') != 'superadmin') {
    echo $ri_langpackage->ri_refuse;
    exit;
}
$dbo = new dbex();
$t_backgroup = $tablePreStr . "backgroup";
$gid = get_args('gid');
if (get_args('action')) {
    dbtarget('w', $dbServs);
    $sql = "update {$t_backgroup} set rights='' where gid='{$gid}'";
    if (!is_null(get_args('rights'))) {
        $sql = "update {$t_backgroup} set rights='" . implode(",", get_args('rights')) . "' where gid='{$gid}'";
    }
    $dbo->exeUpdate($sql);
    echo '<script type="text/javascript">window.location.href="group_manager.php";</script>';
}
dbtarget('r', $dbServs);
$sql = "select * from {$t_backgroup} where gid='{$gid}'";
$groups = $dbo->getRow($sql);
$group = $groups['rights'];
$rights = explode(",", $group);
$rights = array_flip($rights);
$dom = new DOMDocument();
$dom->load("resources/resources.xml");
$classes = $dom->getElementsByTagName("group");
$dom_plugin = new DOMDocument();
$dom_plugin->load($webRoot . "plugins/resources.xml");
Beispiel #17
0
<?php

require_once dirname(dirname(__FILE__)) . '/init_env.php';
$opt = get_args('f:', ['2json', '2sp'], [['f']], 'CMD -f $tsv_file');
$source_file = new Lib_SourceFile($opt['f']);
foreach ($source_file as $_k => $_s) {
    if (isset($opt['2json'])) {
        echo json_encode($_s['data']);
        echo PHP_EOL;
    } elseif (isset($opt['2sp'])) {
        echo serialize($_s['data']);
        echo PHP_EOL;
    } else {
        p($_s);
    }
}
if (!isset($opt['2json']) && !isset($opt['2sp'])) {
    p($source_file->current_line_no());
}
Beispiel #18
0
/* Format new */
foreach($new as $name => $el)
{
    unset($new[$name]);
    $name = clean_func($el["func"]);
    
    $new[$name] = array(
                    "group" => array($el["group"]),
                    "description" => array("")
    );
    
    if(strlen($el["cond"]) > 2)
        $new[$name]["conditions"][0] = $el["cond"];
    
    $args = get_args($el["func"]);
    if(count($args) > 0)
    {
        foreach($args as $n => $arg)
        {
            $tmp = split_var($arg);
            $args[$n] = $tmp[1];
        }
        $new[$name]["param"] = $args;
    }
    
    if(get_return($el["func"]) !== false)
        $new[$name]["return"][0] = "";
}

/* Compare and merge both */
Beispiel #19
0
require "session_check.php";
$is_check = check_rights("d02");
if (!$is_check) {
    echo $m_langpackage->m_no_pri;
    exit;
}
require_once dirname(__FILE__) . "/../foundation/cxmloperator.class.php";
require_once dirname(__FILE__) . "/../foundation/ftpl_compile.php";
$plugin_table = $tablePreStr . "plugins";
$t_plugin_url = $tablePreStr . "plugin_url";
$name = get_args('path');
$opsition_value = get_args('opsition');
$valid_value = get_args('valid');
$autoorder_value = get_args('autoorder');
$submited = get_args("submited");
$type = get_args('type');
if (is_null($valid_value)) {
    $valid_value = 0;
}
if (is_null($autoorder_value)) {
    $autoorder_value = 0;
}
?>
	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
	<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title></title>
	<link rel="stylesheet" type="text/css" media="all" href="css/admin.css">
</head>
Beispiel #20
0
# %BR%
# =code=

MOO;

foreach(get_newest() as $line)
{
    echo "\n".clean_func($line["func"])."\n";

    if(strlen($line["group"]) > 0)
        echo "    \\group ".$line["group"]."\n";

    if(strlen($line["cond"]) > 2)
        echo "    \\conditions "._simplify($line["cond"])."\n";

    foreach(get_args($line["func"]) as $param)
    {
        if(strlen($param) > 0 && $param != "...")
        {
            $param = split_var($param);
            $param = $param[1];
            echo "    \\param $param\n";
        }
    }

    if(get_return($line["func"]) !== false)
        echo "    \\return\n";

    echo "    \\description\n";
}
Beispiel #21
0
<?php

include dirname(__FILE__) . "/../foundation/fgetandpost.php";
$do = get_args("do");
$action = explode("_iweb_", $do);
if (count($action) == 2) {
    include "Actions.php";
    $actions = Actions::getInstance($action[0]);
    $actions->doAction($action[1]);
}
Beispiel #22
0
$groups = $dbo->getRs($sql);
$options = "<option value=\"\" selected>" . $ri_langpackage->ri_choose . "</option>";
$group_array = array();
if ($groups) {
    foreach ($groups as $group) {
        $selected = '';
        if ($user_group == $group['gid']) {
            $selected = 'selected';
        }
        $options .= '<option value="' . $group['gid'] . '" ' . $selected . '>' . $group['name'] . '</option>';
        $group_array[$group['gid']] = $group['name'];
    }
}
if (get_args("op") == 'upd') {
    $group = get_args('group');
    $user_id = intval(get_args('user_id'));
    $sql = "update {$t_users} set user_group='{$group}' where user_id='{$user_id}'";
    $dbo->exeUpdate($sql);
}
//当前页面参数
$page_num = trim(get_argg('page'));
$sql = '';
$eq_array = array('user_id', 'user_group');
$like_array = array("user_name");
$date_array = array();
$num_array = array();
$sql = spell_sql($t_users, $eq_array, $like_array, $date_array, $num_array, '', '', '');
//设置分页
$dbo->setPages(20, $page_num);
//取得数据
$member_rs = $dbo->getRs($sql);
Beispiel #23
0
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" media="all" href="css/admin.css">
<title></title>
</head>
<body style="text-align:center">
	<div style="width:100%;text-align:left" id="show" >
<?php 
$dbo = new dbex();
if (!is_null(get_args('operator')) && get_args('operator') == 'update') {
    dbtarget('w', $dbServs);
    $valid = get_args('valid');
    $autoorder = get_args('autoorder');
    if (is_null($valid)) {
        $valid = 0;
    }
    if (is_null($autoorder)) {
        $autoorder = 0;
    }
    $sql = "update {$plugin_table} set autoorder={$autoorder},valid={$valid} where name='{$path}'";
    if ($dbo->exeUpdate($sql) !== false) {
        comp_plugins_position();
        echo "<script>parent.Dialog.alert('" . $pl_langpackage->pl_update_suc . "')</script>";
    } else {
        echo "<script>parent.Dialog.alert('" . $pl_langpackage->pl_update_false . "')</script>";
    }
}
if (!is_null($path)) {
Beispiel #24
0
<?php

require_once dirname(dirname(__FILE__)) . '/init_env.php';
$opt = get_args('c:m:a:', ['static'], [['c', 'm']], 'USAGE: CMD -c class -m method [--static]');
$args = isset($opt['a']) ? explode(',', $opt['a']) : [];
$r = isset($opt['static']) ? call_user_func_array([$opt['c'], $opt['m']], $args) : call_user_func_array([new $opt['c'](), $opt['m']], $args);
p($r);