Beispiel #1
0
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     $bIsEdit = false;
     if ($iId = $this->request()->getInt('id')) {
         if ($aPackage = Phpfox::getService('subscribe')->getForEdit($iId)) {
             $bIsEdit = true;
             $this->template()->assign('aForms', $aPackage);
             $this->setParam('currency_value_val[cost]', unserialize($aPackage['cost']));
             if (!empty($aPackage['recurring_cost'])) {
                 $this->setParam('currency_value_val[recurring_cost]', unserialize($aPackage['recurring_cost']));
             }
         }
     }
     if ($aVals = $this->request()->getArray('val')) {
         if ($bIsEdit) {
             if (Phpfox::getService('subscribe.process')->update($aPackage['package_id'], $aVals)) {
                 $this->url()->send('admincp.subscribe.add', array('id' => $aPackage['package_id']), Phpfox::getPhrase('subscribe.package_successfully_update'));
             }
         } else {
             if (Phpfox::getService('subscribe.process')->add($aVals)) {
                 $this->url()->send('admincp.subscribe', null, Phpfox::getPhrase('subscribe.package_successfully_added'));
             }
         }
     }
     $this->template()->setTitle($bIsEdit ? Phpfox::getPhrase('subscribe.editing_subscription_package') . ': ' . $aPackage['title'] : Phpfox::getPhrase('subscribe.create_new_subscription_package'))->setBreadcrumb(Phpfox::getPhrase('subscribe.subscription_packages'), $this->url()->makeUrl('admincp.subscribe'))->setBreadcrumb($bIsEdit ? Phpfox::getPhrase('subscribe.editing') . ': ' . Phpfox::getLib('locale')->convert($aPackage['title']) : Phpfox::getPhrase('subscribe.create_new_subscription_package'), null, true)->assign(array('aUserGroups' => Phpfox::getService('user.group')->get(), 'bIsEdit' => $bIsEdit));
 }
Beispiel #2
0
 /**
  * Based on what CDN module is selected here is where we load the CDN class and initiat the object.
  *
  * @param array $aParams Array of any special params to pass to the module CDN class
  */
 public function __construct($aParams = array())
 {
     if (!$this->_oObject) {
         $sCdn = Phpfox::getParam('core.cdn_service') == '' ? 's3' : Phpfox::getParam('core.cdn_service');
         $this->_oObject = Phpfox::getLib('phpfox.cdn.module.' . $sCdn, $aParams);
     }
 }
Beispiel #3
0
 public function setHash($sCode)
 {
     if (Phpfox::getParam('core.store_only_users_in_session')) {
         $oRequest = Phpfox::getLib('request');
         $oSession = Phpfox::getLib('session');
         $sSessionHash = $oSession->get('sessionhash');
         $bCreate = true;
         if (!empty($sSessionHash)) {
             $bCreate = false;
             $aRow = $this->database()->select('*')->from(Phpfox::getT('log_session'))->where('session_hash = \'' . $this->database()->escape($sSessionHash) . '\'')->execute('getSlaveRow');
             if (isset($aRow['session_hash'])) {
                 $this->database()->update(Phpfox::getT('log_session'), array('captcha_hash' => $this->_getHash($sCode, $sSessionHash)), "session_hash = '" . $sSessionHash . "'");
             } else {
                 $bCreate = true;
             }
         }
         if ($bCreate) {
             $sSessionHash = $oRequest->getSessionHash();
             $this->database()->insert(Phpfox::getT('log_session'), array('session_hash' => $sSessionHash, 'id_hash' => $oRequest->getIdHash(), 'captcha_hash' => $this->_getHash($sCode, $sSessionHash), 'user_id' => Phpfox::getUserId(), 'last_activity' => PHPFOX_TIME, 'location' => '', 'is_forum' => '0', 'forum_id' => 0, 'im_hide' => 0, 'ip_address' => '', 'user_agent' => ''));
             $oSession->set('sessionhash', $sSessionHash);
         }
     } else {
         $iId = $this->_oSession->getSessionId();
         $this->database()->update(Phpfox::getT('log_session'), array('captcha_hash' => $this->_getHash($sCode, $iId)), "session_hash = '" . $iId . "'");
     }
 }
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     if ($aVals = $this->request()->getArray('val')) {
         Phpfox::isUser(true);
         Phpfox::getUserParam('comment.can_post_comments', true);
         if (($iFlood = Phpfox::getUserParam('comment.comment_post_flood_control')) !== 0) {
             $aFlood = array('action' => 'last_post', 'params' => array('field' => 'time_stamp', 'table' => Phpfox::getT('comment'), 'condition' => 'type_id = \'' . Phpfox::getLib('database')->escape($aVals['type']) . '\' AND user_id = ' . Phpfox::getUserId(), 'time_stamp' => $iFlood * 60));
             // actually check if flooding
             if (Phpfox::getLib('spam')->check($aFlood)) {
                 Phpfox_Error::set(Phpfox::getPhrase('comment.posting_a_comment_a_little_too_soon_total_time', array('total_time' => Phpfox::getLib('spam')->getWaitTime())));
             }
         }
         if (Phpfox::getLib('parse.format')->isEmpty($aVals['text'])) {
             Phpfox_Error::set(Phpfox::getPhrase('feed.add_some_text_to_your_comment'));
         }
         if (Phpfox_Error::isPassed() && ($iId = Phpfox::getService('comment.process')->add($aVals))) {
             $this->url()->send('feed.view', array('id' => $this->request()->getInt('id')), Phpfox::getPhrase('feed.successfully_added_your_comment'));
         }
     }
     if ($iLikeType = $this->request()->getInt('liketype')) {
         if (Phpfox::getService('feed.process')->like($this->request()->getInt('id'), $iLikeType)) {
             $this->url()->send('feed.view', array('id' => $this->request()->getInt('id')), $iLikeType == '1' ? Phpfox::getPhrase('feed.successfully_liked_this_feed') : Phpfox::getPhrase('feed.successfully_unliked_this_feed'));
         }
     }
     list($iFeedCount, $aFeeds) = Phpfox::getService('feed')->get(null, $this->request()->getInt('id'), 1);
     $iCommentCnt = 0;
     $aComments = array();
     if (Phpfox::getParam('feed.allow_comments_on_feeds')) {
         list($iCommentCnt, $aComments) = Phpfox::getService('comment')->get('cmt.*', array("AND cmt.type_id = 'feed'", 'AND cmt.item_id = ' . (int) $aFeeds[0]['feed_id'], 'AND cmt.view_id = 0'), 'cmt.time_stamp ASC');
     }
     if (!count($aFeeds)) {
         return Phpfox_Error::display(Phpfox::getPhrase('feed.not_a_valid_feed'));
     }
     $this->template()->setMobileHeader(array('feed.css' => 'module_feed'))->assign(array('iFeedId' => $aFeeds[0]['feed_id'], 'aFeeds' => $aFeeds, 'aComments' => $aComments));
 }
Beispiel #5
0
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     // assign the categories
     $this->template()->assign(array('aCategories' => Phpfox::getService('contact.contact')->getCategories()));
     // create the captcha check JS
     // they need to input some text always
     $aValidation = array('text' => Phpfox::getPhrase('contact.fill_in_some_text_for_your_message'), 'category_id' => Phpfox::getPhrase('contact.you_need_to_choose_a_category'), 'subject' => Phpfox::getPhrase('contact.provide_a_subject'), 'full_name' => Phpfox::getPhrase('contact.provide_your_full_name'));
     // do they need to complete a captcha challenge?
     if (Phpfox::isModule('captcha') && Phpfox::getParam('contact.contact_enable_captcha')) {
         $aValidation['image_verification'] = Phpfox::getPhrase('captcha.complete_captcha_challenge');
     }
     // They always need to input their email address
     $aValidation['email'] = array('def' => 'email', 'title' => Phpfox::getPhrase('contact.provide_a_valid_email'));
     $oValid = Phpfox::getLib('validator')->set(array('sFormName' => 'js_contact_form', 'aParams' => $aValidation));
     // check if we're getting a request:
     if ($aVals = $this->request()->getArray('val')) {
         // check the fields are valid
         if ($oValid->isValid($aVals)) {
             if (Phpfox::getService('contact.contact')->sendContactMessage($aVals)) {
                 if (!empty($aVals['category_id']) && $aVals['category_id'] == 'phpfox_sales_ticket') {
                     $this->url()->send('contact', array('sent' => 'true'));
                 } else {
                     $this->url()->send('contact', null, Phpfox::getPhrase('contact.your_message_was_successfully_sent'));
                 }
             } else {
                 $this->template()->assign(array('aContactErrors' => Phpfox_Error::set(Phpfox::getPhrase('error.site_email_not_set'))));
             }
         }
     }
     if (Phpfox::isUser()) {
         $this->template()->assign(array('sFullName' => Phpfox::getUserBy('full_name'), 'sEmail' => Phpfox::getUserBy('email')));
     }
     $this->template()->setTitle(Phpfox::getPhrase('contact.contact_us'))->setBreadcrumb(Phpfox::getPhrase('contact.contact_us'))->assign(array('sCreateJs' => $oValid->createJs(), 'sGetJsForm' => $oValid->getJsForm(), 'bIsSent' => $this->request()->get('sent')))->setFullSite();
 }
Beispiel #6
0
 public function getGlobalNotifications()
 {
     $iTotal = Phpfox::getService('notification')->getUnseenTotal();
     if ($iTotal > 0) {
         Phpfox::getLib('ajax')->call('$(\'#js_total_new_notifications\').html(\'' . (int) $iTotal . '\').css({display: \'block\'}).show();');
     }
 }
Beispiel #7
0
 public function export($sProduct, $sModuleId = null)
 {
     $aCond = array();
     $aCond[] = "me.product_id = '" . $this->database()->escape($sProduct) . "'";
     if ($sModuleId !== null) {
         $aCond[] = "AND me.module_id = '" . $sModuleId . "'";
     }
     $aRows = $this->database()->select('me.*, m.module_id AS module_name, p.title AS product_name, pm.var_name as parent_var_name')->from($this->_sTable, 'me')->join(Phpfox::getT('module'), 'm', 'm.module_id = me.module_id')->join(Phpfox::getT('product'), 'p', 'p.product_id = me.product_id')->leftjoin(Phpfox::getT('menu'), 'pm', 'pm.menu_id = me.parent_id')->where($aCond)->execute('getRows');
     if (!count($aRows)) {
         return false;
     }
     $oXmlBuilder = Phpfox::getLib('xml.builder');
     $oXmlBuilder->addGroup('menus');
     foreach ($aRows as $aRow) {
         if (!empty($aRow['disallow_access'])) {
             $aGroups = unserialize($aRow['disallow_access']);
             $aRow['disallow_access'] = array();
             foreach ($aGroups as $iGroup) {
                 if (!in_array($iGroup, array(1, 2, 3, 4))) {
                     continue;
                 }
                 $aRow['disallow_access'][] = $iGroup;
             }
             $aRow['disallow_access'] = serialize($aRow['disallow_access']);
         }
         $aTag = array('module_id' => $aRow['module_id'], 'parent_var_name' => $aRow['parent_var_name'], 'm_connection' => $aRow['m_connection'], 'var_name' => $aRow['var_name'], 'ordering' => $aRow['ordering'], 'url_value' => $aRow['url_value'], 'version_id' => $aRow['version_id'], 'disallow_access' => $aRow['disallow_access'], 'module' => $aRow['module_name']);
         if (!empty($aRow['mobile_icon'])) {
             $aTag['mobile_icon'] = $aRow['mobile_icon'];
         }
         $oXmlBuilder->addTag('menu', '', $aTag);
     }
     $oXmlBuilder->closeGroup();
     return true;
 }
Beispiel #8
0
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     Phpfox::getUserParam('language.can_manage_lang_packs', true);
     $bNoJsValidation = $this->getParam('bNoJsValidation');
     $aModules = Phpfox::getService('admincp.module')->getModules();
     $aLanguages = Phpfox::getService('language')->get();
     if ($sPhrase = $this->getParam('sVar')) {
         $aParts = explode('.', $sPhrase);
         $sPhrase = $aParts[1];
     }
     /*
     $aValidation = array(
     	'var_name' => array(
     		'def' => 'required',
     		'title' => Phpfox::getPhrase('language.select_varname')
     	)
     );
     */
     $aValidation = array();
     $oValid = Phpfox::getLib('validator')->set(array('sFormName' => 'js_phrase_form', 'aParams' => $aValidation));
     if ($aVals = $this->request()->getArray('val')) {
         if (empty($aVals['var_name']) && isset($aVals['text']['en'])) {
             $aVals['var_name'] = $aVals['text']['en'];
         }
         if (empty($aVals['var_name'])) {
             Phpfox_Error::set('Provide a var name.');
         }
         // Check that all the fields are valid
         if ($oValid->isValid($aVals)) {
             // Check to make sure the phrase has not already been added
             if ($sIsPhrase = Phpfox::getService('language.phrase')->isPhrase($aVals)) {
                 Phpfox_Error::set(Phpfox::getPhrase('language.phrase_already_created', array('phrase' => $sIsPhrase)) . ' - ' . Phpfox::getPhrase($sIsPhrase));
                 $sCachePhrase = $sIsPhrase;
             } else {
                 $sVarName = Phpfox::getService('language.phrase.process')->prepare($aVals['var_name']);
                 if (isset($aVals['module'])) {
                     $aParts = explode('|', $aVals['module']);
                     $sVarName = $aParts[1] . '.' . $sVarName;
                 }
                 $sCached = Phpfox::getPhrase('language.phrase_added', array('phrase' => $sVarName));
                 // Add the new phrase
                 $sPhrase = Phpfox::getService('language.phrase.process')->add($aVals);
                 // Verify if we have a return URL, if we do send them there instead
                 if ($sReturn = $this->request()->get('return')) {
                     $this->url()->forward($sReturn, $sCached);
                 } else {
                     Phpfox::getLib('session')->set('cache_new_phrase', $sVarName);
                     // Phrase added lets send them back to the same page with a message that the phrase was added
                     $this->url()->send('admincp.language.phrase.add', array('last-module' => $aParts[1]), $sCached);
                 }
             }
         }
     }
     if (!isset($sCachePhrase) && ($sCachePhrase = Phpfox::getLib('session')->get('cache_new_phrase'))) {
         Phpfox::getLib('session')->remove('cache_new_phrase');
     }
     // Assign needed vars to the template
     $this->template()->assign(array('aProducts' => Phpfox::getService('admincp.product')->get(), 'aModules' => $aModules, 'aLanguages' => $aLanguages, 'sCreateJs' => $oValid->createJS(), 'sGetJsForm' => $bNoJsValidation ? 'return true;' : $oValid->getJsForm(), 'sReturn' => ($sReturn = $this->request()->get('return')) ? $sReturn : $this->getParam('sReturnUrl'), 'sVar' => $sPhrase, 'sCachePhrase' => isset($sCachePhrase) ? $sCachePhrase : '', 'sLastModuleId' => $this->request()->get('last-module')))->setBreadCrumb(Phpfox::getPhrase('language.add_phrase'))->setTitle(Phpfox::getPhrase('language.add_phrase'));
     ($sPlugin = Phpfox_Plugin::get('language.component_controller_admincp_phrase_add_process')) ? eval($sPlugin) : false;
 }
Beispiel #9
0
 /**
  * Controller
  */
 public function process()
 {
     if (!$this->getParam('bIsValidImage')) {
         return false;
     }
     $aUser = $this->getParam('aUser');
     $aPhoto = $this->getParam('aPhoto');
     $bIsInPhoto = $this->getParam('is_in_photo');
     if ($aPhoto === null) {
         return false;
     }
     $sCategories = '';
     if (isset($aPhoto['categories']) && is_array($aPhoto['categories'])) {
         foreach ($aPhoto['categories'] as $aCategory) {
             $sCategories .= $aCategory[0] . ',';
         }
         $sCategories = rtrim($sCategories, ',');
     }
     $aInfo = array(Phpfox::getPhrase('photo.added') => '<span itemprop="dateCreated">' . Phpfox::getTime(Phpfox::getParam('photo.photo_image_details_time_stamp'), $aPhoto['time_stamp']) . '</span>', Phpfox::getPhrase('photo.category') => $sCategories, Phpfox::getPhrase('photo.file_size') => Phpfox_File::instance()->filesize($aPhoto['file_size']), Phpfox::getPhrase('photo.resolution') => $aPhoto['width'] . '×' . $aPhoto['height'], Phpfox::getPhrase('photo.comments') => $aPhoto['total_comment'], Phpfox::getPhrase('photo.views') => '<span itemprop="interactionCount">' . $aPhoto['total_view'] . '</span>', Phpfox::getPhrase('photo.rating') => round($aPhoto['total_rating']), Phpfox::getPhrase('photo.battle_wins') => round($aPhoto['total_battle']), Phpfox::getPhrase('photo.downloads') => $aPhoto['total_download']);
     if ($bIsInPhoto) {
         unset($aInfo[Phpfox::getPhrase('photo.added')]);
     }
     foreach ($aInfo as $sKey => $mValue) {
         if (empty($mValue)) {
             unset($aInfo[$sKey]);
         }
     }
     $this->template()->assign(array('sHeader' => Phpfox::getPhrase('photo.image_details'), 'aPhotoDetails' => $aInfo, 'bIsInPhoto' => $bIsInPhoto, 'sUrlPath' => preg_match("/\\{file\\/pic\\/(.*)\\/(.*)\\.jpg\\}/i", $aPhoto['destination'], $aMatches) ? Phpfox::getParam('core.path') . str_replace(array('{', '}'), '', $aMatches[0]) : ($aPhoto['server_id'] && Phpfox::getParam('core.allow_cdn') ? Phpfox::getLib('cdn')->getUrl(Phpfox::getParam('photo.url_photo') . sprintf($aPhoto['destination'], '_500'), $aPhoto['server_id']) : Phpfox::getParam('photo.url_photo') . sprintf($aPhoto['destination'], '_500'))));
     // return 'block';
 }
Beispiel #10
0
 /**
  * Controller
  */
 public function process()
 {
     $aLanguage = Phpfox::getService('language')->getLanguage($this->request()->get('id'));
     if (!isset($aLanguage['language_id'])) {
         return Phpfox_Error::display(Phpfox::getPhrase('language.not_a_valid_language_package'));
     }
     $iPage = $this->request()->getInt('page', 0);
     $aXml = Phpfox::getService('core')->getModulePager('phrases', $iPage, 5);
     if ($aXml === false) {
         $sPhrase = Phpfox::getPhrase('language.successfully_imported_missing_phrases');
         Phpfox::getLib('cache')->remove('locale', 'substr');
         if ($this->request()->get('check') == 'true') {
             $this->url()->send('admincp.language', null, $sPhrase);
         } else {
             $this->url()->send('admincp.language.missing', array('id' => $aLanguage['language_id'], 'check' => 'true'));
         }
     }
     $aModules = array();
     if (is_array($aXml)) {
         $iMissing = Phpfox::getService('language.phrase.process')->findMissingPhrases($aLanguage['language_id'], $aXml, $this->request()->get('check') == 'true' ? true : false);
         foreach ($aXml as $sModule => $sPhrases) {
             $aModules[] = $sModule;
         }
         $this->template()->setHeader('<meta http-equiv="refresh" content="2;url=' . $this->url()->makeUrl('admincp.language.missing', array('id' => $aLanguage['language_id'], 'check' => $this->request()->get('check'), 'page' => $iPage + 1)) . '">');
     }
     $this->template()->setTitle(Phpfox::getPhrase('language.find_missing_phrases'))->setBreadcrumb(Phpfox::getPhrase('language.manage_language_packages'), $this->url()->makeUrl('admincp.language'))->setBreadcrumb(Phpfox::getPhrase('language.find_missing_phrases'), $this->url()->makeUrl('current'))->setBreadcrumb($aLanguage['title'], null, true)->assign(array('aModules' => $aModules, 'iMissing' => $iMissing));
 }
Beispiel #11
0
 public function update($aVals)
 {
     $this->database()->update($this->_sTable, array('parent_id' => (int) $aVals['category_id'], 'name' => Phpfox::getLib('parse.input')->clean($aVals['name'], 255)), 'category_id = ' . $aVals['edit_id']);
     // Remove from cache
     $this->cache()->remove('photo_category', 'substr');
     return true;
 }
Beispiel #12
0
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     return Phpfox_Error::display('This section has been depreciated');
     Phpfox::getUserParam('comment.can_moderate_comments', true);
     if ($aIds = $this->request()->getArray('id')) {
         if ($this->request()->get('approve')) {
             foreach ($aIds as $iId) {
                 Phpfox::getService('feed.process')->approve($iId);
             }
             $this->url()->send('admincp.feed', array('view' => 'approval'), Phpfox::getPhrase('feed.profile_comment_s_successfully_approved'));
         } else {
             foreach ($aIds as $iId) {
                 Phpfox::getService('feed.process')->deleteFeed($iId);
             }
             $this->url()->send('admincp.feed', array('view' => 'approval'), Phpfox::getPhrase('feed.profile_comment_s_successfully_deleted'));
         }
     }
     $iPage = $this->request()->getInt('page');
     $aPages = array(20, 30, 40, 50);
     $aDisplays = array();
     foreach ($aPages as $iPageCnt) {
         $aDisplays[$iPageCnt] = Phpfox::getPhrase('core.per_page', array('total' => $iPageCnt));
     }
     $aFilters = array('search' => array('type' => 'input:text', 'search' => "AND ls.name LIKE '%[VALUE]%'"), 'display' => array('type' => 'select', 'options' => $aDisplays, 'default' => '20'), 'sort' => array('type' => 'select', 'options' => array('time_stamp' => Phpfox::getPhrase('comment.last_activity'), 'rating ' => Phpfox::getPhrase('comment.rating')), 'default' => 'time_stamp', 'alias' => 'feed'), 'sort_by' => array('type' => 'select', 'options' => array('DESC' => Phpfox::getPhrase('core.descending'), 'ASC' => Phpfox::getPhrase('core.ascending')), 'default' => 'DESC'));
     $oSearch = Phpfox::getLib('search')->set(array('type' => 'feeds', 'filters' => $aFilters, 'search' => 'search'));
     $oSearch->setCondition('AND feed.view_id = 1');
     list($iCnt, $aFeeds) = Phpfox::getService('feed')->getForBrowse($oSearch->getConditions(), $oSearch->getSort(), $oSearch->getPage(), $oSearch->getDisplay());
     Phpfox::getLib('pager')->set(array('page' => $iPage, 'size' => $oSearch->getDisplay(), 'count' => $oSearch->getSearchTotal($iCnt)));
     $this->template()->setTitle(Phpfox::getPhrase('comment.comment_title'))->setBreadcrumb(Phpfox::getPhrase('comment.comment_title'), $this->url()->makeUrl('admincp.comment'))->setHeader('cache', array('comment.css' => 'style_css', 'pager.css' => 'style_css'))->assign(array('aFeeds' => $aFeeds, 'bIsCommentAdminPanel' => true));
 }
Beispiel #13
0
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     if (!($aPurchase = Phpfox::getService('subscribe.purchase')->getInvoice($this->request()->getInt('id')))) {
         return Phpfox_Error::display(Phpfox::getPhrase('subscribe.unable_to_find_this_invoice'));
     }
     $this->template()->setTitle(Phpfox::getPhrase('subscribe.membership_packages'))->setBreadcrumb(Phpfox::getPhrase('subscribe.membership_packages'), $this->url()->makeUrl('subscribe'))->setBreadcrumb(Phpfox::getPhrase('subscribe.subscriptions'), $this->url()->makeUrl('subscribe.list'))->setBreadcrumb(Phpfox::getPhrase('subscribe.order_purchase_id_title', array('purchase_id' => $aPurchase['purchase_id'], 'title' => Phpfox::getLib('locale')->convert($aPurchase['title']))), null, true)->assign(array('aPurchase' => $aPurchase));
 }
Beispiel #14
0
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     $this->url()->send('music');
     Phpfox::isUser(true);
     if (Phpfox::getParam('music.music_user_group_id') == Phpfox::getUserBy('user_group_id')) {
         $this->url()->send('music');
     }
     $aUser = array('full_name' => Phpfox::getUserBy('full_name'));
     $aSettings = Phpfox::getService('custom')->getForEdit(array('user_main', 'user_panel', 'profile_panel'), Phpfox::getUserId(), Phpfox::getParam('music.music_user_group_id'));
     $aParams = array('full_name' => Phpfox::getPhrase('music.provide_a_artist_band_name'), 'agree' => Phpfox::getPhrase('music.tick_the_box_to_agree_to_our_terms_and_privacy_policy'));
     foreach ($aSettings as $sKey => $aSetting) {
         if ($aSetting['is_required']) {
             $aParams['custom_field_' . $aSetting['field_id']] = array('title' => Phpfox::getPhrase('music.provide_a_value_for') . ': ' . Phpfox::getPhrase($aSetting['phrase_var_name']), 'def' => 'required', 'php_id' => 'custom[' . $aSetting['field_id'] . ']');
         }
     }
     $oValid = Phpfox::getLib('validator')->set(array('sFormName' => 'js_form', 'aParams' => $aParams));
     if ($aVals = $this->request()->getArray('val')) {
         if ($oValid->isValid($aVals)) {
             if (Phpfox::getService('music.process')->convertMember($aVals, $this->request()->getArray('custom'))) {
                 $this->url()->send('music', null, Phpfox::getPhrase('music.you_have_successfully_converted_your_account'));
             }
         }
     }
     $this->template()->setTitle(Phpfox::getPhrase('music.musician_registration'))->setBreadcrumb(Phpfox::getPhrase('music.music'), $this->url()->makeUrl('music'))->setBreadcrumb(Phpfox::getPhrase('music.registration'), null, true)->setFullSite()->assign(array('aForms' => $aUser, 'sCreateJs' => $oValid->createJS(), 'sGetJsForm' => $oValid->getJsForm(), 'aSettings' => $aSettings));
 }
Beispiel #15
0
 public function add($aVals, $bIsCustom = false, $aCallback = null)
 {
     if (!defined('PHPFOX_FORCE_IFRAME')) {
         define('PHPFOX_FORCE_IFRAME', true);
     }
     if (empty($aVals['privacy_comment'])) {
         $aVals['privacy_comment'] = 0;
     }
     if (empty($aVals['privacy'])) {
         $aVals['privacy'] = 0;
     }
     $iId = $this->database()->insert($this->_sTable, array('user_id' => Phpfox::getUserId(), 'is_custom' => $bIsCustom ? '1' : '0', 'module_id' => $aCallback === null ? null : $aCallback['module'], 'item_id' => $aCallback === null ? 0 : $aCallback['item_id'], 'parent_user_id' => isset($aVals['parent_user_id']) ? (int) $aVals['parent_user_id'] : 0, 'link' => $this->preParse()->clean($aVals['link']['url'], 255), 'image' => isset($aVals['link']['image_hide']) && $aVals['link']['image_hide'] == '1' || !isset($aVals['link']['image']) ? null : $this->preParse()->clean($aVals['link']['image'], 255), 'title' => isset($aVals['link']['title']) ? $this->preParse()->clean($aVals['link']['title'], 255) : '', 'description' => isset($aVals['link']['description']) ? $this->preParse()->clean($aVals['link']['description'], 200) : '', 'status_info' => empty($aVals['status_info']) ? null : $this->preParse()->prepare($aVals['status_info']), 'privacy' => (int) $aVals['privacy'], 'privacy_comment' => (int) $aVals['privacy_comment'], 'time_stamp' => PHPFOX_TIME, 'has_embed' => empty($aVals['link']['embed_code']) ? '0' : '1'));
     if (!empty($aVals['link']['embed_code'])) {
         $this->database()->insert(Phpfox::getT('link_embed'), array('link_id' => $iId, 'embed_code' => $this->preParse()->prepare($aVals['link']['embed_code'])));
     }
     if ($aCallback === null && isset($aVals['parent_user_id']) && $aVals['parent_user_id'] != Phpfox::getUserId()) {
         $aUser = $this->database()->select('user_name')->from(Phpfox::getT('user'))->where('user_id = ' . (int) $aVals['parent_user_id'])->execute('getRow');
         $sLink = Phpfox::getLib('url')->makeUrl($aUser['user_name'], array('plink-id' => $iId));
         Phpfox::getLib('mail')->to($aVals['parent_user_id'])->subject(array('link.full_name_posted_a_link_on_your_wall', array('full_name' => Phpfox::getUserBy('full_name'))))->message(array('link.full_name_posted_a_link_on_your_wall_message', array('full_name' => Phpfox::getUserBy('full_name'), 'link' => $sLink)))->notification('comment.add_new_comment')->send();
         if (Phpfox::isModule('notification')) {
             Phpfox::getService('notification.process')->add('feed_comment_link', $iId, $aVals['parent_user_id']);
         }
     }
     $this->_iLinkId = $iId;
     return $bIsCustom ? $iId : Phpfox::getService('feed.process')->callback($aCallback)->add('link', $iId, $aVals['privacy'], $aVals['privacy_comment'], isset($aVals['parent_user_id']) ? (int) $aVals['parent_user_id'] : 0);
 }
Beispiel #16
0
 public function getFriends()
 {
     if ((int) $this->_oApi->get('user_id') === 0) {
         $iUserId = $this->_oApi->getUserId();
     } else {
         $iUserId = $this->_oApi->get('user_id');
     }
     if ($this->_oApi->isAllowed('friend.get_friends') == false) {
         return $this->_oApi->error('friend.get_friends', 'User did not to view friends list');
     }
     $iCnt = $this->database()->select('COUNT(*)')->from($this->_sTable, 'f')->join(Phpfox::getT('user'), 'u', 'u.user_id = f.friend_user_id')->where('f.is_page = 0 AND f.user_id = ' . (int) $iUserId)->execute('getSlaveField');
     $this->_oApi->setTotal($iCnt);
     $aRows = $this->database()->select('u.user_id, u.user_name, u.full_name, u.joined, u.user_image, u.country_iso, u.gender')->from($this->_sTable, 'f')->join(Phpfox::getT('user'), 'u', 'u.user_id = f.friend_user_id')->where('f.is_page = 0 AND f.user_id = ' . (int) $iUserId)->limit($this->_oApi->get('page'), 10, $iCnt)->execute('getSlaveRows');
     $aFriends = array();
     foreach ($aRows as $iKey => $aRow) {
         unset($aRows[$iKey]['user_name'], $aRows[$iKey]['country_iso'], $aRows[$iKey]['gender'], $aRows[$iKey]['joined']);
         if (!$this->_oApi->isAllowed('user.get_full_name', null, $aRow['user_id'])) {
             unset($aRows[$iKey]['full_name']);
         } else {
             $aRows[$iKey]['name'] = $aRow['full_name'];
         }
         if (!$this->_oApi->isAllowed('user.get_email', null, $aRow['user_id'])) {
             unset($aRows[$iKey]['email']);
         }
         $sImagePath = $aRow['user_image'];
         $aRows[$iKey]['photo_50px'] = Phpfox::getLib('image.helper')->display(array('user' => $aRow, 'suffix' => '_50', 'return_url' => true));
         $aRows[$iKey]['photo_50px_square'] = Phpfox::getLib('image.helper')->display(array('user' => $aRow, 'suffix' => '_50_square', 'return_url' => true));
         $aRows[$iKey]['photo_120px'] = Phpfox::getLib('image.helper')->display(array('user' => $aRow, 'suffix' => '_120', 'return_url' => true));
         $aRows[$iKey]['permalink'] = Phpfox::getLib('url')->makeUrl($aRow['user_name']);
         unset($aRows[$iKey]['user_image']);
     }
     return $aRows;
 }
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     define('PHPFOX_DONT_SAVE_PAGE', true);
     if (Phpfox::isUser()) {
         $this->url()->send('profile');
     }
     switch (Phpfox::getParam('user.login_type')) {
         case 'user_name':
             $aValidation['login'] = Phpfox::getPhrase('user.provide_your_user_name');
             break;
         case 'email':
             $aValidation['login'] = Phpfox::getPhrase('user.provide_your_email');
             break;
         default:
             $aValidation['login'] = Phpfox::getPhrase('user.provide_your_user_name_email');
     }
     $aValidation['password'] = Phpfox::getPhrase('user.provide_your_password');
     $oValid = Phpfox::getLib('validator')->set(array('sFormName' => 'js_login_form', 'aParams' => $aValidation));
     if ($aVals = $this->request()->getArray('val')) {
         if ($oValid->isValid($aVals)) {
             list($bLogged, $aUser) = Phpfox::getService('user.auth')->login($aVals['login'], $aVals['password'], isset($aVals['remember_me']) ? true : false, Phpfox::getParam('user.login_type'));
             if ($bLogged) {
                 $this->url()->send('');
             }
         }
     }
 }
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     if ($sPlugin = Phpfox_Plugin::get('core.component_controller_index_member_start')) {
         eval($sPlugin);
     }
     Phpfox::isUser(true);
     if ($this->request()->get('req3') == 'customize') {
         define('PHPFOX_IN_DESIGN_MODE', true);
         define('PHPFOX_CAN_MOVE_BLOCKS', true);
         if ($iTestStyle = $this->request()->get('test_style_id')) {
             if (Phpfox::getLib('template')->testStyle($iTestStyle)) {
             }
         }
         $aDesigner = array('current_style_id' => Phpfox::getUserBy('style_id'), 'design_header' => Phpfox::getPhrase('core.customize_dashboard'), 'current_page' => $this->url()->makeUrl(''), 'design_page' => $this->url()->makeUrl('core.index-member', 'customize'), 'block' => 'core.index-member', 'item_id' => Phpfox::getUserId(), 'type_id' => 'user');
         $this->setParam('aDesigner', $aDesigner);
         $this->template()->setPhrase(array('theme.are_you_sure'))->setHeader('cache', array('style.css' => 'style_css', 'video.css' => 'module_video', 'design.js' => 'module_theme', 'select.js' => 'module_theme'));
         if (Phpfox::getParam('profile.can_drag_drop_blocks_on_profile')) {
             $this->template()->setHeader('cache', array('jquery/ui.js' => 'static_script', 'sort.js' => 'module_theme'))->setHeader(array('<script type="text/javascript">$Behavior.core_controller_member_designonupdate = function() { function designOnUpdate() { $Core.design.updateSorting(); } };</script>', '<script type="text/javascript">$Behavior.core_controller_init = function() { $Core.design.init({type_id: \'user\'}); };</script>'));
         }
     } else {
         // $this->template()->setHeader('jquery/ui.js', 'static_script');
         $this->template()->setHeader('cache', array('sort.js' => 'module_theme', 'design.js' => 'module_theme', 'video.css' => 'module_video'))->setHeader(array());
     }
     if (Phpfox::getParam('video.convert_servers_enable')) {
         $this->template()->setHeader('<script type="text/javascript">document.domain = "' . Phpfox::getParam('video.convert_js_parent') . '";</script>');
     }
     Phpfox::getLib('module')->setCacheBlockData(array('table' => 'user_dashboard', 'field' => 'user_id', 'item_id' => Phpfox::getUserId(), 'controller' => 'core.index-member'));
     $this->template()->setHeader('cache', array('feed.js' => 'module_feed', 'welcome.css' => 'style_css', 'announcement.css' => 'style_css', 'comment.css' => 'style_css', 'quick_edit.js' => 'static_script', 'jquery/plugin/jquery.highlightFade.js' => 'static_script', 'jquery/plugin/jquery.scrollTo.js' => 'static_script', 'player/flowplayer/flowplayer.js' => 'static_script'))->setEditor(array('load' => 'simple'));
 }
Beispiel #19
0
 /**
  * Class process method which is used to execute this component.
  */
 public function process()
 {
     $this->template()->setTitle(Phpfox::getPhrase('user.email_verification'))->setBreadcrumb(Phpfox::getPhrase('user.email_verification'))->assign(array('iVerifyUserId' => Phpfox::getLib('session')->get('cache_user_id')));
     $sHash = $this->request()->get('link', '');
     if ($sHash == '') {
     } elseif (Phpfox::getService('user.verify.process')->verify($sHash)) {
         if ($sPlugin = Phpfox_Plugin::get('user.component_verify_process_redirection')) {
             eval($sPlugin);
         }
         $sRedirect = Phpfox::getParam('user.redirect_after_signup');
         if (!empty($sRedirect)) {
             Phpfox::getLib('session')->set('redirect', str_replace('.', '/', $sRedirect));
         }
         if (Phpfox::isMobile()) {
             $this->url()->send('mobile.user.login', null, Phpfox::getPhrase('user.your_email_has_been_verified_please_log_in_with_the_information_you_provided_during_sign_up'));
         }
         // send to the log in and say everything is ok
         Phpfox::getLib('session')->set('verified_do_redirect', '1');
         $this->url()->send('user.login', null, Phpfox::getPhrase('user.your_email_has_been_verified_please_log_in_with_the_information_you_provided_during_sign_up'));
     } else {
         //send to the log in and say there was an error
         Phpfox_Error::set(Phpfox::getPhrase('user.invalid_verification_link'));
         $iTime = Phpfox::getParam('user.verify_email_timeout');
         if ($iTime < 60) {
             $sTime = Phpfox::getPhrase('user.time_minutes', array('time' => $iTime));
         } elseif ($iTime < 60 * 60 * 24) {
             $sTime = $iTime == 60 ? Phpfox::getPhrase('user.time_hour', array('time' => round($iTime / 60))) : Phpfox::getPhrase('user.time_hours', array('time' => round($iTime / 60)));
         } else {
             $sTime = Phpfox::getPhrase('user.time_days', array('time' => $sTime));
         }
         Phpfox::getService('user.verify.process')->sendMail(Phpfox::getLib('session')->get('cache_user_id'));
         $this->template()->assign(array('sTime' => $sTime));
     }
 }
Beispiel #20
0
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     $aValidation = array('name' => Phpfox::getPhrase('photo.provide_a_name_for_your_photo_category'));
     $oValid = Phpfox::getLib('validator')->set(array('sFormName' => 'js_form', 'aParams' => $aValidation));
     if (($aOrder = $this->request()->getArray('order')) && Phpfox::getUserParam('photo.can_edit_photo_categories', true) && Phpfox::getService('photo.category.process')->updateOrder($aOrder)) {
         $this->url()->send('admincp.photo', null, Phpfox::getPhrase('photo.photo_category_order_successfully_updated'));
     }
     if (!Phpfox::getUserParam('photo.can_add_public_categories') && !Phpfox::getUserParam('photo.can_edit_photo_categories')) {
         return Phpfox_Error::display(Phpfox::getPhrase('photo.invalid_section'));
     }
     if ($aVals = $this->request()->getArray('val')) {
         if ($oValid->isValid($aVals)) {
             if (isset($aVals['delete']) && Phpfox::getUserParam('photo.can_edit_photo_categories', true)) {
                 if (Phpfox::getService('photo.category.process')->delete($aVals['edit_id'])) {
                     $this->url()->send('admincp.photo', null, Phpfox::getPhrase('photo.photo_category_successfully_deleted'));
                 }
             } else {
                 if (isset($aVals['edit_id'])) {
                     Phpfox::getUserParam('photo.can_edit_photo_categories', true);
                     if (Phpfox::getService('photo.category.process')->update($aVals)) {
                         $this->url()->send('admincp.photo', null, Phpfox::getPhrase('photo.photo_category_successfully_updated'));
                     }
                 } else {
                     Phpfox::getUserParam('photo.can_add_public_categories', true);
                     if (Phpfox::getService('photo.category.process')->add($aVals)) {
                         $this->url()->send('admincp.photo', null, Phpfox::getPhrase('photo.photo_category_successfully_added'));
                     }
                 }
             }
         }
     }
     $this->template()->setTitle(Phpfox::getPhrase('photo.manage_photo_categories'))->setBreadCrumb(Phpfox::getPhrase('photo.manage_photo_categories'), $this->url()->makeUrl('admincp.photo'))->setHeader('cache', array('admin.js' => 'module_photo', 'jquery/ui.js' => 'static_script', 'sort.js' => 'module_photo'))->assign(array('sCreateJs' => $oValid->createJS(), 'sGetJsForm' => $oValid->getJsForm()));
 }
Beispiel #21
0
 public function process()
 {
     Phpfox::isUser(true);
     Phpfox::getUserParam('profiles.is_enabled', true);
     if ($sName = $this->request()->get('req3')) {
         $aExtraProfile = Phpfox::getService('profiles')->getProfile($sName);
     }
     if (count($aExtraProfile) == 0) {
         return Phpfox::getLib('module')->setController('error.404');
     }
     if (Phpfox::getUserId() != $aExtraProfile['user_id']) {
         Phpfox::getUserParam('profiles.can_edit_others', true);
         if (($aUser = Phpfox::getService('user')->getUser($aExtraProfile['user_id'], 'u.user_group_id')) && isset($aUser['user_group_id'])) {
             $iUserGroupId = $aUser['user_group_id'];
         }
     } else {
         $iUserGroupId = Phpfox::getUserBy('user_group_id');
     }
     $bIsEdit = false;
     if ($iId = $this->request()->getInt('id', false)) {
         $iUserGroupId = $iId;
         if ($aVals = $this->request()->getArray('custom') && !empty($aVals)) {
             $bIsEdit = true;
             if (Phpfox::getService('profiles.process')->updateFields($aExtraProfile['extra_id'], $aExtraProfile['user_id'], $aVals)) {
                 $this->url()->send('profiles.' . $aExtraProfile['title_url'], null, Phpfox::getPhrase('profiles.successfully_updated_name_profile', array('extra_name' => $aExtraProfile['title'])));
             }
         }
     }
     $aCustomFields = Phpfox::getService('profiles')->getFields(array('extra_main', 'extra_panel', 'extra_side'), $aExtraProfile['extra_id'], $iUserGroupId);
     $this->template()->setTitle(Phpfox::getPhrase('profiles.edit_extra_profiles'))->setBreadcrumb($aExtraProfile['title']);
     $this->template()->setHeader(array('custom.js' => 'module_profiles'))->assign(array('aExtraProfile' => $aExtraProfile, 'aSettings' => $aCustomFields, 'bIsEdit' => $bIsEdit));
 }
Beispiel #22
0
 /**
  * Controller
  */
 public function process()
 {
     if (Phpfox::getParam('core.phpfox_is_hosted')) {
         $this->url()->send('admincp');
     }
     $oArchiveExport = Phpfox::getLib('archive.export')->set(array('zip'));
     $oArchiveImport = Phpfox::getLib('archive.import')->set(array('zip'));
     if (($sExportId = $this->request()->get('id')) && !empty($sExportId)) {
         if ($sData = Phpfox::getService('emoticon')->export($sExportId)) {
             $oArchiveExport->download('phpfox-emoticon-' . $sExportId, 'xml', $sData);
         }
     }
     if (isset($_FILES['import']) && ($aFile = $_FILES['import'])) {
         if (preg_match('/^phpfox-emoticon-(.*?)\\.xml$/i', $aFile['name'], $aMatches)) {
             if ($sXmlData = file_get_contents($aFile['tmp_name'])) {
                 $aParams = Phpfox::getLib('xml.parser')->parse($sXmlData);
                 if (($mReturn = Phpfox::getService('emoticon.process')->import($this->request()->getArray('val'), $aParams)) && is_array($mReturn)) {
                     $this->url()->send('admincp.emoticon.view', array('id' => $mReturn['id']), Phpfox::getPhrase('emoticon.emoticon_package_successfully_created', array('success' => $mReturn['success'], 'failed' => $mReturn['failed'])));
                 }
             }
         } else {
             Phpfox_Error::set(Phpfox::getPhrase('emoticon.not_a_valid_emoticon_package_to_import'));
         }
     }
     $this->template()->setTitle(Phpfox::getPhrase('emoticon.import_emoticons'))->setBreadcrumb(Phpfox::getPhrase('emoticon.emoticons'), $this->url()->makeUrl('admincp.emoticon.package'))->setBreadCrumb(Phpfox::getPhrase('emoticon.import_emoticons'), null, true);
 }
Beispiel #23
0
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     if ($aTables = $this->request()->getArray('tables')) {
         if ($this->request()->get('optimize')) {
             foreach ($aTables as $sTable) {
                 Phpfox::getLib('database')->optimizeTable($sTable);
             }
             $this->url()->send('admincp.sql', null, Phpfox::getPhrase('admincp.table_s_successfully_optimized'));
         } elseif ($this->request()->get('repair')) {
             foreach ($aTables as $sTable) {
                 Phpfox::getLib('database')->repairTable($sTable);
             }
             $this->url()->send('admincp.sql', null, Phpfox::getPhrase('admincp.table_s_successfully_repaired'));
         }
     }
     $aItems = Phpfox::getLib('database')->getTableStatus();
     $iSize = 0;
     $iOverhead = 0;
     foreach ($aItems as $iKey => $aItem) {
         $iSize += $aItem['Data_length'];
         $iOverhead += $aItem['Data_free'];
         $aItems[$iKey]['Name'] = $aItems[$iKey]['Name'];
     }
     $this->template()->setTitle(Phpfox::getPhrase('admincp.sql_maintenance_title'))->setBreadcrumb(Phpfox::getPhrase('admincp.sql_maintenance_title'), $this->url()->makeUrl('admincp.sql'))->assign(array('aItems' => $aItems, 'iSize' => $iSize, 'iOverhead' => $iOverhead, 'iCnt' => count($aItems)));
 }
Beispiel #24
0
 /** This function catches all the "actions" (Dislike, and in the future maybe others)
  * */
 public function getNotificationAction($aNotification)
 {
     //d($aNotification);die();
     // get the type of item that was marked ("blog", "photo"...)
     $aAction = $this->database()->select('*')->from(Phpfox::getT('action'))->where('action_id = ' . (int) $aNotification['item_id'])->limit(1)->execute('getSlaveRow');
     if (empty($aAction) || !isset($aAction['item_type_id'])) {
         return false;
         throw new Exception('No type for this action (' . print_r($aAction, true) . ')');
     }
     // Check if the module is a sub module
     if (preg_match('/(?P<module>[a-z]+)[_]?(?P<submodule>[a-z]{0,99})/i', $aAction['item_type_id'], $aMatch) < 1) {
         throw new Exception('Malformed item_type');
     }
     // Call the module and get the title
     if (!Phpfox::isModule($aMatch['module'])) {
         return false;
     }
     $aRow = Phpfox::getService($aMatch['module'])->getInfoForAction($aAction);
     $sUsers = Phpfox::getService('notification')->getUsers($aNotification);
     $sTitle = Phpfox::getLib('parse.output')->shorten($aRow['title'], Phpfox::getParam('notification.total_notification_title_length'), '...');
     $sPhrase = '';
     if ($aNotification['user_id'] == $aRow['user_id']) {
         // {users} disliked {gender} own {item} "{title}"
         $sPhrase = Phpfox::getPhrase('like.users_disliked_gender_own_item_title', array('users' => $sUsers, 'gender' => Phpfox::getService('user')->gender($aRow['gender'], 1), 'title' => $sTitle, 'item' => $aAction['item_type_id']));
     } elseif ($aRow['user_id'] == Phpfox::getUserId()) {
         // {users} liked your blog "{title}"
         $sPhrase = Phpfox::getPhrase('like.users_disliked_your_item_title', array('users' => $sUsers, 'title' => $sTitle, 'item' => $aAction['item_type_id']));
     } else {
         $sPhrase = Phpfox::getPhrase('like.users_disliked_users_item', array('users' => $sUsers, 'row_full_name' => $aRow['full_name'], 'title' => $sTitle, 'item' => $aAction['item_type_id']));
     }
     return array('link' => $aRow['link'], 'message' => $sPhrase, 'icon' => Phpfox_Template::instance()->getStyle('image', 'activity.png', 'blog'));
 }
Beispiel #25
0
 /**
  * Class process method which is used to execute this component.
  */
 public function process()
 {
     if (substr(decoct(fileperms('./file/achievements/')), 1) != "0777") {
         $this->template()->assign(array('bError' => true))->setTitle('Konsort.org Achievements')->setBreadcrumb('Konsort.org Achievements')->setHeader('cache', array('pager.css' => 'style_css'));
     } else {
         if ($this->request()->get('setHighest', false)) {
             if (Phpfox::getService('achievements.process')->setHighest($this->request()->get('id', 0), $this->request()->get('category', 0))) {
                 $this->url()->send('admincp.achievements.list', null, 'Successfully made the selected acheivement the highest achievement for the category.');
             } else {
                 $this->url()->send('admincp.achievements.list', null, 'There was an error processing your request');
             }
         } elseif ($this->request()->get('unsetHighest', false)) {
             if (Phpfox::getService('achievements.process')->unsetHighest($this->request()->get('id', 0), $this->request()->get('category', 0))) {
                 $this->url()->send('admincp.achievements.list', null, 'Successfully unmade the selected acheivement the highest achievement for the category.');
             } else {
                 $this->url()->send('admincp.achievements.list', null, 'There was an error processing your request');
             }
         }
         $sLimit = 10;
         $iPage = $this->request()->get('page', 0);
         if ($iPage > 0) {
             $iPage--;
         }
         list($iCnt, $aAchievements) = Phpfox::getService('achievements')->getList($iPage, $sLimit);
         Phpfox::getLib('pager')->set(array('page' => $iPage + 1, 'size' => $sLimit, 'count' => $iCnt));
         $this->template()->assign(array('bError' => false, 'iCnt' => $iCnt, 'aAchievements' => $aAchievements))->setTitle('Konsort.org Achievements')->setBreadcrumb('Konsort.org Achievements')->setHeader('cache', array('pager.css' => 'style_css'));
     }
 }
Beispiel #26
0
 public function process()
 {
     if (Phpfox::getService('language.process')->useLanguage($this->get('id'))) {
         Phpfox::addMessage(Phpfox::getPhrase('language.successfully_updated_your_language_preferences'));
         $sReturn = Phpfox::getLib('session')->get('redirect');
         if (is_bool($sReturn)) {
             $sReturn = '';
         }
         if ($sReturn) {
             $aParts = explode('/', trim($sReturn, '/'));
             if (isset($aParts[0])) {
                 $aParts[0] = Phpfox_Url::instance()->reverseRewrite($aParts[0]);
             }
             if (isset($aParts[0]) && !Phpfox::isModule($aParts[0])) {
                 $aUserCheck = Phpfox::getService('user')->getByUserName($aParts[0]);
                 if (isset($aUserCheck['user_id'])) {
                     if (isset($aParts[1]) && !Phpfox::isModule($aParts[1])) {
                         $sReturn = '';
                     }
                 } else {
                     $sReturn = '';
                 }
             }
         }
         $sReturn = trim($sReturn, '/');
         $this->call('window.location.href = window.location.href;');
         // . Phpfox_Url::instance()->makeUrl($sReturn) . '\';');
     }
 }
Beispiel #27
0
 public function getJavascript($iPhotoId)
 {
     $aTags = $this->database()->select('p.user_id AS photo_owner_id, pt.tag_id, pt.user_id AS post_user_id, pt.content, pt.position_x, pt.position_y, pt.width, pt.height, ' . Phpfox::getUserField())->from($this->_sTable, 'pt')->leftJoin(Phpfox::getT('user'), 'u', 'u.user_id = pt.tag_user_id')->join(Phpfox::getT('photo'), 'p', 'p.photo_id = pt.photo_id')->where('pt.photo_id = ' . (int) $iPhotoId)->execute('getSlaveRows');
     if (!count($aTags)) {
         return false;
     }
     $sNotes = '[';
     foreach ($aTags as $aTag) {
         $sNotes .= '{';
         $sNotes .= 'note_id: ' . $aTag['tag_id'] . ', ';
         $sNotes .= 'x1: ' . $aTag['position_x'] . ', ';
         $sNotes .= 'y1: ' . $aTag['position_y'] . ', ';
         $sNotes .= 'width: ' . $aTag['width'] . ', ';
         $sNotes .= 'height: ' . $aTag['height'] . ', ';
         $sRemove = $aTag['post_user_id'] == Phpfox::getUserId() || $aTag['photo_owner_id'] == Phpfox::getUserId() || $aTag['user_id'] == Phpfox::getUserId() ? ' <a href="#" onclick="if (confirm(\\\'' . Phpfox::getPhrase('photo.are_you_sure') . '\\\')) { $(\\\'#noteform\\\').hide(); $(\\\'#js_photo_view_image\\\').imgAreaSelect({ hide: true }); $(this).parent(\\\'span:first\\\').remove();$(\\\'.notep#notep_' . $aTag['tag_id'] . '\\\').remove();$.ajaxCall(\\\'photo.removePhotoTag\\\', \\\'tag_id=' . $aTag['tag_id'] . '\\\'); } return false;"><i class="fa fa-remove"></i></a>' : '';
         if (!empty($aTag['user_id'])) {
             $sNotes .= 'note: \'<a href="' . Phpfox_Url::instance()->makeUrl($aTag['user_name']) . '" id="js_photo_tag_user_id_' . $aTag['user_id'] . '">' . $aTag['full_name'] . '</a>' . $sRemove . '\'';
         } else {
             $sNotes .= 'note: \'' . str_replace("'", "\\'", Phpfox::getLib('parse.output')->clean($aTag['content'])) . $sRemove . '\'';
         }
         $sNotes .= '},';
     }
     $sNotes = rtrim($sNotes, ',');
     $sNotes .= ']';
     return $sNotes;
 }
Beispiel #28
0
 /**
  * Cancels a user account by deleting all the information related to them.
  * @param array $aVal
  * @return Phpfox_Error if password doesnt match | false if user does not have enough permissions or password is not set
  */
 public function cancelAccount($aVal)
 {
     Phpfox::isUser(true);
     define('PHPFOX_CANCEL_ACCOUNT', true);
     if (!isset($aVal['password']) && !Phpfox::getUserBy('fb_user_id') && !Phpfox::getUserBy('janrain_user_id')) {
         return Phpfox_Error::set(Phpfox::getPhrase('user.please_enter_your_password'));
     }
     if (!Phpfox::getUserParam('user.can_delete_own_account')) {
         return Phpfox_Error::set(Phpfox::getPhrase('user.you_are_not_allowed_to_delete_your_own_account'));
     }
     // confirm $aVal[password] == user password
     // get user's data
     $aRow = $this->database()->select('password_salt, password')->from(Phpfox::getT('user'))->where('user_id = ' . Phpfox::getUserId())->execute('getSlaveRow');
     if (!Phpfox::getUserBy('fb_user_id') && !Phpfox::getUserBy('janrain_user_id') && Phpfox::getLib('hash')->setHash($aVal['password'], $aRow['password_salt']) != $aRow['password']) {
         if ($sPlugin = Phpfox_Plugin::get('user.service_cancellations_process_cancelaccount_invalid_password')) {
             eval($sPlugin);
         }
         return Phpfox_Error::set(Phpfox::getPhrase('user.invalid_password'));
     }
     Phpfox::getService('user.cancellations.process')->feedbackCancellation($aVal);
     // mass callback
     Phpfox::massCallback('onDeleteUser', Phpfox::getUserId());
     // log out adter having deleted all the info
     Phpfox::getService('user.auth')->logout();
     Phpfox_Url::instance()->send('', null, Phpfox::getPhrase('user.your_account_has_been_deleted'));
     return true;
 }
Beispiel #29
0
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     if ($this->request()->get('update')) {
         $aModules = Phpfox::massCallback('getSqlTitleField');
         $aParseTables = array();
         if (is_array($aModules) && count($aModules)) {
             foreach ($aModules as $aModule) {
                 if (isset($aModule['table'])) {
                     $aModule = array($aModule);
                 }
                 foreach ($aModule as $aInfo) {
                     $aParseTables[] = $aInfo;
                 }
             }
         }
         $oDb = Phpfox::getLib('database');
         foreach ($aParseTables as $aParseTable) {
             if (isset($aParseTable['has_index'])) {
                 $aIndexes = Phpfox::getLib('database.support')->getIndexes(Phpfox::getT($aParseTable['table']), null, $oDb, true);
                 foreach ($aIndexes as $aIndex) {
                     if ($aIndex['Column_name'] == $aParseTable['has_index']) {
                         $oDb->query('ALTER TABLE ' . Phpfox::getT($aParseTable['table']) . ' DROP INDEX ' . $aIndex['Key_name']);
                     }
                 }
             }
             Phpfox::getLib('database')->query('ALTER TABLE ' . Phpfox::getT($aParseTable['table']) . ' CHANGE ' . $aParseTable['field'] . ' ' . $aParseTable['field'] . ' text');
         }
         $this->url()->send('admincp.sql.title', null, Phpfox::getPhrase('admincp.database_tables_updated'));
     }
     $this->template()->setTitle(Phpfox::getPhrase('admincp.alter_title_fields'))->setBreadcrumb(Phpfox::getPhrase('admincp.alter_title_fields'))->assign(array());
 }
Beispiel #30
0
 public function get()
 {
     /*
     @title Get Feeds
     @info Get an activity feed for a specific user.
     @method GET
     @extra user_id=#{User ID#|int|yes}
     @return id=#{Item ID#|int}&title=#{Title of the item|string}&description=#{Description of the item|string}&likes=#{Total number of likes|int}&permalink=#{Link to the item|string}&content=#{Additional text some feeds might have|string}&image=#{Some feeds include an image|string}
     */
     define('PHPFOX_SKIP_LOOP_MAX_COUNT', true);
     $aFeeds = array();
     $aFeedRows = Phpfox::getService('feed')->get($this->_oApi->get('user_id'), null, $this->_oApi->get('page'));
     foreach ($aFeedRows as $iKey => $aFeedRow) {
         foreach ($aFeedRow as $sKey => $mValue) {
             if (substr($sKey, 0, 5) == 'feed_') {
                 if (in_array($sKey, array('feed_reference', 'feed_time_stamp', 'feed_icon', 'feed_month_year', 'feed_image_onclick', 'feed_is_liked'))) {
                     continue;
                 }
                 $sKey = str_replace('feed_', '', $sKey);
                 switch ($sKey) {
                     case 'total_like':
                         $sKey = 'likes';
                         break;
                     case 'info':
                         $mValue = '<a href="' . Phpfox::getLib('url')->makeUrl($aFeedRow['user_name']) . '">' . $aFeedRow['full_name'] . '</a> ' . $mValue;
                         break;
                 }
                 $aFeeds[$iKey][$sKey] = $mValue;
             }
         }
     }
     return $aFeeds;
 }