function activate()
 {
     global $wpdb;
     if (function_exists('get_role') and function_exists('is_role')) {
         if (FALSE === is_role('premium_subscriber')) {
             add_role('premium_subscriber', 'Premium Subscriber', $caps);
         }
         if (TRUE === is_role('premium_subscriber')) {
             $ps_role = get_role('premium_subscriber');
             if (Null !== $ps_role and !$ps_role->has_cap('premium_content')) {
                 $ps_role->add_cap('premium_content');
             }
             if (Null !== $ps_role and !$ps_role->has_cap('read')) {
                 $ps_role->add_cap('read');
             }
         }
         if (TRUE === is_role('administrator')) {
             $role = get_role('administrator');
             if (Null !== $role and !$role->has_cap('premium_content')) {
                 $role->add_cap('premium_content');
             }
         }
     }
     $this->createstatistictables();
     if (function_exists('wp_cache_flush')) {
         wp_cache_flush();
     }
     $current = get_option('podPress_version');
     if (FALSE === $current) {
         $current = constant('PODPRESS_VERSION');
         update_option('podPress_version', $current);
     }
     //$this->checkSettings();
 }
Beispiel #2
0
function build_rules_services($DATAS, $FW, $eth = null)
{
    if ($FW == null) {
        return;
    }
    $sock = new sockets();
    $ACCEPT_PING = $DATAS["ACCEPT_PING"];
    $ACCEPT_SMTP = $DATAS["ACCEPT_SMTP"];
    $ACCEPT_ARTICA = $DATAS["ACCEPT_ARTICA"];
    $ACCEPT_WWWW = $DATAS["ACCEPT_WWWW"];
    $ACCEPT_LDAP = $DATAS["ACCEPT_LDAP"];
    $ACCEPT_MYSQL = $DATAS["ACCEPT_MYSQL"];
    $ACCEPT_PROXY = $DATAS["ACCEPT_PROXY"];
    $ACCEPT_IMAP = $DATAS["ACCEPT_IMAP"];
    $ACCEPT_DNS = $DATAS["ACCEPT_DNS"];
    $ACCEPT_SSH = $DATAS["ACCEPT_DNS"];
    if ($ACCEPT_SSH == null) {
        $ACCEPT_SSH = "all+";
    }
    if ($ACCEPT_PING == null) {
        $ACCEPT_PING = "all+";
    }
    if ($ACCEPT_SMTP == null) {
        $ACCEPT_SMTP = "all+";
    }
    if ($ACCEPT_ARTICA == null) {
        $ACCEPT_ARTICA = "all+";
    }
    if ($ACCEPT_WWWW == null) {
        $ACCEPT_WWWW = "all+";
    }
    if ($ACCEPT_LDAP == null) {
        $ACCEPT_LDAP = "all+";
    }
    if ($ACCEPT_MYSQL == null) {
        $ACCEPT_MYSQL = "all+";
    }
    if ($ACCEPT_IMAP == null) {
        $ACCEPT_IMAP = "all+";
    }
    if ($ACCEPT_DNS == null) {
        $ACCEPT_DNS = "all+";
    }
    if ($ACCEPT_PING == null) {
        $ACCEPT_PING = "all+";
    }
    $f[] = "";
    $f[] = "############################################################";
    $f[] = "# FireWall services for {$eth} Interface, {$FW} Zone";
    $f[] = "############################################################";
    $f[] = "";
    if (is_role($eth, "DHCP")) {
        $f[] = "# Accept DHCP";
        $f[] = "ACCEPT\tall+\t{$FW}\tudp\t67:68\t67:68";
        $f[] = "ACCEPT\t{$FW}\tall+\tudp\t67:68\t67:68";
    }
    if ($ACCEPT_SSH != "NONE") {
        $f[] = "# Accept SSH";
        $f[] = "ACCEPT\t{$ACCEPT_SSH}\t{$FW}\ttcp\t22";
    }
    if ($ACCEPT_LDAP != "NONE") {
        $f[] = "# Accept LDAP";
        $f[] = "ACCEPT\t{$ACCEPT_SSH}\t{$FW}\ttcp\t389";
    }
    if ($ACCEPT_PING != "NONE") {
        $f[] = "# Accept ping";
        $f[] = "ACCEPT\t{$ACCEPT_PING}\t{$FW}\ticmp\t8";
    }
    if ($ACCEPT_SMTP != "NONE") {
        $f[] = "# Accept SMTP/SMTPS";
        $f[] = "ACCEPT\t{$ACCEPT_SMTP}\t{$FW}\ttcp\t25";
        $f[] = "ACCEPT\t{$ACCEPT_SMTP}\t{$FW}\ttcp\t465";
        $f[] = "ACCEPT\t{$ACCEPT_SMTP}\t{$FW}\ttcp\t587";
    }
    if ($ACCEPT_IMAP != "NONE") {
        $f[] = "# Accept IMAP/POP3/IMAPS";
        $f[] = "ACCEPT\t{$ACCEPT_IMAP}\t{$FW}\ttcp\t143";
        $f[] = "ACCEPT\t{$ACCEPT_IMAP}\t{$FW}\ttcp\t993";
        $f[] = "ACCEPT\t{$ACCEPT_IMAP}\t{$FW}\ttcp\t110";
    }
    if ($ACCEPT_WWWW != "NONE") {
        $f[] = "# Accept WWWW";
        $f[] = "ACCEPT\t{$ACCEPT_WWWW}\t{$FW}\ttcp\t80";
        $f[] = "ACCEPT\t{$ACCEPT_WWWW}\t{$FW}\ttcp\t443";
    }
    if ($ACCEPT_DNS != "NONE") {
        $f[] = "# Accept DNS";
        $f[] = "ACCEPT\t{$ACCEPT_WWWW}\t{$FW}\ttcp\t53";
        $f[] = "ACCEPT\t{$ACCEPT_WWWW}\t{$FW}\tudp\t53";
    }
    if ($ACCEPT_MYSQL != "NONE") {
        $SquidDBTuningParameters = unserialize(base64_decode($sock->GET_INFO("SquidDBTuningParameters")));
        $ListenPort = $SquidDBTuningParameters["ListenPort"];
        $f[] = "# Accept MySQL";
        $f[] = "ACCEPT\t{$ACCEPT_WWWW}\t{$FW}\ttcp\t3306";
        if (is_numeric($ListenPort)) {
            $f[] = "ACCEPT\t{$ACCEPT_WWWW}\t{$FW}\ttcp\t{$ListenPort}";
        }
        $MySQLSyslogParams = unserialize(base64_decode($sock->GET_INFO("MySQLSyslogParams")));
        $ListenPort = $MySQLSyslogParams["ListenPort"];
        if (is_numeric($ListenPort)) {
            $f[] = "ACCEPT\t{$ACCEPT_WWWW}\t{$FW}\ttcp\t{$ListenPort}";
        }
        $AmavisDBMysqlParams = unserialize(base64_decode($sock->GET_INFO("AmavisDBMysqlParams")));
        $ListenPort = $AmavisDBMysqlParams["ListenPort"];
        if (is_numeric($ListenPort)) {
            $f[] = "ACCEPT\t{$ACCEPT_WWWW}\t{$FW}\ttcp\t{$ListenPort}";
        }
    }
    if ($ACCEPT_PROXY != "NONE") {
        $f[] = "# Accept Proxy";
        $f[] = "ACCEPT\t{$ACCEPT_WWWW}\t{$FW}\ttcp\t3128";
        $f[] = "ACCEPT\t{$ACCEPT_WWWW}\t{$FW}\ttcp\t8080";
    }
    if ($ACCEPT_ARTICA != "NONE") {
        $f[] = "# Web Interfaces Artica/Webmin";
        $ListenPort = $sock->GET_INFO("ArticaHttpsPort");
        if (!is_numeric($ListenPort)) {
            $ListenPort = 9000;
        }
        $f[] = "ACCEPT\t{$ACCEPT_WWWW}\t{$FW}\ttcp\t{$ListenPort}";
        if (is_file("/etc/webmin/start")) {
            $miniserv = miniserv_port();
            if (is_numeric($miniserv)) {
                $f[] = "ACCEPT\t{$ACCEPT_WWWW}\t{$FW}\ttcp\t{$miniserv}";
            }
        }
    }
    return @implode("\n", $f);
}
Beispiel #3
0
function my_login_redirect($url, $request, $user)
{
    if ($user && is_object($user) && is_a($user, 'WP_User')) {
        if ($user->has_cap('administrator')) {
            $url = admin_url();
        } else {
            if (is_role('sentai2016', $user)) {
                $url = home_url('/tag/sentaionly');
            } else {
                $url = home_url('/stage/stagelist');
            }
        }
    }
    return $url;
}