Пример #1
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) . '\';');
     }
 }
Пример #2
0
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     //DROPBOX
     $canCall = false;
     if (!$this->request()->get('db_authorize')) {
         $this->dropbox = PhpFox::getService('backuprestore.dropboxfront');
         $canCall = true;
     }
     $dbauthorize = array();
     if ($canCall) {
         $dbauthorize['Url'] = $this->dropbox->get_authorize_url();
         if ($this->dropbox->is_authorized()) {
             //User Dropbox info
             $dbaccount_info = $this->dropbox->get_account_info();
             $dbaccount_details = array('account_owner' => $dbaccount_info->display_name, 'used_space' => round(($dbaccount_info->quota_info->quota - ($dbaccount_info->quota_info->normal + $dbaccount_info->quota_info->shared)) / 1073741824, 1), 'quota' => round($dbaccount_info->quota_info->quota / 1073741824, 1));
             $dbaccount_details['used_percent'] = round($dbaccount_details['used_space'] / $dbaccount_details['quota'] * 100, 0);
             $this->authorized['dropbox'] = 1;
         } else {
             if ($this->request()->get('continue')) {
                 if (!$this->dropbox->is_authorized()) {
                     $dbauthorize['error_not_authorized'] = 'yes';
                 }
                 $dbauthorize['submitbutton'] = 'Authorize';
             }
         }
     }
     //Request Authorize Dropbox Account
     if ($this->request()->get('db_authorize')) {
         $dbauthorize['submitbutton'] = 'Continue';
     }
     //Google DRIVE
     $gdrive = PhpFox::getService('backuprestore.googledrivefront');
     $tokens = $gdrive->getAccessTokens();
     //Check Google drive User Authorization
     if ($gdrive->is_authorized()) {
         //User Google Drive info
         try {
             if (isset($tokens)) {
                 $drive = $gdrive->buildService($tokens);
                 $gdrive_info = $gdrive->getAcountInfo($drive);
                 $this->authorized['gdrive'] = 1;
             }
         } catch (Exception $e) {
             throw $e;
         }
     }
     // Google Drive Authorize
     if ($this->request()->get('gd_authorize')) {
         if (!$gdrive->initClientKeys()) {
             $this->url()->forward($this->url()->makeUrl('admincp.backuprestore.gdrivesett'), 'In order to use Google Drive Service fill below requirements');
         }
         try {
             $gdrive->gdrive_auth_request();
         } catch (Exception $e) {
             Phpfox::addMessage($e->getMessage());
         }
     }
     $this->template()->assign(array('dbauthorize' => $dbauthorize, 'gdrive_info' => !empty($gdrive_info) ? $gdrive_info : null, 'DBADetails' => !empty($dbaccount_details) ? $dbaccount_details : null, 'authorized' => $this->authorized));
 }
Пример #3
0
 public function processActivityPayment()
 {
     $aParts = explode('|', $this->get('item_number'));
     if (Phpfox::getService('user.process')->purchaseWithPoints($aParts[0], $aParts[1], $this->get('amount'), $this->get('currency_code'))) {
         Phpfox::addMessage('Purchase successfully completed.');
         $this->call('window.location.href = \'' . Phpfox_Url::instance()->makeUrl('') . '\'');
     }
 }
Пример #4
0
	public function process()
	{
		if (Phpfox::getService('language.process')->useLanguage($this->get('id')))
		{
			Phpfox::addMessage(Phpfox::getPhrase('language.successfully_updated_your_language_preferences'));
			
			$this->call('window.location.href = \'' . Phpfox::getLib('url')->makeUrl('') . '\';');
		}
	}
Пример #5
0
 /**
  * Controller
  */
 public function process()
 {
     if ($val = $this->request()->getArray('val')) {
         $Theme = new Core\Theme();
         $newTheme = $Theme->make($val);
         Phpfox::addMessage('Theme successfully created.');
         return ['redirect' => $this->url()->makeUrl('admincp.theme.manage', ['id' => $newTheme->theme_id])];
     }
     $this->template()->setBreadcrumb('Create a Theme', $this->url()->makeUrl('current'), true)->assign(array());
 }
Пример #6
0
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     if ($sName = $this->request()->get('newCategory', false)) {
         if (Phpfox::getService('apps.category.process')->add($sName)) {
             Phpfox::addMessage(Phpfox::getPhrase('apps.category_successfully_added'));
         }
     }
     $aCategories = Phpfox::getService('apps')->getCategories();
     $this->template()->assign(array('aCategories' => $aCategories))->setHeader(array('admincp.js' => 'module_apps'))->setBreadCrumb(Phpfox::getPhrase('apps.app_categories'));
 }
Пример #7
0
 public function process()
 {
     $Theme = (new Core\Theme())->get($this->request()->get('id'));
     if ($this->request()->get('sure')) {
         $Theme->delete();
         Phpfox::addMessage('Successfully deleted the theme.');
         $this->url()->send('admincp.theme');
     }
     $this->template()->setBreadCrumb('Are you sure?', $this->url()->makeUrl('current'), true);
     $this->template()->assign(['Theme' => $Theme]);
 }
Пример #8
0
 public function process()
 {
     // $app = Phpfox_Module::instance()->get(($this->request()->get('id')));
     $App = (new Core\App())->get($this->request()->get('id'));
     if (!$App->is_module) {
         if ($val = $this->request()->get('val')) {
             if (!($error = User_Service_Auth::instance()->loginAdmin($val['email'], $val['password']))) {
                 throw new \Exception(implode('', Phpfox_Error::get()));
             }
             $App->delete();
             Phpfox::addMessage('App successfully uninstalled.');
             return ['redirect' => $this->url()->makeUrl('admincp/apps')];
         }
         if ($settings = $this->request()->get('setting')) {
             $Setting = new Core\Setting\Service($App);
             $Setting->save($settings);
             return ['updated' => true];
         }
         if ($this->request()->get('export')) {
             $App->export();
             exit;
         }
         $menus = [];
         if ($App->admincpMenu) {
             foreach ($App->admincpMenu as $key => $value) {
                 $menus[$key] = ['url' => $this->url()->makeUrl('admincp/' . $value)];
             }
         }
         $menus['Uninstall'] = ['url' => $this->url()->makeUrl('admincp/app', ['id' => $App->id, 'uninstall' => 'yes'])];
         $settings = [];
         foreach ($App->settings as $key => $value) {
             if (!isset($value->type)) {
                 $value->type = 'input:text';
             }
             if (!isset($value->value)) {
                 $value->value = '';
             }
             if (setting($key) !== null) {
                 $value->value = setting($key);
             }
             $settings[$key] = ['info' => $value->info, 'value' => $value->value, 'type' => $value->type];
         }
         $this->template()->assign(['sSectionTitle' => $App->name, 'aSectionAppMenus' => $menus, 'ActiveApp' => $App, 'settings' => $settings]);
         if (defined('PHPFOX_IS_TECHIE') && PHPFOX_IS_TECHIE) {
             $this->template()->setActionMenu(['Export' => ['url' => $this->url()->makeUrl('admincp/app', ['id' => $App->id, 'export' => '1']), 'class' => '']]);
         }
     }
     $customContent = '';
     // if ($App->storeId) {
     // $customContent = '<iframe src="http://store.phpfox.com/product/' . $App->storeId . '/go" frameborder="0" class="acp_frame_product"></iframe>';
     // }
     $this->template()->setTitle($App->name)->assign(['App' => $App, 'uninstall' => $this->request()->get('uninstall'), 'customContent' => $customContent]);
 }
Пример #9
0
 /**
  * Controller
  */
 public function process()
 {
     if ($aVals = $this->request()->getArray('val')) {
         if (Phpfox::getService('language.phrase.process')->updateMailPhrases($aVals)) {
             Phpfox::addMessage(Phpfox::getPhrase('language.phrases_updated_successfully'));
         }
     }
     $sLanguage = $this->request()->get('sLanguage', Phpfox::getUserBy('language_id'));
     $aPhrases = Phpfox::getService('language')->getMailPhrases(true);
     $this->template()->assign(array('sLanguage' => $sLanguage, 'aPhrases' => $aPhrases));
     $aLangs = Phpfox::getService('language')->getAll();
     $this->template()->setTitle(Phpfox::getPhrase('language.phrases_used_in_emails'))->setBreadcrumb(Phpfox::getPhrase('language.phrases_used_in_emails'))->setHeader(array('admincp_email.js' => 'module_language'))->assign(array('aLangs' => $aLangs));
 }
Пример #10
0
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     if ($aVals = $this->request()->getArray('compare')) {
         unset($aVals['99999999']);
         if (Phpfox::getService('subscribe.process')->updateCompare($aVals)) {
             Phpfox::addMessage(Phpfox::getPhrase('subscribe.comparison_page_updated_successfully'));
         }
     }
     $aForCompare = Phpfox::getService('subscribe')->getPackagesForCompare(true);
     $aCompare = Phpfox::getService('subscribe')->getCompareArray();
     if (!empty($aCompare)) {
         $this->template()->setHeader(array('<script type="text/javascript">$Behavior.loadCompare = function(){$Core.subscribe.loadCompare(\'' . json_encode($aCompare) . '\', false);}</script>'));
     }
     $this->template()->setPhrase(array('subscribe.no_subscription_package_has_been_created_you_need_at_least_one_subscription_package', 'subscribe.add_a_feature'))->setHeader(array('compare.js' => 'module_subscribe', 'compare.css' => 'module_subscribe'))->assign(array('aPackages' => $aForCompare, 'bIsDisplay' => false, 'iTotalColumns' => count($aForCompare['packages']) + 1))->setBreadcrumb(Phpfox::getPhrase('subscribe.compare_subscription_packages'), $this->url()->makeUrl('admincp.subscribe.compare'))->setTItle(Phpfox::getPhrase('subscribe.compare_subscription_packages'));
 }
Пример #11
0
 public function process()
 {
     @(include_once 'phpMyImporter.php');
     $pass = Phpfox::getParam(array('db', 'pass'));
     $name = Phpfox::getParam(array('db', 'name'));
     $user = Phpfox::getParam(array('db', 'user'));
     $host = Phpfox::getParam(array('db', 'host'));
     $connection = @mysql_connect($host, $user, $pass);
     $process = Phpfox::getService('backuprestore.process');
     if ($this->request()->get('database_restore')) {
         $process->importDatabaseRestore($this->request()->get('fileId'));
     }
     $fileId = $this->request()->get('fileId') ? $this->request()->get('fileId') : 0;
     $this->template()->assign(array('fileId' => $fileId));
     if ($this->request()->get('database_submit')) {
         $file = $this->request()->get('database_file');
         //var_dump($file['name']);die;
         $uniqueImport = Phpfox::getService('backuprestore.history');
         $import_name = $file['name'];
         //echo $file['name'];die;
         /*if(!$uniqueImport->checkImportFileName($import_name)){
            $err_txt = Phpfox::getPhrase('backuprestore.this_base_was_not_done_through_our_service');
            return Phpfox_Error::set($err_txt);
           }*/
         $upl = "file/cloudrestore/";
         if (!is_dir($upl)) {
             @mkdir($upl, 0777);
             @chmod($upl, 0777);
         }
         $uploaddir = realpath('file/cloudrestore/');
         $uploadfile = $uploaddir . "/" . basename($file['name']);
         if (move_uploaded_file($file['tmp_name'], $uploadfile)) {
             $dump = new phpMyImporter($name, $connection, $uploadfile, true);
             $dump->utf8 = true;
             // Uses UTF8 connection with MySQL server, default: true
             if ($dump->doImport()) {
                 $process->clearDir('file/cloudrestore/');
                 $success_txt = Phpfox::getPhrase('backuprestore.database_was_successfully_uploaded');
                 return Phpfox::addMessage($success_txt);
             } else {
                 $err_txt = Phpfox::getPhrase('backuprestore.error_loading_database');
                 return Phpfox_Error::set($err_txt);
             }
         }
     }
     $this->template()->setBreadcrumb(Phpfox::getPhrase('backuprestore.databaserestore'), $this->url()->makeUrl('admincp.backuprestore.databaserestore'))->setHeader(array('btdbstyles.css' => 'module_backuprestore', 'scripts.js' => 'module_backuprestore'));
 }
Пример #12
0
 public function process()
 {
     //Get POST values
     if ($this->request()->get('select_service')) {
         $aVals = $this->request()->getArray('val');
         if (!isset($aVals['dropbox']) && !isset($aVals['gdrive']) && !isset($aVals['email']) && !isset($aVals['folder'])) {
             Phpfox_Error::set(Phpfox::getPhrase('backuprestore.service_select_message'));
         }
         if (isset($aVals['dropbox']) && $aVals['dropbox'] == 1) {
             $service['dropbox'] = 1;
         }
         if (isset($aVals['gdrive']) && $aVals['gdrive'] == 1) {
             $service['gdrive'] = 1;
         }
         if (isset($aVals['email']) && $aVals['email'] == 1 && $aVals['email_address'] != "") {
             $service['email'] = 1;
         }
         if (isset($aVals['folder']) && $aVals['folder'] == 1 && $aVals['server_folder'] != "") {
             $service['folder'] = 1;
         }
         //save server folder
         if (isset($aVals['server_folder']) && !empty($aVals['server_folder'])) {
             Phpfox::getService('backuprestore.services')->addServerFolder($aVals['server_folder']);
         }
         //save email address
         if (isset($aVals['email_address']) && !empty($aVals['email_address'])) {
             Phpfox::getService('backuprestore.services')->addUserEmail($aVals['email_address']);
         }
         if (Phpfox_Error::isPassed()) {
             //Save selected services
             if (Phpfox::getService('backuprestore.services')->addSelectedService($service)) {
                 // success message
                 Phpfox::addMessage(Phpfox::getPhrase('backuprestore.changes_updated_successfully'));
             }
         }
     }
     //Saved Selected services from DB
     if ($selected_service = Phpfox::getService('backuprestore.backuprestore')->getBTDBSettingByName('selected_services')) {
         $selected_service = unserialize(array_shift($selected_service));
     } else {
         Phpfox::getService('backuprestore.backuprestore')->addBTDBSetting('selected_services', '');
     }
     $this->template()->assign(array('selected_service' => $selected_service, 'aForms' => Phpfox::getService('backuprestore.services')->getServicesForEdit()));
     $this->template()->setBreadcrumb(Phpfox::getPhrase('backuprestore.backup_destination'), $this->url()->makeUrl('admincp.backuprestore.destination'))->setHeader(array('btdbstyles.css' => 'module_backuprestore', 'scripts.js' => 'module_backuprestore'));
 }
Пример #13
0
 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     // Google Drive Authorize
     if ($this->request()->get('gd_authorize')) {
         if (!PhpFox::getService('backuprestore.googledrivefront')->initClientKeys()) {
             $this->url()->forward($this->url()->makeUrl('admincp.backuprestore.gdrivesett'), 'In order to use Google Drive Service fill below requirements');
         }
         try {
             PhpFox::getService('backuprestore.googledrivefront')->gdrive_auth_request();
         } catch (Exception $e) {
             Phpfox::addMessage($e->getMessage());
         }
     }
     // Google Drive Unauthorize
     if ($this->request()->get('gd_unauthorize')) {
         try {
             Phpfox::getService('backuprestore.googledrivefront')->gdrive_auth_revoke();
         } catch (Exception $re) {
         }
     }
     $gdrive = PhpFox::getService('backuprestore.googledrivefront');
     $tokens = $gdrive->getAccessTokens();
     //Check Google drive User Authorization
     if ($gdrive->is_authorized()) {
         //User Google Drive info
         try {
             if (isset($tokens)) {
                 $drive = $gdrive->buildService($tokens);
                 $gdrive_info = $gdrive->getAcountInfo($drive);
                 $this->authorized['gdrive'] = 1;
             }
         } catch (Exception $e) {
             throw $e;
         }
     }
     $this->template()->assign(array('gdrive_info' => !empty($gdrive_info) ? $gdrive_info : null, 'authorized' => $this->authorized));
 }
Пример #14
0
 public function updateCoverPosition()
 {
     if (Phpfox::getService('pages.process')->updateCoverPosition($this->get('page_id'), $this->get('position'))) {
         $this->call('window.location.href = "' . Phpfox::permalink('pages', $this->get('page_id'), '') . '";');
         //$this->call('location.reload();');
         Phpfox::addMessage(Phpfox::getPhrase('pages.position_set_correctly'));
     } else {
         $aErr = Phpfox_Error::get();
         $sErr = implode($aErr);
     }
 }
Пример #15
0
 public function process()
 {
     $Theme = new Core\Theme();
     $file = null;
     if ($this->request()->get('type') == 'language') {
         $dir = PHPFOX_DIR_FILE . 'static/' . uniqid() . '/';
         mkdir($dir);
         $file = $dir . 'import.zip';
         file_put_contents($file, file_get_contents($this->request()->get('download')));
         register_shutdown_function(function () use($dir) {
             // Phpfox_File::instance()->delete_directory($dir);
         });
         $Zip = new \ZipArchive();
         $Zip->open($file);
         $Zip->extractTo($dir);
         $Zip->close();
         $pack = '';
         $path = $dir . 'upload/include/xml/language/';
         foreach (scandir($path) as $newDir) {
             if ($newDir == '.' || $newDir == '..') {
                 continue;
             }
             $pack = $newDir;
             $path .= $newDir . '/';
             break;
         }
         \Language_Service_Process::instance()->installPackFromFolder($pack, $path);
         echo '<script>window.top.location.href = \'' . $this->url()->makeUrl('admincp.language.import', ['dir' => base64_encode($path)]) . '\';</script>';
         exit;
     }
     if ($this->request()->get('type') == 'theme') {
         $dir = PHPFOX_DIR_FILE . 'static/' . uniqid() . '/';
         mkdir($dir);
         $file = $dir . 'import.zip';
         file_put_contents($file, file_get_contents($this->request()->get('download')));
         register_shutdown_function(function () use($dir) {
             Phpfox_File::instance()->delete_directory($dir);
         });
         Phpfox::addMessage('Theme successfully installed.');
         $id = $Theme->import($file);
         // $this->url()->send('admincp.theme');
         echo '<script>window.top.location.href = \'' . $this->url()->makeUrl('admincp.theme') . '\';</script>';
         exit;
     }
     if (isset($_SERVER['HTTP_X_FILE_NAME']) || $this->request()->get('download')) {
         $App = (new Core\App())->import($this->request()->get('download'), $this->request()->get('download') ? true : false);
         if ($this->request()->get('download')) {
             // $this->url()->send('admincp.app', ['id' => $App->id]);
             echo '<script>window.top.location.href = \'' . $this->url()->makeUrl('admincp.app', ['id' => $App->id]) . '\';</script>';
             exit;
         }
         return ['redirect' => $this->url()->makeUrl('admincp.app', ['id' => $App->id])];
     }
     if ($token = $this->request()->get('m9token')) {
         (new Core\App())->vendor($token);
         d($token);
         exit;
     }
     if ($val = $this->request()->getArray('val')) {
         $App = (new Core\App())->make($val['name']);
         Phpfox::addMessage('App successfully created.');
         return ['redirect' => $this->url()->makeUrl('admincp.app', ['id' => $App->id])];
     }
     $this->template()->setBreadCrumb('New App', $this->url()->current(), true);
 }
Пример #16
0
	/**
	 * Permalink for items.
	 *
	 * @return	string	Returns the full URL of the link.
	 */
	public function permalink($sLink, $iId, $sTitle = null, $bRedirect = false, $sMessage = null, $aExtraLinks = array())
	{		
		if ($sMessage !== null)
		{
			Phpfox::addMessage($sMessage);
		}		
		
		$aExtra = array();
		$aExtra[] = $iId;
		if (!empty($sTitle))
		{
			$aExtra[] = $this->cleanTitle($sTitle);
		}
		
		if (is_array($sLink))
		{
			$iCnt = 0;
			foreach ($sLink as $mKey => $mValue)
			{
				$iCnt++;
				if ($iCnt === 1)
				{
					$sActualLink = $mValue;
					
					continue;
				}
				
				if (is_numeric($mKey))
				{
					$aExtra[] = $mValue;
				}
				else 
				{
					$aExtra[$mKey] = $mValue;	
				}
			}
			$sLink = $sActualLink;
		}
		
		if (is_array($aExtraLinks) && count($aExtraLinks))
		{
			$aExtra = array_merge($aExtra, $aExtraLinks);	
		}
		
		$sUrl = Phpfox::getLib('url')->makeUrl($sLink, $aExtra);
		
		if ($bRedirect === true)
		{
			$this->_send($sUrl);	
		}
		
		return $sUrl;
	}	
Пример #17
0
 public function deleteFolder()
 {
     if (Phpfox::getService('mail.folder.process')->delete($this->get('id'))) {
         Phpfox::addMessage(Phpfox::getPhrase('mail.folder_successfully_deleted'));
         $this->call('window.location.href = \'' . Phpfox_Url::instance()->makeUrl('mail') . '\'');
     }
 }
Пример #18
0
 /**
  * Sets a new picture as a Profile Picture adding it to the Profile Pictures Album 
  * @param int photo_id 
  */
 public function makeProfilePicture()
 {
     /* Just call the service it'll take care of everything */
     if (Phpfox::getService('photo.process')->makeProfilePicture($this->get('photo_id'))) {
     }
     Phpfox::addMessage(Phpfox::getPhrase('photo.profile_photo_successfully_updated'));
     $this->call('window.location.href = \'' . Phpfox::getLib('url')->makeUrl('user.photo') . '\';');
 }
Пример #19
0
 /**
  * Permalink for items.
  *
  * @return	string	Returns the full URL of the link.
  */
 public function permalink($sLink, $iId, $sTitle = null, $bRedirect = false, $sMessage = null, $aExtraLinks = array())
 {
     if ($sMessage !== null) {
         Phpfox::addMessage($sMessage);
     }
     $aExtra = array();
     $aExtra[] = $iId;
     if (!empty($sTitle)) {
         if (preg_match('/\\{phrase var\\=(.*)\\}/i', $sTitle, $aMatches) && isset($aMatches[1])) {
             $sTitle = str_replace(array("'", '"', '&#039;'), '', $aMatches[1]);
             $sTitle = Phpfox::getPhrase($sTitle);
         }
         $aExtra[] = $this->cleanTitle($sTitle);
     }
     if (is_array($sLink)) {
         $iCnt = 0;
         foreach ($sLink as $mKey => $mValue) {
             $iCnt++;
             if ($iCnt === 1) {
                 $sActualLink = $mValue;
                 continue;
             }
             if (is_numeric($mKey)) {
                 $aExtra[] = $mValue;
             } else {
                 if ($mKey == 'view') {
                     $mValue = urlencode($mValue);
                 }
                 $aExtra[$mKey] = $mValue;
             }
         }
         $sLink = $sActualLink;
     }
     if (is_array($aExtraLinks) && count($aExtraLinks)) {
         $aExtra = array_merge($aExtra, $aExtraLinks);
     }
     $sUrl = Phpfox_Url::instance()->makeUrl($sLink, $aExtra);
     if ($bRedirect === true) {
         $this->_send($sUrl);
     }
     return $sUrl;
 }
Пример #20
0
	public function deleteFolder()
	{
		if (Phpfox::getService('mail.folder.process')->delete($this->get('id')))
		{
			Phpfox::addMessage('Folder successfully deleted.');
			$this->call('window.location.href = \'' . Phpfox::getLib('url')->makeUrl('mail') . '\'');
		}
	}
Пример #21
0
 /**
  * Controller
  */
 public function process()
 {
     Phpfox::getUserParam('event.can_access_event', true);
     $aParentModule = $this->getParam('aParentModule');
     if ($aParentModule === null && $this->request()->getInt('req2') > 0) {
         return Phpfox_Module::instance()->setController('event.view');
     }
     if (($sLegacyTitle = $this->request()->get('req2')) && !empty($sLegacyTitle)) {
         if ($this->request()->get('req3') != '') {
             $sLegacyTitle = $this->request()->get('req3');
         }
         $aLegacyItem = Phpfox::getService('core')->getLegacyItem(array('field' => array('category_id', 'name'), 'table' => 'event_category', 'redirect' => 'event.category', 'title' => $sLegacyTitle, 'search' => 'name_url'));
     }
     if (($iRedirectId = $this->request()->getInt('redirect')) && ($aEvent = Event_Service_Event::instance()->getEvent($iRedirectId, true)) && $aEvent['module_id'] != 'event' && Phpfox::hasCallback($aEvent['module_id'], 'getEventRedirect')) {
         if ($sForward = Phpfox::callback($aEvent['module_id'] . '.getEventRedirect', $aEvent['event_id'])) {
             Phpfox::getService('notification.process')->delete('event_invite', $aEvent['event_id'], Phpfox::getUserId());
             $this->url()->forward($sForward);
         }
     }
     if ($iDeleteId = $this->request()->getInt('delete')) {
         if ($mDeleteReturn = Event_Service_Process::instance()->delete($iDeleteId)) {
             if (is_bool($mDeleteReturn)) {
                 $this->url()->send('event', null, Phpfox::getPhrase('event.event_successfully_deleted'));
             } else {
                 $this->url()->forward($mDeleteReturn, Phpfox::getPhrase('event.event_successfully_deleted'));
             }
         }
     }
     if (($iRedirectId = $this->request()->getInt('redirect')) && ($aEvent = Event_Service_Event::instance()->getEvent($iRedirectId, true))) {
         Phpfox::getService('notification.process')->delete('event_invite', $aEvent['event_id'], Phpfox::getUserId());
         $this->url()->permalink('event', $aEvent['event_id'], $aEvent['title']);
     }
     $bIsUserProfile = false;
     if (defined('PHPFOX_IS_AJAX_CONTROLLER')) {
         $bIsUserProfile = true;
         $aUser = Phpfox::getService('user')->get($this->request()->get('profile_id'));
         $this->setParam('aUser', $aUser);
     }
     if (defined('PHPFOX_IS_USER_PROFILE')) {
         $bIsUserProfile = true;
         $aUser = $this->getParam('aUser');
     }
     $oServiceEventBrowse = Phpfox::getService('event.browse');
     $sCategory = null;
     $sView = $this->request()->get('view', false);
     $aCallback = $this->getParam('aCallback', false);
     $this->search()->set(array('type' => 'event', 'field' => 'm.event_id', 'search_tool' => array('default_when' => 'upcoming', 'when_field' => 'start_time', 'when_upcoming' => true, 'table_alias' => 'm', 'search' => array('action' => $aParentModule === null ? $bIsUserProfile === true ? $this->url()->makeUrl($aUser['user_name'], array('event', 'view' => $this->request()->get('view'))) : $this->url()->makeUrl('event', array('view' => $this->request()->get('view'))) : $aParentModule['url'] . 'event/view_' . $this->request()->get('view') . '/', 'default_value' => Phpfox::getPhrase('event.search_events'), 'name' => 'search', 'field' => 'm.title'), 'sort' => array('latest' => array('m.start_time', Phpfox::getPhrase('event.latest'), 'ASC'), 'most-liked' => array('m.total_like', Phpfox::getPhrase('event.most_liked')), 'most-talked' => array('m.total_comment', Phpfox::getPhrase('event.most_discussed'))), 'show' => array(12, 15, 18, 21))));
     $aBrowseParams = array('module_id' => 'event', 'alias' => 'm', 'field' => 'event_id', 'table' => Phpfox::getT('event'), 'hide_view' => array('pending', 'my'));
     switch ($sView) {
         case 'pending':
             if (Phpfox::getUserParam('event.can_approve_events')) {
                 $this->search()->setCondition('AND m.view_id = 1');
             }
             break;
         case 'my':
             Phpfox::isUser(true);
             $this->search()->setCondition('AND m.user_id = ' . Phpfox::getUserId());
             break;
         default:
             if ($bIsUserProfile) {
                 $this->search()->setCondition('AND m.view_id ' . ($aUser['user_id'] == Phpfox::getUserId() ? 'IN(0,2)' : '= 0') . ' AND m.module_id = "event" AND m.privacy IN(' . (Phpfox::getParam('core.section_privacy_item_browsing') ? '%PRIVACY%' : Phpfox::getService('core')->getForBrowse($aUser)) . ') AND m.user_id = ' . (int) $aUser['user_id']);
             } elseif ($aParentModule !== null) {
                 $this->search()->setCondition('AND m.view_id = 0 AND m.privacy IN(%PRIVACY%) AND m.module_id = \'' . Phpfox_Database::instance()->escape($aParentModule['module_id']) . '\' AND m.item_id = ' . (int) $aParentModule['item_id'] . '');
             } else {
                 switch ($sView) {
                     case 'attending':
                         $oServiceEventBrowse->attending(1);
                         break;
                     case 'may-attend':
                         $oServiceEventBrowse->attending(2);
                         break;
                     case 'not-attending':
                         $oServiceEventBrowse->attending(3);
                         break;
                     case 'invites':
                         $oServiceEventBrowse->attending(0);
                         break;
                 }
                 if ($sView == 'attending') {
                     $this->search()->setCondition('AND m.view_id = 0 AND m.privacy IN(%PRIVACY%)');
                 } else {
                     $this->search()->setCondition('AND m.view_id = 0 AND m.privacy IN(%PRIVACY%) AND m.item_id = ' . ($aCallback !== false ? (int) $aCallback['item'] : 0) . '');
                 }
                 if ($this->request()->getInt('user') && ($aUserSearch = Phpfox::getService('user')->getUser($this->request()->getInt('user')))) {
                     $this->search()->setCondition('AND m.user_id = ' . (int) $aUserSearch['user_id']);
                     $this->template()->setBreadcrumb($aUserSearch['full_name'] . '\'s Events', $this->url()->makeUrl('event', array('user' => $aUserSearch['user_id'])), true);
                 }
             }
             break;
     }
     if ($this->request()->getInt('sponsor') == 1) {
         $this->search()->setCondition('AND m.is_sponsor != 1');
         Phpfox::addMessage(Phpfox::getPhrase('event.sponsor_help'));
     }
     if ($this->request()->get('req2') == 'category') {
         $sCategory = $this->request()->getInt('req3');
         $this->search()->setCondition('AND mcd.category_id = ' . (int) $sCategory);
     }
     if ($sView == 'featured') {
         $this->search()->setCondition('AND m.is_featured = 1');
     }
     $this->setParam('sCategory', $sCategory);
     $oServiceEventBrowse->callback($aCallback)->category($sCategory);
     $this->search()->browse()->params($aBrowseParams)->execute();
     $aFilterMenu = array();
     $bSetFilterMenu = !defined('PHPFOX_IS_USER_PROFILE') && !defined('PHPFOX_IS_PAGES_VIEW');
     if ($sPlugin = Phpfox_Plugin::get('event.component_controller_index_set_filter_menu_1')) {
         eval($sPlugin);
         if (isset($mReturnFromPlugin)) {
             return $mReturnFromPlugin;
         }
     }
     if ($bSetFilterMenu) {
         $aFilterMenu = array(Phpfox::getPhrase('event.all_events') => '', Phpfox::getPhrase('event.my_events') => 'my');
         if (Phpfox::isModule('friend') && !Phpfox::getParam('core.friends_only_community')) {
             $aFilterMenu[Phpfox::getPhrase('event.friends_events')] = 'friend';
         }
         list($iTotalFeatured, $aFeatured) = Event_Service_Event::instance()->getFeatured();
         if ($iTotalFeatured) {
             $aFilterMenu[Phpfox::getPhrase('event.featured_events') . '<span class="pending">' . $iTotalFeatured . '</span>'] = 'featured';
         }
         if (Phpfox::getUserParam('event.can_approve_events')) {
             $iPendingTotal = Event_Service_Event::instance()->getPendingTotal();
             if ($iPendingTotal) {
                 $aFilterMenu[Phpfox::getPhrase('event.pending_events') . '<span class="pending">' . $iPendingTotal . '</span>'] = 'pending';
             }
         }
         $aFilterMenu[] = true;
         $aFilterMenu[Phpfox::getPhrase('event.events_i_m_attending')] = 'attending';
         $aFilterMenu[Phpfox::getPhrase('event.events_i_may_attend')] = 'may-attend';
         $aFilterMenu[Phpfox::getPhrase('event.events_i_m_not_attending')] = 'not-attending';
         $aFilterMenu[Phpfox::getPhrase('event.event_invites')] = 'invites';
         $this->template()->buildSectionMenu('event', $aFilterMenu);
     }
     $this->template()->setTitle($bIsUserProfile ? Phpfox::getPhrase('event.full_name_s_events', array('full_name' => $aUser['full_name'])) : Phpfox::getPhrase('event.events'))->setBreadcrumb(Phpfox::getPhrase('event.events'), $aCallback !== false ? $this->url()->makeUrl($aCallback['url_home'][0], array_merge($aCallback['url_home'][1], array('event'))) : ($bIsUserProfile ? $this->url()->makeUrl($aUser['user_name'], 'event') : $this->url()->makeUrl('event')))->setHeader('cache', array('country.js' => 'module_core', 'browse.css' => 'module_event', 'feed.js' => 'module_feed'))->assign(array('aEvents' => $this->search()->browse()->getRows(), 'sView' => $sView, 'aCallback' => $aCallback, 'sParentLink' => $aCallback !== false ? $aCallback['url_home'][0] . '.' . implode('.', $aCallback['url_home'][1]) . '.event' : 'event', 'sApproveLink' => $this->url()->makeUrl('event', array('view' => 'pending'))));
     if ($sCategory !== null) {
         $aCategories = Phpfox::getService('event.category')->getParentBreadcrumb($sCategory);
         $iCnt = 0;
         foreach ($aCategories as $aCategory) {
             $iCnt++;
             $this->template()->setTitle($aCategory[0]);
             if ($aCallback !== false) {
                 $sHomeUrl = '/' . Phpfox_Url::instance()->doRewrite($aCallback['url_home'][0]) . '/' . implode('/', $aCallback['url_home'][1]) . '/' . Phpfox_Url::instance()->doRewrite('event') . '/';
                 $aCategory[1] = preg_replace('/^http:\\/\\/(.*?)\\/' . Phpfox_Url::instance()->doRewrite('event') . '\\/(.*?)$/i', 'http://\\1' . $sHomeUrl . '\\2', $aCategory[1]);
             }
             $this->template()->setBreadcrumb($aCategory[0], $aCategory[1], empty($sView) ? true : false);
         }
     }
     if ($aCallback !== false) {
         $this->template()->rebuildMenu('event.index', $aCallback['url_home']);
     }
     Phpfox_Pager::instance()->set(array('page' => $this->search()->getPage(), 'size' => $this->search()->getDisplay(), 'count' => $this->search()->browse()->getCount()));
     $this->setParam('global_moderation', array('name' => 'event', 'ajax' => 'event.moderation', 'menu' => array(array('phrase' => Phpfox::getPhrase('event.delete'), 'action' => 'delete'), array('phrase' => Phpfox::getPhrase('event.approve'), 'action' => 'approve'))));
 }
Пример #22
0
	/**
	 * Class process method wnich is used to execute this component.
	 */
	public function process()
	{		
		if (defined('PHPFOX_IS_USER_PROFILE') && ($sLegacyTitle = $this->request()->get('req3')) && !empty($sLegacyTitle))
		{			
			Phpfox::getService('core')->getLegacyItem(array(
					'field' => array('video_id', 'title'),
					'table' => 'video',		
					'redirect' => 'video',
					'title' => $sLegacyTitle
				)
			);
		}			
		
		Phpfox::getUserParam('video.can_access_videos', true);
		
		$aParentModule = $this->getParam('aParentModule');			
		
		if (($iRedirectId = $this->request()->getInt('redirect'))
			&& ($aVideo = Phpfox::getService('video')->getVideo($iRedirectId, true))
			&& $aVideo['module_id'] != 'video'
			&& Phpfox::hasCallback($aVideo['module_id'], 'getVideoRedirect')
		)
		{
			if (($sForward = Phpfox::callback($aVideo['module_id'] . '.getVideoRedirect', $aVideo['video_id'])))
			{	
				$this->url()->forward($sForward);
			}
		}
		
		if (($iRedirectId = $this->request()->getInt('redirect')) && ($aVideo = Phpfox::getService('video')->getVideo($iRedirectId, true)))
		{
			$this->url()->send($aVideo['user_name'], array('video', $aVideo['title_url']));
		}
		
		if (($iDeleteId = $this->request()->getInt('delete')))
		{
			if (Phpfox::getService('video.process')->delete($iDeleteId))
			{
				$this->url()->send('video', null, Phpfox::getPhrase('video.video_successfully_deleted'));
			}
		}
		
		if ($aParentModule === null && $this->request()->getInt('req2'))
		{
			return Phpfox::getLib('module')->setController('video.view');
		}
		
		if ($this->request()->get('req2') == 'category' && ($sLegacyTitle = $this->request()->get('req3')) && !is_numeric($sLegacyTitle) && !empty($sLegacyTitle))
		{
			$aLegacyItem = Phpfox::getService('core')->getLegacyItem(array(
					'field' => array('category_id', 'name'),
					'table' => 'video_category',		
					'redirect' => 'video.category',
					'title' => $sLegacyTitle,
					'search' => 'name_url'
				)
			);		
		}		
		
		$bIsUserProfile = false;
		if (defined('PHPFOX_IS_AJAX_CONTROLLER'))
		{
			$bIsUserProfile = true;
			$aUser = Phpfox::getService('user')->get($this->request()->get('profile_id'));
			$this->setParam('aUser', $aUser);
		}		
		
		if (defined('PHPFOX_IS_USER_PROFILE'))
		{
			$bIsUserProfile = true;
			$aUser = $this->getParam('aUser');
		}
		
		$oServiceVideoBrowse = Phpfox::getService('video.browse');
		$sView = $this->request()->get('view');
		$sCategory = null;		
		$aCallback = false;
		$this->setParam('sTagType', 'video');
		
		$this->search()->set(array(
				'type' => 'video',
				'field' => 'm.video_id',				
				'search_tool' => array(
					'table_alias' => 'm',
					'search' => array(
						'action' => (defined('PHPFOX_IS_PAGES_VIEW') ? $aParentModule['url'] . 'video/' : $this->url()->makeUrl('video', array('view' => $this->request()->get('view')))),
						'default_value' => Phpfox::getPhrase('video.search_videos'),
						'name' => 'search',
						'field' => 'm.title'
					),
					'sort' => array(
						'latest' => array('m.time_stamp', Phpfox::getPhrase('video.latest')),
						'most-viewed' => array('m.total_view', Phpfox::getPhrase('video.most_viewed')),
						'most-liked' => array('m.total_like', Phpfox::getPhrase('video.most_liked')),
						'most-talked' => array('m.total_comment', Phpfox::getPhrase('video.most_discussed'))
					),
					'show' => array(12, 15, 18, 21)
				)
			)
		);
		
		$aBrowseParams = array(
			'module_id' => 'video',
			'alias' => 'm',
			'field' => 'video_id',
			'table' => Phpfox::getT('video'),
			'hide_view' => array('pending', 'my')				
		);			
		
		switch ($sView)
		{
			case 'pending':
				if (Phpfox::getUserParam('video.can_approve_videos'))
				{
					$this->search()->setCondition('AND m.view_id = 2');
				}
				break;
			case 'my':
				Phpfox::isUser(true);
				$this->search()->setCondition('AND m.user_id = ' . Phpfox::getUserId());
				break;
			default:
				if ($bIsUserProfile)
				{
					$this->search()->setCondition('AND m.in_process = 0 AND m.view_id ' . ($aUser['user_id'] == Phpfox::getUserId() ? 'IN(0,2)' : '= 0') . ' AND m.item_id = 0 AND m.privacy IN(' . (Phpfox::getParam('core.section_privacy_item_browsing') ? '%PRIVACY%' : Phpfox::getService('privacy')->getForBrowse($aUser)) . ') AND m.user_id = ' . (int) $aUser['user_id']);
				}
				else
				{			
					if (defined('PHPFOX_IS_PAGES_VIEW'))
					{
						$this->search()->setCondition('AND m.in_process = 0 AND m.view_id = 0 AND m.module_id = \'' . Phpfox::getLib('database')->escape($aParentModule['module_id']) . '\' AND m.item_id = ' . (int) $aParentModule['item_id'] . ' AND m.privacy IN(%PRIVACY%)');
					}
					else
					{
						$this->search()->setCondition('AND m.in_process = 0 AND m.view_id = 0 AND m.item_id = 0 AND m.privacy IN(%PRIVACY%)');
					}
				}
				break;
		}
		
		$sTagSearchValue = null;
		if ($this->request()->get('req2') == 'tag' && $this->request()->get('req3'))
		{
			$sCategory = null;
			$sCategoryUrl = '';
			$sTagSearchValue = $this->request()->get('req3');
		}		
		
		if ($this->request()->get('req2') == 'category')
		{
			$sCategory = $this->request()->getInt('req3');
			$this->search()->setCondition('AND mcd.category_id = ' . (int) $sCategory);
		}
		
		$this->setParam('sCategory', $sCategory);
		if ($this->request()->getInt('sponsor') == 1)
		{
		    $this->search()->setCondition('AND m.is_sponsor != 1');
		    Phpfox::addMessage(Phpfox::getPhrase('video.sponsor_help'));
		}
		
		if ($sView == 'featured')
		{
			$this->search()->setCondition('AND m.is_featured = 1');
		}
		
		$oServiceVideoBrowse->category($sCategory)->tag($sTagSearchValue);					
			
		$this->search()->browse()->params($aBrowseParams)->execute();
		
		$aFilterMenu = array();
		if (!defined('PHPFOX_IS_USER_PROFILE') && !defined('PHPFOX_IS_PAGES_VIEW'))
		{
			$aFilterMenu = array(
				Phpfox::getPhrase('video.all_videos') => '',
				Phpfox::getPhrase('video.my_videos') => 'my'				
			);					
				
			if (Phpfox::isModule('friend') && !Phpfox::getParam('core.friends_only_community'))
			{
				$aFilterMenu[Phpfox::getPhrase('video.friends_videos')] = 'friend';	
			}			
			
			list($iTotalFeatured, $aFeatured) = Phpfox::getService('video')->getFeatured();
			if ($iTotalFeatured)
			{
				$aFilterMenu[Phpfox::getPhrase('video.featured_videos') . '<span class="pending">' . $iTotalFeatured . '</span>'] = 'featured';
			}			
			
			if (Phpfox::getUserParam('video.can_approve_videos'))
			{
				$iPendingTotal = Phpfox::getService('video')->getPendingTotal();
				
				if ($iPendingTotal)
				{
					$aFilterMenu[Phpfox::getPhrase('video.pending') . (Phpfox::getUserParam('video.can_approve_videos') ? '<span class="pending">' . $iPendingTotal . '</span>' : 0)] = 'pending';
				}
			}
			
			$this->template()->buildSectionMenu('video', $aFilterMenu);
		}					
		
		if (defined('PHPFOX_IS_USER_PROFILE'))
		{
			$this->template()->setMeta('description', Phpfox::getPhrase('video.full_name_s_videos_full_name_has_total_video_s' , array('full_name' => $aUser['full_name'], 'total' => $this->search()->browse()->getCount())));
		}
		
		$this->template()->setTitle(($bIsUserProfile ? Phpfox::getPhrase('video.full_name_s_videos', array('full_name' => $aUser['full_name'])) : Phpfox::getPhrase('video.videos')))
			->setBreadcrumb(Phpfox::getPhrase('video.videos'), (defined('PHPFOX_IS_USER_PROFILE') ? $this->url()->makeUrl($aUser['user_name'], 'video') : ($aCallback === false ? $this->url()->makeUrl('video') : $this->url()->makeUrl($aCallback['url_home'][0], array_merge($aCallback['url_home'][1], array('video'))))))
			->setMeta('keywords', Phpfox::getParam('video.video_meta_keywords'))
			->setMeta('description', Phpfox::getParam('video.video_meta_description'))
			->setHeader('cache', array(
					'pager.css' => 'style_css',
					'video.js' => 'module_video',
					'video.css' => 'module_video'
				)
			)
			->assign(array(
					'aVideos' => $this->search()->browse()->getRows(),
					'sLinkPendingVideos' => $this->url()->makeUrl('video.pending'),
					'sView' => $sView,
					'sPublicPhotoView' => $sView
				)
			);		
			
		if ($sCategory !== null)
		{
			$aCategories = Phpfox::getService('video.category')->getParentBreadcrumb($sCategory);
			$iCnt = 0;
			foreach ($aCategories as $aCategory)
			{
				$iCnt++;
				
				$this->template()->setTitle($aCategory[0]);					

				if ($aCallback !== false)
				{
					$sHomeUrl = '/' . $aCallback['url_home'][0] . '/' . implode('/', $aCallback['url_home'][1]) . '/video/';
					$aCategory[1] = preg_replace('/^http:\/\/(.*?)\/video\/(.*?)$/i', 'http://\\1' . $sHomeUrl . '\\2', $aCategory[1]);
				}

				$this->template()->setBreadcrumb($aCategory[0], $aCategory[1], ($iCnt === count($aCategories) ? true : false));
			}			
		}			
			
		if ($aCallback !== false)
		{
			$this->template()->rebuildMenu('video.index', $aCallback['url_home']);
		}
		
		foreach ((array) $this->search()->browse()->getRows() as $aVideo)
		{
			$this->template()->setMeta('keywords', $this->template()->getKeywords($aVideo['title']));
		}
		
		if (!empty($sTagSearchValue))
		{
			$this->template()->setBreadcrumb(Phpfox::getPhrase('video.topic') . ': ' . $sTagSearchValue, $this->url()->makeUrl('video.tag', $sTagSearchValue), true);
		}
		
		Phpfox::getLib('pager')->set(array('page' => $this->search()->getPage(), 'size' => $this->search()->getDisplay(), 'count' => $this->search()->browse()->getCount()));
		
		$this->setParam('global_moderation', array(
				'name' => 'video',
				'ajax' => 'video.moderation',
				'menu' => array(
					array(
						'phrase' => Phpfox::getPhrase('video.delete'),
						'action' => 'delete'
					),
					array(
						'phrase' => Phpfox::getPhrase('video.approve'),
						'action' => 'approve'
					)					
				)
			)
		);		
	}
Пример #23
0
	public function setName()
	{
		$sName = $this->get('sTitle');
		$iSong = (int)$this->get('iSong');
		$sTitle = Phpfox::getService('music.song.process')->setName($iSong, $sName, true, true);
		if (!empty($sTitle))
		{			
			Phpfox::addMessage('Your song was named successfully.');			
			$this->call('location.href = "'.Phpfox::getLib('url')->makeUrl('profile.music.view.' . $sTitle).'";');
		}
	}
Пример #24
0
 /**
  * This function deletes a quiz, if quiz.process->deleteQuiz returns true it also visually removes the
  * quiz entry with a hide and then with a remove
  * @return false
  */
 public function delete()
 {
     $iQuiz = (int) $this->get('iQuiz');
     $bDeleted = Phpfox::getService('quiz.process')->deleteQuiz($iQuiz, Phpfox::getUserId());
     if ($bDeleted == true) {
         if ($this->get('type') == 'viewing') {
             Phpfox::addMessage(Phpfox::getPhrase('quiz.quiz_successfully_deleted'));
             $this->call('window.location.href = \'' . Phpfox::getLib('url')->makeUrl('quiz') . '\';');
         } else {
             $this->call('$("#js_quiz_' . $iQuiz . '").hide("slow", function(){$("#js_quiz_' . $iQuiz . '").remove();});')->call('$Core.quiz_moderate.decreaseCounters();');
         }
         return true;
     } else {
         $this->alert(Phpfox::getPhrase('quiz.your_membership_does_not_allow_you_to_delete_this_quiz'));
     }
     return false;
 }
Пример #25
0
 public function processMerge()
 {
     Phpfox::isUser(true);
     $this->error(false);
     $aThread = Phpfox::getService('forum.thread')->getActualThread($this->get('thread_id'));
     $bHasAccess = false;
     $mReturn = false;
     if ((int) $aThread['group_id'] > 0) {
         $aPage = Phpfox::getService('pages')->getForView($aThread['group_id']);
         if (isset($aPage['is_admin']) && $aPage['is_admin']) {
             $bHasAccess = true;
         }
     } else {
         if (Phpfox::getUserParam('forum.can_merge_forum_threads') || Phpfox::getService('forum.moderate')->hasAccess($this->get('forum_id'), 'merge_thread')) {
             $bHasAccess = true;
         }
     }
     if ($bHasAccess) {
         $mReturn = Phpfox::getService('forum.thread.process')->merge($this->get('thread_id'), $this->get('forum_id'), $this->get('url'));
     } else {
         Phpfox_Error::set(Phpfox::getPhrase('forum.not_allowed_to_merge_threads_from_this_specific_forum'));
     }
     if ($mReturn !== false) {
         Phpfox::addMessage(Phpfox::getPhrase('forum.threads_successfully_merged'));
         $this->call('window.location.href = \'' . $mReturn . '\';');
     } else {
         $aErrors = Phpfox_Error::get();
         $sErrors = '';
         foreach ($aErrors as $sError) {
             $sErrors .= '<div class="error_message">' . $sError . '</div>';
         }
         $this->html('#js_error_message', '' . $sErrors . '');
     }
 }
Пример #26
0
 /**
  * Controller
  */
 public function process()
 {
     Phpfox::getUserParam('marketplace.can_access_marketplace', true);
     Phpfox::getService('marketplace.process')->sendExpireNotifications();
     if ($this->request()->getInt('req2') > 0) {
         return Phpfox_Module::instance()->setController('marketplace.view');
     }
     if (($sLegacyTitle = $this->request()->get('req2')) && !empty($sLegacyTitle)) {
         if ($this->request()->get('req3') != '') {
             $sLegacyTitle = $this->request()->get('req3');
         }
         $aLegacyItem = Phpfox::getService('core')->getLegacyItem(array('field' => array('category_id', 'name'), 'table' => 'marketplace_category', 'redirect' => 'marketplace.category', 'title' => $sLegacyTitle, 'search' => 'name_url'));
     }
     // certain conditions need to apply to sponsor a listing
     if ($this->request()->get('sponsor') == 'help') {
         // check if the user can sponsor items
         if (!Phpfox::getUserParam('marketplace.can_purchase_sponsor') && !Phpfox::getUserParam('marketplace.can_sponsor_marketplace')) {
             $this->url()->forward($this->url()->makeUrl('marketplace'), Phpfox::getPhrase('subscribe.the_feature_or_section_you_are_attempting_to_use_is_not_permitted_with_your_membership_level'));
         } else {
             Phpfox::addMessage(Phpfox::getPhrase('marketplace.sponsor_help'));
         }
     }
     if ($iDeleteId = $this->request()->getInt('delete')) {
         if (Phpfox::getService('marketplace.process')->delete($iDeleteId)) {
             $this->url()->send('marketplace', null, Phpfox::getPhrase('marketplace.listing_successfully_deleted'));
         }
     }
     if (($iRedirectId = $this->request()->getInt('redirect')) && ($aListing = Phpfox::getService('marketplace')->getListing($iRedirectId, true))) {
         $this->url()->send('marketplace.view', array($aListing['title_url']));
     }
     $bIsProfile = false;
     if (defined('PHPFOX_IS_AJAX_CONTROLLER')) {
         $bIsProfile = true;
         $aUser = Phpfox::getService('user')->get($this->request()->get('profile_id'));
         $this->setParam('aUser', $aUser);
     } else {
         $bIsProfile = $this->getParam('bIsProfile');
         if ($bIsProfile === true) {
             $aUser = $this->getParam('aUser');
         }
     }
     $oServiceMarketplaceBrowse = Phpfox::getService('marketplace.browse');
     $sCategoryUrl = null;
     $sView = $this->request()->get('view');
     $bIsUserProfile = false;
     if (defined('PHPFOX_IS_AJAX_CONTROLLER')) {
         $bIsUserProfile = true;
         $aUser = Phpfox::getService('user')->get($this->request()->get('profile_id'));
         $this->setParam('aUser', $aUser);
     }
     if (defined('PHPFOX_IS_USER_PROFILE')) {
         $bIsUserProfile = true;
         $aUser = $this->getParam('aUser');
     }
     $aCountriesValue = array();
     $aCountries = Phpfox::getService('core.country')->get();
     foreach ($aCountries as $sKey => $sValue) {
         $aCountriesValue[] = array('link' => $sKey, 'phrase' => $sValue);
     }
     $aSearchFields = array('type' => 'marketplace', 'field' => 'l.listing_id', 'search_tool' => array('table_alias' => 'l', 'search' => array('action' => $bIsProfile === true ? $this->url()->makeUrl($aUser['user_name'], array('marketplace', 'view' => $this->request()->get('view'))) : $this->url()->makeUrl('marketplace', array('view' => $this->request()->get('view'))), 'default_value' => Phpfox::getPhrase('marketplace.search_listings'), 'name' => 'search', 'field' => array('l.title', 'mt.description_parsed')), 'sort' => array('latest' => array('l.is_sponsor DESC, l.time_stamp', Phpfox::getPhrase('marketplace.latest')), 'most-liked' => array('l.is_sponsor DESC, l.total_like', Phpfox::getPhrase('marketplace.most_liked')), 'most-talked' => array('l.is_sponsor DESC, l.total_comment', Phpfox::getPhrase('marketplace.most_discussed'))), 'show' => array(12, 15, 18, 21)));
     if (!$bIsUserProfile) {
         $aSearchFields['search_tool']['custom_filters'] = array(Phpfox::getPhrase('marketplace.location') => array('param' => 'location', 'default_phrase' => Phpfox::getPhrase('marketplace.anywhere'), 'data' => $aCountriesValue, 'height' => '300px', 'width' => '150px'));
     }
     $this->search()->set($aSearchFields);
     $aBrowseParams = array('module_id' => 'marketplace', 'alias' => 'l', 'field' => 'listing_id', 'table' => Phpfox::getT('marketplace'), 'hide_view' => array('pending', 'my'));
     // http://www.phpfox.com/tracker/view/14708/
     if (Phpfox::getParam('core.section_privacy_item_browsing')) {
         $aBrowseParams['join'] = array('alias' => 'mt', 'field' => 'listing_id', 'table' => Phpfox::getT('marketplace_text'));
     }
     switch ($sView) {
         case 'sold':
             Phpfox::isUser(true);
             $this->search()->setCondition('AND l.user_id = ' . Phpfox::getUserId());
             $this->search()->setCondition('AND l.is_sell = 1');
             break;
         case 'featured':
             $this->search()->setCondition('AND l.is_featured = 1');
             break;
         case 'my':
             Phpfox::isUser(true);
             $this->search()->setCondition('AND l.user_id = ' . Phpfox::getUserId());
             break;
         case 'pending':
             if (Phpfox::getUserParam('marketplace.can_approve_listings')) {
                 $this->search()->setCondition('AND l.view_id = 1');
                 $this->template()->assign('bIsInPendingMode', true);
             }
             break;
         case 'expired':
             if (Phpfox::getParam('marketplace.days_to_expire_listing') > 0 && Phpfox::getUserParam('marketplace.can_view_expired')) {
                 $iExpireTime = PHPFOX_TIME - Phpfox::getParam('marketplace.days_to_expire_listing') * 86400;
                 $this->search()->setCondition('AND l.time_stamp < ' . $iExpireTime);
                 break;
             }
         case 'invoice':
             $this->url()->send('marketplace.invoice');
             break;
         default:
             if ($bIsProfile === true) {
                 $this->search()->setCondition("AND l.view_id IN(" . ($aUser['user_id'] == Phpfox::getUserId() ? '0,1' : '0') . ") AND l.privacy IN(" . (Phpfox::getParam('core.section_privacy_item_browsing') ? '%PRIVACY%' : Phpfox::getService('core')->getForBrowse($aUser)) . ") AND l.user_id = " . $aUser['user_id'] . "");
             } else {
                 switch ($sView) {
                     case 'invites':
                         Phpfox::isUser(true);
                         $oServiceMarketplaceBrowse->seen();
                         break;
                 }
                 if ($sLocation = $this->request()->get('location')) {
                     $this->search()->setCondition('AND l.country_iso = \'' . Phpfox_Database::instance()->escape($sLocation) . '\'');
                 }
                 $this->search()->setCondition('AND l.view_id = 0 AND l.privacy IN(%PRIVACY%)');
             }
             break;
     }
     if ($this->request()->get('req2') == 'category') {
         $sCategoryUrl = $this->request()->getInt('req3');
         $this->search()->setCondition('AND mcd.category_id = ' . (int) $sCategoryUrl);
     }
     $this->setParam('sCategory', $sCategoryUrl);
     $oServiceMarketplaceBrowse->category($sCategoryUrl);
     if (Phpfox::getParam('marketplace.days_to_expire_listing') > 0 && $sView != 'my' && $sView != 'expired') {
         $iExpireTime = PHPFOX_TIME - Phpfox::getParam('marketplace.days_to_expire_listing') * 86400;
         $this->search()->setCondition(' AND l.time_stamp >=' . $iExpireTime);
     }
     $this->search()->browse()->params($aBrowseParams)->execute();
     // if its a user trying to buy sponsor space he should get only his own listings
     if ($this->request()->get('sponsor') == 'help') {
         $this->search()->setCondition('AND m.user_id = ' . Phpfox::getUserId() . ' AND is_sponsor != 1');
     }
     ($sPlugin = Phpfox_Plugin::get('marketplace.component_controller_index_process_filter')) ? eval($sPlugin) : false;
     $aFilterMenu = array();
     if (!defined('PHPFOX_IS_USER_PROFILE')) {
         $sInviteTotal = '';
         if (Phpfox::isUser() && ($iTotalInvites = Phpfox::getService('marketplace')->getTotalInvites())) {
             $sInviteTotal = '<span class="invited">' . $iTotalInvites . '</span>';
         }
         $aFilterMenu = array(Phpfox::getPhrase('marketplace.all_listings') => '', Phpfox::getPhrase('marketplace.my_listings') => 'my', Phpfox::getPhrase('marketplace.listing_invites') . $sInviteTotal => 'invites', Phpfox::getPhrase('marketplace.invoices') => 'invoice');
         if (Phpfox::getUserParam('marketplace.can_view_expired')) {
             $aFilterMenu[Phpfox::getPhrase('marketplace.expired')] = 'expired';
         }
         if (Phpfox::isModule('friend') && !Phpfox::getParam('core.friends_only_community')) {
             $aFilterMenu[Phpfox::getPhrase('marketplace.friends_listings')] = 'friend';
         }
         if (Phpfox::isModule('event') && Phpfox::getUserParam('event.can_approve_events')) {
             $iPendingTotal = Phpfox::getService('marketplace')->getPendingTotal();
             if ($iPendingTotal) {
                 $aFilterMenu[Phpfox::getPhrase('marketplace.pending_listings') . '<span class="pending">' . $iPendingTotal . '</span>'] = 'pending';
             }
         }
     }
     $this->template()->setTitle($bIsProfile ? Phpfox::getPhrase('marketplace.full_name_s_listings', array('full_name' => $aUser['full_name'])) : Phpfox::getPhrase('marketplace.marketplace'))->setBreadcrumb(Phpfox::getPhrase('marketplace.marketplace'), $bIsUserProfile ? $this->url()->makeUrl($aUser['user_name'], 'marketplace') : $this->url()->makeUrl('marketplace'))->setHeader('cache', array('pager.css' => 'style_css', 'country.js' => 'module_core', 'browse.css' => 'module_marketplace', 'comment.css' => 'style_css', 'feed.js' => 'module_feed'))->assign(array('aListings' => $this->search()->browse()->getRows(), 'sCategoryUrl' => $sCategoryUrl, 'sListingView' => $sView));
     ($sPlugin = Phpfox_Plugin::get('marketplace.component_controller_process_end')) ? eval($sPlugin) : false;
     $this->template()->buildSectionMenu('marketplace', $aFilterMenu);
     if ($sCategoryUrl !== null) {
         $aCategories = Phpfox::getService('marketplace.category')->getParentBreadcrumb($sCategoryUrl);
         $iCnt = 0;
         foreach ($aCategories as $aCategory) {
             $iCnt++;
             $this->template()->setTitle($aCategory[0]);
             if ($bIsUserProfile) {
                 $aCategory[1] = str_replace('/marketplace/', '/' . $aUser['user_name'] . '/marketplace/', $aCategory[1]);
             }
             $this->template()->setBreadcrumb($aCategory[0], $aCategory[1], $iCnt === count($aCategories) ? true : false);
         }
     }
     $this->setParam('global_moderation', array('name' => 'marketplace', 'ajax' => 'marketplace.moderation', 'menu' => array(array('phrase' => Phpfox::getPhrase('marketplace.delete'), 'action' => 'delete'), array('phrase' => Phpfox::getPhrase('marketplace.approve'), 'action' => 'approve'), array('phrase' => Phpfox::getPhrase('marketplace.feature'), 'action' => 'feature'), array('phrase' => Phpfox::getPhrase('marketplace.un_feature'), 'action' => 'un-feature'))));
     Phpfox_Pager::instance()->set(array('page' => $this->search()->getPage(), 'size' => $this->search()->getDisplay(), 'count' => $this->search()->browse()->getCount()));
 }
Пример #27
0
    /**
     * Class process method wnich is used to execute this component.
     */
    public function process()
    {
        Phpfox::isUser(true);
        Phpfox::getUserParam('music.can_upload_music_public', true);
        $sModule = $this->request()->get('module', false);
        $iItem = $this->request()->getInt('item', false);
        $aCallback = false;
        if ($sModule !== false && $iItem !== false && Phpfox::hasCallback($sModule, 'getMusicDetails')) {
            if ($aCallback = Phpfox::callback($sModule . '.getMusicDetails', array('item_id' => $iItem))) {
                $this->template()->setBreadcrumb($aCallback['breadcrumb_title'], $aCallback['breadcrumb_home']);
                $this->template()->setBreadcrumb($aCallback['title'], $aCallback['url_home']);
                if ($sModule == 'pages' && !Phpfox::getService('pages')->hasPerm($iItem, 'music.share_music')) {
                    return Phpfox_Error::display('Unable to view this item due to privacy settings.');
                }
            }
        }
        $bIsEdit = false;
        $aValidation = array('title' => Phpfox::getPhrase('music.provide_a_name_for_this_song'));
        $oValidator = Phpfox::getLib('validator')->set(array('sFormName' => 'js_music_form', 'aParams' => $aValidation));
        if (($iId = $this->request()->getInt('id')) && ($aEditSong = Phpfox::getService('music')->getForEdit($iId))) {
            if ($aEditSong['module_id'] == 'pages') {
                Phpfox::getService('pages')->setIsInPage();
            }
            $bIsEdit = true;
            $this->template()->assign(array('aForms' => $aEditSong));
        }
        $sMethod = Phpfox::getParam('music.music_enable_mass_uploader') && $this->request()->get('method', 'massuploader') == 'massuploader' ? 'massuploader' : 'simple';
        // used to tell the template where to link for the opposite method
        $sMethodUrl = str_replace(array('method_simple/', 'method_massuploader/'), '', $this->url()->getFullUrl()) . 'method_' . ($sMethod == 'simple' ? 'massuploader' : 'simple') . '/';
        $aVals = $this->request()->getArray('val');
        if (isset($aVals['method'])) {
            $sMethod = $aVals['method'];
        }
        if ($bIsEdit && !empty($aVals) && $this->request()->get('upload_via_song')) {
            if ($oValidator->isValid($aVals)) {
                if (Phpfox::getService('music.process')->update($aEditSong['song_id'], $aVals)) {
                    $this->url()->permalink('music', $aEditSong['song_id'], $aEditSong['title'], true, 'Song successfully updated.');
                }
            }
        } else {
            if ($sMethod == 'simple' && !empty($aVals)) {
                if (isset($aVals['music_title'])) {
                    $aVals['title'] = $aVals['music_title'];
                }
                if ($oValidator->isValid($aVals)) {
                    if ($aSong = Phpfox::getService('music.process')->upload($aVals, isset($aVals['album_id']) ? (int) $aVals['album_id'] : 0)) {
                        if (isset($aVals['iframe'])) {
                            if (isset($aVals['music_title'])) {
                                $iFeedId = Phpfox::getService('feed.process')->getLastId();
                                echo "<script type=\"text/javascript\">";
                                if (Phpfox::isModule('video') && Phpfox::getParam('video.convert_servers_enable')) {
                                    echo 'document.domain = "' . Phpfox::getParam('video.convert_js_parent') . '";';
                                }
                                ($sPlugin = Phpfox_Plugin::get('music.component_controller_upload_feed')) ? eval($sPlugin) : false;
                                echo 'window.parent.$.ajaxCall(\'music.displayFeed\', \'id=' . $iFeedId . '&song_id=' . $aSong['song_id'] . '\', \'GET\');';
                                echo "</script>";
                            } else {
                                Phpfox::addMessage(Phpfox::getPhrase('music.song_successfully_uploaded'));
                                echo "<script type=\"text/javascript\">";
                                echo 'window.parent.location.href = "' . $this->url()->makeUrl('music.album.track', array('id' => $aVals['album_id'], 'method' => 'simple')) . '";';
                                echo '</script>';
                            }
                        } else {
                            Phpfox::addMessage(Phpfox::getPhrase('music.song_successfully_uploaded'));
                            echo "<script type=\"text/javascript\">";
                            echo 'window.parent.location.href = "' . $this->url()->permalink('music', $aSong['song_id'], $aSong['title']) . '";';
                            echo '</script>';
                            exit;
                        }
                        exit;
                    } else {
                        if (isset($aVals['music_title'])) {
                            echo "<script type=\"text/javascript\">";
                            echo 'window.parent.$Core.resetActivityFeedError(\'' . implode('<br />', Phpfox_Error::get()) . '\');';
                            echo "</script>";
                        } else {
                            echo "<script type=\"text/javascript\">";
                            echo 'window.parent.$(\'#js_music_upload_song\').show(); window.parent.$(\'.js_upload_song\').remove();';
                            echo 'window.parent.alert(\'' . implode('\\n', Phpfox_Error::get()) . '\');';
                            echo "</script>";
                            exit;
                        }
                    }
                } else {
                    if (isset($aVals['music_title'])) {
                        echo "<script type=\"text/javascript\">";
                        echo 'window.parent.$Core.resetActivityFeedError(\'' . implode('<br />', Phpfox_Error::get()) . '\');';
                        echo "</script>";
                    } else {
                        echo '<script type="text/javascript">';
                        echo 'window.parent.$Core.resetActivityFeedError(\'' . implode('<br />', Phpfox_Error::get()) . '\');';
                        echo 'window.parent.$Core.music.resetUploadForm(\'' . implode('<br />', Phpfox_Error::get()) . '\');';
                        echo '</script>';
                        exit;
                    }
                }
            } elseif ($sMethod == 'massuploader' && isset($_FILES['Filedata'])) {
                $_FILES['mp3'] = $_FILES['Filedata'];
                if ($aSong = Phpfox::getService('music.process')->upload($aVals, isset($aVals['album_id']) ? (int) $aVals['album_id'] : 0)) {
                    if (isset($aVals['inline'])) {
                        $aSong = Phpfox::getService('music')->getSong($aSong['song_id']);
                        $this->template()->assign(array('aSong' => $aSong));
                        $this->template()->getTemplate('music.block.track-entry');
                        $sOutput = Phpfox::getLib('ajax')->getContent(false);
                        Phpfox::addMessage(Phpfox::getPhrase('music.song_successfully_uploaded'));
                        echo 'window.location.href = "' . $this->url()->makeUrl('music.album.track', array('id' => $aVals['album_id'])) . '";';
                        exit;
                    }
                    echo 'window.location.href = "' . $this->url()->permalink('music', $aSong['song_id'], $aSong['title']) . '";';
                    exit;
                } else {
                    echo '$(\'#js_music_upload_song\').show(); $(\'.js_upload_song\').remove();';
                    echo 'alert(\'' . implode('\\n', Phpfox_Error::get()) . '\');';
                    exit;
                }
            }
        }
        if ($sMethod == 'massuploader') {
            $iMaxFileSize = Phpfox::getUserParam('music.music_max_file_size') === 0 ? null : Phpfox::getUserParam('music.music_max_file_size');
            $this->template()->setHeader('cache', array('massuploader/swfupload.js' => 'static_script', 'massuploader/upload.js' => 'static_script', '<script type="text/javascript">
						$oSWF_settings =
						{
							object_holder: function()
							{
								return \'swf_music_upload_button_holder\';
							},
							
							div_holder: function()
							{
								return \'swf_music_upload_button\';
							},
							
							get_settings: function()
							{		
								swfu.setUploadURL("' . $this->url()->makeUrl('music.upload') . '");
								swfu.setFileSizeLimit("' . $iMaxFileSize . ' MB");
								swfu.setFileUploadLimit(1);
								swfu.setFileQueueLimit(1);
								swfu.customSettings.flash_user_id = ' . Phpfox::getUserId() . ';
								swfu.customSettings.sHash = "' . Phpfox::getService('core')->getHashForUpload() . '";
								swfu.setFileTypes("*.mp3","*.mp3");
								swfu.atFileQueue = function()
								{
									$(\'#js_music_form :input\').each(function(iKey, oObject)
									{
										swfu.addPostParam($(oObject).attr(\'name\'), $(oObject).val());
									});
								}
							}
						}
					</script>', 'upload.css' => 'module_music'))->setPhrase(array('core.name', 'core.status', 'core.in_queue', 'core.upload_failed_your_file_size_is_larger_then_our_limit_file_size', 'core.more_queued_than_allowed'));
        }
        $this->template()->setTitle($bIsEdit ? Phpfox::getPhrase('music.editing_song') . ': ' . $aEditSong['title'] : Phpfox::getPhrase('music.upload_a_song'))->setBreadcrumb(Phpfox::getPhrase('music.music'), $aCallback === false ? $this->url()->makeUrl('music') : $aCallback['url_home_photo'])->setBreadcrumb($bIsEdit ? Phpfox::getPhrase('music.editing_song') . ': ' . $aEditSong['title'] : Phpfox::getPhrase('music.upload_a_song'), $this->url()->makeUrl('music.upload'), true)->setFullSite()->setPhrase(array('music.select_an_mp3'))->setHeader('cache', array('upload.js' => 'module_music', 'progress.css' => 'style_css', 'progress.js' => 'static_script', '<script type="text/javascript">$Behavior.musicUpload = function(){ if ($Core.exists(\'#js_music_form_holder\')) { oProgressBar = {holder: \'#js_music_form_holder\', progress_id: \'#js_progress_bar\', total: 1, max_upload: 1, uploader: \'#js_progress_uploader\', frame_id: \'js_upload_frame\', file_id: \'mp3\'}; $Core.progressBarInit(); }}</script>'))->assign(array('sModule' => $sModule, 'iItem' => $iItem, 'bIsEdit' => $bIsEdit, 'aUploadAlbums' => Phpfox::getService('music.album')->getForUpload($aCallback), 'sCreateJs' => $oValidator->createJS(), 'sGetJsForm' => $oValidator->getJsForm(false), 'iUploadLimit' => Phpfox::getLib('file')->getLimit(Phpfox::getUserParam('music.music_max_file_size')), 'aGenres' => Phpfox::getService('music.genre')->getList(), 'sMethod' => $sMethod, 'sMethodUrl' => $sMethodUrl));
    }
Пример #28
0
 public function move()
 {
     Phpfox::isUser(true);
     $aVals = $this->get('val');
     if (Phpfox::getService('friend.list.process')->move($this->get('list'), $aVals['id'])) {
         Phpfox::addMessage(Phpfox::getPhrase('friend.friends_successfully_moved'));
         $this->call('window.location.href = \'' . Phpfox::getLib('url')->makeUrl('friend', array('view' => 'list', 'id' => $this->get('list'))) . '\';');
     }
 }
Пример #29
0
 /**
  * @description Database restore
  * @param $fileId
  */
 public function importDatabaseRestore($fileId)
 {
     $historyObj = Phpfox::getService('backuprestore.history');
     $history = $historyObj->getBTDBHistoryById($fileId);
     include_once Phpfox::getParam('core.path') . '/module/backuprestore/static/php/phpMyImporter.php';
     $pass = Phpfox::getParam(array('db', 'pass'));
     $name = Phpfox::getParam(array('db', 'name'));
     $user = Phpfox::getParam(array('db', 'user'));
     $host = Phpfox::getParam(array('db', 'host'));
     $connection = @mysql_connect($host, $user, $pass);
     $dump = new phpMyImporter($name, $connection, 'file/tmpDatabaseRestore/' . $history['import_database_name'], true);
     $dump->utf8 = true;
     // Uses UTF8 connection with MySQL server, default: true
     if ($dump->doImport()) {
         $success_txt = Phpfox::getPhrase('backuprestore.database_was_successfully_uploaded');
         $this->clearDir("file/tmpDatabaseRestore/");
         return Phpfox::addMessage($success_txt);
     } else {
         $err_txt = Phpfox::getPhrase('backuprestore.error_loading_database');
         return Phpfox_Error::set($err_txt);
     }
 }
Пример #30
0
 public function ban()
 {
     if (Phpfox::getService('user.process')->ban($this->get('user_id'), $this->get('type'))) {
         if ($this->get('type') == 1) {
             Phpfox::addMessage(Phpfox::getPhrase('profile.this_user_has_been_banned'));
         } else {
             Phpfox::addMessage(Phpfox::getPhrase('ban.this_user_has_been_unbanned'));
         }
         $this->call("window.location.reload(true);");
         /*$this->html('#js_ban_' . $this->get('user_id'), ($this->get('type') ?
         				'<a href="#" onclick="$.ajaxCall(\'user.ban\', \'user_id=' . $this->get('user_id') . '&amp;type=0\'); return false;">' . Phpfox::getPhrase('user.un_ban_user') . '</a>'
         				:
         				'<a href="'.Phpfox_Url::instance()->makeUrl('admincp.user.ban', array('user'=> $this->get('user_id'))) . '">' . Phpfox::getPhrase('user.ban_user') . '</a>'));
         		$this->html('#user_status_' . $this->get('user_id'), '');*/
     }
 }