function section_websites_search()
{
    $boot = new boostrap_form();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $page = CurrentPageName();
    $table = "visited_sites_tot";
    $searchstring = string_to_flexquery("sites-search");
    $ORDER = $boot->TableOrder(array("size" => "ASC"));
    if ($q->COUNT_ROWS($table) == 0) {
        senderrors("no data");
    }
    $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} ORDER BY {$ORDER} LIMIT 0,250";
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        senderrors($q->mysql_error . "<br>{$sql}");
    }
    while ($ligne = mysql_fetch_assoc($results)) {
        $md = md5(serialize($ligne));
        $ligne["size"] = FormatBytes($ligne["size"] / 1024);
        $sitenameenc = urlencode($ligne["familysite"]);
        $js = "Loadjs('miniadm.webstats.familysite.all.php?familysite={$sitenameenc}')";
        $link = $boot->trswitch($js);
        $tr[] = "\n\t\t<tr id='{$md}'>\n\t\t\t<td style='font-size:16px' width=10% nowrap {$link}>{$ligne["familysite"]}</td>\n\t\t\t<td style='font-size:16px' width=1% nowrap {$link}>{$ligne["hits"]}</td>\n\t\t\t<td style='font-size:16px' width=1% nowrap {$link}>{$ligne["size"]}</td>\n\t\t</tr>\n\t\t";
    }
    echo $boot->TableCompile(array("familysite" => "{familysite}", "hits" => "{hits}", "size" => "{size}"), $tr);
}
function section_start()
{
    $boot = new boostrap_form();
    $tpl = new templates();
    $page = CurrentPageName();
    echo $boot->SearchFormGen("searchstring", "session-search", null, null);
}
Exemplo n.º 3
0
function tabs()
{
    $users = new usersMenus();
    $Privileges_members_admins = Privileges_members_admins();
    $AS_PROXY_SECTION = false;
    if ($users->SQUID_INSTALLED) {
        $AS_PROXY_SECTION = true;
    }
    if ($users->APP_FTP_PROXY) {
        $AS_PROXY_SECTION = true;
    }
    if ($users->NGINX_INSTALLED) {
        $AS_PROXY_SECTION = true;
    }
    if (isNetSessions()) {
        $array["{network_services}"] = "miniadm.network.php?webstats-middle=yes&title=yes";
    }
    $array["{tasks}"] = "miniadm.system.schedules.php";
    $boot = new boostrap_form();
    if ($users->AsSquidAdministrator or $users->AsWebMaster) {
        if ($users->NGINX_INSTALLED) {
            if ($AS_PROXY_SECTION) {
                $array["{certificates_center}"] = "miniadmin.certificates.php?tabs=yes&title=yes";
            }
        }
    }
    if ($Privileges_members_admins) {
        $array["{users_and_groups}"] = "miniadmin.system.members.php?tabs=yes&title=yes";
    }
    echo $boot->build_tab($array);
}
function tabs()
{
    $page = CurrentPageName();
    $array["{tasks}"] = "miniadm.system.schedules-engine.php";
    $array["{parameters}"] = "{$page}?parameters=yes";
    $boot = new boostrap_form();
    echo $boot->build_tab($array);
}
function artica_section()
{
    $EXPLAIN = array();
    $boot = new boostrap_form();
    $tpl = new templates();
    //$EXPLAIN["BUTTONS"][]=$tpl->_ENGINE_parse_body(button("{new_website}", "YahooWin5('690','freewebs.HTTrack.php?item-id=0&t=0','WebCopy::{new_website}');"));
    echo $boot->SearchFormGen("context,text,process,content", "search", "&context={$_GET["context"]}&category={$_GET["category"]}");
}
function syslog_section()
{
    $EXPLAIN = array();
    $boot = new boostrap_form();
    $tpl = new templates();
    //$EXPLAIN["BUTTONS"][]=$tpl->_ENGINE_parse_body(button("{new_website}", "YahooWin5('690','freewebs.HTTrack.php?item-id=0&t=0','WebCopy::{new_website}');"));
    echo $boot->SearchFormGen("service", "search", null);
}
Exemplo n.º 7
0
function tabs()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $t = time();
    $boot = new boostrap_form();
    $array["{status}"] = "{$page}?status=yes";
    echo $boot->build_tab($array);
}
function tabs()
{
    $page = CurrentPageName();
    $sock = new sockets();
    $mini = new boostrap_form();
    $array["{parameters}"] = "squid.main.quicklinks.php?architecture-users=yes";
    $array["{IT_charter}"] = "miniadmin.proxy.charter.php?tabs=yes";
    echo $mini->build_tab($array);
}
function tabs()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $t = time();
    $boot = new boostrap_form();
    $array["{localdomains}"] = "miniadm.messaging.domains.php";
    $array["{parameters}"] = "domains.manage.org.index.php?org_section=postfix&SwitchOrgTabs={$_SESSION["ou"]}&ou={$_SESSION["ou"]}&mem=yes&dn=&miniadm=yes";
    echo $boot->build_tab($array);
}
function generate_graph()
{
    include_once 'ressources/class.artica.graphs.inc';
    $q = new mysql_squid_builder();
    $page = CurrentPageName();
    $tpl = new templates();
    $t = $_GET["t"];
    $ff = time();
    $boot = new boostrap_form();
    $sql = "SELECT zDate,not_categorized FROM tables_day WHERE not_categorized>0";
    $c = 0;
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        echo "<H2>{$q->mysql_error}</H2><center style='font-size:11px'><code>{$sql}</code></center>";
    }
    if (mysql_num_rows($results) > 0) {
        $nb_events = mysql_num_rows($results);
        while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
            $xdata[] = $ligne["zDate"];
            $ydata[] = $ligne["not_categorized"];
            $c++;
            $timeDate = strtotime($ligne["zDate"] . " 00:00:00");
            $timeText = time_to_date($timeDate);
            $js = $boot->trswitch("Loadjs('squid.visited.php?day={$ligne["zDate"]}&onlyNot=yes')");
            $jsrecat = $boot->trswitch("Loadjs('squid.visited.php?recategorize-day-js={$ligne["zDate"]}&href={$page}')");
            $BIGTABLE[] = "\n\t\t<tr>\n\t\t\t<td {$js}>{$timeText}</td>\n\t\t\t<td {$js}><strong style='font-size:18px'>{$ligne["not_categorized"]}</strong></td>\n\t\t\t<td {$jsrecat} width=1% nowrap><img src='img/loupe-32.png'></td>\n\t\t</tr>\n\t\t";
        }
        $Main = array($xdata, $ydata);
        $Main = urlencode(base64_encode(serialize($Main)));
        $t = time();
        echo "<center>\n\t\t\t<div style='font-size:18px;margin-bottom:10px'>" . $tpl->_ENGINE_parse_body("{not_categorized}/{days}") . "</div>\n\t\t\t<div id='{$ff}-graph' style='width:940px;height:450px'><center><img src='img/wait_verybig_mini_red.gif'></center></div>\n\t\t\t</center>";
    }
    $BIGTABLE_COMPILED = $tpl->_ENGINE_parse_body("\n\t\t<table class='table table-bordered table-hover'>\n\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>{date}</th>\n\t\t\t\t\t<th colspan=2>{websites}</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t <tbody>\n\t\t\t") . @implode("", $BIGTABLE) . "</tbody></table>";
    echo "<center>\n\t\t<div style='margin:8px;float-right;width:100%'>" . $tpl->_ENGINE_parse_body(button("{analyze}", "NoCategorizedAnalyze()", 18)) . "</div>\n\t\t</center>\n\t\t{$BIGTABLE_COMPILED}\n\t\n\t\t<script>\n\t\tfunction NoCategorizedAnalyze(){\n\t\t\n\t\t}\n\t\t\n\tvar x_NoCategorizedAnalyze= function (obj) {\n\t\t\tvar tempvalue=obj.responseText;\n\t\t\tif(tempvalue.length>3){alert(tempvalue)};\n\t    \twindow.location.href = '{$page}';\n\t\t}\t\n\n\t\tfunction NoCategorizedAnalyze(){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('NoCategorizedAnalyze','yes');\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_NoCategorizedAnalyze);\n\t\t}\n\t\t\n\t\tLoadjs('{$page}?graphjs=yes&container={$ff}-graph&data={$Main}');\n\t\t\n\t</script>";
}
Exemplo n.º 11
0
function parameters()
{
    $users = new usersMenus();
    $sock = new sockets();
    $FailOverArtica = $sock->GET_INFO("FailOverArtica");
    if (!is_numeric($FailOverArtica)) {
        $FailOverArtica = 1;
    }
    $FailOverArticaParams = unserialize(base64_decode($sock->GET_INFO("FailOverArticaParams")));
    if (!is_numeric($FailOverArticaParams["squid-internal-mgr-info"])) {
        $FailOverArticaParams["squid-internal-mgr-info"] = 1;
    }
    if (!is_numeric($FailOverArticaParams["ExternalPageToCheck"])) {
        $FailOverArticaParams["ExternalPageToCheck"] = 1;
    }
    $boot = new boostrap_form();
    $boot->set_checkbox("FailOverArtica", "{FailOverArtica}", $FailOverArtica, array("TOOLTIP" => "{FailOverArtica_explain}", "DISABLEALL" => true));
    $boot->set_spacertitle("{APP_PROXY}");
    $boot->set_checkbox("squid-internal-mgr-info", "{failover_mgrinfo}", $FailOverArticaParams["squid-internal-mgr-info"], array("TOOLTIP" => "{failover_mgrinfo_explain}"));
    $boot->set_checkbox("ExternalPageToCheck", "{failover_ExternalPageToCheck}", $FailOverArticaParams["ExternalPageToCheck"], array("TOOLTIP" => "{failover_ExternalPageToCheck_explain}"));
    if (!$users->CORP_LICENSE) {
        $boot->set_form_locked();
    }
    echo $boot->Compile();
}
Exemplo n.º 12
0
function popup()
{
    $tpl = new templates();
    $page = CurrentPageName();
    $ID = $_GET["ID"];
    $title = "{new_page}";
    $buttonname = "{add}";
    if ($ID > 0) {
        $q = new mysql_squid_builder();
        $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM reverse_pages_content WHERE ID='{$ID}'"));
        $title = $ligne["subject"];
        $buttonname = "{apply}";
    }
    if ($ligne["content"] == null) {
        $ligne["content"] = "<html>\n<head>\n<title>It's works</title>\n</head>\n<body>\n\t<H1>It works!</H1>\n</body>\n</html>";
    }
    $boot = new boostrap_form();
    $boot->set_hidden("ID", $ID);
    $boot->set_formtitle($title);
    if (!is_numeric($ligne["cachemin"])) {
        $ligne["cachemin"] = 5;
    }
    $boot->set_list("cachemin", "{cache}", $ligne["cachemin"], $q->CACHE_AGES);
    $boot->set_field("subject", "{subject}", $ligne["subject"]);
    $boot->set_textarea("content", "{content}", $ligne["content"], array("ENCODE" => true, "HEIGHT" => 350));
    $boot->set_button($buttonname);
    $boot->set_RefreshSearchs();
    if ($ID == 0) {
        $boot->set_CloseYahoo("YahooWin6");
    }
    echo $boot->Compile();
}
Exemplo n.º 13
0
function tabs()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $t = time();
    $boot = new boostrap_form();
    $mini = new miniadm();
    $users = new usersMenus();
    $ldap = new clladp();
    $tpl = new templates();
    if (isset($_GET["title"])) {
        $title = $tpl->_ENGINE_parse_body("<H3>{users_and_groups}</H3><p>{users_and_groups_system_explain}</p>");
    }
    if ($ldap->IsKerbAuth()) {
        $array["{activedirectory_members}"] = "miniadm.members.browse.php?section-search-ad=yes";
    }
    $array["{radius_members}"] = "miniadm.system.members.radius.php";
    if ($mini->IFItsProxy()) {
        $array["{hostpot_members}"] = "miniadmin.hotspot.php?tabs=yes&title=yes";
    }
    echo $title . $boot->build_tab($array);
}
Exemplo n.º 14
0
function search()
{
    if (!CheckRights()) {
        senderror("{ERROR_NO_PRIVS}");
    }
    $boot = new boostrap_form();
    $sock = new sockets();
    $users = new usersMenus();
    $maillog_path = $users->maillog_path;
    $tpl = new templates();
    $t = time();
    $query = base64_encode($_GET["search"]);
    if (!is_numeric($_POST["rp"])) {
        $_POST["rp"] = 500;
    }
    $array = unserialize(base64_decode($sock->getFrameWork("postfix.php?query-maillog=yes&filter={$query}&maillog={$maillog_path}&rp={$_POST["rp"]}&zarafa-filter={$_GET["zarafa-filter"]}&mimedefang-filter={$_GET["mimedefang-filter"]}")));
    $array = explode("\n", @file_get_contents("/usr/share/artica-postfix/ressources/logs/web/query.mail.log"));
    krsort($array);
    $zDate = $tpl->_ENGINE_parse_body("{zDate}");
    $hostTXT = $tpl->_ENGINE_parse_body("{host}");
    $serviceTXT = $tpl->_ENGINE_parse_body("{servicew}");
    $eventsTXT = $tpl->_ENGINE_parse_body("{events}");
    while (list($index, $line) = each($array)) {
        $lineenc = base64_encode($line);
        if (preg_match("#^[a-zA-Z]+\\s+[0-9]+\\s+([0-9\\:]+)\\s+(.+?)\\s+(.+?)\\[([0-9]+)\\]:(.+)#", $line, $re)) {
            $date = "{$re[1]}";
            $host = $re[2];
            $service = $re[3];
            $pid = $re[4];
            $line = $re[5];
        }
        $class = LineToClass($line);
        $img = statusLogs($line);
        $loupejs = "ZoomEvents('{$lineenc}')";
        $trSwitch = $boot->trswitch("blur()");
        $tr[] = "\n\t\t<tr id='{$id}' class={$class} {$trSwitch}>\n\t\t<td style='font-size:12px' {$trSwitch} width=1% nowrap><i class='icon-time'></i>&nbsp;{$date}</td>\n\t\t<td style='font-size:12px' nowrap {$trSwitch} width=1% nowrap><i class='icon-arrow-right'></i>&nbsp;{$host}</td>\n\t\t<td style='font-size:12px' nowrap {$trSwitch} width=1% nowrap>{$service}</td>\n\t\t<td style='text-align:center;font-size:12px' width=1% nowrap>{$pid}</td>\n\t\t<td style='text-align:center;font-size:12px' width=1% nowrap><img src='{$img}'></td>\n\t\t<td style='font-size:12px' nowrap {$trSwitch} width=99% nowrap>{$line}</td>\n\t\t</tr>";
    }
    echo $tpl->_ENGINE_parse_body("\n\t\n\t\t\t<table class='table table-bordered table-hover'>\n\t\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>{$zDate}</th>\n\t\t\t\t\t<th>{$hostTXT}</th>\n\t\t\t\t\t<th>{$serviceTXT}</th>\n\t\t\t\t\t<th>PID</th>\n\t\t\t\t\t<th colspan=2>{$eventsTXT}</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t <tbody>\n\t\t\t") . @implode("\n", $tr) . " </tbody>\n\t\t\t\t</table>\n\t\t\t\t<script>\n\n\t</script>\n\t";
}
function SearchTask()
{
    $boot = new boostrap_form();
    $sock = new sockets();
    $q = new mysql_squid_builder();
    $tpl = new templates();
    $CheckRunningTasks = base64_decode(unserialize($sock->getFrameWork("squid.php?CheckRunningTasks=yes")));
    $table = "webfilters_schedules";
    $searchstring = string_to_flexquery("SearchTask");
    $sql = "SELECT * FROM {$table} WHERE TaskType={$_GET["TaskID"]} {$searchstring}";
    $results = $q->QUERY_SQL($sql);
    $q2 = new mysql();
    $MyPage = CurrentPageName();
    $schedules = new system_tasks();
    while ($ligne = mysql_fetch_assoc($results)) {
        $sincerun = null;
        $tools = array();
        $delete = imgtootltip("delete-24.png", "{delete} {$ligne['ID']}", "SquidTaskDelete('{$ligne['ID']}')");
        $disabled = null;
        if (isset($CheckRunningTasks[$ligne['ID']])) {
            $run_icon = "preloader.gif";
        }
        //print_r($ligne);
        $TimeText = $tpl->_ENGINE_parse_body($schedules->PatternToHuman($ligne["TimeText"]));
        $TimeText = str_replace("<br>", "", $TimeText);
        if (intval($ligne["enabled"]) == 0) {
            $disabled = $tpl->_ENGINE_parse_body("<span class='label label-info'>{disabled}</span> ");
        }
        if (isset($CheckRunningTasks[$ligne['ID']])) {
            $sincerun = "<br><i>{$CheckRunningTasks[$ligne['ID']]}</i>";
        }
        $tablename = "TaskSq{$ligne['ID']}";
        if ($q2->TABLE_EXISTS($tablename, "artica_events")) {
            $evs = $q2->COUNT_ROWS($tablename, "artica_events");
            if ($evs > 0) {
                $tools[] = "<i class='icon-info-sign'></i> {$evs} {events}";
            }
        }
        $js = $boot->trswitch("Loadjs('miniadm.ajax.proxy.schedule.php?ID={$ligne['ID']}');");
        $ligne["TimeDescription"] = utf8_encode($ligne["TimeDescription"]);
        $delete = "<td {$js} width=1% style='text-align:center'>{$delete}</td>";
        $delete = null;
        $tr[] = "\n\t\t<tr class='{$class}'>\n\t\t<td {$js} width=1%>{$ligne['ID']}</td>\n\t\t<td {$js} >{$disabled}<strong style='font-size:16px;font-weight:bold'>{$ligne["TimeDescription"]}</strong>{$sincerun}<div>{$TimeText}</div><div style='font-size:11px'>" . $tpl->_ENGINE_parse_body(@implode("&nbsp;|&nbsp;", $tools)) . "</div></td>\n\t\t\n\t\t</tr>\n\t\t";
    }
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body("<table class='table table-bordered table-hover'>\n\t\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th width=1%>{ID}</th>\n\t\t\t\t\t<th width=98%>{task}</th>\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t <tbody>\n\t\t\t") . @implode("\n", $tr) . " </tbody>\n\t\t\n\t\t\t</table>\n";
}
Exemplo n.º 16
0
function today()
{
    $boot = new boostrap_form();
    echo $boot->SearchFormGen("uid,ipaddr,sitename,words", "search-today");
}
function webstats_middle_table_items()
{
    $t = $_GET["t"];
    $tpl = new templates();
    $MyPage = CurrentPageName();
    $q = new mysql_squid_builder();
    $users = new usersMenus();
    $sock = new sockets();
    $xtime = $_GET["xtime"];
    $database = "squidlogs";
    $tablename_members = date("Ymd", $_GET["xtime"]) . "_members";
    if ($_GET["FILTER"] == null) {
        $_GET["FILTER"] = which_filter($tablename_members);
    }
    $subtable = "( SELECT {$_GET["FILTER"]},SUM(size) as size, SUM(hits) as hits FROM `{$tablename_members}` \n\tGROUP BY {$_GET["FILTER"]} HAVING LENGTH({$_GET["FILTER"]})>0) as t";
    $search = '%';
    $table = $subtable;
    $page = 1;
    $FORCE_FILTER = null;
    $dansguardian_events = date("Ymd", $xtime) . "_hour";
    if (!$q->TABLE_EXISTS($tablename_members, $database)) {
        json_error_show("{$table} doesn't exists...");
    }
    if ($q->COUNT_ROWS($tablename_members, $database) == 0) {
        json_error_show("No data");
    }
    if (isset($_POST["sortname"])) {
        if ($_POST["sortname"] != null) {
            $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}";
        }
    }
    if (isset($_POST['page'])) {
        $page = $_POST['page'];
    }
    $searchstring = string_to_flexquery("items");
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    $boot = new boostrap_form();
    $pageStart = ($page - 1) * $rp;
    $limitSql = "LIMIT {$pageStart}, {$rp}";
    $sql = "SELECT *  FROM {$table} WHERE 1 {$searchstring} {$FORCE_FILTER} ORDER BY size DESC LIMIT 0,150";
    writelogs($sql, __FUNCTION__, __FILE__, __LINE__);
    $results = $q->QUERY_SQL($sql, $database);
    while ($ligne = mysql_fetch_assoc($results)) {
        $zmd5 = md5(serialize($ligne));
        $color = "black";
        //familysite 	size 	hits
        $colorsize = "black";
        $sizeorg = $ligne["size"];
        $ligne["hits"] = numberFormat($ligne["hits"], 0, "", " ");
        $ligne["size"] = FormatBytes($ligne["size"] / 1024);
        if ($sizeorg > 102400000) {
            $colorsize = "#4E0000";
        }
        if ($sizeorg > 512000000) {
            $colorsize = "#9A0000";
        }
        // https://192.168.1.106:9000/
        $urljs = "Loadjs('squid.members.zoom.php?table={$dansguardian_events}&field={$_GET["FILTER"]}&value={$ligne["{$_GET["FILTER"]}"]}')";
        $link = $boot->trswitch($urljs);
        $tr[] = "\n\t<tr id='{$id}'>\n\t<td {$link}><i class='icon-user'></i> {$ligne["name"]}</a>{$ligne["{$_GET["FILTER"]}"]}</td>\n\t<td {$link}><i class='icon-globe'></i> {$ligne["hits"]}</td>\n\t<td {$link}><i class='icon-globe'></i> {$ligne["size"]}</td>\n\t</tr>";
    }
    echo $tpl->_ENGINE_parse_body("\n\t\t\n\t\t<table class='table table-bordered table-hover'>\n\t\t\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>{{$_GET["FILTER"]}}</th>\n\t\t\t\t\t<th>{hits}</th>\n\t\t\t\t\t<th>{size}</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t <tbody>\n\t\t\t") . @implode("\n", $tr) . " </tbody>\n\t\t</table>";
}
function search()
{
    $page = CurrentPageName();
    $boot = new boostrap_form();
    $tpl = new templates();
    $searchstring = string_to_flexquery("search");
    $ORDER = $boot->TableOrder(array("subject" => "ASC"));
    $limitSql = "LIMIT 0,250";
    $sql = "SELECT * FROM reverse_pages_content WHERE 1 {$searchstring} ORDER BY {$ORDER} {$limitSql}";
    $q = new mysql_squid_builder();
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        echo $q->mysql_error_html();
    }
    while ($ligne = mysql_fetch_assoc($results)) {
        $ID = $ligne["ID"];
        $jsselect = null;
        $select = null;
        $js = $boot->trswitch("Loadjs('miniadmin.crm.pages.php?ID={$ID}')");
        if ($_GET["field-id"] != null) {
            $select = "Loadjs('{$page}?select-js=yes&ID={$ID}&field-id={$_GET["field-id"]}')";
            $jsselect = $boot->trswitch($select);
            $select_img = imgsimple("arrow-right-24.png", null, $select);
        }
        $delete_img = imgsimple("delete-24.png", null, "Loadjs('{$page}?delete-js=yes&ID={$ID}')");
        $tr[] = "\n\t<tr id='{$ligne["ID"]}'>\n\t<td width='99%' nowrap {$js}><i class='icon-tags'></i> {$ligne["subject"]}</a></td>\n\t<td width='45px' nowrap style='vertical-align:middle;text-align:center'>{$select_img}</td>\n\t<td width='45px' nowrap style='vertical-align:middle;text-align:center'>{$delete_img}</td>\n\t</tr>";
    }
    $html = $boot->TableCompile(array("subject" => "{subject}", "ID" => "select", "delete" => "{delete}"), $tr);
    echo $tpl->_ENGINE_parse_body($html);
}
function settings()
{
    $tpl = new templates();
    $page = CurrentPageName();
    $q = new mysql_catz();
    $users = new usersMenus();
    $sock = new sockets();
    $SquidDBTuningParameters = unserialize(base64_decode($sock->GET_INFO("MySQLCatzParams")));
    $query_cache_size = $SquidDBTuningParameters["query_cache_size"];
    $max_allowed_packet = $SquidDBTuningParameters["max_allowed_packet"];
    $max_connections = $SquidDBTuningParameters["max_connections"];
    $connect_timeout = $SquidDBTuningParameters["connect_timeout"];
    $interactive_timeout = $SquidDBTuningParameters["interactive_timeout"];
    $key_buffer_size = $SquidDBTuningParameters["key_buffer_size"];
    $table_open_cache = $SquidDBTuningParameters["table_open_cache"];
    $myisam_sort_buffer_size = $SquidDBTuningParameters["myisam_sort_buffer_size"];
    $ListenPort = $SquidDBTuningParameters["ListenPort"];
    $tmpdir = $SquidDBTuningParameters["tmpdir"];
    if (!isset($SquidDBTuningParameters["net_read_timeout"])) {
        $SquidDBTuningParameters["net_read_timeout"] = 120;
    }
    $serverMem = round(($users->MEM_TOTAL_INSTALLEE - 300) / 1024);
    $VARIABLES = $q->SHOW_VARIABLES();
    if (is_array($SquidDBTuningParameters)) {
        while (list($key, $value) = each($SquidDBTuningParameters)) {
            if (isset($SquidDBTuningParameters[$key])) {
                if ($GLOBALS["VERBOSE"]) {
                    echo "VARIABLES[{$key}]={$VARIABLES[$key]} MySQLCatzParams[{$key}]={$SquidDBTuningParameters[$key]}<br>\n";
                }
                if ($VARIABLES[$key] == null) {
                    $VARIABLES[$key] = $SquidDBTuningParameters[$key];
                }
            }
        }
    }
    $read_buffer_size = round($VARIABLES["read_buffer_size"] / 1024 / 1000, 2);
    $read_rnd_buffer_size = round($VARIABLES["read_rnd_buffer_size"] / 1024 / 1000, 2);
    $sort_buffer_size = round($VARIABLES["sort_buffer_size"] / 1024 / 1000, 2);
    $thread_stack = round($VARIABLES["thread_stack"] / 1024 / 1000, 2);
    $join_buffer_size = round($VARIABLES["join_buffer_size"] / 1024 / 1000, 2);
    $max_tmp_table_size = round($VARIABLES["max_tmp_table_size"] / 1024 / 1000, 2);
    $innodb_log_buffer_size = round($VARIABLES["innodb_log_buffer_size"] / 1024 / 1000, 2);
    $innodb_additional_mem_pool_size = round($VARIABLES["innodb_additional_mem_pool_size"] / 1024 / 1000, 2);
    $innodb_log_buffer_size = round($VARIABLES["innodb_log_buffer_size"] / 1024 / 1000, 2);
    $innodb_buffer_pool_size = round($VARIABLES["innodb_buffer_pool_size"] / 1024 / 1000, 2);
    $max_connections = $VARIABLES["max_connections"];
    $per_thread_buffers = $sort_buffer_size + $read_rnd_buffer_size + $sort_buffer_size + $thread_stack + $join_buffer_size;
    $total_per_thread_buffers = $per_thread_buffers * $max_connections;
    if ($total_per_thread_buffers > $serverMem) {
        $color = "#EB0000";
    }
    $query_cache_size = round($VARIABLES["query_cache_size"] / 1024 / 1000, 2);
    $key_buffer_size = round($VARIABLES["key_buffer_size"] / 1024 / 1000, 2);
    if ($tmpdir == null) {
        $tmpdir = "/tmp";
    }
    $server_buffers = $key_buffer_size + $max_tmp_table_size + $innodb_buffer_pool_size + $innodb_additional_mem_pool_size + $innodb_log_buffer_size + $query_cache_size;
    if ($server_buffers > $serverMem) {
        $color = "#EB0000";
    }
    $max_used_memory = $server_buffers + $total_per_thread_buffers;
    if ($max_used_memory > $serverMem) {
        $color = "#EB0000";
    }
    $UNIT = "M";
    if ($max_used_memory > 1000) {
        $max_used_memory = round($max_used_memory / 1000, 2);
        $UNIT = "G";
    }
    if (!is_numeric($ListenPort)) {
        $ListenPort = 0;
    }
    $boot = new boostrap_form();
    $boot->set_hidden("innodb_buffer_pool_size", $innodb_buffer_pool_size);
    $boot->set_hidden("innodb_additional_mem_pool_size", $innodb_additional_mem_pool_size);
    $boot->set_hidden("innodb_log_buffer_size", $innodb_log_buffer_size);
    $boot->set_spacertitle("{threads}:");
    $boot->set_field("read_buffer_size", "{read_buffer_size} (MB)", $read_buffer_size, array("TOOLTIP" => "{read_buffer_size_text}"));
    $boot->set_field("read_rnd_buffer_size", "{read_rnd_buffer_size} (MB)", $read_rnd_buffer_size, array("TOOLTIP" => "{read_rnd_buffer_size_text}"));
    $boot->set_field("sort_buffer_size", "{sort_buffer_size} (MB)", $sort_buffer_size, array("TOOLTIP" => "{sort_buffer_size_text}"));
    $boot->set_field("thread_stack", "Thread Stack", $thread_stack, array("TOOLTIP" => "{thread_stack_text}"));
    $boot->set_spacertitle("{server}:");
    $boot->set_field("ListenPort", "{listen_port}", $ListenPort);
    $boot->set_field("tmpdir", "{working_directory}", $tmpdir, array("BUTTON" => array("LABEL" => "{browse}", "JS" => "Loadjs('SambaBrowse.php?no-shares=yes&field=%f&no-hidden=yes')")));
    $boot->set_field("net_read_timeout", "{net_read_timeout} ({seconds})", $SquidDBTuningParameters["net_read_timeout"]);
    $boot->set_field("max_connections", "{max_connections}", $max_connections);
    $boot->set_field("key_buffer_size", "{key_buffer_size} (MB)", $key_buffer_size);
    $boot->set_field("max_tmp_table_size", "MAX TMP Table size (MB)", $max_tmp_table_size);
    $boot->set_field("query_cache_size", "{query_cache_size} (MB)", $query_cache_size, array("TOOLTIP" => "{thread_stack_text}"));
    $boot->set_button("{apply}");
    $boot->set_formdescription("{$server_buffers}M + {$total_per_thread_buffers}M = {$max_used_memory}{$UNIT}");
    $html = $boot->Compile();
    echo $tpl->_ENGINE_parse_body($html);
}
Exemplo n.º 20
0
function proxy_behavior()
{
    $boot = new boostrap_form();
    $boot->set_formtitle("{proxy_behavior}");
    $boot->set_formdescription("{proxy_behavior_explain}");
    $sock = new sockets();
    $exclusive_internet_proxy = 1;
    $exclusive_reverse_proxy = 0;
    $mixed_mode = 0;
    $SquidActHasReverse = $sock->GET_INFO("SquidActHasReverse");
    $SquidActHasReverseOnly = $sock->GET_INFO("SquidActHasReverseOnly");
    if (!is_numeric($SquidActHasReverse)) {
        $SquidActHasReverse = 0;
    }
    if (!is_numeric($SquidActHasReverseOnly)) {
        $SquidActHasReverseOnly = 0;
    }
    if ($SquidActHasReverseOnly == 1) {
        $exclusive_internet_proxy = 0;
        $exclusive_reverse_proxy = 1;
        $mixed_mode = 0;
    }
    if ($SquidActHasReverseOnly == 0) {
        if ($SquidActHasReverse == 1) {
            $exclusive_internet_proxy = 0;
            $exclusive_reverse_proxy = 0;
            $mixed_mode = 1;
        }
    }
    $boot->set_checkbox("exclusive_reverse_proxy", "{exclusive_reverse_proxy}", $exclusive_reverse_proxy);
    $boot->set_checkbox("exclusive_internet_proxy", "{exclusive_internet_proxy}", $exclusive_internet_proxy);
    $boot->set_checkbox("mixed_mode", "{mixed_mode}", $mixed_mode);
    $boot->set_button("{apply}");
    echo $boot->Compile();
}
Exemplo n.º 21
0
function websites_directories_search()
{
    $searchstring = string_to_flexquery("directories-search");
    $q = new mysql_squid_builder();
    $servername = $_GET["servername"];
    $servername_enc = urlencode($servername);
    $sql = "SELECT * FROM reverse_dirs WHERE servername='{$servername}' {$searchstring} ORDER BY directory LIMIT 0,250";
    $results = $q->QUERY_SQL($sql);
    $tpl = new templates();
    $GLOBALS["CLASS_TPL"] = $tpl;
    $boot = new boostrap_form();
    $page = CurrentPageName();
    $t = time();
    while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
        $icon = "folder-move-64.png";
        $arrow = "arrow-right-64.png";
        $color = "black";
        $md = md5(serialize($ligne));
        $delete = imgsimple("delete-48.png", null, "Loadjs('{$page}?delete-folder-id-js={$ligne["folderid"]}');");
        $jsEditWW = $boot->trswitch("Loadjs('website-js=yes&servername={$servername_enc}')");
        $jsedit = $boot->trswitch("Loadjs('{$page}?website-directory-js=yes&servername={$servername}&folderid={$ligne["folderid"]}')");
        $jseditA = $jsedit;
        $ligne2 = mysql_fetch_array($q->QUERY_SQL("SELECT servername,ipaddr,port FROM reverse_sources WHERE ID='{$ligne["cache_peer_id"]}'"));
        $destination = "{$ligne2["servername"]}:{$ligne2["port"]}";
        $jseditS = $boot->trswitch("Loadjs('{$page}?js-source=yes&source-id={$ligne["cache_peer_id"]}')");
        $jseditDest = $jsedit;
        $DestFont = 16;
        $directory = trim(stripslashes($ligne["directory"]));
        $hostweb = "<div><i>{$ligne["hostweb"]}</i></div>";
        if ($ligne["local"] == 1) {
            $destination = $ligne["localdirectory"];
        }
        if ($ligne["webpageid"] > 0) {
            $ligne2 = mysql_fetch_array($q->QUERY_SQL("SELECT subject FROM reverse_pages_content WHERE ID='{$ligne["webpageid"]}'"));
            $destination = $ligne2["subject"];
            $hostweb = null;
            $DestFont = 12;
            $jseditDest = $boot->trswitch("Loadjs('miniadmin.crm.pages.php?ID={$ligne["webpageid"]}')");
        }
        $tr[] = "\n\t\t<tr style='color:{$color}' id='{$md}'>\n\t\t<td width=1% nowrap {$jsedit}><img src='img/{$icon}'></td>\n\t\t<td width=80% {$jsedit}><span style='font-size:16px;font-weight:bold'>http(s)://{$servername}/{$directory}</span></td>\n\t\t<td width=1% nowrap {$jsedit} style='vertical-align:middle'><img src='img/{$arrow}'></td>\n\t\t<td width=1% nowrap {$jseditDest} style='vertical-align:middle'>\n\t\t\t<span style='font-size:{$DestFont}px;font-weight:bold'>{$destination}</span>{$hostweb}\n\t\t</td>\n\t\t\t\n\t\t\t\n\t\t<td width=1% nowrap style='vertical-align:middle'>{$delete}</td>\n\t\t</tr>\n\t\t";
    }
    $t = time();
    $freeweb_compile_background = $tpl->javascript_parse_text("{freeweb_compile_background}");
    $reset_admin_password = $tpl->javascript_parse_text("{reset_admin_password}");
    $delete_freeweb_text = $tpl->javascript_parse_text("{delete_freeweb_text}");
    $delete_freeweb_dnstext = $tpl->javascript_parse_text("{delete_freeweb_dnstext}");
    echo $tpl->_ENGINE_parse_body("\n<table class='table table-bordered table-hover'>\n\t<thead>\n\t\t<tr>\n\t\t\t<th colspan=2>{paths}</th>\n\t\t\t<th colspan=2>{destination}</th>\n\t\t\t<th>&nbsp;</th>\n\t\t</tr>\n\t\t</thead>\n<tbody>") . @implode("", $tr) . "</tbody></table>\n<script>\n var FreeWebIDMEM{$t}='';\nvar xDelete{$t}=function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>10){alert(results);return;}\n\t\$('#'+FreeWebIDMEM{$t}).remove();\n}\n\t\nfunction Delete{$t}(server,md){\n\tFreeWebIDMEM{$t}=md;\n\tif(confirm('{$delete_freeweb_text}')){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('website-delete',server);\n\t\tXHR.sendAndLoad('{$page}', 'POST',xDelete{$t});\n\t}\n}\n</script>\n";
}
Exemplo n.º 22
0
function webstats_middle()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $users = new usersMenus();
    $t = time();
    $boot = new boostrap_form();
    if (isset($_GET["title"])) {
        $buuton0 = button("{save_network_settings}", "Loadjs('{$page}?save-network=yes')");
        $buuton1 = button("{compile_network_settings}", "Loadjs('{$page}?apply-network=yes')");
        $title = $tpl->_ENGINE_parse_body("<div style='float:right'>{$buuton0}&nbsp;{$buuton1}</div><H3>{network_services}</H3><p>{network_services_text}</p>");
    }
    if (isNetSessions()) {
        $array["{edit_networks}"] = "miniadm.network.interfaces.php";
        $array["{routing_tables}"] = "miniadm.network.routes.php";
    }
    if ($users->AsDnsAdministrator) {
        if ($users->POWER_DNS_INSTALLED) {
            $array["{dns_service}"] = "miniadm.PowerDNS.php?popup=yes&explain-title=yes";
        }
    }
    if ($_SESSION["ASDCHPAdmin"]) {
        if ($users->dhcp_installed) {
            $array["{APP_DHCP}"] = "miniadm.dhcp.php?webstats-middle=yes&explain-title=yes";
        }
    }
    if ($_SESSION["AllowChangeDomains"]) {
        $array["{manage_internet_domains}"] = "miniadm.smtpdom.php?webstats-middle=yes&title=yes";
    }
    $array["{etc_hosts}"] = "miniadm.network.etchosts.php";
    $array["{computers}"] = "miniadm.computers.browse.php?page=yes";
    //$array["{events}"]="$page?events=yes";
    echo $title . $boot->build_tab($array);
    return;
    ini_set('display_errors', 1);
    ini_set('error_reporting', E_ALL);
    ini_set('error_prepend_string', null);
    ini_set('error_append_string', null);
    $page = CurrentPageName();
    $tpl = new templates();
    $tr = array();
    $dhcp = Paragraphe("64-dhcp.png", "{APP_DHCP}", "{APP_DHCP_TEXT}", "miniadm.dhcp.php?webstats-middle=yes");
    $domains = Paragraphe("domain-main-64.png", "{manage_internet_domains}", "{manage_internet_domains_text}", "miniadm.smtpdom.php");
    if (!$_SESSION["ASDCHPAdmin"]) {
        $dhcp = Paragraphe("64-dhcp-grey.png", "{APP_DHCP}", "{APP_DHCP_TEXT}");
    }
    if (!$users->dhcp_installed) {
        $dhcp = null;
        if ($_SESSION["ASDCHPAdmin"]) {
            $dhcp = Paragraphe("64-dhcp-grey.png", "{APP_DHCP}", "{APP_DHCP_TEXT}");
        }
    }
    if (!$_SESSION["AsOrgDNSAdmin"]) {
        $pdns = Paragraphe("dns-64-grey.png", "{manage_DNS_database}", "{APP_PDNS_TEXT}");
    }
    if (!$_SESSION["AllowChangeDomains"]) {
        $domains = Paragraphe("domain-main-64-grey.png", "{manage_internet_domains}", "{manage_internet_domains_text}");
    }
    if (!$users->POWER_DNS_INSTALLED) {
        $pdns = null;
    }
    $tr[] = $dhcp;
    $tr[] = $domains;
    echo $title . $tpl->_ENGINE_parse_body(CompileTr3($tr));
}
Exemplo n.º 23
0
function charters_search()
{
    $boot = new boostrap_form();
    $tpl = new templates();
    $page = CurrentPageName();
    $searchstring = string_to_flexquery("itcharters-search");
    $q = new mysql_squid_builder();
    $ORDER = $boot->TableOrder(array("title" => "ASC"));
    $table = "itcharters";
    $t = time();
    $sql = "SELECT ID,title,TextIntro,TextButton  FROM {$table} WHERE 1 {$searchstring} ORDER BY {$ORDER} LIMIT 0,150";
    writelogs($sql, __FUNCTION__, __FILE__, __LINE__);
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        echo "<p class=text-error>{$q->mysql_error}<hr><code>{$sql}</code></p>";
    }
    while ($ligne = mysql_fetch_assoc($results)) {
        $md = md5(serialize($ligne));
        $link = $boot->trswitch("Loadjs('{$page}?charter-js=yes&ID={$ligne["ID"]}')");
        $delete = imgtootltip("delete-24.png", null, "Delete{$t}({$ligne["ID"]},'{$md}')");
        $tr[] = "\n\t<tr id='{$md}'>\n\t<td {$link}><i class='icon-globe'></i> {$ligne["title"]}</td>\n\t<td width=1% nowrap>{$delete}</td>\n\t</tr>";
    }
    $delete_text = $tpl->javascript_parse_text("{delete_this_itchart}");
    echo $boot->TableCompile(array("title" => "{it_charters}", "delete" => null), $tr) . "\n<script>\nvar mem{$t}='';\nvar xDelete{$t}=function(obj){\n\tvar tempvalue=obj.responseText;\n\tif(tempvalue.length>3){alert(tempvalue);return;}\n\t\$('#'+mem{$t}).remove();\n}\nfunction Delete{$t}(ID,mem){\n\tmem{$t}=mem;\n\tif(confirm('{$delete_text} '+ID+'?')){\n\t\tmem{$t}=mem;\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('itcharters-delete',ID);\n\t\tXHR.sendAndLoad('{$page}', 'POST',xDelete{$t});\n\t\t}\n\t}\n</script>\t\t\t\t\t\n";
}
function tab()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $t = $_GET["t"];
    $ff = time();
    $boot = new boostrap_form();
    $year = $_GET["year"];
    $month = $_GET["month"];
    $time = strtotime("{$year}-{$month}-01 00:00:00");
    $title = date("{F} Y", $time);
    $suffix = suffix();
    $array["{flow}"] = "{$page}?flow=yes{$suffix}";
    $array["{top_users}"] = "{$page}?topuser=yes{$suffix}";
    $array["{members}"] = "{$page}?topmembers-table-section=yes{$suffix}";
    echo $tpl->_ENGINE_parse_body("<div style='margin-top:20px'><H3>{$_GET["uid"]} {$title}</H3></div>") . $boot->build_tab($array);
}
function items_search()
{
    $page = CurrentPageName();
    $boot = new boostrap_form();
    $tpl = new templates();
    $searchstring = string_to_flexquery("items-search");
    $ORDER = $boot->TableOrder(array("token" => "ASC"));
    $limitSql = "LIMIT 0,150";
    $sql = "SELECT *  FROM nginx_exploits_items WHERE groupid={$_GET["groupid"]} {$searchstring}  ORDER BY {$ORDER} {$limitSql}";
    $q = new mysql_squid_builder();
    $results = $q->QUERY_SQL($sql);
    $sock = new sockets();
    $not = $tpl->_ENGINE_parse_body("{is_not}");
    if (!$q->ok) {
        echo $q->mysql_error_html();
    }
    while ($ligne = mysql_fetch_assoc($results)) {
        $reverse = null;
        if ($ligne["reverse"] == 1) {
            $reverse = "<strong>{$not}</strong>&nbsp;";
        }
        $linkipaddr = $boot->trswitch("Loadjs('{$page}?js-item=yes&ID={$ligne["ID"]}&groupid={$ligne["groupid"]}&servername={$_GET["servername"]}')");
        $ligne["token"] = $tpl->_ENGINE_parse_body("{{$ligne["token"]}}");
        $delete = imgsimple("delete-24.png", null, "Loadjs('{$page}?delete-item-js={$ligne["ID"]}&ID={$ligne["ID"]}')");
        $tr[] = "\n\t<tr id='{$ligne["ID"]}'>\n\t<td {$linkipaddr} width='30%' nowrap><i class='icon-list-alt'></i> {$ligne["token"]}</a></td>\n\t<td {$linkipaddr} width='70%' nowrap><i class='icon-list-alt'></i> {$reverse}{$ligne["pattern"]}</a></td>\n\t<td style='text-align:center' width='24px' nowrap>{$delete}</td>\n\t</tr>";
    }
    $html = $boot->TableCompile(array("token" => "{token}", "pattern" => "{pattern}", "delete" => "{delete}"), $tr);
    echo $tpl->_ENGINE_parse_body($html);
}
function table_sites_search()
{
    $t = $_GET["t"];
    $tpl = new templates();
    $MyPage = CurrentPageName();
    $q = new mysql_squid_builder();
    $users = new usersMenus();
    $sock = new sockets();
    $boot = new boostrap_form();
    $database = "squidlogs";
    $search = '%';
    $table = "generic_categories";
    $rp = 250;
    $page = 1;
    $FORCE_FILTER = null;
    $ORDER = "ORDER BY size DESC";
    if (!$q->TABLE_EXISTS($table, $database)) {
        senderror("{$table} doesn't exists...");
    }
    if ($q->COUNT_ROWS($table, $database) == 0) {
        senderror("No data");
    }
    if (isset($_POST["sortname"])) {
        if ($_POST["sortname"] != null) {
            $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}";
        }
    }
    if (isset($_POST['page'])) {
        $page = $_POST['page'];
    }
    $search = string_to_flexquery("category-search");
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    $category = mysql_escape_string2($_GET["category"]);
    $sql = "SELECT SUM( size ) AS size,SUM(hits) as hits, zDate, category FROM generic_categories GROUP BY category,zDate\n\tHAVING category='{$_GET["category"]}' ORDER BY zDate";
    $results = $q->QUERY_SQL($sql);
    $results = $q->QUERY_SQL($sql, $database);
    if (!$q->ok) {
        senderror($q->mysql_error . "<br>{$sql}");
    }
    while ($ligne = mysql_fetch_assoc($results)) {
        $color = "black";
        $ligne["hits"] = numberFormat($ligne["hits"], 0, "", " ");
        $ligne["size"] = FormatBytes($ligne["size"] / 1024);
        $xtime = strtotime($ligne["zDate"] . " 00:00:00");
        $dateText = time_to_date($xtime);
        $catz = urlencode($_GET["category"]);
        $jsSitename = $boot->trswitch("Loadjs('miniadm.webstats.websites.ByDayByCategory.php?category={$catz}&xtime={$xtime}')");
        $tr[] = "\n\t\t\t\t<tr {$jsSitename}>\n\t\t\t\t\t<td><i class='icon-time'></i>&nbsp;{$dateText}</a></td>\n\t\t\t\t\t<td><i class='icon-info-sign'></i>&nbsp;{$ligne["size"]}</td>\n\t\t\t\t\t<td><i class='icon-info-sign'></i>&nbsp;{$ligne["hits"]}</td>\n\t\t\t\t</tr>";
    }
    echo $tpl->_ENGINE_parse_body("\n\t\n\t\t<table class='table table-bordered table-hover'>\n\t\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>{day}</th>\n\t\t\t\t\t<th>{size}</th>\n\t\t\t\t\t<th>{hits}</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t <tbody>\n\t\t\t\t") . @implode("", $tr) . "</tbody></table>";
}
Exemplo n.º 27
0
function section_webrules_search()
{
    $q = new mysql_squid_builder();
    $database = "squidlogs";
    $sock = new sockets();
    $tpl = new templates();
    $search = '%';
    $table = "websites_caches_params";
    $searchstring = string_to_flexquery("search-webrules");
    $sql = "SELECT *  FROM `{$table}` WHERE 1 {$searchstring} ORDER BY sitename";
    $results = $q->QUERY_SQL($sql, $database);
    if (!$q->ok) {
        senderror($q->mysql_error);
    }
    $boot = new boostrap_form();
    $t = time();
    while ($ligne = mysql_fetch_assoc($results)) {
        $ID = md5($ligne["sitename"]);
        $delete = imgtootltip("delete-24.png", "{delete}", "DeleteWebsiteCached{$t}('{$ligne["sitename"]}','{$ID}')");
        $select = "Loadjs('squid.miniwebsite.tasks.php?cache-params-js=yes&sitename={$ligne["sitename"]}&table-t={$_GET["t"]}');";
        $ligne["MIN_AGE"] = $ligne["MIN_AGE"];
        $ligne["MIN_AGE"] = $tpl->javascript_parse_text(distanceOfTimeInWords(time(), mktime() + $ligne["MIN_AGE"] * 60, true));
        $ligne["MAX_AGE"] = $ligne["MAX_AGE"];
        $ligne["MAX_AGE"] = $tpl->javascript_parse_text(distanceOfTimeInWords(time(), mktime() + $ligne["MAX_AGE"] * 60, true));
        if (trim($ligne["sitename"]) == '.') {
            $ligne["sitename"] = $tpl->_ENGINE_parse_body("{all}");
        }
        $link = $boot->trswitch($select);
        $tr[] = "\n\t\t<tr id='{$ID}'>\n\t\t<td {$link}><i class='icon-globe'></i>&nbsp;{$ligne["sitename"]}</td>\n\t\t<td {$link} width=1% nowrap>{$ligne["MIN_AGE"]}</td>\n\t\t<td {$link} width=1% nowrap>{$ligne["PERCENT"]}%</td>\n\t\t<td {$link} width=1% nowrap>{$ligne["MAX_AGE"]}</td>\n\t\t<td width=1% nowrap>{$delete}</td>\n\t\t</tr>";
    }
    echo $tpl->_ENGINE_parse_body("\n\t\t\t<table class='table table-bordered table-hover'>\n\t\n\t\t\t<thead>\n\t\t\t<tr>\n\t\t\t<th>{website}</th>\n\t\t\t<th>{expire_time}</th>\n\t\t\t<th>%</th>\n\t\t\t<th>{limit}</th>\n\t\t\t<th>&nbsp;</th>\n\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t<tbody>\n\t\t\t") . @implode("", $tr) . "</tbody></table>\n<script>\nvar websiteMem{$t}='';\n\t\tvar x_DeleteWebsiteCached{$t}= function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tif(results.length>0){alert(results);return;}\n\t\t\t\$('#'+websiteMem{$t}).remove();\t\t\t\n\t\t\t\t\n\t\t}\t\n\n\t\tfunction DeleteWebsiteCached{$t}(domain,id){\n\t\t\twebsiteMem{$t}=id;\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('DELETE',domain);\n\t\t\tXHR.sendAndLoad('squid.caches32.caches-www.php', 'POST',x_DeleteWebsiteCached{$t});\n\t\t}\n</script>\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\n";
}
Exemplo n.º 28
0
function table_blocked()
{
    $tpl = new templates();
    $MyPage = CurrentPageName();
    $q = new mysql_squid_builder();
    $dt = strtotime("{$_GET["zday"]} 00:00:00");
    if (isset($_SESSION["QUERY_BLOCKED_DATE"])) {
        $dt = $_SESSION["QUERY_BLOCKED_DATE"];
    }
    $zday = date('Ymd', $dt);
    $title_date = time_to_date($dt);
    $MAIN_QUERY = $_GET["query-blocked"];
    $search = '%';
    $table = $zday . "_blocked";
    if (!$q->TABLE_EXISTS($table)) {
        senderrors("{no_such_table}:{$table}");
    }
    $main_query = $_GET["query-blocked"];
    $QUERY_BLOCKED_UID = $_SESSION["QUERY_BLOCKED_UID"];
    $QUERY_BLOCKED_CATEGORY = $_SESSION["QUERY_BLOCKED_CATEGORY"];
    $BLOCKED_CATEGORY_LIMIT = $_SESSION["BLOCKED_CATEGORY_LIMIT"];
    if (!is_numeric($BLOCKED_CATEGORY_LIMIT)) {
        $BLOCKED_CATEGORY_LIMIT = 250;
    }
    if ($QUERY_BLOCKED_UID != null) {
        $title_members = " {and} {member}:{$QUERY_BLOCKED_UID}";
        $QUERY_BLOCKED_UID_OP = " = ";
        if (preg_match("#not.*?:(.+)#i", $QUERY_BLOCKED_UID, $re)) {
            $neg = true;
            $QUERY_BLOCKED_UID = trim($re[1]);
        }
        if ($neg) {
            $QUERY_BLOCKED_UID_OP = " != ";
        }
        $QUERY_BLOCKED_UID = str_replace("*", "%", $QUERY_BLOCKED_UID);
        if (strpos(" {$QUERY_BLOCKED_UID}", "%") > 0) {
            $QUERY_BLOCKED_UID_OP = " LIKE ";
            if ($neg) {
                $QUERY_BLOCKED_UID_OP = " NOT LIKE ";
            }
        }
        $QUERY_BLOCKED_UID_SQL = " AND (\n\t\t\t(`client` {$QUERY_BLOCKED_UID_OP}'{$QUERY_BLOCKED_UID}') \n\t\t\tOR (`hostname` {$QUERY_BLOCKED_UID_OP}'{$QUERY_BLOCKED_UID}')\n\t\t\tOR (`uid` {$QUERY_BLOCKED_UID_OP}'{$QUERY_BLOCKED_UID}')\n\t\t\t)\n\t\t";
    }
    $neg = false;
    if ($QUERY_BLOCKED_CATEGORY != null) {
        $title_cat = " {and} {category}:{$QUERY_BLOCKED_CATEGORY}";
        if (preg_match("#not.*?:(.+)#i", $QUERY_BLOCKED_CATEGORY, $re)) {
            $neg = true;
            $QUERY_BLOCKED_CATEGORY = trim($re[1]);
        }
        $QUERY_BLOCKED_CATEGORY = str_replace("*", "%", $QUERY_BLOCKED_CATEGORY);
        $QUERY_BLOCKED_CATEGORY_OP = " = ";
        if ($neg) {
            $QUERY_BLOCKED_CATEGORY_OP = " != ";
        }
        if (strpos(" {$QUERY_BLOCKED_CATEGORY}", "%") > 0) {
            $QUERY_BLOCKED_CATEGORY_OP = " LIKE ";
            if ($neg) {
                $QUERY_BLOCKED_CATEGORY_OP = " NOT LIKE ";
            }
        }
        $QUERY_BLOCKED_CATEGORY_SQL = " AND `category`{$QUERY_BLOCKED_CATEGORY_OP}'{$QUERY_BLOCKED_CATEGORY}'";
    }
    $neg = false;
    if ($MAIN_QUERY != null) {
        $title_cat = " {and} {website}:{$MAIN_QUERY}";
        if (preg_match("#not.*?:(.+)#i", $MAIN_QUERY, $re)) {
            $neg = true;
            $MAIN_QUERY = trim($re[1]);
        }
        $MAIN_QUERY = str_replace("*", "%", $MAIN_QUERY);
        $MAIN_QUERY_OP = " = ";
        if ($neg) {
            $MAIN_QUERY_OP = " != ";
        }
        if (strpos(" {$MAIN_QUERY}", "%") > 0) {
            $MAIN_QUERY_OP = " LIKE ";
            if ($neg) {
                $MAIN_QUERY_OP = " NOT LIKE ";
            }
        }
        $MAIN_QUERY_SQL = " AND `website`{$MAIN_QUERY_OP}'{$MAIN_QUERY}'";
    }
    $sql = "SELECT * FROM `{$table}` WHERE 1 {$MAIN_QUERY_SQL}{$QUERY_BLOCKED_UID_SQL}{$QUERY_BLOCKED_CATEGORY_SQL} ORDER BY zDate LIMIT 0,{$BLOCKED_CATEGORY_LIMIT}";
    $results = $q->QUERY_SQL($sql, 'artica_events');
    $boot = new boostrap_form();
    $UnBlockWebSiteExplain = $tpl->javascript_parse_text("{UnBlockWebSiteExplain}");
    $today = date('Y-m-d');
    if (!$q->ok) {
        sendserrors($q->mysql_error . "<br>{$sql}");
    }
    $t = time();
    $q2 = new mysql();
    while ($ligne = mysql_fetch_assoc($results)) {
        $member = $ligne["client"];
        if ($ligne["hostname"] != null) {
            $member = $ligne["hostname"];
        }
        if ($ligne["uid"] != null) {
            $member = $ligne["uid"];
        }
        $js = "Loadjs('squid.categories.php?category={$ligne["category"]}&website={$ligne["website"]}',true)";
        $link = $boot->trswitch($js);
        $unblock = imgsimple("whitelist-24.png", null, "UnBlockWebSite{$t}('{$ligne["website"]}')");
        $ligne3 = mysql_fetch_array($q2->QUERY_SQL("SELECT items FROM urlrewriteaccessdeny WHERE items='{$ligne["website"]}'", "artica_backup"));
        if (!$q->ok) {
            $unblock = "<img src='img/icon_err.gif'><br>{$q->mysql_error}";
        } else {
            if ($ligne3["items"] != null) {
                $unblock = imgsimple("20-check.png", null, null);
            }
        }
        if ($ligne["blocktype"] != null) {
            $blocktype = "<div><i style='font-size:10px'>{$ligne["blocktype"]}</i></div>";
        }
        $tr[] = "\n\t\t<tr>\n\t\t<td nowrap><i class='icon-time'></i>&nbsp;{$ligne["zDate"]}</td>\n\t\t<td {$link}><i class='icon-user'></i>&nbsp;{$member}</td>\n\t\t<td {$link}><i class='icon-globe'></i>&nbsp;{$ligne["website"]}{$blocktype}</td>\n\t\t<td {$link}><i class='icon-info'></i>&nbsp;{$ligne["category"]}</td>\n\t\t<td {$link}><i class='icon-info'></i>&nbsp;{$ligne["rulename"]}</td>\n\t\t<td>{$unblock}</td>\n\t\t</tr>";
    }
    echo $tpl->_ENGINE_parse_body("\n\t\t\t\n\t\t<p>{search}:{$title_date}{$title_members}{$title_cat}</p>\n\t\t<table class='table table-bordered table-hover'>\n\t\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>{zDate}&nbsp;</th>\n\t\t\t\t\t<th>{member}</th>\n\t\t\t\t\t<th>{website}</th>\n\t\t\t\t\t<th>{category}</th>\n\t\t\t\t\t<th>{rule}</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t <tbody>\n\t\t\t") . @implode("\n", $tr) . " </tbody>\n\t\t</table>\n\t\t<script>\n\tvar x_UnBlockWebSite{$t}=function(obj){\n\t      var tempvalue=obj.responseText;\n\t      if(tempvalue.length>3){alert(tempvalue);}\n\t      \n\t}\t\n\nfunction UnBlockWebSite{$t}(domain){\n\tif(confirm('{$UnBlockWebSiteExplain}:'+domain+' ?')){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('unlock',domain);\n\t\tXHR.sendAndLoad('squid.blocked.events.php', 'POST',x_UnBlockWebSite{$t});\n\t}\n\n}\n</script>\t\t\t\t\t\n";
}
Exemplo n.º 29
0
function table_all_videos_search()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $users = new usersMenus();
    $TB_HEIGHT = 500;
    $TB_WIDTH = 910;
    $uid = $_GET["uid"];
    $t = time();
    $new_entry = $tpl->javascript_parse_text("{new_backup_rule}");
    $imapserv = $tpl->_ENGINE_parse_body("{imap_server}");
    $account = $tpl->_ENGINE_parse_body("{account}");
    //	$title=$tpl->_ENGINE_parse_body("$attachments_storage {items}:&nbsp;&laquo;$size&raquo;");
    $filessize = $tpl->_ENGINE_parse_body("{filesize}");
    $action_delete_rule = $tpl->javascript_parse_text("{action_delete_rule}");
    $enable = $tpl->_ENGINE_parse_body("{enable}");
    $compile_rules = $tpl->_ENGINE_parse_body("{compile_rules}");
    $online_help = $tpl->_ENGINE_parse_body("{online_help}");
    $enabled = $tpl->_ENGINE_parse_body("{enabled}");
    $items = $tpl->_ENGINE_parse_body("{items}");
    $error_want_operation = $tpl->javascript_parse_text("{error_want_operation}");
    $events = $tpl->javascript_parse_text("{events}");
    $category = $tpl->javascript_parse_text("{category}");
    $title = $tpl->javascript_parse_text("{video_title}");
    $created = $tpl->javascript_parse_text("{created}");
    $duration = $tpl->javascript_parse_text("{duration}");
    $hits = $tpl->javascript_parse_text("{hits}");
    $categories = $tpl->javascript_parse_text("{categories}");
    if (!isset($_SESSION["QUERY_YOUTUBE_LIMIT"])) {
        $_SESSION["QUERY_YOUTUBE_LIMIT"] = 250;
    }
    $q = new mysql_squid_builder();
    $search = string_to_flexquery("videos-search");
    $filters = array();
    $filters[] = SearchToSql("category", $_SESSION["QUERY_YOUTUBE_CATE"]);
    $sql = "SELECT *  FROM youtube_objects WHERE 1 {$search} " . @implode($filters, " ") . " ORDER BY uploaded DESC LIMIT 0,{$_SESSION["QUERY_YOUTUBE_LIMIT"]}";
    $results = $q->QUERY_SQL($sql);
    $boot = new boostrap_form();
    if (!$q->ok) {
        die("<p class=text-error>{$q->mysql_error}</p>");
    }
    $seconds = $tpl->_ENGINE_parse_body("{seconds}");
    $minutes = $tpl->_ENGINE_parse_body("{minutes}");
    $hours = $tpl->_ENGINE_parse_body("{hours}");
    while ($ligne = mysql_fetch_assoc($results)) {
        $youtubeid = $ligne["youtubeid"];
        $color = "black";
        $unit = $seconds;
        $ligne["duration"] = format_time($ligne["duration"]);
        $urljsSIT = "Loadjs('miniadm.webstats.youtubeid.php?youtubeid={$youtubeid}')";
        $link = $boot->trswitch($urljsSIT);
        $jsvideo = $boot->trswitch("Loadjs('miniadm.webstats.youtubeid.php?youtubeid={$youtubeid}');");
        $tr[] = "\n\t\t<tr id='{$id}'>\n\t\t<td {$jsvideo}><img  src='{$page}?thumbnail={$youtubeid}' class=img-polaroid></td>\n\t\t<td {$link} nowrap><i class='icon-time'></i>&nbsp;{$ligne["uploaded"]}</td>\n\t\t<td {$link}><i class='icon-info-sign'></i>&nbsp;{$ligne["title"]}</td>\n\t\t<td {$link} nowrap><i class='icon-info-sign'></i>&nbsp;{$ligne["category"]}</td>\n\t\t<td {$link} nowrap><i class='icon-info-sign'></i>&nbsp;{$ligne["duration"]}</td>\n\t\t<td {$link} nowrap><i class='icon-info-sign'></i>&nbsp;{$ligne["hits"]}</td>\n\t\t</tr>";
    }
    echo $tpl->_ENGINE_parse_body("\n\t<table class='table table-bordered table-hover'>\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>{$created}</th>\n\t\t\t\t\t<th>{$title}</th>\n\t\t\t\t\t<th>{$category} {$_SESSION["QUERY_YOUTUBE_CATE"]}</th>\n\t\t\t\t\t<th>{$duration}</th>\n\t\t\t\t\t<th>{$hits}</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t <tbody>\n\t\t\t") . @implode("", $tr) . "</tbody></table>";
}
function www_top_table()
{
    $q = new mysql_squid_builder();
    $tpl = new templates();
    $boot = new boostrap_form();
    $tablename = "www_" . $q->uid_to_tablename($_GET["uid"]);
    $member = urlencode($_GET["uid"]);
    $q = new mysql_squid_builder();
    if (!$q->TABLE_EXISTS($tablename)) {
        echo "<p class=text-error>No table &laquo;{$tablename}&raquo; for {$_GET["uid"]}</p>";
        return;
    }
    $sql = "SELECT SUM(hits) as hits,SUM(size) as size,familysite FROM `{$tablename}` GROUP BY\n\tcategory,familysite HAVING category='{$_GET["category"]}' ORDER BY size DESC,hits DESC LIMIT 0,100";
    if ($_GET["category"] == null) {
        $sql = "SELECT SUM(hits) as hits,SUM(size) as size,familysite FROM `{$tablename}` GROUP BY\n\tcategory,familysite HAVING category IS NULL ORDER BY size DESC,hits DESC LIMIT 0,100";
    }
    $results = $q->QUERY_SQL($sql);
    $_GET["uid"] = urlencode($_GET["uid"]);
    if (!$q->ok) {
        echo "<p class=text-error>{$q->mysql_error}<br>{$sql}</p>";
        return;
    }
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $size = FormatBytes($ligne["size"] / 1024);
        $hits = FormatNumber($ligne["hits"]);
        $familysite = $ligne["familysite"];
        $fsite = urlencode($familysite);
        $jslink = "Loadjs('miniadm.webstats.ByMember.website.php?familysite={$fsite}&member-value={$member}&by=uid')";
        $link = $boot->trswitch($jslink);
        $tr[] = "\n\t<tr>\n\t<td {$link}><i class='icon-globe'></i> {$familysite}</a></td>\n\t<td {$link}><i class='icon-info-sign'></i> {$size}</td>\n\t<td {$link}><i class='icon-info-sign'></i> {$hits}</td>\n\t</tr>";
    }
    echo $tpl->_ENGINE_parse_body("\n\t\n\t\t\t<table class='table table-bordered table-hover'>\n\t\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>{websites}</th>\n\t\t\t\t\t<th>{size}</th>\n\t\t\t\t\t<th>{hits}</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t <tbody>\n\t\t\t") . @implode("", $tr) . "</tbody></table>";
}