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];
 }
Ejemplo n.º 2
0
 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('&amp;', '&', $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>&nbsp;' : '';
             $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);
     }
 }
Ejemplo n.º 3
0
 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;
     }
 }
 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;
     }
 }
Ejemplo n.º 5
0
<?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);
 /**
  * (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) {
                                     $this->_ERROR_CODE = 22121;
                                 } else {
                                     if ($result[0]['varerror'] == -3) {
                                         //qua ngay cat tien
                                         $this->_ERROR_CODE = 22149;
                                     } else {
                                         if ($result[0]['varerror'] == -1) {
                                             //Exception
                                             $this->_ERROR_CODE = 22122;
                                         } else {
                                             if ($result[0]['varerror'] < 0) {
                                                 $this->_ERROR_CODE = 22134;
                                                 write_my_log_path($function_name, $query . '  VarError ' . $result[0]['varerror'], EVENT_PATH);
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                         if ($this->_ERROR_CODE != 0) {
                             $soap->rollback($ret['table1']['Id'], $Today);
                         }
                     } else {
                         switch ($ret['table0']['Result']) {
                             case 0:
                                 $this->_ERROR_CODE = 0;
                                 break;
                             case -2:
                                 //Error - bravo
                                 $this->_ERROR_CODE = 23002;
                                 break;
                             case -1:
                                 //Invalid key
                                 $this->_ERROR_CODE = 23003;
                                 break;
                             case -13:
                                 /*Invalid Transaction Type*/
                                 $this->_ERROR_CODE = 23006;
                                 break;
                             case -15:
                                 /*Invalid CustomerCode*/
                                 $this->_ERROR_CODE = 23005;
                                 break;
                             case -16:
                                 /*Invalid DestCustomerCode*/
                                 $this->_ERROR_CODE = 23004;
                                 break;
                             default:
                                 //Unknown Error
                                 $this->_ERROR_CODE = 23009;
                                 write_my_log_path($function_name, '  Bravo ' . $ret['table0']['Result'], EVENT_PATH);
                                 break;
                         }
                     }
                 } else {
                     switch ($dab_rs) {
                         case '-1':
                             //unauthenticate partner
                             $this->_ERROR_CODE = 22135;
                             break;
                         case '-2':
                             //invalid parameters
                             $this->_ERROR_CODE = 22136;
                             break;
                         case '-3':
                             //invalid date
                             $this->_ERROR_CODE = 22137;
                             break;
                         case '-12':
                             // Tai khoan khong ton tai
                             $this->_ERROR_CODE = 12001;
                             break;
                         case '-4':
                             //no customer found
                             $this->_ERROR_CODE = 22140;
                             break;
                         case '-5':
                             //transfer unsuccessful
                             $this->_ERROR_CODE = 22141;
                             break;
                         case '-13':
                         case '1':
                             //invalid account
                             $this->_ERROR_CODE = 22142;
                             break;
                         case '2':
                             //invalid amount
                             $this->_ERROR_CODE = 22143;
                             break;
                         case '3':
                             //duplicate transfer
                             $this->_ERROR_CODE = 22147;
                             break;
                         case '-14':
                         case '5':
                             //not enough balance
                             $this->_ERROR_CODE = 22144;
                             break;
                         case '6':
                             //duplicate account
                             $this->_ERROR_CODE = 22145;
                             break;
                         case '-15':
                             //can not add history transaction
                             $this->_ERROR_CODE = 22228;
                             break;
                         case '-11':
                         case '99':
                             //unknown error
                             $this->_ERROR_CODE = 22138;
                             break;
                         default:
                             $this->_ERROR_CODE = 22139;
                     }
                 }
             } else {
                 $this->_ERROR_CODE = $Withdrawal['ErrorCode'];
             }
         }
     } catch (Exception $e) {
         write_my_log_path('PHP-Exception', $function_name . ' Caught exception: ' . $e->getMessage() . ' ' . date('Y-m-d h:i:s'), DEBUG_PATH);
         $this->_ERROR_CODE = 23022;
     }
     return returnXML(func_get_args(), $this->class_name, $function_name, $this->_ERROR_CODE, $this->items, $this);
 }
    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;
    }
Ejemplo n.º 8
0
 /**
  * @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;
 }
Ejemplo n.º 9
0
 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);
     }
 }
Ejemplo n.º 10
0
    $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');
Ejemplo n.º 11
0
<?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) {
Ejemplo n.º 12
0
<?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"' : '';
Ejemplo n.º 13
0
 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);
 }
Ejemplo n.º 14
0
    $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';
Ejemplo n.º 15
0
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__);
}
Ejemplo n.º 16
0
 function Comments($script, $idprov, $vars, $module_folder = '', $is_kernel_script = false)
 {
     $this->module_folder = !empty($module_folder) ? strprotect($module_folder) : strprotect($script);
     list($this->script, $this->idprov, $this->vars, $this->path) = array(strprotect($script), numeric($idprov), $vars, PATH_TO_ROOT . '/' . $this->module_folder . '/');
     $this->is_kernel_script = $is_kernel_script;
 }
Ejemplo n.º 17
0
 /**
  * 
  * @param type $data
  * @return boolean
  */
 function savePriceList($data)
 {
     $this->db->trans_begin();
     $baris = $data['numRows'];
     for ($i = 2; $i <= $baris; $i++) {
         if (!empty($data['cells'][$i][1])) {
             $kode = str_replace(" ", "", $data['cells'][$i][1]);
             $harga = $data['cells'][$i][3];
             $this->db->query("UPDATE spa_inventory SET inve_harga = " . numeric($harga) . " WHERE inve_cbid = '" . ses_cabang . "' AND inve_kode = '{$kode}'");
         }
     }
     if ($this->db->trans_status() === TRUE) {
         $this->db->trans_commit();
         return true;
     } else {
         $this->db->trans_rollback();
         return false;
     }
     return false;
 }
Ejemplo n.º 18
0
 public function addSubTrans($etc = array(), $main = array(), $detail = array(), $bank = array())
 {
     $this->db->trans_begin();
     try {
         if ($etc['purpose'] == 'ADD') {
             $tahun = date('y');
             $main['kstid'] = NUM_TRANS . $tahun . sprintf("%08s", $this->getCounter(NUM_TRANS . $tahun));
             if ($main['kst_type'] == 'I') {
                 $main['kst_kredit'] = 0;
             } else {
                 if ($main['kst_type'] == 'O') {
                     $main['kst_debit'] = 0;
                 }
             }
             $this->addMain($main);
         } else {
             $this->editMain($main, $etc['kstid']);
             $this->flagDetail(0, $etc['kstid']);
             $main['kstid'] = $etc['kstid'];
         }
         if (count($detail) < 1) {
             $e = "DETAIL TRANSAKSI KOSONG";
             throw new Exception($e);
         } else {
             if (!empty($detail['nota'][0])) {
                 for ($i = 0; $i <= count($detail['coa']) - 1; $i++) {
                     if ($main['kst_trans'] != 'ADJUST') {
                         if ($main['kst_type'] == 'I') {
                             $kredit = numeric($detail['nominal'][$i]);
                             $debit = 0;
                         } else {
                             $kredit = 0;
                             $debit = numeric($detail['nominal'][$i]);
                         }
                     } else {
                         $debit = numeric($detail['debit'][$i]);
                         $kredit = numeric($detail['kredit'][$i]);
                     }
                     if ($this->addDetail(array('dkst_kstid' => $main['kstid'], 'dkst_coa' => $detail['coa'], 'dkst_descrip' => strtoupper($detail['desc']), 'dkst_nota' => strtoupper($detail['nota'][$i]), 'dkst_pelid' => strtoupper($detail['pelid']), 'dkst_supid' => strtoupper($detail['supid']), 'dkst_ccid' => $detail['ccid'], 'dkst_debit' => $debit, 'dkst_kredit' => $kredit, 'dkst_flag' => '1', 'dkst_lastupdate' => date('Y-m-d H:i:s'))) == FALSE) {
                         throw new Exception('GAGAL TAMBAH DETAIL');
                     }
                     $arrLog[] = array("trl_cbid" => ses_cabang, "trl_nomer" => $main['kst_nomer'], 'trl_date' => $main['kst_tgl'], "trl_coa" => $detail['coa'][$i], "trl_descrip" => $detail['desc'], "trl_debit" => $debit, "trl_kredit" => $kredit, "trl_croscoa" => $main['kst_coa'], "trl_nota" => $detail['nota'][$i], "trl_pelid" => $detail['pelid'], "trl_ccid" => $detail['ccid'][$i], "trl_supid" => $detail['supid'][$i], "trl_headstatus" => '0', "trl_name" => $main['kst_trans'], "trl_trans" => $main['kst_type'], "trl_createon" => date('Y-m-d H:i:s'));
                     if ($main['kst_trans'] != 'ADJ') {
                         $arrLog[] = array("trl_cbid" => ses_cabang, "trl_nomer" => $main['kst_nomer'], 'trl_date' => $main['kst_tgl'], "trl_coa" => $main['kst_coa'], "trl_descrip" => $detail['desc'], "trl_debit" => $kredit, "trl_kredit" => $debit, "trl_croscoa" => $main['kst_coa'], "trl_nota" => $detail['nota'][$i], "trl_pelid" => $detail['pelid'], "trl_ccid" => $detail['ccid'], "trl_supid" => $detail['supid'], "trl_headstatus" => '1', "trl_name" => $main['kst_trans'], "trl_trans" => $main['kst_type'], "trl_createon" => date('Y-m-d H:i:s'));
                     }
                 }
             }
         }
         if (count($bank['bank']) > 0) {
             if (!empty($bank['bank'][0])) {
                 for ($i = 0; $i <= count($bank['bank']) - 1; $i++) {
                     if ($this->addBank(array('dbnk_kstid' => $main['kstid'], 'dbnk_bankid' => $bank['bank'][$i], 'dbnk_norek' => $bank['norek'][$i], 'dbnk_nocek' => $bank['nocek'][$i], 'dbnk_jtempo' => dateToIndo($bank['jtempo'][$i]), 'dbnk_kotaid' => $bank['kota'][$i], 'dbnk_nominal' => numeric($bank['nominal'][$i]), 'dbnk_flag' => '1', 'dbnk_lastupdate' => date('Y-m-d H:i:s'))) == FALSE) {
                         throw new Exception('GAGAL TAMBAH DETAIL BANK');
                     }
                 }
             }
         }
         /* INSERTING TO LEDGER */
         $this->db->insert_batch('ksr_ledger', $arrLog);
         if ($this->db->trans_status() == TRUE) {
             $this->db->trans_commit();
             return array('status' => TRUE, 'msg' => 'INPUT DATA BERHASIL');
         } else {
             $e = "GAGAL MENYIMPAN DATA";
             throw new Exception($e);
         }
     } catch (Exception $e) {
         $this->db->trans_rollback();
         return array('status' => FALSE, 'msg' => $e->getMessage());
     }
 }
Ejemplo n.º 19
0
 /**
 * Function checkAccountValidate	: check the validation of data input
 * Input 					: array of data
 * Output 					: error code. Return 0 if data is valid and return error code
 							 (number >0).
 */
 function checkPayment($data)
 {
     //if(!required($data['FirstName'])) return 18012;
     if (!required($data['PaymentDate']) || !valid_date($data['PaymentDate'])) {
         return 21007;
     }
     if (!required($data['TotalMoney']) || !numeric($data['TotalMoney']) || $data['TotalMoney'] < 20000000) {
         return 21009;
     }
     if (isset($data['CreatedBy']) && !required($data['CreatedBy'])) {
         return 21010;
     }
     if (isset($data['UpdatedBy']) && !required($data['UpdatedBy'])) {
         return 21011;
     }
     return 0;
 }
Ejemplo n.º 20
0
<?php

define('PATH_TO_ROOT', '../../..');
require_once PATH_TO_ROOT . '/kernel/begin.php';
define('TITLE', $LANG['title_com']);
require_once PATH_TO_ROOT . '/kernel/header_no_display.php';
if (!empty($_GET['com'])) {
    if (!preg_match('`([0-9]+)([a-z]+)([0-9]*)`', trim($_GET['com']), $array_get)) {
        $array_get = array('', '', '', '');
    }
    $idcom = empty($array_get[3]) && !empty($_POST['idcom']) ? numeric($_POST['idcom']) : $array_get[3];
    import('content/comments');
    $Comments = new Comments($array_get[2], $array_get[1], url('?com=' . $array_get[1] . $array_get[2] . '%s', ''), $array_get[2]);
    $Comments->set_arg($idcom, HOST . DIR . '/kernel/framework/ajax/pop_up_comments.php');
    echo $Comments->display(POP_UP_WINDOW, null, '');
}
include_once PATH_TO_ROOT . '/kernel/footer_no_display.php';
 /**
  * Function updateTransferPrivilege	: updateTransferPrivilege
  * Input 					: $ID, $FromAccountNo, $ToAccountNo, $TradingDate, $Quantity, $EventID, $UpdatedBy, $Note
  * OutPut 					: error code. Return 0 if success else return error code (number >0).
  */
 function updateTransferPrivilege($ID, $FromAccountNo, $ToAccountNo, $TradingDate, $Quantity, $EventID, $UpdatedBy, $Note)
 {
     try {
         $class_name = $this->class_name;
         $function_name = 'updateTransferPrivilege';
         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 && $FromAccountNo == $ToAccountNo) {
             $this->_ERROR_CODE = 22074;
         }
         if ($this->_ERROR_CODE == 0 && ($FromAccountNo == '0' && $ToAccountNo == '0' || $FromAccountNo == '' && $ToAccountNo == '')) {
             $this->_ERROR_CODE = 22075;
         }
         if ($this->_ERROR_CODE == 0 && (!required($TradingDate) || !valid_date($TradingDate))) {
             $this->_ERROR_CODE = 22073;
         }
         if ($this->_ERROR_CODE == 0 && (!required($Quantity) || $Quantity <= 0)) {
             $this->_ERROR_CODE = 22009;
         }
         if ($this->_ERROR_CODE == 0 && !required($UpdatedBy)) {
             $this->_ERROR_CODE = 22011;
         }
         if ($this->_ERROR_CODE == 0) {
             $query = sprintf("CALL sp_updateTransfer_Privilege ('%s','%s','%s','%s','%s','%s','%s','%s')", $ID, $FromAccountNo, $ToAccountNo, $TradingDate, $Quantity, $EventID, $UpdatedBy, $Note);
             //echo $query;
             $result = $this->_MDB2_WRITE->extended->getAll($query);
             //Can not updateEventStatus
             if (empty($result) || is_object($result)) {
                 $this->_ERROR_CODE = 22066;
                 write_my_log_path('ErrorCallStore', $query . '  ' . $result->backtrace[0]['args'][4], EVENT_PATH);
             } else {
                 if (isset($result[0]['varerror'])) {
                     if ($result[0]['varerror'] < 0) {
                         switch ($result[0]['varerror']) {
                             case 0:
                                 $this->_ERROR_CODE = 0;
                                 break;
                             case -1:
                                 //Invalid FromAccountID
                                 $this->_ERROR_CODE = 22071;
                                 break;
                             case -2:
                                 //Invalid ToAccountID
                                 $this->_ERROR_CODE = 22072;
                                 break;
                             case -3:
                                 //Exception
                                 $this->_ERROR_CODE = 22070;
                                 break;
                             case -4:
                                 //Invalid TradingDate
                                 $this->_ERROR_CODE = 22073;
                                 break;
                             case -5:
                                 //Invalid TransferPrivilegeID
                                 $this->_ERROR_CODE = 22087;
                                 break;
                             case -6:
                                 //so luong chuyen nhuong lon hon so luong cho phep
                                 $this->_ERROR_CODE = 22084;
                                 break;
                             case -7:
                                 //su kien khong cho phep chuyen nhuong
                                 $this->_ERROR_CODE = 22085;
                                 break;
                             default:
                                 //default
                                 $this->_ERROR_CODE = 22134;
                                 write_my_log_path($function_name, $query . '  VarError ' . $result[0]['varerror'], EVENT_PATH);
                                 break;
                         }
                     }
                 }
             }
         }
     } catch (Exception $e) {
         write_my_log_path('PHP-Exception', $function_name . ' Caught exception: ' . $e->getMessage() . ' ' . date('Y-m-d h:i:s'), DEBUG_PATH);
         $this->_ERROR_CODE = 23022;
     }
     return returnXML(func_get_args(), $this->class_name, $function_name, $this->_ERROR_CODE, $this->items, $this);
 }
Ejemplo n.º 22
0
                        redirect(HOST . DIR . '/gallery/admin_gallery_add.php?error=' . $Gallery->error . '#errorh');
                    }
                    $Cache->Generate_module_file('gallery');
                }
            }
        }
    }
    redirect(HOST . DIR . '/gallery/admin_gallery_add.php?add=' . $idpic);
} elseif (!empty($_POST['valid']) && !empty($nbr_pics_post)) {
    for ($i = 1; $i <= $nbr_pics_post; $i++) {
        $activ = !empty($_POST[$i . 'activ']) ? trim($_POST[$i . 'activ']) : '';
        $uniq = !empty($_POST[$i . 'uniq']) ? strprotect($_POST[$i . 'uniq']) : '';
        if ($activ && !empty($uniq)) {
            $name = !empty($_POST[$i . 'name']) ? strprotect($_POST[$i . 'name']) : 0;
            $cat = !empty($_POST[$i . 'cat']) ? numeric($_POST[$i . 'cat']) : 0;
            $del = !empty($_POST[$i . 'del']) ? numeric($_POST[$i . 'del']) : 0;
            if ($del) {
                delete_file('pics/' . $uniq);
            } else {
                $Gallery->Add_pics($cat, $name, $uniq, $User->get_attribute('user_id'));
            }
        }
    }
    $Cache->Generate_module_file('gallery');
    redirect(HOST . DIR . '/gallery/admin_gallery_add.php');
} else {
    $Template->set_filenames(array('admin_gallery_add' => 'gallery/admin_gallery_add.tpl'));
    $get_error = !empty($_GET['error']) ? trim($_GET['error']) : '';
    $array_error = array('e_upload_invalid_format', 'e_upload_max_weight', 'e_upload_max_dimension', 'e_upload_error', 'e_upload_failed_unwritable', 'e_upload_already_exist', 'e_unlink_disabled', 'e_unsupported_format', 'e_unabled_create_pics', 'e_error_resize', 'e_no_graphic_support', 'e_unabled_incrust_logo', 'delete_thumbnails');
    if (in_array($get_error, $array_error)) {
        $Errorh->handler($LANG[$get_error], E_USER_WARNING);
Ejemplo n.º 23
0
 /**
 * Function checkSpecialRateValidate	: check the validation of data input
 * Input 						: array of data
 * Output 						: error code. Return 0 if data is valid and return error code
 							 (number >0).
 */
 function checkSpecialRateValidate($data)
 {
     if (isset($data['BankID']) && !unsigned($data['BankID'])) {
         return 13065;
     }
     if (isset($data['StockID']) && !unsigned($data['StockID'])) {
         return 13072;
     }
     if (isset($data['FromValue']) && strlen($data['FromValue']) > 0 && !numeric($data['FromValue'])) {
         return 13066;
     }
     if (isset($data['ToValue']) && strlen($data['ToValue']) > 0 && !numeric($data['ToValue'])) {
         return 13067;
     }
     if (isset($data['FromValue']) && isset($data['ToValue']) && $data['FromValue'] > $data['ToValue']) {
         return 13073;
     }
     if (isset($data['PercentRate']) && strlen($data['PercentRate']) > 0 && !numeric($data['PercentRate'])) {
         return 13068;
     }
     if (isset($data['UseMarketPrice']) && strlen($data['UseMarketPrice']) > 0 && !numeric($data['UseMarketPrice'])) {
         return 13069;
     }
     if (isset($data['CreatedBy']) && !required($data['CreatedBy'])) {
         return 13070;
     }
     if (isset($data['UpdatedBy']) && !required($data['UpdatedBy'])) {
         return 13071;
     }
     return 0;
 }
Ejemplo n.º 24
0
 public function updateStockUnit()
 {
     $id = strtoupper($this->input->post('mscid', TRUE));
     $norangka = strtoupper($this->input->post('msc_norangka', TRUE));
     $nomesin = strtoupper($this->input->post('msc_nomesin', TRUE));
     $jkend = strtoupper($this->input->post('msc_segid', TRUE));
     $type = strtoupper($this->input->post('msc_ctyid', TRUE));
     $warna = strtoupper($this->input->post('msc_warnaid', TRUE));
     $tahun = strtoupper($this->input->post('msc_tahun', TRUE));
     $kondisi = strtoupper($this->input->post('msc_kondisi', TRUE));
     if (empty($id) || empty($norangka) || empty($nomesin) || empty($jkend) || empty($type) || empty($warna) || empty($tahun) || empty($kondisi)) {
         $hasil = array('status' => '0', 'msg' => $this->error('Rangka : ' . $norangka . ' | Mesin : ' . $nomesin . ' | Jkend : ' . $jkend . ' | Type : ' . $type . ' | Warna : ' . $warna . ' | Tahun : ' . $tahun . ' | Kondisi : ' . $kondisi));
     } else {
         $save = $this->model_sales->updateStockUnit(array('msc_norangka' => $norangka, 'msc_nomesin' => $nomesin, 'msc_jenis' => $jkend, 'msc_ctyid' => $type, 'msc_warnaid' => $warna, 'msc_tahun' => $tahun, 'msc_kondisi' => $kondisi, 'msc_cbid' => ses_cabang, 'msc_status' => "B", 'msc_roda' => strtoupper($this->input->post('msc_roda', TRUE)), 'msc_chasis' => strtoupper($this->input->post('msc_chasis', TRUE)), 'msc_vinlot' => strtoupper($this->input->post('msc_vinlot', TRUE)), 'msc_bodyseri' => strtoupper($this->input->post('msc_bodyseri', TRUE)), 'msc_nokunci' => strtoupper($this->input->post('msc_nokunci', TRUE)), 'msc_fuel' => strtoupper($this->input->post('msc_fuel', TRUE)), 'msc_regckd' => strtoupper($this->input->post('msc_regckd', TRUE)), 'msc_silinder' => numeric($this->input->post('msc_silinder', TRUE)), 'msc_createon' => date('Y-m-d H:i:s'), 'msc_createby' => ses_krid), $id);
         if ($save['status'] == TRUE) {
             $hasil = array('status' => TRUE, 'msg' => $this->sukses($save['msg']));
         } else {
             $hasil = array('status' => FALSE, 'msg' => $this->error($save['msg']));
         }
     }
     echo json_encode($hasil);
 }
Ejemplo n.º 25
0
 public function updateKreditLimit()
 {
     $this->load->library('form_validation');
     $this->form_validation->set_rules('pelid', '<b>Fx</b>', 'xss_clean');
     if ($this->form_validation->run() == TRUE) {
         $data = array('limit_cbid' => ses_cabang, 'limit_pelid' => $this->input->post('pelid'), 'limitid' => $this->input->post('limitid'), 'limit_top' => numeric($this->input->post('limit_top')), 'limit_total' => numeric($this->input->post('limit_total')), 'limit_diskon' => numeric($this->input->post('limit_diskon')), 'limit_createon' => date('Y-m-d H:i:s'), 'limit_createby' => ses_cabang);
         if ($this->model_sparepart->updateKreditLimit($data)) {
             $hasil['result'] = true;
             $hasil['msg'] = $this->sukses("Berhasil menyimpan Kredit Limit");
         } else {
             $hasil['result'] = false;
             $hasil['msg'] = $this->error("Gagal menyimpan Kredit Limit");
         }
     }
     echo json_encode($hasil);
 }
define('NO_SESSION_LOCATION', true);
include_once PATH_TO_ROOT . '/kernel/begin.php';
define('TITLE', '');
include_once PATH_TO_ROOT . '/kernel/header_no_display.php';
$calendar_type = !empty($_GET['date']) ? 'timestamp' : 'date';
$field = !empty($_GET['field']) ? trim($_GET['field']) : 'calendar';
$input_field = !empty($_GET['input_field']) ? trim($_GET['input_field']) : '';
$lyear = !empty($_GET['lyear']) ? '&amp;lyear=1' : '';
$Template->set_filenames(array('calendar' => 'framework/mini_calendar_response.tpl'));
if ($calendar_type == 'date') {
    $year = gmdate_format('Y');
    $month = gmdate_format('n');
    $day = gmdate_format('j');
    $year = !empty($_GET['y']) ? numeric($_GET['y']) : $year;
    $month = !empty($_GET['m']) ? numeric($_GET['m']) : $month;
    $day = !empty($_GET['d']) ? numeric($_GET['d']) : $day;
    if (!checkdate($month, $day, $year)) {
        list($year, $month, $day) = array(gmdate_format('Y'), gmdate_format('n'), gmdate_format('j'));
    }
    $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);
    $array_l_month = array($LANG['january'], $LANG['february'], $LANG['march'], $LANG['april'], $LANG['may'], $LANG['june'], $LANG['july'], $LANG['august'], $LANG['september'], $LANG['october'], $LANG['november'], $LANG['december']);
    $month_day = $array_month[$month - 1];
    $Template->assign_vars(array('FIELD' => $field, 'INPUT_FIELD' => $input_field, 'LYEAR' => $lyear, 'MONTH' => $month, 'YEAR' => $year, 'U_PREVIOUS' => $month == 1 ? 'input_field=' . $input_field . '&amp;field=' . $field . $lyear . '&amp;d=' . $day . '&amp;m=12&amp;y=' . ($year - 1) : 'input_field=' . $input_field . '&amp;input_field=' . $input_field . '&amp;field=' . $field . $lyear . '&amp;d=1&amp;m=' . ($month - 1) . '&amp;y=' . $year, 'U_NEXT' => $month == 12 ? 'input_field=' . $input_field . '&amp;field=' . $field . $lyear . '&amp;d=' . $day . '&amp;m=1&amp;y=' . ($year + 1) : 'input_field=' . $input_field . '&amp;field=' . $field . $lyear . '&amp;d=1&amp;m=' . ($month + 1) . '&amp;y=' . $year));
    for ($i = 1; $i <= 12; $i++) {
        $selected = $month == $i ? 'selected="selected"' : '';
        $Template->assign_block_vars('month', array('MONTH' => '<option value="' . $i . '" ' . $selected . '>' . htmlentities($array_l_month[$i - 1], ENT_COMPAT, 'ISO-8859-1') . '</option>'));
    }
    for ($i = 1900; $i <= 2037; $i++) {
        $selected = $year == $i ? 'selected="selected"' : '';
        $Template->assign_block_vars('year', array('YEAR' => '<option value="' . $i . '" ' . $selected . '>' . $i . '</option>'));
Ejemplo n.º 27
0
        $is_writable = @chmod($dir, 0777) ? true : false;
    }
    @clearstatcache();
    $error = '';
    if (is_writable($dir)) {
        $Cache->load('uploads');
        import('io/upload');
        $Upload = new Upload($dir);
        $Upload->file('upload_file', '`([a-z0-9()_-])+\\.(' . implode('|', array_map('preg_quote', $CONFIG_UPLOADS['auth_extensions'])) . ')+$`i', UNIQ_NAME);
        if (!empty($Upload->error)) {
            redirect(HOST . DIR . '/admin/admin_files.php?f=' . $folder . '&erroru=' . $Upload->error . '#errorh');
        } else {
            $check_user_folder = $Sql->query("SELECT user_id FROM " . DB_TABLE_UPLOAD_CAT . " WHERE id = '" . $folder . "'", __LINE__, __FILE__);
            $user_id = $check_user_folder <= 0 ? -1 : $User->get_attribute('user_id');
            $user_id = max($user_id, $folder_member);
            $Sql->query_inject("INSERT INTO " . DB_TABLE_UPLOAD . " (idcat, name, path, user_id, size, type, timestamp) VALUES ('" . $folder . "', '" . addslashes($_FILES['upload_file']['name']) . "', '" . addslashes($Upload->filename['upload_file']) . "', '" . $user_id . "', '" . numeric(number_round($_FILES['upload_file']['size'] / 1024, 1), 'float') . "', '" . $Upload->extension['upload_file'] . "', '" . time() . "')", __LINE__, __FILE__);
        }
    } else {
        $error = 'e_upload_failed_unwritable';
    }
    $error = !empty($error) ? '&error=' . $error . '#errorh' : '';
    redirect(HOST . DIR . '/admin/admin_files.php?f=' . $folder . ($folder_member > 0 ? '&fm=' . $folder_member : '') . $error);
} elseif (!empty($del_folder)) {
    $Session->csrf_get_protect();
    $Uploads->Del_folder($del_folder);
    if (!empty($folder_member)) {
        redirect(HOST . DIR . '/admin/admin_files.php?fm=' . $folder_member);
    } else {
        redirect(HOST . DIR . '/admin/admin_files.php?f=' . $folder);
    }
} elseif (!empty($empty_folder)) {
Ejemplo n.º 28
0
<?php

require_once '../admin/admin_begin.php';
load_module_lang('gallery');
define('TITLE', $LANG['administration']);
require_once '../admin/admin_header.php';
$idcat = !empty($_GET['cat']) ? numeric($_GET['cat']) : 0;
$idpics = !empty($_GET['id']) ? numeric($_GET['id']) : 0;
$del = !empty($_GET['del']) ? numeric($_GET['del']) : 0;
$move = !empty($_GET['move']) ? numeric($_GET['move']) : 0;
include_once '../gallery/gallery.class.php';
$Gallery = new Gallery();
$Cache->load('gallery');
if (!empty($idpics) && isset($_GET['move'])) {
    $Session->csrf_get_protect();
    $Gallery->Move_pics($idpics, $move);
    $Cache->Generate_module_file('gallery');
    redirect(HOST . DIR . '/gallery/admin_gallery.php?cat=' . $move);
} elseif (!empty($del)) {
    $Session->csrf_get_protect();
    $Gallery->Del_pics($del);
    $Cache->Generate_module_file('gallery');
    redirect(HOST . DIR . '/gallery/admin_gallery.php?cat=' . $idcat);
} else {
    $Template->set_filenames(array('admin_gallery_management' => 'gallery/admin_gallery_management.tpl'));
    if (!empty($idcat) && !isset($CAT_GALLERY[$idcat])) {
        redirect(HOST . DIR . '/gallery/admin_gallery.php?error=unexist_cat');
    }
    if (!empty($idcat)) {
        $cat_links = '';
        foreach ($CAT_GALLERY as $id => $array_info_cat) {
Ejemplo n.º 29
0
 function set_cat($value)
 {
     $this->category = is_numeric($value) ? numeric($value) : 0;
 }
Ejemplo n.º 30
0
 public function saveTagService()
 {
     $coa = $this->input->post('dtrans_coa', TRUE);
     $desc = $this->input->post('dtrans_desc', TRUE);
     $nominal = $this->input->post('dtrans_nominal', TRUE);
     $trans = $this->input->post('dtrans_trans', TRUE);
     $etc = array('numerator' => $this->input->post('trans_numerator', TRUE), 'purpose' => 'ADD', 'woid' => $this->input->post('trans_notaid', TRUE));
     $transToSave = array();
     if (count($nominal) > 0) {
         for ($i = 0; $i <= count($nominal) - 1; $i++) {
             if (count($nominal) > 1) {
                 $docno = strtoupper($this->input->post('trans_nota', TRUE)) . '-' . ($i + 1);
             } else {
                 $docno = strtoupper($this->input->post('trans_nota', TRUE));
             }
             $main = array('kst_trans' => $trans[$i], 'kst_type' => $this->input->post('trans_type', TRUE), 'kst_nomer' => $docno, 'kst_noreff' => '', 'kst_tgl' => dateToIndo($this->input->post('trans_tgl', TRUE)), 'kst_coa' => $coa[$i], 'kst_desc' => strtoupper($desc[$i]), 'kst_debit' => numeric($nominal[$i]), 'kst_kredit' => numeric($nominal[$i]), 'kst_createon' => date('Y-m-d H:i:s'), 'kst_sub_trans' => $this->input->post('trans_sub_trans', TRUE), 'kst_createby' => ses_krid, 'kst_cbid' => ses_cabang);
             $detail = array('coa' => array(0 => PIUTANG_SERVICE), 'desc' => array(0 => $desc[$i]), 'nota' => array(0 => $this->input->post('trans_notaid', TRUE)), 'pelid' => array(0 => $this->input->post('trans_pelid', TRUE)), 'supid' => array(0 => '0'), 'ccid' => array(0 => '0'), 'nominal' => array(0 => $nominal[$i]));
             $bank = array();
             if ($nominal[$i] != 0) {
                 $transToSave[] = array('etc' => $etc, 'main' => $main, 'detail' => $detail, 'bank' => $bank);
             }
         }
     }
     $save = $this->model_trfinance->saveTagihanService($etc, $transToSave);
     if ($save['status'] == TRUE) {
         $this->session->set_flashdata('msg', $this->sukses('Berhasil menambah tagihan'));
         $result = array('status' => TRUE, 'msg' => $this->sukses($save['msg']));
     } else {
         $result = array('status' => FALSE, 'msg' => $this->error($save['msg']));
     }
     echo json_encode($result);
 }