コード例 #1
0
ファイル: atAPI.php プロジェクト: rotvulpix/php-nuke
function atBlockLoad($location = "", $title = "")
{
    if (!defined('BLOCK_FILE')) {
        define('BLOCK_FILE', true);
    }
    $runningconfig = atGetRunningConfig();
    $blocklist = $runningconfig['blocklist'];
    if ($location) {
        foreach ($blocklist as $block) {
            if ($block['position'] == $location && $block['active'] == 1) {
                $blocks[] = $block;
            }
        }
    } elseif ($title) {
        if ($blocklist[$title]['active'] == 1) {
            $blocks[] = $blocklist[$title];
        }
    }
    if (is_array($blocks)) {
        foreach ($blocks as $theblock) {
            atRunningSetVar("block", $theblock);
            extract($theblock);
            if ($bkey == "admin") {
                adminblock();
            } elseif ($bkey == "userbox") {
                userblock();
            } elseif ($bkey == "") {
                $displaythis = 0;
                if ($view == 0) {
                    $displaythis = 1;
                } elseif ($view == 1 && atIsLoggedIn() || atIsAdminUser()) {
                    $displaythis = 1;
                } elseif ($view == 2 && atIsAdminUser()) {
                    $displaythis = 1;
                } elseif ($view == 3 && !atIsLoggedIn() || atIsAdminUser()) {
                    $displaythis = 1;
                }
                if ($displaythis) {
                    if ($url == "") {
                        if ($blockfile == "") {
                            themesidebox($title, $content);
                        } else {
                            blockfileinc($title, $blockfile);
                        }
                    } else {
                        headlines($bid);
                    }
                }
            }
        }
    }
}
コード例 #2
0
ファイル: blocks.php プロジェクト: rotvulpix/php-nuke
 function block_show($bid)
 {
     global $prefix, $db, $admin_file;
     include "header.php";
     GraphicAdmin();
     title("" . _BLOCKSADMIN . "");
     OpenTable();
     echo "<br><center>";
     $bid = intval($bid);
     $row = $db->sql_fetchrow($db->sql_query("select bid, bkey, title, content, url, active, bposition, blockfile from " . $prefix . "_blocks where bid='{$bid}'"));
     $bid = intval($row['bid']);
     $bkey = filter($row['bkey'], "nohtml");
     $title = filter($row['title'], "nohtml");
     $content = filter($row['content']);
     $url = filter($row['url'], "nohtml");
     $active = intval($row['active']);
     $bposition = filter($row['bposition'], "nohtml");
     $blockfile = filter($row['blockfile'], "nohtml");
     if ($bkey == "main") {
         mainblock();
     } elseif ($bkey == "admin") {
         adminblock();
     } elseif ($bkey == "modules") {
         modules_block();
     } elseif ($bkey == "category") {
         category();
     } elseif ($bkey == "userbox") {
         userblock();
     } elseif (empty($bkey)) {
         if (empty($url)) {
             if (empty($blockfile)) {
                 if ($bposition == "c") {
                     themecenterbox($title, $content);
                 } else {
                     themesidebox($title, $content);
                 }
             } else {
                 if ($bposition == "c") {
                     blockfileinc($title, $blockfile, 1);
                 } else {
                     blockfileinc($title, $blockfile);
                 }
             }
         } else {
             headlines($bid);
         }
     }
     echo "</center>";
     CloseTable();
     echo "<br>";
     OpenTable();
     if ($active == 1) {
         $act_chg = _DEACTIVATE;
     } elseif ($active == 0) {
         $act_chg = _ACTIVATE;
     }
     echo "<center><font class=\"option\"><b>" . _BLOCKSADMIN . ": " . _FUNCTIONS . "</b></font><br><br>" . "[ <a href=\"" . $admin_file . ".php?op=ChangeStatus&bid={$bid}\">{$act_chg}</a> | <a href=\"" . $admin_file . ".php?op=BlocksEdit&bid={$bid}\">" . _EDIT . "</a> | ";
     if (empty($bkey)) {
         echo "<a href=\"" . $admin_file . ".php?op=BlocksDelete&bid={$bid}\">" . _DELETE . "</a> | ";
     } else {
         echo "" . _DELETE . " | ";
     }
     echo "<a href=\"" . $admin_file . ".php?op=BlocksAdmin\">" . _BLOCKSADMIN . "</a> ]</center>";
     CloseTable();
     include "footer.php";
 }
コード例 #3
0
function blocks($side)
{
    global $blocks;
    //switch(strtolower(substr($side,0,1)))
    switch (strtolower(substr($side, 0, 1))) {
        case 'l':
        case 'r':
        case 'c':
            $side = strtolower(substr($side, 0, 1));
            break;
        default:
            echo "<h1>something wierd</h1>";
    }
    for ($i = 0; $i < count($blocks); $i++) {
        if ($side == $blocks[$i]['position']) {
            $bid = $i;
            $bkey = $blocks[$i]['bkey'];
            $title = $blocks[$i]['title'];
            $content = $blocks[$i]['content'];
            $url = $blocks[$i]['url'];
            $blockfile = $blocks[$i]['blockfile'];
            $view = $blocks[$i]['view'];
            if ($bkey == 'admin') {
                adminblock();
            } elseif ($bkey == 'userbox') {
                userblock();
            } elseif ($bkey == '') {
                if ($view == 0) {
                    render_blocks($side, $blockfile, $title, $content, $bid, $url);
                } elseif ($view == 1 && is_user()) {
                    render_blocks($side, $blockfile, $title, $content, $bid, $url);
                } elseif ($view == 2 && is_admin()) {
                    render_blocks($side, $blockfile, $title, $content, $bid, $url);
                } elseif ($view == 3 && !is_user()) {
                    render_blocks($side, $blockfile, $title, $content, $bid, $url);
                }
            }
        }
    }
}
コード例 #4
0
ファイル: mainfile.php プロジェクト: rotvulpix/php-nuke
function blocks($side)
{
    global $storynum, $prefix, $multilingual, $currentlang, $db, $admin, $user;
    if ($multilingual == 1) {
        $querylang = "AND (blanguage='{$currentlang}' OR blanguage='')";
    } else {
        $querylang = "";
    }
    if (strtolower($side[0]) == "l") {
        $pos = "l";
    } elseif (strtolower($side[0]) == "r") {
        $pos = "r";
    } elseif (strtolower($side[0]) == "c") {
        $pos = "c";
    } elseif (strtolower($side[0]) == "d") {
        $pos = "d";
    }
    $side = $pos;
    $sql = "SELECT bid, bkey, title, content, url, blockfile, view, expire, action, subscription FROM " . $prefix . "_blocks WHERE bposition='{$pos}' AND active='1' {$querylang} ORDER BY weight ASC";
    $result = $db->sql_query($sql);
    while ($row = $db->sql_fetchrow($result)) {
        $bid = intval($row['bid']);
        $title = filter($row['title'], "nohtml");
        $content = stripslashes($row['content']);
        $url = filter($row['url'], "nohtml");
        $blockfile = filter($row['blockfile'], "nohtml");
        $view = intval($row['view']);
        $expire = intval($row['expire']);
        $action = filter($row['action'], "nohtml");
        $action = substr($action, 0, 1);
        $now = time();
        $sub = intval($row['subscription']);
        if ($sub == 0 or $sub == 1 and !paid()) {
            if ($expire != 0 and $expire <= $now) {
                if ($action == "d") {
                    $db->sql_query("UPDATE " . $prefix . "_blocks SET active='0', expire='0' WHERE bid='{$bid}'");
                    return;
                } elseif ($action == "r") {
                    $db->sql_query("DELETE FROM " . $prefix . "_blocks WHERE bid='{$bid}'");
                    return;
                }
            }
            if ($row['bkey'] == "admin") {
                adminblock();
            } elseif ($row['bkey'] == "userbox") {
                userblock();
            } elseif (empty($row['bkey'])) {
                if ($view == 0) {
                    render_blocks($side, $blockfile, $title, $content, $bid, $url);
                } elseif ($view == 1 and is_user($user) || is_admin($admin)) {
                    render_blocks($side, $blockfile, $title, $content, $bid, $url);
                } elseif ($view == 2 and is_admin($admin)) {
                    render_blocks($side, $blockfile, $title, $content, $bid, $url);
                } elseif ($view == 3 and !is_user($user) || is_admin($admin)) {
                    render_blocks($side, $blockfile, $title, $content, $bid, $url);
                }
            }
        }
    }
    $db->sql_freeresult($result);
}
コード例 #5
0
 function block_show($bid)
 {
     global $prefix, $db;
     include "header.php";
     GraphicAdmin();
     title("" . _BLOCKSADMIN . "");
     OpenTable2();
     $bid = intval($bid);
     $row = $db->sql_fetchrow($db->sql_query("select bid, bkey, title, content, url, bposition, blockfile from " . $prefix . "_blocks where bid='{$bid}'"));
     $bid = intval($row['bid']);
     $bkey = $row['bkey'];
     $title = $row['title'];
     $content = $row['content'];
     $url = $row['url'];
     $bposition = $row['bposition'];
     $blockfile = $row['blockfile'];
     if ($bkey == main) {
         mainblock();
     } elseif ($bkey == admin) {
         adminblock();
     } elseif ($bkey == modules) {
         modules_block();
     } elseif ($bkey == category) {
         category();
     } elseif ($bkey == userbox) {
         userblock();
     } elseif ($bkey == "") {
         if ($url == "") {
             if ($blockfile == "") {
                 if ($bposition == "c") {
                     themecenterbox($title, $content);
                 } else {
                     themesidebox($title, $content);
                 }
             } else {
                 if ($bposition == "c") {
                     blockfileinc($title, $blockfile, 1);
                 } else {
                     blockfileinc($title, $blockfile);
                 }
             }
         } else {
             headlines($bid);
         }
     }
     CloseTable2();
     echo "<br>";
     OpenTable();
     echo "<center><font class=\"option\"><b>" . _BLOCKSADMIN . ": " . _FUNCTIONS . "</b></font><br><br>" . "[ <a href=\"admin.php?op=ChangeStatus&bid={$bid}\">" . _ACTIVATE . "</a> | <a href=\"admin.php?op=BlocksEdit&bid={$bid}\">" . _EDIT . "</a> | ";
     if ($bkey == "") {
         echo "<a href=\"admin.php?op=BlocksDelete&bid={$bid}\">" . _DELETE . "</a> | ";
     } else {
         echo "" . _DELETE . " | ";
     }
     echo "<a href=\"admin.php?op=BlocksAdmin\">" . _BLOCKSADMIN . "</a> ]</center>";
     CloseTable();
     include "footer.php";
 }
コード例 #6
0
ファイル: blocks.php プロジェクト: cbsistem/nexos
 public function display($side)
 {
     if (!$this->{$side}) {
         return;
     }
     if ($this->start) {
         $this->blocks = array_merge_recursive($this->custom, $this->blocks);
         $this->custom = array();
     }
     require_once CORE_PATH . 'nbbcode.php';
     foreach ($this->blocks[$side] as $block) {
         $block['title'] = defined($block['title']) ? constant($block['title']) : $block['title'];
         switch ($block['bkey']) {
             case 'admin':
                 if (can_admin()) {
                     if ($content = adminblock($block['bid'], $block['title'], $block['content'])) {
                         $this->assign($side, $content);
                     }
                 }
                 break;
             case 'userbox':
                 global $userinfo;
                 if (is_user() && $userinfo['ublockon']) {
                     $block['title'] = _MENUFOR . " {$userinfo['username']}";
                     $block['content'] = decode_bbcode($userinfo['ublock'], 1, true);
                     $this->assign($side, $block);
                 }
                 break;
             case 'rss':
                 $this->rss($side, $block);
                 break;
             case 'custom':
                 $block['content'] = decode_bbcode($block['content'], 1, true);
                 $this->assign($side, $block);
                 break;
             case 'file':
                 $this->blockfile($side, $block);
                 break;
             default:
                 trigger_error('Undefined bkey for ' . $block['title'], E_USER_WARNING);
         }
     }
     $this->blocks[$side] = array();
 }