/**
  * Add facebook user
  */
 public function addUserFacebook($aVals, $iFacebookUserId, $sAccessToken)
 {
     if (!defined('PHPFOX_IS_FB_USER')) {
         define('PHPFOX_IS_FB_USER', true);
     }
     //get facebook setting
     $bFbConnect = Phpfox::getParam('facebook.enable_facebook_connect');
     if ($bFbConnect == false) {
         return false;
     } else {
         if (Phpfox::getService('accountapi.facebook')->checkUserFacebook($iFacebookUserId) == false) {
             if (Phpfox::getParam('user.disable_username_on_sign_up')) {
                 $aVals['user_name'] = Phpfox::getLib('parse.input')->cleanTitle($aVals['full_name']);
             }
             $aVals['country_iso'] = null;
             if (Phpfox::getParam('user.split_full_name')) {
                 $aNameSplit = preg_split('[ ]', $aVals['full_name']);
                 $aVals['first_name'] = $aNameSplit[0];
                 unset($aNameSplit[0]);
                 $aVals['last_name'] = implode(' ', $aNameSplit);
             }
             $iUserId = Phpfox::getService('user.process')->add($aVals);
             if ($iUserId === false) {
                 return false;
             } else {
                 Phpfox::getService('facebook.process')->addUser($iUserId, $iFacebookUserId);
                 //update fb profile image to db
                 $bCheck = Phpfox::getService('accountapi.facebook')->addImagePicture($sAccessToken, $iUserId);
             }
         }
     }
     return true;
 }
Example #2
0
 public function process()
 {
     if ($aVals = $this->request()->getArray('val')) {
         if (Phpfox::getService('custom.relation.process')->add($aVals)) {
             $this->url()->send('admincp.custom.relationships', array(), Phpfox::getPhrase('custom.status_added'));
         }
     }
     if ($iId = $this->request()->getInt('delete')) {
         if (Phpfox::getService('custom.relation.process')->delete($iId)) {
             $this->url()->send('admincp.custom.relationships', array(), Phpfox::getPhrase('custom.status_deleted'));
         }
     }
     $aStatuses = Phpfox::getService('custom.relation')->getAll();
     /* If we're editing lets make it easier and just find the one we're looking for here */
     if ($iEdit = $this->request()->getInt('edit')) {
         $aEdit = array();
         foreach ($aStatuses as $aStatus) {
             if ($aStatus['relation_id'] == $iEdit) {
                 $aEdit = $aStatus;
                 break;
             }
         }
         if (empty($aEdit)) {
             Phpfox_Error::display(Phpfox::getPhrase('custom.not_found'));
         } else {
             $this->template()->assign(array('aEdit' => $aEdit));
         }
     }
     $this->template()->setTitle(Phpfox::getPhrase('custom.admin_menu_manage_relationships'))->setBreadcrumb(Phpfox::getPhrase('custom.admin_menu_manage_relationships'))->setPhrase(array())->assign(array('aStatuses' => $aStatuses));
 }
Example #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');
 }
Example #4
0
	public function sendEmail($sType)
	{		
		$this->database()->update($this->_sTable, array(
				'send_email' => (int) $sType
			), 'user_id = ' . Phpfox::getUserId()
		);		
		
		if ((int) $sType === 2)
		{
			$aUserInfo = Phpfox::getService('facebook.api')->getUserInfo();

			if (Phpfox::getService('facebook')->checkEmail($aUserInfo['email']) !== false)
			{
				return false;
			}						
			
			$this->database()->update(Phpfox::getT('user'), array(
					'email' => $aUserInfo['email']
				), 'user_id = ' . Phpfox::getUserId()
			);
			
			if ($aUserInfo['email'] == $aUserInfo['proxied_email'])
			{
				$this->database()->update($this->_sTable, array(
						'is_proxy_email' => '1'
					), 'user_id = ' . Phpfox::getUserId()
				);				
			}
		}		
		
		return true;
	}
Example #5
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()
				)
			);	
	}
Example #6
0
 public function getQueryJoins($bIsCount = false, $bNoQueryFriend = false)
 {
     if (Phpfox::isModule('friend') && Phpfox::getService('friend')->queryJoin($bNoQueryFriend)) {
         $this->database()->join(Phpfox::getT('friend'), 'friends', 'friends.user_id = m.user_id AND friends.friend_user_id = ' . Phpfox::getUserId());
     }
     if ($this->_sCategory !== null) {
         $this->database()->innerJoin(Phpfox::getT('fevent_category_data'), 'mcd', 'mcd.fevent_id = m.fevent_id');
         if (!$bIsCount) {
             $this->database()->group('m.fevent_id');
         }
     }
     if ($this->_iAttending !== null) {
         $this->database()->innerJoin(Phpfox::getT('fevent_invite'), 'ei', 'ei.fevent_id = m.fevent_id AND ei.rsvp_id = ' . (int) $this->_iAttending . ' AND ei.invited_user_id = ' . Phpfox::getUserId());
         if (!$bIsCount) {
             $this->database()->select('ei.rsvp_id, ');
             $this->database()->group('m.fevent_id');
         }
     } else {
         if (Phpfox::isUser()) {
             $this->database()->leftJoin(Phpfox::getT('fevent_invite'), 'ei', 'ei.fevent_id = m.fevent_id AND ei.invited_user_id = ' . Phpfox::getUserId());
             if (!$bIsCount) {
                 $this->database()->select('ei.rsvp_id, ');
                 $this->database()->group('m.fevent_id');
             }
         }
     }
 }
Example #7
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();
 }
 /**
  * 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));
 }
 /**
  * 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('');
             }
         }
     }
 }
Example #10
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) . '\';');
     }
 }
Example #11
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'));
 }
 /**
  * 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));
 }
Example #13
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);
 }
Example #14
0
 /**
  * Controller
  */
 public function process()
 {
     $aValidation = array('name' => Phpfox::getPhrase('forum.provide_a_name_for_your_forum'));
     $oValid = Phpfox_Validator::instance()->set(array('sFormName' => 'js_form', 'aParams' => $aValidation));
     $bIsEdit = false;
     if ($iId = $this->request()->getInt('id')) {
         $bIsEdit = true;
         Phpfox::getUserParam('forum.can_edit_forum', true);
         $aForum = Phpfox::getService('forum')->getForEdit($iId);
         $this->template()->assign('aForms', $aForum);
     } else {
         Phpfox::getUserParam('forum.can_add_new_forum', true);
     }
     if ($aVals = $this->request()->getArray('val')) {
         if ($oValid->isValid($aVals)) {
             if ($bIsEdit) {
                 if (Phpfox::getService('forum.process')->update($aForum['forum_id'], $aVals)) {
                     $this->url()->send('admincp.forum', null, Phpfox::getPhrase('forum.forum_successfully_updated'));
                 }
             } else {
                 if (Phpfox::getService('forum.process')->add($aVals)) {
                     $this->url()->send('admincp.forum.add', null, Phpfox::getPhrase('forum.forum_successfully_added'));
                 }
             }
         }
     }
     $sTitle = $bIsEdit ? Phpfox::getPhrase('forum.editing_forum') . ': ' . $aForum['name'] : Phpfox::getPhrase('forum.create_new_form');
     $this->template()->setTitle($sTitle)->setBreadCrumb($sTitle, $this->url()->makeUrl('admincp.forum'))->assign(array('sCreateJs' => $oValid->createJS(), 'sGetJsForm' => $oValid->getJsForm(), 'sForumParents' => Phpfox::getService('forum')->active($bIsEdit ? $aForum['parent_id'] : $this->request()->getInt('child'))->edit($bIsEdit ? $aForum['forum_id'] : 0)->getJumpTool(true, $bIsEdit)));
 }
 public function process()
 {
     $sAction = $this->request()->get('req4');
     $sFlag = $this->request()->get('flag');
     if ($sFlag == '') {
         if ($sAction == 'install') {
             $oInstaller = Phpfox::getService('blog.import');
             if ($oInstaller->uninstall() && $oInstaller->install()) {
                 $this->clearCache("file/cache");
                 $this->clearCache("file/gzip");
                 $this->url()->send('admincp.blog.installer.install' . '/flag_success1');
             } else {
                 Phpfox_Error::set('The module blog importer cannot installed, please try again');
             }
         } elseif ($sAction == 'uninstall2') {
             if (Phpfox::getService('blog.import')->uninstall()) {
                 $this->clearCache("file/cache");
                 $this->clearCache("file/gzip");
                 $this->url()->send('admincp.blog.installer.uninstall' . '/flag_success2');
             } else {
                 Phpfox_Error::set('The module blog importer cannot uninstalled, please try again');
             }
         } elseif ($sAction == 'uninstall') {
         } else {
             $this->url()->send('subcribe');
         }
     } elseif ($sFlag == 'success1') {
         $this->url()->send('admincp.blog.installer.install' . '/flag_success', null, 'Congratulation ! The module blog importer v3.02p2 has been installed successfully');
     } elseif ($sFlag == 'success2') {
         $this->url()->send('admincp.blog.installer.uninstall' . '/flag_success', null, 'Uninstall blog importer v3.02p3 done !');
     }
     $this->template()->assign(array('sAction' => $sAction, 'sFlag' => $sFlag))->setBreadCrumb(Phpfox::getPhrase('blog.blog'), $this->url()->makeUrl('admincp.blog'));
 }
Example #16
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']));
     }
 }
Example #17
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';
 }
Example #18
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());
 }
Example #19
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>'));
 }
Example #20
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));
 }
Example #21
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'));
     }
 }
Example #22
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));
 }
Example #23
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';
		}
	}
Example #24
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();');
     }
 }
Example #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'));
 }
Example #26
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));
     }
 }
Example #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() : '')
			)
		);
	}
Example #28
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));
 }
Example #29
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));
 }
Example #30
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);
 }