GetInput() public static méthode

Returns the whole parameters array for the given input method.
public static GetInput ( string $p_reqMethod = 'default' ) : array
$p_reqMethod string
Résultat array
Exemple #1
0
 /**
  * Class constructor
  */
 public final function __construct()
 {
     global $Campsite, $controller;
     if (!is_null($this->m_properties)) {
         return;
     }
     $this->login_action = (object) array('is_error' => false, 'error_message' => '');
     self::$m_nullMetaArticle = new MetaArticle();
     self::$m_nullMetaSection = new MetaSection();
     // LEGACY PLUGINS
     // register plugin objects and listobjects
     foreach (CampPlugin::GetPluginsInfo(true) as $info) {
         if (is_array($info['template_engine']['objecttypes'])) {
             foreach ($info['template_engine']['objecttypes'] as $objecttype) {
                 $this->registerObjectType($objecttype);
             }
         }
         if (is_array($info['template_engine']['listobjects'])) {
             foreach ($info['template_engine']['listobjects'] as $listobject) {
                 $this->registerListObject($listobject);
             }
         }
     }
     // Register new plugins system list objects
     $pluginsService = \Zend_Registry::get('container')->get('newscoop.plugins.service');
     $collectedData = $pluginsService->collectListObjects();
     $this->m_listObjects = array_merge($collectedData['listObjects'], $this->m_listObjects);
     CampContext::$m_objectTypes = array_merge($collectedData['objectTypes'], CampContext::$m_objectTypes);
     $this->m_properties['htmlencoding'] = false;
     $this->m_properties['subs_by_type'] = null;
     $this->m_readonlyProperties['version'] = $Campsite['VERSION'];
     $this->m_readonlyProperties['current_list'] = null;
     $this->m_readonlyProperties['lists'] = array();
     $this->m_readonlyProperties['prev_list_empty'] = null;
     $this->m_readonlyProperties['default_url'] = new MetaURL();
     $this->m_readonlyProperties['url'] = new MetaURL();
     if (!$this->m_readonlyProperties['default_url']->is_valid) {
         if (!$this->m_readonlyProperties['url']->language->defined) {
             $this->m_readonlyProperties['url']->language = $this->m_readonlyProperties['url']->publication->default_language;
             $this->m_readonlyProperties['default_url'] = $this->m_readonlyProperties['url'];
         }
     }
     $this->m_objects['user'] = $this->m_readonlyProperties['url']->user;
     $this->m_readonlyProperties['preview'] = $this->m_readonlyProperties['url']->preview;
     if (!$this->m_readonlyProperties['preview']) {
         if (!$this->m_readonlyProperties['url']->article->is_published) {
             $this->m_readonlyProperties['default_url']->article = self::$m_nullMetaArticle;
             $this->m_readonlyProperties['url']->article = self::$m_nullMetaArticle;
         }
         if (!$this->m_readonlyProperties['url']->issue->is_published) {
             $this->m_readonlyProperties['default_url']->article = self::$m_nullMetaArticle;
             $this->m_readonlyProperties['url']->article = self::$m_nullMetaArticle;
             $this->m_readonlyProperties['default_url']->section = self::$m_nullMetaSection;
             $this->m_readonlyProperties['url']->section = self::$m_nullMetaSection;
             $this->m_readonlyProperties['default_url']->issue = new MetaIssue();
             $this->m_readonlyProperties['url']->issue = new MetaIssue();
         }
     }
     $this->m_objects['publication'] = $this->m_readonlyProperties['url']->publication;
     $this->m_objects['language'] = $this->m_readonlyProperties['url']->language;
     $this->m_objects['issue'] = $this->m_readonlyProperties['url']->issue;
     $this->m_objects['section'] = $this->m_readonlyProperties['url']->section;
     $this->m_objects['article'] = $this->m_readonlyProperties['url']->article;
     $this->m_objects['template'] = $this->m_readonlyProperties['url']->template;
     if (is_numeric($this->m_readonlyProperties['url']->get_parameter('tpid'))) {
         $this->m_objects['topic'] = new MetaTopic($this->m_readonlyProperties['url']->get_parameter('tpid'));
     }
     $this->m_readonlyProperties['default_template'] = $this->m_objects['template'];
     $this->m_readonlyProperties['default_language'] = $this->m_objects['language'];
     $this->m_readonlyProperties['default_publication'] = $this->m_objects['publication'];
     $this->m_readonlyProperties['default_issue'] = $this->m_objects['issue'];
     $this->m_readonlyProperties['default_section'] = $this->m_objects['section'];
     $this->m_readonlyProperties['default_article'] = $this->m_objects['article'];
     $this->m_readonlyProperties['default_topic'] = $this->topic;
     if (!is_null($commentId = CampRequest::GetVar('acid'))) {
         $this->m_objects['comment'] = new MetaComment($commentId);
     }
     $this->m_readonlyProperties['request_action'] = MetaAction::CreateAction(CampRequest::GetInput(CampRequest::GetMethod()));
     $requestActionName = $this->m_readonlyProperties['request_action']->name;
     $runAction = true;
     if ($requestActionName == 'submit_comment' && $pluginsService->isInstalled('terwey/plugin-newscoop-comments')) {
         $runAction = false;
     }
     if ($requestActionName != 'default' && $runAction) {
         $this->m_readonlyProperties['request_action']->takeAction($this);
     }
     foreach (MetaAction::ReadAvailableActions() as $actionName => $actionAttributes) {
         $propertyName = $actionName . '_action';
         if ($requestActionName == $actionName) {
             $this->m_readonlyProperties[$propertyName] =& $this->m_readonlyProperties['request_action'];
         } else {
             $this->m_readonlyProperties[$propertyName] = MetaAction::DefaultAction();
         }
     }
     // Initialize the default comment attribute at the end, after the
     // submit comment action had run.
     $this->m_readonlyProperties['default_comment'] = $this->comment;
     // add browser info
     $this->m_readonlyProperties['browser'] = new Browser();
     // initialize plugins
     foreach (CampPlugin::GetPluginsInfo(true) as $info) {
         if (function_exists($info['template_engine']['init'])) {
             $plugin_init = $info['template_engine']['init'];
             $plugin_init($this);
         }
     }
     // initialize geo-map holders
     $this->m_properties['map_dynamic_constraints'] = null;
     $this->m_properties['map_dynamic_areas'] = null;
     $this->m_properties['map_dynamic_max_points'] = 0;
     $this->m_properties['map_dynamic_tot_points'] = 0;
     $this->m_properties['map_dynamic_points_raw'] = null;
     $this->m_properties['map_dynamic_points_objects'] = null;
     $this->m_properties['map_dynamic_meta_article_objects'] = null;
     $this->m_properties['map_dynamic_map_label'] = "";
     $this->m_properties['map_dynamic_id_counter'] = 0;
     $this->m_properties['map_common_header_set'] = false;
     $flashMessenger = new \Newscoop\Controller\Helper\FlashMessenger();
     $this->flash_messages = $flashMessenger->getMessages();
 }
    /**
     *
     */
    protected function execute()
    {
        $input = CampRequest::GetInput('post');
        $session = CampSession::singleton();

        $this->m_step = (!empty($input['step'])) ? $input['step'] : $this->m_defaultStep;

        switch($this->m_step) {
        case 'precheck':
            break;
        case 'license':
            $session->unsetData('config.db', 'installation');
            $session->unsetData('config.site', 'installation');
            $session->unsetData('config.demo', 'installation');
            $this->preInstallationCheck();
            break;
        case 'database':
            $this->license();
            break;
        case 'mainconfig':
            $prevStep = (isset($input['this_step'])) ? $input['this_step'] : '';
            if ($prevStep != 'loaddemo'
                    && $this->databaseConfiguration($input)) {
                $session->setData('config.db', $this->m_config['database'], 'installation', true);
            }
            break;
        case 'loaddemo':
            $prevStep = (isset($input['this_step'])) ? $input['this_step'] : '';
            if ($prevStep != 'loaddemo'
                    && $this->generalConfiguration($input)) {
                $session->setData('config.site', $this->m_config['mainconfig'], 'installation', true);
            }
            break;
        case 'cronjobs':
            if (isset($input['install_demo'])) {
                $session->setData('config.demo', array('loaddemo' => $input['install_demo']), 'installation', true);
                if ($input['install_demo'] != '0') {
                    if (!$this->loadDemoSite()) {
                        break;
                    }
                }
            }
            break;
        case 'finish':
            if (isset($input['install_demo'])) {
                $session->setData('config.demo', array('loaddemo' => $input['install_demo']), 'installation', true);
                if ($input['install_demo'] != '0') {
                    if (!$this->loadDemoSite()) {
                        break;
                    }
                }
            }
            $this->saveCronJobsScripts();
            if ($this->finish()) {
                $this->saveConfiguration();
                self::InstallPlugins();

                require_once($GLOBALS['g_campsiteDir'].'/classes/SystemPref.php');
                SystemPref::DeleteSystemPrefsFromCache();

                // clear all cache
                require_once($GLOBALS['g_campsiteDir'].'/classes/CampCache.php');
                CampCache::singleton()->clear('user');
                CampCache::singleton()->clear();
                CampTemplate::singleton()->clearCache();
            }
            break;
        }
    } // fn execute
Exemple #3
0
// Remove all attempts to get at other parts of the file system
$call_script = str_replace('/../', '/', $call_script);
if ($call_script == '/logout.php') $call_script = $prefix . 'logout.php';

$extension = '';
if (($extension_start = strrpos($call_script, '.')) !== false) {
    $extension = strtolower(substr($call_script, $extension_start));
}

if (($extension == '.php') || ($extension == '')) {

    // If they arent trying to login in...
    if (($call_script != $prefix . 'login.php') && ($call_script != $prefix . 'do_login.php') && $call_script != $prefix . 'password_recovery.php' && $call_script != $prefix . 'password_check_token.php') {

        // Check if the user is logged in already
        list($access, $g_user) = camp_check_admin_access(CampRequest::GetInput());
        if (!$access) {
            // If not logged in: store request
            $request = serialize(array(
                'uri' => $_SERVER['REQUEST_URI'],
                'post' => $_POST,
            ));
            $requestId = sha1($request);
            camp_session_set("request_$requestId", $request);

            // show the login screen
            header("Location: /{$ADMIN}{$prefix}login.php?request=$requestId");
            exit(0);
        }
    }
    /**
     * Performs the action; returns true on success, false on error.
     *
     * @param $p_context - the current context object
     * @return bool
     */
    public function takeAction(CampContext &$p_context)
    {
        $p_context->default_url->reset_parameter('f_'.$this->m_name);
        $p_context->url->reset_parameter('f_'.$this->m_name);

        if (PEAR::isError($this->m_error)) {
            return false;
        }

        $user = new User($p_context->user->identifier);
        if ($user->getUserId() != CampRequest::GetVar('LoginUserId')
        || $user->getKeyId() != CampRequest::GetVar('LoginUserKey')
        || $user->getUserId() == 0
        || $user->getKeyId() == 0) {
            $this->m_error = new PEAR_Error('You must be logged in to create or edit your subscription.',
            ACTION_EDIT_SUBSCRIPTION_ERR_NO_USER);
            return false;
        }

        $subscriptions = Subscription::GetSubscriptions($p_context->publication->identifier,
        $user->getUserId());
        if (count($subscriptions) == 0) {
            $subscription = new Subscription();
            $created = $subscription->create(array(
			'IdUser' => $user->getUserId(),
			'IdPublication' => $p_context->publication->identifier,
			'Active' => 'Y',
			'Type' => $this->m_subscriptionType == 'trial' ? 'T' : 'P'));
            if (!$created) {
                $this->m_error = new PEAR_Error('Internal error (code 1)',
                ACTION_EDIT_SUBSCRIPTION_ERR_INTERNAL);
                exit(1);
            }
        } else {
            $subscription = $subscriptions[0];
        }

        $publication = new Publication($p_context->publication->identifier);
        $subscriptionDays = $this->computeSubscriptionDays($publication,
        $p_context->publication->subscription_time);

        $startDate = new Date();
        
        $columns = array(
        'StartDate'=>$startDate->getDate(),
        'Days'=>$subscriptionDays,
        'PaidDays'=>($this->m_subscriptionType == 'trial' ? $subscriptionDays : 0),
        'NoticeSent'=>'N'
        );

        if ($this->m_properties['subs_by_type'] == 'publication') {
        	$sectionsList = Section::GetUniqueSections($p_context->publication->identifier);
        	foreach ($sectionsList as $section) {
        		$this->m_sections[] = $section['id'];
        	}
        }
        foreach ($this->m_languages as $languageId) {
            foreach ($this->m_sections as $sectionNumber) {
                $subsSection = new SubscriptionSection($subscription->getSubscriptionId(),
                $sectionNumber, $languageId);
                $subsSection->create($columns);
            }
        }

        $fields = array('SubsType', 'tx_subs', 'nos', 'unitcost', 'unitcostalllang',
        'f_substype', 'cb_subs', 'subs_all_languages', 'suma', 'tpl', 'subscription_language');
        foreach (CampRequest::GetInput() as $field=>$value) {
            if (strncmp('tx_subs', $field, strlen('tx_subs')) == 0) {
                $fields[] = $field;
            }
        }
        foreach ($fields as $fieldName) {
            $p_context->default_url->reset_parameter($fieldName);
            $p_context->url->reset_parameter($fieldName);
        }

        $this->m_error = ACTION_OK;
        return true;
    }
    /**
     * Reads the input parameters and sets up the interview action.
     *
     * @param array $p_input
     */
    public function __construct(array $p_input)
    {
        $this->m_name = 'interview';
        $this->m_defined = true;
        
        if (!strlen($p_input['f_interview_language_id'])) {
            $this->m_error = new PEAR_Error('An interview language was not selected.',
            ACTION_INTERVIEW_ERR_NO_LANGUAGE);
            return;
        }
        $this->m_properties['language_id'] = $p_input['f_interview_language_id'];
        
        if (!strlen($p_input['f_interview_title'])) {
            $this->m_error = new PEAR_Error('An interview title was not set.',
            ACTION_INTERVIEW_ERR_NO_TITLE);
            return;
        }
        $this->m_properties['title'] = $p_input['f_interview_title'];
        
        if (!isset($p_input['f_interview_description'])) {
            $this->m_error = new PEAR_Error('An description was not set.',
            ACTION_INTERVIEW_ERR_NO_DESCRIPTION);
            return;
        }
        $this->m_properties['description'] = $p_input['f_interview_description'];
        
        if (!strlen($p_input['f_interview_description_short'])) {
            $this->m_error = new PEAR_Error('An short description was not set.',
            ACTION_INTERVIEW_ERR_NO_DESCRIPTION_SHORT);
            return;
        }
        $this->m_properties['description_short'] = $p_input['f_interview_description_short'];

        if (!isset($p_input['f_interview_moderator_user_id'])) {
            $this->m_error = new PEAR_Error('An interview moderator was not selected.',
            ACTION_INTERVIEW_ERR_NO_MODERATOR);
            return;
        }
        $this->m_properties['moderator_user_id'] = $p_input['f_interview_moderator_user_id'];
        
        if (!isset($p_input['f_interview_guest_user_id'])) {
            $this->m_error = new PEAR_Error('An interview guest was not selected.',
            ACTION_INTERVIEW_ERR_NO_GUEST);
            return;
        }
        $this->m_properties['guest_user_id'] = $p_input['f_interview_guest_user_id'];
        
        if (strlen($p_input['f_interview_interview_begin']) != 10) {
            $this->m_error = new PEAR_Error('An interview begin was not set.',
            ACTION_INTERVIEW_ERR_NO_INTERVIEW_BEGIN);
            return;
        }
        $this->m_properties['interview_begin'] = $p_input['f_interview_interview_begin'];
        
        if (strlen($p_input['f_interview_interview_end']) != 10) {
            $this->m_error = new PEAR_Error('An interview end was not set.',
            ACTION_INTERVIEW_ERR_NO_INTERVIEW_END);
            return;
        }
        $this->m_properties['interview_end'] = $p_input['f_interview_interview_end'];
        
        if (strlen($p_input['f_interview_questions_begin']) != 10) {
            $this->m_error = new PEAR_Error('An questions begin was not set.',
            ACTION_INTERVIEW_ERR_NO_QUESTIONS_BEGIN);
            return;
        }
        $this->m_properties['questions_begin'] = $p_input['f_interview_questions_begin'];

        if (strlen($p_input['f_interview_questions_end']) != 10) {
            $this->m_error = new PEAR_Error('An questions end was not set.',
            ACTION_INTERVIEW_ERR_NO_QUESTIONS_END);
            return;
        }
        $this->m_properties['questions_end'] = $p_input['f_interview_questions_end'];

        if (strlen($p_input['f_interview_questions_limit'])) {
            $this->m_properties['questions_limit'] = $p_input['f_interview_questions_limit'];
        } else {
            $this->m_properties['questions_limit'] = 0;
        }
        
        $this->m_properties['image_delete'] = $p_input['f_interview_image_delete'];
        $this->m_properties['image_description'] = $p_input['f_interview_image_description'];
        $files = CampRequest::GetInput('files');
        $this->m_properties['image'] = $files['f_interview_image'];
        
        $this->m_interview = new Interview($p_input['f_interview_id']);
    }
Exemple #6
0
 /**
  * Class constructor
  */
 public final function __construct()
 {
     global $Campsite, $controller;
     if (!is_null($this->m_properties)) {
         return;
     }
     $this->login_action = (object) array('is_error' => false, 'error_message' => '');
     self::$m_nullMetaArticle = new MetaArticle();
     self::$m_nullMetaSection = new MetaSection();
     // register plugin objects and listobjects
     foreach (CampPlugin::GetPluginsInfo(true) as $info) {
         if (is_array($info['template_engine']['objecttypes'])) {
             foreach ($info['template_engine']['objecttypes'] as $objecttype) {
                 $this->registerObjectType($objecttype);
             }
         }
         if (is_array($info['template_engine']['listobjects'])) {
             foreach ($info['template_engine']['listobjects'] as $listobject) {
                 $this->registerListObject($listobject);
             }
         }
     }
     $this->m_properties['htmlencoding'] = false;
     $this->m_properties['subs_by_type'] = null;
     $this->m_readonlyProperties['version'] = $Campsite['VERSION'];
     $this->m_readonlyProperties['current_list'] = null;
     $this->m_readonlyProperties['lists'] = array();
     $this->m_readonlyProperties['prev_list_empty'] = null;
     $this->m_readonlyProperties['default_url'] = new MetaURL();
     $this->m_readonlyProperties['url'] = new MetaURL();
     if (!$this->m_readonlyProperties['default_url']->is_valid) {
         header('HTTP/1.0 404 Not Found');
         if (!$this->m_readonlyProperties['url']->language->defined) {
             $this->m_readonlyProperties['url']->language = $this->m_readonlyProperties['url']->publication->default_language;
             $this->m_readonlyProperties['default_url'] = $this->m_readonlyProperties['url'];
         }
     }
     $this->m_objects['user'] = $this->m_readonlyProperties['url']->user;
     $this->m_readonlyProperties['preview'] = $this->m_readonlyProperties['url']->preview;
     if (!$this->m_readonlyProperties['preview']) {
         if (!$this->m_readonlyProperties['url']->article->is_published) {
             $this->m_readonlyProperties['default_url']->article = self::$m_nullMetaArticle;
             $this->m_readonlyProperties['url']->article = self::$m_nullMetaArticle;
         }
         if (!$this->m_readonlyProperties['url']->issue->is_published) {
             $this->m_readonlyProperties['default_url']->article = self::$m_nullMetaArticle;
             $this->m_readonlyProperties['url']->article = self::$m_nullMetaArticle;
             $this->m_readonlyProperties['default_url']->section = self::$m_nullMetaSection;
             $this->m_readonlyProperties['url']->section = self::$m_nullMetaSection;
             $this->m_readonlyProperties['default_url']->issue = new MetaIssue();
             $this->m_readonlyProperties['url']->issue = new MetaIssue();
         }
     }
     $this->m_objects['publication'] = $this->m_readonlyProperties['url']->publication;
     $this->m_objects['language'] = $this->m_readonlyProperties['url']->language;
     $this->m_objects['issue'] = $this->m_readonlyProperties['url']->issue;
     $this->m_objects['section'] = $this->m_readonlyProperties['url']->section;
     $this->m_objects['article'] = $this->m_readonlyProperties['url']->article;
     $this->m_objects['template'] = $this->m_readonlyProperties['url']->template;
     if (is_numeric($this->m_readonlyProperties['url']->get_parameter('tpid'))) {
         $this->m_objects['topic'] = new MetaTopic($this->m_readonlyProperties['url']->get_parameter('tpid'));
     }
     $this->m_readonlyProperties['default_template'] = $this->m_objects['template'];
     $this->m_readonlyProperties['default_language'] = $this->m_objects['language'];
     $this->m_readonlyProperties['default_publication'] = $this->m_objects['publication'];
     $this->m_readonlyProperties['default_issue'] = $this->m_objects['issue'];
     $this->m_readonlyProperties['default_section'] = $this->m_objects['section'];
     $this->m_readonlyProperties['default_article'] = $this->m_objects['article'];
     $this->m_readonlyProperties['default_topic'] = $this->topic;
     if (!is_null($commentId = CampRequest::GetVar('acid'))) {
         $this->m_objects['comment'] = new MetaComment($commentId);
     }
     $this->m_readonlyProperties['request_action'] = MetaAction::CreateAction(CampRequest::GetInput(CampRequest::GetMethod()));
     $requestActionName = $this->m_readonlyProperties['request_action']->name;
     if ($requestActionName != 'default') {
         $this->m_readonlyProperties['request_action']->takeAction($this);
     }
     foreach (MetaAction::ReadAvailableActions() as $actionName => $actionAttributes) {
         $propertyName = $actionName . '_action';
         if ($requestActionName == $actionName) {
             $this->m_readonlyProperties[$propertyName] =& $this->m_readonlyProperties['request_action'];
         } else {
             $this->m_readonlyProperties[$propertyName] = MetaAction::DefaultAction();
         }
     }
     // Initialize the default comment attribute at the end, after the
     // submit comment action had run.
     $this->m_readonlyProperties['default_comment'] = $this->comment;
     // add browser info
     $this->m_readonlyProperties['browser'] = new Browser();
     // initialize plugins
     foreach (CampPlugin::GetPluginsInfo(true) as $info) {
         if (function_exists($info['template_engine']['init'])) {
             $plugin_init = $info['template_engine']['init'];
             $plugin_init($this);
         }
     }
     // initialize geo-map holders
     $this->m_properties['map_dynamic_constraints'] = null;
     $this->m_properties['map_dynamic_areas'] = null;
     $this->m_properties['map_dynamic_max_points'] = 0;
     $this->m_properties['map_dynamic_tot_points'] = 0;
     $this->m_properties['map_dynamic_points_raw'] = null;
     $this->m_properties['map_dynamic_points_objects'] = null;
     $this->m_properties['map_dynamic_meta_article_objects'] = null;
     $this->m_properties['map_dynamic_map_label'] = "";
     $this->m_properties['map_dynamic_id_counter'] = 0;
     $this->m_properties['map_common_header_set'] = false;
     if (defined('APPLICATION_PATH')) {
         $options = $controller->getInvokeArg('bootstrap')->getOptions();
         $form = new \Application_Form_Contact();
         $form->setMethod('POST');
         $request = \Zend_Controller_Front::getInstance()->getRequest();
         if ($request->isPost() && $form->isValid($request->getPost())) {
             $email = new \Zend_Mail('utf-8');
             $email->setFrom($form->email->getValue(), $form->first_name->getValue() . ' ' . $form->last_name->getValue())->setSubject($form->subject->getValue())->setBodyText($form->message->getValue())->addTo($options['email']['contact'])->send();
             $controller->getHelper('flashMessenger')->addMessage("form_contact_done");
             $controller->getHelper('redirector')->gotoUrl($request->getPathInfo());
             exit;
         }
         $this->form_contact = $form;
         $this->flash_messages = $controller->getHelper('flashMessenger')->getMessages();
     }
 }
Exemple #7
0
    /**
     * Class constructor
     *
     * @param string $p_uri
     *    The full URI string
     */
    public function __construct($p_uri = 'SELF')
    {
        $this->m_config = CampConfig::singleton();

        if (isset($p_uri) && $p_uri != 'SELF') {
            $uriString = $p_uri;
        } else {
            // ... otherwise we build the uri from the server itself.
            //
            // checks whether the site is being queried through SSL
            if (isset($_SERVER['HTTPS'])
            && !empty($_SERVER['HTTPS'])
            && (strtolower($_SERVER['HTTPS']) != 'off')) {
                $scheme = 'https://';
            } else {
                $scheme = 'http://';
            }

            // this works at least for apache, some research is needed
            // in order to support other web servers.
            if (!empty($_SERVER['PHP_SELF'])) {
                $uriString = $scheme . $_SERVER['HTTP_HOST'];
            }
            if (isset($_SERVER['REQUEST_URI'])) {
                $uriString .= $_SERVER['REQUEST_URI'];
            }

            // some cleaning directives
            $uriString = urldecode($uriString);
            $uriString = str_replace('"', '"', $uriString);
            $uriString = str_replace('<', '&lt;', $uriString);
            $uriString = str_replace('>', '&gt;', $uriString);
            $uriString = preg_replace('/eval\((.*)\)/', '', $uriString);
            $uriString = preg_replace('/[\\\"\\\'][\\s]*javascript:(.*)[\\\"\\\']/', '""', $uriString);
        }

        $this->parse($uriString);
        $this->m_queryArray = array_merge($this->m_queryArray, CampRequest::GetInput('POST'));

        $this->readUser();
    } // fn __construct
Exemple #8
0
    /**
     * Class constructor
     */
    final public function __construct()
    {
        global $Campsite;

        if (!is_null($this->m_properties)) {
            return;
        }

        self::$m_nullMetaArticle = new MetaArticle();
        self::$m_nullMetaSection = new MetaSection();

        // register plugin objects and listobjects
        foreach (CampPlugin::GetPluginsInfo(true) as $info) {
        	if (is_array($info['template_engine']['objecttypes'])) {
        		foreach ($info['template_engine']['objecttypes'] as $objecttype) {
        			$this->registerObjectType($objecttype);
        		}
        	}

        	if (is_array($info['template_engine']['listobjects'])) {
        		foreach ($info['template_engine']['listobjects'] as $listobject) {
        			$this->registerListObject($listobject);
        		}
        	}
        }

        $this->m_properties['htmlencoding'] = false;
        $this->m_properties['subs_by_type'] = null;

        $this->m_readonlyProperties['version'] = $Campsite['VERSION'];

        $this->m_readonlyProperties['current_list'] = null;
        $this->m_readonlyProperties['lists'] = array();
        $this->m_readonlyProperties['prev_list_empty'] = null;

        $this->m_readonlyProperties['default_url'] = new MetaURL();
        $this->m_readonlyProperties['url'] = new MetaURL();
        if (!$this->m_readonlyProperties['default_url']->is_valid) {
        	header('HTTP/1.0 404 Not Found');
        	if (!$this->m_readonlyProperties['url']->language->defined) {
        		$this->m_readonlyProperties['url']->language = $this->m_readonlyProperties['url']->publication->default_language;
        		$this->m_readonlyProperties['default_url'] = $this->m_readonlyProperties['url'];
        	}
        }

        $this->m_objects['user'] = $this->m_readonlyProperties['url']->user;
        $this->m_readonlyProperties['preview'] = $this->m_readonlyProperties['url']->preview;

        if (!$this->m_readonlyProperties['preview']) {
        	if (!$this->m_readonlyProperties['url']->article->is_published) {
        		$this->m_readonlyProperties['default_url']->article = self::$m_nullMetaArticle;
                $this->m_readonlyProperties['url']->article = self::$m_nullMetaArticle;
        	}
            if (!$this->m_readonlyProperties['url']->issue->is_published) {
                $this->m_readonlyProperties['default_url']->article = self::$m_nullMetaArticle;
                $this->m_readonlyProperties['url']->article = self::$m_nullMetaArticle;
                $this->m_readonlyProperties['default_url']->section = self::$m_nullMetaSection;
                $this->m_readonlyProperties['url']->section = self::$m_nullMetaSection;
                $this->m_readonlyProperties['default_url']->issue = new MetaIssue();
                $this->m_readonlyProperties['url']->issue = new MetaIssue();
            }
        }

        $this->m_objects['publication'] = $this->m_readonlyProperties['url']->publication;
        $this->m_objects['language'] = $this->m_readonlyProperties['url']->language;
        $this->m_objects['issue'] = $this->m_readonlyProperties['url']->issue;
        $this->m_objects['section'] = $this->m_readonlyProperties['url']->section;
        $this->m_objects['article'] = $this->m_readonlyProperties['url']->article;
        $this->m_objects['template'] = $this->m_readonlyProperties['url']->template;
        if (is_numeric($this->m_readonlyProperties['url']->get_parameter('tpid'))) {
            $this->m_objects['topic'] = new MetaTopic($this->m_readonlyProperties['url']->get_parameter('tpid'));
        }

        $this->m_readonlyProperties['default_template'] = $this->m_objects['template'];
        $this->m_readonlyProperties['default_language'] = $this->m_objects['language'];
        $this->m_readonlyProperties['default_publication'] = $this->m_objects['publication'];
        $this->m_readonlyProperties['default_issue'] = $this->m_objects['issue'];
        $this->m_readonlyProperties['default_section'] = $this->m_objects['section'];
        $this->m_readonlyProperties['default_article'] = $this->m_objects['article'];
        $this->m_readonlyProperties['default_topic'] = $this->topic;

        if (!is_null($commentId = CampRequest::GetVar('acid'))) {
            $this->m_objects['comment'] = new MetaComment($commentId);
        }

        $this->m_readonlyProperties['request_action'] = MetaAction::CreateAction(CampRequest::GetInput(CampRequest::GetMethod()));
        $requestActionName = $this->m_readonlyProperties['request_action']->name;
        if ($requestActionName != 'default') {
        	$this->m_readonlyProperties['request_action']->takeAction($this);
        }

        foreach (MetaAction::ReadAvailableActions() as $actionName=>$actionAttributes) {
            $propertyName = $actionName . '_action';
            if ($requestActionName == $actionName) {
                $this->m_readonlyProperties[$propertyName] =& $this->m_readonlyProperties['request_action'];
            } else {
                $this->m_readonlyProperties[$propertyName] = MetaAction::DefaultAction();
            }
        }

        // Initialize the default comment attribute at the end, after the
        // submit comment action had run.
        $this->m_readonlyProperties['default_comment'] = $this->comment;

        // add browser info
        $this->m_readonlyProperties['browser'] = new Browser;

        // initialize plugins
        foreach (CampPlugin::GetPluginsInfo(true) as $info) {
            if (function_exists($info['template_engine']['init'])) {
                $plugin_init = $info['template_engine']['init'];
                $plugin_init($this);
            }
        }
    } // fn __construct