Exemple #1
0
 function init()
 {
     $errno = strip_tags(Func::GETPOST('errno'));
     if ($errno) {
         $this->set($errno);
         $this->sm->assign('errno', $errno);
     }
 }
Exemple #2
0
 function prepareOrder(&$orderBy, &$orderDirection, $defaultOrder = '', $allowedOrders = array(), $orderParamName = 'order')
 {
     $order = Func::GETPOST($orderParamName);
     if (empty($order)) {
         $order = $defaultOrder;
     }
     if (!empty($order)) {
         @(list($orderBy, $orderDirection) = explode(',', $order));
         if (!isset($orderDirection)) {
             $orderDirection = 'asc';
         }
         if (!empty($allowedOrders) && !isset($allowedOrders[$orderBy])) {
             @(list($orderBy, $orderDirection) = explode(',', $defaultOrder));
         }
         $orderDirectionNeeded = $orderDirection == 'asc' ? 'desc' : 'asc';
         $this->tplAssign(array('order_by' => $orderBy, 'order_dir' => $orderDirection, 'order_dir_needed' => $orderDirectionNeeded));
         return true;
     }
     return false;
 }
Exemple #3
0
 function user_ajax()
 {
     if (!($nRecordID = $this->input->id('rec', 'gp'))) {
         $this->ajaxResponse(Errors::IMPOSSIBLE);
     }
     if (func::isAjaxRequest(null)) {
         switch (Func::GETPOST('action')) {
             case 'avatar-delete':
                 if (!$this->haveAccessTo('users-edit')) {
                     $this->ajaxResponse(Errors::ACCESSDENIED);
                 }
                 $avatar = new CAvatar(TABLE_USERS, USERS_AVATAR_PATH, 'avatar', 'user_id');
                 $avatar->delete($nRecordID, true);
                 $this->ajaxResponse(Errors::SUCCESSFULL);
                 break;
             case 'user-info':
                 $aData = $this->db->one_array('SELECT U.*, C.title as city, R.region_id, R.title as region 
                                                 FROM ' . TABLE_USERS . ' U
                                                 LEFT JOIN ' . TABLE_CITY . ' C   ON U.city_id=C.city_id
                                                 LEFT JOIN ' . TABLE_REGION . ' R ON C.region_id=R.region_id
                                                WHERE U.user_id=' . $nRecordID . ' LIMIT 1');
                 $aData['tuid'] = $this->makeTUID($nRecordID);
                 $aData['sendmsg'] = 0;
                 //($this->security->isAdmin() || $aData['im_noreply'] == 0);
                 $this->tplAssignByRef('aData', $aData);
                 $this->adminCustomCenterArea();
                 $this->tplDisplay('admin.user.info.tpl');
                 exit;
                 break;
             case 'user-block':
                 if (!$this->haveAccessTo('users-edit') || $this->security->isCurrentUser($nRecordID)) {
                     $this->ajaxResponse(Errors::ACCESSDENIED);
                 }
                 $sReason = mb_strcut(Func::POSTGET('blocked_reason', true), 0, 300);
                 $nBlocked = Func::POSTGET('blocked') ? 1 : 0;
                 $this->db->execute('UPDATE ' . TABLE_USERS . ' 
                                SET blocked_reason = ' . $this->db->str2sql($sReason) . ',
                                    blocked = ' . $nBlocked . '
                                WHERE user_id = ' . $nRecordID);
                 $this->ajaxResponse(Errors::SUCCESSFULL);
                 break;
         }
     }
     $this->ajaxResponse(Errors::IMPOSSIBLE);
 }
Exemple #4
0
 function showBanner()
 {
     if (!$this->haveAccessTo('listing')) {
         return $this->showAccessDenied();
     }
     $nRecordID = Func::GETPOST('rec', false, true);
     if ($nRecordID <= 0) {
         $this->ajaxResponse('');
     }
     $aData = $this->db->one_array('SELECT * FROM ' . TABLE_BANNERS . ' WHERE id = ' . $nRecordID);
     $aData['img_thumb'] = BANNERS_URL . '/' . $aData['id'] . '_work_' . $aData['banner'];
     if (file_exists(BANNERS_PATH . $aData['id'] . '_work_' . $aData['banner'])) {
         $aData['img_size'] = getimagesize(BANNERS_PATH . $aData['id'] . '_work_' . $aData['banner']);
         $aData['img_size'] = $aData['img_size'][0];
     } else {
         $aData['img_size'] = 240;
     }
     $aData['flash'] = unserialize($aData['flash']);
     $this->tplAssign('aData', $aData);
     $this->ajaxResponse($this->tplFetch('admin.banner.show.tpl'));
 }