Exemplo n.º 1
0
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     Phpfox::getUserParam('language.can_manage_lang_packs', true);
     $bNoJsValidation = $this->getParam('bNoJsValidation');
     $aModules = Phpfox::getService('admincp.module')->getModules();
     $aLanguages = Phpfox::getService('language')->get();
     if ($sPhrase = $this->getParam('sVar')) {
         $aParts = explode('.', $sPhrase);
         $sPhrase = $aParts[1];
     }
     /*
     $aValidation = array(
     	'var_name' => array(
     		'def' => 'required',
     		'title' => Phpfox::getPhrase('language.select_varname')
     	)
     );
     */
     $aValidation = array();
     $oValid = Phpfox::getLib('validator')->set(array('sFormName' => 'js_phrase_form', 'aParams' => $aValidation));
     if ($aVals = $this->request()->getArray('val')) {
         if (empty($aVals['var_name']) && isset($aVals['text']['en'])) {
             $aVals['var_name'] = $aVals['text']['en'];
         }
         if (empty($aVals['var_name'])) {
             Phpfox_Error::set('Provide a var name.');
         }
         // Check that all the fields are valid
         if ($oValid->isValid($aVals)) {
             // Check to make sure the phrase has not already been added
             if ($sIsPhrase = Phpfox::getService('language.phrase')->isPhrase($aVals)) {
                 Phpfox_Error::set(Phpfox::getPhrase('language.phrase_already_created', array('phrase' => $sIsPhrase)) . ' - ' . Phpfox::getPhrase($sIsPhrase));
                 $sCachePhrase = $sIsPhrase;
             } else {
                 $sVarName = Phpfox::getService('language.phrase.process')->prepare($aVals['var_name']);
                 if (isset($aVals['module'])) {
                     $aParts = explode('|', $aVals['module']);
                     $sVarName = $aParts[1] . '.' . $sVarName;
                 }
                 $sCached = Phpfox::getPhrase('language.phrase_added', array('phrase' => $sVarName));
                 // Add the new phrase
                 $sPhrase = Phpfox::getService('language.phrase.process')->add($aVals);
                 // Verify if we have a return URL, if we do send them there instead
                 if ($sReturn = $this->request()->get('return')) {
                     $this->url()->forward($sReturn, $sCached);
                 } else {
                     Phpfox::getLib('session')->set('cache_new_phrase', $sVarName);
                     // Phrase added lets send them back to the same page with a message that the phrase was added
                     $this->url()->send('admincp.language.phrase.add', array('last-module' => $aParts[1]), $sCached);
                 }
             }
         }
     }
     if (!isset($sCachePhrase) && ($sCachePhrase = Phpfox::getLib('session')->get('cache_new_phrase'))) {
         Phpfox::getLib('session')->remove('cache_new_phrase');
     }
     // Assign needed vars to the template
     $this->template()->assign(array('aProducts' => Phpfox::getService('admincp.product')->get(), 'aModules' => $aModules, 'aLanguages' => $aLanguages, 'sCreateJs' => $oValid->createJS(), 'sGetJsForm' => $bNoJsValidation ? 'return true;' : $oValid->getJsForm(), 'sReturn' => ($sReturn = $this->request()->get('return')) ? $sReturn : $this->getParam('sReturnUrl'), 'sVar' => $sPhrase, 'sCachePhrase' => isset($sCachePhrase) ? $sCachePhrase : '', 'sLastModuleId' => $this->request()->get('last-module')))->setBreadCrumb(Phpfox::getPhrase('language.add_phrase'))->setTitle(Phpfox::getPhrase('language.add_phrase'));
     ($sPlugin = Phpfox_Plugin::get('language.component_controller_admincp_phrase_add_process')) ? eval($sPlugin) : false;
 }
Exemplo n.º 2
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'));
 }
Exemplo n.º 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');
 }
Exemplo n.º 4
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();
 }
Exemplo n.º 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()
				)
			);	
	}
Exemplo n.º 6
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));
 }
Exemplo n.º 7
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)));
 }
Exemplo n.º 8
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);
 }
Exemplo n.º 9
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));
 }
Exemplo n.º 10
0
	/**
	 * Class process method which is used to execute this component.
	 */
	public function process()
	{
		if (!Phpfox::isModule('ad'))
		{
			return false;
		}	    
		
		if (defined('PHPFOX_IS_GROUP_VIEW'))
	    {
			return false;
	    }
	    
	    $aSponsorEvents = Phpfox::getService('event')->getRandomSponsored();
	    
	    if (empty($aSponsorEvents))
	    {
			return false;
	    }
	    
	    Phpfox::getService('ad.process')->addSponsorViewsCount($aSponsorEvents['sponsor_id'], 'event');
		
	    $this->template()->assign(array(
				'sHeader' => Phpfox::getPhrase('event.sponsored_event'),
				'aSponsorEvents' => $aSponsorEvents,
				'aFooter' => array(Phpfox::getPhrase('event.encourage_sponsor') => $this->url()->makeUrl('event', array('view' => 'my', 'sponsor' => 1)))
		    )
		);
		
	    return 'block';
	}
Exemplo n.º 11
0
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     $aValidation = array('name' => Phpfox::getPhrase('photo.provide_a_name_for_your_photo_category'));
     $oValid = Phpfox::getLib('validator')->set(array('sFormName' => 'js_form', 'aParams' => $aValidation));
     if (($aOrder = $this->request()->getArray('order')) && Phpfox::getUserParam('photo.can_edit_photo_categories', true) && Phpfox::getService('photo.category.process')->updateOrder($aOrder)) {
         $this->url()->send('admincp.photo', null, Phpfox::getPhrase('photo.photo_category_order_successfully_updated'));
     }
     if (!Phpfox::getUserParam('photo.can_add_public_categories') && !Phpfox::getUserParam('photo.can_edit_photo_categories')) {
         return Phpfox_Error::display(Phpfox::getPhrase('photo.invalid_section'));
     }
     if ($aVals = $this->request()->getArray('val')) {
         if ($oValid->isValid($aVals)) {
             if (isset($aVals['delete']) && Phpfox::getUserParam('photo.can_edit_photo_categories', true)) {
                 if (Phpfox::getService('photo.category.process')->delete($aVals['edit_id'])) {
                     $this->url()->send('admincp.photo', null, Phpfox::getPhrase('photo.photo_category_successfully_deleted'));
                 }
             } else {
                 if (isset($aVals['edit_id'])) {
                     Phpfox::getUserParam('photo.can_edit_photo_categories', true);
                     if (Phpfox::getService('photo.category.process')->update($aVals)) {
                         $this->url()->send('admincp.photo', null, Phpfox::getPhrase('photo.photo_category_successfully_updated'));
                     }
                 } else {
                     Phpfox::getUserParam('photo.can_add_public_categories', true);
                     if (Phpfox::getService('photo.category.process')->add($aVals)) {
                         $this->url()->send('admincp.photo', null, Phpfox::getPhrase('photo.photo_category_successfully_added'));
                     }
                 }
             }
         }
     }
     $this->template()->setTitle(Phpfox::getPhrase('photo.manage_photo_categories'))->setBreadCrumb(Phpfox::getPhrase('photo.manage_photo_categories'), $this->url()->makeUrl('admincp.photo'))->setHeader('cache', array('admin.js' => 'module_photo', 'jquery/ui.js' => 'static_script', 'sort.js' => 'module_photo'))->assign(array('sCreateJs' => $oValid->createJS(), 'sGetJsForm' => $oValid->getJsForm()));
 }
Exemplo n.º 12
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'));
 }
Exemplo n.º 13
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';
 }
Exemplo n.º 14
0
 /**
  * Controller
  */
 public function process()
 {
     $this->url()->send('admincp');
     list($aGroups, $aModules, $aProductGroups) = Phpfox::getService('admincp.setting.group')->get();
     $this->template()->setBreadCrumb(Phpfox::getPhrase('admincp.manage_settings'))->setTitle(Phpfox::getPhrase('admincp.manage_settings'))->assign(array('aGroups' => $aGroups, 'aModules' => $aModules, 'aProductGroups' => $aProductGroups));
     ($sPlugin = Phpfox_Plugin::get('admincp.component_controller_setting_index_process')) ? eval($sPlugin) : false;
 }
Exemplo n.º 15
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);
 }
Exemplo n.º 16
0
 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'));
 }
Exemplo n.º 17
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));
     }
 }
Exemplo n.º 18
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)));
 }
Exemplo n.º 19
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));
 }
Exemplo n.º 20
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'));
 }
Exemplo n.º 21
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']));
     }
 }
Exemplo n.º 22
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) . '\';');
     }
 }
Exemplo n.º 23
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));
 }
Exemplo n.º 24
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('');
             }
         }
     }
 }
Exemplo n.º 25
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;
 }
Exemplo n.º 26
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());
 }
Exemplo n.º 27
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;
 }
Exemplo n.º 28
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));
 }
Exemplo n.º 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());
 }
Exemplo n.º 30
0
 /**
  * Controller
  */
 public function process()
 {
     if ($iDeleteId = $this->request()->getInt('delete')) {
         if (Phpfox::getService('admincp.block.process')->delete($iDeleteId)) {
             $this->url()->send('admincp.block', null, Phpfox::getPhrase('admincp.successfully_deleted'));
         }
     }
     if ($aVals = $this->request()->getArray('val')) {
         if (Phpfox::getService('admincp.block.process')->updateOrder($aVals)) {
             $this->url()->send('admincp.block');
         }
     }
     $aBlocks = array();
     $aRows = Admincp_Service_Block_Block::instance()->get();
     foreach ($aRows as $iKey => $aRow) {
         if (!Phpfox::isModule($aRow['module_id'])) {
             continue;
         }
         if ($aRow['m_connection'] == 'admincp.index') {
             continue;
         }
         $aBlocks[$aRow['m_connection']][$aRow['location']][] = $aRow;
     }
     // d($aBlocks); exit;
     ksort($aBlocks);
     $this->template()->setSectionTitle('Blocks')->setActionMenu(['Add Block' => ['class' => 'popup', 'url' => $this->url()->makeUrl('admincp.block.add')]])->setBreadCrumb(Phpfox::getPhrase('admincp.block_manager'))->setTitle(Phpfox::getPhrase('admincp.block_manager'))->setHeader('cache', array('template.css' => 'style_css', 'drag.js' => 'static_script', 'jquery/plugin/jquery.scrollTo.js' => 'static_script'))->assign(array('aBlocks' => $aBlocks));
 }