コード例 #1
0
ファイル: GetRoleFriends.php プロジェクト: svn2github/ybtx
function GetFriends($var, $gm)
{
    global $tbl_role_all_detail;
    echo "<h1>{$tbl_role_all_detail['16']}</h1>\n";
    ReturnAndBack();
    Reload();
    $role_id = ArgRoleId();
    echo "<table class='list_table'>\n";
    echo sprintf("<tr><td>{$tbl_role_all_detail['18']}</td></tr>\n", ArgRoleName() . "(" . $role_id . ")");
    echo "</table>\n";
    global $tbl_role_friends, $tbl_camp, $tbl_class, $tbl_sex, $tbl_sys_msg;
    $serverid = $var["serverid"];
    if (!$role_id) {
        return true;
    }
    echo "<h1>" . $tbl_role_friends[0] . "</h1>\n";
    echo "<table class='list_table'>\n";
    printf("<tr><th>%s</th><th>%s</th><th style='width:100px;'>%s</th><th style='width:100px;'>%s</th><th style='width:100px;'>%s</th><th style='width:100px;'>%s</th></tr>\n", $tbl_role_friends[1][0], $tbl_role_friends[1][1], $tbl_role_friends[1][2], $tbl_role_friends[1][3], $tbl_role_friends[1][4], $tbl_role_friends[1][5]);
    $rs = MySQLQuery("select c.c_sName, cs.cs_uCamp, cs.cs_uClass, cb.cb_uLevel, cs.cs_uSex, fc.fc_sName from tbl_player_friends pf, tbl_friends_class fc, tbl_char c, tbl_char_basic cb, tbl_char_static cs where pf.fc_uId = fc.fc_uId and pf.cs_uId = fc.cs_uId and pf.pf_uFriendId = c.cs_uId and fc.fc_uId<>2 and pf.cs_uId='{$role_id}' and cb.cs_uId = c.cs_uId and cs.cs_uId = c.cs_uId", "Game", $serverid);
    while ($row = mysql_fetch_row($rs)) {
        if ($row[5] == UTF82Local($tbl_role_friends[1][6])) {
            $row[5] = $tbl_role_friends[1][6];
        }
        printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n", $row[5], $row[0], $tbl_camp[$row[1]], $tbl_class[$row[2]], $row[3], $tbl_sex[$row[4]]);
    }
    echo "</table>\n";
    echo "<h1>" . $tbl_role_friends[2] . "</h1>\n";
    echo "<table class='list_table'>\n";
    printf("<tr><th>%s</th><th style='width:100px;'>%s</th><th style='width:100px;'>%s</th><th style='width:100px;'>%s</th><th style='width:100px;'>%s</th></tr>\n", $tbl_role_friends[3][0], $tbl_role_friends[3][1], $tbl_role_friends[3][2], $tbl_role_friends[3][3], $tbl_role_friends[3][4]);
    $rs = MySQLQuery("select c.c_sName, cs.cs_uCamp, cs.cs_uClass, cb.cb_uLevel, cs.cs_uSex from tbl_player_friends pf, tbl_char c, tbl_char_basic cb, tbl_char_static cs where pf.pf_uFriendId = c.cs_uId and pf.cs_uId='{$role_id}' and pf.fc_uId=2 and cb.cs_uId = c.cs_uId and cs.cs_uId = c.cs_uId", "Game", $serverid);
    while ($row = mysql_fetch_row($rs)) {
        printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n", $row[0], $tbl_camp[$row[1]], $tbl_class[$row[2]], $row[3], $tbl_sex[$row[4]]);
    }
    echo "</table>\n";
    echo "<h1>" . $tbl_role_friends[4] . "</h1>\n";
    echo "<table class='list_table'>\n";
    printf("<tr><th>%s</th><th>%s</th><th>%s</th></tr>\n", $tbl_role_friends[5][0], $tbl_role_friends[5][1], $tbl_role_friends[5][2]);
    $rs = MySQLQuery("select fg.fg_sName,gm1.gm_uIdentity,count(*) from tbl_group_manager gm1,tbl_group_manager gm2,tbl_friends_group fg where gm1.cs_uId='{$role_id}' and gm1.fg_uId = gm2.fg_uId and gm1.fg_uId = fg.fg_uId group by gm2.fg_uId", "Game", $serverid);
    while ($row = mysql_fetch_row($rs)) {
        printf("<tr><td>%s</td><td>%s</td><td>%d</td></tr>\n", $row[0], $tbl_role_friends[5][3][intval($row[1])], $row[2]);
    }
    echo "</table>\n";
    echo "<h1>" . $tbl_role_friends[6] . "</h1>\n";
    echo "<table class='list_table'>\n";
    printf("<tr><th>%s</th><th>%s</th><th>%s</th></tr>\n", $tbl_role_friends[7][0], $tbl_role_friends[7][1], $tbl_role_friends[7][2]);
    $rs = MySQLQuery("select t.t_sName, mt1.mt_sPosition, count(*) from tbl_member_tong mt1, tbl_tong t, tbl_member_tong mt2 where mt1.t_uId = t.t_uId and t.t_uId = mt2.t_uId and mt1.cs_uId = '{$role_id}' group by t.t_uId", "Game", $serverid);
    while ($row = mysql_fetch_row($rs)) {
        global $tbl_tong_pos;
        printf("<tr><td>%s</td><td>%s</td><td>%d</td></tr>\n", $row[0], $tbl_tong_pos[intval($row[1])], $row[2]);
    }
    echo "</table>\n";
    return true;
}
コード例 #2
0
function xrun()
{
    $unix = new unix();
    $php = $unix->LOCATE_PHP5_BIN();
    $sock = new sockets();
    $SpamAssassinUrlScore = intval($sock->GET_INFO("SpamAssassinUrlScore"));
    $SpamAssassinScrapScore = intval($sock->GET_INFO("SpamAssassinScrapScore"));
    $SpamAssassinSubjectsScore = intval($sock->GET_INFO("SpamAssassinSubjectsScore"));
    if ($SpamAssassinUrlScore == 0) {
        $SpamAssassinUrlScore = 9;
    }
    if ($SpamAssassinScrapScore == 0) {
        $SpamAssassinScrapScore = 6;
    }
    if ($SpamAssassinSubjectsScore == 0) {
        $SpamAssassinSubjectsScore = 3;
    }
    $TargetFilename = "/etc/spamassassin/ArticaUrlsRules.cf";
    $TargetFilename2 = "/etc/spamassassin/ArticaEscrapRules.cf";
    $TargetFilename3 = "/etc/spamassassin/ArticaSubjectsRules.cf";
    $q = new mysql();
    $sql = "SELECT * FROM spamasssin_baddomains";
    $results = $q->QUERY_SQL($sql, "artica_backup");
    if (!$q->ok) {
        build_progress(110, "MySQL Error");
        return;
    }
    $f = array();
    $f2 = array();
    build_progress(50, "Building rules...");
    while ($ligne = mysql_fetch_assoc($results)) {
        $ID = $ligne["ID"];
        $pattern = pattern_replace($ligne["pattern"]);
        if ($pattern == null) {
            continue;
        }
        $RuleName = "ARTICA_BAD_URLS_{$ID}";
        $RuleName2 = "ARTICATECH_BAD_URLS_{$ID}";
        build_progress(50, "Building rule {$pattern}...");
        $f[] = "uri {$RuleName} /{$pattern}/";
        $f[] = "describe {$RuleName} Urls found in spam messages by Messaging Team.";
        $f[] = "score {$RuleName} {$SpamAssassinUrlScore}";
        $f2[] = "uri {$RuleName2} /{$pattern}/";
        $f2[] = "describe {$RuleName2} Urls found in spam messages - by Artica Team.";
        $f2[] = "score {$RuleName2} 9";
    }
    $f2[] = "uri ARTICA_MICRO_LINK /\\/\\/goo\\.gl\\//";
    $f2[] = "describe ARTICA_MICRO_LINK goo.gl found in message - by Artica Team.";
    $f2[] = "score ARTICA_MICRO_LINK 2";
    $f2[] = "uri UNSUBSCRIBE_NEWS_LETTER  /\\/unsubscribe\\.php\\?/";
    $f2[] = "score UNSUBSCRIBE_NEWS_LETTER 1";
    $f2[] = "describe UNSUBSCRIBE_NEWS_LETTER Probably a news letter - by Artica Team.";
    $f2[] = "uri ARTICA_DYNALINK_INTEGER_1 /\\/(link|unsubscribe)\\.php\\?M=[0-9]+/";
    $f2[] = "describe ARTICA_DYNALINK_INTEGER_1 Probably a tracker that point to an integer value - by Artica Team.";
    $f2[] = "score ARTICA_DYNALINK_INTEGER_1 2";
    $f2[] = "uri ARTICA_URI_EXE /\\.(?:exe|scr|dll|pif|vbs|wsh|cmd|bat)(?:\\W{0,20}\$|\\?)/i";
    $f2[] = "describe ARTICA_URI_EXE link contains executables files - by Artica Team.";
    $f2[] = "score ARTICA_URI_EXE 3";
    @unlink($TargetFilename);
    @file_put_contents($TargetFilename, @implode("\n", $f) . "\n");
    @unlink("/etc/artica-postfix/spamassassin-rules1.cf");
    @file_put_contents("/etc/artica-postfix/spamassassin-rules1.cf", @implode("\n", $f2) . "\n");
    $sql = "SELECT * FROM spamasssin_escrap";
    $results = $q->QUERY_SQL($sql, "artica_backup");
    if (!$q->ok) {
        build_progress(110, "MySQL Error");
        return;
    }
    $f = array();
    $f2 = array();
    $f2[] = "# # # e-Scrap From Artica Team, builded on " . date("Y-m-d H:i:s") . "\n";
    while ($ligne = mysql_fetch_assoc($results)) {
        $ID = $ligne["ID"];
        $pattern = pattern_replace($ligne["pattern"]);
        if ($pattern == null) {
            continue;
        }
        $RuleName = "ARTICA_SCRAP_{$ID}";
        $RuleName2 = "ARTICATECH_SCRAP_{$ID}";
        build_progress(60, "Building rules {$pattern}...");
        $f[] = "header {$RuleName} From =~ /{$pattern}/i";
        $f[] = "score {$RuleName}  {$SpamAssassinScrapScore}";
        $f[] = "describe {$RuleName} From e-scrap messages - non sollicted mails";
        $f2[] = "header {$RuleName2} From =~ /{$pattern}/i";
        $f2[] = "score {$RuleName2}  6";
        $f2[] = "describe {$RuleName2} From e-scrap messages - non sollicted mails by Artica Team";
    }
    $f2[] = "header BOUNCE_NEWS_ADDR From =~ /\\@bounce\\.news\\./i";
    $f2[] = "score BOUNCE_NEWS_ADDR  3";
    $f2[] = "describe BOUNCE_NEWS_ADDR From e-scrap messages - @bounce.news. in mail addr by Artica Team";
    $f2[] = "header INVITATION_INADDR From =~ /\\@invitation\\..*?\\.(com|fr|net)/i";
    $f2[] = "score INVITATION_INADDR  3";
    $f2[] = "describe INVITATION_INADDR From e-scrap messages - @invitation. something in mail addr by Artica Team";
    $f2[] = "header WEBMASTER_INADDR From =~ /(bounce|noreply|webmaster|www-data)\\@/i";
    $f2[] = "score WEBMASTER_INADDR  2";
    $f2[] = "describe WEBMASTER_INADDR From e-scrap messages - bounce,noreply,WebMaster,www-data is a generic mail address by Artica Team";
    $f2[] = "header LEGETIMATE_BANK From =~ /\\@bnpparibas\\.com/i";
    $f2[] = "score LEGETIMATE_BANK  -5";
    $f2[] = "describe LEGETIMATE_BANK From legetimate bank - by Artica Team";
    $f2[] = "header LEGETIMATE_GOOGLE From =~ /noreply\\@youtube\\.com/i";
    $f2[] = "score LEGETIMATE_GOOGLE  -5";
    $f2[] = "describe LEGETIMATE_GOOGLE From Google mailing lists - by Artica Team";
    $f2[] = "header LEGETIMATE_TWITTER From =~ /\\@twitter.com/i";
    $f2[] = "score LEGETIMATE_TWITTER  -5";
    $f2[] = "describe LEGETIMATE_TWITTER From twitter mailing lists - by Artica Team";
    $f2[] = "header LEGETIMATE_GOOGLE From =~ /googlealerts-noreply\\@google\\.com/i";
    $f2[] = "score LEGETIMATE_GOOGLE  -5";
    $f2[] = "describe LEGETIMATE_GOOGLE From Google mailing lists - by Artica Team";
    $f2[] = "header LEGETIMATE_PAYPAL From =~ /[a-z]+\\@paypal\\.(fr|com|de|it|es|pt|pl)/i";
    $f2[] = "score LEGETIMATE_PAYPAL  -5";
    $f2[] = "describe LEGETIMATE_PAYPAL From PayPal mailing lists - by Artica Team";
    $f2[] = "header LEGETIMATE_VIADEO From =~ /\\@[a-z]+\\.viadeo\\.com/i";
    $f2[] = "score LEGETIMATE_VIADEO  -5";
    $f2[] = "describe LEGETIMATE_VIADEO From viadeo mailing lists - by Artica Team";
    $f2[] = "header VENTE_FLASH Subject =~ /vente flash/i";
    $f2[] = "score VENTE_FLASH  3";
    $f2[] = "describe VENTE_FLASH Subject - Seems a flash sales - by Artica Team";
    $f2[] = "header X_ACCORHOTELS_PRESENT\t\t   exists:X-Accorhotels-ReservationDate";
    $f2[] = "describe X_ACCORHOTELS_PRESENT      Message has X-Accorhotels-ReservationDate";
    $f2[] = "score X_ACCORHOTELS_PRESENT         -8";
    $f2[] = "header X_IRONPORT_PRESENT\t\texists:X-IronPort-AV";
    $f2[] = "describe X_IRONPORT_PRESENT      Message has X-IronPort-AV";
    $f2[] = "score X_IRONPORT_PRESENT         -5";
    $f2[] = "header X_LINKEDIN_PRESENT\t\texists:X-LinkedIn-Id";
    $f2[] = "describe X_LINKEDIN_PRESENT      Message has X-LinkedIn-Id";
    $f2[] = "score X_LINKEDIN_PRESENT         -9";
    $f2[] = "header X_BEVERLYMAIL_PRESENT        exists:X-BeverlyMail-Recipient";
    $f2[] = "describe X_BEVERLYMAIL_PRESENT      Message has X-BeverlyMail-Recipient";
    $f2[] = "score X_BEVERLYMAIL_PRESENT         3";
    $f2[] = "header X_MAILINCAMPAIGN_PRESENT        exists:X-Mailin-Campaign";
    $f2[] = "describe X_MAILINCAMPAIGN_PRESENT      Message has X-Mailin-Campaign";
    $f2[] = "score X_MAILINCAMPAIGN_PRESENT         3";
    $f2[] = "header X_MAILERSID_PRESENT        exists:X-Mailer-SID";
    $f2[] = "describe X_MAILERSID_PRESENT      Message has X-Mailer-SID";
    $f2[] = "score X_MAILERSID_PRESENT         3";
    @unlink($TargetFilename2);
    @file_put_contents($TargetFilename2, @implode("\n", $f) . "\n");
    @unlink("/etc/artica-postfix/spamassassin-rules3.cf");
    @file_put_contents("/etc/artica-postfix/spamassassin-rules3.cf", @implode("\n", $f2) . "\n");
    $sql = "SELECT * FROM spamasssin_subjects";
    $results = $q->QUERY_SQL($sql, "artica_backup");
    if (!$q->ok) {
        build_progress(110, "MySQL Error");
        return;
    }
    $f = array();
    $f2 = array();
    $f2[] = "# # # Subjects From Artica Team, builded on " . date("Y-m-d H:i:s") . "\n";
    while ($ligne = mysql_fetch_assoc($results)) {
        $ID = $ligne["ID"];
        $pattern = pattern_replace($ligne["pattern"]);
        if ($pattern == null) {
            continue;
        }
        $RuleName = "ARTICA_SUBJECT_{$ID}";
        $RuleName2 = "ARTICATECH_SUBJECT_{$ID}";
        build_progress(60, "Building rules {$pattern}...");
        $f[] = "header {$RuleName} Subject =~ /{$pattern}/i";
        $f[] = "score {$RuleName}  {$SpamAssassinSubjectsScore}";
        $f[] = "describe {$RuleName} Subject - non sollicted mails";
        $f2[] = "header {$RuleName2} Subject =~ /{$pattern}/i";
        $f2[] = "score {$RuleName2}  3";
        $f2[] = "describe {$RuleName2} Subject - non sollicted mails by Artica Team";
    }
    @unlink($TargetFilename3);
    @file_put_contents($TargetFilename3, @implode("\n", $f) . "\n");
    @unlink("/etc/artica-postfix/spamassassin-rules4.cf");
    @file_put_contents("/etc/artica-postfix/spamassassin-rules4.cf", @implode("\n", $f2) . "\n");
    build_progress(70, "Building rules {done}...");
    Reload();
    build_progress(95, "{exporting_rules}...");
    shell_exec("{$php} /usr/share/artica-postfix/exec.milter-greylist.cloud.php >/dev/null 2>&1");
    build_progress(100, "{done}...");
}
コード例 #3
0
ファイル: exec.status.php プロジェクト: BillTheBest/1.6.x
function launch_all_status($force = false)
{
    $conf = array();
    $CacheFileTime = "/usr/share/artica-postfix/ressources/logs/global.status.ini";
    mkdir_test("/usr/share/artica-postfix/ressources/logs", 0755, true);
    if (!is_file("/usr/share/artica-postfix/ressources/logs/php.log")) {
        @touch("/usr/share/artica-postfix/ressources/logs/php.log");
    }
    events("launch_all_status() -> xLoadAvg().., started", __FUNCTION__, __LINE__);
    xLoadAvg();
    ChecksRoutes();
    events("global.status.ini OK next step...", __FUNCTION__, __LINE__);
    $trace = debug_backtrace();
    if (isset($trace[1])) {
        $called = " called by " . basename($trace[1]["file"]) . " {$trace[1]["function"]}() line {$trace[1]["line"]}";
        events("{$called}", __FUNCTION__, __LINE__);
    }
    events("global.status.ini OK CheckCallable()", __FUNCTION__, __LINE__);
    CheckCallable();
    if (!system_is_overloaded()) {
        $GLOBALS["CLASS_UNIX"]->Process1();
        if (!is_file("/usr/share/artica-postfix/ressources/logs/global.versions.conf")) {
            events("-> artica-install --write-version", __FUNCTION__, __LINE__);
            $GLOBALS["CLASS_UNIX"]->THREAD_COMMAND_SET("/usr/share/artica-postfix/bin/artica-install --write-versions");
        } else {
            $filetime = file_time_min("/usr/share/artica-postfix/ressources/logs/global.versions.conf");
            events("global.versions.conf={$filetime}mn ", __FUNCTION__, __LINE__);
            if ($filetime > 60) {
                events("global.versions.conf \"{$filetime}\"mn", __FUNCTION__, __LINE__);
                @unlink("/usr/share/artica-postfix/ressources/logs/global.versions.conf");
                $GLOBALS["CLASS_UNIX"]->THREAD_COMMAND_SET("/usr/share/artica-postfix/bin/artica-install --write-versions");
            }
        }
    }
    @unlink($GLOBALS["MY-POINTER"]);
    @file_put_contents($GLOBALS["MY-POINTER"], time());
    $authtailftime = "/etc/artica-postfix/pids/auth-tail.time";
    $unix = new unix();
    $timefile = $unix->file_time_min($authtailftime);
    events("/etc/artica-postfix/pids/auth-tail.time -> {$timefile}Mn", __FUNCTION__, __LINE__);
    if ($timefile > 15) {
        @unlink($timefile);
        @file_put_contents($authtailftime, time());
        $cmd = trim("{$GLOBALS["nohup"]} /etc/init.d/artica-postfix restart auth-logger >/dev/null 2>&1 &");
        events($cmd);
        shell_exec2($cmd);
    }
    $TimeF = "/etc/artica-postfix/pids/exec.system.last.php.xstart.php.time";
    $timefile = $unix->file_time_min($TimeF);
    if ($timefile > 60) {
        $cmd = trim("{$GLOBALS["nohup"]} {$GLOBALS["NICE"]} {$GLOBALS["PHP5"]} " . dirname(__FILE__) . "/exec.system.last.php >/dev/null 2>&1 &");
        events($cmd);
        shell_exec2($cmd);
    }
    @unlink($CacheFileTime);
    @file_put_contents($CacheFileTime, time());
    if (is_dir("/etc/resolvconf")) {
        if (!is_file("/etc/resolvconf/resolv.conf.d/base")) {
            $cmd = trim("{$GLOBALS["nohup"]} {$GLOBALS["NICE"]} {$GLOBALS["PHP5"]} " . dirname(__FILE__) . "/exec.virtuals-ip.php --resolvconf >/dev/null 2>&1 &");
            events($cmd);
            shell_exec2($cmd);
        }
    }
    events("**************** START ALL STATUS ****************");
    events("global.status.ini start processing", __FUNCTION__, __LINE__);
    events_syslog("start processing");
    $t1 = time();
    $GLOBALS["CLASS_UNIX"]->chmod_func(0755, "/etc/artica-postfix/settings/Daemons/*");
    $functions = array("Default_values", "load_stats", "fail2ban", "unifi_mongodb", "unifi", "Popuplate_cron", "squid_dashboard_statistics", "philesight", "cron", "transmission_daemon", "disks_monitor", "InfluxDB", "CleanLogs", "monit", "kav4Proxy_status", "dansguardian_master_status", "wpa_supplicant", "fetchmail", "milter_greylist", "irqbalance", "framework", "pdns_server", "pdns_recursor", "cyrus_imap", "mysql_server", "mysql_mgmt", "mysql_replica", "openldap", "saslauthd", "syslogger", "amavis", "amavis_milter", "boa", "lighttpd", "clamd", "clamscan", "clammilter", "freshclam", "retranslator_httpd", "spamassassin_milter", "spamassassin", "postfix", "postfix_logger", "mailman", "kas3_milter", "kas3_ap", "rpcbind", "smbd", "nmbd", "winbindd", "scanned_only", "roundcube", "cups", "apache_groupware", "gdm", "xfce", "vmtools", "hamachi", "artica_notifier", "dhcpd_server", "pure_ftpd", "mldonkey", "backuppc", "kav4fs", "kav4fsavs", "apache_ocsweb", "ocs_agent", "openssh", "gluster", "auditd", "milter_dkim", "dropbox", "artica_policy", "virtualbox_webserv", "tftpd", "dhcpd_server", "crossroads", "artica_status", "bandwith", "pptpd", "pptp_clients", "apt_mirror", "ddclient", "cluebringer", "apachesrc", "zarafa_server2", "assp", "openvpn", "vboxguest", "sabnzbdplus", "MemorySync", "MemoryWatchdog", "SwapWatchdog", "artica_meta_scheduler", "OpenVPNClientsStatus", "stunnel", "meta_checks", "avahi_daemon", "CheckCurl", "vnstat", "NetAdsWatchdog", "munin", "autofs", "greyhole", "dnsmasq", "iscsi", "watchdog_yorel", "netatalk", "postfwd2", "vps_servers", "smartd", "crossroads_multiple", "auth_tail", "greyhole_watchdog", "greensql", "nscd", "tomcat", "openemm", "openemm_sendmail", "cgroups", "ntpd_server", "arpd", "ps_mem", "ipsec", "yaffas", "ifconfig_network", "testingrrd", "zarafa_multi", "memcached", "UpdateUtilityHTTP", "udevd_daemon", "dbus_daemon", "ejabberd", "pymsnt", "arkwsd", "arkeiad", "haproxy", "klms_status", "klmsdb_status", "klms_milter", "CleanLogs", "mimedefangmx", "mimedefang", "zarafa_search", "snort", "amavisdb", "nginx", "nginx_db", "checksyslog", "freeradius", "maillog_watchdog", "arp_spoof", "caches_pages", "php_fpm", "php_fcgi", "CleanCloudCatz", "syslog_db", "roundcube_db", "Scheduler", "exim4", "snmpd", "ntopng", "redis_server", "bwm_ng", "XMail", "conntrackd", "iptables", "rdpproxy_authhook", "rdpproxy", "vde_all", "iptables_tasks", "l7filter", "syncthing", "killstrangeprocesses");
    ToSyslog("launch_all_status(): " . count($functions));
    $postfix_functions = array();
    $postconf = $GLOBALS["CLASS_UNIX"]->find_program("postconf");
    ToSyslog("launch_all_status(): postconf: {$postconf}");
    if (is_file($postconf)) {
        include_once '/usr/share/artica-postfix/ressources/class.status.postfix.inc';
        $postfix_functions = postfix_increment_func(array());
        if ($GLOBALS["ZARAFA_INSTALLED"]) {
            include_once '/usr/share/artica-postfix/ressources/class.status.zarafa.inc';
            $postfix_functions = zarafa_increment_func($postfix_functions);
        }
    }
    if ($GLOBALS["SQUID_INSTALLED"]) {
        include_once '/usr/share/artica-postfix/ressources/class.status.squid.inc';
        $squid_functions = squid_increment_func(array());
    }
    ToSyslog("launch_all_status(): " . count($functions));
    $stats = new status_hardware();
    $data1 = $GLOBALS["TIME_CLASS"];
    $data2 = time();
    $difference = $data2 - $data1;
    $min = round($difference / 60);
    if ($min > 9) {
        events("reloading classes...", __FUNCTION__, __LINE__);
        $GLOBALS["TIME_CLASS"] = time();
        $GLOBALS["CLASS_SOCKETS"] = new sockets();
        $GLOBALS["CLASS_USERS"] = new settings_inc();
        $GLOBALS["CLASS_UNIX"] = new unix();
    }
    if (!isset($GLOBALS["CLASS_UNIX"])) {
        $GLOBALS["CLASS_SOCKETS"] = new sockets();
        $GLOBALS["CLASS_USERS"] = new settings_inc();
        $GLOBALS["CLASS_UNIX"] = new unix();
    }
    $AllFunctionCount = count($functions);
    events("running {$AllFunctionCount} functions ", __FUNCTION__, __LINE__);
    if ($force) {
        events("running function in FORCE MODE !", __FUNCTION__, __LINE__);
    }
    $max = count($functions);
    $c = 0;
    $TEX = time();
    while (list($num, $func) = each($functions)) {
        $c++;
        $mem = round(memory_get_usage() / 1024 / 1000, 2);
        if ($GLOBALS["VERBOSE"]) {
            echo "*****\n{$func} {$c}/{$max}\n*****\n";
        }
        if (!function_exists($func)) {
            continue;
        }
        events("Running {$c}/{$max} {$func}() function {$mem}MB", __FUNCTION__, __LINE__);
        if (is_file("/etc/artica-postfix/ARTICA_STATUS_RELOAD")) {
            ToSyslog("Reloading settings and libraries...");
            Reload();
        }
        if (!$force) {
            if (system_is_overloaded(basename(__FILE__))) {
                events("System is overloaded: {$GLOBALS["SYSTEM_INTERNAL_LOAD"]}, aborting", __FUNCTION__, __LINE__);
                ToSyslog("System is overloaded: {$GLOBALS["SYSTEM_INTERNAL_LOAD"]}, aborting");
                AmavisWatchdog();
                greyhole_watchdog();
                break;
            }
        }
        try {
            if ($GLOBALS["VERBOSE"]) {
                echo "***** {$c}/{$max} {$func} *****\n";
            }
            $results = call_user_func($func);
            $GLOBALS["LAST_FUNCTION_USED"] = "{$func}()";
        } catch (Exception $e) {
            ToSyslog("Fatal while running function {$func} ({$e})");
        }
        if (trim($results) != null) {
            $conf[] = $results;
        }
    }
    events("Postfix functions: " . count($postfix_functions) . " functions", __FUNCTION__, __LINE__);
    if (count($postfix_functions) > 0) {
        $c = 0;
        $max = count($postfix_functions);
        while (list($num, $func) = each($postfix_functions)) {
            $c++;
            $mem = round(memory_get_usage() / 1024 / 1000, 2);
            if ($GLOBALS["VERBOSE"]) {
                echo "*****\npostfix_functions {$func} {$c}/{$max}\n*****\n";
            }
            events("Postfix functions: Running {$c}/{$max} {$func}() function {$mem}MB", __FUNCTION__, __LINE__);
            if (!function_exists($func)) {
                continue;
            }
            if (!$force) {
                if (system_is_overloaded(basename(__FILE__))) {
                    events("System is overloaded: {$GLOBALS["SYSTEM_INTERNAL_LOAD"]}, aborting", __FUNCTION__, __LINE__);
                    ToSyslog("System is overloaded: {$GLOBALS["SYSTEM_INTERNAL_LOAD"]}, aborting");
                    AmavisWatchdog();
                    greyhole_watchdog();
                    break;
                }
            }
            try {
                $results = call_user_func($func);
            } catch (Exception $e) {
                ToSyslog("Fatal while running function {$func} ({$e})");
            }
            if (trim($results) != null) {
                $conf[] = $results;
            }
        }
    }
    events("Squid functions: " . count($squid_functions) . " functions", __FUNCTION__, __LINE__);
    if (count($squid_functions) > 0) {
        $c = 0;
        $max = count($squid_functions);
        while (list($num, $func) = each($squid_functions)) {
            $mem = round(memory_get_usage() / 1024 / 1000, 2);
            if ($GLOBALS["VERBOSE"]) {
                echo "*****\n{$func} {$c}/{$max}\n*****\n";
            }
            if (!function_exists($func)) {
                events("Squid functions: {$func}() No such function", __FUNCTION__, __LINE__);
                continue;
            }
            events("Squid functions: Running {$c}/{$max} {$func}() function {$mem}MB", __FUNCTION__, __LINE__);
            _statussquid("Launch {$func}(): {$mem}MB in memory");
            $c++;
            try {
                $results = call_user_func($func);
            } catch (Exception $e) {
                events("Fatal while running function {$func} ({$e})", __FUNCTION__, __LINE__);
                _statussquid("Fatal while running function {$func} ({$e})");
            }
            if (trim($results) != null) {
                $conf[] = $results;
            }
        }
    }
    $p = new processes_php();
    $p->MemoryInstances();
    $p = null;
    $TOOK = $GLOBALS["CLASS_UNIX"]->distanceOfTimeInWords($TEX, time(), true);
    $mem = round(memory_get_usage() / 1024 / 1000, 2);
    $percent_free = $GLOBALS["CLASS_UNIX"]->GetMemFreePourc();
    ToSyslog("Executed " . count($functions) . " functions in {$TOOK} MemFree {$percent_free}% Used memory: {$mem}MB");
    @unlink("/usr/share/artica-postfix/ressources/logs/global.status.ini");
    file_put_contents("/usr/share/artica-postfix/ressources/logs/global.status.ini", @implode("\n", $conf));
    @chmod("/usr/share/artica-postfix/ressources/logs/global.status.ini", 0777);
    @file_put_contents("/etc/artica-postfix/cache.global.status", @implode("\n", $conf));
    events("creating status done " . count($conf) . " lines....", __FUNCTION__, __LINE__);
    $sock = new sockets();
    $WizardSavedSettingsSend = $sock->GET_INFO("WizardSavedSettingsSend");
    if (!is_numeric($WizardSavedSettingsSend)) {
        $WizardSavedSettingsSend = 0;
    }
    if ($WizardSavedSettingsSend == 0) {
        $cmd = trim("{$GLOBALS["nohup"]} {$GLOBALS["NICE"]} {$GLOBALS["PHP5"]} " . dirname(__FILE__) . "/exec.web-community-filter.php --register >/dev/null 2>&1 &");
        shell_exec2($cmd);
    }
    if (!is_file("/usr/share/artica-postfix/ressources/settings.inc")) {
        $GLOBALS["CLASS_UNIX"]->Process1(true);
    }
    if (is_dir("/opt/artica-agent/usr/share/artica-agent/ressources")) {
        events("writing /opt/artica-agent/usr/share/artica-agent/ressources/status.ini", __FUNCTION__, __LINE__);
        @file_put_contents("/opt/artica-agent/usr/share/artica-agent/ressources/status.ini", @implode("\n", $conf));
    }
    if (system_is_overloaded(__FILE__)) {
        ToSyslog("Overloaded system {$GLOBALS["SYSTEM_INTERNAL_LOAD"]} {$GLOBALS["SYSTEM_INTERNAL_MEMM"]}MB Memory free");
        return;
    }
    $cmd = trim("{$GLOBALS["nohup"]} {$GLOBALS["NICE"]} {$GLOBALS["PHP5"]} " . dirname(__FILE__) . "/exec.syslog-engine.php --admin-evs >/dev/null 2>&1 &");
    events($cmd);
    shell_exec2($cmd);
    $cmd = trim("{$GLOBALS["nohup"]} {$GLOBALS["NICE"]} {$GLOBALS["PHP5"]} " . __FILE__ . " --samba >/usr/share/artica-postfix/ressources/logs/web/samba.status 2>&1 &");
    shell_exec2($cmd);
    $GLOBALS["CLASS_UNIX"]->BLKID_ALL();
    events("*****  FINISH {$TOOK} ****", __FUNCTION__, __LINE__);
    events("********************************************************************", __FUNCTION__, __LINE__);
    if ($GLOBALS["VERBOSE"]) {
        echo " *****  FINISH **** \n\n";
    }
}
コード例 #4
0
ファイル: RoleDetail.php プロジェクト: svn2github/ybtx
function GetRoleAllDetail($var, $gm)
{
    global $tbl_role_all_detail, $tbl_sys_msg;
    $serverid = $var["serverid"];
    $js_str = <<<_js_str
<script type="text/javascript">
function toItem(){
\tdocument.form1.action_name.value = "201";
\tdocument.form1.submit();
}
function toFriend(){
\tdocument.form1.action_name.value = "199";
\tdocument.form1.submit();
}
function toRealTime(){
\tdocument.form1.action_name.value = "204";
\tdocument.form1.submit();
}
</script>
_js_str;
    echo $js_str . "\n";
    echo "<h1>{$tbl_role_all_detail['10']}</h1>\n";
    ReturnAndBack();
    Reload();
    form($var, $gm);
    $role_id = ArgRoleId();
    echo "<input type='hidden' name='role_str' value='" . $var["role_str"] . "'/>";
    echo "<input type='hidden' name='role_item' value='" . $var["role_item"] . "'/>";
    echo "<table class='list_table'>\n";
    echo sprintf("<tr><td>{$tbl_role_all_detail['0']}</td></tr>\n", ArgRoleName() . "(" . $role_id . ")");
    echo "<tr><td><a href='#' onclick='toItem()'>{$tbl_role_all_detail['15']}</a></td></tr>\n";
    echo "<tr><td><a href='#' onclick='toFriend()'>{$tbl_role_all_detail['16']}</a></td></tr>\n";
    echo "</table>\n";
    echo "</form>\n";
    echo "<h2>{$tbl_role_all_detail['1']}</h2>\n" . GetRoleDetail($role_id, $serverid);
    echo "<h2>{$tbl_role_all_detail['19']}</h2>\n" . GetRoleLogin($role_id, $serverid);
    echo "<h2>{$tbl_role_all_detail['2']}</h2>\n" . GetRoleLocation($role_id, $serverid);
    echo "<h2>{$tbl_role_all_detail['11']}</h2>\n" . GetRoleSort($role_id, $serverid);
    echo "<h2>{$tbl_role_all_detail['12']}</h2>\n" . GetRoleAppellation($role_id, $serverid);
    echo "<h2>{$tbl_role_all_detail['6']}</h2>\n" . GetRoleSkill($role_id, $serverid);
    return true;
}
コード例 #5
0
ファイル: TalkMgr.php プロジェクト: svn2github/ybtx
function ChannelChatAll($var, $gm)
{
    global $tbl_serv_db, $tbl_game_server, $tbl_sys_msg;
    echo "<script type='text/javascript' src='/js/page.js'></script>\n";
    echo "<script type='text/javascript' src='/js/checkbox.js'></script>\n";
    $jsstr = <<<_jsstr
<script type="text/javascript">
function re_load(){
\t\$(".panel").each(function(){
\t\tvar ins = \$(this).find("table");
\t\tif(\$(ins).find("tbody").html()!=null)
\t\t\tins = \$(ins).find("tbody");
\t\tvar last_dt = \$("#ldt").val();
\t\tvar url = "/cgi-bin/gm_tools/FrameWork.php?UID=%s&action_name=209&serv_id="+\$(this).attr("id").substring(4)+"&last_dt="+last_dt;
\t\t\$.ajax({
\t\t\turl: url,
\t\t\tdata: "serv_id="+\$(this).attr("id").substring(4)+"&last_dt="+last_dt,
\t\t\tsuccess: function(msg) {
\t\t\t\tvar s = msg.indexOf("_start_");
\t\t\t\tvar m = msg.indexOf(">|+|+|<");
\t\t\t\tvar ndt = msg.substring(m+7);
\t\t\t\tvar str = msg.substring(s+7,m);
\t\t\t\t\$(ins).append(str);
\t\t\t\t\$("#ldt").val(ndt);
\t\t\t}
\t\t});
\t});
}

setInterval("re_load()",10000);
</script>
_jsstr;
    printf($jsstr, $var["UID"]);
    form($var, $gm);
    ReturnAndBack();
    $serv_id = implode(",", $var["server_id"]);
    echo "<div class='panel' id = 'div_{$serv_id}'>\n";
    echo "<input type='hidden' id='ldt' value='" . date("Y-m-d H:i:s") . "' />\n";
    echo "<table class='list_table'>\n";
    echo "</table>\n";
    echo "</div>\n";
    Reload();
    ReturnAndBack();
    echo "</form>\n";
    return true;
}