コード例 #1
0
ファイル: installer.php プロジェクト: dalinhuang/shopexts
 function uninstall($aParams)
 {
     if (BxDolRequest::serviceExists('wall', 'update_handlers')) {
         BxDolService::call('wall', 'update_handlers', array($this->_aConfig['home_uri'], false));
     }
     return parent::uninstall($aParams);
 }
コード例 #2
0
ファイル: BxOAuthAPI.php プロジェクト: blas-dmx/trident
 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));
 }
コード例 #3
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;
 }
コード例 #4
0
 /**
  * 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);
     }
 }
コード例 #5
0
ファイル: installer.php プロジェクト: dalinhuang/shopexts
 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);
 }
コード例 #6
0
ファイル: installer.php プロジェクト: toxalot/dolphin.pro
 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);
 }
コード例 #7
0
ファイル: installer.php プロジェクト: Gotgot59/dolphin.pro
 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;
 }
コード例 #8
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 '';
    }
コード例 #9
0
 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");
 }
コード例 #10
0
ファイル: installer.php プロジェクト: toxalot/dolphin.pro
 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;
 }
コード例 #11
0
ファイル: BxDolMenu.php プロジェクト: Gotgot59/dolphin.pro
 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;
 }
コード例 #12
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');
 }
コード例 #13
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 '';
 }
コード例 #14
0
ファイル: BxSpyResponse.php プロジェクト: dalinhuang/shopexts
 /**
  * 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);
                         }
                     }
                 }
             }
         }
     }
 }
コード例 #15
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 '';
 }
コード例 #16
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;
 }
コード例 #17
0
ファイル: BxAvaModule.php プロジェクト: noormcs/studoro
 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;
 }
コード例 #18
0
ファイル: splash.php プロジェクト: blas-dmx/trident
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()));
}
コード例 #19
0
 public function prolongSubscription($sOrderId)
 {
     if (!BxDolRequest::serviceExists($this->_sActiveUri, 'prolong_subscription')) {
         return '';
     }
     $aSrvParams = array($sOrderId);
     return BxDolService::call($this->_sActiveUri, 'prolong_subscription', $aSrvParams);
 }
コード例 #20
0
ファイル: BxDolSiteMaps.php プロジェクト: Arvindvi/dolphin
 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;
 }
コード例 #21
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);
 }
コード例 #22
0
 /**
  * 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);
         }
     }
 }
コード例 #23
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;
     }
 }
コード例 #24
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;
 }
コード例 #25
0
 protected function _updateModuleData($sAction, $sModuleUri)
 {
     $sMethod = $this->_oConfig->getHandlersMethod();
     $aModule = $this->_oDb->getModuleByUri($sModuleUri);
     if (!BxDolRequest::serviceExists($aModule, $sMethod)) {
         return;
     }
     $aData = BxDolService::call($aModule['name'], $sMethod);
     if (empty($aData) || !is_array($aData)) {
         return;
     }
     switch ($sAction) {
         case 'add_handlers':
             $this->_oDb->insertData($aData);
             BxDolAlerts::cacheInvalidate();
             $this->_oDb->activateModuleEvents($aData, true);
             break;
         case 'delete_handlers':
             $this->_oDb->deleteData($aData);
             BxDolAlerts::cacheInvalidate();
             $this->_oDb->activateModuleEvents($aData, false);
             break;
         case 'delete_module_events':
             $this->_oDb->deleteModuleEvents($aData);
             break;
     }
 }
コード例 #26
0
ファイル: BxWallModule.php プロジェクト: noormcs/studoro
 function serviceUpdateHandlers($sModuleUri = 'all', $bInstall = true)
 {
     $aModules = $sModuleUri == 'all' ? $this->_oDb->getModules() : array($this->_oDb->getModuleByUri($sModuleUri));
     foreach ($aModules as $aModule) {
         if (!BxDolRequest::serviceExists($aModule, 'get_wall_data')) {
             continue;
         }
         $aData = BxDolService::call($aModule['uri'], 'get_wall_data');
         if ($bInstall) {
             $this->_oDb->insertData($aData);
         } else {
             $this->_oDb->deleteData($aData);
         }
     }
     BxDolAlerts::cache();
 }
コード例 #27
0
 function registerMember()
 {
     $oPC = new BxDolProfilesController();
     $oZ = new BxDolAlerts('profile', 'before_join', 0, 0, $this->aValues[0]);
     $oZ->alert();
     $aProfile1 = $this->oPF->getProfileFromValues($this->aValues[0]);
     if (empty($aProfile1['NickName'])) {
         $aProfile1['NickName'] = uriGenerate(empty($aProfile1['FirstName']) ? genRndPwd(10, false) : $aProfile1['FirstName'], 'Profiles', 'NickName');
     }
     list($iId1, $sStatus1) = $oPC->createProfile($aProfile1);
     //--- check whether profile was created successfully or not
     if (!$iId1) {
         if (isset($aProfile1['ProfilePhoto']) && !empty($aProfile1['ProfilePhoto'])) {
             @unlink($GLOBALS['dir']['tmp'] . $aProfile1['ProfilePhoto']);
         }
         return array(false, 'Fail');
     }
     //--- check for couple profile
     if ($this->bCouple) {
         $aProfile2 = $this->oPF->getProfileFromValues($this->aValues[1]);
         list($iId2, $sStatus2) = $oPC->createProfile($aProfile2, false, $iId1);
         if (!$iId2) {
             $oPC->deleteProfile($iId1);
             return array(false, 'Fail');
         }
     }
     //--- upload profile photo
     if (isset($aProfile1['ProfilePhoto']) && !empty($aProfile1['ProfilePhoto'])) {
         $sPass1 = getPassword($iId1);
         bx_login($iId1);
         check_logged();
         BxDolService::call('avatar', 'set_image_for_cropping', array($iId1, $GLOBALS['dir']['tmp'] . $aProfile1['ProfilePhoto']));
         if (BxDolRequest::serviceExists('photos', 'perform_photo_upload', 'Uploader')) {
             $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($iId1), getParam('bx_photos_profile_album_name')), 'albumPrivacy' => BX_DOL_PG_ALL);
             BxDolService::call('photos', 'perform_photo_upload', array($GLOBALS['dir']['tmp'] . $aProfile1['ProfilePhoto'], $aFileInfo, false), 'Uploader');
         }
     }
     if (BxDolModule::getInstance('BxWmapModule')) {
         BxDolService::call('wmap', 'response_entry_add', array('profiles', $iId1));
     }
     //--- create system event
     bx_import('BxDolAlerts');
     $oZ = new BxDolAlerts('profile', 'join', $iId1, 0, array('status_text' => &$sStatus1));
     $oZ->alert();
     return array($iId1, $sStatus1);
 }
コード例 #28
0
/**
 * Print code for membership status
 * $memberID - member ID
 * $offer_upgrade - will this code be printed at [c]ontrol [p]anel
 */
function GetMembershipStatus($memberID, $bOfferUpgrade = true, $bViewActions = true)
{
    $ret = '';
    $aMembership = getMemberMembershipInfo($memberID);
    $sViewActions = $bViewActions ? "<a onclick=\"javascript:loadHtmlInPopup('explanation_popup', '" . BX_DOL_URL_ROOT . "explanation.php?explain=membership&amp;type=" . $aMembership['ID'] . "');\" href=\"javascript:void(0);\">" . _t("_VIEW_MEMBERSHIP_ACTIONS") . "</a>" : "";
    // Show colored membership name
    if ($aMembership['ID'] == MEMBERSHIP_ID_STANDARD) {
        $ret .= $aMembership['Name'];
        if ($bOfferUpgrade && BxDolRequest::serviceExists('membership', 'get_upgrade_url')) {
            $sViewActions = _t('_MEMBERSHIP_UPGRADE_FROM_STANDARD', BxDolService::call('membership', 'get_upgrade_url')) . '<span class="sys-bullet"></span>' . $sViewActions;
        }
        $ret .= '<br />' . $sViewActions;
    } else {
        $ret .= '<font color="red">' . $aMembership['Name'] . '</font>';
        $sExpiration = '';
        if (!is_null($aMembership['DateExpires'])) {
            $sExpiration = _t("_MEMBERSHIP_EXPIRES", defineTimeInterval($aMembership['DateExpires']));
        } else {
            $sExpiration = _t("_MEMBERSHIP_EXPIRES_NEVER");
        }
        $ret .= '<br />' . $sViewActions . '<span class="sys-bullet"></span>' . $sExpiration;
    }
    return $ret;
}
コード例 #29
0
 function __construct($oMain, $iProfileId, $iEntryId = 0, $iThumb = 0)
 {
     $this->_oMain = $oMain;
     $this->_oDb = $oMain->_oDb;
     $this->_aMedia = array();
     if (BxDolRequest::serviceExists('photos', 'perform_photo_upload', 'Uploader')) {
         $this->_aMedia['images'] = array('post' => 'ready_images', 'upload_func' => 'uploadPhotos', 'tag' => BX_EVENTS_PHOTOS_TAG, 'cat' => BX_EVENTS_PHOTOS_CAT, 'thumb' => 'PrimPhoto', 'module' => 'photos', 'title_upload_post' => 'images_titles', 'title_upload' => _t('_bx_events_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_EVENTS_VIDEOS_TAG, 'cat' => BX_EVENTS_VIDEOS_CAT, 'thumb' => false, 'module' => 'videos', 'title_upload_post' => 'videos_titles', 'title_upload' => _t('_bx_events_form_caption_file_title'), 'service_method' => 'get_video_array');
     }
     if (BxDolRequest::serviceExists('sounds', 'perform_music_upload', 'Uploader')) {
         $this->_aMedia['sounds'] = array('post' => 'ready_sounds', 'upload_func' => 'uploadSounds', 'tag' => BX_EVENTS_SOUNDS_TAG, 'cat' => BX_EVENTS_SOUNDS_CAT, 'thumb' => false, 'module' => 'sounds', 'title_upload_post' => 'sounds_titles', 'title_upload' => _t('_bx_events_form_caption_file_title'), 'service_method' => 'get_music_array');
     }
     if (BxDolRequest::serviceExists('files', 'perform_file_upload', 'Uploader')) {
         $this->_aMedia['files'] = array('post' => 'ready_files', 'upload_func' => 'uploadFiles', 'tag' => BX_EVENTS_FILES_TAG, 'cat' => BX_EVENTS_FILES_CAT, 'thumb' => false, 'module' => 'files', 'title_upload_post' => 'files_titles', 'title_upload' => _t('_bx_events_form_caption_file_title'), 'service_method' => 'get_file_array');
     }
     bx_import('BxDolCategories');
     $oCategories = new BxDolCategories();
     $oCategories->getTagObjectConfig();
     $oProfileFields = new BxDolProfileFields(0);
     $aCountries = $oProfileFields->convertValues4Input('#!Country');
     // generate templates for form custom elements
     $aCustomMediaTemplates = $this->generateCustomMediaTemplates($this->_oMain->_iProfileId, $iEntryId, $iThumb);
     // privacy
     $aInputPrivacyCustom = array();
     $aInputPrivacyCustom[] = array('key' => '', 'value' => '----');
     $aInputPrivacyCustom[] = array('key' => 'p', 'value' => _t('_bx_events_privacy_participants_only'));
     $aInputPrivacyCustomPass = array('pass' => 'Preg', 'params' => array('/^([0-9p]+)$/'));
     $aInputPrivacyCustom2 = array(array('key' => 'p', 'value' => _t('_bx_events_privacy_participants')), array('key' => 'a', 'value' => _t('_bx_events_privacy_admins_only')));
     $aInputPrivacyCustom2Pass = array('pass' => 'Preg', 'params' => array('/^([pa]+)$/'));
     $aInputPrivacyViewParticipants = $GLOBALS['oBxEventsModule']->_oPrivacy->getGroupChooser($iProfileId, 'events', 'view_participants');
     $aInputPrivacyViewParticipants['values'] = array_merge($aInputPrivacyViewParticipants['values'], $aInputPrivacyCustom);
     $aInputPrivacyComment = $GLOBALS['oBxEventsModule']->_oPrivacy->getGroupChooser($iProfileId, 'events', 'comment');
     $aInputPrivacyComment['values'] = array_merge($aInputPrivacyComment['values'], $aInputPrivacyCustom);
     $aInputPrivacyComment['db'] = $aInputPrivacyCustomPass;
     $aInputPrivacyRate = $GLOBALS['oBxEventsModule']->_oPrivacy->getGroupChooser($iProfileId, 'events', 'rate');
     $aInputPrivacyRate['values'] = array_merge($aInputPrivacyRate['values'], $aInputPrivacyCustom);
     $aInputPrivacyRate['db'] = $aInputPrivacyCustomPass;
     $aInputPrivacyForum = $GLOBALS['oBxEventsModule']->_oPrivacy->getGroupChooser($iProfileId, 'events', 'post_in_forum');
     $aInputPrivacyForum['values'] = array_merge($aInputPrivacyForum['values'], $aInputPrivacyCustom);
     $aInputPrivacyForum['db'] = $aInputPrivacyCustomPass;
     $aInputPrivacyForumView = $GLOBALS['oBxEventsModule']->_oPrivacy->getGroupChooser($iProfileId, 'events', 'view_forum');
     $aInputPrivacyForumView['values'] = array_merge($aInputPrivacyForumView['values'], $aInputPrivacyCustom);
     $aInputPrivacyForumView['db'] = $aInputPrivacyCustomPass;
     $aInputPrivacyUploadPhotos = $this->_oMain->_oPrivacy->getGroupChooser($iProfileId, 'events', 'upload_photos');
     $aInputPrivacyUploadPhotos['values'] = $aInputPrivacyCustom2;
     $aInputPrivacyUploadPhotos['db'] = $aInputPrivacyCustom2Pass;
     $aInputPrivacyUploadVideos = $this->_oMain->_oPrivacy->getGroupChooser($iProfileId, 'events', 'upload_videos');
     $aInputPrivacyUploadVideos['values'] = $aInputPrivacyCustom2;
     $aInputPrivacyUploadVideos['db'] = $aInputPrivacyCustom2Pass;
     $aInputPrivacyUploadSounds = $this->_oMain->_oPrivacy->getGroupChooser($iProfileId, 'events', 'upload_sounds');
     $aInputPrivacyUploadSounds['values'] = $aInputPrivacyCustom2;
     $aInputPrivacyUploadSounds['db'] = $aInputPrivacyCustom2Pass;
     $aInputPrivacyUploadFiles = $this->_oMain->_oPrivacy->getGroupChooser($iProfileId, 'events', 'upload_files');
     $aInputPrivacyUploadFiles['values'] = $aInputPrivacyCustom2;
     $aInputPrivacyUploadFiles['db'] = $aInputPrivacyCustom2Pass;
     $aCustomForm = array('form_attrs' => array('name' => 'form_events', 'action' => '', 'method' => 'post', 'enctype' => 'multipart/form-data'), 'params' => array('db' => array('table' => 'bx_events_main', 'key' => 'ID', 'uri' => 'EntryUri', 'uri_title' => 'Title', 'submit_name' => 'submit_form')), 'inputs' => array('header_info' => array('type' => 'block_header', 'caption' => _t('_bx_events_form_header_info')), 'Title' => array('type' => 'text', 'name' => 'Title', 'caption' => _t('_bx_events_caption_title'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(3, 100), 'error' => _t('_bx_events_err_title')), 'db' => array('pass' => 'Xss')), 'Description' => array('type' => 'textarea', 'name' => 'Description', 'caption' => _t('_bx_events_caption_desc'), 'required' => true, 'html' => 2, 'checker' => array('func' => 'length', 'params' => array(20, 64000), 'error' => _t('_bx_events_err_desc')), 'db' => array('pass' => 'XssHtml')), 'Country' => array('type' => 'select', 'name' => 'Country', 'caption' => _t('_bx_events_caption_country'), 'values' => $aCountries, 'required' => true, 'checker' => array('func' => 'preg', 'params' => array('/^[a-zA-Z]{2}$/'), 'error' => _t('_bx_events_err_country')), 'db' => array('pass' => 'Preg', 'params' => array('/([a-zA-Z]{2})/'))), 'City' => array('type' => 'text', 'name' => 'City', 'caption' => _t('_bx_events_caption_city'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(3, 50), 'error' => _t('_bx_events_err_city')), 'db' => array('pass' => 'Xss')), 'Place' => array('type' => 'text', 'name' => 'Place', 'caption' => _t('_bx_events_caption_place'), 'required' => true, 'checker' => array('func' => 'avail', 'error' => _t('_bx_events_err_place')), 'db' => array('pass' => 'Xss')), 'EventStart' => array('type' => 'datetime', 'name' => 'EventStart', 'caption' => _t('_bx_events_caption_event_start'), 'required' => true, 'checker' => array('func' => 'DateTime', 'error' => _t('_bx_events_err_event_start')), 'db' => array('pass' => 'DateTimeUTC'), 'display' => 'filterDateUTC'), 'EventEnd' => array('type' => 'datetime', 'name' => 'EventEnd', 'caption' => _t('_bx_events_caption_event_end'), 'required' => true, 'checker' => array('func' => 'DateTime', 'error' => _t('_bx_events_err_event_end')), 'db' => array('pass' => 'DateTimeUTC'), 'display' => 'filterDateUTC'), 'Tags' => array('type' => 'text', 'name' => 'Tags', 'caption' => _t('_Tags'), 'info' => _t('_sys_tags_note'), 'required' => true, 'checker' => array('func' => 'avail', 'error' => _t('_bx_events_err_tags')), 'db' => array('pass' => 'Tags')), 'Categories' => $oCategories->getGroupChooser('bx_events', (int) $iProfileId, true), 'header_images' => array('type' => 'block_header', 'caption' => _t('_bx_events_form_header_images'), 'collapsable' => true, 'collapsed' => false), 'PrimPhoto' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['images']['thumb_choice'], 'name' => 'PrimPhoto', 'caption' => _t('_bx_events_form_caption_thumb_choice'), 'info' => _t('_bx_events_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_events_form_caption_images_choice'), 'info' => _t('_bx_events_form_info_images_choice'), 'required' => false), 'images_upload' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['images']['upload'], 'name' => 'images_upload[]', 'caption' => _t('_bx_events_form_caption_images_upload'), 'info' => _t('_bx_events_form_info_images_upload'), 'required' => false), 'header_videos' => array('type' => 'block_header', 'caption' => _t('_bx_events_form_header_videos'), 'collapsable' => true, 'collapsed' => false), 'videos_choice' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['videos']['choice'], 'name' => 'videos_choice[]', 'caption' => _t('_bx_events_form_caption_videos_choice'), 'info' => _t('_bx_events_form_info_videos_choice'), 'required' => false), 'videos_upload' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['videos']['upload'], 'name' => 'videos_upload[]', 'caption' => _t('_bx_events_form_caption_videos_upload'), 'info' => _t('_bx_events_form_info_videos_upload'), 'required' => false), 'header_sounds' => array('type' => 'block_header', 'caption' => _t('_bx_events_form_header_sounds'), 'collapsable' => true, 'collapsed' => false), 'sounds_choice' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['sounds']['choice'], 'name' => 'sounds_choice[]', 'caption' => _t('_bx_events_form_caption_sounds_choice'), 'info' => _t('_bx_events_form_info_sounds_choice'), 'required' => false), 'sounds_upload' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['sounds']['upload'], 'name' => 'sounds_upload[]', 'caption' => _t('_bx_events_form_caption_sounds_upload'), 'info' => _t('_bx_events_form_info_sounds_upload'), 'required' => false), 'header_files' => array('type' => 'block_header', 'caption' => _t('_bx_events_form_header_files'), 'collapsable' => true, 'collapsed' => false), 'files_choice' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['files']['choice'], 'name' => 'files_choice[]', 'caption' => _t('_bx_events_form_caption_files_choice'), 'info' => _t('_bx_events_form_info_files_choice'), 'required' => false), 'files_upload' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['files']['upload'], 'name' => 'files_upload[]', 'caption' => _t('_bx_events_form_caption_files_upload'), 'info' => _t('_bx_events_form_info_files_upload'), 'required' => false), 'header_privacy' => array('type' => 'block_header', 'caption' => _t('_bx_events_form_header_privacy')), 'allow_view_event_to' => $GLOBALS['oBxEventsModule']->_oPrivacy->getGroupChooser($iProfileId, 'events', 'view_event'), 'allow_view_participants_to' => $aInputPrivacyViewParticipants, 'allow_comment_to' => $aInputPrivacyComment, 'allow_rate_to' => $aInputPrivacyRate, 'allow_post_in_forum_to' => $aInputPrivacyForum, 'allow_view_forum_to' => $aInputPrivacyForumView, 'allow_join_to' => $GLOBALS['oBxEventsModule']->_oPrivacy->getGroupChooser($iProfileId, 'events', 'join'), 'JoinConfirmation' => array('type' => 'select', 'name' => 'JoinConfirmation', 'caption' => _t('_bx_events_form_caption_join_confirmation'), 'info' => _t('_bx_events_form_info_join_confirmation'), 'values' => array(0 => _t('_bx_events_form_join_confirmation_disabled'), 1 => _t('_bx_events_form_join_confirmation_enabled')), 'checker' => array('func' => 'int', 'error' => _t('_bx_events_form_err_join_confirmation')), 'db' => array('pass' => 'Int')), 'allow_upload_photos_to' => $aInputPrivacyUploadPhotos, 'allow_upload_videos_to' => $aInputPrivacyUploadVideos, 'allow_upload_sounds_to' => $aInputPrivacyUploadSounds, 'allow_upload_files_to' => $aInputPrivacyUploadFiles));
     if (!$aCustomForm['inputs']['images_choice']['content']) {
         unset($aCustomForm['inputs']['PrimPhoto']);
         unset($aCustomForm['inputs']['images_choice']);
     }
     if (!$aCustomForm['inputs']['videos_choice']['content']) {
         unset($aCustomForm['inputs']['videos_choice']);
     }
     if (!$aCustomForm['inputs']['sounds_choice']['content']) {
         unset($aCustomForm['inputs']['sounds_choice']);
     }
     if (!$aCustomForm['inputs']['files_choice']['content']) {
         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']);
     }
     if (!isset($this->_aMedia['sounds'])) {
         unset($aCustomForm['inputs']['header_sounds']);
         unset($aCustomForm['inputs']['sounds_choice']);
         unset($aCustomForm['inputs']['sounds_upload']);
         unset($aCustomForm['inputs']['allow_upload_sounds_to']);
     }
     if (!isset($this->_aMedia['files'])) {
         unset($aCustomForm['inputs']['header_files']);
         unset($aCustomForm['inputs']['files_choice']);
         unset($aCustomForm['inputs']['files_upload']);
         unset($aCustomForm['inputs']['allow_upload_files_to']);
     }
     $oModuleDb = new BxDolModuleDb();
     if (!$oModuleDb->getModuleByUri('forum')) {
         unset($aCustomForm['inputs']['allow_post_in_forum_to']);
     }
     $aFormInputsAdminPart = array();
     if ($GLOBALS['oBxEventsModule']->isAdmin()) {
         require_once BX_DIRECTORY_PATH_INC . 'membership_levels.inc.php';
         $aMemberships = getMemberships();
         unset($aMemberships[MEMBERSHIP_ID_NON_MEMBER]);
         // unset Non-member
         $aMemberships = array('' => _t('_bx_events_membership_filter_none')) + $aMemberships;
         $aFormInputsAdminPart = array('EventMembershipFilter' => array('type' => 'select', 'name' => 'EventMembershipFilter', 'caption' => _t('_bx_events_caption_membership_filter'), 'info' => _t('_bx_events_info_membership_filter'), 'values' => $aMemberships, 'value' => '', 'checker' => array('func' => 'preg', 'params' => array('/^[0-9a-zA-Z]*$/'), 'error' => _t('_bx_events_err_membership_filter')), 'db' => array('pass' => 'Preg', 'params' => array('/([0-9a-zA-Z]*)/'))));
     }
     $aFormInputsSubmit = array('Submit' => array('type' => 'submit', 'name' => 'submit_form', 'value' => _t('_Submit')));
     $aCustomForm['inputs'] = array_merge($aCustomForm['inputs'], $aFormInputsAdminPart, $aFormInputsSubmit);
     $this->processMembershipChecksForMediaUploads($aCustomForm['inputs']);
     parent::__construct($aCustomForm);
 }
 function savePage()
 {
     $aDiff = $this->getDiffValues(0);
     list($aUpd, $aMedia) = $this->oPF->getPageFromValues($aDiff);
     $sDelimeter = getParam('ml_clonetwo_multi_divider');
     $sDelimeter = $sDelimeter ? $sDelimeter : ';';
     if ($aDiff['title']) {
         $aUpd['uri'] = uriGenerate($aDiff['title'], 'ml_clonetwo_main', 'title');
     }
     $sTitle = $aDiff['title'] ? $aDiff['title'] : db_value("SELECT `title` FROM `ml_clonetwo_main` WHERE `id` = {$this->iPageID} LIMIT 1");
     if (!empty($aMedia)) {
         foreach ($aMedia as $sKey => $sValue) {
             $aMediaData = explode($sDelimeter, $aUpd[$sValue]);
             switch ($sKey) {
                 case 'photo':
                     $sTable = 'ml_clonetwo_images';
                     $iIdField = 'entry_id';
                     $iMedIdField = 'media_id';
                     if ($_POST['thumb_radio']) {
                         db_res("UPDATE `ml_clonetwo_main` SET `thumb` = {$_POST['thumb_radio']} WHERE `id` = {$this->iPageID} LIMIT 1");
                     }
                     if (!empty($_POST[$sValue . '_check_photos'])) {
                         foreach ($_POST[$sValue . '_check_photos'] as $sValue) {
                             if ($sValue) {
                                 db_res("DELETE FROM `{$sTable}` WHERE `{$iIdField}` = {$this->iPageID} AND `{$iMedIdField}` = {$sValue} LIMIT 1");
                             }
                         }
                     }
                     if (BxDolRequest::serviceExists("photos", "perform_photo_upload", 'Uploader')) {
                         $i = 0;
                         foreach ($aMediaData as $sData) {
                             $aInfo = array('medTitle' => $_POST[$sValue . '_title_photos'][$i] ? $_POST[$sValue . '_title_photos'][$i] : $_FILES[$sValue]['name'][$i], 'Categories' => array($aUpd['title'] . ' ' . _t("_bx_{$sKey}s")), 'album' => _t('_ml_clonetwo_photo_album', $aUpd['title']));
                             if ($sData) {
                                 $this->looper();
                                 $iMediaId = BxDolService::call("photos", "perform_photo_upload", array($GLOBALS['dir']['tmp'] . $sData, $aInfo, false), 'Uploader');
                                 if ($iMediaId) {
                                     @unlink($GLOBALS['dir']['tmp'] . $sData);
                                     if (db_value("SHOW TABLES LIKE '{$sTable}'")) {
                                         db_res("INSERT INTO `{$sTable}` SET `{$iIdField}` = {$this->iPageID}, `{$iMedIdField}` = {$iMediaId}");
                                     }
                                     if (!db_value("SELECT `thumb` FROM `ml_clonetwo_main` WHERE `id` = {$this->iPageID} LIMIT 1") && $i == 0) {
                                         db_res("UPDATE `ml_clonetwo_main` SET `thumb` = {$iMediaId} WHERE `id` = {$this->iPageID} LIMIT 1");
                                     }
                                 }
                             }
                             $i++;
                         }
                     }
                     break;
                 case 'video':
                     $sTable = 'ml_clonetwo_videos';
                     $iIdField = 'entry_id';
                     $iMedIdField = 'media_id';
                     if (!empty($_POST[$sValue . '_check_videos'])) {
                         foreach ($_POST[$sValue . '_check_videos'] as $sValue) {
                             if ($sValue) {
                                 db_res("DELETE FROM `{$sTable}` WHERE `{$iIdField}` = {$this->iPageID} AND `{$iMedIdField}` = {$sValue} LIMIT 1");
                             }
                         }
                     }
                     if (BxDolRequest::serviceExists("videos", "perform_video_upload", 'Uploader')) {
                         $i = 0;
                         if ($sData) {
                             foreach ($aMediaData as $sData) {
                                 $aInfo = array('medTitle' => $_POST[$sValue . '_title_videos'][$i] ? $_POST[$sValue . '_title_videos'][$i] : $_FILES[$sValue]['name'][$i], 'Categories' => array($aUpd['title'] . ' ' . _t("_bx_{$sKey}s")), 'album' => _t('_ml_clonetwo_photo_album', $aUpd['title']));
                                 $this->looper();
                                 $iMediaId = BxDolService::call("videos", "perform_video_upload", array($GLOBALS['dir']['tmp'] . $sData, $aInfo, false), 'Uploader');
                                 if ($iMediaId) {
                                     @unlink($GLOBALS['dir']['tmp'] . $sData);
                                     if (db_value("SHOW TABLES LIKE '{$sTable}'")) {
                                         db_res("INSERT INTO `{$sTable}` SET `{$iIdField}` = {$this->iPageID}, `{$iMedIdField}` = {$iMediaId}");
                                     }
                                 }
                             }
                             $i++;
                         }
                     }
                     break;
                 case 'sound':
                     $sTable = 'ml_clonetwo_sounds';
                     $iIdField = 'entry_id';
                     $iMedIdField = 'media_id';
                     if (!empty($_POST[$sValue . '_check_sounds'])) {
                         foreach ($_POST[$sValue . '_check_sounds'] as $sValue) {
                             if ($sValue) {
                                 db_res("DELETE FROM `{$sTable}` WHERE `{$iIdField}` = {$this->iPageID} AND `{$iMedIdField}` = {$sValue} LIMIT 1");
                             }
                         }
                     }
                     if (BxDolRequest::serviceExists("sounds", "perform_music_upload", 'Uploader')) {
                         $i = 0;
                         if ($sData) {
                             foreach ($aMediaData as $sData) {
                                 $aInfo = array('medTitle' => $_POST[$sValue . '_title_sounds'][$i] ? $_POST[$sValue . '_title_sounds'][$i] : $_FILES[$sValue]['name'][$i], 'Categories' => array($aUpd['title'] . ' ' . _t("_bx_{$sKey}s")), 'album' => _t('_ml_clonetwo_photo_album', $aUpd['title']));
                                 $this->looper();
                                 $iMediaId = BxDolService::call("sounds", "perform_music_upload", array($GLOBALS['dir']['tmp'] . $sData, $aInfo, false), 'Uploader');
                                 if ($iMediaId) {
                                     @unlink($GLOBALS['dir']['tmp'] . $sData);
                                     if (db_value("SHOW TABLES LIKE '{$sTable}'")) {
                                         db_res("INSERT INTO `{$sTable}` SET `{$iIdField}` = {$this->iPageID}, `{$iMedIdField}` = {$iMediaId}");
                                     }
                                 }
                             }
                             $i++;
                         }
                     }
                     break;
                 case 'file':
                     $sTable = 'ml_clonetwo_files';
                     $iIdField = 'entry_id';
                     $iMedIdField = 'media_id';
                     if (!empty($_POST[$sValue . '_check_files'])) {
                         foreach ($_POST[$sValue . '_check_files'] as $sValue) {
                             if ($sValue) {
                                 db_res("DELETE FROM `{$sTable}` WHERE `{$iIdField}` = {$this->iPageID} AND `{$iMedIdField}` = {$sValue} LIMIT 1");
                             }
                         }
                     }
                     if (BxDolRequest::serviceExists("files", "perform_file_upload", 'Uploader')) {
                         $i = 0;
                         if ($sData) {
                             foreach ($aMediaData as $sData) {
                                 $aInfo = array('medTitle' => $_POST[$sValue . '_title_files'][$i] ? $_POST[$sValue . '_title_files'][$i] : $_FILES[$sValue]['name'][$i], 'Categories' => array($aUpd['title'] . ' ' . _t("_bx_{$sKey}s")), 'album' => _t('_ml_clonetwo_photo_album', $aUpd['title']));
                                 $this->looper();
                                 $iMediaId = BxDolService::call("files", "perform_file_upload", array($GLOBALS['dir']['tmp'] . $sData, $aInfo, false), 'Uploader');
                                 if ($iMediaId) {
                                     @unlink($GLOBALS['dir']['tmp'] . $sData);
                                     if (db_value("SHOW TABLES LIKE '{$sTable}'")) {
                                         db_res("INSERT INTO `{$sTable}` SET `{$iIdField}` = {$this->iPageID}, `{$iMedIdField}` = {$iMediaId}");
                                     }
                                 }
                             }
                             $i++;
                         }
                     }
                     break;
                 case 'youtube':
                     $i = 0;
                     $sTable = 'ml_clonetwo_youtube';
                     $iUIdField = 'id';
                     $iIdField = 'id_entry';
                     $sUrlField = 'url';
                     $sTitleField = 'title';
                     if (!empty($_POST[$sValue . '_check_youtube'])) {
                         foreach ($_POST[$sValue . '_check_youtube'] as $sValue) {
                             if ($sValue) {
                                 db_res("DELETE FROM `{$sTable}` WHERE `{$iIdField}` = {$this->iPageID} AND `{$iUIdField}` = {$sValue} LIMIT 1");
                             }
                         }
                     }
                     foreach ($aMediaData as $sData) {
                         if ($sData) {
                             $sTitle = $_POST[$sValue . '_title_youtube'][$i];
                             if (db_value("SHOW TABLES LIKE '{$sTable}'") && $sData) {
                                 db_res("INSERT INTO `{$sTable}` SET `{$iIdField}` = {$this->iPageID}, `{$sUrlField}` = '{$sData}', `{$sTitleField}` = '{$sTitle}'");
                             }
                         }
                         $i++;
                     }
                     break;
                 case 'rss':
                     $i = 0;
                     $sTable = 'ml_clonetwo_rss';
                     $iUIdField = 'id';
                     $iIdField = 'id_entry';
                     $sUrlField = 'url';
                     $sTitleField = 'name';
                     if (!empty($_POST[$sValue . '_check_rss'])) {
                         foreach ($_POST[$sValue . '_check_rss'] as $sValue) {
                             if ($sValue) {
                                 db_res("DELETE FROM `{$sTable}` WHERE `{$iIdField}` = {$this->iPageID} AND `{$iUIdField}` = {$sValue} LIMIT 1");
                             }
                         }
                     }
                     foreach ($aMediaData as $sData) {
                         if ($sData) {
                             $sTitle = $_POST[$sValue . '_title_rss'][$i];
                             if (db_value("SHOW TABLES LIKE '{$sTable}'") && $sData) {
                                 db_res("INSERT INTO `{$sTable}` SET `{$iIdField}` = {$this->iPageID}, `{$sUrlField}` = '{$sData}', `{$sTitleField}` = '{$sTitle}'");
                             }
                         }
                         $i++;
                     }
                     break;
             }
         }
     }
     $oModuleDb = new BxDolModuleDb();
     $aModule = $oModuleDb->getModuleByUri('clonetwo');
     $iProfileId = getLoggedId();
     bx_import('BxDolTags');
     $o = new BxDolTags();
     $o->reparseObjTags('ml_clonetwo', $this->iPageID);
     bx_import('BxDolCategories');
     $o = new BxDolCategories();
     $o->reparseObjTags('ml_clonetwo', $this->iPageID);
     $this->oPC->updatePage($this->iPageID, $aUpd);
 }