/** * Class constructor * * @param boolean $exceptions PHPMailer should throw external exceptions? [Optional] */ public function __construct($exceptions = TRUE) { require_once Kohana::find_file('vendor/PHPMailer', 'PHPMailerAutoload'); // Create phpmailer object $this->_mail = new PHPMailer($exceptions); // Set some defaults $this->_mail->setFrom(Config::get('site.site_email', '*****@*****.**'), Template::getSiteName()); $this->_mail->WordWrap = 70; $this->_mail->CharSet = Kohana::$charset; $this->_mail->XMailer = Gleez::getVersion(FALSE, TRUE); $this->_mail->setLanguage(I18n::$lang); $this->_mail->Debugoutput = 'error_log'; }
<?php echo Form::input('name', $post->rawname, array('class' => 'form-control')); ?> </div> </div> <div class="form-group <?php echo isset($errors['type']) ? 'has-error' : ''; ?> "> <?php echo Form::label('type', __('Type'), array('class' => 'control-label col-md-3')); ?> <div class="controls col-md-5"> <?php echo Form::select('type', Gleez::types(), $post->type, array('class' => 'form-control')); ?> <span class="help-block"><?php _e('For what type of content you intend to use categories from this group?'); ?> </span> </div> </div> <div class="form-group <?php echo isset($errors['description']) ? 'has-error' : ''; ?> "> <?php echo Form::label('description', __('Description'), array('class' => 'control-label col-md-3')); ?>
/** * Set the default server headers */ protected function _set_default_server_headers() { $headers = $this->_config->get('headers', array()); $headers['X-Gleez-Version'] = Gleez::getVersion(TRUE, TRUE) . ' (' . Gleez::CODENAME . ')'; $xmlrpc = $this->_config->get('xmlrpc', NULL); if (!is_null($xmlrpc)) { $headers['X-Pingback'] = URL::site($xmlrpc, TRUE); } $this->_set_server_headers($headers); }
/** * Runs the Gleez environment * * @uses Gleez::_set_cookie * @uses Route::set * @uses Route::defaults * @uses Config::load * @uses I18n::initialize * @uses Module::load_modules */ public static function ready() { if (self::$_init) { // Do not allow execution twice return; } // Gleez is now initialized? self::$_init = TRUE; // Set default cookie salt and lifetime self::_set_cookie(); // Check database config file exist or not Gleez::$installed = file_exists(APPPATH . 'config/database.php'); if (Gleez::$installed) { // Database config reader and writer Kohana::$config->attach(new Config_Database()); } if (Kohana::$environment !== Kohana::DEVELOPMENT) { Gleez_Exception::$error_view = 'errors/stack'; } // Turn off notices and strict errors in production if (Kohana::$environment === Kohana::PRODUCTION) { // Turn off notices and strict errors error_reporting(E_ALL ^ E_NOTICE ^ E_STRICT); } // Initialize the locale from settings I18n::initialize(); // Disable the kohana powered headers // @todo Remove it, use Gleez::$expose Kohana::$expose = FALSE; /** * If database.php doesn't exist, then we assume that the Gleez is not * properly installed and send to the installer. */ if (!Gleez::$installed) { Session::$default = 'cookie'; Gleez_Exception::$error_view = 'errors/error'; // Static file serving (CSS, JS, images) Route::set('install/media', 'media(/<file>)', array('file' => '.+'))->defaults(array('controller' => 'install', 'action' => 'media', 'file' => NULL, 'directory' => 'install')); Route::set('install', '(install(/<action>))', array('action' => 'index|systemcheck|database|install|finalize'))->defaults(array('controller' => 'install', 'directory' => 'install')); return; } // Set the default session type Session::$default = Config::get('site.session_type'); // Initialize Gleez modules Module::load_modules(FALSE); // Load the active theme(s) Theme::load_themes(); }
?> </p> <?php } else { ?> <?php } ?> </div> <div class="span-12 last right"> <p><?php _e('Powered by :gleez', array(':gleez' => HTML::anchor('http://gleezcms.org/', 'Gleez CMS'))); ?> <?php echo Gleez::getVersion(); ?> </p> </div> </div> </div> <?php if (Kohana::$environment === Kohana::PRODUCTION) { ?> <script type="text/javascript"> //<![CDATA[ (function() { var links = document.getElementsByTagName('a'); var query = '?'; for(var i = 0; i < links.length; i++) {
/** * Changes the currently enabled modules. Module paths may be relative * or absolute, but must point to a directory: * * Kohana::modules(array('modules/foo', MODPATH.'bar')); * * @param array $modules list of module paths * @return array enabled modules * @throws \InvalidArgumentException */ public static function modules(array $modules = NULL) { if ($modules === NULL) { // Not changing modules, just return the current set return Kohana::$_modules; } // Start a new list of include paths, APPPATH first $paths = array(APPPATH); foreach ($modules as $name => $path) { if (is_dir($path)) { // Add the module to include paths $paths[] = $modules[$name] = realpath($path) . DS; } else { // This module is invalid, remove it throw new \InvalidArgumentException(sprintf('Attempted to load an invalid or missing module %s at %s', $name, realpath($path))); } } // Include GLZPATH before system for CFS $paths[] = GLZPATH; // Finish the include paths by adding SYSPATH $paths[] = SYSPATH; // Set the new include paths Kohana::$_paths = $paths; // Set the current module list Kohana::$_modules = $modules; /** Run Gleez Components */ Gleez::ready(); foreach (Kohana::$_modules as $path) { $init = $path . 'init' . EXT; if (is_file($init)) { // Include the module initialization file once require_once $init; } } if (is_file(GLZPATH . 'init' . EXT)) { //@todo better handling instead of init require_once GLZPATH . 'init' . EXT; } return Kohana::$_modules; }
/** * Processes the request, executing the controller action that handles this * request, determined by the [Route]. * * 1. Before the controller action is called, the [Controller::before] method * will be called. * 2. Next the controller action will be called. * 3. After the controller action is called, the [Controller::after] method * will be called. * * By default, the output from the controller is captured and returned, and * no headers are sent. * * Example: * ~~~ * $request->execute(); * ~~~ * * @return Response * * @throws Request_Exception * * @throws HTTP_Exception_404 * @uses [Kohana::$profiling] * @uses [Profiler] * @uses Gleez::block_ips * @uses Gleez::maintenance_mode */ public function execute() { if (Gleez::$installed) { // Deny access to blocked IP addresses Gleez::block_ips(); // Check Maintenance Mode Gleez::maintenance_mode(); } if (!$this->_external) { $processed = Request::process($this, $this->_routes); if ($processed) { // Store the matching route $this->_route = $processed['route']; $params = $processed['params']; // Is this route external? $this->_external = $this->_route->is_external(); if (isset($params['directory'])) { // Controllers are in a sub-directory $this->_directory = $params['directory']; } // Store the controller $this->_controller = $params['controller']; // Store the action $this->_action = isset($params['action']) ? $params['action'] : Route::$default_action; // These are accessible as public vars and can be overloaded unset($params['controller'], $params['action'], $params['directory']); // Params cannot be changed once matched $this->_params = $params; } } if (!$this->_route instanceof Route) { return HTTP_Exception::factory(404, 'Unable to find a route to match the URI: :uri', array(':uri' => $this->_uri))->request($this)->get_response(); } if (!$this->_client instanceof Request_Client) { throw new Request_Exception('Unable to execute :uri without a Kohana_Request_Client', array(':uri' => $this->_uri)); } return $this->_client->execute($this); }
/** * Get feed generator title and version * * @return string * * @uses Gleez::getVersion */ public static function getGenerator() { return Gleez::getVersion(TRUE, TRUE) . ' ' . '(http://gleezcms.org)'; }