HomeHelpTrac

Changeset 15733 for trunk/inc


Ignore:
Timestamp:
12/08/11 00:02:57 (6 months ago)
Author:
Alexander Trofimov
Message:

Groups - some corrections

Location:
trunk/inc
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/inc/classes/BxDolCmts.php

    r15590 r15733  
    162162        if (!isset($GLOBALS['bx_dol_cmts_systems'])) 
    163163        { 
    164             $GLOBALS['bx_dol_cmts_systems'] = $GLOBALS['MySQL']->fromCache('sys_objects_cmts', 'getAllWithKey', ' 
     164            $GLOBALS['bx_dol_cmts_systems'] = BxDolDb::getInstance()->fromCache('sys_objects_cmts', 'getAllWithKey', ' 
    165165                SELECT 
    166166                    `ID` as `system_id`, 
  • trunk/inc/classes/BxDolCmtsQuery.php

    r15262 r15733  
    5353                `c`.`cmt_replies`, 
    5454                (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(`c`.`cmt_time`)) AS `cmt_secs_ago`, 
    55                 `p`.`NickName` AS `cmt_author_name` 
     55                `p`.`id` AS `cmt_author_name` 
    5656            FROM {$this->_sTable} AS `c` 
    57             LEFT JOIN `Profiles` AS `p` ON (`p`.`ID` = `c`.`cmt_author_id`) 
     57            LEFT JOIN `sys_profiles` AS `p` ON (`p`.`id` = `c`.`cmt_author_id`) 
    5858            $sJoin 
    5959            WHERE `c`.`cmt_object_id` = ? AND `c`.`cmt_parent_id` = ? 
  • trunk/inc/classes/BxDolForm.php

    r15722 r15733  
    474474        foreach ($aInputs as $k => $a) { 
    475475            if (!isset($aValues[$k])) continue; 
    476             $sMethod = 'display'.ucfirst($a['db']['pass']); 
     476            $sMethod = 'display' . (isset($a['db']['pass']) ? ucfirst($a['db']['pass']) : 'Undefined'); 
    477477            if (method_exists($this->_oChecker, $sMethod)) 
    478478                $aInputs[$k]['value'] = call_user_func_array (array($this->_oChecker, $sMethod), $a['db']['params'] ? array_merge(array($aValues[$k]), $a['db']['params']) : array ($aValues[$k])); 
     
    652652    } 
    653653    function _passTags ($s) { 
     654        require_once(BX_DIRECTORY_PATH_INC . 'tags.inc.php'); 
    654655        $sTags = $this->passXss ($s); 
    655656        $aTags = explodeTags($sTags); 
  • trunk/inc/classes/BxDolProfile.php

    r15698 r15733  
    6363 
    6464    /** 
     65     * Check if profile status is active 
     66     */ 
     67    public function isActive($iProfileId) { 
     68        $aInfo = $this->getStatus((int)$iProfileId ? $iProfileId : $this->_iProfileID); 
     69        return 'active' == $aInfo['status']; 
     70    } 
     71 
     72    /** 
     73     * Get profile status 
     74     */ 
     75    public function getStatus($iProfileId) { 
     76        $aInfo = $this->_oQuery->getInfoById((int)$iProfileId ? $iProfileId : $this->_iProfileID); 
     77        return $aInfo['status']; 
     78    } 
     79 
     80    /** 
    6581     * Get profile info 
    6682     */ 
    6783    public function getInfo($iProfileId) { 
    68         return $this->_oQuery->getInfoById((int)$iProfileId ? $iAccountId : $this->_iProfileID); 
     84        return $this->_oQuery->getInfoById((int)$iProfileId ? $iProfileId : $this->_iProfileID); 
    6985    } 
    7086 
  • trunk/inc/classes/BxDolProfileFields.php

    r15588 r15733  
    4848        } 
    4949 
    50         $this -> aArea = $this -> aCache[ $this -> iAreaID ]; 
     50        $this -> aArea = isset($this -> aCache[ $this -> iAreaID ]) ? $this -> aCache[ $this -> iAreaID ] : false; 
    5151 
    5252        //load blocks 
  • trunk/inc/classes/BxDolSubscription.php

    r15334 r15733  
    244244            ) 
    245245        ); 
     246        bx_import('BxTemplFormView'); 
    246247        $oForm = new BxTemplFormView($aForm); 
    247248        $sContent .= PopupBox($this->_sVisitorPopup, _t('_sys_bcpt_subscribe'), $oForm->getCode(), array(), true); 
  • trunk/inc/classes/BxDolTemplate.php

    r15698 r15733  
    602602            $mixedKeywords[$iKey] = trim($sValue); 
    603603 
    604         $this->aPage['keywords'] = array_merge($this->aPage['keywords'], $mixedKeywords); 
     604        $this->aPage['keywords'] = isset($this->aPage['keywords']) && is_array($this->aPage['keywords']) ? array_merge($this->aPage['keywords'], $mixedKeywords) : $mixedKeywords; 
    605605    } 
    606606    /** 
  • trunk/inc/classes/BxDolTwigModule.php

    r15731 r15733  
    3030class BxDolTwigModule extends BxDolModule { 
    3131 
     32    var $_iAccountId; 
     33    var $_oAccount; 
     34 
    3235    var $_iProfileId; 
     36    var $_oProfile; 
     37 
    3338    var $_sPrefix; 
    3439    var $_sFilterName; 
     
    3641    function BxDolTwigModule(&$aModule) { 
    3742        parent::BxDolModule($aModule); 
    38         $this->_iProfileId = !empty($GLOBALS['logged']['member']) || !empty($GLOBALS['logged']['admin']) ? $_COOKIE['memberID'] : 0; 
     43        $this->_iAccountId = !empty($GLOBALS['logged']['member']) || !empty($GLOBALS['logged']['admin']) ? $_COOKIE['memberID'] : 0; 
     44        bx_import('BxDolAccount'); 
     45        $this->_oAccount = BxDolAccount::getInstance($this->_iAccountId); 
    3946    } 
    4047 
     
    264271 
    265272        if ($oForm->isSubmittedAndValid ()) { 
    266  
    267             $oForm->processMedia($iEntryId, $this->_iProfileId); 
    268273 
    269274            $this->$sIsAllowedFuncName($aDataEntry, true); // perform action 
     
    468473        bx_import ('SearchResult', $this->_aModule); 
    469474        $sClass = $this->_aModule['class_prefix'] . 'SearchResult'; 
    470         $o = new $sClass(process_db_input($sMode, BX_TAGS_STRIP), process_db_input($sValue, BX_TAGS_STRIP), process_db_input($sValue2, BX_TAGS_STRIP), process_db_input($sValue3, BX_TAGS_STRIP)); 
     475        $o = new $sClass(bx_process_input($sMode), bx_process_input($sValue), bx_process_input($sValue2), bx_process_input($sValue3)); 
    471476 
    472477        if ($o->isError) { 
     
    581586            return; 
    582587        } 
    583  
     588/* 
    584589        $GLOBALS['oTopMenu']->setCustomSubHeader($aDataEntry[$this->_oDb->_sFieldTitle]); 
    585590        $GLOBALS['oTopMenu']->setCustomVar($this->_sPrefix.'_view_uri', $aDataEntry[$this->_oDb->_sFieldUri]); 
     
    589594            $sTitle => '', 
    590595        )); 
    591  
     596*/ 
    592597        if (!$this->isAllowedEdit($aDataEntry)) { 
    593598            $this->_oTemplate->displayAccessDenied (); 
     
    610615            $aValsAdd = array ($this->_oDb->_sFieldStatus => $sStatus); 
    611616            if ($oForm->update ($iEntryId, $aValsAdd)) { 
    612  
    613                 $oForm->processMedia($iEntryId, $this->_iProfileId); 
    614617 
    615618                $this->isAllowedEdit($aDataEntry, true); // perform action 
     
    873876    // ================================== external actions 
    874877 
    875     function serviceGetForumPermission($iMemberId, $iForumId) { 
    876  
    877         $iMemberId = (int)$iMemberId; 
    878         $iForumId = (int)$iForumId; 
    879  
    880         $aFalse = array ( 
    881             'admin' => 0, 
    882             'read' => 0, 
    883             'post' => 0, 
    884         ); 
    885  
    886         if (!($aForum = $this->_oDb->getForumById ($iForumId))) 
    887             return $aFalse; 
    888  
    889         if (!($aDataEntry = $this->_oDb->getEntryById ($aForum['entry_id']))) 
    890             return $aFalse; 
    891  
    892         $aTrue = array ( 
    893             'admin' => $aDataEntry[$this->_oDb->_sFieldAuthorId] == $iMemberId || $this->isAdmin() ? 1 : 0, // author is admin 
    894             'read' => $this->isAllowedPostInForum ($aDataEntry, $iMemberId) ? 1 : 0, 
    895             'post' => $this->isAllowedPostInForum ($aDataEntry, $iMemberId) ? 1 : 0, 
    896         ); 
    897  
    898         return $aTrue; 
    899     } 
    900878 
    901879    function serviceDeleteProfileData ($iProfileId) { 
     
    11941172            $this->reparseCategories ($iEntryId); 
    11951173        } 
    1196         $this->_oDb->createForum ($aDataEntry, $this->_oDb->getProfileNickNameById($this->_iProfileId)); 
    11971174        $oAlert = new BxDolAlerts($this->_sPrefix, 'add', $iEntryId, $this->_iProfileId, array('Status' => $sStatus)); 
    11981175        $oAlert->alert(); 
     
    12301207        $oViews->onObjectDelete(); 
    12311208 
    1232         // delete forum 
    1233         $this->_oDb->deleteForum ($iEntryId); 
    1234  
    12351209        // arise alert 
    12361210        $oAlert = new BxDolAlerts($this->_sPrefix, 'delete', $iEntryId, $this->_iProfileId); 
     
    12941268 
    12951269    function isAdmin () { 
    1296         return $GLOBALS['logged']['admin'] && isProfileActive($this->_iProfileId); 
     1270        bx_import('BxDolProfile'); 
     1271        return $GLOBALS['logged']['admin']; // TODO: && $this->_oProfile->isActive(); 
    12971272    } 
    12981273 
     
    13191294 
    13201295                $this->isAllowedAdd(true); // perform action 
    1321  
    1322                 $oForm->processMedia($iEntryId, $this->_iProfileId); 
    13231296 
    13241297                $aDataEntry = $this->_oDb->getEntryByIdAndOwner($iEntryId, $this->_iProfileId, $this->isAdmin()); 
     
    13951368            return false; 
    13961369        } 
    1397  
     1370/* 
    13981371        $GLOBALS['oTopMenu']->setCustomSubHeader($aDataEntry[$this->_oDb->_sFieldTitle]); 
    13991372        $GLOBALS['oTopMenu']->setCustomVar($this->_sPrefix.'_view_uri', $aDataEntry[$this->_oDb->_sFieldUri]); 
     
    14031376            $sSubTab => '', 
    14041377        )); 
    1405  
     1378*/ 
    14061379        if ((!$this->_iProfileId || $aDataEntry[$this->_oDb->_sFieldAuthorId] != $this->_iProfileId) && !$this->isAllowedView($aDataEntry, true)) { 
    14071380            $this->_oTemplate->displayAccessDenied (); 
  • trunk/inc/classes/BxDolTwigModuleDb.php

    r15731 r15733  
    101101        if (!($iRet = $this->query ("DELETE FROM `" . $this->_sPrefix . $this->_sTableMain . "` WHERE `{$this->_sFieldId}` = $iId $sWhere LIMIT 1"))) 
    102102            return false; 
    103         $this->query ("DELETE FROM `" . $this->_sPrefix . $this->_sTableMediaPrefix . "files` WHERE `entry_id` = $iId"); 
    104103        $this->query ("DELETE FROM `" . $this->_sPrefix . $this->_sTableMediaPrefix . "images` WHERE `entry_id` = $iId"); 
    105         $this->query ("DELETE FROM `" . $this->_sPrefix . $this->_sTableMediaPrefix . "videos` WHERE `entry_id` = $iId"); 
    106104        return true; 
    107105    } 
     
    175173    } 
    176174 
    177     // forum functions 
    178  
    179     function getForumById ($iForumId) { 
    180         return $this->getRow ("SELECT * FROM `" . $this->_sPrefix . "forum` WHERE `forum_id` = '{$iForumId}' LIMIT 1"); 
    181     } 
    182  
    183     function createForum ($aDataEntry, $sUsername) { 
    184         $sForumTitle = process_db_input($aDataEntry[$this->_sFieldTitle], BX_TAGS_NO_ACTION, BX_SLASHES_NO_ACTION); 
    185         $sUsername = process_db_input($sUsername, BX_TAGS_NO_ACTION, BX_SLASHES_NO_ACTION); 
    186         return $this->query ("INSERT INTO `" . $this->_sPrefix . "forum` SET `forum_uri` = '{$aDataEntry[$this->_sFieldUri]}', `cat_id` = 1, `forum_title` = '{$sForumTitle}', `forum_desc` = '$sUsername', `forum_last` = UNIX_TIMESTAMP(), `forum_type` = 'public', `entry_id` = '{$aDataEntry[$this->_sFieldId]}'"); 
    187     } 
    188  
    189     function deleteForum ($iEntryId) { 
    190  
    191         global $gConf; 
    192         $gConf['db']['host'] = DATABASE_HOST; 
    193         $gConf['db']['db'] = DATABASE_NAME; 
    194         $gConf['db']['user'] = DATABASE_USER; 
    195         $gConf['db']['pwd'] = DATABASE_PASS; 
    196         $gConf['db']['port'] = DATABASE_PORT; 
    197         $gConf['db']['sock'] = DATABASE_SOCK; 
    198         $gConf['db']['prefix'] = $this->_sPrefix; 
    199  
    200         require_once (BX_DIRECTORY_PATH_CLASSES . 'Thing.php'); 
    201         require_once (BX_DIRECTORY_PATH_MODULES . 'boonex/forum/classes/ThingPage.php'); 
    202         require_once (BX_DIRECTORY_PATH_MODULES . 'boonex/forum/classes/Mistake.php'); 
    203         require_once (BX_DIRECTORY_PATH_MODULES . 'boonex/forum/classes/BxDb.php'); 
    204         require_once (BX_DIRECTORY_PATH_MODULES . 'boonex/forum/classes/DbAdmin.php'); 
    205  
    206         $db = new DbAdmin (); 
    207         $iForumId = $this->getOne ("SELECT `forum_id` FROM `" . $this->_sPrefix . "forum` WHERE `entry_id` = '{$iEntryId}'"); 
    208         return $db->deleteForumAll($iForumId); 
    209     } 
    210  
    211175    // profile functions 
    212176 
    213177    function getProfileNickNameById ($iId) { 
    214         $a = getProfileInfo($iId); 
    215         return $a['NickName']; 
     178        return 'Undefined'; // TODO: 
    216179    } 
    217180 
  • trunk/inc/classes/BxDolTwigPageView.php

    r15211 r15733  
    4747    function _blockInfo ($aData, $sFields = '') { 
    4848 
    49         $aAuthor = getProfileInfo($aData['author_id']); 
    50  
    51         $aVars = array ( 
    52             'author_thumb' => get_member_thumbnail($aAuthor['ID'], 'none'), 
     49        $aVars = array ( 
     50            'author_thumb' => '', // TODO: get_member_thumbnail($aAuthor['ID'], 'none'), 
    5351            'date' => getLocaleDate($aData['created'], BX_DOL_LOCALE_DATE_SHORT), 
    5452            'date_ago' => defineTimeInterval($aData['created']), 
     
    5654            'tags' => $this->_oTemplate->parseTags($aData['tags']), 
    5755            'fields' => $sFields, 
    58             'author_username' => $aAuthor['NickName'], 
    59             'author_url' => $aAuthor ? getProfileLink($aAuthor['ID']) : 'javascript:void(0)', 
     56            'author_username' => $aData['author_id'], // TODO: $aAuthor['NickName'], 
     57            'author_url' => '', // TODO: $aAuthor ? getProfileLink($aAuthor['ID']) : 'javascript:void(0)', 
    6058        ); 
    6159        return $this->_oTemplate->parseHtmlByName('entry_view_block_info', $aVars); 
     
    221219    function _blockFans($iPerPage, $sFuncIsAllowed = 'isAllowedViewFans', $sFuncGetFans = 'getFans') { 
    222220 
     221        return 'TODO: fans here'; 
     222/* 
    223223        if (!$this->_oMain->$sFuncIsAllowed($this->aDataEntry)) 
    224224            return ''; 
     
    258258 
    259259        return array($ret, array(), $aDBBottomMenu); 
     260*/ 
    260261    } 
    261262 
    262263    function _blockFansUnconfirmed($iFansLimit = 1000) { 
    263264 
     265        return 'TODO: unconfirmed fans here'; 
     266/* 
    264267        if (!$this->_oMain->isEntryAdmin($this->aDataEntry)) 
    265268            return ''; 
     
    293296        ); 
    294297        return $this->_oMain->_oTemplate->parseHtmlByName('manage_items_form', $aVars); 
     298*/ 
    295299    } 
    296300} 
  • trunk/inc/classes/BxDolTwigSearchResult.php

    r15731 r15733  
    6161        $sUrlStart .= (false === strpos($sUrlStart, '?') ? '?' : '&'); 
    6262 
    63         $oPaginate = new BxDolPaginate(array( 
     63        bx_import('BxTemplPaginate'); 
     64        $oPaginate = new BxTemplPaginate(array( 
    6465            'page_url' => $sUrlStart . 'page={page}&per_page={per_page}' . (false !== bx_get($this->sFilterName) ? '&' . $this->sFilterName . '=' . bx_get($this->sFilterName) : ''), 
    6566            'count' => $this->aCurrent['paginate']['totalNum'], 
    6667            'per_page' => $this->aCurrent['paginate']['perPage'], 
    6768            'page' => $this->aCurrent['paginate']['page'], 
    68             'per_page_changer' => true, 
    69             'page_reloader' => true, 
    70             'on_change_page' => '', 
    71             'on_change_per_page' => "document.location='" . $sUrlStart . "page=1&per_page=' + this.value + '" . (false !== bx_get($this->sFilterName) ? '&' . $this->sFilterName . '=' . bx_get($this->sFilterName) ."';": "';"), 
    7269        )); 
    7370 
  • trunk/inc/classes/BxDolTwigTemplate.php

    r15731 r15733  
    3838 
    3939    function parseHtmlByName ($sName, &$aVars) { 
    40         return parent::parseHtmlByName (strpos($sName, '.html', strlen($sName) - 5) ? $sName : $sName.'.html', $aVars); 
     40        return parent::parseHtmlByName (strlen($sName) > 5 && strpos($sName, '.html', strlen($sName) - 5) ? $sName : $sName.'.html', $aVars); 
    4141    } 
    4242 
  • trunk/inc/classes/BxDolVoting.php

    r15262 r15733  
    242242    function checkAction () 
    243243    { 
     244        require_once(BX_DIRECTORY_PATH_INC . 'membership_levels.inc.php'); 
    244245        if (isset($this->_checkActionResult)) 
    245246            return $this->_checkActionResult; 
  • trunk/inc/membership_levels.inc.php

    r15705 r15733  
    286286    $aLangFileParams[CHECK_ACTION_LANG_FILE_SITE_EMAIL] = $oDb->getParam('site_email'); 
    287287 
    288     if($aMembership['ID'] != MEMBERSHIP_ID_NON_MEMBER || $logged['admin']) { 
     288    if ($aMembership['ID'] != MEMBERSHIP_ID_NON_MEMBER || $logged['admin']) { 
    289289        $iDestID = $iProfileId; 
    290290        if (isAdmin() && $iForcedProfID > 0) { 
     
    294294 
    295295        if ($isCheckMemberStatus) { 
    296             $aActive = getProfileInfo( $iDestID ); 
    297             if ($aActive['Status'] != 'Active') { 
     296            bx_import('BxDolProfile'); 
     297            $oProfile = BxDolProfile::getInstance($iDestID); 
     298            if (!$oProfile || !$oProfile->isActive()) { 
    298299                $aResult[CHECK_ACTION_RESULT] = CHECK_ACTION_RESULT_NOT_ACTIVE; 
    299300                $aResult[CHECK_ACTION_MESSAGE] = _t_ext(CHECK_ACTION_MESSAGE_NOT_ACTIVE, $aLangFileParams); 
Note: See TracChangeset for help on using the changeset viewer.