/**
  * Controller
  */
 public function process()
 {
     $sCountryChildValue = $this->getParam('country_child_value');
     $mCountryChildFilter = $this->getParam('country_child_filter', $this->request()->get('country_child_filter', null));
     $sCountryChildType = $this->getParam('country_child_type', null);
     $sCountryChildId = null;
     if (empty($sCountryChildValue) && Phpfox::isUser() && $mCountryChildFilter === null && !$this->getParam('country_not_user')) {
         $sCountryChildValue = Phpfox::getUserBy('country_iso');
     }
     $iSearchId = 0;
     if ($mCountryChildFilter !== null) {
         $iSearchId = $this->request()->get('search-id');
         if (!empty($iSearchId) && isset($_SESSION[Phpfox::getParam('core.session_prefix')]['search'][$sCountryChildType][$iSearchId]['country'])) {
             $sCountryChildValue = $_SESSION[Phpfox::getParam('core.session_prefix')]['search'][$sCountryChildType][$iSearchId]['country'];
         }
         if (isset($_SESSION[Phpfox::getParam('core.session_prefix')]['search'][$sCountryChildType][$iSearchId]['country_child_id'])) {
             $sCountryChildId = $_SESSION[Phpfox::getParam('core.session_prefix')]['search'][$sCountryChildType][$iSearchId]['country_child_id'];
         }
     }
     /* Last resort, get is a little heavy but controller didnt provide a child country*/
     if ($sCountryChildId == null && $this->getParam('country_child_id') == null) {
         $aUser = Phpfox::getService('user')->get(Phpfox::getUserId(), true);
         $sCountryChildId = $aUser['country_child_id'];
     }
     $this->template()->assign(array('aCountryChildren' => Phpfox::getService('core.country')->getChildren($sCountryChildValue), 'iCountryChildId' => (int) $this->getParam('country_child_id', $sCountryChildId), 'bForceDiv' => $this->getParam('country_force_div', false), 'mCountryChildFilter' => $mCountryChildFilter));
 }
示例#2
0
 public function getValidation($sStep = null)
 {
     $aValidation = array();
     if ($sStep == 1 || $sStep === null) {
         $aValidation['full_name'] = Phpfox::getPhrase('user.provide_your_full_name');
         $aValidation['email'] = array('def' => 'email', 'title' => Phpfox::getPhrase('user.provide_a_valid_email_address'));
         $aValidation['password'] = array('def' => 'password', 'title' => Phpfox::getPhrase('user.provide_a_valid_password'));
         if (Phpfox::getParam('user.new_user_terms_confirmation')) {
             $aValidation['agree'] = array('def' => 'checkbox', 'title' => Phpfox::getPhrase('user.check_our_agreement_in_order_to_join_our_site'));
         }
         if (!Phpfox::getParam('user.profile_use_id') && !Phpfox::getParam('user.disable_username_on_sign_up')) {
             $aValidation['user_name'] = array('def' => 'username', 'title' => Phpfox::getPhrase('user.provide_a_valid_user_name', array('min' => Phpfox::getParam('user.min_length_for_username'), 'max' => Phpfox::getParam('user.max_length_for_username'))));
         }
     }
     if ($sStep == 2 || $sStep === null) {
         if (Phpfox::getParam('core.registration_enable_dob')) {
             $aValidation['month'] = Phpfox::getPhrase('user.select_month_of_birth');
             $aValidation['day'] = Phpfox::getPhrase('user.select_day_of_birth');
             $aValidation['year'] = Phpfox::getPhrase('user.select_year_of_birth');
         }
         if (Phpfox::getParam('core.registration_enable_location')) {
             $aValidation['country_iso'] = Phpfox::getPhrase('user.select_current_location');
         }
         if (Phpfox::getParam('core.registration_enable_gender')) {
             $aValidation['gender'] = Phpfox::getPhrase('user.select_your_gender');
         }
     }
     if (Phpfox::isModule('captcha') && Phpfox::getParam('user.captcha_on_signup') && $sStep === null) {
         $aValidation['image_verification'] = Phpfox::getPhrase('captcha.complete_captcha_challenge');
     }
     return $aValidation;
 }
示例#3
0
 /**
  * Need this to take over photo moderation
  * Enter description here ...
  */
 public function moderation()
 {
     Phpfox::isUser(true);
     switch ($this->get('action')) {
         case 'approve':
             Phpfox::getUserParam('photo.can_approve_photos', true);
             foreach ((array) $this->get('item_moderate') as $iId) {
                 Phpfox::getService('photo.process')->approve($iId);
                 $this->call('$(\'#js_photo_id_' . $iId . '\').remove();');
             }
             $sMessage = Phpfox::getPhrase('photo.photo_s_successfully_approved');
             $this->alert($sMessage, 'Moderation', 300, 150, true);
             break;
         case 'delete':
             Phpfox::getUserParam('photo.can_delete_other_photos', true);
             $item = $this->get('item_moderate')[0];
             $bReload = Phpfox::getService('profiles')->getUserAndProfile($item);
             if ($bReload) {
                 $this->call('location.reload();');
             }
             foreach ((array) $this->get('item_moderate') as $iId) {
                 Phpfox::getService('photo.process')->delete($iId);
                 $this->call('$(\'#js_photo_id_' . $iId . '\').remove();');
             }
             $sMessage = Phpfox::getPhrase('photo.photo_s_successfully_deleted');
             break;
     }
     $this->updateCount();
     $this->hide('.moderation_process');
 }
示例#4
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);
     }
 }
示例#5
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;
 }
示例#6
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();
 }
示例#7
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'));
     }
 }
示例#8
0
 public function getApiSupportedMethods()
 {
     $aMethods = array();
     $aMethods[] = array('call' => 'getNewCount', 'requires' => array('user_id' => 'user_id'), 'detail' => Phpfox::getPhrase('notification.get_the_total_number_of_unseen_notifications_if_you_do_not_pass_the_user_id_we_will_return_information_about_the_user_that_is_currently_logged_in'), 'type' => 'GET', 'response' => '{"api":{"total":5,"pages":0,"current_page":0},"output":5}');
     $aMethods[] = array('call' => 'get', 'requires' => array('user_id' => 'user_id'), 'detail' => Phpfox::getPhrase('notification.get_all_of_the_users_notifications_if_you_do_not_pass_the_user_id_we_will_return_information_about_the_user_that_is_currently_logged_in'), 'type' => 'GET', 'response' => '{"api":{"total":0,"pages":0,"current_page":0},"output":[{"notification_id":"3","link":"http:\\/\\/[DOMAIN_REPLACE]\\/john-doe\\/comment-id_1\\/","message":"Jane Doe commented on your wall","icon":"http:\\/\\/[DOMAIN_REPLACE]\\/module\\/blog\\/static\\/image\\/default\\/default\\/activity.png"}]}');
     return array('module' => 'notification', 'module_info' => '', 'methods' => $aMethods);
 }
示例#9
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));
     }
 }
示例#10
0
 /**
  * Controller
  */
 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_Validator::instance()->set(array('sFormName' => 'js_form', 'aParams' => $aParams));
     if ($aVals = $this->request()->getArray('val')) {
         if ($oValid->isValid($aVals)) {
             if (Music_Service_Process::instance()->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));
 }
示例#11
0
 /**
  * Controller
  */
 public function process()
 {
     /* This is a good way of leaving out the admins and staff, we could remove the Banned user groups
      * but that would require more processing */
     $aUserGroups = Phpfox::getService('user.group')->get('user_group_id != 1 AND user_group_id != 4');
     $this->template()->assign(array('aUserGroups' => $aUserGroups, 'bShow' => $this->getParam('bShow', false) ? true : false, 'bHideAffected' => $this->getParam('bHideAffected', false) ? true : false));
 }
示例#12
0
 /**
  * Controller
  */
 public function process()
 {
     $this->_setMenuName('admincp.user.cancellations.add');
     // is user trying to edit or add an item?
     if ($aVals = $this->request()->getArray('val')) {
         if (Phpfox::getService('user.cancellations.process')->add($aVals)) {
             if (isset($aVals['iDeleteId'])) {
                 $sMessage = Phpfox::getPhrase('user.option_updated_successfully');
             } else {
                 $sMessage = Phpfox::getPhrase('user.option_added_successfully');
             }
             $this->url()->send('admincp.user.cancellations.manage', null, $sMessage);
         }
     }
     // is user requesting an item for edit?
     if ($iId = $this->request()->getInt('id')) {
         $aDelete = Phpfox::getService('user.cancellations')->get($iId);
         if (empty($aDelete)) {
             Phpfox_Error::set(Phpfox::getPhrase('user.item_not_found'));
         }
         $aDelete = reset($aDelete);
         $this->template()->assign(array('aForms' => $aDelete));
     }
     $this->template()->setTitle(Phpfox::getPhrase('user.add_cancellation_options'))->setBreadcrumb(Phpfox::getPhrase('user.add_cancellation_options'), $this->url()->makeUrl('admincp.user.cancellations.add'), true)->assign(array());
 }
示例#13
0
 /**
  * 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('');
             }
         }
     }
 }
示例#14
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'));
 }
示例#15
0
 /**
  * Controller
  */
 public function process()
 {
     if ($sPlugin = Phpfox_Plugin::get('core.component_controller_index_visitor_start')) {
         eval($sPlugin);
     }
     $image = [];
     list($total, $featured) = Photo_Service_Photo::instance()->getFeatured();
     if (is_array($featured) && isset($featured[0])) {
         $photo = $featured[0];
         $url = Phpfox_Image_Helper::instance()->display(['server_id' => $photo['server_id'], 'path' => 'photo.url_photo', 'file' => $photo['destination'], 'suffix' => '_1024', 'return_url' => true]);
         $image = ['image' => $url, 'info' => strip_tags($photo['title']) . ' by ' . $photo['full_name']];
     }
     if (!$image) {
         $images = ['create-a-community-for-musicians.jpg' => 'Creating communities for Musicians', 'create-a-community-for-athletes.jpg' => 'Creating communities for Athletes', 'create-a-community-for-photographers.jpg' => 'Creating communities for Photographers', 'create-a-social-network-for-fine-cooking.jpg' => 'Creating communities for Fine Cooking'];
         $total = rand(1, count($images));
         $image = [];
         $cnt = 0;
         foreach ($images as $image => $info) {
             $cnt++;
             $image = ['image' => 'http://bg.m9.io/' . $image, 'info' => $info];
             if ($cnt === $total) {
                 break;
             }
         }
     }
     $this->template()->setHeader('cache', array('register.js' => 'module_user', 'country.js' => 'module_core', 'comment.css' => 'style_css'))->setBreadCrumb(Phpfox::getParam('core.site_title'))->setPhrase(array('user.continue'))->assign(array('aSettings' => Phpfox::getService('custom')->getForEdit(array('user_main', 'user_panel', 'profile_panel'), null, null, true), 'image' => $image));
 }
示例#16
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;
 }
示例#17
0
    /**
     * Class process method wnich is used to execute this component.
     */
    public function process()
    {
        Phpfox::getService('user.auth')->logout();
        $sHttp = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https' : 'http';
        $this->template()->setFullSite();
        $this->template()->setHeader(array('<script src="' . $sHttp . '://connect.facebook.net/en_US/all.js" type="text/javascript"></script>', '<script type="text/javascript">
				$Behavior.facebook_init = function()
				{
					FB.init(
					{
					    appId  : \'' . Phpfox::getParam('facebook.facebook_app_id') . '\',
					    status : true,
					    cookie : true,
						oauth  : true,
					    xfbml  : true
				   });
		   
				   FB.getLoginStatus(function(response) 
				   {
						if (response.authResponse)
						{ 
		  					FB.logout(function(response) 
		  					{  
				   				window.location.href = \'' . $this->url()->makeUrl('') . '\';
				   			});
		  				}
				   		else
				   		{
				   			window.location.href = \'' . $this->url()->makeUrl('') . '\';
				   		}
				   });		   
		   
		   		};
		   </script>'));
    }
示例#18
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));
 }
示例#19
0
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     Phpfox::isUser(true);
     $sMessage = Phpfox::getPhrase('share.hi_check_this_out_bbcode', array('url' => $this->request()->get('url')));
     $sMessage = str_replace("\n", "", $sMessage);
     $this->template()->assign(array('sTitle' => $this->request()->get('title'), 'sMessage' => $sMessage));
 }
示例#20
0
 public function get($iContestId, $iPage = 0, $iLimit = 20)
 {
     $where = 'cta.contest_id = ' . $iContestId;
     $iCnt = $this->database()->select('count(*)')->from($this->_sTable, 'cta')->join(Phpfox::getT('user'), 'u', 'u.user_id = cta.user_id')->where($where)->execute('getSlaveField');
     $aRows = $this->database()->select('*')->from($this->_sTable, 'cta')->join(Phpfox::getT('user'), 'u', 'u.user_id = cta.user_id')->where($where)->limit($iPage, $iLimit)->execute('getSlaveRows');
     return array($iCnt, $aRows);
 }
示例#21
0
	public function process()
	{
		$aUser = $this->getParam('aUser');
		if (empty($aUser))
		{
			$aUser = $this->request()->get('iUser');
		}
		//$iUser = (PHPFOX_IS_AJAX ? $this->request()->get('iUser') : $this->getParam('iUser'));
		
		$this->template()->assign(array(
				'iUser' => $aUser['user_id']
			)
		);
		
		if (!PHPFOX_IS_AJAX)
		{
			if (Phpfox::getService('friend')->isBirthdaySent(Phpfox::getUserId(), $aUser['user_id']))
			{
				return false;
			}
			
			$this->template()->assign(array(
					'sHeader' => 'Birthday Notification'					
				)
			);
			
			return 'block';
		}
	}
示例#22
0
 /**
  * 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));
 }
示例#23
0
	/**
	 * Class process method wnich is used to execute this component.
	 */
	public function process()
	{
		if ($aOrder = $this->request()->getArray('order'))
		{
			if (Phpfox::getService('event.category.process')->updateOrder($aOrder))
			{
				$this->url()->send('admincp.event', null, Phpfox::getPhrase('event.category_order_successfully_updated'));
			}
		}		
		
		if ($iDelete = $this->request()->getInt('delete'))
		{
			if (Phpfox::getService('event.category.process')->delete($iDelete))
			{
				$this->url()->send('admincp.event', null, Phpfox::getPhrase('event.category_successfully_deleted'));
			}
		}
	
		$this->template()->setTitle(Phpfox::getPhrase('event.manage_categories'))
			->setBreadcrumb(Phpfox::getPhrase('event.manage_categories'), $this->url()->makeUrl('admincp.event'))
			->setPhrase(array(
					'event.are_you_sure_this_will_delete_all_events_that_belong_to_this_category_and_cannot_be_undone'
				)
			)
			->setHeader(array(
					'jquery/ui.js' => 'static_script',
					'admin.js' => 'module_event',
					'<script type="text/javascript">$Core.event.url(\'' . $this->url()->makeUrl('admincp.event') . '\');</script>'
				)
			)
			->assign(array(
					'sCategories' => Phpfox::getService('event.category')->display('admincp')->get()
				)
			);	
	}
示例#24
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)));
 }
示例#25
0
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     if ($aVals = $this->request()->getArray('val')) {
         if (isset($aVals['question_id'])) {
             if (Phpfox::getService('user.process')->editSpamQuestion($aVals)) {
                 //die('Finished editing question');
             }
         } else {
             if (Phpfox::getService('user.process')->addSpamQuestion($aVals)) {
                 //die('Finished adding question');
             }
         }
     }
     $aOut = array();
     $aOut['questions'] = Phpfox::getService('user')->getSpamQuestions();
     if ($iQuestionId = $this->request()->getInt('id')) {
         foreach ($aOut['questions'] as $aQuestion) {
             if ($aQuestion['question_id'] == $iQuestionId) {
                 $aOut['edit'] = $aQuestion;
             }
         }
     }
     $jOut = json_encode($aOut);
     $this->template()->setBreadCrumb(Phpfox::getPhrase('user.anti_spam_security_questions'))->setTitle(Phpfox::getPhrase('user.anti_spam_security_questions'))->assign(array('sSiteUsePhrase' => $this->url()->makeUrl('admincp.language.phrase.add', array('last-module' => 'user'))))->setHeader(array('admin.spam.js' => 'module_user', 'admin.spam.css' => 'module_user', '<script type="text/javascript">$Behavior.initSpamQuestions = function(){$Core.User.Spam.initAdd();};</script>', '<script type="text/javascript">$Behavior.initData = function(){$Core.User.Spam.initPopulate(' . $jOut . ');};</script>'))->setPhrase(array('user.setting_require_all_spam_questions_on_signup', 'user.edit_question'));
 }
示例#26
0
 /**
  * Controller
  */
 public function process()
 {
     if ($iCommentId = $this->request()->getInt('req3')) {
         $aComment = Phpfox::getService('comment')->getComment($iCommentId);
         if (!isset($aComment['comment_id'])) {
             return Phpfox_Error::display(Phpfox::getPhrase('comment.comment_does_not_exist'));
         }
         if (Phpfox::hasCallback('comment', 'getRedirectRequest')) {
             $this->url()->forward(Phpfox::callback('comment.getRedirectRequest', $aComment['comment_id']));
         }
         if (Phpfox::hasCallback($aComment['type_id'], 'getParentItemCommentUrl')) {
             $sNewUrl = Phpfox::callback($aComment['type_id'] . '.getParentItemCommentUrl', $aComment);
             if ($sNewUrl !== false) {
                 $aComment['callback_url'] = $sNewUrl;
             }
         }
         $this->template()->setTitle(Phpfox::getPhrase('comment.viewing_comment'))->setHeader(array('view.css' => 'module_comment'))->setBreadcrumb(Phpfox::getPhrase('comment.viewing_comment'))->assign(array('aComment' => $aComment));
     } else {
         $aComment = Phpfox::getService('comment')->getComment($this->request()->getInt('id'));
         if (!isset($aComment['comment_id'])) {
             return Phpfox_Error::display(Phpfox::getPhrase('comment.comment_does_not_exist'));
         }
         $this->url()->forward(Phpfox::callback('comment.getRedirectRequest', $aComment['comment_id']));
     }
 }
示例#27
0
	/**
	 * Class process method wnich is used to execute this component.
	 */
	public function process()
	{
		$this->template()->assign(array(
				'sJanrainUrl' => (Phpfox::isModule('janrain') ? Phpfox::getService('janrain')->getUrl() : '')
			)
		);
	}
示例#28
0
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     $iUser = $this->request()->get('iUser');
     $aUser = Phpfox::getService('user')->get($iUser, true);
     $this->template()->assign(array('aUser' => $aUser, 'iUserIdDelete' => $aUser['user_id']));
     return 'block';
 }
示例#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());
 }
示例#30
0
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     if (($sLegacyTitle = $this->request()->get('req2')) && !empty($sLegacyTitle)) {
         Phpfox::getService('core')->getLegacyItem(array('field' => array('group_id', 'title'), 'table' => 'group', 'redirect' => 'pages', 'title' => $sLegacyTitle));
     }
     $this->url()->send('pages', array(), null, 301);
 }