Example #1
0
 function getBlockCode_ActionList()
 {
     $sCode = null;
     $sMainPrefix = $this->oConfig->getMainPrefix();
     bx_import('BxDolSubscription');
     $oSubscription = BxDolSubscription::getInstance();
     $aButton = $oSubscription->getButton($this->iProfileId, $sMainPrefix, '', (int) $this->aFileInfo['medID']);
     $sCode .= $oSubscription->getData();
     $aReplacement = array('favorited' => $this->aFileInfo['favorited'] == false ? '' : 'favorited', 'featured' => (int) $this->aFileInfo['Featured'], 'featuredCpt' => '', 'approvedCpt' => '', 'approvedAct' => '', 'moduleUrl' => BX_DOL_URL_ROOT . $this->oConfig->getBaseUri(), 'fileUri' => $this->aFileInfo['medUri'], 'iViewer' => $this->iProfileId, 'ID' => (int) $this->aFileInfo['medID'], 'Owner' => (int) $this->aFileInfo['medProfId'], 'OwnerName' => $this->aFileInfo['NickName'], 'AlbumUri' => $this->aFileInfo['albumUri'], 'sbs_' . $sMainPrefix . '_title' => $aButton['title'], 'sbs_' . $sMainPrefix . '_script' => $aButton['script'], 'shareCpt' => $this->oModule->isAllowedShare($this->aFileInfo) ? _t('_Share') : '', 'downloadCpt' => $this->oModule->isAllowedDownload($this->aFileInfo) ? _t('_Download') : '');
     if (isAdmin($this->iProfileId)) {
         $sMsg = $aReplacement['featured'] > 0 ? 'un' : '';
         $aReplacement['featuredCpt'] = _t('_' . $sMainPrefix . '_action_' . $sMsg . 'feature');
     }
     if ($this->oModule->isAllowedApprove($this->aFileInfo)) {
         $sMsg = '';
         $iAppr = 1;
         if ($this->aFileInfo['Approved'] == 'approved') {
             $sMsg = 'de';
             $iAppr = 0;
         }
         $aReplacement['approvedCpt'] = _t('_' . $sMainPrefix . '_admin_' . $sMsg . 'activate');
         $aReplacement['approvedAct'] = $iAppr;
     }
     $aReplacement['repostCpt'] = $aReplacement['repostScript'] = '';
     if (BxDolRequest::serviceExists('wall', 'get_repost_js_click')) {
         $sCode .= BxDolService::call('wall', 'get_repost_js_script');
         $aReplacement['repostCpt'] = _t('_Repost');
         $aReplacement['repostScript'] = BxDolService::call('wall', 'get_repost_js_click', array($this->iProfileId, $sMainPrefix, 'add', (int) $this->aFileInfo['medID']));
     }
     $sActionsList = $GLOBALS['oFunctions']->genObjectsActions($aReplacement, $sMainPrefix);
     if (is_null($sActionsList)) {
         return '';
     }
     return $sCode . $sActionsList;
 }
Example #2
0
 function uninstall($aParams)
 {
     if (BxDolRequest::serviceExists('wall', 'update_handlers')) {
         BxDolService::call('wall', 'update_handlers', array($this->_aConfig['home_uri'], false));
     }
     return parent::uninstall($aParams);
 }
Example #3
0
 function service($aToken)
 {
     if (!isAdmin($aToken['user_id'])) {
         $this->errorOutput(403, 'access_denied', 'Only admin can access service endpoint');
         return false;
     }
     bx_login($aToken['user_id'], false, false);
     $sUri = bx_get('uri');
     $sMethod = bx_get('method');
     if (!($aParams = bx_get('params'))) {
         $aParams = array();
     } elseif (is_string($aParams) && preg_match('/^a:[\\d+]:\\{/', $aParams)) {
         $aParams = @unserialize($aParams);
     }
     if (!is_array($aParams)) {
         $aParams = array($aParams);
     }
     if (!($sClass = bx_get('class'))) {
         $sClass = 'Module';
     }
     if (!BxDolRequest::serviceExists($sUri, $sMethod, $sClass)) {
         $this->errorOutput(404, 'not_found', 'Service was not found');
         return false;
     }
     $mixedRet = BxDolService::call($sUri, $sMethod, $aParams, $sClass);
     $this->output(array('uri' => $sUri, 'method' => $sMethod, 'data' => $mixedRet));
 }
 /**
  * Overwtire the method of parent class.
  *
  * @param BxDolAlerts $oAlert an instance of alert.
  */
 function response($oAlert)
 {
     $sKey = $oAlert->sUnit . '_' . $oAlert->sAction;
     $iCommentId = 0;
     switch ($oAlert->sAction) {
         case 'delete':
         case 'delete_poll':
         case 'delete_post':
             $this->_oModule->_oDb->deleteActivityByObject($oAlert->sUnit, $oAlert->iObject);
             return;
         case 'commentPost':
             if (!isset($oAlert->aExtras['comment_id']) || (int) $oAlert->aExtras['comment_id'] == 0) {
                 return;
             }
             $iCommentId = (int) $oAlert->aExtras['comment_id'];
             break;
         case 'commentRemoved':
             if (!isset($oAlert->aExtras['comment_id']) || (int) $oAlert->aExtras['comment_id'] == 0) {
                 return;
             }
             $this->_oModule->_oDb->deleteActivityByObject($oAlert->sUnit, $oAlert->iObject, (int) $oAlert->aExtras['comment_id']);
             return;
     }
     // call defined method;
     if (!is_array($this->aInternalHandlers) || !array_key_exists($sKey, $this->aInternalHandlers)) {
         return;
     }
     if (!BxDolRequest::serviceExists($this->aInternalHandlers[$sKey]['module_uri'], $this->aInternalHandlers[$sKey]['module_method'])) {
         return;
     }
     // define functions parameters;
     $aParams = array('action' => $oAlert->sAction, 'object_id' => $oAlert->iObject, 'sender_id' => $oAlert->iSender, 'extra_params' => $oAlert->aExtras);
     $aResult = BxDolService::call($this->aInternalHandlers[$sKey]['module_uri'], $this->aInternalHandlers[$sKey]['module_method'], $aParams);
     if (empty($aResult)) {
         return;
     }
     // create new event;
     // define recipent id;
     $iRecipientId = isset($aResult['recipient_id']) ? $aResult['recipient_id'] : $oAlert->iObject;
     if (isset($aResult['spy_type']) && $aResult['spy_type'] == 'content_activity' && $iRecipientId == $oAlert->iSender) {
         $iRecipientId = 0;
     }
     $iEventId = 0;
     if ($oAlert->iSender || !$oAlert->iSender && $this->_oModule->_oConfig->bTrackGuestsActivites) {
         $iEventId = $this->_oModule->_oDb->createActivity($oAlert->sUnit, $oAlert->sAction, $oAlert->iObject, $iCommentId, $oAlert->iSender, $iRecipientId, $aResult);
     }
     if (!$iEventId) {
         return;
     }
     // try to define all profile's friends;
     $aFriends = getMyFriendsEx($oAlert->iSender);
     if (empty($aFriends) || !is_array($aFriends)) {
         return;
     }
     // attach event to friends;
     foreach ($aFriends as $iFriendId => $aItems) {
         $this->_oModule->_oDb->attachFriendEvent($iEventId, $oAlert->iSender, $iFriendId);
     }
 }
Example #5
0
 public static function processAsAction($aModule, &$aRequest, $sClass = "Module")
 {
     $sClassRequire = $aModule['class_prefix'] . $sClass;
     $oModule = BxDolRequest::_require($aModule, $sClassRequire);
     $aVars = array('BaseUri' => $oModule->_oConfig->getBaseUri());
     $GLOBALS['oTopMenu']->setCustomSubActions($aVars, 'bx_store_title', false);
     return BxDolRequest::processAsAction($aModule, $aRequest, $sClass);
 }
Example #6
0
 function uninstall($aParams)
 {
     if (BxDolRequest::serviceExists('spy', 'update_handlers')) {
         BxDolService::call('spy', 'update_handlers', array($this->_aConfig['home_uri'], false));
     }
     $this->updateEmailTemplatesExceptions();
     return parent::uninstall($aParams);
 }
Example #7
0
 function uninstall($aParams)
 {
     if (BxDolRequest::serviceExists('payment', 'update_dependent_modules')) {
         BxDolService::call('payment', 'update_dependent_modules', array($this->_aConfig['home_uri'], false));
     }
     if (BxDolRequest::serviceExists('payflow', 'update_dependent_modules')) {
         BxDolService::call('payflow', 'update_dependent_modules', array($this->_aConfig['home_uri'], false));
     }
     return parent::uninstall($aParams);
 }
Example #8
0
 public static function call($mixed, $sMethod, $aParams = array(), $sClass = 'Module')
 {
     $oDb = new BxDolModuleDb();
     if (is_string($mixed)) {
         $aModule = $oDb->getModuleByUri($mixed);
     } else {
         $aModule = $oDb->getModuleById($mixed);
     }
     return empty($aModule) ? '' : BxDolRequest::processAsService($aModule, $sMethod, $aParams, $sClass);
 }
Example #9
0
 /**
  * Perform serice call
  * @param $mixed module name or module id
  * @param $sMethod service method name in format 'method_name', corresponding class metod is serviceMethodName
  * @param $aParams params to pass to service method
  * @param $sClass class to search for service method, by default it is main module class
  * @return service call result
  */
 public static function call($mixed, $sMethod, $aParams = array(), $sClass = 'Module')
 {
     bx_import('BxDolModuleQuery');
     $oDb = BxDolModuleQuery::getInstance();
     $aModule = array();
     if (is_string($mixed)) {
         $aModule = $oDb->getModuleByName($mixed);
     } else {
         $aModule = $oDb->getModuleById($mixed);
     }
     return empty($aModule) ? '' : BxDolRequest::processAsService($aModule, $sMethod, $aParams, $sClass);
 }
Example #10
0
 function uninstall($aParams)
 {
     if (BxDolRequest::serviceExists('wall', 'update_handlers')) {
         BxDolService::call('wall', 'update_handlers', array($this->_aConfig['home_uri'], false));
     }
     if (BxDolRequest::serviceExists('spy', 'update_handlers')) {
         BxDolService::call('spy', 'update_handlers', array($this->_aConfig['home_uri'], false));
     }
     $aResult = parent::uninstall($aParams);
     if ($aResult['result'] && BxDolModule::getInstance('BxWmapModule')) {
         BxDolService::call('wmap', 'part_uninstall', array('ads'));
     }
     return $aResult;
 }
Example #11
0
    function getBlockCode_ViewActions()
    {
        global $oFunctions;
        if ($this->_oSites->iOwnerId || $this->_oSites->isAdmin()) {
            $sCode = '';
            $aInfo = array('iViewer' => $this->_oSites->iOwnerId, 'ownerID' => (int) $this->_aSite['ownerid'], 'ID' => (int) $this->_aSite['id'], 'TitleEdit' => $this->_oSites->isAllowedEdit($this->_aSite) ? _t('_bx_sites_action_title_edit') : '', 'TitleDelete' => $this->_oSites->isAllowedDelete($this->_aSite) ? _t('_bx_sites_action_title_delete') : '', 'TitleShare' => $this->_oSites->isAllowedShare($this->_aSite) ? _t('_Share') : '', 'AddToFeatured' => $this->_oSites->isAllowedMarkAsFeatured($this->_aSite) && (int) $this->_aSite['allowView'] == BX_DOL_PG_ALL ? (int) $this->_aSite['featured'] == 1 ? _t('_bx_sites_action_remove_from_featured') : _t('_bx_sites_action_add_to_featured') : '');
            $oSubscription = BxDolSubscription::getInstance();
            $aButton = $oSubscription->getButton($this->_oSites->iOwnerId, 'bx_sites', '', $this->_aSite['id']);
            $sCode .= $oSubscription->getData();
            $aInfo['sbs_sites_title'] = $aButton['title'];
            $aInfo['sbs_sites_script'] = $aButton['script'];
            if (!$aInfo['TitleEdit'] && !$aInfo['TitleDelete'] && !$aInfo['TitleShare'] && !$aInfo['AddToFeatured'] && !$aInfo['sbs_sites_title']) {
                return '';
            }
            if ($aInfo['TitleShare']) {
                $sUrlSharePopup = BX_DOL_URL_ROOT . $this->_oSites->_oConfig->getBaseUri() . "share_popup/" . $this->_aSite['id'];
                $sCode .= <<<EOF
                    <script type="text/javascript">
                    function bx_site_show_share_popup ()
                    {
                        if (!\$('#bx_sites_share_popup').length) {
                            \$('<div id="bx_sites_share_popup" style="display: none;"></div>').prependTo('body');
                        }

                        \$('#bx_sites_share_popup').load(
                            '{$sUrlSharePopup}',
                            function() {
                                \$(this).dolPopup();
                            }
                        );
                    }
                    </script>
EOF;
            }
            $aInfo['repostCpt'] = $aInfo['repostScript'] = '';
            if (BxDolRequest::serviceExists('wall', 'get_repost_js_click')) {
                $sCode .= BxDolService::call('wall', 'get_repost_js_script');
                $aInfo['repostCpt'] = _t('_Repost');
                $aInfo['repostScript'] = BxDolService::call('wall', 'get_repost_js_click', array($this->_oSites->iOwnerId, 'bx_sites', 'add', (int) $this->_aSite['id']));
            }
            $aCodeActions = $oFunctions->genObjectsActions($aInfo, 'bx_sites');
            if (empty($aCodeActions)) {
                return '';
            }
            return $sCode . $aCodeActions;
        }
        return '';
    }
 function getSearchResultsNearMe($sUser, $sPwd, $sLang, $sLat, $sLng, $isOnlineOnly, $isWithPhotosOnly, $iStart, $iPP)
 {
     if (!($iId = BxDolXMLRPCUtil::checkLogin($sUser, $sPwd))) {
         return new xmlrpcresp(new xmlrpcval(array('error' => new xmlrpcval(1, "int")), "struct"));
     }
     BxDolXMLRPCUtil::setLanguage($sLang);
     $sLat = (double) $sLat;
     $sLng = (double) $sLng;
     if ((!$sLat || !$sLng) && BxDolRequest::serviceExists('wmap', 'get_location')) {
         $aLocation = BxDolService::call('wmap', 'get_location', array('profiles', $iId, $iId));
         if ($aLocation && !empty($aLocation['lat']) && !empty($aLocation['lng'])) {
             $sLat = $aLocation['lat'];
             $sLng = $aLocation['lng'];
         }
     }
     if (!$sLat || !$sLng) {
         return new xmlrpcval(array(), "array");
     }
     $sWhere = '';
     $sJoin = '';
     $sLocation = '';
     $sDistance = ", (POW({$sLat}-`loc`.`lat`, 2)+POW({$sLng}-`loc`.`lng`, 2)) AS `distance`";
     $sJoin .= " INNER JOIN `bx_wmap_locations` AS `loc` ON  (`loc`.`part` = 'profiles' AND `loc`.`id` = `Profiles`.`ID` AND `loc`.`failed` = 0) ";
     if ($isWithPhotosOnly) {
         $sWhere .= " AND `Avatar` ";
     }
     if ($isOnlineOnly) {
         $iOnlineTime = (int) getParam('member_online_time');
         $sWhere .= " AND `DateLastNav` >= DATE_SUB(NOW(), INTERVAL {$iOnlineTime} MINUTE)";
     }
     $iStart = (int) $iStart;
     if (!$iStart || $iStart < 0) {
         $iStart = 0;
     }
     $iPP = (int) $iPP;
     if (!$iPP || $iPP < 1) {
         $iPP = 1;
     }
     $r = db_res("\n            SELECT * " . $sDistance . " FROM `Profiles`\n            {$sJoin}\n            WHERE `Status` = 'Active' AND (`Profiles`.`Couple` = 0 OR `Profiles`.`Couple` > `Profiles`.`ID`) {$sWhere}\n            ORDER BY `distance` ASC\n            LIMIT {$iStart}, {$iPP}");
     while ($aRow = mysql_fetch_array($r)) {
         $aProfiles[] = new xmlrpcval(BxDolXMLRPCUtil::fillProfileArray($aRow, 'thumb'), 'struct');
     }
     return new xmlrpcval($aProfiles, "array");
 }
Example #13
0
 function load()
 {
     $oCache = $GLOBALS['MySQL']->getDbCacheObject();
     $this->aTopMenu = $oCache->getData($GLOBALS['MySQL']->genDbCacheKey('sys_menu_top'));
     if (null === $this->aTopMenu) {
         if (!$this->compile()) {
             return false;
         }
         $this->aTopMenu = $oCache->getData($GLOBALS['MySQL']->genDbCacheKey('sys_menu_top'));
     }
     if (!$this->aTopMenu or !is_array($this->aTopMenu)) {
         echo '<b>Warning!</b> Cannot evaluate Menu Cache.';
         return false;
     }
     if (BxDolRequest::serviceExists('pageac', 'menu_items_filter')) {
         BxDolService::call('pageac', 'menu_items_filter', array('top', &$this->aTopMenu));
     }
     return true;
 }
Example #14
0
 function saveChanges(&$oForm)
 {
     $aCategories = explode(',', $oForm->getCleanValue('categories'));
     foreach ($aCategories as $sCategory) {
         $aOptions = array();
         $iOptions = $this->oDb->getOptions(array('type' => 'by_category_name_full', 'value' => $sCategory), $aOptions);
         $aData = array();
         foreach ($aOptions as $aOption) {
             $aData[$aOption['name']] = $oForm->getCleanValue($aOption['name']);
             if (!empty($aOption['check'])) {
                 $sCheckerHelper = '';
                 if (!empty($aOption['type_name']) && BxDolRequest::serviceExists($aOption['type_name'], 'get_settings_checker_helper')) {
                     $sCheckerHelper = BxDolService::call($aOption['type_name'], 'get_settings_checker_helper');
                 }
                 if ($sCheckerHelper == '') {
                     bx_import('BxDolStudioForm');
                     $sCheckerHelper = 'BxDolStudioFormCheckerHelper';
                 }
                 $oChecker = new $sCheckerHelper();
                 $aCheckFunction = array($oChecker, 'check' . bx_gen_method_name($aOption['check']));
                 $aCheckFunctionParams = array($aData[$aOption['name']]);
                 if (!empty($aOption['check_params'])) {
                     $aCheckFunctionParams = array_merge($aCheckFunctionParams, unserialize($aOption['check_params']));
                 }
                 if (is_callable($aCheckFunction) && !call_user_func_array($aCheckFunction, $aCheckFunctionParams)) {
                     $this->sCategory = $sCategory;
                     return $this->getJsResult(_t('_adm_stg_err_save_error_message', _t($aOption['caption']), _t($aOption['check_error'])), false);
                 }
             }
             if (isset($aData[$aOption['name']])) {
                 $aData[$aOption['name']] = $this->getProcessedValue($aOption, $aData[$aOption['name']]);
             } else {
                 $aData[$aOption['name']] = $this->getEmptyValue($aOption);
             }
             if ($this->oDb->setParam($aOption['name'], $aData[$aOption['name']])) {
                 $aCategoryInfo = array();
                 $this->oDb->getCategories(array('type' => 'by_name', 'value' => $sCategory), $aCategoryInfo, false);
                 bx_alert('system', 'save_setting', 0, 0, array('category' => $aCategoryInfo, 'option' => $aOption['name'], 'value' => $aData[$aOption['name']]));
             }
         }
     }
     return $this->getJsResult('_adm_stg_scs_save');
 }
Example #15
0
 function uninstall($aParams)
 {
     if (BxDolRequest::serviceExists('wall', 'update_handlers')) {
         BxDolService::call('wall', 'update_handlers', array($this->_aConfig['home_uri'], false));
     }
     $aResult = parent::uninstall($aParams);
     if ($aResult['result']) {
         foreach ($this->_aConfig['install_permissions']['writable'] as $sDir) {
             $sPath = BX_DIRECTORY_PATH_MODULES . $this->_aConfig['home_dir'] . $sDir;
             if (is_dir($sPath)) {
                 bx_clear_folder($sPath);
             }
         }
         bx_import('BxDolCacheUtilities');
         $oCacheUtilities = new BxDolCacheUtilities();
         $oCacheUtilities->clear('users');
     }
     return $aResult;
 }
Example #16
0
 function getBlockCode_Actions()
 {
     global $oFunctions;
     if ($this->_oMain->_iProfileId || $this->_oMain->isAdmin()) {
         $sCode = '';
         $oSubscription = BxDolSubscription::getInstance();
         $aSubscribeButton = $oSubscription->getButton($this->_oMain->_iProfileId, 'bx_store', '', (int) $this->aDataEntry['id']);
         $sCode .= $oSubscription->getData();
         $aInfo = array('BaseUri' => $this->_oMain->_oConfig->getBaseUri(), 'iViewer' => $this->_oMain->_iProfileId, 'ownerID' => (int) $this->aDataEntry['author_id'], 'ID' => (int) $this->aDataEntry['id'], 'URI' => (int) $this->aDataEntry['uri'], 'ScriptSubscribe' => $aSubscribeButton['script'], 'TitleSubscribe' => $aSubscribeButton['title'], 'TitleEdit' => $this->_oMain->isAllowedEdit($this->aDataEntry) ? _t('_bx_store_action_title_edit') : '', 'TitleDelete' => $this->_oMain->isAllowedDelete($this->aDataEntry) ? _t('_bx_store_action_title_delete') : '', 'TitleShare' => $this->_oMain->isAllowedShare($this->aDataEntry) ? _t('_bx_store_action_title_share') : '', 'TitleBroadcast' => $this->_oMain->isAllowedBroadcast($this->aDataEntry) ? _t('_bx_store_action_title_broadcast') : '', 'AddToFeatured' => $this->_oMain->isAllowedMarkAsFeatured($this->aDataEntry) ? $this->aDataEntry['featured'] ? _t('_bx_store_action_remove_from_featured') : _t('_bx_store_action_add_to_featured') : '', 'TitleActivate' => method_exists($this->_oMain, 'isAllowedActivate') && $this->_oMain->isAllowedActivate($this->aDataEntry) ? _t('_bx_store_admin_activate') : '');
         if (BxDolRequest::serviceExists('wall', 'get_repost_js_click')) {
             $sCode .= BxDolService::call('wall', 'get_repost_js_script');
             $aInfo['repostCpt'] = _t('_Repost');
             $aInfo['repostScript'] = BxDolService::call('wall', 'get_repost_js_click', array($this->_oMain->_iProfileId, 'bx_store', 'add', (int) $this->aDataEntry['id']));
         }
         $sCodeActions = $oFunctions->genObjectsActions($aInfo, 'bx_store');
         if (empty($sCodeActions)) {
             return '';
         }
         return $sCode . $sCodeActions;
     }
     return '';
 }
Example #17
0
 /**
  * Overwtire the method of parent class.
  *
  * @param BxDolAlerts $oAlert an instance of alert.
  */
 function response($oAlert)
 {
     $sKey = $oAlert->sUnit . '_' . $oAlert->sAction;
     // call defined method;
     if (array_key_exists($sKey, $this->aInternalHandlers)) {
         if (BxDolRequest::serviceExists($this->aInternalHandlers[$sKey]['module_uri'], $this->aInternalHandlers[$sKey]['module_method'])) {
             // define functions parameters;
             $aParams = array('action' => $oAlert->sAction, 'object_id' => $oAlert->iObject, 'sender_id' => $oAlert->iSender, 'extra_params' => $oAlert->aExtras);
             $aResult = BxDolService::call($this->aInternalHandlers[$sKey]['module_uri'], $this->aInternalHandlers[$sKey]['module_method'], $aParams);
             if ($aResult) {
                 // create new event;
                 //define recipent id;
                 $iRecipientId = isset($aResult['recipient_id']) ? $aResult['recipient_id'] : $oAlert->iObject;
                 if (isset($aResult['spy_type']) && $aResult['spy_type'] == 'content_activity' && $iRecipientId == $oAlert->iSender) {
                     $iRecipientId = 0;
                 }
                 $iEventId = 0;
                 if ($oAlert->iSender == 0 || !$oAlert->iSender) {
                     if ($this->_oModule->_oConfig->bTrackGuestsActivites) {
                         $iEventId = $this->_oModule->_oDb->createActivity($oAlert->iSender, $iRecipientId, $aResult);
                     }
                 } else {
                     $iEventId = $this->_oModule->_oDb->createActivity($oAlert->iSender, $iRecipientId, $aResult);
                 }
                 if ($iEventId) {
                     // try to define all profile's friends;
                     $aFriends = getMyFriendsEx($oAlert->iSender);
                     if ($aFriends && is_array($aFriends)) {
                         foreach ($aFriends as $iFriendId => $aItems) {
                             // attach event to friends;
                             $this->_oModule->_oDb->attachFriendEvent($iEventId, $oAlert->iSender, $iFriendId);
                         }
                     }
                 }
             }
         }
     }
 }
Example #18
0
 function getBlockCode_Actions()
 {
     global $oFunctions;
     if ($this->_oMain->_iProfileId || $this->_oMain->isAdmin()) {
         $sCode = '';
         $oSubscription = BxDolSubscription::getInstance();
         $aSubscribeButton = $oSubscription->getButton($this->_oMain->_iProfileId, 'bx_events', '', (int) $this->aDataEntry['ID']);
         $sCode .= $oSubscription->getData();
         $isFan = $this->_oDb->isFan((int) $this->aDataEntry['ID'], $this->_oMain->_iProfileId, 0) || $this->_oDb->isFan((int) $this->aDataEntry['ID'], $this->_oMain->_iProfileId, 1);
         $this->aInfo = array('BaseUri' => $this->_oMain->_oConfig->getBaseUri(), 'iViewer' => $this->_oMain->_iProfileId, 'ownerID' => (int) $this->aDataEntry['ResponsibleID'], 'ID' => (int) $this->aDataEntry['ID'], 'URI' => $this->aDataEntry['EntryUri'], 'ScriptSubscribe' => $aSubscribeButton['script'], 'TitleSubscribe' => $aSubscribeButton['title'], 'TitleEdit' => $this->_oMain->isAllowedEdit($this->aDataEntry) ? _t('_bx_events_action_title_edit') : '', 'TitleDelete' => $this->_oMain->isAllowedDelete($this->aDataEntry) ? _t('_bx_events_action_title_delete') : '', 'TitleJoin' => $this->_oMain->isAllowedJoin($this->aDataEntry) ? $isFan ? _t('_bx_events_action_title_leave') : _t('_bx_events_action_title_join') : '', 'IconJoin' => $isFan ? 'sign-out' : 'sign-in', 'TitleInvite' => $this->_oMain->isAllowedSendInvitation($this->aDataEntry) ? _t('_bx_events_action_title_invite') : '', 'TitleShare' => $this->_oMain->isAllowedShare($this->aDataEntry) ? _t('_bx_events_action_title_share') : '', 'TitleBroadcast' => $this->_oMain->isAllowedBroadcast($this->aDataEntry) ? _t('_bx_events_action_title_broadcast') : '', 'AddToFeatured' => $this->_oMain->isAllowedMarkAsFeatured($this->aDataEntry) ? $this->aDataEntry['Featured'] ? _t('_bx_events_action_remove_from_featured') : _t('_bx_events_action_add_to_featured') : '', 'TitleManageFans' => $this->_oMain->isAllowedManageFans($this->aDataEntry) ? _t('_bx_events_action_manage_fans') : '', 'TitleUploadPhotos' => $this->_oMain->isAllowedUploadPhotos($this->aDataEntry) ? _t('_bx_events_action_upload_photos') : '', 'TitleUploadVideos' => $this->_oMain->isAllowedUploadVideos($this->aDataEntry) ? _t('_bx_events_action_upload_videos') : '', 'TitleUploadSounds' => $this->_oMain->isAllowedUploadSounds($this->aDataEntry) ? _t('_bx_events_action_upload_sounds') : '', 'TitleUploadFiles' => $this->_oMain->isAllowedUploadFiles($this->aDataEntry) ? _t('_bx_events_action_upload_files') : '', 'TitleActivate' => method_exists($this->_oMain, 'isAllowedActivate') && $this->_oMain->isAllowedActivate($this->aDataEntry) ? _t('_bx_events_admin_activate') : '');
         if (BxDolRequest::serviceExists('wall', 'get_repost_js_click')) {
             $sCode .= BxDolService::call('wall', 'get_repost_js_script');
             $this->aInfo['repostCpt'] = _t('_Repost');
             $this->aInfo['repostScript'] = BxDolService::call('wall', 'get_repost_js_click', array($this->_oMain->_iProfileId, 'bx_events', 'add', (int) $this->aDataEntry['ID']));
         }
         $sCodeActions = $oFunctions->genObjectsActions($this->aInfo, 'bx_events');
         if (empty($sCodeActions)) {
             return '';
         }
         return $sCode . $sCodeActions;
     }
     return '';
 }
Example #19
0
 function getBlockCode_ActionList()
 {
     $sCode = null;
     $sMainPrefix = $this->oConfig->getMainPrefix();
     bx_import('BxDolSubscription');
     $oSubscription = BxDolSubscription::getInstance();
     $aButton = $oSubscription->getButton($this->iProfileId, $sMainPrefix, '', (int) $this->aFileInfo['medID']);
     $sCode .= $oSubscription->getData();
     bx_import('BxDolAlbums');
     $sProfileAlbumUri = BxDolAlbums::getAbumUri($this->oConfig->getGlParam('profile_album_name'), $this->iProfileId);
     $aReplacement = array('favorited' => $this->aFileInfo['favorited'] == false ? '' : 'favorited', 'featured' => (int) $this->aFileInfo['Featured'], 'featuredCpt' => '', 'approvedCpt' => '', 'approvedAct' => '', 'moduleUrl' => BX_DOL_URL_ROOT . $this->oConfig->getBaseUri(), 'fileUri' => $this->aFileInfo['medUri'], 'fileKey' => $this->aFileInfo['Hash'], 'fileExt' => $this->aFileInfo['medExt'], 'iViewer' => $this->iProfileId, 'ID' => (int) $this->aFileInfo['medID'], 'Owner' => (int) $this->aFileInfo['medProfId'], 'OwnerName' => $this->aFileInfo['NickName'], 'AlbumUri' => $this->aFileInfo['albumUri'], 'Tags' => bx_php_string_apos($this->aFileInfo['medTags']), 'TitleAvatar' => $this->aFileInfo['medProfId'] == $this->iProfileId && 'sys_avatar' == getParam('sys_member_info_thumb') ? _t('_' . $sMainPrefix . '_set_as_avatar') : '', 'SetAvatarCpt' => $this->aFileInfo['medProfId'] == $this->iProfileId && $sProfileAlbumUri == $this->aFileInfo['albumUri'] && 'bx_photos_thumb' == getParam('sys_member_info_thumb') ? _t('_' . $sMainPrefix . '_set_as_avatar') : '', 'sbs_' . $sMainPrefix . '_title' => $aButton['title'], 'sbs_' . $sMainPrefix . '_script' => $aButton['script'], 'shareCpt' => $this->oModule->isAllowedShare($this->aFileInfo) ? _t('_Share') : '', 'cropCpt' => $this->oModule->isAllowedEdit($this->aFileInfo) && $this->aFileInfo['medProfId'] == $this->iProfileId ? _t('_bx_photos_crop_action') : '');
     if (isAdmin($this->iProfileId)) {
         $sMsg = $aReplacement['featured'] > 0 ? 'un' : '';
         $aReplacement['featuredCpt'] = _t('_' . $sMainPrefix . '_action_' . $sMsg . 'feature');
     }
     if ($this->oModule->isAllowedApprove($this->aFileInfo)) {
         $sMsg = '';
         $iAppr = 1;
         if ($this->aFileInfo['Approved'] == 'approved') {
             $sMsg = 'de';
             $iAppr = 0;
         }
         $aReplacement['approvedCpt'] = _t('_' . $sMainPrefix . '_admin_' . $sMsg . 'activate');
         $aReplacement['approvedAct'] = $iAppr;
     }
     $aReplacement['repostCpt'] = $aReplacement['repostScript'] = '';
     if (BxDolRequest::serviceExists('wall', 'get_repost_js_click')) {
         $sCode .= BxDolService::call('wall', 'get_repost_js_script');
         $aReplacement['repostCpt'] = _t('_Repost');
         $aReplacement['repostScript'] = BxDolService::call('wall', 'get_repost_js_click', array($this->iProfileId, $sMainPrefix, 'add', (int) $this->aFileInfo['medID']));
     }
     $sActionsList = $GLOBALS['oFunctions']->genObjectsActions($aReplacement, $sMainPrefix);
     if (is_null($sActionsList)) {
         return '';
     }
     return $sCode . $sActionsList;
 }
Example #20
0
 function _uploadImage($iProfileId = 0)
 {
     $iProfileId = (int) $iProfileId;
     $sImagePath = BX_AVA_DIR_TMP . ($iProfileId ? $iProfileId : $this->_iProfileId) . BX_AVA_EXT;
     $i = strrpos($_FILES['image']['name'], '.');
     if (false === $i) {
         return false;
     }
     $sExt = strtolower(substr($_FILES['image']['name'], $i + 1));
     if (!in_array($sExt, $this->_aAllowedExt)) {
         return false;
     }
     if (move_uploaded_file($_FILES['image']['tmp_name'], $sImagePath)) {
         if ($_POST['copy_to_profile_photos']) {
             if (BxDolRequest::serviceExists('photos', 'perform_photo_upload', 'Uploader')) {
                 $aFileInfo = array('medTitle' => _t('_bx_ava_avatar'), 'medDesc' => _t('_bx_ava_avatar'), 'medTags' => _t('_ProfilePhotos'), 'Categories' => array(_t('_ProfilePhotos')), 'album' => str_replace('{nickname}', getUsername($iProfileId), getParam('bx_photos_profile_album_name')), 'albumPrivacy' => BX_DOL_PG_ALL);
                 $_POST[BX_DOL_UPLOADER_EP_PREFIX . 'album'] = uriFilter($aFileInfo['album']);
                 BxDolService::call('photos', 'perform_photo_upload', array($sImagePath, $aFileInfo, false), 'Uploader');
             }
         }
         return IMAGE_ERROR_SUCCESS == imageResize($sImagePath, '', BX_AVA_PRE_RESIZE_W, BX_AVA_PRE_RESIZE_H, true) ? true : false;
     }
     return false;
 }
Example #21
0
 public function prolongSubscription($sOrderId)
 {
     if (!BxDolRequest::serviceExists($this->_sActiveUri, 'prolong_subscription')) {
         return '';
     }
     $aSrvParams = array($sOrderId);
     return BxDolService::call($this->_sActiveUri, 'prolong_subscription', $aSrvParams);
 }
Example #22
0
<?php

defined('BX_DOL') or die('hack attempt');
/**
 * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
 * CC-BY License - http://creativecommons.org/licenses/by/3.0/
 *
 * @defgroup    Accounts Accounts
 * @ingroup     DolphinModules
 *
 * @{
 */
require_once BX_DIRECTORY_PATH_INC . "design.inc.php";
bx_import('BxDolLanguages');
BxDolRequest::processAsAction($GLOBALS['aModule'], $GLOBALS['aRequest']);
/** @} */
Example #23
0
function getPageMainCode()
{
    $oTemplate = BxDolStudioTemplate::getInstance();
    $oTemplate->addJs(array('jquery.form.min.js'));
    $oTemplate->addCss(array('splash.css'));
    $oForm = new BxDolSplashForm($oTemplate);
    $oForm->initChecker();
    if ($oForm->isSubmittedAndNotValid()) {
        $oForm->_echoResultJson(array('err' => $oForm->getNotValid()), true);
        exit;
    }
    if ($oForm->isSubmittedAndValid()) {
        $sDomainKey = 'domain';
        $sDomainValue = $oForm->getCleanValue($sDomainKey);
        if (!BxDolRequest::serviceExists('bx_sites', 'is_used')) {
            $oForm->_echoResultJson(array('msg' => _t('_sys_splash_err_service_not_available')), true);
            exit;
        }
        if (BxDolService::call('bx_sites', 'is_used', array($sDomainValue))) {
            $oForm->_echoResultJson(array('err' => array($sDomainKey => _t('_sys_splash_err_domain_is_used'))), true);
            exit;
        }
        bx_import('BxDolSession');
        BxDolSession::getInstance()->setValue('bx_sites_domain', $sDomainValue);
        bx_import('BxDolPermalinks');
        $sUrl = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=create-account');
        $oForm->_echoResultJson(array('eval' => 'window.open(\'' . $sUrl . '\', \'_self\');'), true);
        exit;
    }
    return $oTemplate->parseHtmlByName('splash.html', array('form_id' => $oForm->aFormAttrs['id'], 'form' => $oForm->getCode()));
}
Example #24
0
 function __construct($oMain, $iProfileId, $isRemovePhotoFieldAllowed = true, $iEntryId = 0, $iThumb = 0)
 {
     $this->_aMedia = array();
     if (BxDolRequest::serviceExists('photos', 'perform_photo_upload', 'Uploader')) {
         $this->_aMedia['images'] = array('post' => 'ready_images', 'upload_func' => 'uploadPhotos', 'tag' => BX_STORE_PHOTOS_TAG, 'cat' => BX_STORE_PHOTOS_CAT, 'thumb' => 'thumb', 'module' => 'photos', 'title_upload_post' => 'images_titles', 'title_upload' => _t('_bx_store_form_caption_file_title'), 'service_method' => 'get_photo_array');
     }
     if (BxDolRequest::serviceExists('videos', 'perform_video_upload', 'Uploader')) {
         $this->_aMedia['videos'] = array('post' => 'ready_videos', 'upload_func' => 'uploadVideos', 'tag' => BX_STORE_VIDEOS_TAG, 'cat' => BX_STORE_VIDEOS_CAT, 'thumb' => false, 'module' => 'videos', 'title_upload' => _t('_bx_store_form_caption_file_title'), 'service_method' => 'get_video_array');
     }
     $this->_oMain = $oMain;
     $this->_oDb = $oMain->_oDb;
     bx_import('BxDolCategories');
     $oCategories = new BxDolCategories();
     $oCategories->getTagObjectConfig();
     // generate templates for form custom elements
     $aCustomMediaTemplates = $this->generateCustomMediaTemplates($iProfileId, $iEntryId, $iThumb);
     // files
     $aFilesChoiceOrig = $this->_getFilesInEntry('files', 'get_file_array', 'ready_files', 'files', (int) $iProfileId, $iEntryId);
     $aFilesChoice = array();
     $sCurrencySign = getParam('pmt_default_currency_sign');
     foreach ($aFilesChoiceOrig as $k => $r) {
         if (!$r['checked']) {
             continue;
         }
         $a = $GLOBALS['oBxStoreModule']->_oDb->getFileInfo($iEntryId, $r['id']);
         $r['file_id'] = $a['id'];
         $r['title'] .= ' - ' . $sCurrencySign . ' ' . $a['price'] . ' (' . $GLOBALS['oBxStoreModule']->getGroupName($a['allow_purchase_to']) . ')';
         $r['visibility'] = $a['hidden'] ? _t('_bx_store_product_file_hidden') : _t('_bx_store_product_file_visible');
         $aFilesChoice[] = $r;
     }
     $aVarsFilesChoice = array('bx_store_base_url' => $this->_oMain->_oConfig->getBaseUri(), 'bx_if:empty' => array('condition' => empty($aFilesChoice), 'content' => array()), 'bx_repeat:files' => $aFilesChoice);
     $aInputPrivacyPurchase = $GLOBALS['oBxStoreModule']->_oPrivacyProduct->getGroupChooser($iProfileId, 'store', 'purchase');
     foreach ($aInputPrivacyPurchase['values'] as $k => $r) {
         if ($r['key'] == BX_DOL_PG_ALL) {
             unset($aInputPrivacyPurchase['values'][$k]);
             break;
         }
     }
     require_once BX_DIRECTORY_PATH_INC . 'membership_levels.inc.php';
     $aMemberships = getMemberships();
     unset($aMemberships[MEMBERSHIP_ID_NON_MEMBER]);
     // unset Non-member
     unset($aMemberships[MEMBERSHIP_ID_STANDARD]);
     // unset member
     $aMemberships = array('' => '----') + $aMemberships;
     $aMembershipsValues = array();
     foreach ($aMemberships as $k => $v) {
         $aMembershipsValues[] = array('key' => $k ? 'm' . $k : $k, 'value' => $v);
     }
     $aInputPrivacyPurchase['values'] = array_merge($aInputPrivacyPurchase['values'], $aMembershipsValues);
     /*
            if (empty($aInputPrivacyPurchase['value']) || !$aInputPrivacyPurchase['value'])
                $aInputPrivacyPurchase['value'] = BX_DOL_PG_MEMBERS;
     */
     $sInputPrivacyPurchase = str_replace('name="allow_purchase_to"', 'name="allow_purchase_to[]"', $this->genInputSelect($aInputPrivacyPurchase));
     $aVarsFilesUpload = array('file' => 'files', 'title' => 'files_titles', 'file_upload_title' => _t('_bx_store_form_caption_file_title'), 'bx_if:price' => array('condition' => true, 'content' => array('price' => 'files_prices', 'file_price_title' => _t('_bx_store_form_caption_file_price'))), 'bx_if:privacy' => array('condition' => true, 'content' => array('select' => $sInputPrivacyPurchase, 'file_permission_title' => _t('_bx_store_form_caption_file_allow_purcase_to'))));
     // privacy
     $aInputPrivacyCustom = array();
     $aInputPrivacyCustom[] = array('key' => '', 'value' => '----');
     $aInputPrivacyCustom[] = array('key' => 'c', 'value' => _t('_bx_store_privacy_customers_only'));
     $aInputPrivacyPostInForum = $GLOBALS['oBxStoreModule']->_oPrivacyProduct->getGroupChooser($iProfileId, 'store', 'post_in_forum');
     $aInputPrivacyPostInForum['values'] = array_merge($aInputPrivacyPostInForum['values'], $aInputPrivacyCustom);
     $aInputPrivacyPostInForum['db'] = array('pass' => 'Preg', 'params' => array('/^([0-9c]+)$/'));
     $aInputPrivacyViewForum = $GLOBALS['oBxStoreModule']->_oPrivacyProduct->getGroupChooser($iProfileId, 'store', 'view_forum');
     $aInputPrivacyViewForum['values'] = array_merge($aInputPrivacyViewForum['values'], $aInputPrivacyCustom);
     $aInputPrivacyViewForum['db'] = $aInputPrivacyPostInForum['db'];
     $aCustomForm = array('form_attrs' => array('name' => 'form_store', 'action' => '', 'method' => 'post', 'enctype' => 'multipart/form-data'), 'params' => array('db' => array('table' => 'bx_store_products', 'key' => 'id', 'uri' => 'uri', 'uri_title' => 'title', 'submit_name' => 'submit_form')), 'inputs' => array('header_info' => array('type' => 'block_header', 'caption' => _t('_bx_store_form_header_info')), 'title' => array('type' => 'text', 'name' => 'title', 'caption' => _t('_bx_store_form_caption_title'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(3, 100), 'error' => _t('_bx_store_form_err_title')), 'db' => array('pass' => 'Xss')), 'desc' => array('type' => 'textarea', 'name' => 'desc', 'caption' => _t('_bx_store_form_caption_desc'), 'required' => true, 'html' => 2, 'checker' => array('func' => 'length', 'params' => array(20, 64000), 'error' => _t('_bx_store_form_err_desc')), 'db' => array('pass' => 'XssHtml')), 'tags' => array('type' => 'text', 'name' => 'tags', 'caption' => _t('_Tags'), 'info' => _t('_sys_tags_note'), 'required' => true, 'checker' => array('func' => 'avail', 'error' => _t('_bx_store_form_err_tags')), 'db' => array('pass' => 'Tags')), 'categories' => $oCategories->getGroupChooser('bx_store', (int) $iProfileId, true), 'header_images' => array('type' => 'block_header', 'caption' => _t('_bx_store_form_header_images'), 'collapsable' => true, 'collapsed' => false), 'thumb' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['images']['thumb_choice'], 'name' => 'thumb', 'caption' => _t('_bx_store_form_caption_thumb_choice'), 'info' => _t('_bx_store_form_info_thumb_choice'), 'required' => false, 'db' => array('pass' => 'Int')), 'images_choice' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['images']['choice'], 'name' => 'images_choice[]', 'caption' => _t('_bx_store_form_caption_images_choice'), 'info' => _t('_bx_store_form_info_images_choice'), 'required' => false), 'images_upload' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['images']['upload'], 'name' => 'images_upload[]', 'caption' => _t('_bx_store_form_caption_images_upload'), 'info' => _t('_bx_store_form_info_images_upload'), 'required' => false), 'header_videos' => array('type' => 'block_header', 'caption' => _t('_bx_store_form_header_videos'), 'collapsable' => true, 'collapsed' => false), 'videos_choice' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['videos']['choice'], 'name' => 'videos_choice[]', 'caption' => _t('_bx_store_form_caption_videos_choice'), 'info' => _t('_bx_store_form_info_videos_choice'), 'required' => false), 'videos_upload' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['videos']['upload'], 'name' => 'videos_upload[]', 'caption' => _t('_bx_store_form_caption_videos_upload'), 'info' => _t('_bx_store_form_info_videos_upload'), 'required' => false), 'header_files' => array('type' => 'block_header', 'caption' => _t('_bx_store_form_header_files'), 'collapsable' => true, 'collapsed' => false), 'files_choice' => array('type' => 'custom', 'content' => $aFilesChoice ? $GLOBALS['oBxStoreModule']->_oTemplate->parseHtmlByName('form_field_product_files_choice', $aVarsFilesChoice) : '', 'name' => 'files_choice[]', 'caption' => _t('_bx_store_form_caption_files_choice'), 'info' => _t('_bx_store_form_info_files_choice'), 'required' => false), 'files_upload' => array('type' => 'custom', 'content' => $GLOBALS['oBxStoreModule']->_oTemplate->parseHtmlByName('form_field_files_upload', $aVarsFilesUpload), 'name' => 'files_upload[]', 'caption' => _t('_bx_store_form_caption_files_upload'), 'info' => _t('_bx_store_form_info_files_upload'), 'required' => false), 'header_privacy' => array('type' => 'block_header', 'caption' => _t('_bx_store_form_header_privacy')), 'allow_view_product_to' => $GLOBALS['oBxStoreModule']->_oPrivacyProduct->getGroupChooser($iProfileId, 'store', 'view_product'), 'allow_post_in_forum_to' => $aInputPrivacyPostInForum, 'allow_view_forum_to' => $aInputPrivacyViewForum));
     if (!$aCustomForm['inputs']['images_choice']['content']) {
         unset($aCustomForm['inputs']['thumb']);
         unset($aCustomForm['inputs']['images_choice']);
     }
     if (!$aCustomForm['inputs']['videos_choice']['content']) {
         unset($aCustomForm['inputs']['videos_choice']);
     }
     if (!$aFilesChoice) {
         unset($aCustomForm['inputs']['files_choice']);
     }
     if (!isset($this->_aMedia['images'])) {
         unset($aCustomForm['inputs']['header_images']);
         unset($aCustomForm['inputs']['PrimPhoto']);
         unset($aCustomForm['inputs']['images_choice']);
         unset($aCustomForm['inputs']['images_upload']);
         unset($aCustomForm['inputs']['allow_upload_photos_to']);
     }
     if (!isset($this->_aMedia['videos'])) {
         unset($aCustomForm['inputs']['header_videos']);
         unset($aCustomForm['inputs']['videos_choice']);
         unset($aCustomForm['inputs']['videos_upload']);
         unset($aCustomForm['inputs']['allow_upload_videos_to']);
     }
     $aFormInputsSubmit = array('Submit' => array('type' => 'submit', 'name' => 'submit_form', 'value' => _t('_Submit')));
     $aCustomForm['inputs'] = array_merge($aCustomForm['inputs'], $aFormInputsSubmit);
     $this->processMembershipChecksForMediaUploads($aCustomForm['inputs']);
     parent::__construct($aCustomForm);
 }
Example #25
0
<?php

/***************************************************************************
*                            Dolphin Smart Community Builder
*                              -------------------
*     begin                : Mon Mar 23 2006
*     copyright            : (C) 2007 BoonEx Group
*     website              : http://www.boonex.com
* This file is part of Dolphin - Smart Community Builder
*
* Dolphin is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the
* License, or  any later version.
*
* Dolphin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
* You should have received a copy of the GNU General Public License along with Dolphin,
* see license.txt file; if not, write to marketing@boonex.com
***************************************************************************/
require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolRequest.php';
check_logged();
if (empty($aRequest[0]) || $aRequest[0] == 'index') {
    BxDolRequest::processAsFile($aModule, $aRequest);
} else {
    BxDolRequest::processAsAction($aModule, $aRequest);
}
Example #26
0
 protected function _genXmlUrl($a)
 {
     $sUrl = $this->_genUrl($a);
     if (BxDolRequest::serviceExists('pageac', 'is_url_accessable')) {
         if (!BxDolService::call('pageac', 'is_url_accessable', array($sUrl))) {
             return '';
         }
     }
     $s = "\t<url>\n";
     $s .= "\t\t<loc>" . $this->_escape($sUrl) . "</loc>\n";
     if (!empty($a[$this->_aQueryParts['field_date']])) {
         $s .= "\t\t<lastmod>" . $this->_genDate($a) . "</lastmod>\n";
     }
     if (!empty($this->_aSystem['changefreq'])) {
         $s .= "\t\t<changefreq>" . $this->_genChangeFreq($a) . "</changefreq>\n";
     }
     if (!empty($this->_aSystem['priority'])) {
         $s .= "\t\t<priority>" . $this->_aSystem['priority'] . "</priority>\n";
     }
     $s .= "\t</url>\n";
     return $s;
 }
Example #27
0
 function getActionsBlock()
 {
     if ($this->iPostViewType == 3 && $this->iViewingPostID > 0) {
         $iMemberID = (int) $this->aViewingPostInfo['OwnerID'];
         $aOwnerInfo = getProfileInfo($iMemberID);
         $sOwnerNickname = getNickName($iMemberID);
         $aUser = array('Permalink' => $aOwnerInfo['NickName'], 'Link' => $iMemberID);
         $sOwnerBlogLinkSub = $this->genBlogLink('show_member_blog_home', $aUser, '', '', '', true);
         $sApproveC = _t('_Approve');
         $sDisApproveC = _t('_Disapprove');
         $sFeatureItC = _t('_Feature it');
         $sDeFeatureItC = _t('_De-Feature it');
         $bApproveAllowed = $this->isAllowedApprove() ? 'true' : 'false';
         if ($this->_iVisitorID == $iMemberID && $iMemberID > 0 || $this->bAdminMode || $bApproveAllowed) {
             $iFeaturedStatus = $this->_oDb->getFeaturedStatus($this->iViewingPostID);
             $sFeatureC = (int) $iFeaturedStatus == 1 ? $sDeFeatureItC : $sFeatureItC;
             if ($this->bAdminMode || $bApproveAllowed == 'true') {
                 $iApproved = 0;
                 //0 = not changed; 1 = app; 2 = disapp;
                 if (bx_get('sa') == 'approve') {
                     //approve this post
                     $this->_oDb->setPostStatus($this->iViewingPostID, 'approval');
                     $this->onPostApproveDisapprove($this->iViewingPostID, true);
                     $iApproved = 1;
                 }
                 if (bx_get('sa') == 'disapprove') {
                     //disapprove this post
                     $this->_oDb->setPostStatus($this->iViewingPostID);
                     $this->onPostApproveDisapprove($this->iViewingPostID, false);
                     $iApproved = 2;
                 }
                 $sCurPostStatus = $this->_oDb->getActiveStatus($this->iViewingPostID);
                 switch ($iApproved) {
                     case 0:
                         $sSAAction = $sCurPostStatus == 'disapproval' ? 'approve' : 'disapprove';
                         $sSACaption = $sCurPostStatus == 'disapproval' ? $sApproveC : $sDisApproveC;
                         break;
                     case 1:
                         $sSAAction = 'disapprove';
                         $sSACaption = $sDisApproveC;
                         break;
                     case 2:
                         $sSAAction = 'approve';
                         $sSACaption = $sApproveC;
                         break;
                 }
             }
         }
         $sLink = $this->genBlogLink('show_member_blog_home', $aUser);
         $sViewingPostUri = $this->_oDb->getPostUriByID($this->iViewingPostID);
         $aViewingPost = array('Permalink' => $sViewingPostUri, 'Link' => $this->iViewingPostID);
         $sViewingPostLink = $this->genBlogLink('show_member_post', $aUser, '', $aViewingPost);
         $sLink = $this->genBlogLink('show_member_post', $aUser, '', $aViewingPost, '', true);
         $sProcessingFile = $this->genBlogSubUrl();
         bx_import('BxDolSubscription');
         $oSubscription = BxDolSubscription::getInstance();
         $aButton = $oSubscription->getButton($this->_iVisitorID, 'bx_' . $this->_oConfig->getUri(), '', $this->iViewingPostID);
         $sSubsAddon = $oSubscription->getData();
         $aActionKeys = array('edit_allowed' => $this->isAllowedPostEdit(-1) ? 'true' : 'false', 'visitor_id' => $this->_iVisitorID, 'owner_id' => $iMemberID, 'blog_owner_link' => $sOwnerBlogLinkSub, 'owner_title' => $sOwnerNickname, 'owner_name' => $aOwnerInfo['NickName'], 'admin_mode' => "'" . $this->bAdminMode . "'", 'post_id' => $this->iViewingPostID, 'post_featured' => (int) $iFeaturedStatus, 'sure_label' => _t('_Are_you_sure'), 'post_entry_url' => $sLink, 'post_inside_entry_url' => $sViewingPostLink, 'sSACaption' => $sSACaption, 'sSAAction' => $sSAAction, 'work_url' => $sProcessingFile, 'only_menu' => 0, 'sbs_blogs_title' => $aButton['title'], 'sbs_blogs_script' => $aButton['script'], 'site_url' => BX_DOL_URL_ROOT, 'allow_approve' => $bApproveAllowed, 'base_url' => $this->sHomeUrl, 'TitleShare' => $this->isAllowedShare($this->aViewingPostInfo) ? _t('_Share') : '');
         if (BxDolRequest::serviceExists('wall', 'get_repost_js_click')) {
             $sSubsAddon .= BxDolService::call('wall', 'get_repost_js_script');
             $aActionKeys['repostCpt'] = _t('_Repost');
             $aActionKeys['repostScript'] = BxDolService::call('wall', 'get_repost_js_click', array($this->_iVisitorID, 'bx_blogs', 'create', $this->iViewingPostID));
         }
         $sActionsVal = $GLOBALS['oFunctions']->genObjectsActions($aActionKeys, 'bx_blogs', false);
         return $sSubsAddon . $sActionsVal;
     }
 }
 function __construct()
 {
     parent::__construct();
 }
 /**
  * Assign avatar to user
  *
  * @param $sAvatarUrl string
  * @return void
  */
 function _assignAvatar($sAvatarUrl, $iProfileId = false)
 {
     if (!$iProfileId) {
         $iProfileId = getLoggedId();
     }
     if (BxDolInstallerUtils::isModuleInstalled('avatar')) {
         BxDolService::call('avatar', 'make_avatar_from_image_url', array($sAvatarUrl));
     }
     if (BxDolRequest::serviceExists('photos', 'perform_photo_upload', 'Uploader')) {
         bx_import('BxDolPrivacyQuery');
         $oPrivacy = new BxDolPrivacyQuery();
         $sTmpFile = tempnam($GLOBALS['dir']['tmp'], 'bxoauth');
         if (false !== file_put_contents($sTmpFile, bx_file_get_contents($sAvatarUrl))) {
             $aFileInfo = array('medTitle' => _t('_sys_member_thumb_avatar'), 'medDesc' => _t('_sys_member_thumb_avatar'), 'medTags' => _t('_ProfilePhotos'), 'Categories' => array(_t('_ProfilePhotos')), 'album' => str_replace('{nickname}', getUsername($iProfileId), getParam('bx_photos_profile_album_name')), 'albumPrivacy' => $oPrivacy->getDefaultValueModule('photos', 'album_view'));
             BxDolService::call('photos', 'perform_photo_upload', array($sTmpFile, $aFileInfo, false), 'Uploader');
             @unlink($sTmpFile);
         }
     }
 }
Example #30
0
 protected function actionUpdateRelations($sOperation)
 {
     if (!in_array($sOperation, array('install', 'uninstall', 'enable', 'disable'))) {
         return BX_DOL_STUDIO_INSTALLER_FAILED;
     }
     if (empty($this->_aConfig['relations']) || !is_array($this->_aConfig['relations'])) {
         return BX_DOL_STUDIO_INSTALLER_SUCCESS;
     }
     foreach ($this->_aConfig['relations'] as $sModule) {
         if (!$this->oDb->isModuleByName($sModule)) {
             continue;
         }
         $aRelation = $this->oDb->getRelationsBy(array('type' => 'module', 'value' => $sModule));
         if (empty($aRelation) || empty($aRelation['on_' . $sOperation]) || !BxDolRequest::serviceExists($aRelation['module'], $aRelation['on_' . $sOperation])) {
             continue;
         }
         BxDolService::call($aRelation['module'], $aRelation['on_' . $sOperation], array($this->_aConfig['home_uri']));
     }
     return BX_DOL_STUDIO_INSTALLER_SUCCESS;
 }