Example #1
0
    public static function uninstall()
    {
        global $db, $setting, $admin_cat;
        $info = self::info();
        $db->delete($setting['db']['pre'] . "news_mark");
        $db->exec("drop", "table", $setting['db']['pre'] . "news_mark");
        $db->delete($setting['db']['pre'] . "admin_cat", array("file", "=", "news_mark.php"));
        $db->delete($setting['db']['pre'] . "plugin", array("idx", "=", $info['idx']));
        deleteCache("admin_cat");
        deleteCache("plugin");
        $err = array();
        if ($db->GetError($err)) {
            showInfo($setting['language']['plugin_err_uninstall'] . "\r\n\t\t\t<br />\r\n\t\t\t<pre>\r\n\t\t\t" . join("\n------------------------\n", $err) . "\r\n\t\t\t</pre>\r\n\t\t\t");
        } else {
            includeCache("admin_cat");
            $admin_cat = toJson($admin_cat, $setting['gen']['charset']);
            echo <<<mystep
<script language="javascript">
parent.admin_cat = {$admin_cat};
parent.setNav();
</script>
mystep;
            buildParaList("plugin");
            echo showInfo($setting['language']['plugin_uninstall_done'], false);
        }
    }
Example #2
0
function build_page($method)
{
    global $mystep, $req, $db, $tpl, $tpl_info, $setting, $id, $web_id;
    $tpl_info['idx'] = "art_info_" . ($method == "list" ? "list" : "input");
    $tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info);
    if ($method == "list") {
        $condition = array();
        if (!empty($web_id)) {
            $condition = array("web_id", "n=", $web_id);
        }
        $db->select($setting['db']['pre'] . "info_show", "*", $condition, array("order" => "id asc"));
        $n = 0;
        while ($record = $db->GetRS()) {
            $n++;
            if ($webInfo = getParaInfo("website", "web_id", $record['web_id'])) {
                $record['web_id'] = $webInfo['name'];
            } else {
                $record['web_id'] = "ALL";
            }
            $tpl_tmp->Set_Loop('record', $record);
        }
        $tpl_tmp->Set_If('empty', $n == 0);
        $tpl_tmp->Set_Variable('title', $setting['language']['admin_art_info_title']);
        $tpl_tmp->Set_Variable('web_id', $web_id);
    } else {
        if ($method == "edit") {
            $record = $db->record($setting['db']['pre'] . "info_show", "*", array("id", "n=", $id));
            if ($record === false) {
                $tpl->Set_Variable('main', showInfo($setting['language']['admin_art_info_error'], 0));
                $mystep->show($tpl);
                $mystep->pageEnd(false);
            }
            $web_id = $record['web_id'];
            HtmlTrans(&$record);
        } else {
            $record = array();
            $record['id'] = 0;
            $record['web_id'] = $web_id;
            $record['subject'] = "";
            $record['content'] = "";
            $record['attach_list'] = "|";
        }
        $tpl_tmp->Set_Variables($record);
        $Max_size = round(GetFileSize(ini_get('upload_max_filesize')) / 1024 / 1024, 2);
        $tpl_tmp->Set_Variable('title', $method == 'add' ? $setting['language']['admin_art_info_add'] : $setting['language']['admin_art_info_edit']);
        $tpl_tmp->Set_Variable('method', $method);
        $tpl_tmp->Set_Variable('MaxSize', $Max_size);
        $tpl_tmp->Set_Variable('back_url', $req->getServer("HTTP_REFERER"));
    }
    $max_count = count($GLOBALS['website']);
    for ($i = 0; $i < $max_count; $i++) {
        $GLOBALS['website'][$i]['selected'] = $GLOBALS['website'][$i]['web_id'] == $web_id ? "selected" : "";
        $tpl_tmp->Set_Loop("website", $GLOBALS['website'][$i]);
    }
    $db->Free();
    $tpl->Set_Variable('main', $tpl_tmp->Get_Content('$db, $setting'));
    unset($tpl_tmp);
    $mystep->show($tpl);
    return;
}
Example #3
0
    public static function uninstall()
    {
        global $db, $setting, $admin_cat, $mystep;
        $info = self::info();
        $db->delete($setting['db']['pre'] . "admin_cat", array("file", "=", "xcode.php"));
        $db->delete($setting['db']['pre'] . "plugin", array("idx", "=", $info['idx']));
        deleteCache("admin_cat");
        deleteCache("plugin");
        $err = array();
        if ($db->GetError($err)) {
            showInfo($setting['language']['plugin_err_uninstall'] . "\r\n\t\t\t<br />\r\n\t\t\t<pre>\r\n\t\t\t" . join("\n------------------------\n", $err) . "\r\n\t\t\t</pre>\r\n\t\t\t");
        } else {
            $mydb = $mystep->getInstance("MyDB", "code", dirname(__FILE__));
            $record = $mydb->queryAll();
            for ($i = 0; $i < count($record); $i++) {
                unlink(dirname(__FILE__) . "/code/" . $record[$i]['idx'] . ".php");
            }
            $mydb->emptyTBL();
            unset($mydb);
            includeCache("admin_cat");
            $admin_cat = toJson($admin_cat, $setting['gen']['charset']);
            echo <<<mystep
<script language="javascript">
parent.admin_cat = {$admin_cat};
parent.setNav();
</script>
mystep;
            buildParaList("plugin");
            echo showInfo($setting['language']['plugin_uninstall_done'], false);
        }
    }
Example #4
0
    public static function uninstall()
    {
        global $db, $setting, $admin_cat;
        $info = self::info();
        $db->delete($setting['db']['pre'] . "survey");
        $db->exec("drop", "table", $setting['db']['pre'] . "survey");
        $db->delete($setting['db']['pre'] . "admin_cat", array("file", "like", "survey.php%"));
        $db->delete($setting['db']['pre'] . "plugin", array("idx", "=", $info['idx']));
        deleteCache("admin_cat");
        deleteCache("plugin");
        $err = array();
        if ($db->GetError($err)) {
            showInfo($setting['language']['plugin_err_uninstall'] . "\r\n\t\t\t<br />\r\n\t\t\t<pre>\r\n\t\t\t" . join("\n------------------------\n", $err) . "\r\n\t\t\t</pre>\r\n\t\t\t");
        } else {
            includeCache("admin_cat");
            $admin_cat = toJson($admin_cat, $setting['gen']['charset']);
            echo <<<mystep
<script language="javascript">
parent.admin_cat = {$admin_cat};
parent.setNav();
</script>
mystep;
            MultiDel(ROOT_PATH . "/" . $setting['path']['cache'] . "/plugin/survey/");
            MultiDel(dirname(__FILE__) . "/data/");
            MakeDir(dirname(__FILE__) . "/data/");
            buildParaList("plugin");
            echo showInfo($setting['language']['plugin_uninstall_done'], false);
        }
    }
Example #5
0
function info_body()
{
    $id = 1;
    function showInfo($cmd)
    {
        global $id;
        ?>
<div class="info_frame">
<a href="#" onclick="look('l_<?php 
        echo $id;
        ?>
','t_<?php 
        echo $id;
        ?>
')"><div id="t_<?php 
        echo $id;
        ?>
" class="info_topic"><?php 
        echo $cmd;
        ?>
</div></a>
<div id="l_<?php 
        echo $id;
        ?>
" class="info_list"><pre>
<?php 
        exec($cmd, $lines);
        foreach ($lines as $s) {
            echo "{$s}\n";
        }
        $id += 1;
        ?>
</pre></div></div><br />
<?php 
    }
    ?>
<div id="container">
<h3><?php 
    echo getMsg('coreInfo');
    ?>
</h3>
<?php 
    showInfo("/bin/uname -a");
    showInfo("cat /proc/cpuinfo");
    showInfo("cat /proc/meminfo");
    showInfo("/sbin/lsmod");
    showInfo("/bin/ps -w");
    showInfo("/bin/dmesg");
    showInfo("/bin/busybox");
    showInfo("cat /proc/mounts");
    showInfo("/bin/df -h");
    showInfo("/sbin/fdisk -l");
    showInfo("/sbin/ifconfig");
    showInfo("/sbin/route");
    showInfo("cat /etc/resolv.conf");
    showInfo("set");
    echo "</div>\n";
}
Example #6
0
function build_page($method)
{
    global $mystep, $req, $db, $setting, $id;
    $tpl_info = array("idx" => $method == "list" ? "list" : "input", "style" => "../plugin/" . basename(realpath(dirname(__FILE__))) . "/tpl/", "path" => ROOT_PATH . "/" . $setting['path']['template']);
    $tpl = $mystep->getInstance("MyTpl", $tpl_info);
    if ($method == "list") {
        $status = file_get_contents("status.txt");
        if ($status == "run") {
            $tpl->Set_Variable('status_info', $setting['language']['plugin_crontab_status_run']);
            $tpl->Set_Variable('status_link', "?method=stop");
            $tpl->Set_Variable('status_txt', $setting['language']['plugin_crontab_status_stop']);
        } else {
            $tpl->Set_Variable('status_info', $setting['language']['plugin_crontab_status_stop']);
            //$tpl->Set_Variable('status_link', "?method=start");
            $tpl->Set_Variable('status_link', 'javascript:crontab_start()');
            $tpl->Set_Variable('status_txt', $setting['language']['plugin_crontab_status_run']);
        }
        $db->select($setting['db']['pre'] . "crontab", "*", "", array("order" => "id desc"));
        while ($record = $db->GetRS()) {
            HtmlTrans(&$record);
            $tpl->Set_Loop('record', $record);
        }
        $db->Free();
        $tpl->Set_Variable('title', $setting['language']['plugin_crontab_title']);
    } else {
        if ($method == "edit") {
            $record = $db->record($setting['db']['pre'] . "crontab", "*", array("id", "n=", $id));
            if ($record === false) {
                $tpl->Set_Variable('main', showInfo($setting['language']['plugin_crontab_error'], 0));
                $mystep->show($tpl);
                $mystep->pageEnd(false);
            }
            HtmlTrans(&$record);
        } else {
            $record = array();
            $record['id'] = 0;
            $record['name'] = "";
            $record['mode'] = 1;
            $record['expire'] = "";
            $record['schedule'] = "0,0,1,0,0";
            $record['url'] = "";
            $record['code'] = "";
        }
        $record['send_date'] = date("Y-m-d H:i:s");
        $tpl->Set_Variables($record);
        $tpl->Set_Variable('title', $method == 'add' ? $setting['language']['plugin_crontab_add'] : $setting['language']['plugin_crontab_edit']);
        $tpl->Set_Variable('method', $method);
        $tpl->Set_Variable('back_url', $req->getServer("HTTP_REFERER"));
    }
    $tpl->Set_Variable('path_admin', $setting['path']['admin']);
    $db->Free();
    $mystep->show($tpl);
    return;
}
Example #7
0
 public static function uninstall()
 {
     global $db, $setting, $admin_cat;
     $info = self::info();
     $db->delete($setting['db']['pre'] . "plugin", array("idx", "=", $info['idx']));
     deleteCache("plugin");
     $err = array();
     if ($db->GetError($err)) {
         showInfo($setting['language']['plugin_err_uninstall'] . "\r\n\t\t\t<br />\r\n\t\t\t<pre>\r\n\t\t\t" . join("\n------------------------\n", $err) . "\r\n\t\t\t</pre>\r\n\t\t\t");
     } else {
         buildParaList("plugin");
         echo showInfo($setting['language']['plugin_uninstall_done'], false);
     }
 }
Example #8
0
function build_page($method)
{
    global $mystep, $req, $db, $setting, $id;
    $tpl_info = array("idx" => $method == "list" ? "list" : "input", "style" => "../plugin/" . basename(realpath(dirname(__FILE__))) . "/tpl/", "path" => ROOT_PATH . "/" . $setting['path']['template']);
    $tpl = $mystep->getInstance("MyTpl", $tpl_info);
    if ($method == "list") {
        $db->select($setting['db']['pre'] . "email", "*", "", array("order" => "id desc"));
        while ($record = $db->GetRS()) {
            HtmlTrans(&$record);
            $tpl->Set_Loop('record', $record);
        }
        $db->Free();
        $tpl->Set_Variable('title', $setting['language']['plugin_email_title']);
    } else {
        if ($method == "edit") {
            $record = $db->record($setting['db']['pre'] . "email", "*", array("id", "n=", $id));
            if ($record === false) {
                $tpl->Set_Variable('main', showInfo($setting['language']['plugin_email_error'], 0));
                $mystep->show($tpl);
                $mystep->pageEnd(false);
            }
            HtmlTrans(&$record);
        } else {
            $record = array();
            $record['id'] = 0;
            $record['subject'] = "";
            $record['from'] = "";
            $record['reply'] = "";
            $record['notification'] = "";
            $record['priority'] = 3;
            $record['to'] = "";
            $record['cc'] = "";
            $record['bcc'] = "";
            $record['header'] = "";
            $record['content'] = "";
            $record['attachment'] = "";
        }
        $record['send_date'] = date("Y-m-d H:i:s");
        $tpl->Set_Variables($record);
        $tpl->Set_Variable('title', $method == 'add' ? $setting['language']['plugin_email_add'] : $setting['language']['plugin_email_edit']);
        $tpl->Set_Variable('method', $method);
        $tpl->Set_Variable('back_url', $req->getServer("HTTP_REFERER"));
    }
    $tpl->Set_Variable('path_admin', $setting['path']['admin']);
    $db->Free();
    $mystep->show($tpl);
    return;
}
Example #9
0
function build_page($method)
{
    global $mystep, $req, $db, $tpl, $power_id, $tpl_info, $setting;
    $tpl_info['idx'] = "user_power_" . ($method == "list" ? "list" : "input");
    $tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info);
    $formatList = array('digital' => $setting['language']['checkform_item_digital'], 'date' => $setting['language']['checkform_item_date'], 'time' => $setting['language']['checkform_item_time']);
    if ($method == "list") {
        $db->select($setting['db']['pre'] . "user_power", "*", "", array("order" => "power_id"));
        while ($record = $db->GetRS()) {
            HtmlTrans(&$record);
            $record['format'] = $formatList[$record['format']];
            $tpl_tmp->Set_Loop('record', $record);
        }
        $tpl_tmp->Set_Variable('title', $setting['language']['admin_user_power_title']);
    } else {
        $tpl_tmp->Set_Variable('title', $method == "add" ? $setting['language']['admin_user_power_add'] : $setting['language']['admin_user_power_edit']);
        if ($method == "edit") {
            $record = $db->record($setting['db']['pre'] . "user_power", "*", array("power_id", "n=", $power_id));
            if ($record === false) {
                $tpl->Set_Variable('main', showInfo($setting['language']['admin_user_power_error'], 0));
                $mystep->show($tpl);
                $mystep->pageEnd(false);
            }
            $record['idx_org'] = $record['idx'];
        } else {
            $record['power_id'] = 0;
            $record['idx'] = "";
            $record['idx_org'] = "";
            $record['name'] = "";
            $record['value'] = "";
            $record['format'] = "";
            $record['format_org'] = "";
            $record['comment'] = "";
        }
        $tpl_tmp->Set_Variables($record);
        foreach ($formatList as $key => $value) {
            $tpl_tmp->Set_Loop('format', array("key" => $key, "value" => $value, "select" => $record['format'] == $key ? "selected" : ""));
        }
        $tpl_tmp->Set_Variable('method', $method);
        $tpl_tmp->Set_Variable('back_url', $req->getServer("HTTP_REFERER"));
    }
    $db->Free();
    $tpl->Set_Variable('main', $tpl_tmp->Get_Content('$db, $setting'));
    unset($tpl_tmp);
    $mystep->show($tpl);
    return;
}
Example #10
0
function build_page($method)
{
    global $mystep, $req, $db, $tpl, $type_id, $tpl_info, $setting, $user_power;
    $tpl_info['idx'] = "user_type_" . ($method == "list" ? "list" : "input");
    $tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info);
    if ($method == "list") {
        $max_count = count($user_power);
        $db->select($setting['db']['pre'] . "user_type", "*", "", array("order" => "type_id"));
        while ($record = $db->GetRS()) {
            HtmlTrans(&$record);
            $record['user_power'] = "";
            for ($i = 0; $i < $max_count; $i++) {
                $record['user_power'] .= "<td class=\"row\">" . $record[$user_power[$i]['idx']] . "</td>\n";
            }
            $tpl_tmp->Set_Loop('record', $record);
        }
        $tpl_tmp->Set_Variable('title', $setting['language']['admin_user_type_title']);
    } else {
        $tpl_tmp->Set_Variable('title', $method == "add" ? $setting['language']['admin_user_type_add'] : $setting['language']['admin_user_type_edit']);
        if ($method == "edit") {
            $record = $db->record($setting['db']['pre'] . "user_type", "*", array("type_id", "n=", $type_id));
            if ($record === false) {
                $tpl->Set_Variable('main', showInfo($setting['language']['admin_user_type_error'], 0));
                $mystep->show($tpl);
                $mystep->pageEnd(false);
            }
        } else {
            $record['type_id'] = 0;
            $record['type_name'] = "";
        }
        $tpl_tmp->Set_Variables($record);
        $tpl_tmp->Set_Variable('method', $method);
        $tpl_tmp->Set_Variable('back_url', $req->getServer("HTTP_REFERER"));
    }
    $max_count = count($user_power);
    for ($i = 0; $i < $max_count; $i++) {
        if (isset($record[$user_power[$i]['idx']])) {
            $user_power[$i]['value'] = $record[$user_power[$i]['idx']];
        }
        $tpl_tmp->Set_Loop('user_power', $user_power[$i]);
    }
    $db->Free();
    $tpl->Set_Variable('main', $tpl_tmp->Get_Content('$db, $setting'));
    unset($tpl_tmp);
    $mystep->show($tpl);
    return;
}
Example #11
0
function build_page($method)
{
    global $mystep, $req, $db, $setting, $idx, $mydb;
    $tpl_info = array("idx" => "main", "style" => "../plugin/" . basename(realpath(dirname(__FILE__))) . "/tpl/", "path" => ROOT_PATH . "/" . $setting['path']['template']);
    $tpl = $mystep->getInstance("MyTpl", $tpl_info);
    $tpl_info['idx'] = $method == "list" ? "list" : "input";
    $tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info);
    if ($method == "list") {
        $record = $mydb->queryAll();
        if (!$record) {
            $record = array();
        }
        $tpl_tmp->Set_Loop('record', $record, true);
        $tpl_tmp->Set_Variable('title', $setting['language']['plugin_xcode_title']);
    } else {
        if ($method == "edit") {
            $record = $mydb->queryDate("idx=" . $idx, true, &$fp_pos, &$row_pos);
            if (!$record) {
                $tpl->Set_Variable('main', showInfo($setting['language']['plugin_xcode_error'], 0));
                $mystep->show($tpl);
                $mystep->pageEnd(false);
            }
            $record['content'] = GetFile(dirname(__FILE__) . "/code/" . $idx . ".php");
            HtmlTrans(&$record);
        } else {
            $record = array();
            $record['idx'] = $_SERVER['REQUEST_TIME'];
            $record['page'] = "";
            $record['position'] = "0";
            $record['description'] = "";
            $record['content'] = "<?php\n\n?>";
        }
        $tpl_tmp->Set_Variables($record);
        $tpl_tmp->Set_Variable('title', $method == 'add' ? $setting['language']['plugin_xcode_add'] : $setting['language']['plugin_xcode_edit']);
        $tpl_tmp->Set_Variable('method', $method);
        $tpl_tmp->Set_Variable('back_url', $req->getServer("HTTP_REFERER"));
    }
    $tpl->Set_Variable('path_admin', $setting['path']['admin']);
    $tpl->Set_Variable('main', $tpl_tmp->Get_Content('$setting'));
    unset($tpl_tmp);
    $mystep->show($tpl);
    return;
}
Example #12
0
function build_page($method)
{
    global $mystep, $req, $db, $setting, $id;
    $tpl_info = array("idx" => $method == "list" ? "list" : "input", "style" => "../plugin/" . basename(realpath(dirname(__FILE__))) . "/tpl/", "path" => ROOT_PATH . "/" . $setting['path']['template']);
    $tpl = $mystep->getInstance("MyTpl", $tpl_info);
    if ($method == "list") {
        $max_count = count($GLOBALS['admin_cat']);
        for ($i = 0; $i < $max_count; $i++) {
            switch ($GLOBALS['admin_cat'][$i]['web_id']) {
                case "0":
                    $GLOBALS['admin_cat'][$i]['web_id'] = $setting['language']['plugin_admin_cat_panle'];
                    break;
                case "255":
                    $GLOBALS['admin_cat'][$i]['web_id'] = $setting['language']['plugin_admin_cat_allsub'];
                    break;
                default:
                    $webInfo = getParaInfo("website", "web_id", $GLOBALS['admin_cat'][$i]['web_id']);
                    $GLOBALS['admin_cat'][$i]['web_id'] = $webInfo['name'];
                    break;
            }
            $tpl->Set_Loop('record', $GLOBALS['admin_cat'][$i]);
            $max_count2 = count($GLOBALS['admin_cat'][$i]['sub']);
            for ($j = 0; $j < $max_count2; $j++) {
                switch ($GLOBALS['admin_cat'][$i]['sub'][$j]['web_id']) {
                    case "0":
                        $GLOBALS['admin_cat'][$i]['sub'][$j]['web_id'] = $setting['language']['plugin_admin_cat_panle'];
                        break;
                    case "255":
                        $GLOBALS['admin_cat'][$i]['sub'][$j]['web_id'] = $setting['language']['plugin_admin_cat_allsub'];
                        break;
                    default:
                        $GLOBALS['admin_cat'][$i]['sub'][$j]['web_id'] = getParaInfo("website", "web_id", $GLOBALS['admin_cat'][$i]['sub'][$j]['web_id']);
                        $GLOBALS['admin_cat'][$i]['sub'][$j]['web_id'] = $GLOBALS['admin_cat'][$i]['sub'][$j]['web_id']['name'];
                        break;
                }
                $GLOBALS['admin_cat'][$i]['sub'][$j]['name'] = "&nbsp; &nbsp; " . $GLOBALS['admin_cat'][$i]['sub'][$j]['name'];
                $tpl->Set_Loop('record', $GLOBALS['admin_cat'][$i]['sub'][$j]);
            }
        }
        $tpl->Set_Variable('title', $setting['language']['plugin_admin_cat_title']);
    } else {
        if ($method == "edit") {
            $record = $db->record($setting['db']['pre'] . "admin_cat", "*", array("id", "n=", $id));
            if ($record === false) {
                $tpl->Set_Variable('main', showInfo($setting['language']['plugin_admin_cat_error'], 0));
                $mystep->show($tpl);
                $mystep->pageEnd(false);
            }
            $web_id = $record['web_id'];
            HtmlTrans(&$record);
        } else {
            $record = array();
            $record['id'] = 0;
            $record['pid'] = 0;
            $record['name'] = "";
            $record['file'] = "";
            $record['path'] = "";
            $record['web_id'] = "0";
            $record['order'] = "0";
            $record['comment'] = "";
        }
        $tpl->Set_Variables($record);
        $tpl->Set_Variable('title', $method == 'add' ? $setting['language']['plugin_admin_cat_add'] : $setting['language']['plugin_admin_cat_edit']);
        $tpl->Set_Variable('method', $method);
        $tpl->Set_Variable('back_url', $req->getServer("HTTP_REFERER"));
        $max_count = count($GLOBALS['website']);
        for ($i = 0; $i < $max_count; $i++) {
            $tpl->Set_Loop("website", $GLOBALS['website'][$i]);
        }
        $max_count = count($GLOBALS['admin_cat']);
        for ($i = 0; $i < $max_count; $i++) {
            $tpl->Set_Loop("cat", array("id" => $GLOBALS['admin_cat'][$i]['id'], "name" => $GLOBALS['admin_cat'][$i]['name'], "selected" => $GLOBALS['admin_cat'][$i]['id'] == $record['pid'] ? "selected" : ""));
        }
    }
    $tpl->Set_Variable('path_admin', $setting['path']['admin']);
    $db->Free();
    $mystep->show($tpl);
    return;
}
Example #13
0
function build_page($method)
{
    global $mystep, $req, $db, $tpl, $tpl_info, $setting, $news_cat, $news_id, $cat_id, $group, $web_id, $setting_sub;
    $top_mode_list = array("0" => $setting['language']['admin_art_content_top_mode_1'], "1" => $setting['language']['admin_art_content_top_mode_2'], "2" => $setting['language']['admin_art_content_top_mode_3']);
    $top_list = array("1" => $setting['language']['admin_art_content_top_1'], "2" => $setting['language']['admin_art_content_top_2'], "4" => $setting['language']['admin_art_content_top_3']);
    $tpl_info['idx'] = "art_content_" . ($method == "list" ? "list" : "input");
    $tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info);
    if ($cat_info = getParaInfo("news_cat", "cat_id", $cat_id)) {
        $web_id = $cat_info['web_id'];
    }
    $check_i = "";
    $check_b = "";
    $check_c = "";
    if (empty($group['power_cat'])) {
        $group['power_cat'] = 0;
    }
    if ($method == "list") {
        $page = $req->getGet("page");
        $keyword = $req->getGet("keyword");
        $order = $req->getGet("order");
        $tpl_tmp->Set_Variable('order', $order);
        $order_type = $req->getGet("order_type");
        if (empty($order_type)) {
            $order_type = "desc";
        }
        $condition = array();
        if (!empty($web_id)) {
            $condition[] = array("web_id", "n=", $web_id, "and");
        }
        if (!empty($cat_id)) {
            $condition[] = array("cat_id", "n=", $cat_id, "and");
        }
        if (!empty($keyword)) {
            $condition[] = array(array(array("subject", "like", $keyword), array("tag", "like", $keyword)), "and");
        }
        if ($group['power_cat'] != "all") {
            $condition[] = array("cat_id", "nin", $group['power_cat'], "and");
        }
        //navigation
        $counter = $db->result($setting['db']['pre_sub'] . "news_show", "count(*)", $condition);
        list($page_arr, $page_start, $page_size) = GetPageList($counter, "?keyword={$keyword}&cat_id={$cat_id}&web_id={$web_id}&order={$order}&order_type={$order_type}", $page);
        $tpl_tmp->Set_Variables($page_arr);
        //main list
        $the_order = array();
        if (!empty($cat_id) && $order != "setop") {
            $the_order[] = "order desc";
        }
        if ($order == "setop") {
            $order_type = "desc";
        }
        if (!empty($order)) {
            $the_order[] = "{$order} {$order_type}";
        }
        $the_order[] = "news_id {$order_type}";
        $sql = $db->buildSel_join(array(array("name" => $setting['db']['pre_sub'] . "news_show", "idx" => "a", "col" => "*", "condition" => $condition, "order" => $the_order), array("name" => $setting['db']['pre'] . "news_cat", "idx" => "b", "col" => "cat_idx, cat_name", "join" => "cat_id")), "", array("limit" => "{$page_start}, {$page_size}"));
        $db->Query($sql);
        while ($record = $db->GetRS()) {
            HtmlTrans(&$record);
            if (empty($record['link'])) {
                $record['link'] = getUrl("read", array($record['news_id'], $record['cat_id']), 1, $record['web_id']);
            }
            $tpl_tmp->Set_Loop('record', $record);
        }
        $title = empty($cat_id) ? $setting['language']['admin_art_content_list_all'] : $db->result($setting['db']['pre'] . "news_cat", "cat_name", array("cat_id", "n=", $cat_id));
        $tpl_tmp->Set_Variable('title', $setting['language']['admin_art_content_list_article'] . " - " . $setting_sub['web']['title'] . " - " . $title);
        $tpl_tmp->Set_Variable('keyword', $keyword);
        $tpl_tmp->Set_Variable('cat_id', $cat_id);
        $tpl_tmp->Set_Variable('order_type_org', $order_type);
        $order_type = $order_type == "asc" ? "desc" : "asc";
        $tpl_tmp->Set_Variable('order_type', $order_type);
        $tpl_tmp->Set_Variable('keyword', $keyword);
    } elseif ($method == "edit") {
        $record = $db->record($setting['db']['pre_sub'] . "news_show", "*", array("news_id", "n=", $news_id));
        if (!$record) {
            $tpl->Set_Variable('main', showInfo($setting['language']['admin_art_content_error'], 0));
            $mystep->show($tpl);
            $mystep->pageEnd(false);
        }
        HtmlTrans(&$record);
        $tpl_tmp->Set_Variables($record, "record");
        $cat_id = $record['cat_id'];
        $setop = (int) $record['setop'];
        foreach ($top_list as $key => $value) {
            $key = (int) $key;
            $tpl_tmp->Set_Loop('setop', array("key" => $key, "value" => $value, "checked" => ($setop & $key) == $key ? "checked" : ""));
            if (($setop & $key) == $key) {
                $setop -= $key;
            }
        }
        $setop /= 1024;
        foreach ($top_mode_list as $key => $value) {
            $key = (int) $key;
            $tpl_tmp->Set_Loop('setop_mode', array("key" => $key, "value" => $value, "checked" => $setop == $key ? "checked" : ""));
        }
        $theStyle = explode(",", $record['style']);
        $max_count = count($theStyle);
        for ($i = 0; $i < $max_count; $i++) {
            if ($theStyle[$i] == "i") {
                $check_i = "checked";
            } elseif ($theStyle[$i] == "b") {
                $check_b = "checked";
            } else {
                $check_c = $theStyle[$i];
            }
        }
        $content = array();
        $db->select($setting['db']['pre_sub'] . "news_detail", "*", array("news_id", "n=", $news_id), array("order" => "page"));
        while ($record = $db->GetRS()) {
            $record['content'] = str_replace("&", "&#38;", $record['content']);
            HtmlTrans(&$record);
            $record['content'] = "<span class=\"mceSubtitle\">" . $record['sub_title'] . "</span>\n" . $record['content'];
            $content[] = $record['content'];
        }
        $Max_size = round(GetFileSize(ini_get('upload_max_filesize')) / 1024 / 1024, 2);
        $tpl_tmp->Set_Variable('MaxSize', $Max_size);
        $tpl_tmp->Set_Variable('record_content', implode("\n<p><img src=\"../script/tinymce/plugins/pagebreak/img/trans.gif\" class=\"mcePageBreak mceItemNoResize\" /></p>\n", $content));
        $tpl_tmp->Set_Variable('title', $setting['language']['admin_art_content_edit']);
    } else {
        $checked = "checked";
        foreach ($top_mode_list as $key => $value) {
            $key = (int) $key;
            $tpl_tmp->Set_Loop('setop_mode', array("key" => $key, "value" => $value, "checked" => $checked));
            $checked = "";
        }
        foreach ($top_list as $key => $value) {
            $key = (int) $key;
            $tpl_tmp->Set_Loop('setop', array("key" => $key, "value" => $value, "checked" => ""));
        }
        $record = array();
        $record['news_id'] = 0;
        $record['cat_id'] = $cat_id;
        $record['web_id'] = $web_id;
        $record['subject'] = "";
        $record['style'] = "";
        $record['describe'] = "";
        $record['original'] = "";
        $record['link'] = "";
        $record['tag'] = "";
        $record['image'] = "";
        $record['content'] = "";
        $record['pages'] = 1;
        $record['order'] = 0;
        if (!empty($cat_id) && ($cat_info = getParaInfo("news_cat", "cat_id", $cat_id))) {
            $record['view_lvl'] = $cat_info['view_lvl'];
            $record['notice'] = $cat_info['notice'];
        } else {
            $record['view_lvl'] = 0;
            $record['notice'] = "";
        }
        $Max_size = round(GetFileSize(ini_get('upload_max_filesize')) / 1024 / 1024, 2);
        $tpl_tmp->Set_Variable('MaxSize', $Max_size);
        $tpl_tmp->Set_Variables($record, "record");
        $tpl_tmp->Set_Variable('title', $setting['language']['admin_art_content_add']);
    }
    //news image
    $condition = array();
    if (!empty($web_id)) {
        $condition = array("web_id", "n=", $web_id);
    }
    $db->select($setting['db']['pre'] . "news_image", "*", $condition, array("order" => "id asc"));
    while ($record = $db->GetRS()) {
        HtmlTrans(&$record);
        $tpl_tmp->Set_Loop('news_image', $record);
    }
    //catalog select
    if (empty($web_id)) {
        $web_id = 1;
    }
    $max_count = count($news_cat);
    for ($i = 0; $i < $max_count; $i++) {
        if (($method != "add" || $setting['info']['web']['web_id'] != 1) && $news_cat[$i]['web_id'] != $web_id) {
            continue;
        }
        //if(!empty($news_cat[$i]['cat_link'])) continue;
        $news_cat[$i]['cat_name'] = (isset($news_cat[$i + 1]) && $news_cat[$i + 1]['cat_layer'] == $news_cat[$i]['cat_layer'] ? "©À " : "©¸ ") . $news_cat[$i]['cat_name'];
        for ($j = 1; $j < $news_cat[$i]['cat_layer']; $j++) {
            $news_cat[$i]['cat_name'] = "&nbsp;" . $news_cat[$i]['cat_name'];
        }
        $news_cat[$i] = preg_replace("/^©À /", "", preg_replace("/^©¸ /", "", $news_cat[$i]));
        $tpl_tmp->Set_Loop('catalog', array('cat_id' => $news_cat[$i]['cat_id'], 'web_id' => $news_cat[$i]['web_id'], 'cat_name' => $news_cat[$i]['cat_name'], 'view_lvl' => $news_cat[$i]['view_lvl'], 'selected' => $cat_id == $news_cat[$i]['cat_id'] ? "selected" : ""));
        $tpl_tmp->Set_Loop('cat_sub', array('cat_id' => $news_cat[$i]['cat_id'], 'cat_sub' => $news_cat[$i]['cat_sub']));
    }
    $tpl_tmp->Set_Variable('check_b', $check_b);
    $tpl_tmp->Set_Variable('check_i', $check_i);
    $tpl_tmp->Set_Variable('check_c', $check_c);
    $tpl_tmp->Set_Variable('get_remote_file', $setting['content']['get_remote_img'] ? "checked" : "");
    $tpl_tmp->Set_Variable('method', $method);
    $tpl_tmp->Set_Variable('web_id', $web_id);
    $tpl_tmp->Set_Variable('cat_id', $cat_id);
    $tpl_tmp->Set_Variable('news_id', $news_id);
    $tpl_tmp->Set_Variable('back_url', $req->getServer("HTTP_REFERER"));
    $max_count = count($GLOBALS['website']);
    for ($i = 0; $i < $max_count; $i++) {
        $GLOBALS['website'][$i]['selected'] = $GLOBALS['website'][$i]['web_id'] == $web_id ? "selected" : "";
        $tpl_tmp->Set_Loop("website", $GLOBALS['website'][$i]);
    }
    $db->Free();
    $tpl->Set_Variable('main', $tpl_tmp->Get_Content('$db, $setting'));
    unset($tpl_tmp);
    $mystep->show($tpl);
    return;
}
Example #14
0
 public function pageEnd($show_info = false)
 {
     global $setting;
     for ($i = count($this->func_end) - 1; $i >= 0; $i--) {
         call_user_func($this->func_end[$i]);
     }
     $setting['info']['query_count'] = $GLOBALS['db']->Close();
     if ($GLOBALS['db']->GetError($err_info) && isset($GLOBALS['op_mode'])) {
         ob_clean();
         echo showInfo($setting['language']['admin_database_error'] . '<ol style="text-align:left;font-weight:normal;"><li>' . implode('</li><li>', $err_info) . '</li></ol>', 0);
     }
     if (!empty($GLOBALS['goto_url']) && ob_get_length() == 0) {
         header("location: " . $GLOBALS['goto_url']);
     } else {
         GzDocOut($setting['gen']['gzip_level'], $show_info);
     }
     unset($GLOBALS['db'], $GLOBALS['req'], $GLOBALS['setting'], $this);
     exit;
 }
Example #15
0
function build_page($method)
{
    global $mystep, $req, $db, $tpl, $web_id, $tpl_info, $website, $setting;
    $tpl_info['idx'] = "web_subweb_" . ($method == "list" ? "list" : "input");
    $tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info);
    $tpl_tmp->allow_script = true;
    if ($method == "list") {
        $db->select($setting['db']['pre'] . "website", "*", "", array("order" => "web_id"));
        while ($record = $db->GetRS()) {
            HtmlTrans(&$record);
            $tpl_tmp->Set_Loop('record', $record);
        }
        $tpl_tmp->Set_Variable('title', $setting['language']['admin_web_subweb_title']);
        global $admin_cat;
        $tpl_tmp->Set_Variable("admin_cat", toJson($admin_cat, $setting['gen']['charset']));
        $tpl_tmp->Set_Variable("website", toJson($website, $setting['gen']['charset']));
    } else {
        $tpl_tmp->Set_Variable('title', $method == "add" ? $setting['language']['admin_web_subweb_add'] : $setting['language']['admin_web_subweb_edit']);
        if ($method == "edit") {
            $record = $db->record($setting['db']['pre'] . "website", "*", array("web_id", "n=", $web_id));
            if ($record === false) {
                $tpl->Set_Variable('main', showInfo($setting['language']['admin_web_subweb_error'], 0));
                $mystep->show($tpl);
                $mystep->pageEnd(false);
            }
        } else {
            $record['web_id'] = 0;
            $record['name'] = "";
            $record['idx'] = "";
            $record['host'] = "";
        }
        $GLOBALS['subweb_idx'] = $record['idx'];
        $tpl_tmp->Set_Variables($record);
        $setting['watermark']['mode'] = array($setting['watermark']['mode'] & 1 == 1, $setting['watermark']['mode'] & 2 == 2);
        $tpl_tmp->Set_Variable('method', $method);
        $tpl_tmp->Set_Variable('back_url', $req->getServer("HTTP_REFERER"));
    }
    $tpl->Set_Variable('main', $tpl_tmp->Get_Content('$db, $setting'));
    $db->Free();
    unset($tpl_tmp);
    $mystep->show($tpl);
    return;
}
Example #16
0
     $sevent = "<b title='{$origevent}'>{$event}</b>";
     if (in_array($event, $exclude) || substr($event, 0, 2) == "**") {
         $sevent = "<b>" . trim(substr($event, 2)) . "</b>";
     }
     if ($event == "** Full Server Tick") {
         $sevent = showInfo('fst', 'Full Server Tick');
         $serverLoad = $pct_tick;
     }
     if ($event == "** Connection Handler") {
         $sevent = showInfo('connhandler', 'Connection Handler');
     }
     if ($event == "** activatedTickEntity") {
         $sevent = showInfo('ate', 'Activated Entities');
     }
     if ($event == "Scheduler") {
         $sevent = showInfo('sched', 'Plugin Scheduler');
     }
     $i++;
     if ($plugin == $subkey && $i >= 11 || $pct_tot_raw < 0.0003 || $plugin != "Minecraft" && $i >= 6 && $plugin != $subkey) {
         $disabled = " hidden";
         $hiddenelem = true;
     } else {
         $disabled = "";
         $shown++;
     }
     $timesPerTick = pad(number_format($timesPerTick, $timesPerTick > 10 ? 0 : 1), 4);
     echo "<span class='event {$disabled}'><pre>  {$pct_tot}\t{$pct_tick}\t{$stime}\t{$avg}\t{$timesPerTick}\t{$count}";
     echo "\t    {$sevent}\n</pre></span>";
 }
 if ($hiddenelem) {
     echo "<button class='show_rest'>Show rest...</button><br />";
Example #17
0
function build_page($method)
{
    global $mystep, $req, $db, $mydb, $setting, $topic_id;
    $tpl_info = array("idx" => "main", "style" => "../plugin/" . basename(realpath(dirname(__FILE__))) . "/tpl/", "path" => ROOT_PATH . "/" . $setting['path']['template']);
    $tpl = $mystep->getInstance("MyTpl", $tpl_info);
    if ($method == "add" || $method == "edit") {
        $tpl_info['idx'] = "input";
    } else {
        $tpl_info['idx'] = $method;
    }
    $tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info);
    if ($method == "list") {
        $order = $req->getGet("order");
        $order_type = $req->getGet("order_type");
        if (empty($order_type)) {
            $order_type = "desc";
        }
        $keyword = $req->getGet("keyword");
        $page = $req->getGet("page");
        $condition = array();
        if (!empty($keyword)) {
            $condition[] = array("topic_name", "like", $keyword);
        }
        $counter = $db->result($setting['db']['pre'] . "topic", "count(*)", $condition);
        list($page_arr, $page_start, $page_size) = GetPageList($counter, "?keyword={$keyword}&order={$order}&order_type={$order_type}", $page);
        $tpl_tmp->Set_Variables($page_arr);
        $the_order = array();
        if (empty($order)) {
            $order = "topic_id";
        }
        $the_order[] = "{$order} {$order_type}";
        if ($order != "topic_id") {
            $the_order[] = "topic_id {$order_type}";
        }
        $db->select($setting['db']['pre'] . "topic", "*", $condition, array("order" => $the_order, "limit" => "{$page_start}, {$page_size}"));
        while ($record = $db->GetRS()) {
            if (empty($record['topic_link'])) {
                $record['topic_link'] = getUrl("topic", $record['topic_idx']);
            }
            $tpl_tmp->Set_Loop('record', $record);
        }
        $tpl_tmp->Set_Variable('order_type_org', $order_type);
        if ($order_type == "desc") {
            $order_type = "asc";
        } else {
            $order_type = "desc";
        }
        $tpl_tmp->Set_Variable('keyword', $keyword);
        $tpl_tmp->Set_Variable('order', $order);
        $tpl_tmp->Set_Variable('order_type', $order_type);
        $tpl_tmp->Set_Variable('title', $setting['language']['plugin_topic_title']);
    } else {
        $record = array();
        if ($method == "edit") {
            $record = $db->record($setting['db']['pre'] . "topic", "*", array("topic_id", "n=", $topic_id));
            if ($record === false) {
                $tpl->Set_Variable('main', showInfo($setting['language']['plugin_topic_error'], 0));
                $mystep->show($tpl);
                return;
            }
            $record['topic_tpl'] = GetFile("topic/" . $topic_id . ".tpl");
            HtmlTrans(&$record);
            $style_list = explode(",", $record['topic_cat']);
            $max_count = count($style_list);
            for ($i = 0; $i < $max_count; $i++) {
                $tpl_tmp->Set_Loop('style_list', array("index" => $i, "style" => $style_list[$i]));
            }
            $n = 1;
            $db->select($setting['db']['pre'] . "topic_link", "*", array("topic_id", "n=", $topic_id), array("order" => "link_order desc,id desc"));
            while ($links = $db->GetRS()) {
                HtmlTrans(&$links);
                $links['idx'] = $n++;
                $links['link_cat'] = $style_list[$links['link_cat']];
                if (empty($links['link_url'])) {
                    $links['link_url'] = "/read.php?id=" . $links['news_id'];
                }
                $tpl_tmp->Set_Loop('link_list', $links);
            }
        } else {
            $record = array();
            $record['topic_id'] = 0;
        }
        $tpl_tmp->Set_Variables($record);
        $tpl_tmp->Set_Variable('show_link', $method == "edit" ? "" : "none");
        $tpl_tmp->Set_Variable('title', $setting['language']['plugin_topic_' . $method]);
        $tpl_tmp->Set_Variable('method', $method);
    }
    $tpl_tmp->Set_Variable('max_size', ini_get('upload_max_filesize'));
    $tpl_tmp->Set_Variable('path_admin', $setting['path']['admin']);
    $tpl->Set_Variable('path_admin', $setting['path']['admin']);
    $tpl->Set_Variable('main', $tpl_tmp->Get_Content('$setting'));
    $db->Free();
    unset($tpl_tmp);
    $mystep->show($tpl);
    return;
}
Example #18
0
function build_page($method)
{
    global $mystep, $req, $db, $tpl, $group_id, $tpl_info, $admin_cat, $admin_cat_plat, $news_cat, $website, $setting;
    $tpl_info['idx'] = "user_group_" . ($method == "list" ? "list" : "input");
    $tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info);
    if ($method == "list") {
        $db->select($setting['db']['pre'] . "user_group", "*", "", array("order" => "group_id"));
        while ($record = $db->GetRS()) {
            HtmlTrans(&$record);
            if ($record['power_func'] == "all") {
                $record['power_func'] = $setting['language']['admin_user_group_power_all'];
            } elseif ($record['power_func'] == "") {
                $record['power_func'] = $setting['language']['admin_user_group_power_none'];
            } else {
                $thePowerFunc = explode(",", $record['power_func']);
                $record['power_func'] = "";
                $max_count = count($thePowerFunc);
                for ($i = 0; $i < $max_count; $i++) {
                    $theFunc = getParaInfo("admin_cat_plat", "id", $thePowerFunc[$i]);
                    $record['power_func'] .= $theFunc['name'] . ", ";
                }
                $record['power_func'] = substr($record['power_func'], 0, -2);
            }
            if ($record['power_cat'] == "all") {
                $record['power_cat'] = $setting['language']['admin_user_group_cat_all'];
            } elseif ($record['power_cat'] == "") {
                $record['power_cat'] = $setting['language']['admin_user_group_cat_none'];
            } else {
                $thePowerCata = explode(",", $record['power_cat']);
                $record['power_cat'] = "";
                $max_count = count($thePowerCata);
                for ($i = 0; $i < $max_count; $i++) {
                    $theCata = getParaInfo("news_cat", "cat_id", $thePowerCata[$i]);
                    $record['power_cat'] .= $theCata['cat_name'] . ", ";
                }
                $record['power_cat'] = substr($record['power_cat'], 0, -2);
            }
            if ($record['power_web'] == "all") {
                $record['power_web'] = $setting['language']['admin_user_group_web_all'];
            } elseif ($record['power_web'] == "") {
                $record['power_web'] = $setting['language']['admin_user_group_web_none'];
            } else {
                $thePowerWeb = explode(",", $record['power_web']);
                $record['power_web'] = "";
                $max_count = count($thePowerWeb);
                for ($i = 0; $i < $max_count; $i++) {
                    $theWeb = getParaInfo("website", "web_id", $thePowerWeb[$i]);
                    $record['power_web'] .= $theWeb['name'] . ", ";
                }
                $record['power_web'] = substr($record['power_web'], 0, -2);
            }
            $tpl_tmp->Set_Loop('record', $record);
        }
        $tpl_tmp->Set_Variable('title', $setting['language']['admin_user_group_title']);
    } else {
        $tpl_tmp->Set_Variable('title', $method == "add" ? $setting['language']['admin_user_group_add'] : $setting['language']['admin_user_group_edit']);
        if ($method == "edit") {
            $record = $db->record($setting['db']['pre'] . "user_group", "*", array("group_id", "n=", $group_id));
            if ($record === false) {
                $tpl->Set_Variable('main', showInfo($setting['language']['admin_user_group_error'], 0));
                $mystep->show($tpl);
                $mystep->pageEnd(false);
            }
        } else {
            $record['group_id'] = 0;
            $record['group_name'] = "";
            $record['power_func'] = "";
            $record['power_cat'] = "";
            $record['power_web'] = "";
        }
        $tpl_tmp->Set_Variables($record);
        $tpl_tmp->Set_Variable('power_web_all_checked', $record['power_web'] == "all" ? "checked" : "");
        $max_count = count($website);
        for ($i = 0; $i < $max_count; $i++) {
            $tpl_tmp->Set_Loop('power_web', array("web_id" => $website[$i]['web_id'], "name" => $website[$i]['name'], "checked" => strpos("," . $record['power_web'] . ",", "," . $website[$i]['web_id'] . ",") !== false ? "checked" : ""));
        }
        $tpl_tmp->Set_Variable('power_func_all_checked', $record['power_func'] == "all" ? "checked" : "");
        $max_count = count($admin_cat);
        for ($i = 0; $i < $max_count; $i++) {
            $tpl_tmp->Set_Loop('power_func', array("key" => $admin_cat[$i]['id'], "value" => $admin_cat[$i]['name'], "pid" => $admin_cat[$i]['pid'], "checked" => strpos("," . $record['power_func'] . ",", "," . $admin_cat[$i]['id'] . ",") !== false ? "checked" : ""));
            if (isset($admin_cat[$i]['sub'])) {
                $max_count1 = count($admin_cat[$i]['sub']);
                for ($j = 0; $j < $max_count1; $j++) {
                    $tpl_tmp->Set_Loop('power_func', array("key" => $admin_cat[$i]['sub'][$j]['id'], "value" => ($j + 1 == count($admin_cat[$i]['sub']) ? "©¸ " : "©À ") . $admin_cat[$i]['sub'][$j]['name'], "pid" => $admin_cat[$i]['sub'][$j]['pid'], "checked" => strpos("," . $record['power_func'] . ",", "," . $admin_cat[$i]['sub'][$j]['id'] . ",") !== false ? "checked" : ""));
                }
            }
        }
        $tpl_tmp->Set_Variable('power_cat_all_checked', $record['power_cat'] == "all" ? "checked" : "");
        $max_count = count($news_cat);
        for ($i = 0; $i < $max_count; $i++) {
            $news_cat[$i]['cat_name'] = (isset($news_cat[$i + 1]) && $news_cat[$i + 1]['cat_layer'] == $news_cat[$i]['cat_layer'] ? "©À " : "©¸ ") . $news_cat[$i]['cat_name'];
            for ($j = 1; $j < $news_cat[$i]['cat_layer']; $j++) {
                $news_cat[$i]['cat_name'] = " &nbsp;" . $news_cat[$i]['cat_name'];
            }
            $news_cat[$i]['cat_name'] = preg_replace("/^©À /", "", preg_replace("/^©¸ /", "", $news_cat[$i]['cat_name']));
            $news_cat[$i]['checked'] = strpos("," . $record['power_cat'] . ",", "," . $news_cat[$i]['cat_id'] . ",") !== false ? "checked" : "";
            $tpl_tmp->Set_Loop('power_cat', $news_cat[$i]);
        }
        $tpl_tmp->Set_Variable('method', $method);
        $tpl_tmp->Set_Variable('back_url', $req->getServer("HTTP_REFERER"));
    }
    $db->Free();
    $tpl->Set_Variable('main', $tpl_tmp->Get_Content('$db, $setting'));
    unset($tpl_tmp);
    $mystep->show($tpl);
    return;
}
Example #19
0
function build_page($method)
{
    global $mystep, $req, $db, $tpl, $tpl_info, $setting, $id, $idx, $web_id;
    $tpl_info['idx'] = "func_link_" . ($method == "list" ? "list" : "input");
    $tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info);
    if ($method == "list") {
        $condition = array();
        if (!empty($idx)) {
            $condition[] = array("idx", "=", $idx);
        }
        if (!empty($web_id)) {
            $condition[] = array("web_id", "n=", $web_id);
        }
        $counter = $db->result($setting['db']['pre'] . "links", "count(*)", $condition);
        $page = $req->getGet("page");
        list($page_arr, $page_start, $page_size) = GetPageList($counter, "?order={$order}&order_type={$order_type}", $page);
        $tpl_tmp->Set_Variables($page_arr);
        $order = $req->getGet("order");
        $order_type = $req->getGet("order_type");
        if (empty($order_type)) {
            $order_type = "desc";
        }
        if (empty($order)) {
            $order = "id";
        }
        $the_order = array();
        $the_order[] = "{$order} {$order_type}";
        if ($order != "id") {
            $the_order[] = "id desc";
        }
        $db->select($setting['db']['pre'] . "links", "*", $condition, array("order" => $the_order, "limit" => "{$page_start}, {$page_size}"));
        $tpl_tmp->Set_Variable('order_type_org', $order_type);
        if ($order_type == "desc") {
            $order_type = "asc";
        } else {
            $order_type = "desc";
        }
        $tpl_tmp->Set_Variable('order', $order);
        $tpl_tmp->Set_Variable('order_type', $order_type);
        while ($record = $db->GetRS()) {
            HtmlTrans(&$record);
            if (!empty($record['image'])) {
                $record['image'] = "<img width='88' height='31' src='" . $record['image'] . "' />";
            } else {
                $record['image'] = "&nbsp;";
            }
            $tpl_tmp->Set_Loop('record', $record);
        }
        $db->Free();
        $tpl_tmp->Set_Variable('title', $setting['language']['admin_func_link_title']);
        $tpl_tmp->Set_Variable('idx', $idx);
        $tpl_tmp->Set_Variable('web_id', $web_id);
    } else {
        if ($method == "edit") {
            $record = $db->record($setting['db']['pre'] . "links", "*", array("id", "n=", $id));
            if ($record === false) {
                $tpl->Set_Variable('main', showInfo($setting['language']['admin_func_link_error'], 0));
                $mystep->show($tpl);
                $mystep->pageEnd(false);
            }
            $web_id = $record['web_id'];
            $idx = $record['idx'];
            HtmlTrans(&$record);
        } else {
            $record['id'] = "0";
            $record['web_id'] = $web_id;
            $record['idx'] = "";
            $record['link_name'] = "";
            $record['link_url'] = "http://";
            $record['level'] = "1";
            $record['image'] = "";
        }
        $tpl_tmp->Set_Variables($record);
        $tpl_tmp->judge_list['edit'] = $method == "edit";
        $tpl_tmp->Set_Variable('title', $method == "add" ? $setting['language']['admin_func_link_add'] : $setting['language']['admin_func_link_edit']);
        $tpl_tmp->Set_Variable('method', $method);
        $tpl_tmp->Set_Variable('back_url', $req->getServer("HTTP_REFERER"));
    }
    for ($i = 0, $m = count($GLOBALS['website']); $i < $m; $i++) {
        $GLOBALS['website'][$i]['selected'] = $GLOBALS['website'][$i]['web_id'] == $web_id ? "selected" : "";
        $tpl_tmp->Set_Loop("website", $GLOBALS['website'][$i]);
    }
    $db->select($setting['db']['pre'] . "links", "distinct idx");
    while ($record = $db->GetRS()) {
        $record['selected'] = $record['idx'] == $idx ? "selected" : "";
        $tpl_tmp->Set_Loop('idx', $record);
    }
    $db->Free();
    $tpl->Set_Variable('main', $tpl_tmp->Get_Content('$db, $setting'));
    unset($tpl_tmp);
    $mystep->show($tpl);
    return;
}
Example #20
0
     }
     break;
 case "lend_requests":
     lend_requests($option, $bid);
     break;
 case "accept_lend_requests":
     accept_lend_requests($option, $bid);
     break;
 case "decline_lend_requests":
     decline_lend_requests($option, $bid);
     break;
 case "about":
     HTML_booklibrary::about();
     break;
 case "show_info":
     showInfo($option, $bid);
     break;
 case "lend_return":
     if (mosGetParam($_POST, 'save') == 1) {
         saveLend_return($option, $bid);
     } else {
         lend_return($option, $bid);
     }
     break;
 case "edit_lend":
     if (mosGetParam($_POST, 'save') == 1) {
         if (count($bid) > 1) {
             echo "<script> alert('You must select only one item for edit'); window.history.go(-1); </script>\n";
             exit;
         }
         saveLend($option, $bid, "edit_lend");
        echo $e->getMessage() . "\n";
        return;
    }
}
showInfo("pubA");
showInfo("protA");
showInfo("privA");
showInfo("pubB");
showInfo("protB");
showInfo("privB");
showInfo("pubC");
showInfo("protC");
showInfo("privC");
showInfo("doesntExist");
showInfo("A::pubC");
showInfo("A::protC");
showInfo("A::privC");
showInfo("B::pubC");
showInfo("B::protC");
showInfo("B::privC");
showInfo("c::pubC");
showInfo("c::PUBC");
showInfo("C::pubC");
showInfo("C::protC");
showInfo("C::privC");
showInfo("X::pubC");
showInfo("X::protC");
showInfo("X::privC");
showInfo("X::doesntExist");
showInfo("doesntexist::doesntExist");
Example #22
0
$setting['gen']['minify'] = false;
$usergroup = $req->getSession("usergroup");
if ($usergroup === 0) {
    $goto_url = $setting['web']['url'];
    //debug("usergroup",$goto_url);
    $mystep->pageEnd(false);
}
$group = getParaInfo("user_group", "group_id", $usergroup);
if (empty($group['power_func'])) {
    $goto_url = "/" . $setting['path']['admin'] . "login.php";
    //debug("power_func",$goto_url);
    $req->setCookie("referer", $req->getServer("REQUEST_URI"), 1000);
    $mystep->pageEnd(false);
}
$op_mode = $setting['info']['web']['web_id'] == 1 && ($group['power_func'] == "all" || strpos("," . $group['power_func'] . ",", ",1,") !== false);
includeCache("admin_cat");
$cat_info = getParaInfo("admin_cat_plat", "file", $setting['info']['self'], true);
$plugin_info = getParaInfo("plugin", "idx", basename($cat_info["path"]));
if ($plugin_info['active'] == 0) {
    $cat_info = false;
}
if (!$op_mode) {
    $admin_cat = $admin_cat_plat;
}
if ($cat_info === false && !checkSign(8) || $group['power_func'] != "all" && strpos("," . $group['power_func'] . ",", "," . $cat_info['id'] . ",") === false) {
    echo showInfo($setting['language']['login_nopower'], false);
    $mystep->pageEnd(false);
}
if (!$op_mode) {
    $web_id = $setting['info']['web']['web_id'];
}
Example #23
0
function build_page($method)
{
    global $mystep, $req, $db, $setting, $id;
    $tpl_info = array("idx" => "main", "style" => "../plugin/" . basename(realpath(dirname(__FILE__))) . "/tpl/", "path" => ROOT_PATH . "/" . $setting['path']['template']);
    $tpl = $mystep->getInstance("MyTpl", $tpl_info);
    $tpl_info['idx'] = $method == "list" ? "list" : "input";
    $tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info);
    $ad_mode = explode(",", $setting['language']['plugin_ad_show_mode']);
    if ($method == "list") {
        $order = $req->getGet("order");
        $order_type = $req->getGet("order_type");
        if (empty($order_type)) {
            $order_type = "desc";
        }
        $counter = $db->result($setting['db']['pre'] . "ad_show", "count(*)");
        $page = $req->getGet("page");
        list($page_arr, $page_start, $page_size) = GetPageList($counter, "?order={$order}&order_type={$order_type}", $page);
        $tpl_tmp->Set_Variables($page_arr);
        if (empty($order)) {
            $order = "id";
        }
        $the_order = array();
        $the_order[] = "{$order} {$order_type}";
        if ($order != "id") {
            $the_order[] = "id desc";
        }
        $db->select($setting['db']['pre'] . "ad_show", "*", "", array("order" => $the_order, "limit" => "{$page_start}, {$page_size}"));
        $tpl_tmp->Set_Variable('order_type_org', $order_type);
        if ($order_type == "desc") {
            $order_type = "asc";
        } else {
            $order_type = "desc";
        }
        $tpl_tmp->Set_Variable('order', $order);
        $tpl_tmp->Set_Variable('order_type', $order_type);
        while ($record = $db->GetRS()) {
            HtmlTrans(&$record);
            $record['ad_mode'] = $ad_mode[$record['ad_mode']];
            $tpl_tmp->Set_Loop('record', $record);
        }
        $db->Free();
        $tpl_tmp->Set_Variable('title', $setting['language']['plugin_ad_show_title']);
    } else {
        if ($method == "edit") {
            $record = $db->record($setting['db']['pre'] . "ad_show", "*", array("id", "n=", $id));
            if ($record === false) {
                $tpl_tmp->Set_Variable('main', showInfo($setting['language']['plugin_ad_show_error'], 0));
                $mystep->show($tpl);
                $mystep->pageEnd(false);
            }
            HtmlTrans(&$record);
            $db->Free();
        } else {
            $record = array();
            $record['id'] = 0;
            $record['idx'] = "";
            $record['ad_client'] = "";
            $record['ad_url'] = "";
            $record['ad_mode'] = 1;
            $record['ad_file'] = "";
            $record['ad_text'] = "";
            $record['ad_level'] = 1;
            $record['exp_date'] = "";
            $record['comment'] = "";
        }
        $tpl_tmp->Set_Variables($record);
        for ($i = 0, $m = count($ad_mode); $i < $m; $i++) {
            $tpl_tmp->Set_Loop('ad_mode', array("idx" => $i, "mode" => $ad_mode[$i], "selected" => $i == $record['ad_mode'] ? "selected" : ""));
        }
        $db->select($setting['db']['pre'] . "ad_show", "distinct idx");
        while ($record = $db->GetRS()) {
            $record['selected'] = $record['idx'] == $idx ? "selected" : "";
            $tpl_tmp->Set_Loop('idx', $record);
        }
        $db->Free();
        $tpl_tmp->Set_Variable('title', $method == 'add' ? $setting['language']['plugin_ad_show_add'] : $setting['language']['plugin_ad_show_edit']);
        $tpl_tmp->Set_Variable('method', $method);
        $tpl_tmp->Set_Variable('back_url', $req->getServer("HTTP_REFERER"));
    }
    $tpl->Set_Variable('path_admin', $setting['path']['admin']);
    $tpl->Set_Variable('main', $tpl_tmp->Get_Content('$setting'));
    unset($tpl_tmp);
    $mystep->show($tpl);
    return;
}
Example #24
0
function build_page($method)
{
    global $mystep, $req, $db, $mydb, $setting, $id;
    $tpl_info = array("idx" => "main", "style" => "../plugin/" . basename(realpath(dirname(__FILE__))) . "/tpl/", "path" => ROOT_PATH . "/" . $setting['path']['template']);
    $tpl = $mystep->getInstance("MyTpl", $tpl_info);
    if ($method == "add" || $method == "edit") {
        $tpl_info['idx'] = "input";
    } else {
        $tpl_info['idx'] = "list";
    }
    $tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info);
    if ($method == "list") {
        $page = $req->getGet("page");
        $order = $req->getGet("order");
        $order_type = $req->getGet("order_type");
        if (empty($order_type)) {
            $order_type = "desc";
        }
        $counter = $db->result($setting['db']['pre'] . "survey", "count(*)");
        list($page_arr, $page_start, $page_size) = GetPageList($counter, "?order={$order}&order_type={$order_type}", $page);
        $tpl_tmp->Set_Variables($page_arr);
        if ($counter > 0) {
            if (empty($order)) {
                $order = "id";
            }
            $the_order = array();
            $the_order[] = "{$order} {$order_type}";
            if ($order != "id") {
                $the_order[] = "id desc";
            }
            $db->select($setting['db']['pre'] . "survey", "*", "", array("order" => $the_order, "limit" => "{$page_start}, {$page_size}"));
            while ($record = $db->GetRS()) {
                HtmlTrans(&$record);
                switch ($record['max_select']) {
                    case 0:
                        $record['max_select'] = $setting['language']['plugin_survey_select_0'];
                        break;
                    case 1:
                        $record['max_select'] = $setting['language']['plugin_survey_select_1'];
                        break;
                    default:
                        $record['max_select'] = sprintf($setting['language']['plugin_survey_select_2'], $record['max_select']);
                }
                $record['link'] = getUrl("survey", $record['id']);
                $record['add_date'] = date("Y-m-d", $record['add_date']);
                $record['expire'] = ceil((int) $record['expire'] / (60 * 60 * 24));
                $record['expire'] = $record['expire'] == 0 ? $setting['language']['plugin_survey_expire_1'] : $record['expire'] . $setting['language']['plugin_survey_expire_2'];
                $tpl_tmp->Set_Loop('record', $record);
            }
        }
        $tpl_tmp->Set_Variable('order_type_org', $order_type);
        $order_type = $order_type == "asc" ? "desc" : "asc";
        $tpl_tmp->Set_Variable('order_type', $order_type);
        $tpl_tmp->Set_Variable('title', $setting['language']['plugin_survey_title']);
    } else {
        if ($method == "edit") {
            $record = $db->record($setting['db']['pre'] . "survey", "*", array("id", "n=", $id));
            if ($record === false) {
                $tpl->Set_Variable('main', showInfo($setting['language']['plugin_survey_error'], 0));
                $mystep->show($tpl);
                return;
            }
            HtmlTrans(&$record);
            $record['expire'] = ceil((int) $record['expire'] / (60 * 60 * 24));
            $record['expire'] = $record['expire'] == 0 ? "<option value=\"0\">" . $setting['language']['plugin_survey_expire_1'] . "</option>" : "<option value=\"{$record['expire']}\">" . $record['expire'] . $setting['language']['plugin_survey_expire_2'] . "</option>";
            $mydb->resetDB("survey_{$id}");
            $item_list = $mydb->queryAll();
            if ($item_list !== false) {
                for ($i = 0, $m = count($item_list); $i < $m; $i++) {
                    $item_list[$i]['no'] = $i + 1;
                }
            } else {
                $item_list = array();
            }
            $tpl_tmp->Set_Loop('item_list', $item_list, true);
            $mydb->closeTBL();
        } else {
            $record['user_lvl'] = 0;
            $record['max_select'] = 1;
        }
        $tpl_tmp->Set_Variables($record, "record");
        $tpl_tmp->judge_list['edit'] = $method == "edit";
        $tpl_tmp->Set_Variable('title', $method == "add" ? $setting['language']['plugin_survey_add'] : $setting['language']['plugin_survey_edit']);
        $tpl_tmp->Set_Variable('show_item', $method == "add" ? "none" : "block");
        $tpl_tmp->Set_Variable('method', $method);
    }
    $tpl_tmp->Set_Variable('max_size', ini_get('upload_max_filesize'));
    $tpl->Set_Variable('path_admin', $setting['path']['admin']);
    $tpl->Set_Variable('main', $tpl_tmp->Get_Content('$setting'));
    $db->Free();
    unset($tpl_tmp);
    $mystep->show($tpl);
    return;
}
 function JsonReturn($info = '', $data = null, $status = 0)
 {
     if ($this->returnJson) {
         exit(json_encode(array('status' => $status, 'info' => $info, 'data' => $data)));
     } else {
         $_SERVER['HTTP_X_REQUESTED_WITH'] = null;
         return $status ? showInfo($info) : showError($info);
     }
 }
Example #26
0
        print "   {$k} = {$v}\n";
    }
    #
    print "\nContents of \$_REQUEST:\n";
    foreach ($_REQUEST as $k => $v) {
        print "   {$k} = {$v}\n";
    }
    #
    print "\nContents of \$_SERVER:\n";
    foreach ($_SERVER as $k => $v) {
        print "   {$k} = {$v}\n";
    }
    print "</pre>\n";
}
?>

<html>
<head>
<link href='mystyle.css' rel='stylesheet' type='text/css'>
</head>
<body class='bheader'>
<?php 
#drawMenu() ;
#$cli = new XML_RPC_Client('/RPCSERVER','localhost',5000);
#runTests($cli);
showInfo();
?>
<br>
</body>
</html>
Example #27
0
<?php

//
// In this example, GDAL is used to get basic information about a particular
// raster dataset given in argument.
//
// Note: this is a minimal example which has nothing to do
// with the 'gdalinfo' program.
//
function showInfo(GDALDataSet $dataset)
{
    echo "driver: " . $dataset->GetDriver()->GetDescription() . "\n";
    echo "width: " . $dataset->getRasterXSize() . "\n";
    echo "height: " . $dataset->getRasterYSize() . "\n";
    echo "number of bands: " . $dataset->GetRasterCount() . "\n";
    echo "projection: " . $dataset->GetProjectionRef() . "\n";
}
$path =& $_SERVER['argv'][1];
if (!isset($path)) {
    throw new Exception("Missing argument: path to raster dataset");
}
GDALAllRegister();
$dataset = GDALOpen($path, GA_ReadOnly);
if (!$dataset) {
    throw new Exception("Could not open raster dataset: " . $path);
}
header("Content-type: text/plain");
showInfo($dataset);
# get settings
require "settings.php";
require "https_urlsettings.php";
if (isset($_POST["key"])) {
    switch ($_POST["key"]) {
        case "confirm":
            $OUTPUT = confirmInfo($_POST);
            break;
        case "write":
            $OUTPUT = writeInfo($_POST);
            break;
        default:
            $OUTPUT = showInfo();
    }
} else {
    $OUTPUT = showInfo();
}
# display output
require "template.php";
# print Info from db
function showInfo()
{
    # connect to db
    db_connect();
    $sql = "SELECT * FROM compinfo WHERE div = '" . USER_DIV . "'";
    $compRslt = db_exec($sql) or errDie("Unable to retrieve company details from Cubit.", SELF);
    $comp = pg_fetch_array($compRslt);
    db_conn("cubit");
    $sql = "SELECT * FROM cubitnet_sitesettings WHERE div='" . USER_DIV . "'";
    $rslt = db_exec($sql) or errDie("Error reading settings.");
    if (pg_num_rows($rslt) < 1) {
Example #29
0
             if ($res === TRUE) {
                 for ($i = 0; $i < $zip->numFiles; $i++) {
                     $theName = $zip->getNameIndex($i);
                     if (stripos($theName, "images/") !== 0 && stripos($theName, "template/") !== 0 || stripos($theName, "admin") > 0 || stripos($theName, ".php") > 0) {
                         $zip->deleteIndex($i);
                     }
                 }
                 $zip->close();
                 if (unzip($theFile, ROOT_PATH) == false) {
                     showInfo($setting['language']['admin_web_template_upload_error']);
                 }
             } else {
                 showInfo($setting['language']['admin_web_template_upload_error']);
             }
         } else {
             showInfo($setting['language']['admin_web_template_upload_error']);
         }
         unset($upload);
     }
     $idx = "";
     break;
 case "add_ok":
 case "edit_ok":
     if (count($_POST) > 0) {
         $log_info = $setting['language']['admin_web_template_edit'];
         if ($_POST['file_name'] == "style.css") {
             $the_file = ROOT_PATH . "/images/" . $idx . "/style.css";
         } else {
             $ext = GetFileExt($_POST['file_name']);
             if ($ext != "tpl") {
                 $_POST['file_name'] .= ".tpl";
Example #30
0
 public static function uninstall()
 {
     showInfo("You cannot uninstall the offical plugin!");
 }