Ejemplo n.º 1
0
function table()
{
    $sock = new sockets();
    $EnableSquidGuardHTTPService = $sock->GET_INFO("EnableSquidGuardHTTPService");
    if (!is_numeric($EnableSquidGuardHTTPService)) {
        $EnableSquidGuardHTTPService = 1;
    }
    if ($EnableSquidGuardHTTPService == 0) {
        echo FATAL_ERROR_SHOW_128("{web_page_service_is_disabled}");
        die;
    }
    $q = new mysql_squid_builder();
    if (!$q->TABLE_EXISTS("ufdb_page_rules")) {
        $sql = "CREATE TABLE IF NOT EXISTS `ufdb_page_rules` (\n\t\t\t`zmd5` varchar(90) NOT NULL,\n\t\t\t`category` varchar(90) NOT NULL,\n\t\t\t`deny` smallint(1) NOT NULL,\n\t\t\t`allow` smallint(1) NOT NULL,\n\t\t\t`adgroup` varchar(255) NOT NULL,\n\t\t\t`noauth` smallint(1) NOT NULL,\n\t\t\t`maxtime` smallint(3) NOT NULL,\n\t\t\t`infinite` smallint(1) NOT NULL,\n\t\t\t`addTocat` varchar(255) NOT NULL,\n\t\t\t`username` varchar(255) NOT NULL,\n\t\t\t`webruleid` INT(10) NOT NULL,\n\t\t\tPRIMARY KEY (`zmd5`),\n\t\t\tKEY `category` (`category`),\n\t\t\tKEY `deny` (`deny`),\n\t\t\tKEY `allow` (`allow`),\n\t\t\tKEY `webruleid`(`webruleid`),\n\t\t\tKEY `infinite` (`infinite`)\n\t\t\t) ENGINE=MYISAM;";
        $q->QUERY_SQL($sql);
        if (!$q->ok) {
            FATAL_ERROR_SHOW_128($q->mysql_error_html());
        }
        return;
    }
    $page = CurrentPageName();
    $tpl = new templates();
    $new_rule = $tpl->_ENGINE_parse_body("{new_rule}");
    $description = $tpl->_ENGINE_parse_body("{description}");
    $context = $tpl->_ENGINE_parse_body("{context}");
    $events = $tpl->_ENGINE_parse_body("{events}");
    $destination = $tpl->_ENGINE_parse_body("{destination}");
    $website = $tpl->_ENGINE_parse_body("{website}");
    $settings = $tpl->javascript_parse_text("{watchdog_squid_settings}");
    $empty_events_text_ask = $tpl->javascript_parse_text("{empty_events_text_ask}");
    $members = $tpl->javascript_parse_text("{members}");
    $allow = $tpl->javascript_parse_text("{allow}");
    $category = $tpl->javascript_parse_text("{category}");
    $deny = $tpl->javascript_parse_text("{deny}");
    $banned_page_webservice = $tpl->javascript_parse_text("{banned_page_webservice}");
    $rules = $tpl->javascript_parse_text("{rules}");
    $apply = $tpl->javascript_parse_text("{apply}");
    $ticket = $tpl->javascript_parse_text("{ticket}");
    $clean_cache = $tpl->javascript_parse_text("{clean_cache}");
    $smtp_parameters = $tpl->javascript_parse_text("{smtp_parameters}");
    $t = time();
    if (isset($_GET["dashboard"])) {
        $WEBFILTERING_TOP_MENU = WEBFILTERING_TOP_MENU();
        $DASHBOARD = $tpl->_ENGINE_parse_body("<div style='font-size:30px;margin-bottom:20px'>{$WEBFILTERING_TOP_MENU}</div>");
    }
    $buttons = "\n\tbuttons : [\n\t\t{name: '<strong style=font-size:22px>{$new_rule}</strong>', bclass: 'add', onpress :  newrule{$t}},\n\t\t{name: '<strong style=font-size:22px>{$apply}</strong>', bclass: 'apply', onpress :  apply{$t}},\n\t\t{name: '<strong style=font-size:22px>{$clean_cache}</strong>', bclass: 'apply', onpress :  CleanCache{$t}},\n\t\t{name: '<strong style=font-size:22px>{$smtp_parameters}</strong>', bclass: 'Settings', onpress :  smtp_parameters{$t}},\n\t],";
    $html = "{$DASHBOARD}\n\t<table class='UFDB_PAGE_RULE' style='display: none' id='UFDB_PAGE_RULE' style='width:99%'></table>\n\t<script>\n\tfunction BuildTable{$t}(){\n\t\$('#UFDB_PAGE_RULE').flexigrid({\n\turl: '{$page}?list=yes',\n\tdataType: 'json',\n\tcolModel : [\n\t{display: '<span style=font-size:18px>{$category}</span>', name : 'category', width :595, sortable : false, align: 'left'},\n\t{display: '<span style=font-size:18px>{$deny}</span>', name : 'deny', width :70, sortable : true, align: 'center'},\n\t{display: '<span style=font-size:18px>{$allow}</span>', name : 'allow', width :70, sortable : true, align: 'center'},\n\t{display: '<span style=font-size:18px>{$ticket}</span>', name : 'ticket', width :70, sortable : true, align: 'center'},\n\t{display: '<span style=font-size:18px>{$members}</span>', name : 'members', width :433, sortable : false, align: 'left'},\n\t{display: '&nbsp;', name : 'delete', width :70, sortable : false, align: 'center'},\n\t],\n\t{$buttons}\n\n\tsearchitems : [\n\t\t{display: '{$category}', name : 'category'},\n\t],\n\tsortname: 'category',\n\tsortorder: 'asc',\n\tusepager: true,\n\ttitle: '<strong style=font-size:30px>{$banned_page_webservice} > > {$rules}</strong>',\n\tuseRp: true,\n\trp: 50,\n\tshowTableToggleBtn: false,\n\twidth: '99%',\n\theight: 550,\n\tsingleSelect: true,\n\trpOptions: [10, 20, 30, 50,100,200,500]\n\n});\n}\n\nfunction apply{$t}(){\n\tLoadjs('squid.compile.progress.php');\n}\n\nfunction newrule{$t}(){\n\tLoadjs('{$page}?rule-js=')\n}\nfunction purge_caches{$t}(){\nLoadjs('system.services.cmd.php?APPNAME=APP_NGINX&action=purge&cmd=%2Fetc%2Finit.d%2Fnginx&appcode=APP_NGINX');\n}\nfunction smtp_parameters{$t}(){\n\tLoadjs('squidguardweb.php?smtp-parameters-js=yes')\n}\n\nfunction New{$t}(){\n\tLoadjs('nginx.new.php?peer-id={$_GET["ID"]}');\n}\n\nvar xCleanCache{$t}=function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>0){alert(results);}\n}\n\nfunction CleanCache{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('clean-cache','yes');\n\tXHR.sendAndLoad('{$page}', 'POST',xCleanCache{$t});\n\t\n}\n\n\n\tBuildTable{$t}();\n\t</script>";
    echo $html;
}
Ejemplo n.º 2
0
function rules()
{
    $tpl = new templates();
    $page = CurrentPageName();
    $q = new mysql_squid_builder();
    $users = new usersMenus();
    $sock = new sockets();
    if (!$users->APP_UFDBGUARD_INSTALLED) {
        rules_ufdb_not_installed();
        return;
    }
    $WEBFILTERING_TOP_MENU = WEBFILTERING_TOP_MENU();
    $html = "\n\t<div style='font-size:30px;margin-bottom:20px'>{$WEBFILTERING_TOP_MENU}</div>\t\t\n\t<div id='rules-table'></div>\n\t<script>\n\t\tLoadAjax('rules-table','{$page}?rules-table=yes');\n\t</script>\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
function categories()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $users = new usersMenus();
    $q = new mysql_squid_builder();
    if (!$q->TABLE_EXISTS("webfilters_categories_caches")) {
        $q->CheckTables();
    } else {
        $q->QUERY_SQL("TRUNCATE TABLE webfilters_categories_caches");
    }
    $q->QUERY_SQL("DELETE FROM personal_categories WHERE category='';");
    $OnlyPersonal = null;
    $dans = new dansguardian_rules();
    $dans->LoadBlackListes();
    $purge_catagories_database_explain = $tpl->javascript_parse_text("{purge_catagories_database_explain}");
    $purge_catagories_table_explain = $tpl->javascript_parse_text("{purge_catagories_table_explain}");
    $items = $tpl->_ENGINE_parse_body("{items}");
    $size = $tpl->_ENGINE_parse_body("{size}");
    $SaveToDisk = $tpl->_ENGINE_parse_body("{SaveToDisk}");
    $addCat = $tpl->_ENGINE_parse_body("{new_category}");
    $purge = $tpl->_ENGINE_parse_body("{purgeAll}");
    $category = $tpl->_ENGINE_parse_body("{category}");
    $tablewith = 691;
    $compilesize = 35;
    $size_elemnts = 50;
    $size_size = 58;
    $title = $tpl->javascript_parse_text("{your_categories}");
    $deletetext = $tpl->javascript_parse_text("{purge}");
    $test_categories = $tpl->javascript_parse_text("{test_categories}");
    $delete = "{display: '<strong style=font-size:18px>{$deletetext}</strong>', name : 'icon3', width : 90, sortable : false, align: 'center'},";
    $add = $tpl->javascript_parse_text("{add}");
    $WEBFILTERING_TOP_MENU = WEBFILTERING_TOP_MENU();
    if (!$users->CORP_LICENSE) {
        $error = "\n\t\t\t\t\n\t\t\t\t<p class=text-error style='font-size:18px'>" . $tpl->_ENGINE_parse_body("{this_feature_is_disabled_corp_license}") . "</p>";
    }
    $t = time();
    $html = "<div style='font-size:30px;margin-bottom:20px'>{$WEBFILTERING_TOP_MENU}</div>\n\t\t\t{$error}\n<table class='PERSONAL_CATEGORIES_TABLE' style='display: none' id='PERSONAL_CATEGORIES_TABLE' style='width:99%'></table>\n<script>\n\$(document).ready(function(){\n\t\$('#PERSONAL_CATEGORIES_TABLE').flexigrid({\n\turl: '{$page}?category-search=yes',\n\tdataType: 'json',\n\tcolModel : [\n\t{display: '<strong style=font-size:18px>{$category}</strong>', name : 'category', width : 825, sortable : false, align: 'left'},\n\t{display: '<strong style=font-size:18px>{$add}</strong>', name : 'add', width : 121, sortable : false, align: 'center'},\n\t{display: '<strong style=font-size:18px>{$size}</strong>', name : 'category', width : 121, sortable : false, align: 'right'},\n\t{display: '<strong style=font-size:18px>{$items}</strong>', name : 'TABLE_ROWS', width : 121, sortable : true, align: 'right'},\n\t{display: '<strong style=font-size:18px>compile</strong>', name : 'icon2', width : 121, sortable : false, align: 'center'},\n\t{$delete}\n\n\t],\n\tbuttons : [\n\t\t{name: '<strong style=font-size:18px>{$addCat}</strong>', bclass: 'add', onpress : AddNewCategory},\n\t\t{name: '<strong style=font-size:18px>{$size}</strong>', bclass: 'Search', onpress : LoadCategoriesSize},\n\t\t{name: '<strong style=font-size:18px>{$test_categories}</strong>', bclass: 'Search', onpress : LoadTestCategories},\n\t\t\n\t\t\n\t\t\n\t],\n\tsearchitems : [\n\t{display: '{$category}', name : 'category'},\n\t],\n\tsortname: 'table_name',\n\tsortorder: 'asc',\n\tusepager: true,\n\ttitle: '<span style=font-size:30px>{$title}</span>',\n\tuseRp: true,\n\trpOptions: [10, 20, 30, 50,100,200],\n\trp:50,\n\tshowTableToggleBtn: false,\n\twidth: '99%',\n\theight: 550,\n\tsingleSelect: true\n\n});\n});\n\n\nfunction AddNewCategory(){\n\tLoadjs('{$page}?add-perso-cat-js=yes&t={$t}');\n}\n\nfunction SwitchToArtica(){\n\$('#dansguardian2-category-{$t}').flexOptions({url: '{$page}?category-search=yes&minisize={$_GET["minisize"]}&t={$t}&artica=1'}).flexReload();\n}\n\nfunction SaveAllToDisk(){\nLoadjs('{$page}?compile-all-dbs-js=yes')\n\n}\n\nfunction LoadTestCategories(){\n\tLoadjs('squid.category.tests.php');\n}\n\nfunction LoadCategoriesSize(){\n\tLoadjs('dansguardian2.compilesize.php')\n}\n\nfunction CategoryDansSearchCheck(e){\nif(checkEnter(e)){CategoryDansSearch();}\n}\n\nfunction CategoryDansSearch(){\nvar se=escape(document.getElementById('category-dnas-search').value);\nLoadAjax('dansguardian2-category-list','{$page}?category-search='+se,false);\n\n}\n\nfunction DansGuardianCompileDB(category){\nLoadjs('ufdbguard.compile.category.php?category='+category);\n}\n\nfunction CheckStatsApplianceC(){\nLoadAjax('CheckStatsAppliance','{$page}?CheckStatsAppliance=yes',false);\n}\n\nvar X_PurgeCategoriesDatabase= function (obj) {\nvar results=obj.responseText;\nif(results.length>2){alert(results);}\nRefreshAllTabs();\n}\n\nfunction PurgeCategoriesDatabase(){\nif(confirm('{$purge_catagories_database_explain}')){\nvar XHR = new XHRConnection();\nXHR.appendData('PurgeCategoriesDatabase','yes');\nAnimateDiv('dansguardian2-category-list');\nXHR.sendAndLoad('{$page}', 'POST',X_PurgeCategoriesDatabase);\n}\n\n}\n\nvar X_TableCategoryPurge= function (obj) {\nvar results=obj.responseText;\nif(results.length>2){alert(results);}\n\$('#dansguardian2-category-{$t}').flexReload();\n}\n\nfunction TableCategoryPurge(tablename){\nif(confirm('{$purge_catagories_table_explain}')){\nvar XHR = new XHRConnection();\nXHR.appendData('PurgeCategoryTable',tablename);\nXHR.sendAndLoad('dansguardian2.databases.compiled.php', 'POST',X_TableCategoryPurge);\n}\n}\n\n\nCheckStatsApplianceC();\n</script>\n\n";
    echo $tpl->_ENGINE_parse_body($html);
}
Ejemplo n.º 4
0
function page()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $sock = new sockets();
    $q = new mysql_squid_builder();
    if ($sock->EnableUfdbGuard() == 0) {
        if ($q->COUNT_ROWS("webfilter_rules") == 0) {
            echo $tpl->_ENGINE_parse_body("<center style='margin:90px'>" . button("{activate_the_webfiltering_engine_wizard}", "Loadjs('dansguardian2.wizard.rule.php')", 40) . "</center>");
            return;
        }
        echo $tpl->_ENGINE_parse_body("<center style='margin:90px'>\n\t\t\t\t<p style='font-size:20px'>{warn_ufdbguard_not_activated_explain}</p>\n\t\t\t\t\n\t\t\t\t" . button("{activate_webfilter_engine}", "Loadjs('ufdbguard.enable.progress.php')", 40) . "</center>");
        return;
    }
    $t = time();
    $WEBFILTERING_TOP_MENU = WEBFILTERING_TOP_MENU();
    $html = "\n\t<div style='font-size:30px;margin-bottom:20px'>{$WEBFILTERING_TOP_MENU}</div>\n\t<div style='width:98%' class=form>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td style='vertical-align:top;width:390px'><div id='service-status-{$t}'></div></td>\n\t\t<td style='vertical-align:top;width:99%;padding-left:20px'>\n\t\t\t\t<center id='rules-toolbox' style='margin:bottom:15px'></center>\n\t\t\t\t<div id='main-status-{$t}'></div>\n\t\t</td>\n\t</tr>\n\t</table>\n\t</div>\n\t\n\t<script>\n\t\tLoadAjax('service-status-{$t}','{$page}?service-status=yes&t={$t}');\n\t</script>\n\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
Ejemplo n.º 5
0
function tabs()
{
    $squid = new squidbee();
    $tpl = new templates();
    $WEBFILTERING_TOP_MENU = $tpl->_ENGINE_parse_body(WEBFILTERING_TOP_MENU());
    $users = new usersMenus();
    $page = CurrentPageName();
    $sock = new sockets();
    $SquidHTTPTemplateLanguage = $sock->GET_INFO("SquidHTTPTemplateLanguage");
    if ($SquidHTTPTemplateLanguage == null) {
        $SquidHTTPTemplateLanguage = "en-us";
    }
    $array["settings"] = "{parameters}";
    $array["table"] = "{generated_rules}";
    $array["template"] = "{template}";
    $fontsize = 22;
    $t = time();
    while (list($num, $ligne) = each($array)) {
        if ($num == "template") {
            $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"squid.templates.skin.php?TEMPLATE_TAB=yes&TEMPLATE_TITLE=ERR_PARANOID&lang={$SquidHTTPTemplateLanguage}\" style='font-size:{$fontsize}'><span>{$ligne}</span></a></li>\n");
            continue;
        }
        $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"{$page}?{$num}={$t}\" style='font-size:{$fontsize}'><span>{$ligne}</span></a></li>\n");
    }
    $html = "<div style='font-size:30px;margin-bottom:20px'>{$WEBFILTERING_TOP_MENU}</div>" . build_artica_tabs($html, 'main_squid_paranoid', 1490);
    echo $html;
}