예제 #1
0
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     if (Phpfox::getUserBy('profile_page_id') > 0) {
         return false;
     }
     if ($iVideoId = $this->request()->getInt('video_id')) {
         list($iCnt, $aVideos) = Phpfox::getService('video')->getRelatedVideos($iVideoId, $this->request()->get('video_title'), $this->request()->getInt('page_number') + 1);
         if (!count($aVideos)) {
             return false;
         }
         Phpfox::getLib('pager')->set(array('page' => $this->request()->getInt('page_number'), 'size' => Phpfox::getParam('video.total_related_videos'), 'count' => $iCnt));
         if (Phpfox::getLib('pager')->getLastPage() <= $this->request()->getInt('page_number')) {
             return false;
         }
         $this->template()->assign(array('aRelatedVideos' => $aVideos, 'bIsLoadingMore' => true));
     } else {
         $aVideo = $this->getParam('aVideo');
         list($iCnt, $aVideos) = Phpfox::getService('video')->getRelatedVideos($aVideo['video_id'], $aVideo['title'], 1, true);
         if (!count($aVideos)) {
             return false;
         }
         $this->template()->assign(array('sHeader' => Phpfox::getPhrase('video.suggestions'), 'aRelatedVideos' => $aVideos));
         Phpfox::getLib('pager')->set(array('page' => $this->request()->getInt('page_number'), 'size' => Phpfox::getParam('video.total_related_videos'), 'count' => $iCnt));
         if ($iCnt >= Phpfox::getParam('video.total_related_videos')) {
             $this->template()->assign(array('aFooter' => array(Phpfox::getPhrase('video.load_more_suggestions') => '#')));
         }
         return 'block';
     }
 }
예제 #2
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();
 }
예제 #3
0
파일: cdn.class.php 프로젝트: Lovinity/EQM
 /**
  * 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);
     }
 }
예제 #4
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));
     }
 }
예제 #5
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));
 }
예제 #6
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'));
 }
예제 #7
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('');
             }
         }
     }
 }
예제 #8
0
 /**
  * Process the controller
  *
  */
 public function process()
 {
     if (Phpfox::isUser()) {
         $this->url()->send('');
     }
     if ($sRequest = $this->request()->get('id')) {
         if ($aVals = $this->request()->getArray('val')) {
             if (!isset($aVals['newpassword']) || !isset($aVals['newpassword2']) || $aVals['newpassword'] != $aVals['newpassword2']) {
                 Phpfox_Error::set(Phpfox::getPhrase('user.your_confirmed_password_does_not_match_your_new_password'));
             } else {
                 if (Phpfox::getService('user.password')->updatePassword($sRequest, $aVals)) {
                     $this->url()->send('user.password.verify', null, Phpfox::getPhrase('user.password_successfully_updated'));
                 }
             }
         }
         if (Phpfox::getParam('user.shorter_password_reset_routine')) {
             if (Phpfox::getService('user.password')->isValidRequest($sRequest) == true) {
                 $this->template()->assign(array('sRequest' => $sRequest));
             } else {
             }
         } else {
             if (Phpfox::getService('user.password')->verifyRequest($sRequest)) {
                 $this->url()->send('user.password.verify', null, Phpfox::getPhrase('user.new_password_successfully_sent_check_your_email_to_use_your_new_password'));
             }
         }
     }
     $this->template()->setTitle(Phpfox::getPhrase('user.password_request_verification'))->setBreadcrumb(Phpfox::getPhrase('user.password_request_verification'));
 }
예제 #9
0
 /**
  * Controller
  */
 public function process()
 {
     Phpfox::isUser(true);
     $sView = $this->request()->get('view');
     $aCond = array();
     switch ($sView) {
         case 'pending':
             $aCond[] = 'AND a.is_custom = 2';
             break;
         case 'payment':
             $aCond[] = 'AND a.is_custom = 1';
             break;
         case 'denied':
             $aCond[] = 'AND a.is_custom = 4';
             break;
         default:
             $aCond[] = 'AND a.is_custom = 3';
             break;
     }
     $aCond[] = 'AND a.user_id = ' . Phpfox::getUserId();
     if (Phpfox::getParam('ad.multi_ad')) {
         $aCond[] = ' AND a.location = 50';
     }
     $aAds = Ad_Service_Ad::instance()->getForUser($aCond);
     Ad_Service_Ad::instance()->getSectionMenu();
     $this->template()->setTitle(Phpfox::getPhrase('ad.ad_management'))->setFullSite()->setBreadcrumb(Phpfox::getPhrase('ad.advertise'), $this->url()->makeUrl('ad'))->setBreadcrumb(Phpfox::getPhrase('ad.advertise'), $this->url()->makeUrl('ad.manage'), true)->setHeader(array('table.css' => 'style_css', 'manage.js' => 'module_ad'))->assign(array('aAllAds' => $aAds, 'sView' => $sView, 'bNewPurchase' => $this->request()->get('payment')));
 }
예제 #10
0
파일: add.class.php 프로젝트: Lovinity/EQM
    /**
     * Class process method wnich is used to execute this component.
     */
    public function process()
    {
        if (Phpfox::getParam('core.phpfox_is_hosted')) {
            $this->url()->send('admincp');
        }
        if ($aVals = $this->request()->getArray('val')) {
            if (Phpfox::getService('theme.style.process')->addCss($aVals)) {
                $this->url()->send('admincp.theme.style.css.add', null, Phpfox::getPhrase('theme.css_file_successfully_added'));
            }
        }
        if (Phpfox::getParam('core.enabled_edit_area')) {
            $this->template()->setHeader(array('editarea/edit_area_full.js' => 'static_script', '<script type="text/javascript">				
						editAreaLoader.init({
							id: "js_template_content"	
							,start_highlight: true
							,allow_resize: "both"
							,allow_toggle: false
							,word_wrap: false
							,language: "en"
							,syntax: "css"
						});		
					</script>'));
        }
        $this->template()->setTitle(Phpfox::getPhrase('theme.creating_css_file'))->setBreadcrumb(Phpfox::getPhrase('theme.creating_css_file'))->assign(array('aStyles' => Phpfox::getService('theme.style')->get()));
    }
예제 #11
0
 public function getDashboardMenus()
 {
     if (!Phpfox::getParam('subscribe.enable_subscription_packages')) {
         return false;
     }
     return array('subscribe.upgrades' => '#subscribe.listUpgrades?id=js_core_dashboard');
 }
예제 #12
0
 public function check()
 {
     if (!Phpfox::getParam('user.check_promotion_system')) {
         return false;
     }
     if (!Phpfox::isUser()) {
         return false;
     }
     $sCacheId = $this->cache()->set('promotion_' . Phpfox::getUserBy('user_group_id'));
     $aPromotion = array();
     if (!($aPromotion = $this->cache()->get($sCacheId))) {
         $aPromotion = $this->database()->select('*')->from($this->_sTable)->where('user_group_id = ' . Phpfox::getUserBy('user_group_id'))->execute('getSlaveRow');
         $this->cache()->save($sCacheId, $aPromotion);
     }
     if (isset($aPromotion['promotion_id'])) {
         if ((int) Phpfox::getUserBy('activity_points') >= (int) $aPromotion['total_activity'] && (int) $aPromotion['total_activity']) {
             $this->database()->update(Phpfox::getT('user'), array('user_group_id' => $aPromotion['upgrade_user_group_id']), 'user_id = ' . Phpfox::getUserId());
             Phpfox_Url::instance()->send('user.promotion');
         } else {
             if ((int) $aPromotion['total_day'] > 0) {
                 if (str_replace('-', '', Phpfox::getUserBy('joined') - PHPFOX_TIME) >= $aPromotion['total_day'] * 86400) {
                     $this->database()->update(Phpfox::getT('user'), array('user_group_id' => $aPromotion['upgrade_user_group_id']), 'user_id = ' . Phpfox::getUserId());
                     Phpfox_Url::instance()->send('user.promotion');
                 }
             }
         }
     }
 }
예제 #13
0
파일: my.class.php 프로젝트: hoanghd/tools
	/**
	 * Class process method wnich is used to execute this component.
	 */
	public function process()
	{
		$aListing = $this->getParam('aListing');
		
		list($iCnt, $aListings) = Phpfox::getService('marketplace')->getUserListings($aListing['listing_id'], $aListing['user_id']);
		
		if (!$iCnt)
		{
			return false;
		}
		
		$this->template()->assign(array(
				'sHeader' => 'More From Seller',
				'aMyListings' => $aListings
			)
		);
		
		if ($iCnt > Phpfox::getParam('marketplace.total_listing_more_from'))
		{
			$this->template()->assign(array(
					'aFooter' => array(
						Phpfox::getPhrase('marketplace.view_more') => $this->url()->makeUrl($aListing['user_name'], array('marketplace'))
					)
				)
			);
		}
		
		return 'block';				
	}
예제 #14
0
	public function playInFeed()
	{
		$aSong = Phpfox::getService('music')->getSong($this->get('id'));
		
		if (!isset($aSong['song_id']))
		{
			$this->alert(Phpfox::getPhrase('music.unable_to_find_the_song_you_are_trying_to_play'));
			
			return false;
		}
		
		Phpfox::getService('music.process')->play($aSong['song_id']);
		
		$sSongPath = $aSong['song_path'];
		
		$sWidth = '425px';
		if ($this->get('track'))
		{
			$sWidth = '100%';
		}
		
		$sDivId = 'js_tmp_music_player_' . $aSong['song_id'];
		$this->call('$Core.loadStaticFile(\'' . $this->template()->getStyle('static_script', 'player/' . Phpfox::getParam('core.default_music_player') . '/core.js') . '\');');
		if ($this->get('feed_id'))
		{
			$this->call('$(\'#js_item_feed_' . $this->get('feed_id') . '\').find(\'.activity_feed_content_link:first\').html(\'<div id="' . $sDivId . '" style="width:425px; height:30px;"></div>\');');
		}
		else 
		{
			$this->call('$(\'#' . ($this->get('track') ? $this->get('track') : 'js_controller_music_play_' . $this->get('id') . '') . '\').html(\'<div id="' . $sDivId . '" style="width:' . $sWidth . '; height:30px;"></div>\');');
		}
		$this->call('$Core.player.load({id: \'' . $sDivId . '\', auto: true, type: \'music\', play: \'' . $sSongPath . '\'});');		
	}
예제 #15
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);
 }
예제 #16
0
 /**
  * Class constructor. Gets the new prefix from the global settings.
  *
  */
 public function __construct()
 {
     $this->_sPrefix = Phpfox::getParam('core.session_prefix');
     if (session_status() == PHP_SESSION_NONE) {
         session_start();
     }
 }
예제 #17
0
 /**
  * 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));
 }
예제 #18
0
 public function feedDisplayLimitProfile($mValue)
 {
     if (in_array((int) $mValue, Phpfox::getParam('feed.user_feed_display_limit'))) {
         return true;
     }
     return false;
 }
예제 #19
0
 public function update($sTable, $iId, $iUserId = null)
 {
     if (Phpfox::getParam('track.cache_allow_recurrent_visit') > 0) {
         // Get the cache!
         $sType = '';
         switch ($sTable) {
             case 'user_track':
                 // This type is defined in the service track->getLatestUsers. It is also used in track.callback->addTrack
                 $sType = 'profile';
                 break;
         }
         $sCacheId = $this->cache()->set(array('track', $sType . '_' . $iId));
         if (!($aTracks = $this->cache()->get($sCacheId))) {
         } else {
             // Check every track record in cache
             foreach ($aTracks as $aTrack) {
                 // If its the user visiting this profile and it was added recently we dont add it anymore.
                 if ($aTrack['user_id'] == Phpfox::getUserId() && $aTrack['time_stamp'] >= PHPFOX_TIME - Phpfox::getParam('track.cache_allow_recurrent_visit') * 60) {
                     return true;
                 }
             }
         }
     }
     $this->database()->update(Phpfox::getT($sTable), array('time_stamp' => PHPFOX_TIME), 'item_id = ' . (int) $iId . ' AND user_id = ' . Phpfox::getUserId());
 }
예제 #20
0
 /**
  * Based on what storage system is set within the global settings this is where we load the file.
  * You can also pass any params to the storage object.
  *
  * @param array $aParams Any extra params you may want to pass to the storage object.
  */
 public function __construct($aParams = array())
 {
     if (!self::$_oObject) {
         $dir = PHPFOX_DIR_SITE . 'Apps/';
         if (is_dir($dir)) {
             foreach (scandir($dir) as $app) {
                 $path = $dir . $app . '/';
                 if (file_exists($path . 'app.lock') && file_exists($path . 'app.json')) {
                     $json = json_decode(file_get_contents($path . 'app.json'));
                     if (is_object($json) && isset($json->lib) && isset($json->lib->cache)) {
                         if (file_exists($path . 'vendor/autoload.php')) {
                             require $path . 'vendor/autoload.php';
                         }
                         try {
                             self::$_oObject = (new \ReflectionClass($json->lib->cache))->newInstance();
                         } catch (\Exception $e) {
                         }
                         break;
                     }
                 }
             }
         }
         if (!self::$_oObject) {
             $sStorage = isset($aParams['storage']) ? $aParams['storage'] : Phpfox::getParam('core.cache_storage');
             switch ($sStorage) {
                 case 'memcache':
                     $sStorage = 'phpfox.cache.storage.memcache';
                     break;
                 default:
                     $sStorage = 'phpfox.cache.storage.file';
             }
             self::$_oObject = Phpfox::getLib($sStorage, $aParams);
         }
     }
 }
예제 #21
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));
 }
예제 #22
0
 /**
  * Controller
  */
 public function process()
 {
     if (Phpfox::getParam('core.phpfox_is_hosted')) {
         $this->url()->send('admincp');
     }
     $bIsEdit = false;
     if (($iId = $this->request()->getInt('id')) && ($aComponent = Phpfox::getService('admincp.component')->getForEdit($iId))) {
         $bIsEdit = true;
         $this->template()->assign(array('aForms' => $aComponent));
     }
     $aValidation = array('product_id' => Phpfox::getPhrase('admincp.select_product'), 'component' => Phpfox::getPhrase('admincp.specify_component'), 'is_active' => Phpfox::getPhrase('admincp.select_component_active'), 'type' => Phpfox::getPhrase('admincp.select_component_type'));
     $oValid = Phpfox_Validator::instance()->set(array('sFormName' => 'js_form', 'aParams' => $aValidation));
     if ($aVals = $this->request()->getArray('val')) {
         if ($oValid->isValid($aVals)) {
             if ($bIsEdit) {
                 if (Phpfox::getService('admincp.component.process')->update($iId, $aVals)) {
                     $this->url()->send('admincp.component.add', array('id' => $iId), Phpfox::getPhrase('admincp.component_successfully_updated'));
                 }
             } else {
                 if (Phpfox::getService('admincp.component.process')->add($aVals)) {
                     $this->url()->send('admincp.component', null, Phpfox::getPhrase('admincp.component_successfully_added'));
                 }
             }
         }
     }
     $this->template()->setTitle($bIsEdit ? Phpfox::getPhrase('admincp.editing_component') : Phpfox::getPhrase('admincp.add_component'))->setBreadcrumb(Phpfox::getPhrase('admincp.manage_components'), $this->url()->makeUrl('admincp.component'))->setBreadCrumb($bIsEdit ? Phpfox::getPhrase('admincp.editing_component') : Phpfox::getPhrase('admincp.add_component'), null, true)->assign(array('aProducts' => Admincp_Service_Product_Product::instance()->get(), 'aModules' => Phpfox::getService('admincp.module')->getModules(), 'sCreateJs' => $oValid->createJS(), 'sGetJsForm' => $oValid->getJsForm(), 'bIsEdit' => $bIsEdit));
 }
예제 #23
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));
 }
예제 #24
0
 public function getSiteStats()
 {
     $sCacheQueryId = $this->cache()->set('stat_query');
     if (!($aStats = $this->cache()->get($sCacheQueryId))) {
         $aStats = $this->database()->select('ss.*')->from($this->_sTable, 'ss')->where('ss.is_active = 1')->join(Phpfox::getT('module'), 'm', 'm.module_id = ss.module_id AND m.is_active = 1')->join(Phpfox::getT('product'), 'p', 'p.product_id = ss.product_id AND p.is_active = 1')->order('ss.ordering ASC')->execute('getRows');
         $this->cache()->save($sCacheQueryId, $aStats);
     }
     $aCached = array();
     $bRun = true;
     if (Phpfox::getParam('core.cache_site_stats')) {
         $sCacheCountId = $this->cache()->set('stat_count');
         if ($aCached = $this->cache()->get($sCacheCountId, Phpfox::getParam('core.site_stat_update_time'))) {
             $bRun = false;
         }
     }
     if ($bRun === true) {
         foreach ($aStats as $aStat) {
             eval('$aStat[\'count\'] = ' . $aStat['php_code'] . '');
             unset($aStat['php_code']);
             $aCached[] = $aStat;
         }
         if (Phpfox::getParam('core.cache_site_stats')) {
             $this->cache()->save($sCacheCountId, $aCached);
         }
     }
     return $aCached;
 }
예제 #25
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>'));
    }
예제 #26
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';
 }
예제 #27
0
 /**
  * Gets the featured members according to Phpfox::getParam('user.how_many_featured_members').
  * Uses cache to save a query (stores a cache if none found)
  * @return array( array of users, int total featured users )
  */
 public function get()
 {
     if ($sPlugin = Phpfox_Plugin::get('user.service_featured_get_1')) {
         eval($sPlugin);
         if (isset($mPluginReturn)) {
             return $mPluginReturn;
         }
     }
     $iTotal = Phpfox::getParam('user.how_many_featured_members');
     // the random will be done with php logic
     $sCacheId = $this->cache()->set('featured_users');
     if (!($aUsers = $this->cache()->get($sCacheId))) {
         $aUsers = $this->database()->select(Phpfox::getUserField() . ', uf.ordering')->from(Phpfox::getT('user'), 'u')->join($this->_sTable, 'uf', 'uf.user_id = u.user_id')->order('ordering DESC')->execute('getSlaveRows');
         if (Phpfox::getParam('user.cache_featured_users')) {
             $this->cache()->save($sCacheId, $aUsers);
         }
     }
     if (!is_array($aUsers)) {
         return array(array(), 0);
     }
     $aOut = array();
     if (Phpfox::getParam('user.randomize_featured_members')) {
         shuffle($aUsers);
     }
     $iCount = count($aUsers);
     // using count instead of $this->database()->limit to measure the real value
     for ($i = 0; $i <= $iTotal; $i++) {
         if (!isset($aUsers[$iCount - $i])) {
             continue;
         }
         // availability check
         $aOut[] = $aUsers[$iCount - $i];
     }
     return array($aOut, count($aUsers));
 }
예제 #28
0
 /**
  * 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'));
 }
예제 #29
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;
 }
예제 #30
0
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     Phpfox::getUserParam('photo.can_view_photos', true);
     if (!Phpfox::getParam('photo.can_rate_on_photos')) {
         return Phpfox_Error::display(Phpfox::getPhrase('photo.photo_rating_is_disabled'));
     }
     Phpfox::getUserParam('photo.can_rate_on_photos', true);
     if ($iPhotoId = $this->request()->getInt('photo-id')) {
         Phpfox::getService('photo.rate.process')->add($this->request()->getInt('photo-id'), $this->request()->getInt('rating'));
     }
     $sCategory = null;
     if ($this->request()->get('req3') == 'category') {
         $sCategory = $this->request()->getInt('req4');
     }
     ($sPlugin = Phpfox_Plugin::get('photo.component_controller_rate_process_start')) ? eval($sPlugin) : false;
     $aPhoto = Phpfox::getService('photo.rate')->getForRating($sCategory, $this->request()->get('id', null));
     $sBar = '';
     for ($i = 1; $i <= 10; $i++) {
         $sBar .= '<li><a href="' . ($sCategory === null ? $this->url()->makeUrl('photo.rate', array('photo-id' => $aPhoto['photo_id'], 'rating' => $i)) : $this->url()->permalink('photo.rate.category', $this->request()->getInt('req4'), $this->request()->get('req5'), false, null, array('photo-id' => $aPhoto['photo_id'], 'rating' => $i))) . '" class="js_rating_bar">' . $i . '</a></li>';
     }
     $sBar .= '<li><a href="' . ($sCategory === null ? $this->url()->makeUrl('photo.rate') : $this->url()->permalink('photo.rate.category', $this->request()->getInt('req4'), $this->request()->get('req5'))) . '">' . Phpfox::getPhrase('photo.skip') . '</a></li>';
     $this->setParam('sPhotoCategorySubSystem', 'rate');
     $this->setParam('aPhoto', $aPhoto);
     $this->setParam('sCurrentCategory', $sCategory);
     Phpfox::getService('photo')->buildMenu();
     $this->template()->setTitle(Phpfox::getPhrase('photo.rate_photos'))->setBreadcrumb(Phpfox::getPhrase('photo.photos'), $this->url()->makeUrl('photo'))->setHeader('cache', array('rate_bar.css' => 'style_css'))->assign(array('sRatingBar' => $sBar, 'aPhoto' => $aPhoto, 'aCallback' => null));
     ($sPlugin = Phpfox_Plugin::get('photo.component_controller_rate_process_end')) ? eval($sPlugin) : false;
 }