本文整理汇总了PHP中numeric函数的典型用法代码示例。如果您正苦于以下问题:PHP numeric函数的具体用法?PHP numeric怎么用?PHP numeric使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了numeric函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _get_cats_tree
function _get_cats_tree()
{
global $LANG, $CAT_ARTICLES;
Cache::load('articles');
if (!(isset($CAT_ARTICLES) && is_array($CAT_ARTICLES))) {
$CAT_ARTICLES = array();
}
$ordered_cats = array();
foreach ($CAT_ARTICLES as $id => $cat) {
$cat['id'] = $id;
$ordered_cats[numeric($cat['id_left'])] = array('this' => $cat, 'children' => array());
}
$level = 0;
$cats_tree = array(array('this' => array('id' => 0, 'name' => $LANG['root']), 'children' => array()));
$parent =& $cats_tree[0]['children'];
$nb_cats = count($CAT_ARTICLES);
foreach ($ordered_cats as $cat) {
if ($cat['this']['level'] == $level + 1 && count($parent) > 0) {
$parent =& $parent[count($parent) - 1]['children'];
} elseif ($cat['this']['level'] < $level) {
$j = 0;
$parent =& $cats_tree[0]['children'];
while ($j < $cat['this']['level']) {
$parent =& $parent[count($parent) - 1]['children'];
$j++;
}
}
$parent[] = $cat;
$level = $cat['this']['level'];
}
return $cats_tree[0];
}
示例2: display_form
function display_form($template = false)
{
global $CONFIG, $Sql, $LANG, $Session;
$note = !empty($_POST['note']) ? numeric($_POST['note']) : 0;
$path_redirect = $this->path . sprintf(str_replace('&', '&', $this->script_path), 0);
if ($this->_note_loaded()) {
if (!is_object($template) || strtolower(get_class($template)) != 'template') {
$template = new template('framework/note.tpl');
}
###########################Insertion##############################
if (!empty($_POST['valid_note'])) {
if (!empty($note)) {
$this->add($note);
}
redirect($path_redirect);
} else {
###########################Affichage##############################
$row_note = $Sql->query_array(PREFIX . $this->sql_table, 'users_note', 'nbrnote', 'note', "WHERE id = '" . $this->idprov . "'", __LINE__, __FILE__);
$select = '<option value="-1" selected="selected">' . $LANG['note'] . '</option>';
for ($i = 0; $i <= $this->notation_scale; $i++) {
$select .= '<option value="' . $i . '">' . $i . '</option>';
}
### Notation Ajax ###
$row_note['note'] = round($row_note['note'] / 0.25) * 0.25;
$l_note = ($this->options & NOTE_DISPLAY_NOTE) !== 0 ? '<strong>' . $LANG['note'] . ':</strong> ' : '';
$display = ($this->options & NOTE_DISPLAY_BLOCK) !== 0 ? 'block' : 'inline';
$width = ($this->options & NOTE_DISPLAY_BLOCK) !== 0 ? 'width:' . $this->notation_scale * 16 . 'px;margin:auto;' : '';
$ajax_note = '<div style="' . $width . 'display:none" id="note_stars' . $this->idprov . '" onmouseout="out_div(' . $this->idprov . ', array_note[' . $this->idprov . '])" onmouseover="over_div()">';
for ($i = 1; $i <= $this->notation_scale; $i++) {
$star_img = 'stars.png';
if ($row_note['note'] < $i) {
$decimal = $i - $row_note['note'];
if ($decimal >= 1) {
$star_img = 'stars0.png';
} elseif ($decimal >= 0.75) {
$star_img = 'stars1.png';
} elseif ($decimal >= 0.5) {
$star_img = 'stars2.png';
} else {
$star_img = 'stars3.png';
}
}
$ajax_note .= '<a href="javascript:send_note(' . $this->idprov . ', ' . $i . ', \'' . $Session->get_token() . '\')" onmouseover="select_stars(' . $this->idprov . ', ' . $i . ');"><img src="../templates/' . get_utheme() . '/images/' . $star_img . '" alt="" class="valign_middle" id="n' . $this->idprov . '_stars' . $i . '" /></a>';
}
if (($this->options & NOTE_NODISPLAY_NBRNOTES) !== 0) {
$ajax_note .= '</div> <span id="noteloading' . $this->idprov . '"></span>';
} else {
$ajax_note .= '</div> <span id="noteloading' . $this->idprov . '"></span> <div style="display:' . $display . '" id="nbrnote' . $this->idprov . '">(' . $row_note['nbrnote'] . ' ' . ($row_note['nbrnote'] > 1 ? strtolower($LANG['notes']) : strtolower($LANG['note'])) . ')</div>';
}
$template->assign_vars(array('C_JS_NOTE' => !defined('HANDLE_NOTE'), 'ID' => $this->idprov, 'NOTE_MAX' => $this->notation_scale, 'SELECT' => $select, 'NOTE' => $l_note . '<span id="note_value' . $this->idprov . '">' . ($row_note['nbrnote'] > 0 ? '<strong>' . $row_note['note'] . '</strong>' : '<em>' . $LANG['no_note'] . '</em>') . '</span>' . $ajax_note, 'ARRAY_NOTE' => 'array_note[' . $this->idprov . '] = \'' . $row_note['note'] . '\';', 'DISPLAY' => $display, 'L_AUTH_ERROR' => addslashes($LANG['e_auth']), 'L_ALERT_ALREADY_VOTE' => addslashes($LANG['already_vote']), 'L_ALREADY_VOTE' => '', 'L_NOTE' => addslashes($LANG['note']), 'L_NOTES' => addslashes($LANG['notes']), 'L_VALID_NOTE' => $LANG['valid_note']));
}
if (!defined('HANDLE_NOTE')) {
define('HANDLE_NOTE', true);
}
return $template->parse(TEMPLATE_STRING_MODE);
} else {
global $Errorh;
$Errorh->handler('e_unexist_page', E_USER_REDIRECT);
}
}
示例3: _get_var_page
function _get_var_page($var_page)
{
$_GET[$var_page] = isset($_GET[$var_page]) ? numeric($_GET[$var_page]) : 0;
if (!empty($_GET[$var_page])) {
return $_GET[$var_page];
} else {
return 1;
}
}
示例4: add
function add($id_parent, $name, $visible = CAT_VISIBLE, $order = 0)
{
global $Sql, $Cache;
$this->_clear_error();
if (!is_int($visible)) {
$visible = (int) $visible;
}
$max_order = $Sql->query("SELECT MAX(c_order) FROM " . PREFIX . $this->table . " WHERE id_parent = '" . $id_parent . "'", __LINE__, __FILE__);
$max_order = numeric($max_order);
if ($id_parent == 0 || array_key_exists($id_parent, $this->cache_var)) {
if ($order <= 0 || $order > $max_order) {
$Sql->query_inject("INSERT INTO " . PREFIX . $this->table . " (name, c_order, id_parent, visible) VALUES ('" . $name . "', '" . ($max_order + 1) . "', '" . $id_parent . "', '" . $visible . "')", __LINE__, __FILE__);
} else {
$Sql->query_inject("UPDATE " . PREFIX . $this->table . " SET c_order = c_order + 1 WHERE id_parent = '" . $id_parent . "' AND c_order >= '" . $order . "'", __LINE__, __FILE__);
$Sql->query_inject("INSERT INTO " . PREFIX . $this->table . " (name, c_order, id_parent, visible) VALUES ('" . $name . "', '" . $order . "', '" . $id_parent . "', '" . $visible . "')", __LINE__, __FILE__);
}
return $Sql->insert_id("SELECT MAX(id) FROM " . PREFIX . $this->table);
} else {
$this->_add_error(NEW_PARENT_CATEGORY_DOES_NOT_EXIST);
return 0;
}
}
示例5: define
<?php
require_once '../kernel/begin.php';
define('TITLE', $LANG['title_error']);
require_once '../kernel/header.php';
$id_error = retrieve(GET, 'e', '');
$array_error = array('e_member_ban', 'e_member_ban_w', 'e_unexist_member', 'e_unactiv_member', 'e_member_flood', 'e_forget_confirm_change');
if (in_array($id_error, $array_error)) {
if ($User->get_attribute('user_id') === -1) {
$Template->set_filenames(array('error' => 'member/error.tpl'));
$errno = E_USER_WARNING;
switch ($id_error) {
case 'e_member_ban':
$ban = !empty($_GET['ban']) ? numeric($_GET['ban']) : '';
if ($ban > 0) {
if ($ban < 60) {
$delay_ban = $ban . ' ' . ($ban > 1 ? $LANG['minutes'] : $LANG['minute']);
} elseif ($ban < 1440) {
$delay_ban = number_round($ban / 60, 0);
$delay_ban = $delay_ban . ' ' . ($delay_ban > 1 ? $LANG['hours'] : $LANG['hour']);
} elseif ($ban < 10080) {
$delay_ban = number_round($ban / 1440, 0);
$delay_ban = $delay_ban . ' ' . ($delay_ban > 1 ? $LANG['days'] : $LANG['day']);
} elseif ($ban < 43200) {
$delay_ban = number_round($ban / 10080, 0);
$delay_ban = $delay_ban . ' ' . ($delay_ban > 1 ? $LANG['weeks'] : $LANG['week']);
} elseif ($ban < 525600) {
$delay_ban = number_round($ban / 43200, 0);
$delay_ban = $delay_ban . ' ' . ($delay_ban > 1 ? $LANG['months'] : $LANG['month']);
} else {
$delay_ban = number_round($ban / 525600, 0);
示例6: ConfirmBuyingStockForDividend_CutMoney_ForTraiPhieu
/**
* (Function nay chi khac ConfirmBuyingStockForDividend_CutMoney o cho tham so $Note - Tao ngay 20100712, request ngay 20100709)
* Function ConfirmBuyingStockForDividend_CutMoney_ForTraiPhieu : Ke toan cat tien -- day dl qua Bravo -- cap nhat bankid khi cat tien thanh cong
* Input : $EventID, $AccountID, $Today, $UpdatedBy, $Note
* OutPut : error code. Return 0 if success else return error code (number >0).
*/
function ConfirmBuyingStockForDividend_CutMoney_ForTraiPhieu($EventID, $AccountID, $UpdatedBy, $Today, $BankID, $Note)
{
try {
$class_name = $this->class_name;
$function_name = 'ConfirmBuyingStockForDividend_CutMoney_ForTraiPhieu';
if (authenUser(func_get_args(), $this, $function_name) > 0) {
return returnXML(func_get_args(), $this->class_name, $function_name, $this->_ERROR_CODE, $this->items, $this);
}
if (!required($EventID) || !numeric($EventID)) {
$this->_ERROR_CODE = 22042;
}
if ($this->_ERROR_CODE == 0 && (!required($AccountID) || !numeric($AccountID))) {
$this->_ERROR_CODE = 22005;
}
if ($this->_ERROR_CODE == 0 && (!required($Today) || !valid_date($Today))) {
$this->_ERROR_CODE = 22056;
}
if ($this->_ERROR_CODE == 0) {
$Withdrawal = $this->CheckConfirmBuyingStock_CutMoney($EventID, $AccountID, $Today);
if ($Withdrawal['ErrorCode'] == '0') {
// money in bank
$query = sprintf("SELECT BankID, BankAccount, BravoCode FROM vw_ListAccountBank_Detail WHERE AccountID='%s' AND BankID ='%s' ", $AccountID, $BankID);
$this->_MDB2->disconnect();
$this->_MDB2->connect();
$bank_rs = $this->_MDB2->extended->getAll($query);
$dab_rs = 999;
$BankID = 0;
$TransactionType = BRAVO_BUYING_STOCK;
// phat hanh them cp
if ($Withdrawal['AccountNo'] != PAGODA_ACCOUNT) {
if (count($bank_rs) > 0) {
$i = 0;
$BankID = $bank_rs[$i]['bankid'];
$BravoCode = $bank_rs[$i]['bravocode'];
switch ($BankID) {
case DAB_ID:
$dab =& new CDAB();
$dab_rs = $dab->transfertoEPS($bank_rs[$i]['bankaccount'], $Withdrawal['AccountNo'], '3_' . $EventID . '_' . $AccountID, $Withdrawal['Amount'], $Note);
write_my_log_path('transfertoEPS', $function_name . ' BankAccount ' . $bank_rs[$i]['bankaccount'] . ' AccountNo ' . $Withdrawal['AccountNo'] . ' Event_AccountID ' . '3_' . $EventID . ' ' . $AccountID . ' Amount ' . $Withdrawal['Amount'] . ' Description ' . $Note . ' Error ' . $dab_rs, EVENT_PATH);
break;
case OFFLINE:
$mdb2 = initWriteDB();
//`sp_VirtualBank_insertBuyingStockDivident`(inAccountID bigint, inBankID int, inAmount double,inTransactionDate date, inNote text(1000), inCreatedBy varchar(100))
$query = sprintf("CALL sp_VirtualBank_insertBuyingStockDivident(%u, %u, %f, '%s', '%s', '%s' )", $AccountID, $BankID, $Withdrawal['Amount'], $Today, $Note, $UpdatedBy);
$rs = $mdb2->extended->getRow($query);
$mdb2->disconnect();
$dab_rs = $rs["varerror"];
break;
default:
$dab_rs = 0;
}
} else {
$dab_rs = 9999;
$this->_ERROR_CODE = 22155;
//TK k co TK Ngan hang nay
}
} else {
$TransactionType = BRAVO_BUYING_STOCK;
// phat hanh them cp
$dab_rs = 0;
$BankID = EXI_ID;
}
if ($dab_rs == 0) {
if ($BankID == OFFLINE) {
$query = "SELECT mobilephone,ab.usableamount FROM " . TBL_INVESTOR;
$query .= " i INNER JOIN " . TBL_ACCOUNT . " a ON(i.id=a.investorId)";
$query .= " INNER JOIN " . TBL_ACCOUNT_BANK . " ab ON(a.id=ab.accountid)";
$query .= " WHERE a.accountNo='" . $Withdrawal['AccountNo'] . "' AND ab.bankid=" . OFFLINE;
$mdb = initWriteDB();
$acc_rs = $mdb->extended->getRow($query);
$mdb->disconnect();
if (!empty($acc_rs['mobilephone'])) {
$message = 'Tai khoan cua quy khach tai KIS da thay doi: -' . number_format($Withdrawal['Amount'], 0, '.', ',') . '. ' . $Note;
$message .= '. So du hien tai la: ' . number_format($acc_rs['usableamount'], 0, '.', ',');
sendSMS(array('Phone' => $acc_rs['mobilephone'], 'Content' => $message), 'ConfirmBuyingStockForDividend_CutMoney_ForTraiPhieu');
}
}
$soap =& new Bravo();
$Withdrawal_value = array("TradingDate" => $Today, 'TransactionType' => $TransactionType, "AccountNo" => $Withdrawal['AccountNo'], "Amount" => $Withdrawal['Amount'], "Bank" => $BravoCode, "Branch" => "", "Note" => $Note);
//'011C001458'
//var_dump($withdraw_value);
$ret = $soap->withdraw($Withdrawal_value);
if ($ret['table0']['Result'] == 1) {
$query = sprintf("CALL sp_UpdateDividendPrivilege_BankID ('%s','%s','%s','%s')", $BankID, $EventID, $AccountID, $UpdatedBy);
//echo $query;
$result = $this->_MDB2_WRITE->extended->getAll($query);
//Can not update
if (empty($result) || is_object($result)) {
$this->_ERROR_CODE = 22120;
write_my_log_path('ErrorCallStore', $query . ' ' . $result->backtrace[0]['args'][4], EVENT_PATH);
} else {
if (isset($result[0]['varerror'])) {
//p_iDividentPrivilege sai hoac dang ky mua chua xac nhan hoac da cat tien roi
if ($result[0]['varerror'] == -2) {
//.........这里部分代码省略.........
示例7: elseif
if (!empty($id_folder) && !empty($name)) {
if ($User->get_attribute('user_id') != $user_id) {
if ($User->check_level(ADMIN_LEVEL)) {
echo $Uploads->Rename_folder($id_folder, $name, $previous_name, $user_id, ADMIN_NO_CHECK);
} else {
echo $Uploads->Rename_folder($id_folder, $name, $previous_name, $User->get_attribute('user_id'), ADMIN_NO_CHECK);
}
} else {
echo $Uploads->Rename_folder($id_folder, $name, $previous_name, $User->get_attribute('user_id'));
}
} else {
echo 0;
}
} elseif (!empty($_GET['rename_file'])) {
$id_file = !empty($_POST['id_file']) ? numeric($_POST['id_file']) : '0';
$user_id = !empty($_POST['user_id']) ? numeric($_POST['user_id']) : $User->get_attribute('user_id');
$name = !empty($_POST['name']) ? strprotect(utf8_decode($_POST['name'])) : '';
$previous_name = !empty($_POST['previous_name']) ? strprotect(utf8_decode($_POST['previous_name'])) : '';
if (!empty($id_file) && !empty($name)) {
if ($User->get_attribute('user_id') != $user_id) {
if ($User->check_level(ADMIN_LEVEL)) {
echo $Uploads->Rename_file($id_file, $name, $previous_name, $user_id, ADMIN_NO_CHECK);
} else {
echo $Uploads->Rename_file($id_file, $name, $previous_name, $User->get_attribute('user_id'), ADMIN_NO_CHECK);
}
} else {
echo $Uploads->Rename_file($id_file, $name, $previous_name, $User->get_attribute('user_id'));
}
} else {
echo 0;
}
示例8: deleteCommentAction
/**
* @Created By : Mahipal Singh Adhikari
* @Created On : 2-Nov-2010
* @Description: Delete comment and comment votes by blog owner
*/
public function deleteCommentAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$userNs = new Zend_Session_Namespace('members');
$this->view->userId = $userNs->userId;
if (is_null($userNs->userId) && !numeric($userNs->userId)) {
$response = "<span style='color:#ff0000;'>Please login to delete this comment.</span>";
$JsonResultArray = array('error' => 1, 'response' => $response);
echo Zend_Json::encode($JsonResultArray);
exit;
}
//delete comment: update comment publish status to '0' to delete the comment
$commentM = new Application_Model_Comment();
$commentM = $commentM->find($this->_getParam('comment_id'));
$commentM->setPublish(0);
$resp = $commentM->save();
//set response message
if ($resp) {
//get total number of comments
$total_comments = $commentM->numComments('blog', $this->_getParam('item_id'));
$total_comments = $total_comments . " Comments";
$response = "<span style='color:#ff0000;'>Comment has been deleted.</span>";
$JsonResultArray = array('error' => 0, 'total_comments' => $total_comments, 'response' => $response);
} else {
$response = "<span style='color:#ff0000;'>Error occured, Please try again later.</span>";
$JsonResultArray = array('error' => 1, 'response' => $response);
}
echo Zend_Json::encode($JsonResultArray);
exit;
}
示例9: get_search_request
function get_search_request($args)
{
global $CONFIG, $CAT_FORUM, $User, $Cache, $Sql;
$weight = isset($args['weight']) && is_numeric($args['weight']) ? $args['weight'] : 1;
$Cache->load('forum');
$search = $args['search'];
$idcat = !empty($args['ForumIdcat']) ? numeric($args['ForumIdcat']) : -1;
$time = !empty($args['ForumTime']) ? numeric($args['ForumTime']) : 0;
$where = !empty($args['ForumWhere']) ? strprotect($args['ForumWhere']) : 'title';
$colorate_result = !empty($args['ForumColorate_result']) ? true : false;
require_once PATH_TO_ROOT . '/forum/forum_defines.php';
$auth_cats = '';
if (is_array($CAT_FORUM)) {
foreach ($CAT_FORUM as $id => $key) {
if (!$User->check_auth($CAT_FORUM[$id]['auth'], READ_CAT_FORUM)) {
$auth_cats .= $id . ',';
}
}
}
$auth_cats = !empty($auth_cats) ? " AND c.id NOT IN (" . trim($auth_cats, ',') . ")" : '';
if ($where == 'all') {
return "SELECT " . $args['id_search'] . " AS `id_search`,\n MIN(msg.id) AS `id_content`,\n t.title AS `title`,\n MAX(( 2 * MATCH(t.title) AGAINST('" . $search . "') + MATCH(msg.contents) AGAINST('" . $search . "') ) / 3) * " . $weight . " AS `relevance`,\n " . $Sql->concat("'" . PATH_TO_ROOT . "'", "'/forum/topic.php?id='", 't.id', "'#m'", 'msg.id') . " AS `link`\n FROM " . PREFIX . "forum_msg msg\n JOIN " . PREFIX . "forum_topics t ON t.id = msg.idtopic\n JOIN " . PREFIX . "forum_cats c ON c.level != 0 AND c.aprob = 1 AND c.id = t.idcat\n WHERE ( MATCH(t.title) AGAINST('" . $search . "') OR MATCH(msg.contents) AGAINST('" . $search . "') )\n " . ($idcat != -1 ? " AND c.id_left BETWEEN '" . $CAT_FORUM[$idcat]['id_left'] . "' AND '" . $CAT_FORUM[$idcat]['id_right'] . "'" : '') . " " . $auth_cats . "\n GROUP BY t.id\n ORDER BY relevance DESC" . $Sql->limit(0, FORUM_MAX_SEARCH_RESULTS);
}
if ($where == 'contents') {
return "SELECT " . $args['id_search'] . " AS `id_search`,\n MIN(msg.id) AS `id_content`,\n t.title AS `title`,\n MAX(MATCH(msg.contents) AGAINST('" . $search . "')) * " . $weight . " AS `relevance`,\n " . $Sql->concat("'" . PATH_TO_ROOT . "'", "'/forum/topic.php?id='", 't.id', "'#m'", 'msg.id') . " AS `link`\n FROM " . PREFIX . "forum_msg msg\n JOIN " . PREFIX . "forum_topics t ON t.id = msg.idtopic\n JOIN " . PREFIX . "forum_cats c ON c.level != 0 AND c.aprob = 1 AND c.id = t.idcat\n WHERE MATCH(msg.contents) AGAINST('" . $search . "')\n " . ($idcat != -1 ? " AND c.id_left BETWEEN '" . $CAT_FORUM[$idcat]['id_left'] . "' AND '" . $CAT_FORUM[$idcat]['id_right'] . "'" : '') . " " . $auth_cats . "\n GROUP BY t.id\n ORDER BY relevance DESC" . $Sql->limit(0, FORUM_MAX_SEARCH_RESULTS);
} else {
return "SELECT " . $args['id_search'] . " AS `id_search`,\n msg.id AS `id_content`,\n t.title AS `title`,\n MATCH(t.title) AGAINST('" . $search . "') * " . $weight . " AS `relevance`,\n " . $Sql->concat("'" . PATH_TO_ROOT . "'", "'/forum/topic.php?id='", 't.id', "'#m'", 'msg.id') . " AS `link`\n FROM " . PREFIX . "forum_msg msg\n JOIN " . PREFIX . "forum_topics t ON t.id = msg.idtopic\n JOIN " . PREFIX . "forum_cats c ON c.level != 0 AND c.aprob = 1 AND c.id = t.idcat\n WHERE MATCH(t.title) AGAINST('" . $search . "')\n " . ($idcat != -1 ? " AND c.id_left BETWEEN '" . $CAT_FORUM[$idcat]['id_left'] . "' AND '" . $CAT_FORUM[$idcat]['id_right'] . "'" : '') . " " . $auth_cats . "\n GROUP BY t.id\n ORDER BY relevance DESC" . $Sql->limit(0, FORUM_MAX_SEARCH_RESULTS);
}
}
示例10: while
$result = $Sql->query_while("SELECT pages, stats_day\n\tFROM " . DB_TABLE_STATS . " WHERE stats_year = '" . $year . "' AND stats_month = '" . $month . "' \n\tORDER BY stats_day", __LINE__, __FILE__);
while ($row = $Sql->fetch_assoc($result)) {
$array_stats[$row['stats_day']] = $row['pages'];
}
$Sql->query_close($result);
$bissextile = date("L", mktime(0, 0, 0, 1, 1, $year)) == 1 ? 29 : 28;
$array_month = array(31, $bissextile, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
for ($i = 1; $i <= $array_month[$month - 1]; $i++) {
if (!isset($array_stats[$i])) {
$array_stats[$i] = 0;
}
}
$Stats->load_data($array_stats, 'histogram', 5);
$Stats->draw_histogram(440, 250, '', array($LANG['days'], $LANG['page_s']), NO_DRAW_LEGEND, NO_DRAW_VALUES, 8);
} elseif ($get_pages_year) {
$year = !empty($_GET['year']) ? numeric($_GET['year']) : '';
$array_stats = array();
$result = $Sql->query_while("SELECT SUM(pages) as total, stats_month\n\tFROM " . DB_TABLE_STATS . " WHERE stats_year = '" . $year . "'\n\tGROUP BY stats_month\n\tORDER BY stats_month", __LINE__, __FILE__);
while ($row = $Sql->fetch_assoc($result)) {
$array_stats[$row['stats_month']] = $row['total'];
}
$Sql->query_close($result);
for ($i = 1; $i <= 12; $i++) {
if (!isset($array_stats[$i])) {
$array_stats[$i] = 0;
}
}
$Stats->load_data($array_stats, 'histogram', 5);
$Stats->draw_histogram(440, 250, '', array($LANG['month'], $LANG['page_s']), NO_DRAW_LEGEND, DRAW_VALUES, 8);
} elseif ($get_brw) {
$file = @fopen(PATH_TO_ROOT . '/cache/browsers.txt', 'r');
示例11: load_module_lang
<?php
require_once '../admin/admin_begin.php';
load_module_lang('shoutbox');
define('TITLE', $LANG['administration']);
require_once '../admin/admin_header.php';
if (!empty($_POST['valid'])) {
$config_shoutbox = array();
$config_shoutbox['shoutbox_max_msg'] = retrieve(POST, 'shoutbox_max_msg', 10);
$config_shoutbox['shoutbox_auth'] = retrieve(POST, 'shoutbox_auth', -1);
$config_shoutbox['shoutbox_forbidden_tags'] = isset($_POST['shoutbox_forbidden_tags']) ? serialize($_POST['shoutbox_forbidden_tags']) : serialize(array());
$config_shoutbox['shoutbox_max_link'] = retrieve(POST, 'shoutbox_max_link', -1);
$config_shoutbox['shoutbox_refresh_delay'] = numeric(retrieve(POST, 'shoutbox_refresh_delay', 0) * 60000, 'float');
$Sql->query_inject("UPDATE " . DB_TABLE_CONFIGS . " SET value = '" . addslashes(serialize($config_shoutbox)) . "' WHERE name = 'shoutbox'", __LINE__, __FILE__);
###### Régénération du cache des news #######
$Cache->Generate_module_file('shoutbox');
redirect(HOST . SCRIPT);
} else {
$Template->set_filenames(array('admin_shoutbox_config' => 'shoutbox/admin_shoutbox_config.tpl'));
$Cache->load('shoutbox');
$array_tags = array('b' => 0, 'i' => 0, 'u' => 0, 's' => 0, 'title' => 1, 'stitle' => 1, 'style' => 1, 'url' => 0, 'img' => 1, 'quote' => 1, 'hide' => 1, 'list' => 1, 'color' => 0, 'bgcolor' => 0, 'font' => 0, 'size' => 0, 'align' => 1, 'float' => 1, 'sup' => 0, 'sub' => 0, 'indent' => 1, 'pre' => 0, 'table' => 1, 'swf' => 1, 'movie' => 1, 'sound' => 1, 'code' => 1, 'math' => 1, 'anchor' => 0, 'acronym' => 0);
$CONFIG_SHOUTBOX['shoutbox_auth'] = isset($CONFIG_SHOUTBOX['shoutbox_auth']) ? $CONFIG_SHOUTBOX['shoutbox_auth'] : '-1';
$array_auth_ranks = array(-1 => $LANG['guest'], 0 => $LANG['member'], 1 => $LANG['modo'], 2 => $LANG['admin']);
$ranks = '';
foreach ($array_auth_ranks as $rank => $name) {
$selected = $CONFIG_SHOUTBOX['shoutbox_auth'] == $rank ? ' selected="selected"' : '';
$ranks .= '<option value="' . $rank . '"' . $selected . '>' . $name . '</option>';
}
$Template->assign_vars(array('NBR_TAGS' => count($array_tags), 'SHOUTBOX_MAX_MSG' => !empty($CONFIG_SHOUTBOX['shoutbox_max_msg']) ? $CONFIG_SHOUTBOX['shoutbox_max_msg'] : '100', 'SHOUTBOX_AUTH' => $ranks, 'MAX_LINK' => isset($CONFIG_SHOUTBOX['shoutbox_max_link']) ? $CONFIG_SHOUTBOX['shoutbox_max_link'] : '-1', 'SHOUTBOX_REFRESH_DELAY' => isset($CONFIG_SHOUTBOX['shoutbox_refresh_delay']) ? $CONFIG_SHOUTBOX['shoutbox_refresh_delay'] / 60000 : 1, 'L_REQUIRE' => $LANG['require'], 'L_SHOUTBOX' => $LANG['title_shoutbox'], 'L_SHOUTBOX_CONFIG' => $LANG['shoutbox_config'], 'L_SHOUTBOX_MAX_MSG' => $LANG['shoutbox_max_msg'], 'L_SHOUTBOX_MAX_MSG_EXPLAIN' => $LANG['shoutbox_max_msg_explain'], 'L_RANK' => $LANG['rank_post'], 'L_SHOUTBOX_REFRESH_DELAY' => $LANG['shoutbox_refresh_delay'], 'L_SHOUTBOX_REFRESH_DELAY_EXPLAIN' => $LANG['shoutbox_refresh_delay_explain'], 'L_MINUTES' => $LANG['minutes'], 'L_UPDATE' => $LANG['update'], 'L_RESET' => $LANG['reset'], 'L_FORBIDDEN_TAGS' => $LANG['forbidden_tags'], 'L_EXPLAIN_SELECT_MULTIPLE' => $LANG['explain_select_multiple'], 'L_SELECT_ALL' => $LANG['select_all'], 'L_SELECT_NONE' => $LANG['select_none'], 'L_MAX_LINK' => $LANG['max_link'], 'L_MAX_LINK_EXPLAIN' => $LANG['max_link_explain']));
$i = 0;
foreach (ContentFormattingFactory::get_available_tags() as $name => $value) {
示例12: define
<?php
require_once '../admin/admin_begin.php';
define('TITLE', $LANG['administration']);
require_once '../admin/admin_header.php';
if (!empty($_POST['msg_mbr'])) {
$config_member['activ_register'] = retrieve(POST, 'activ_register', 0);
$config_member['msg_mbr'] = stripslashes(strparse(retrieve(POST, 'contents', '', TSTRING_AS_RECEIVED)));
$config_member['msg_register'] = $CONFIG_USER['msg_register'];
$config_member['activ_mbr'] = retrieve(POST, 'activ_mbr', 0);
$config_member['verif_code'] = isset($_POST['verif_code']) && @extension_loaded('gd') ? numeric($_POST['verif_code']) : 0;
$config_member['verif_code_difficulty'] = retrieve(POST, 'verif_code_difficulty', 2);
$config_member['delay_unactiv_max'] = retrieve(POST, 'delay_unactiv_max', 0);
$config_member['force_theme'] = retrieve(POST, 'force_theme', 0);
$config_member['activ_up_avatar'] = retrieve(POST, 'activ_up_avatar', 0);
$config_member['width_max'] = retrieve(POST, 'width_max', 120);
$config_member['height_max'] = retrieve(POST, 'height_max', 120);
$config_member['weight_max'] = retrieve(POST, 'weight_max', 20);
$config_member['activ_avatar'] = retrieve(POST, 'activ_avatar', 0);
$config_member['avatar_url'] = retrieve(POST, 'avatar_url', '');
$Sql->query_inject("UPDATE " . DB_TABLE_CONFIGS . " SET value = '" . addslashes(serialize($config_member)) . "' WHERE name = 'member'", __LINE__, __FILE__);
###### Régénération du cache $CONFIG_USER #######
$Cache->Generate_file('member');
redirect(HOST . SCRIPT);
} else {
$Template->set_filenames(array('admin_members_config' => 'admin/admin_members_config.tpl'));
#####################Activation du mail par le membre pour s'inscrire##################
$array = array(0 => $LANG['no_activ_mbr'], 1 => $LANG['mail'], 2 => $LANG['admin']);
$activ_mode_option = '';
foreach ($array as $key => $value) {
$selected = $CONFIG_USER['activ_mbr'] == $key ? 'selected="selected"' : '';
示例13: proccess_calculating
public function proccess_calculating($suggest_price = NULL)
{
// don't calculate, just show the form
if ($this->input->post('init')) {
$eshop_code = $this->input->post('eshop_code');
if ($eshop_code) {
$currency_code = $this->fee_price_model->fetch_eshop_currency_code($eshop_code);
} else {
$currency_code = 'USD';
}
$data = array('suggest_price' => 0, 'buyer_shipping_cost' => 0, 'list_fee' => 0, 'trade_fee' => 0, 'pay_fee' => 0, 'shipping_cost' => 0, 'shipping_type_name' => 0, 'other_cost' => 0, 'total_cost' => 0, 'total_profit' => 0, 'total_profit_rate' => 0, 'currency_code' => $currency_code, 'default_currency_code' => DEFAULT_CURRENCY_CODE);
return $this->load->view('sale/price/calculate_price_result', $data);
}
$product_count = $this->input->post('product_count');
$total_price = 0;
$total_weight = 0;
$total_profit = 0;
$max_length = 0;
$max_width = 0;
$total_height = 0;
for ($i = 0; $i < $product_count; $i++) {
$sku = trim($this->input->post('sku_' . $i));
$product = $this->product_model->fetch_product_by_sku($sku);
if (!$product) {
echo $this->create_json(0, sprintf(lang('product_sku_doesnot_exists_with_sku'), $sku));
return;
}
$qty = trim($this->input->post('qty_' . $i));
if (!is_numeric($qty) || $qty <= 0) {
echo $this->create_json(0, lang('qty_not_natural'));
return;
}
$weight = trim($this->input->post('weight_' . $i));
if (!numeric($weight) || $weight <= 0) {
echo $this->create_json(0, lang('weight_format_error'));
return;
}
$price = trim($this->input->post('price_' . $i));
if (!numeric($price) || $price <= 0) {
echo $this->create_json(0, lang('price_format_error'));
return;
}
$profit = trim($this->input->post('profit_' . $i));
if (!numeric($profit) || $profit <= 0 || $profit >= 1) {
echo $this->create_json(0, lang('profit_format_error'));
return;
}
$length = trim($this->input->post('length_' . $i));
if ($length > $max_length) {
$max_length = $length;
}
$width = trim($this->input->post('width_' . $i));
if ($width > $max_width) {
$max_width = $width;
}
$height = trim($this->input->post('height_' . $i));
$total_height += $height;
$total_price += $price * $qty;
$total_weight += $weight * $qty;
$total_profit += $profit;
}
$balance_profit = $total_profit / $product_count;
$pay_option = $this->input->post('pay_option');
$pay_discount = $this->input->post('pay_discount');
$eshop_code = $this->input->post('eshop_code');
$sale_mode = $this->input->post('sale_mode');
$eshop_list_count = $this->input->post('eshop_list_count');
$shipping_type = $this->input->post('shipping_type');
$shipping_country = $this->input->post('shipping_country');
if (empty($shipping_country)) {
$shipping_country = DEFAULT_SHIPPING_COUNTRY;
}
$buyer_shipping_cost = $this->input->post('buyer_shipping_cost');
$other_cost = $this->input->post('other_cost');
$eshop_category = $this->input->post('eshop_category');
if (!is_numeric($eshop_list_count) || $eshop_list_count <= 0) {
echo $this->create_json(0, lang('eshop_list_count_format_error'));
return;
}
if (!numeric($buyer_shipping_cost) || $buyer_shipping_cost < 0) {
echo $this->create_json(0, lang('buyer_shipping_cost_format_error'));
return;
}
if (!numeric($other_cost)) {
echo $this->create_json(0, lang('other_cost_format_error'));
return;
}
$eshop_list_fee_multiply = 1;
if ($sale_mode == 'auction') {
$bid_rate = $this->input->post('bid_rate');
$eshop_list_fee_multiply = 1 + (100 - $bid_rate) / $bid_rate;
}
$input = array('eshop_code' => $eshop_code, 'buyer_shipping_cost' => $buyer_shipping_cost, 'shipping_type' => $shipping_type, 'shipping_country' => $shipping_country, 'total_weight' => $total_weight, 'sale_mode' => $sale_mode, 'eshop_category' => $eshop_category, 'suggest_price' => $suggest_price, 'key' => $key, 'total_price' => $total_price, 'balance_profit' => $balance_profit, 'eshop_list_count' => $eshop_list_count, 'eshop_list_fee_multiply' => $eshop_list_fee_multiply, 'pay_option' => $pay_option, 'pay_discount' => $pay_discount, 'other_cost' => $other_cost, 'max_length' => $max_length, 'max_width' => $max_width, 'total_height' => $total_height);
$data = price_profit_rate($input);
if (!is_array($data)) {
echo $this->create_json(0, $data);
return;
}
$this->load->view('sale/price/calculate_price_result', $data);
}
示例14: retrieve
$config_news['activ_com'] = retrieve(POST, 'activ_com', 0);
$config_news['activ_icon'] = retrieve(POST, 'activ_icon', 0);
$config_news['display_author'] = retrieve(POST, 'display_author', 0);
$config_news['display_date'] = retrieve(POST, 'display_date', 0);
$config_news['nbr_news'] = $Sql->query("SELECT COUNT(*) FROM " . PREFIX . "news WHERE visible = 1", __LINE__, __FILE__);
$config_news['nbr_column'] = retrieve(POST, 'nbr_column', 1);
$config_news['edito'] = stripslashes(retrieve(POST, 'edito', '', TSTRING_PARSE));
$config_news['edito_title'] = stripslashes(retrieve(POST, 'edito_title', ''));
$Sql->query_inject("UPDATE " . DB_TABLE_CONFIGS . " SET value = '" . addslashes(serialize($config_news)) . "' WHERE name = 'news'", __LINE__, __FILE__);
###### Régénération du cache des news #######
$Cache->Generate_module_file('news');
redirect(HOST . SCRIPT);
} else {
$Template->set_filenames(array('admin_news_config' => 'news/admin_news_config.tpl'));
$Cache->load('news');
$CONFIG_NEWS['pagination_news'] = isset($CONFIG_NEWS['pagination_news']) ? $CONFIG_NEWS['pagination_news'] : 6;
$CONFIG_NEWS['pagination_arch'] = isset($CONFIG_NEWS['pagination_arch']) ? $CONFIG_NEWS['pagination_arch'] : 15;
$CONFIG_NEWS['edito_title'] = isset($CONFIG_NEWS['edito_title']) ? $CONFIG_NEWS['edito_title'] : '';
$CONFIG_NEWS['edito'] = isset($CONFIG_NEWS['edito']) ? $CONFIG_NEWS['edito'] : '';
$CONFIG_NEWS['type'] = isset($CONFIG_NEWS['type']) ? $CONFIG_NEWS['type'] : 0;
$CONFIG_NEWS['activ_pagin'] = isset($CONFIG_NEWS['activ_pagin']) ? $CONFIG_NEWS['activ_pagin'] : 0;
$CONFIG_NEWS['nbr_column'] = isset($CONFIG_NEWS['nbr_column']) ? $CONFIG_NEWS['nbr_column'] : 1;
$CONFIG_NEWS['activ_edito'] = isset($CONFIG_NEWS['activ_edito']) ? $CONFIG_NEWS['activ_edito'] : 0;
$CONFIG_NEWS['activ_com'] = isset($CONFIG_NEWS['activ_com']) ? $CONFIG_NEWS['activ_com'] : 1;
$CONFIG_NEWS['activ_icon'] = isset($CONFIG_NEWS['activ_icon']) ? $CONFIG_NEWS['activ_icon'] : 0;
$CONFIG_NEWS['display_author'] = isset($CONFIG_NEWS['display_author']) ? $CONFIG_NEWS['display_author'] : 1;
$CONFIG_NEWS['display_date'] = isset($CONFIG_NEWS['display_date']) ? $CONFIG_NEWS['display_date'] : 1;
$Template->assign_vars(array('KERNEL_EDITOR' => display_editor(), 'PAGINATION' => !empty($CONFIG_NEWS['pagination_news']) ? $CONFIG_NEWS['pagination_news'] : '6', 'PAGINATION_ARCH' => !empty($CONFIG_NEWS['pagination_arch']) ? numeric($CONFIG_NEWS['pagination_arch']) : '15', 'TITLE' => !empty($CONFIG_NEWS['edito_title']) ? $CONFIG_NEWS['edito_title'] : '', 'CONTENTS' => !empty($CONFIG_NEWS['edito']) ? unparse($CONFIG_NEWS['edito']) : '', 'BLOCK_ENABLED' => $CONFIG_NEWS['type'] == '1' ? 'checked="checked"' : '', 'BLOCK_DISABLED' => $CONFIG_NEWS['type'] == '0' ? 'checked="checked"' : '', 'PAGIN_ENABLED' => $CONFIG_NEWS['activ_pagin'] == '1' ? 'checked="checked"' : '', 'PAGIN_DISABLED' => $CONFIG_NEWS['activ_pagin'] == '0' ? 'checked="checked"' : '', 'NBR_COLUMN' => !empty($CONFIG_NEWS['nbr_column']) ? $CONFIG_NEWS['nbr_column'] : '1', 'EDITO_ENABLED' => $CONFIG_NEWS['activ_edito'] == '1' ? 'checked="checked"' : '', 'EDITO_DISABLED' => $CONFIG_NEWS['activ_edito'] == '0' ? 'checked="checked"' : '', 'COM_ENABLED' => $CONFIG_NEWS['activ_com'] == '1' ? 'checked="checked"' : '', 'COM_DISABLED' => $CONFIG_NEWS['activ_com'] == '0' ? 'checked="checked"' : '', 'ICON_ENABLED' => $CONFIG_NEWS['activ_icon'] == '1' ? 'checked="checked"' : '', 'ICON_DISABLED' => $CONFIG_NEWS['activ_icon'] == '0' ? 'checked="checked"' : '', 'AUTHOR_ENABLED' => $CONFIG_NEWS['display_author'] == '1' ? 'checked="checked"' : '', 'AUTHOR_DISABLED' => $CONFIG_NEWS['display_author'] == '0' ? 'checked="checked"' : '', 'DATE_ENABLED' => $CONFIG_NEWS['display_date'] == '1' ? 'checked="checked"' : '', 'DATE_DISABLED' => $CONFIG_NEWS['display_date'] == '0' ? 'checked="checked"' : '', 'L_REQUIRE_TITLE' => $LANG['require_title'], 'L_REQUIRE_TEXT' => $LANG['require_text'], 'L_REQUIRE' => $LANG['require'], 'L_NEWS_MANAGEMENT' => $LANG['news_management'], 'L_ADD_NEWS' => $LANG['add_news'], 'L_CONFIG_NEWS' => $LANG['configuration_news'], 'L_CAT_NEWS' => $LANG['category_news'], 'L_TITLE' => $LANG['title'], 'L_TEXT' => $LANG['content'], 'L_YES' => $LANG['yes'], 'L_NO' => $LANG['no'], 'L_APROB' => $LANG['aprob'], 'L_UNAPROB' => $LANG['unaprob'], 'L_SUBMIT' => $LANG['submit'], 'L_UPDATE' => $LANG['update'], 'L_PREVIEW' => $LANG['preview'], 'L_RESET' => $LANG['reset'], 'L_EDITO_WHERE' => $LANG['edito_where'], 'L_CONFIG_NEWS' => $LANG['config_news'], 'L_NBR_NEWS_P' => $LANG['nbr_news_p'], 'L_NBR_NEWS_P_EXPLAIN' => $LANG['nbr_news_p_explain'], 'L_NBR_COLUMN_MAX' => $LANG['nbr_news_column'], 'L_NBR_ARCH_P' => $LANG['nbr_arch_p'], 'L_NBR_ARCH_P_EXPLAIN' => $LANG['nbr_arch_p_explain'], 'L_MODULE_MANAGEMENT' => $LANG['module_management'], 'L_ACTIV_PAGINATION' => $LANG['activ_pagination'], 'L_ACTIV_PAGINATION_EXPLAIN' => $LANG['activ_pagination_explain'], 'L_ACTIV_EDITO' => $LANG['activ_edito'], 'L_ACTIV_EDITO_EXPLAIN' => $LANG['activ_edito_explain'], 'L_ACTIV_NEWS_BLOCK' => $LANG['activ_news_block'], 'L_ACTIV_COM_NEWS' => $LANG['activ_com_n'], 'L_ACTIV_ICON_NEWS' => $LANG['activ_icon_n'], 'L_DISPLAY_NEWS_AUTHOR' => $LANG['display_news_author'], 'L_DISPLAY_NEWS_DATE' => $LANG['display_news_date']));
$Template->pparse('admin_news_config');
}
require_once '../admin/admin_footer.php';
示例15: forum_history_collector
function forum_history_collector($type, $user_id_action = '', $url_action = '')
{
global $Sql, $User;
$Sql->query_inject("INSERT INTO " . PREFIX . "forum_history (action, user_id, user_id_action, url, timestamp) VALUES('" . strprotect($type) . "', '" . $User->get_attribute('user_id') . "', '" . numeric($user_id_action) . "', '" . strprotect($url_action) . "', '" . time() . "')", __LINE__, __FILE__);
}