Exemple #1
0
 public function update($id = '')
 {
     $page = $this->page($id);
     if (!$page) {
         return response::error(l('pages.error.missing'));
     }
     $blueprint = blueprint::find($page);
     $fields = $blueprint->fields($page);
     $oldTitle = (string) $page->title();
     // trigger the validation
     $form = new Form($fields->toArray());
     $form->validate();
     // fetch the data for the form
     $data = pagedata::createByInput($page, $form->serialize());
     // stop at invalid fields
     if (!$form->isValid()) {
         return response::error(l('pages.show.error.form'), 400, array('fields' => $form->fields()->filterBy('error', true)->pluck('name')));
     }
     try {
         $page->update($data);
         // make sure that the sorting number is correct
         if ($page->isVisible()) {
             $num = api::createPageNum($page);
             if ($num !== $page->num()) {
                 if ($num > 0) {
                     $page->sort($num);
                 }
             }
         }
         history::visit($page->id());
         return response::success('success', array('file' => $page->content()->root(), 'data' => $data, 'uid' => $page->uid(), 'uri' => $page->id()));
     } catch (Exception $e) {
         return response::error($e->getMessage());
     }
 }
Exemple #2
0
 public function depositIsPay($deposit_id, $recharge_type)
 {
     global $mysql, $langArray, $config;
     $row = $this->get($deposit_id);
     if ($row) {
         //订单已成功
         if ($row['paid'] == 'true') {
             return;
         }
         //对用户进行充值 添加到充值余额 同时增加总余额
         $mysql->query("\n\t\t\t\tUPDATE `users`\n\t\t\t\tSET `deposit` = `deposit` + '" . sql_quote($row['deposit']) . "',\n\t\t\t\t\t\t`total` = `total` + '" . sql_quote($row['deposit']) . "'\n\t\t\t\tWHERE `user_id` = '" . intval($row['user_id']) . "'\n\t\t\t\tLIMIT 1\n\t\t\t");
         //资金流动类
         require_once ROOT_PATH . '/apps/users/models/transaction_details.class.php';
         $logClass = new transaction_details();
         //记录资金流动(uid,type,value,info)
         if (floatval($row['deposit']) > 0) {
             $logClass->addRecord(intval($row['user_id']), 'deposit', floatval($row['deposit']), $langArray['deposit_type'] . ':' . $recharge_type);
         }
         $user_deposit = floatval($_SESSION['user']['deposit']) + floatval($row['deposit']);
         $user_total = floatval($_SESSION['user']['total']) + floatval($row['deposit']);
         //改变充值订单状态
         $mysql->query("\n\t\t\t\tUPDATE `deposit`\n\t\t\t\tSET \n\t\t\t\t`paid` = 'true'\n\t\t\t\tWHERE `id` = '" . intval($deposit_id) . "'\n\t\t\t");
         //检测用户登录状态 更新session
         if (isset($_SESSION['user'])) {
             $_SESSION['user']['deposit'] = $user_deposit;
             $_SESSION['user']['total'] = $user_total;
         }
         require_once ROOT_PATH . '/classes/history.class.php';
         $historyClass = new history();
         //添加到充值记录
         $historyClass->add($langArray['deposit_history'] . $row['deposit'], $deposit_id, $row['user_id']);
         #CHECK REFERAL
         require_once ROOT_PATH . '/apps/users/models/users.class.php';
         $usersClass = new users();
         $user = $usersClass->get($row['user_id']);
         if ($user['referal_id'] != '0') {
             //对推荐人进行分成  (暂时关闭对充值进行分成)
             //$this->referalMoney($row, $user);
         }
     }
 }
Exemple #3
0
 public function index()
 {
     $widgets = array();
     $wroot = c::get('root.site') . DS . 'widgets';
     $wdirs = dir::read($wroot);
     foreach ($wdirs as $dir) {
         $file = $wroot . DS . $dir . DS . $dir . '.php';
         if (file_exists($file)) {
             $widgets[$dir] = (require $file);
         }
     }
     return view('dashboard/index', array('topbar' => new Snippet('pages/topbar', array('breadcrumb' => new Snippet('breadcrumb'), 'search' => purl('pages/search/'))), 'history' => history::get(), 'site' => site(), 'widgets' => $widgets, 'user' => site()->user()));
 }
 public function index()
 {
     $site = site();
     $widgets = array();
     $wroot = kirby()->roots()->widgets();
     $wdirs = dir::read($wroot);
     // fetch all top-level pages in the right order
     $blueprint = blueprint::find($site);
     $pages = api::subpages($site->children(), $blueprint);
     foreach ($wdirs as $dir) {
         $file = $wroot . DS . $dir . DS . $dir . '.php';
         if (file_exists($file)) {
             $widgets[$dir] = (require $file);
         }
     }
     return view('dashboard/index', array('topbar' => new Snippet('pages/topbar', array('breadcrumb' => new Snippet('breadcrumb'), 'search' => purl('pages/search/'))), 'history' => history::get(), 'site' => $site, 'pages' => $pages, 'addbutton' => !api::maxPages($site, $blueprint->pages()->max()), 'widgets' => $widgets, 'user' => site()->user(), 'license' => panel()->license()));
 }
 public function update($id = '')
 {
     $page = $this->page($id);
     if (!$page) {
         return response::error(l('pages.error.missing'));
     }
     $blueprint = blueprint::find($page);
     $fields = $blueprint->fields($page);
     $oldTitle = (string) $page->title();
     // trigger the validation
     $form = new Form($fields->toArray());
     $form->validate();
     // fetch the data for the form
     $data = pagedata::createByInput($page, $form->serialize());
     // stop at invalid fields
     if (!$form->isValid()) {
         return response::error(l('pages.show.error.form'), 400, array('fields' => $form->fields()->filterBy('error', true)->pluck('name')));
     }
     try {
         PageStore::discard($page);
         $page->update($data);
         // make sure that the sorting number is correct
         if ($page->isVisible()) {
             $num = api::createPageNum($page);
             if ($num !== $page->num()) {
                 if ($num > 0) {
                     $page->sort($num);
                 }
             }
         }
         // get the blueprint of the parent page to find the
         // correct sorting mode for this page
         $parentBlueprint = blueprint::find($page->parent());
         // auto-update the uid if the sorting mode is set to zero
         if ($parentBlueprint->pages()->num()->mode() == 'zero') {
             $uid = str::slug($page->title());
             $page->move($uid);
         }
         history::visit($page->id());
         kirby()->trigger('panel.page.update', $page);
         return response::success('success', array('file' => $page->content()->root(), 'data' => $data, 'uid' => $page->uid(), 'uri' => $page->id()));
     } catch (Exception $e) {
         return response::error($e->getMessage());
     }
 }
 function display_questions()
 {
     if (func_num_args()) {
         $arg_list = func_get_args();
         $menu_id = $arg_list[0];
         $post_vars = $arg_list[1];
         $get_vars = $arg_list[2];
     }
     print "<table width='500'>";
     print "<tr valign='top'><td colspan='3'>";
     print "<span class='library'>" . FTITLE_QUESTION_LIST . "</span><br>";
     print "</td></tr>";
     print "<tr valign='top'><td>&nbsp;</td><td><b>ID</b></td><td><b>" . THEAD_TEXT . "</b></td><td><b>" . THEAD_TYPE . "</b></td><td><b>" . THEAD_ALERT . "</b></td></tr>";
     $sql = "select question_id, question_rank, question_text, answer_type, question_cat, alert_flag from m_lib_questions order by question_cat, question_rank";
     if ($result = mysql_query($sql)) {
         if (mysql_num_rows($result)) {
             while (list($id, $rank, $text, $type, $cat, $alert) = mysql_fetch_array($result)) {
                 if ($prevcat != $cat) {
                     print "<tr bgcolor='#FFCC00'><td colspan='5'><b>" . strtoupper(history::get_catname($cat)) . "</b></td></tr>";
                 }
                 print "<tr valign='top'><td>";
                 print "<a name='id{$id}'>";
                 print "<a href='" . $_SERVER["PHPS_SELF"] . "?page=" . $get_vars["page"] . "&menu_id=" . $get_vars["menu_id"] . "&menu_item={$id}&cat={$cat}&moveup={$rank}#id{$id}'><img src='../images/uparrow.gif' border='0'/></a>";
                 print "<a href='" . $_SERVER["PHPS_SELF"] . "?page=" . $get_vars["page"] . "&menu_id=" . $get_vars["menu_id"] . "&menu_item={$id}&cat={$cat}&movedown={$rank}#id{$id}'><img src='../images/downarrow.gif' border='0'/></a>";
                 print "</td>";
                 print "</td><td>{$id}</td><td><a href='" . $_SERVER["SELF"] . "?page=" . $get_vars["page"] . "&menu_id={$menu_id}&question_id={$id}'>" . stripslashes($text) . "</a></td><td>{$type}</td><td>{$alert}</td></tr>";
                 $prevcat = $cat;
             }
         }
     }
     print "</table><br>";
 }
 public function historyNext()
 {
     load_class('history');
     session_start();
     //re start
     $session = $_SESSION['history'];
     if (is_array($session)) {
         $hi = new history($session);
         $path = $hi->gonext();
         $_SESSION['history'] = $hi->getHistory();
         $folderlist = $this->path(_DIR($path));
         $_SESSION['this_path'] = $path;
         show_json(array('history_status' => array('back' => $hi->isback(), 'next' => $hi->isnext()), 'thispath' => $path, 'list' => $folderlist));
     }
 }
 public static function lastChangeStateDuration($_cmd_id, $_value)
 {
     return history::lastChangeStateDuration(str_replace('#', '', $_cmd_id), $_value);
 }
Exemple #9
0
 public static function checkAndCollect()
 {
     try {
         if (date('Gi') >= 500 && date('Gi') < 505) {
             history::archive();
         }
     } catch (Exception $e) {
         log::add('history', 'error', 'history::archive : ' . $e->getMessage());
     }
     try {
         network::cron();
     } catch (Exception $e) {
         log::add('network', 'error', 'network::cron : ' . $e->getMessage());
     }
     try {
         eqLogic::checkAlive();
         connection::cron();
         if (config::byKey('jeeNetwork::mode') != 'slave') {
             jeeNetwork::pull();
         }
     } catch (Exception $e) {
     }
     try {
         cmd::collect();
     } catch (Exception $e) {
         log::add('cmd', 'error', 'cmd::collect : ' . $e->getMessage());
     }
     try {
         history::historize();
     } catch (Exception $e) {
         log::add('history', 'error', 'history::archive : ' . $e->getMessage());
     }
 }
Exemple #10
0
 public function getPluralityHistory($_dateStart = null, $_dateEnd = null, $_period = 'day', $_offset = 0)
 {
     return history::getPlurality($this->id, $_dateStart, $_dateEnd, $_period, $_offset);
 }
Exemple #11
0
             } else {
                 $value = null;
             }
             $previsousValue = $history->getValue() === null ? null : floatval($history->getValue());
         }
         $info_history[] = $value;
         if ($value != null && $value > $return['maxValue'] || $return['maxValue'] == '') {
             $return['maxValue'] = $value;
         }
         if ($value != null && $value < $return['minValue'] || $return['minValue'] == '') {
             $return['minValue'] = $value;
         }
         $data[] = $info_history;
     }
 } else {
     $histories = history::getHistoryFromCalcul(init('id'), $dateStart, $dateEnd, init('allowZero', true));
     if (is_array($histories)) {
         foreach ($histories as $datetime => $value) {
             $info_history = array();
             $info_history[] = floatval($datetime) * 1000;
             $info_history[] = $value === null ? null : floatval($value);
             if ($value > $return['maxValue'] || $return['maxValue'] == '') {
                 $return['maxValue'] = $value;
             }
             if ($value < $return['minValue'] || $return['minValue'] == '') {
                 $return['minValue'] = $value;
             }
             $data[] = $info_history;
         }
     }
     $return['cmd_name'] = init('name');
Exemple #12
0
        $email_template = $tpl->render($tpl->email_plain_text, $data_email);
        $to_save = array('query_string' => $query_string, 'result' => $result_action, 'time_creation' => time(), 'date_creation' => date("Y-m-d H:i:s"), 'server_info' => $_SERVER, 'request_info' => $_REQUEST, 'cookie_info' => $_COOKIE, 'env_info' => $_ENV, 'email_template' => $email_template);
        // get current log
        if (file_exists('createacct_log')) {
            $rawlog = file_get_contents('createacct_log');
        } else {
            file_put_contents('createacct_log', json_encode(array()));
            $rawlog = file_get_contents('createacct_log');
        }
        $records = json_decode($rawlog);
        $records[] = $to_save;
        $rawlog = json_encode($records);
        file_put_contents('createacct_log', $rawlog);
    }
}
if (file_exists('createacct_log')) {
    // read current log
    $rawlog = file_get_contents('createacct_log');
    $records = array_reverse(json_decode($rawlog), true);
    $history = new history();
    $data['history'] = $history->show_history($records);
} else {
    $data['history'] = '<div class="alert alert-info">Nothing recorded yet!.</div>';
}
$data['script_path'] = SCRIPT_PATH;
$data['select_servers'] = $core->get_select_servers($servers);
$data['serverid'] = $_REQUEST['serverid'];
$data['root_path'] = ROOT_PATH;
$data['html_navbar'] = $tpl->render($tpl->html_navbar, $data);
echo $tpl->render($tpl->html_header, $data) . $tpl->render($tpl->html_tpl_main, $data);
exit;
<?php

/*
* This is User Admin page
* ALl of the site feature shows from here.
 * */
include 'header.php';
global $session;
if (!$session->is_p_logedIn()) {
    safe_redirect(get_home_url() . '/login.php');
}
global $main_db;
$history = new history();
?>

<section class="container-fluid admin-section section bg-gray-img">
    <div class="container">
        <div class="row">
            <div class="col-md-3 leftbar">
                <div class="content">
                    <ul class="admin_tab_list">
                        <li data-target="upload_files" class="active"> <i class="fa fa-file fa-2x"></i> My Documents </li>
                        <li data-target="history"> <i class="fa fa-history fa-2x"></i> History </li>
                        <li data-target="profile"> <i class="fa fa-user fa-2x"></i> Profile </li>
                        <li data-target="help"> <i class="fa fa-dribbble fa-2x"></i> Help </li>
                        <li><a href="<?php 
echo get_home_url();
?>
/logout.php"><i class="fa fa-power-off fa-2x"></i> Log Out</a> </li>
                    </ul>
                </div>
Exemple #14
0
<?php

return array('title' => array('text' => l('dashboard.index.history.title'), 'link' => false), 'html' => function () {
    return tpl::load(__DIR__ . DS . 'history.html.php', array('history' => history::get()));
});
Exemple #15
0
 public function sql_delete($data = null)
 {
     unset($this->error);
     $this->error = array();
     if (count($this->_keys) === 0) {
         $this->unserializeKeys();
     }
     //TODO implement verification of child table before delete
     foreach ($data as $table => $field) {
         if (file_exists(TMP . "/database/" . $table . ".table.txt")) {
             if (!empty($field['id'])) {
                 if (static::HISTORY_ACTIVE) {
                     //traitement specifique
                     if (strstr($this->_table_to_history, $table)) {
                         $sql = "SELECT * FROM " . static::ESC . "" . $table . "" . static::ESC . " WHERE id ='" . $data[$table]['id'] . "'";
                         $res = $this->sql_query($sql);
                         if ($this->sql_num_rows($res) === 1) {
                             $before_update = $this->sql_to_array($res);
                         } else {
                             return false;
                         }
                         $param = \history::compare($before_update[0], array());
                         $id_table = $data[$table]['id'];
                         \history::insert($table, $id_table, $param, $this->_history_type, $this->_history_user, 'DELETE');
                         $this->_history_type = HISTORY_TYPE;
                         $this->_history_user = null;
                     }
                 }
                 $sql = "UPDATE " . $table . " SET id_history_etat = 3 WHERE id =" . $field['id'];
                 $this->sql_query($sql, $table, "UPDATE");
             }
         }
     }
 }
Exemple #16
0
            $current_user =& singleton("current_user", new person());
            $sess = new session();
            // If session hasn't been started re-direct to login page
            if (!$sess->Started()) {
                defined("NO_REDIRECT") && exit("Session expired. Please <a href='" . $TPL["url_alloc_login"] . "'>log in</a> again.");
                alloc_redirect($TPL["url_alloc_login"] . ($_SERVER['REQUEST_URI'] != '/' ? '?forward=' . urlencode($_SERVER['REQUEST_URI']) : ''));
                // Else load up the current_user and continue
            } else {
                if ($sess->Get("personID")) {
                    $current_user->load_current_user($sess->Get("personID"));
                }
            }
        }
        // Setup all the urls
        require_once ALLOC_MOD_DIR . "shared" . DIRECTORY_SEPARATOR . "global_tpl_values.inc.php";
        $TPL = get_alloc_urls($TPL, $sess);
        // Add user's navigation to quick list dropdown
        if (is_object($current_user) && $current_user->get_id()) {
            $history = new history();
            $history->save_history();
            $TPL["current_user"] =& $current_user;
        }
    }
}
// This is a hook for the SaaS side of alloc, to allow per-site code customizations
if (!function_exists("ace_augment")) {
    function ace_augment($name, $default = null)
    {
        return $default;
    }
}
Exemple #17
0
<?php

// +----------------------------------------------------------------------
// | Demila [ Beautiful Digital Content Trading System ]
// +----------------------------------------------------------------------
// | Copyright (c) 2015 http://demila.org All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Email author@demila.org
// +----------------------------------------------------------------------
_setView(__FILE__);
_setTitle($langArray['deposit_history_setTitle']);
if (!check_login_bool()) {
    $_SESSION['temp']['golink'] = '/' . $languageURL . 'invoices/';
    refresh('/' . $languageURL . 'users/login/');
}
require_once ROOT_PATH . '/classes/history.class.php';
$historyClass = new history();
$history = $historyClass->getAll(0, 0, " `user_id` = '" . intval($_SESSION['user']['user_id']) . "' ");
abr('history', $history);
#面包屑
abr('breadcrumb', '<a href="/' . $languageURL . '" title="">' . $langArray['home'] . '</a> \\ <a href="/' . $languageURL . 'users/dashboard/" title="">' . $langArray['my_account'] . '</a> \\ <a href="/' . $languageURL . 'users/history/" title="">' . $langArray['history'] . '</a>');
Exemple #18
0
 public static function toolbar()
 {
     global $TPL;
     $current_user =& singleton("current_user");
     $db = new db_alloc();
     has("task") and $str[] = "<option value=\"create_" . $TPL["url_alloc_task"] . "\">New Task</option>";
     has("time") and $str[] = "<option value=\"create_" . $TPL["url_alloc_timeSheet"] . "\">New Time Sheet</option>";
     has("task") and $str[] = "<option value=\"create_" . $TPL["url_alloc_task"] . "tasktype=Fault\">New Fault</option>";
     has("task") and $str[] = "<option value=\"create_" . $TPL["url_alloc_task"] . "tasktype=Message\">New Message</option>";
     if (has("project") && have_entity_perm("project", PERM_CREATE, $current_user)) {
         $str[] = "<option value=\"create_" . $TPL["url_alloc_project"] . "\">New Project</option>";
     }
     has("client") and $str[] = "<option value=\"create_" . $TPL["url_alloc_client"] . "\">New Client</option>";
     has("finance") and $str[] = "<option value=\"create_" . $TPL["url_alloc_expenseForm"] . "\">New Expense Form</option>";
     has("reminder") and $str[] = "<option value=\"create_" . $TPL["url_alloc_reminder"] . "parentType=general&step=2\">New Reminder</option>";
     if (has("person") && have_entity_perm("person", PERM_CREATE, $current_user)) {
         $str[] = "<option value=\"create_" . $TPL["url_alloc_person"] . "\">New Person</option>";
     }
     has("item") and $str[] = "<option value=\"create_" . $TPL["url_alloc_loanAndReturn"] . "\">New Item Loan</option>";
     $str[] = "<option value=\"\" disabled=\"disabled\">--------------------";
     $history = new history();
     $q = $history->get_history_query("DESC");
     $db = new db_alloc();
     $db->query($q);
     while ($row = $db->row()) {
         $r["history_" . $row["value"]] = $row["the_label"];
     }
     $str[] = page::select_options($r, $_POST["search_action"]);
     $TPL["history_options"] = implode("\n", $str);
     $TPL["category_options"] = page::get_category_options($_POST["search_action"]);
     $TPL["needle"] = $_POST["needle"];
     include_template(ALLOC_MOD_DIR . "shared/templates/toolbarS.tpl");
 }