Exemplo n.º 1
0
appconf_set('template', false);
/**
 * Set this to the page ID of the page you would like to be the parent of
 * the app.  This affects the web site navigation while within the
 * app itself, and the breadcrumb trail as well.
 */
appconf_set('page_below', false);
/**
 * Set this to the ID of the page which is an alias of the app.
 */
appconf_set('page_alias', false);
/**
 * This loads the settings.ini.php file now so the defaults there can affect
 * subsequent function calls like page_add_style() below in this file.
 */
appconf_default_settings();
if ($context == 'action') {
    if (appconf('page_below')) {
        page_below(appconf('page_below'));
    }
    if (appconf('page_alias')) {
        page_id(appconf('page_alias'));
    }
    if (appconf('template')) {
        page_template(appconf('template'));
    }
    global $cgi;
    $url = 'http://' . site_domain() . site_prefix() . '/index/news-rss-action/nomenu.1';
    if ($cgi->section) {
        $url .= '?section=' . $cgi->section;
    } elseif ($cgi->author) {
Exemplo n.º 2
0
 /**
  * Executes the specified form using the Sitellite form API,
  * which is essentially just an include of a file that defines a
  * subclass of saf.MailForm.
  * 
  * @access	public
  * @param	string	$name
  * @param	string	$context
  * @return	string
  * 
  */
 function form($name, $context = 'normal')
 {
     if (!is_array($this->formAccess)) {
         if (!$this->formAllowed($name, $context)) {
             return '';
         }
     }
     if ($this->formAccess['sitellite_secure']) {
         if (site_secure()) {
             if (!cgi_is_https()) {
                 cgi_force_https();
             }
         } else {
             die('The requested form requires an SSL connection, but Sitellite does not have SSL enabled.');
         }
     } elseif ($this->formAccess['sitellite_secure'] === '') {
         if (cgi_is_https()) {
             cgi_force_http();
         }
     }
     $app = $this->getApp($name);
     $name = $this->removeApp($name, $app);
     $this->apps[] = $app;
     if (@file_exists($this->prefix . '/' . $app . '/' . $this->formPath . '/' . $name . '/index.php')) {
         loader_import('saf.MailForm');
         if (@file_exists($this->prefix . '/' . $app . '/conf/properties.php')) {
             include_once $this->prefix . '/' . $app . '/conf/properties.php';
         }
         /*if (@file_exists ($this->prefix . '/' . $app . '/conf/settings.ini.php')) {
         			$settings = ini_parse ($this->prefix . '/' . $app . '/conf/settings.ini.php', true);
         			foreach ($settings as $k => $v) {
         				appconf_set ($k, $v['value']);
         			}
         		}*/
         appconf_default_settings();
         ob_start();
         // special behaviour changes for global objects when in a box
         global $simple, $tpl, $intl;
         $old_simple_path = $simple->path;
         $simple->path = $this->prefix . '/' . $app . '/html';
         $old_tpl_path = $tpl->path;
         $tpl->path = $this->prefix . '/' . $app . '/html';
         $old_intl_path = $intl->directory;
         $intl->directory = $this->prefix . '/' . $app . '/lang';
         $intl->getIndex();
         include $this->prefix . '/' . $app . '/' . $this->formPath . '/' . $name . '/index.php';
         $contents .= ob_get_contents();
         ob_end_clean();
         $contents = trim($contents);
         if (empty($contents)) {
             $class = ucfirst($app);
             foreach (explode('/', $name) as $p) {
                 $class .= ucfirst($p);
             }
             $class .= 'Form';
             if (class_exists($class)) {
                 ob_start();
                 $form = new $class();
                 $form->context = $context;
                 echo $form->run();
                 $contents .= ob_get_contents();
                 ob_end_clean();
             }
         }
         $simple->path = $old_simple_path;
         $tpl->path = $old_tpl_path;
         $intl->directory = $old_intl_path;
         $this->formAccess = false;
         array_pop($this->apps);
         return $contents;
     } else {
         $this->formAccess = false;
         array_pop($this->apps);
         global $errno;
         $errno = E_NOT_FOUND;
         switch (conf('Server', 'error_handler_type')) {
             case 'box':
                 return $this->box(conf('Server', 'error_handler'));
             case 'form':
                 return $this->form(conf('Server', 'error_handler'));
             default:
                 header('Location: ' . site_prefix() . '/index/' . conf('Server', 'error_handler'));
                 exit;
         }
     }
     $this->formAccess = false;
     array_pop($this->apps);
     return '';
 }