Exemplo n.º 1
0
echo $aData['url_listing'];
?>
&owner=<?php 
echo $aData['owner_id'];
?>
"><?php 
echo $aData['owner_title'];
?>
</a>
                &rarr;&nbsp;&nbsp;
                <span class="bold">динамические свойства</span>
            </div>
            <div class="right">
                <?php 
if (false && $this->inherit === 1) {
    $vis = !func::getCOOKIE(BFF_COOKIE_PREFIX . 'bbs_dynprop_inh');
    ?>
                    <a href="#" class="ajax desc">скрыть наследуемые</a>
                <?php 
}
?>
            </div>
            <div class="clear-all"></div>
        </div>
                                                          
        <table class="admtbl tblhover" id="dynprop_listing">
            <tr class="header nodrag nodrop">
            <?php 
if (FORDEV) {
    ?>
<th width="30">DF</th><?php 
Exemplo n.º 2
0
 function categories_listing()
 {
     if (!$this->haveAccessTo('categories-listing')) {
         return $this->showAccessDenied();
     }
     $aData = array();
     if (bff::$isAjax) {
         $sAct = func::GET('act');
         if (!$this->haveAccessTo('categories-edit') && $sAct != 'subs-list') {
             $this->ajaxResponse(Errors::ACCESSDENIED);
         }
         switch ($sAct) {
             case 'subs-list':
                 $nCategoryID = $this->input->id('category', 'pg');
                 if (!$nCategoryID) {
                     $this->ajaxResponse(Errors::UNKNOWNRECORD);
                 }
                 $aData['cats'] = $this->db->select('SELECT C.id, C.pid, C.enabled, C.regions, C.prices, C.numlevel, IF(C.numright-C.numleft>1,1,0) as node, C.title, COUNT(I.id) as items 
                                            FROM ' . TABLE_BBS_CATEGORIES . ' C
                                                 LEFT JOIN ' . TABLE_BBS_ITEMS . ' I ON C.id IN(I.cat1_id, I.cat2_id, I.cat_id)
                                            WHERE C.pid=' . $nCategoryID . ' 
                                            GROUP BY C.id
                                            ORDER BY C.numleft');
                 $this->tplAssignByRef('aData', $aData);
                 $this->ajaxResponse(array('cats' => $this->tplFetch('admin.categories.listing.ajax.tpl')));
                 break;
             case 'toggle':
                 $nCategoryID = $this->input->get('rec');
                 if ($this->db->execute('UPDATE ' . TABLE_BBS_CATEGORIES . ' SET enabled = (1-enabled) WHERE id = ' . $nCategoryID)) {
                     $this->ajaxResponse(Errors::SUCCESSFULL);
                 }
                 break;
             case 'prices-form':
                 $p = $this->input->getm(array('rec' => TYPE_UINT, 'save' => TYPE_BOOL));
                 if ($p['save']) {
                     $this->input->postm(array('prices' => TYPE_BOOL, 'sett' => TYPE_ARRAY), $p);
                     $this->input->clean_array($p['sett'], array('ranges' => TYPE_ARRAY, 'torg' => TYPE_BOOL, 'bart' => TYPE_BOOL));
                     $p['sett']['ranges'] = $this->prepareCategoryPricesRanges($p['sett']['ranges']);
                     $res = $this->db->execute('UPDATE ' . TABLE_BBS_CATEGORIES . ' SET 
                             prices = ' . $p['prices'] . ', prices_sett = ? 
                             WHERE id = ' . $p['rec'], array(serialize($p['sett'])));
                     $this->ajaxResponse(array('prices' => $p['prices'], 'cat_id' => $p['rec']));
                 }
                 $aData = $this->db->one_array('SELECT prices, prices_sett as sett FROM ' . TABLE_BBS_CATEGORIES . ' WHERE id = ' . $p['rec']);
                 $aData['sett'] = !empty($aData['sett']) ? unserialize($aData['sett']) : array();
                 if ($aData['sett'] === false) {
                     $aData['sett'] = array();
                 }
                 if (!isset($aData['sett']['ranges'])) {
                     $aData['sett']['ranges'] = array();
                 }
                 $aData['form'] = $this->tplFetchPHP($aData, 'admin.prices.form.php');
                 $aData['cat_id'] = $p['rec'];
                 $this->ajaxResponse($aData);
                 break;
             case 'regions':
                 $nCategoryID = $this->input->get('rec');
                 if ($this->db->execute('UPDATE ' . TABLE_BBS_CATEGORIES . ' SET regions = (1-regions) WHERE id = ' . $nCategoryID)) {
                     $this->ajaxResponse(Errors::SUCCESSFULL);
                 }
                 break;
             case 'rotate':
                 if ($this->tree_rotateTablednd()) {
                     $this->ajaxResponse(Errors::SUCCESSFULL);
                 }
                 break;
             case 'delete':
                 $nCategoryID = $this->input->id('rec', 'p');
                 if ($nCategoryID) {
                     $nSubcats = $this->tree_getChildrenCount($nCategoryID);
                     $nItems = $this->db->one_data('SELECT COUNT(I.id) FROM ' . TABLE_BBS_ITEMS . ' I WHERE I.cat_id = ' . $nCategoryID);
                     if (empty($nSubcats) && empty($nItems)) {
                         //удаляем только пустую категорию
                         $aDeleteID = $this->tree_deleteNode($nCategoryID);
                         if (!$aDeleteID) {
                             $this->adminRedirect(Errors::IMPOSSIBLE);
                         }
                         $this->db->execute('DELETE FROM ' . TABLE_BBS_CATEGORIES . ' WHERE id IN (' . join(',', $aDeleteID) . ')');
                         $this->ajaxResponse(Errors::SUCCESSFULL);
                     }
                 }
                 break;
         }
         $this->ajaxResponse(Errors::IMPOSSIBLE);
     }
     $sCatState = func::getCOOKIE(BFF_COOKIE_PREFIX . 'bbs_cats_state');
     $aCatExpandedID = !empty($sCatState) ? explode(',', $sCatState) : array();
     $aCatExpandedID[] = 1;
     $sqlWhere = ' AND ' . $this->db->prepareIN('C.pid', $aCatExpandedID);
     $aData['cats'] = $this->db->select('SELECT C.id, C.pid, C.enabled, C.regions, C.prices, C.numlevel, IF(C.numright-C.numleft>1,1,0) as node, C.title, COUNT(I.id) as items
                 FROM ' . TABLE_BBS_CATEGORIES . ' C
                     LEFT JOIN ' . TABLE_BBS_ITEMS . ' I ON C.id IN(I.cat1_id, I.cat2_id, I.cat_id)
                 WHERE 1=1 ' . $sqlWhere . '
                 GROUP BY C.id
                 ORDER BY C.numleft ASC');
     $this->includeJS('tablednd');
     $this->tplAssignByRef('aData', $aData);
     $aData['cats_html'] = $this->tplFetch('admin.categories.listing.ajax.tpl');
     return $this->tplFetch('admin.categories.listing.tpl');
 }
Exemplo n.º 3
0
 function getFavorites($bResaveFromCookie = false)
 {
     static $cache;
     if (isset($cache)) {
         return $cache;
     }
     $cookieKey = BFF_COOKIE_PREFIX . 'bbs_fav';
     if ($userID = $this->security->getUserID()) {
         $res = $this->db->select_one_column('SELECT item_id FROM ' . TABLE_BBS_ITEMS_FAV . ' WHERE user_id = ' . $userID . ' GROUP BY item_id');
         if (empty($res)) {
             $res = array();
         }
         if ($bResaveFromCookie) {
             $resCookie = func::getCOOKIE($cookieKey);
             if (!empty($resCookie)) {
                 $resCookie = explode(',', $resCookie);
                 if (!empty($resCookie)) {
                     $this->input->clean($resCookie, TYPE_ARRAY_UINT);
                 }
                 if (!empty($resCookie)) {
                     $sqlInsert = array();
                     foreach ($resCookie as $id) {
                         if (!in_array($id, $res)) {
                             $sqlInsert[] = "({$id}, {$userID})";
                             $res[] = $id;
                         }
                     }
                     if (!empty($sqlInsert)) {
                         $this->db->execute('INSERT INTO ' . TABLE_BBS_ITEMS_FAV . ' (item_id, user_id) 
                             VALUES ' . join(',', $sqlInsert));
                     }
                 }
                 func::setCOOKIE($cookieKey, '', BBS_FAV_COOKIE_EXPIRE, '/', '.' . SITEHOST);
             }
         }
     } else {
         $res = func::getCOOKIE($cookieKey);
         if (empty($res)) {
             $res = 0;
         } else {
             $res = explode(',', $res);
             if (empty($res)) {
                 $res = 0;
             } else {
                 $this->input->clean($res, TYPE_ARRAY_UINT);
             }
         }
     }
     $cache = $res = !empty($res) ? array('id' => $res, 'total' => count($res)) : array('id' => array(), 'total' => 0);
     config::set('bbs_favs', $res);
     return $res;
 }
Exemplo n.º 4
0
 function isRememberMe($cookiePrefix = '', &$sLogin, &$sPassword)
 {
     $sLogin = func::getCOOKIE($cookiePrefix . 'rmlgn');
     $sPassword = func::getCOOKIE($cookiePrefix . 'rmpwd');
     return $sLogin === false || $sPassword === false ? false : true;
 }
Exemplo n.º 5
0
 function preparePerpage(&$nPerpage, $aValues = array(5, 10, 15), $sParamName = 'perpage', $nExpireDays = 7)
 {
     $nPerpage = $this->input->getpost($sParamName, TYPE_UINT);
     $sCookieKey = BFF_COOKIE_PREFIX . $this->module_name . '_' . $sParamName;
     $nCurCookie = func::getCOOKIE($sCookieKey, 0);
     $this->input->clean($nCurCookie, TYPE_UINT);
     if (!$nPerpage) {
         $nPerpage = $nCurCookie;
         if (!in_array($nPerpage, $aValues)) {
             $nPerpage = current($aValues);
         }
     } else {
         if (!in_array($nPerpage, $aValues)) {
             $nPerpage = current($aValues);
         }
         if ($nCurCookie != $nPerpage) {
             func::setCOOKIE($sCookieKey, $nPerpage, isset($nExpireDays) ? $nExpireDays : 7);
         }
         //default: one week
     }
     array_walk($aValues, create_function('&$item,$key,$cur', '$item = "<option value=\\"$item\\" ".($item==$cur?"selected=\\"selected\\"":"").">$item</option>";'), $nPerpage);
     return join($aValues);
 }