Exemplo n.º 1
0
 /**
  * User command for betting on the coin toss game in the casino
  *
  * @param bet int The amount of money to bet on the coin toss game
  * @return Array
  *
  * @note
  * If the player bets within ~1% of the maximum bet, they will receive a reward item
  */
 public function bet()
 {
     $player = new Player(self_char_id());
     $bet = intval(in('bet'));
     $negative = $bet < 0;
     set_setting('bet', max(0, $bet));
     $pageParts = ['reminder-max-bet'];
     if ($negative) {
         $pageParts = ['result-cheat'];
         $player->vo->health = subtractHealth($player->id(), 99);
     } else {
         if ($bet > $player->vo->gold) {
             $pageParts = ['result-no-gold'];
         } else {
             if ($bet > 0 && $bet <= self::MAX_BET) {
                 if (rand(0, 1) === 1) {
                     $pageParts = ['result-win'];
                     $player->vo->gold = add_gold($player->id(), $bet);
                     if ($bet >= round(self::MAX_BET * 0.99)) {
                         // within about 1% of the max bet & you win, you get a reward item.
                         add_item($player->id(), self::REWARD, 1);
                     }
                 } else {
                     $player->vo->gold = subtract_gold($player->id(), $bet);
                     $pageParts = ['result-lose'];
                 }
             }
         }
     }
     // End of not cheating check.
     return $this->render(['pageParts' => $pageParts, 'player' => $player, 'bet' => get_setting('bet')]);
 }
Exemplo n.º 2
0
function remove_enemy($enemy_id)
{
    if (!is_numeric($enemy_id)) {
        throw new Exception('Enemy id to remove must be present to succeed.');
    }
    $enemy_list = get_setting('enemy_list');
    if (isset($enemy_list[$enemy_id])) {
        unset($enemy_list[$enemy_id]);
    }
    set_setting('enemy_list', $enemy_list);
}
Exemplo n.º 3
0
 public function gerenciar()
 {
     if ($this->input->post('salvardados')) {
         if (is_admin(TRUE)) {
             $settings = elements(array('nome_site', 'url_logomarca', 'email_adm'), $this->input->post());
             foreach ($settings as $nome_config => $valor_config) {
                 set_setting($nome_config, $valor_config);
             }
             set_msg('msgok', 'Configurações atualizadas com sucesso', 'sucesso');
             redirect('settings/gerenciar');
         } else {
             redirect('settings/gerenciar');
         }
     }
     set_tema('titulo', 'Configuração do sistema');
     set_tema('conteudo', load_modulo('settings', 'gerenciar'));
     load_template();
 }
Exemplo n.º 4
0
 public function gerenciar()
 {
     if ($this->input->post('cadastrar')) {
         if (stats_user(TRUE)) {
             $settings = elements(array('nome_site', 'url_logomarca', 'email_adm'), $this->input->post());
             foreach ($settings as $nome_config => $valor_config) {
                 set_setting($nome_config, $valor_config);
             }
             set_msg('msgok', 'Configurações atualizadas com sucesso', '');
             redirect('settings/gerenciar');
         } else {
             redirect('settings/gerenciar');
         }
     }
     set_tema('footerinc', load_js(array('data-table', 'table')), FALSE);
     set_tema('titulo', 'Configurações do sistema');
     set_tema('conteudo', load_modulo($this->view . 'gerenciar'));
     load_template();
 }
Exemplo n.º 5
0
 /**
  * Command for current user to purchase a quantity of a specific item
  *
  * @param quantity int The quantity of the item to purchase
  * @param item string The identity of the item to purchase
  * @return Array
  */
 public function buy()
 {
     $in_quantity = in('quantity');
     $in_item = in('item');
     $gold = get_gold($this->sessionData['char_id']);
     $current_item_cost = 0;
     $no_funny_business = false;
     // Pull the item info from the database
     $item_costs = item_for_sale_costs();
     $item = getItemByID(item_id_from_display_name($in_item));
     $quantity = whichever(positive_int($in_quantity), $this->sessionData['quantity_setting'], 1);
     $item_text = null;
     if ($item instanceof Item) {
         $item_text = $quantity > 1 ? $item->getPluralName() : $item->getName();
         $purchaseOrder = new PurchaseOrder();
         // Determine the quantity from input, or settings, or as a fallback, default of 1.
         $purchaseOrder->quantity = $quantity;
         $purchaseOrder->item = $item;
         $potential_cost = isset($item_costs[$purchaseOrder->item->identity()]['item_cost']) ? $item_costs[$purchaseOrder->item->identity()]['item_cost'] : null;
         $current_item_cost = first_value($potential_cost, 0);
         $current_item_cost = $current_item_cost * $purchaseOrder->quantity;
         if (!$this->sessionData['char_id'] || !$purchaseOrder->item || $purchaseOrder->quantity < 1) {
             $no_funny_business = true;
         } else {
             if ($gold >= $current_item_cost) {
                 // Has enough gold.
                 try {
                     add_item($this->sessionData['char_id'], $purchaseOrder->item->identity(), $purchaseOrder->quantity);
                     subtract_gold($this->sessionData['char_id'], $current_item_cost);
                 } catch (Exception $e) {
                     $invalid_item = $e->getMessage();
                     error_log('Invalid Item attempted :' . $invalid_item);
                     $no_funny_business = true;
                 }
             }
         }
     }
     set_setting('items_quantity', $quantity);
     $parts = array('current_item_cost' => $current_item_cost, 'quantity' => $quantity, 'item_text' => $item_text, 'no_funny_business' => $no_funny_business, 'view_part' => 'buy');
     return $this->render($parts);
 }
Exemplo n.º 6
0
 function get_channel()
 {
     global $_G;
     if (!class_exists('SpContentGetallclassRequest')) {
         include_once ROOT_PATH . 'top/request/SpContentGetallclassRequest.php';
     }
     $req = new SpContentGetallclassRequest();
     $req->setSiteKey($_G['setting'][sitekey]);
     $resp = $_G['TOP']->execute($req);
     top_check_error($resp, $this->show_error);
     $value = $this->parse($resp);
     if (is_array($value) && count($value) > 0) {
         $rs = implode(',', $value);
         if (!isset($_G['setting']['uz_type'])) {
             insert_setting('uz_type', $rs);
         } else {
             set_setting('uz_type', $rs);
         }
         loadcache('setting', 'update');
     }
     return $value;
 }
Exemplo n.º 7
0
    }
    //print 'document.getElementById("res").innerHTML="ok";';
    if (isset($_POST['tt5'])) {
        switch ($_POST['tt5']) {
            case '1':
                set_setting('tt', 'prevedt');
                print "document.getElementById('div_tt').innerHTML='" . js_escape(obj_reload('tt')) . "';";
                print "document.getElementById('tt').focus();";
                exit;
            case '2':
                set_setting('tt', 'krossafcheg');
                print "document.getElementById('div_tt').innerHTML='" . js_escape(obj_reload('tt')) . "';";
                print "document.getElementById('tt').focus();";
                exit;
            case '3':
                set_setting('tt', 'test');
                print "document.getElementById('div_tt').innerHTML='" . js_escape(obj_reload('tt')) . "';";
                print "document.getElementById('tt').focus();";
                exit;
        }
    }
    exit;
}
$idcounter = isset($_SESSION['idcounter']) ? intval($_SESSION['idcounter']) : 0;
class dom_node
{
    public $parentnode = NULL, $nodes = array(), $id = 0;
    public $container = '';
    function __construct($name)
    {
        global $idcounter;
Exemplo n.º 8
0
 }
 if (!is_object($item)) {
     error_log('Invalid item identifier (' . (is_string($item_in) ? $item_in : 'non-string') . ') sent to page from ' . (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '(no referrer)') . '.');
     redirect(WEB_ROOT . 'inventory.php?error=noitem');
 }
 $item_count = item_count($user_id, $item);
 // Check whether use on self is occurring.
 $self_use = $selfTarget || $target_id === $user_id;
 if ($self_use) {
     $target = $username;
     $targetObj = $player;
 } else {
     if ($target_id) {
         $targetObj = new Player($target_id);
         $target = $targetObj->name();
         set_setting("last_item_used", $item_in);
         // Save last item used.
     }
 }
 $starting_turns = $player->vo->turns;
 $username_turns = $starting_turns;
 $username_level = $player->vo->level;
 if ($targetObj instanceof Player && $targetObj->id()) {
     $targets_turns = $targetObj->vo->turns;
     $targets_level = $targetObj->vo->level;
     $target_hp = $targetObj->vo->health;
 } else {
     $targets_turns = $targets_level = $target_hp = null;
 }
 $max_power_increase = 10;
 $level_difference = $targets_level - $username_level;
Exemplo n.º 9
0
 * Authentication file
 */
require "auth-admin.php";
/**
 * XHTML functions
 */
include "../functions/functions.xhtml.php";
/**
 * CKEditor
 */
include "../include/ckeditor/ckeditor.php";
global $db;
$CKEditor = new CKEditor();
$CKEditor->basePath = "../include/ckeditor/";
if (isset($_POST['information'])) {
    set_setting("information", $_POST['information']);
}
xhtml_head(T_("Set centre information"), true, array("../include/bootstrap/css/bootstrap.min.css", "../css/custom.css"), array("../js/window.js"));
?>
		<form action="" method="post" class="panel-body">
		<!-- <label for="information"><?php 
//echo T_("Set centre information: ");
?>
</label> -->
		<?php 
echo $CKEditor->editor("information", get_setting("information"));
?>
		<br/><input class="btn btn-primary" type="submit" name="update" value="<?php 
echo T_("Update centre information");
?>
"/>
Exemplo n.º 10
0
 function caiji()
 {
     global $_G;
     if ($_GET['onsubmit'] && check()) {
         $field = '';
         if ($_GET[field] && count($_GET[field]) > 0) {
             $f = array();
             foreach ($_GET[field] as $k => $v) {
                 $f[] = $k;
             }
             if ($f && count($f) > 0) {
                 $field = implode(',', $f);
             }
         }
         if (!isset($_G['setting']['filter_field'])) {
             insert_setting('filter_field', $field);
         } else {
             set_setting('filter_field', $field);
         }
         insert_setting();
         cpmsg('修改成功', 'success', 'm=admin&a=caiji');
         return false;
     }
     $field = array('picurl' => array('key' => 'picurl', 'name' => '主图', 'check' => 0), 'title' => array('key' => 'title', 'name' => '标题', 'check' => 0), 'num' => array('key' => 'num', 'name' => '库存数量', 'check' => 0), 'yh_price' => array('key' => 'yh_price', 'name' => '优惠价', 'check' => 0), 'sum' => array('key' => 'sum', 'name' => '销量', 'check' => 0), 'views' => array('key' => 'views', 'name' => '收藏', 'check' => 0), 'message' => array('key' => 'message', 'name' => '详情', 'check' => 0));
     if ($_G['setting']['filter_field']) {
         foreach ($_G['setting']['filter_field'] as $k => $v) {
             $field[$v]['check'] = 1;
         }
     }
     $this->add(array('field' => $field));
     $this->show();
 }
Exemplo n.º 11
0
 function gezi()
 {
     global $_G;
     if ($_GET['onsubmit'] && check()) {
         $arr = array();
         foreach ($_POST[picurl] as $k => $v) {
             $tmp = array();
             $tmp['picurl'] = $_POST[picurl][$k];
             $tmp['url'] = $_POST[url][$k];
             $tmp['title'] = $_POST[title][$k];
             if ($_FILES['file' . $k]) {
                 $pic = upload($_FILES['file' . $k]);
                 if ($pic) {
                     $tmp['picurl'] = $pic;
                 }
             }
             if (!$tmp['picurl'] && $tmp['url']) {
                 continue;
             }
             $arr[] = $tmp;
         }
         $arr = serialize($arr);
         if (isset($_G['setting']['app_gezi'])) {
             set_setting('app_gezi', $arr);
         } else {
             insert_setting('app_gezi', $arr);
         }
         loadcache('setting', 'update');
         cpmsg('修改成功', 'success', 'm=apps&a=gezi');
         return false;
     }
     if ($_G[setting]['app_gezi']) {
         $hdp = dunserialize($_G[setting]['app_gezi']);
     } else {
         $hdp = array(array('picurl' => '', 'url' => ''));
     }
     $size = 6;
     $this->add(array('hdp' => $hdp, 'size' => $size));
     $this->show('apps/gezi');
 }
Exemplo n.º 12
0
 * XHTML functions
 */
include "../functions/functions.xhtml.php";
if (isset($_GET['watch'])) {
    //start watching process
    start_process(realpath(dirname(__FILE__) . "/systemsortprocess.php"), 2);
}
$p = is_process_running(2);
if ($p) {
    if (isset($_GET['kill'])) {
        if ($_GET['kill'] == "force") {
            end_process($p);
        } else {
            kill_process($p);
        }
        set_setting('systemsort', false);
    }
    xhtml_head(T_("Monitor system wide case sorting"), true, array("../include/bootstrap/css/bootstrap.min.css", "../css/custom.css"), false, false, false, true);
    print "<h2>" . T_("Running process:") . " {$p}</h2>";
    if (is_process_killed($p)) {
        print "<h3>" . T_("Kill signal sent: Please wait...") . "</h3>";
        print "<p><a href='?kill=force'>" . T_("Process is already closed (eg. server was rebooted) - click here to confirm") . "</a></p>";
    } else {
        print "<p><a href='?kill=kill'>" . T_("Kill the running process") . "</a></p>";
    }
    $d = process_get_data($p);
    if ($d !== false) {
        xhtml_table($d, array('process_log_id', 'datetime', 'data'), array(T_("Log id"), T_("Date"), T_("Log entry")));
    }
} else {
    xhtml_head(T_("Monitor system wide case sorting"), true, array("../include/bootstrap/css/bootstrap.min.css", "../css/custom.css"));
Exemplo n.º 13
0
function insert_setting($name, $value)
{
    global $_G;
    if (!$name && !$value) {
        foreach ($_GET['postdb'] as $k => $v) {
            if (isset($_G['setting'][$k]) || array_key_exists($k, $_G['setting'])) {
                set_setting($k, $v);
            } else {
                insert_setting($k, $v);
            }
        }
    } else {
        if (isset($_G['setting'][$name]) || array_key_exists($name, $_G['setting'])) {
            set_setting($name, $value);
        } else {
            DB::insert('setting', array('name' => $name, 'value' => $value), true);
        }
    }
    loadcache('setting', 'update');
}
Exemplo n.º 14
0
$private = true;
$alive = true;
$page_title = "Battle Status";
$quickstat = "player";
if ($error = init($private, $alive)) {
    display_error($error);
    die;
}
// TODO: Turn this page/system into a function to be rendered.
// *** ********* GET VARS FROM POST - OR GET ************* ***
$target = whichever(in('target'), in('attackee'));
$duel = in('duel') ? true : NULL;
$blaze = in('blaze') ? true : NULL;
$deflect = in('deflect') ? true : NULL;
$evade = in('evasion') ? true : NULL;
set_setting('combat_toggles', array('duel' => $duel, 'blaze' => $blaze, 'deflect' => $deflect, 'evasion' => $evade));
// Save the combat toggled settings.
$attacker_id = self_char_id();
$attacker_obj = new Player($attacker_id);
$attacker = $attacker_obj->name();
$target_id = get_char_id($target);
// Template vars.
$stealthed_attack = $stealth_damage = $stealth_lost = $pre_battle_stats = $rounds = $combat_final_results = $killed_target = $attacker_died = $bounty_result = $rewarded_ki = $wrath_regain = false;
// *** Attack System Initialization ***
$killpoints = 0;
// *** Starting state for killpoints. ***
$attack_turns = 1;
// *** Default cost, will go to zero if an error prevents combat. ***
$required_turns = 0;
$what = "";
// *** This will be the attack type string, e.g. "duel". ***
Exemplo n.º 15
0
                            unlink('upgrade.php');
                            echo ' EXECUTED</li>';
                        } else {
                            //echo $thisFileName;exit;
                            $updateThis = fopen('../zipphp/' . $thisFileName, 'w');
                            fwrite($updateThis, $contents);
                            fclose($updateThis);
                            unset($contents);
                            echo ' UPDATED</li>';
                        }
                    }
                }
                echo '</ul>';
                $updated = true;
            } else {
                echo '<p>Update ready. <a href="?doUpdate=true">&raquo; Install Now?</a></p>';
            }
            break;
        }
    }
    if ($updated == true) {
        set_setting($advnce_version);
        echo '<p class="success">&raquo; CMS Updated to v' . $advnce_version . '</p>';
    } else {
        if ($found != true) {
            echo '<p>&raquo; No update is available.</p>';
        }
    }
} else {
    echo '<p>Could not find latest realeases.</p>';
}
Exemplo n.º 16
0
/**
 * Authentication file
 */
require "auth-admin.php";
/**
 * XHTML functions
 */
include "../functions/functions.xhtml.php";
if (isset($_POST['update'])) {
    set_setting("bosh_service", $_POST['bosh']);
    set_setting("supervisor_xmpp", $_POST['supervisor']);
    $enable = false;
    if (isset($_POST['enable'])) {
        $enable = true;
    }
    set_setting("chat_enabled", $enable);
}
xhtml_head(T_("Supervisor chat"), true, array("../include/bootstrap/css/bootstrap.min.css", "../include/bootstrap-toggle/css/bootstrap-toggle.min.css", "../css/custom.css"), array("../include/jquery/jquery.min.js", "../include/bootstrap/js/bootstrap.min.js", "../include/bootstrap-toggle/js/bootstrap-toggle.min.js", "../js/window.js"));
print "<p class='well'>" . T_("Allow interviewers to chat with the supervisor over XMPP (Jabber). Required is a BOSH enabled XMPP/Jabber server. The operators and the supervisor will need XMPP/Jabber accounts.") . "</p>";
$e = get_setting("chat_enabled");
$checked = "checked='checked'";
if (empty($e)) {
    $checked = "";
}
?>
		<form action="" method="post" class="form-horizontal">

		<div class="form-group form-inline">
			<label class="control-label col-sm-3" for="enable"><?php 
echo T_("Enable supervisor chat?");
?>
Exemplo n.º 17
0
 static function init()
 {
     set_setting();
 }
Exemplo n.º 18
0
<?php

require_once LIB_ROOT . 'control/lib_inventory.php';
$private = false;
$alive = true;
if ($error = init($private, $alive)) {
    display_error($error);
} else {
    $work_multiplier = 30;
    $worked = $new_gold = $not_enough_energy = $use_second_description = null;
    $is_logged_in = is_logged_in();
    $worked = intval(in('worked'));
    $recommended_to_work = 10;
    // Store or retrieve the last value of turns worked.
    if ($worked && is_numeric($worked)) {
        set_setting('turns_worked', $worked);
        $recommended_to_work = $worked;
    } else {
        $last_worked = get_setting('turns_worked');
        $recommended_to_work = $last_worked ? $last_worked : 10;
    }
    // Work only if the work was requested, not just if the setting was set.
    if ($worked > 0) {
        $turns = get_turns($char_id);
        if ($worked > $turns) {
            $not_enough_energy = true;
        } else {
            $new_gold = $worked * $work_multiplier;
            // *** calc amount worked ***
            add_gold($char_id, $new_gold);
            $turns = subtractTurns($char_id, $worked);
Exemplo n.º 19
0
/**
 * Disable system sort on shutdown
 * 
 * @author Adam Zammit <*****@*****.**>
 * @since  2011-01-31
 */
function disable_systemsort()
{
    set_setting('systemsort', false);
}
Exemplo n.º 20
0
 $page = in('page', 1, 'non_negative_int');
 $limit = 25;
 $offset = non_negative_int(($page - 1) * $limit);
 $delete = in('delete');
 $informational = in('informational');
 $type = in('type');
 // Clan chat or normal messages.
 $type = restrict_to($type, array(0, 1));
 $message_sent_to = null;
 // Names or name to display.
 $message_to = null;
 // strings clan or individual if sent to those respectively.
 if ($target_id) {
     $to = get_char_name($target_id);
 }
 set_setting('last_messaged', $to);
 switch (true) {
     case $command == 'clan' && $_POST:
         $messages_type = 'clan';
         $current_tab = 'clan';
         $type = 1;
         break;
     case $command == 'clan':
         $messages_type = 'clan';
         $current_tab = 'clan';
         $type = 1;
         break;
     case $command == 'personal' && $_POST:
         // Try to send
         $messages_type = 'personal';
         $current_tab = 'messages';
Exemplo n.º 21
0
            }
            echo "</div>\n";
            echo "<div align='center' style='margin-top:5px;'>\n" . makePageNav($_GET['rowstart'], 20, $rows, 3, FUSION_SELF . $aidlink . "&amp;") . "\n</div>\n";
        } else {
            echo "<div style='text-align:center'><br />\n" . $locale['SB_no_msgs'] . "<br /><br />\n</div>\n";
        }
        closetable();
    }
} else {
    require_once INCLUDES . "infusions_include.php";
    if (isset($_POST['sb_settings'])) {
        if (isset($_POST['visible_shouts']) && isnum($_POST['visible_shouts'])) {
            $setting = set_setting("visible_shouts", $_POST['visible_shouts'], "shoutbox_panel");
        }
        if (isset($_POST['guest_shouts']) && ($_POST['guest_shouts'] == 1 || $_POST['guest_shouts'] == 0)) {
            $setting = set_setting("guest_shouts", $_POST['guest_shouts'], "shoutbox_panel");
        }
        redirect(FUSION_SELF . $aidlink . "&amp;page=settings&amp;status=update_ok");
    }
    if (isset($_POST['sb_delete_old']) && isset($_POST['num_days']) && isnum($_POST['num_days'])) {
        $deletetime = time() - $_POST['num_days'] * 86400;
        $numrows = dbcount("(shout_id)", DB_SHOUTBOX, "shout_datestamp < '" . $deletetime . "'");
        $result = dbquery("DELETE FROM " . DB_SHOUTBOX . " WHERE shout_datestamp < '" . $deletetime . "'");
        redirect(FUSION_SELF . $aidlink . "&amp;page=settings&amp;status=delall&numr={$numrows}");
    }
    if (isset($_GET['status'])) {
        if ($_GET['status'] == "delall" && isset($_GET['numr']) && isnum($_GET['numr'])) {
            $message = number_format(intval($_GET['numr'])) . " " . $locale['SB_shouts_deleted'];
        } elseif ($_GET['status'] == "update_ok") {
            $message = $locale['SB_update_ok'];
        }
Exemplo n.º 22
0
<?php

import('session');
import('forms');
if (!is_admin()) {
    header('location: /users/logut');
    exit;
}
if (isset($_POST) && !empty($_POST)) {
    foreach ($_POST as $key => $value) {
        set_setting($key, $value);
    }
    $success[] = 'New settings saved!';
    $system_settings = get_settings();
}
$template = set_template('dashboard', 'parameters');
$link = THEME . 'template.php';
require_once $link;
Exemplo n.º 23
0
 public function update($cachename)
 {
     global $_G;
     $sys = true;
     //$syn = false,代表不写入缓存,每次都读取
     if (strpos($cachename, '_cate') !== false) {
         $tmp = explode('_', $cachename);
         $cate = new cate($tmp[0], $tmp[0]);
         $cache_data = $cate->get_cate();
         $this->set($cachename, $cache_data, true, 1);
         return $cache_data;
     }
     switch ($cachename) {
         case 'all_channel':
             $all_channel = DB::fetch_all("SELECT * FROM " . DB::table('channel') . " ORDER BY `sort` DESC,fid ASC ", 'fid');
             $tmp = array();
             foreach ($all_channel as $k => $v) {
                 $v[org_url] = $v[url];
                 $v[url] = '/index.php?fid=' . $v[fid];
                 $tmp['k' . $k] = $v;
             }
             $cache_data = $tmp;
             break;
         case 'channels':
             $all_channel = DB::fetch_all("SELECT * FROM " . DB::table('channel') . " ORDER BY `sort` DESC,fid ASC ", 'fid');
             $channel = array();
             //一级
             foreach ($all_channel as $k => $v) {
                 if ($v[fup] == 0) {
                     //$v[count] = getcount('goods'," AND fid = ".$v[fid]);
                     $v[org_url] = $v[url];
                     $v[url] = '/index.php?fid=' . $v[fid];
                     $channel[$k] = $v;
                 }
             }
             //二级
             $tmps = $all_channel;
             foreach ($channel as $k => $v) {
                 $sub = array();
                 $fid_in = array();
                 unset($tmps[$v[fid]]);
                 foreach ($all_channel as $kk => $vv) {
                     if ($vv['fup'] == $k) {
                         //$vv[count] = getcount('goods'," AND fid = ".$vv[fid]);
                         $vv[org_url] = $vv[url];
                         $vv[url] = '/index.php?fid=' . $vv[fid];
                         $sub[$kk] = $vv;
                         //二级栏目
                         $fid_in2 = array();
                         unset($tmps[$vv[fid]]);
                         foreach ($all_channel as $k3 => $v3) {
                             if ($v3['fup'] == $kk) {
                                 $v3[org_url] = $v3[url];
                                 $v3[url] = '/index.php?fid=' . $v3[fid];
                                 //$v3[count] = getcount('goods'," AND fid = ".$v3[fid]);
                                 unset($tmps[$v3[fid]]);
                                 $sub[$kk]['sub'][$k3] = $v3;
                                 //三级栏目
                                 $fid_in2[] = $v3['fid'];
                                 $fid_in[] = $v3['fid'];
                                 $sub[$kk]['sub'][$k3]['fid_in'] = $v3['fid'];
                             }
                         }
                         $fid_in[] = $vv['fid'];
                         $fid_in2[] = $vv['fid'];
                         $sub[$kk]['fid_in'] = implode(',', $fid_in2);
                     }
                 }
                 $fid_in[] = $v['fid'];
                 $channel[$k]['fid_in'] = implode(',', $fid_in);
                 if ($sub) {
                     $channel[$k]['sub'] = $sub;
                 }
             }
             if (count($tmps) > 0) {
                 foreach ($tmps as $k => $v) {
                     if (!array_key_exists($k)) {
                         $v[fid_in] = $v[fid];
                         $channel[$k] = $v;
                     }
                 }
             }
             $cache_data = $channel;
             break;
         case 'setting':
             set_setting('time', TIMESTAMP);
             $st = DB::fetch_all("SELECT * FROM " . DB::table('setting'));
             foreach ($st as $k => $v) {
                 $setting[$v['name']] = $v['value'];
             }
             if ($setting['qq']) {
                 $setting['qq'] = explode(',', $setting['qq']);
             }
             if ($setting['flag']) {
                 $setting['flag'] = explode(',', $setting['flag']);
                 $setting['flag'] = array_filter($setting['flag']);
             }
             if ($setting['shop_tag']) {
                 $setting['shop_tag'] = explode(',', $setting['shop_tag']);
                 $setting['shop_tag'] = array_filter($setting['shop_tag']);
             }
             if ($setting['goods_tag']) {
                 $setting['goods_tag'] = explode(',', $setting['goods_tag']);
                 $setting['goods_tag'] = array_filter($setting['goods_tag']);
             }
             if ($setting['article_tag']) {
                 $setting['article_tag'] = explode(',', $setting['article_tag']);
                 $setting['article_tag'] = array_filter($setting['article_tag']);
             }
             if ($setting['filter_field']) {
                 $setting['filter_field'] = explode(',', $setting['filter_field']);
             }
             if ($setting['shiyong_status']) {
                 $setting['shiyong_status'] = explode(',', $setting['shiyong_status']);
             }
             if ($setting['duihuan_status']) {
                 $setting['duihuan_status'] = explode(',', $setting['duihuan_status']);
             }
             if ($setting['shiyong_tags']) {
                 $setting['shiyong_tags'] = explode(',', $setting['shiyong_tags']);
             }
             if ($setting['activity_tags']) {
                 $setting['activity_tags'] = explode(',', $setting['activity_tags']);
             }
             if ($setting['style_tags']) {
                 $setting['style_tags'] = explode(',', $setting['style_tags']);
             }
             if ($setting['movie_tags']) {
                 $setting['movie_tags'] = explode(',', $setting['movie_tags']);
             }
             if ($setting['zj_tags']) {
                 $setting['zj_tags'] = explode(',', $setting['zj_tags']);
             }
             if ($setting['shishang_flag']) {
                 $setting['shishang_flag'] = explode(',', $setting['shishang_flag']);
             }
             if ($setting['tags']) {
                 $setting['tags'] = explode(',', $setting['tags']);
                 $tags = array();
                 foreach ($setting['tags'] as $k => $v) {
                     $uname = urlencode_utf8($v);
                     $tags[$uname] = $v;
                 }
                 $setting['tags'] = $tags;
             }
             if ($setting['sign_jf']) {
                 $setting['sign_jf'] = (array) dunserialize($setting['sign_jf']);
             }
             if ($setting['sign_tb']) {
                 $setting['sign_tb'] = (array) dunserialize($setting['sign_tb']);
             }
             if ($setting['syn_table']) {
                 $setting['syn_table'] = explode(',', $setting['syn_table']);
             }
             if ($setting['syn_domain']) {
                 $setting['syn_domain'] = explode("\r\n", $setting['syn_domain']);
             }
             if ($setting['uz_tag']) {
                 $setting['uz_tag'] = explode(',', $setting['uz_tag']);
             }
             if ($setting['uz_type']) {
                 $setting['uz_type'] = explode(',', $setting['uz_type']);
             }
             $setting['time'] = TIMESTAMP;
             if ($setting['email']) {
                 $setting['email'] = (array) dunserialize($setting['email']);
             }
             $cache_data = $setting;
             break;
         case 'friend_link':
             //友情链接
             $friend_link = DB::fetch_all("SELECT * FROM " . DB::table('friend_link') . " ORDER BY sort DESC,id DESC", 'id');
             foreach ($friend_link as $k => $v) {
                 $friend_link[$k]['dateline'] = dgmdate($v['dateline'], 'u');
             }
             $cache_data = $friend_link;
             break;
         case 'pics_type':
             $cache_data = DB::fetch_all("SELECT * FROM " . DB::table('pics_type') . " ORDER BY id DESC", 'id');
             break;
         case 'pics':
             $pics_type = DB::fetch_all("SELECT * FROM " . DB::table('pics_type') . " ORDER BY id DESC", 'id');
             $pics_tmp = DB::fetch_all("SELECT * FROM " . DB::table('pics') . " ORDER BY sort ASC,id DESC ", 'id');
             $pics = array();
             foreach ($pics_type as $k => $v) {
                 $pics[$k] = array();
                 foreach ($pics_tmp as $k1 => $v1) {
                     $v1['org_dateline'] = $v1['dateline'];
                     $v1['dateline'] = dgmdate($v1['dateline'], 'u');
                     if ($v1['fup'] == $k) {
                         $pics[$k][$k1] = $v1;
                     }
                 }
             }
             $cache_data = set_key($pics);
             break;
         case 'ad':
             $ad = DB::fetch_all("SELECT * FROM " . DB::table('ad') . " ORDER BY id DESC ", 'id');
             foreach ($ad as $k => $v) {
                 $ad[$k]['org_dateline'] = $v[dateline];
                 $ad[$k]['dateline'] = dgmdate($v[dateline], 'u');
                 $ad[$k]['start_time'] = dgmdate($v[start_time], 'dt');
                 $ad[$k]['end_time'] = dgmdate($v[end_time], 'dt');
                 $ad[$k]['show'] = false;
                 $ad[$k]['show_html'] = '';
                 //先判断是否在显示时间内
                 $show = 0;
                 if ($v['start_time'] < TIMESTAMP && ($v['end_time'] == 0 || $v['end_time'] > TIMESTAMP)) {
                     $show = 1;
                 }
                 if ($show == true && $v['hide'] == 0) {
                     $html = '';
                     if ($v['type'] == 1) {
                         $html = $v['content'];
                     } elseif ($v['type'] == 2) {
                         $width = $v['width'] > 0 ? "width='" . $v['width'] . "'" : '';
                         $height = $v['height'] > 0 ? "height='" . $v['height'] . "'" : '';
                         $img = "<img class='ads_" . $k . "' src='" . $v['picurl'] . "' " . $width . "" . $height . " />";
                         if ($v['url']) {
                             $target = $v['target'] == 1 ? "target='_blank'" : '';
                             $html = "<a href='" . $v['url'] . "' " . $target . " >" . $img . "</a>";
                         } else {
                             $html = $img;
                         }
                     } else {
                         $html = $v['html'];
                     }
                     if (!empty($html)) {
                         $ad[$k]['show'] = true;
                         $ad[$k]['show_html'] = $html;
                     } else {
                         $ad[$k]['show_html'] = '';
                     }
                 }
             }
             $cache_data = set_key($ad);
             break;
         case 'goods_cate':
             $cate = new cate('goods', 'goods');
             $cache_data = $cate->get_cate();
             break;
         case 'shop':
             $shop = DB::fetch_all("SELECT * FROM " . DB::table('shop') . " ORDER BY sort DESC,id DESC", 'id');
             foreach ($shop as $k => $v) {
                 $shop[$k] = parse('shop', $v);
             }
             $cache_data = $shop;
             break;
         case 'shop_cate':
             $cate = new cate('shop', 'shop');
             $cache_data = $cate->get_cate();
             break;
         case 'prize':
             $rs = DB::fetch_all("SELECT * FROM " . DB::table('prize') . " ORDER BY sort DESC ,id DESC ", 'id');
             foreach ($rs as $k => $v) {
                 //统计每个分类,还未中奖的中奖码..
                 $rs[$k][num] = $rs[$k][count] = getcount('ticket', "prizeid = " . $v[id] . " AND is_use=0");
                 $rs[$k][total] = getcount('ticket', "prizeid = " . $v[id]);
             }
             $cache_data = $rs;
             break;
         case 'table':
             $cache_data = update_table();
             break;
         case 'group':
             $rs = DB::fetch_all("SELECT * FROM " . DB::table('group') . " ORDER BY id ASC", 'id');
             foreach ($rs as $k => $v) {
                 $rs[$k][power] = dunserialize($v['power']);
             }
             $cache_data = $rs;
             break;
         case 'rank':
             $rs = DB::fetch_all("SELECT * FROM " . DB::table('rank') . " ORDER BY id ASC", 'id');
             $cache_data = $rs;
             break;
         default:
             $sys = false;
             $cache_data = '';
             break;
     }
     if ($sys == true) {
         $this->set($cachename, $cache_data, true, 1);
     }
     return $cache_data;
 }
Exemplo n.º 24
0
require "auth-admin.php";
/**
 * XHTML functions
 */
include "../functions/functions.xhtml.php";
/**
 * Display functions
 */
include "../functions/functions.display.php";
/**
 * Input functions
 */
include "../functions/functions.input.php";
global $db;
if (isset($_POST['dtime_zone'])) {
    set_setting('DEFAULT_TIME_ZONE', $_POST['dtime_zone']);
}
if (isset($_GET['time_zone'])) {
    //need to add sample to questionnaire
    $tz = $db->qstr($_GET['time_zone'], get_magic_quotes_gpc());
    $sql = "INSERT INTO timezone_template(Time_zone_name)\r\n\t\tVALUES({$tz})";
    $db->Execute($sql);
}
if (isset($_GET['tz'])) {
    //need to remove rsid from questionnaire
    $tz = $db->qstr($_GET['tz'], get_magic_quotes_gpc());
    $sql = "DELETE FROM timezone_template\r\n\t\tWHERE Time_zone_name = {$tz}";
    $db->Execute($sql);
}
xhtml_head(T_("Set Timezones"), true, array("../include/bootstrap/css/bootstrap.min.css", "../css/custom.css"), array("../js/window.js"));
//,"../include/bootstrap/css/bootstrap-theme.min.css"