function index()
 {
     $this->name = 'configuration';
     $themes_config = $themes_fallback = array();
     $Configure =& Configure::getInstance('jreviews');
     $App =& App::getInstance('jreviews');
     $ThemeArray = $App->jreviewsPaths['Theme'];
     foreach ($ThemeArray as $theme_name => $files) {
         if (!isset($themes_config[$theme_name]) && isset($files['.info']) && $files['.info']['configuration'] == 1) {
             $themes_config[$theme_name] = $files['.info']['title'] . ' (' . $files['.info']['location'] . ')';
         }
         if (!isset($themes_mobile[$theme_name]) && isset($files['.info']) && $files['.info']['configuration'] == 1) {
             $themes_mobile[$theme_name] = $files['.info']['title'] . ' (' . $files['.info']['location'] . ')';
         }
         if (!isset($themes_fallback[$theme_name]) && isset($files['.info']) && $files['.info']['fallback'] == 1) {
             $themes_fallback[$theme_name] = $files['.info']['title'] . ' (' . $files['.info']['location'] . ')';
         }
         if ($files['.info']['mobile'] == 1) {
             $themes_config[$theme_name] = $themes_config[$theme_name] . ' -mobile';
             $themes_mobile[$theme_name] = $themes_mobile[$theme_name] . ' -mobile';
         }
         $themes_description[$theme_name] = $files['.info']['description'];
     }
     unset($ThemeArray);
     unset($App);
     $this->set(array('stats' => $this->stats, 'version' => $this->Config->version, 'Config' => $this->Config, 'themes_config' => $themes_config, 'themes_mobile' => empty($themes_mobile) ? array('' => 'No theme available') : $themes_mobile, 'themes_fallback' => $themes_fallback, 'themes_description' => $themes_description));
     return $this->render();
 }
Example #2
0
 /**
  * Accesseur en écriture des données de la classe
  *
  * @param varchar $var Variable à modifier
  * @param mixed $value Valeur de la variable à modifier
  * @version 0.1 - 29/12/2011
  */
 static function write($var, $value)
 {
     $_this = Configure::getInstance();
     //On va créer une instence de la classe car en static l'objet $this n'est pas accessible
     $_this->{$var} = $value;
     unset($o);
 }
 function _readConfigure()
 {
     $configure = Configure::getInstance();
     $config_array = array();
     $start = false;
     foreach ($configure as $key => $value) {
         if ($key == "SettingsEnd") {
             break;
         }
         if ($start) {
             foreach ($value as $key2 => $value2) {
                 if (is_array($value2)) {
                     foreach ($value2 as $key3 => $value3) {
                         $thekey = $key . "." . $key2 . "." . $key3;
                         $config_array[$thekey] = $value3;
                     }
                 } else {
                     $thekey = $key . "." . $key2;
                     $config_array[$thekey] = $value2;
                 }
                 //Configure::write($thekey, $value2);
                 //echo $key . "." . $key2 . "." . $value2 . "<br />\n";
             }
         }
         if ($key == "SettingsStart") {
             $start = true;
         }
     }
     return $config_array;
 }
Example #4
0
 /**
  * Return all packeges included
  *
  * @return array
  * @access public
  */
 function return_packages()
 {
     $_this =& Configure::getInstance();
     if (count($_this->packages) > 0) {
         return $_this->packages;
     } else {
         return array();
     }
 }
Example #5
0
 function _initialize()
 {
     Configure::write('localePaths', am(Configure::getInstance()->localePaths, dirname(dirname(dirname(__FILE__))) . DS . 'locale' . DS));
     Configure::write('Cache.disable', true);
     if (!defined('DEFAULT_LANGUAGE')) {
         define('DEFAULT_LANGUAGE', 'pt-br');
     }
     if (!empty($this->params['proxy'])) {
         $this->proxy = $this->params['proxy'];
     }
 }
 /**
  * &getInstance method
  * 
  * @param bool $boot 
  * @access public
  * @return void
  */
 function &getInstance($boot = true)
 {
     /**
      * instance property
      * 
      * @var array
      * @access public
      */
     static $instance = array();
     if (!$instance) {
         $instance[0] =& Configure::getInstance();
         $instance[0]->__loadBootstrap(false);
     }
     return $instance[0];
 }
Example #7
0
 function __parseUrl($url)
 {
     $paths = Configure::getInstance();
     $params = Router::parse(Router::url($url));
     if ($paths->Routing['prefixes']) {
         if (isset($params[$paths->Routing['prefixes'][0]])) {
             if (empty($params['action'])) {
                 $params['action'] = $paths->Routing['prefixes'][0] . '_' . 'index';
             } else {
                 $params['action'] = $paths->Routing['prefixes'][0] . '_' . $params['action'];
             }
         } elseif (strpos($params['action'], $paths->Routing['prefixes'][0]) === 0) {
             $privateAction = true;
         }
     }
     return $params;
 }
Example #8
0
/**
 * Get CakePHP basic paths as an indexed array.
 * Resulting array will contain array of paths
 * indexed by: Models, Behaviors, Controllers,
 * Components, and Helpers.
 *
 * @return array Array of paths indexed by type
 */
function paths()
{
    $directories = Configure::getInstance();
    $paths = array();
    foreach ($directories->modelPaths as $path) {
        $paths['Models'][] = $path;
    }
    foreach ($directories->behaviorPaths as $path) {
        $paths['Behaviors'][] = $path;
    }
    foreach ($directories->controllerPaths as $path) {
        $paths['Controllers'][] = $path;
    }
    foreach ($directories->componentPaths as $path) {
        $paths['Components'][] = $path;
    }
    foreach ($directories->helperPaths as $path) {
        $paths['Helpers'][] = $path;
    }
    if (!class_exists('Folder')) {
        App::import('Core', 'Folder');
    }
    $folder =& new Folder(APP . 'plugins' . DS);
    $plugins = $folder->ls();
    $classPaths = array('models', 'models' . DS . 'behaviors', 'controllers', 'controllers' . DS . 'components', 'views' . DS . 'helpers');
    foreach ($plugins[0] as $plugin) {
        foreach ($classPaths as $path) {
            if (strpos($path, DS) !== false) {
                $key = explode(DS, $path);
                $key = $key[1];
            } else {
                $key = $path;
            }
            $folder->path = APP . 'plugins' . DS . $plugin . DS . $path;
            $paths[Inflector::camelize($plugin)][Inflector::camelize($key)][] = $folder->path;
        }
    }
    return $paths;
}
 function _getViewFileName($action)
 {
     $action = Inflector::underscore($action);
     $paths = Configure::getInstance();
     $type = null;
     if (empty($action)) {
         $action = $this->action;
     }
     $position = strpos($action, '..');
     if ($position === false) {
     } else {
         $action = explode('/', $action);
         $i = array_search('..', $action);
         unset($action[$i - 1]);
         unset($action[$i]);
         $action = '..' . DS . implode(DS, $action);
     }
     foreach ($paths->viewPaths as $path) {
         if (file_exists($path . $this->viewPath . DS . $this->subDir . $type . $action . $this->ext)) {
             $viewFileName = $path . $this->viewPath . DS . $this->subDir . $type . $action . $this->ext;
             return $viewFileName;
         }
     }
     // added for .ctp viewPath fallback
     foreach ($paths->viewPaths as $path) {
         if (file_exists($path . $this->viewPath . DS . $type . $action . '.ctp')) {
             $viewFileName = $path . $this->viewPath . DS . $type . $action . '.ctp';
             return $viewFileName;
         }
     }
     if ($viewFileName = fileExistsInPath(LIBS . 'view' . DS . 'templates' . DS . 'errors' . DS . $type . $action . '.ctp')) {
     } elseif ($viewFileName = fileExistsInPath(LIBS . 'view' . DS . 'templates' . DS . $this->viewPath . DS . $type . $action . '.ctp')) {
     } else {
         $viewFileName = VIEWS . $this->viewPath . DS . $this->subDir . $type . $action . $this->ext;
     }
     return $viewFileName;
 }
 /**
  * testStaticAssets method
  *
  * @access public
  * @return void
  */
 function testStaticAssets()
 {
     Router::reload();
     $Configure = Configure::getInstance();
     $Configure->__objects = null;
     App::build(array('plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS), 'vendors' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'vendors' . DS)));
     $Dispatcher =& new TestDispatcher();
     Configure::write('debug', 0);
     ob_start();
     $Dispatcher->dispatch('/img/test.jpg');
     $result = ob_get_clean();
     $file = file_get_contents(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'vendors' . DS . 'img' . DS . 'test.jpg');
     $this->assertEqual($file, $result);
     Configure::write('debug', 0);
     $Dispatcher->params = $Dispatcher->parseParams('css/test_asset.css');
     ob_start();
     $Dispatcher->cached('css/test_asset.css');
     $result = ob_get_clean();
     $this->assertEqual('this is the test asset css file', $result);
     Configure::write('debug', 0);
     $Dispatcher->params = $Dispatcher->parseParams('test_plugin/css/test_plugin_asset.css');
     ob_start();
     $Dispatcher->cached('test_plugin/css/test_plugin_asset.css');
     $result = ob_get_clean();
     $this->assertEqual('this is the test plugin asset css file', $result);
     Configure::write('debug', 0);
     $Dispatcher->params = $Dispatcher->parseParams('test_plugin/img/cake.icon.gif');
     ob_start();
     $Dispatcher->cached('test_plugin/img/cake.icon.gif');
     $result = ob_get_clean();
     $file = file_get_contents(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS . 'test_plugin' . DS . 'vendors' . DS . 'img' . DS . 'cake.icon.gif');
     $this->assertEqual($file, $result);
     header('Content-type: text/html');
     //reset the header content-type without page can render as plain text.
 }
Example #11
0
 /**
  * Clean up after yourself
  *
  * @return void
  * @access public
  */
 public function endTest()
 {
     $Configure = Configure::getInstance();
     $Configure = $this->_Configure;
     MiCache::clear();
 }
Example #12
0
 /**
  * Get the names of the plugin controllers ...
  * 
  * This function will get an array of the plugin controller names, and
  * also makes sure the controllers are available for us to get the 
  * method names by doing an App::import for each plugin controller.
  *
  * @return array of plugin names.
  *
  */
 function _getPluginControllerNames()
 {
     App::import('Core', 'File', 'Folder');
     $paths = Configure::getInstance();
     $folder =& new Folder();
     $folder->cd(APP . 'plugins');
     // Get the list of plugins
     $Plugins = $folder->read();
     $Plugins = $Plugins[0];
     $arr = array();
     // Loop through the plugins
     foreach ($Plugins as $pluginName) {
         // Change directory to the plugin
         $didCD = $folder->cd(APP . 'plugins' . DS . $pluginName . DS . 'controllers');
         // Get a list of the files that have a file name that ends
         // with controller.php
         $files = $folder->findRecursive('.*_controller\\.php');
         // Loop through the controllers we found in the plugins directory
         foreach ($files as $fileName) {
             // Get the base file name
             $file = basename($fileName);
             // Get the controller name
             $file = Inflector::camelize(substr($file, 0, strlen($file) - strlen('_controller.php')));
             if (!preg_match('/^' . Inflector::humanize($pluginName) . 'App/', $file)) {
                 if (!App::import('Controller', $pluginName . '.' . $file)) {
                     debug('Error importing ' . $file . ' for plugin ' . $pluginName);
                 } else {
                     /// Now prepend the Plugin name ...
                     // This is required to allow us to fetch the method names.
                     $arr[] = Inflector::humanize($pluginName) . "/" . $file;
                 }
             }
         }
     }
     return $arr;
 }
Example #13
0
 function setUp()
 {
     $this->Configure =& Configure::getInstance();
 }
Example #14
0
 /**
  * Used to determine the current version of CakePHP.
  *
  * Usage `Configure::version();`
  *
  * @link http://book.cakephp.org/view/930/version
  * @return string Current version of CakePHP
  * @access public
  */
 function version()
 {
     $_this =& Configure::getInstance();
     if (!isset($_this->Cake['version'])) {
         require CORE_PATH . 'cake' . DS . 'config' . DS . 'config.php';
         $_this->write($config);
     }
     return $_this->Cake['version'];
 }
Example #15
0
define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'include');
//define('APP_PATH', ROOT . DS . APP_DIR . DS);
define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);
define('CAKE', CORE_PATH . 'cake' . DS);
//define('APP', ROOT.DS.APP_DIR.DS);
define('CONFIGS', CAKE . 'configs' . DS);
define('LIBS', CAKE . 'libs' . DS);
include CAKE . DS . 'basics.php';
include LIBS . DS . 'object.php';
include LIBS . DS . 'configure.php';
include LIBS . DS . 'inflector.php';
include LIBS . DS . 'cache.php';
include LIBS . DS . 'session.php';
include LIBS . DS . 'sanitize.php';
include CAKE . DS . 'compat.php';
$cConfigure =& Configure::getInstance(false);
// Config
Configure::write('Session.save', 'php');
Configure::write('Session.cookie', 'SSESSID');
Configure::write('Session.timeout', '120');
Configure::write('Session.start', true);
Configure::write('Session.checkAgent', true);
Configure::write('Security.level', 'high');
Configure::write('Security.salt', 'DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi');
/*
Cache::config('default', array(
  'engine' => 'File', //[required]
  'duration' => 3600, //[optional]
  'probability' => 100, //[optional]
  'path' => SE_ROOT . DS . 'cache', //[optional] use system tmp directory - remember to use absolute path
  'prefix' => 'se_', //[optional]  prefix every cache file with this string
Example #16
0
/**
 * Loads a component
 *
 * @param  string  $name Name of component
 * @return boolean Success
 */
function loadComponent($name)
{
    $paths = Configure::getInstance();
    if ($name === null) {
        return true;
    }
    if (!class_exists($name . 'Component')) {
        $name = Inflector::underscore($name);
        foreach ($paths->componentPaths as $path) {
            if (file_exists($path . $name . '.php')) {
                require $path . $name . '.php';
                return true;
            }
        }
        if ($component_fn = fileExistsInPath(LIBS . 'controller' . DS . 'components' . DS . $name . '.php')) {
            if (file_exists($component_fn)) {
                require $component_fn;
                return true;
            } else {
                return false;
            }
        }
    } else {
        return true;
    }
}
Example #17
0
 /**
  * Returns scaffold view filename of given action's template file (.ctp) as a string.
  *
  * @param string $action Controller action to find template filename for
  * @return string Template filename
  * @access private
  */
 function __getViewFileName($action)
 {
     $action = Inflector::underscore($action);
     $scaffoldAction = 'scaffold.' . $action;
     $paths = Configure::getInstance();
     if (!is_null($this->webservices)) {
         $type = strtolower($this->webservices) . DS;
     } else {
         $type = null;
     }
     if (!is_null($this->plugin)) {
         if (file_exists(APP . 'views' . DS . 'plugins' . DS . $this->plugin . DS . $this->subDir . $type . $scaffoldAction . $this->ext)) {
             return APP . 'views' . DS . 'plugins' . DS . $this->plugin . DS . $this->subDir . $type . $scaffoldAction . $this->ext;
         } elseif (file_exists(APP . 'views' . DS . 'plugins' . DS . $this->plugin . DS . $this->subDir . $type . $scaffoldAction . $this->ext)) {
             return APP . 'views' . DS . 'plugins' . DS . $this->plugin . DS . $this->subDir . $type . $scaffoldAction . $this->ext;
         } elseif (file_exists(APP . 'plugins' . DS . $this->plugin . DS . 'views' . DS . $this->viewPath . DS . $scaffoldAction . $this->ext)) {
             return APP . 'plugins' . DS . $this->plugin . DS . 'views' . DS . $this->viewPath . DS . $scaffoldAction . $this->ext;
         } elseif (file_exists(APP . 'views' . DS . 'plugins' . DS . $this->plugin . DS . $this->subDir . $type . $scaffoldAction . '.ctp')) {
             return APP . 'views' . DS . 'plugins' . DS . $this->plugin . DS . $this->subDir . $type . $scaffoldAction . '.ctp';
         } elseif (file_exists(APP . 'views' . DS . 'plugins' . DS . $this->plugin . DS . $this->subDir . $type . $scaffoldAction . '.thtml')) {
             return APP . 'views' . DS . 'plugins' . DS . $this->plugin . DS . $this->subDir . $type . $scaffoldAction . '.thtml';
         } elseif (file_exists(APP . 'views' . DS . 'plugins' . DS . 'scaffolds' . DS . $this->subDir . $type . $scaffoldAction . '.ctp')) {
             return APP . 'views' . DS . 'plugins' . DS . 'scaffolds' . DS . $this->subDir . $type . $scaffoldAction . '.ctp';
         } elseif (file_exists(APP . 'views' . DS . 'plugins' . DS . 'scaffolds' . DS . $this->subDir . $type . $scaffoldAction . '.thtml')) {
             return APP . 'views' . DS . 'plugins' . DS . 'scaffolds' . DS . $this->subDir . $type . $scaffoldAction . '.thtml';
         } elseif (file_exists(APP . 'plugins' . DS . $this->plugin . DS . 'views' . DS . $this->viewPath . DS . $scaffoldAction . '.ctp')) {
             return APP . 'plugins' . DS . $this->plugin . DS . 'views' . DS . $this->viewPath . DS . $scaffoldAction . '.ctp';
         } elseif (file_exists(APP . 'plugins' . DS . $this->plugin . DS . 'views' . DS . $this->viewPath . DS . $scaffoldAction . '.thtml')) {
             return APP . 'plugins' . DS . $this->plugin . DS . 'views' . DS . $this->viewPath . DS . $scaffoldAction . '.thtml';
         }
     }
     foreach ($paths->viewPaths as $path) {
         if (file_exists($path . $this->viewPath . DS . $this->subDir . $type . $scaffoldAction . $this->ext)) {
             return $path . $this->viewPath . DS . $this->subDir . $type . $scaffoldAction . $this->ext;
         } elseif (file_exists($path . 'scaffolds' . DS . $this->subDir . $type . $scaffoldAction . $this->ext)) {
             return $path . 'scaffolds' . DS . $this->subDir . $type . $scaffoldAction . $this->ext;
         } elseif (file_exists($path . $this->viewPath . DS . $this->subDir . $type . $scaffoldAction . '.ctp')) {
             return $path . $this->viewPath . DS . $this->subDir . $type . $scaffoldAction . '.ctp';
         } elseif (file_exists($path . $this->viewPath . DS . $this->subDir . $type . $scaffoldAction . '.thtml')) {
             return $path . $this->viewPath . DS . $this->subDir . $type . $scaffoldAction . '.thtml';
         } elseif (file_exists($path . 'scaffolds' . DS . $this->subDir . $type . $scaffoldAction . '.ctp')) {
             return $path . 'scaffolds' . DS . $this->subDir . $type . $scaffoldAction . '.ctp';
         } elseif (file_exists($path . 'scaffolds' . DS . $this->subDir . $type . $scaffoldAction . '.thtml')) {
             return $path . 'scaffolds' . DS . $this->subDir . $type . $scaffoldAction . '.thtml';
         }
     }
     if ($action === 'add') {
         $action = 'edit';
     }
     return LIBS . 'view' . DS . 'templates' . DS . 'scaffolds' . DS . $action . '.ctp';
 }
Example #18
0
 /**
  * Loads the app/config/bootstrap.php
  * If the alternative paths are set in this file
  * they will be added to the paths vars
  *
  * @access private
  */
 function __loadBootstrap()
 {
     $_this =& Configure::getInstance();
     $_this->write('Session.checkAgent', true);
     $modelPaths = null;
     $viewPaths = null;
     $controllerPaths = null;
     $helperPaths = null;
     $componentPaths = null;
     require APP_PATH . 'config' . DS . 'bootstrap.php';
     $_this->__buildModelPaths($modelPaths);
     $_this->__buildViewPaths($viewPaths);
     $_this->__buildControllerPaths($controllerPaths);
     $_this->__buildHelperPaths($helperPaths);
     $_this->__buildComponentPaths($componentPaths);
 }
Example #19
0
 */
/**
 * Configuration, directory layout and standard libraries
 */
if (!isset($bootstrap)) {
    require CORE_PATH . 'cake' . DS . 'basics.php';
    require APP_PATH . 'config' . DS . 'core.php';
    require CORE_PATH . 'cake' . DS . 'config' . DS . 'paths.php';
}
$TIME_START = getMicrotime();
require LIBS . 'object.php';
require LIBS . 'session.php';
require LIBS . 'security.php';
require LIBS . 'inflector.php';
require LIBS . 'configure.php';
$paths = Configure::getInstance();
/**
 * Enter description here...
 */
if (empty($uri) && defined('BASE_URL')) {
    $uri = setUri();
    if ($uri === '/' || $uri === '/index.php' || $uri === '/' . APP_DIR . '/') {
        $_GET['url'] = '/';
        $url = '/';
    } else {
        if (strpos($uri, 'index.php') !== false) {
            $uri = r('?', '', $uri);
            $elements = explode('/index.php', $uri);
        } else {
            $elements = explode('/?', $uri);
        }
Example #20
0
 /**
  * Used to read information stored in the Configure instance.
  *
  * Usage:
  * {{{
  * Configure::read('Name'); will return all values for Name
  * Configure::read('Name.key'); will return only the value of Configure::Name[key]
  * }}}
  *
  * @link http://book.cakephp.org/view/927/read
  * @param string $var Variable to obtain.  Use '.' to access array elements.
  * @return string value of Configure::$var
  * @access public
  */
 public static function read($var = 'debug')
 {
     $_this =& Configure::getInstance();
     if ($var === 'debug') {
         return $_this->debug;
     }
     if (strpos($var, '.') !== false) {
         $names = explode('.', $var, 3);
         $var = $names[0];
     }
     if (!isset($_this->{$var})) {
         return null;
     }
     if (!isset($names[1])) {
         return $_this->{$var};
     }
     switch (count($names)) {
         case 2:
             if (isset($_this->{$var}[$names[1]])) {
                 return $_this->{$var}[$names[1]];
             }
             break;
         case 3:
             if (isset($_this->{$var}[$names[1]][$names[2]])) {
                 return $_this->{$var}[$names[1]][$names[2]];
             }
             if (!isset($_this->{$var}[$names[1]])) {
                 return null;
             }
             return Set::classicExtract($_this->{$var}[$names[1]], $names[2]);
             break;
     }
     return null;
 }
 /**
  * Returns the plural names of ALL controllers in this application as a list
  *
  * @return array
  * @author Marko
  * @link http://debuggable.com/posts/quick-dessert-list-all-controllers-of-a-cakephp-application:480f4dd6-adf4-4b18-9fe8-4b99cbdd56cb
  **/
 function __getControllers()
 {
     $Configure =& Configure::getInstance();
     return $Configure->listObjects('controller');
 }
Example #22
0
 /**
  * Caches the object map when the instance of the Configure class is destroyed
  *
  * @access public
  */
 function __destruct()
 {
     $_this =& Configure::getInstance();
     if ($_this->__cache) {
         Cache::write('object_map', array_filter($_this->__objects), '_cake_core_');
     }
 }
Example #23
0
 /**
  * Initializes the environment and loads the Cake core.
  *
  * @return boolean Success.
  * @access private
  */
 function __bootstrap()
 {
     define('ROOT', $this->params['root']);
     define('APP_DIR', $this->params['app']);
     define('APP_PATH', ROOT . DS . APP_DIR . DS);
     define('WWW_ROOT', 'webroot');
     $includes = array(CORE_PATH . 'cake' . DS . 'basics.php', CORE_PATH . 'cake' . DS . 'config' . DS . 'paths.php', CORE_PATH . 'cake' . DS . 'libs' . DS . 'object.php', CORE_PATH . 'cake' . DS . 'libs' . DS . 'inflector.php', CORE_PATH . 'cake' . DS . 'libs' . DS . 'configure.php', CORE_PATH . 'cake' . DS . 'libs' . DS . 'cache.php');
     foreach ($includes as $inc) {
         if (!(require $inc)) {
             $this->stderr("Failed to load Cake core file {$inc}");
             return false;
         }
     }
     Configure::getInstance(file_exists(CONFIGS . 'bootstrap.php'));
     if (!file_exists(APP_PATH . 'config' . DS . 'core.php')) {
         include_once CORE_PATH . 'cake' . DS . 'console' . DS . 'libs' . DS . 'templates' . DS . 'skel' . DS . 'config' . DS . 'core.php';
     } else {
         include_once APP_PATH . 'config' . DS . 'core.php';
     }
     require CORE_PATH . 'cake' . DS . 'libs' . DS . 'class_registry.php';
     Configure::write('debug', 1);
     return true;
 }
Example #24
0
 /**
  * testStaticAssets method
  *
  * @return void
  * @access public
  */
 function testAssets()
 {
     Router::reload();
     $Configure =& Configure::getInstance();
     $Configure->__objects = null;
     App::build(array('plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS), 'vendors' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'vendors' . DS), 'views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS)));
     $Dispatcher =& new TestDispatcher();
     $debug = Configure::read('debug');
     Configure::write('debug', 0);
     ob_start();
     $Dispatcher->dispatch('theme/test_theme/../webroot/css/test_asset.css');
     $result = ob_get_clean();
     $this->assertFalse($result);
     ob_start();
     $Dispatcher->dispatch('theme/test_theme/pdfs');
     $result = ob_get_clean();
     $this->assertFalse($result);
     ob_start();
     $Dispatcher->dispatch('theme/test_theme/flash/theme_test.swf');
     $result = ob_get_clean();
     $file = file_get_contents(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS . 'themed' . DS . 'test_theme' . DS . 'webroot' . DS . 'flash' . DS . 'theme_test.swf');
     $this->assertEqual($file, $result);
     $this->assertEqual('this is just a test to load swf file from the theme.', $result);
     ob_start();
     $Dispatcher->dispatch('theme/test_theme/pdfs/theme_test.pdf');
     $result = ob_get_clean();
     $file = file_get_contents(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS . 'themed' . DS . 'test_theme' . DS . 'webroot' . DS . 'pdfs' . DS . 'theme_test.pdf');
     $this->assertEqual($file, $result);
     $this->assertEqual('this is just a test to load pdf file from the theme.', $result);
     ob_start();
     $Dispatcher->dispatch('theme/test_theme/img/test.jpg');
     $result = ob_get_clean();
     $file = file_get_contents(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS . 'themed' . DS . 'test_theme' . DS . 'webroot' . DS . 'img' . DS . 'test.jpg');
     $this->assertEqual($file, $result);
     $Dispatcher->params = $Dispatcher->parseParams('theme/test_theme/css/test_asset.css');
     ob_start();
     $Dispatcher->asset('theme/test_theme/css/test_asset.css');
     $result = ob_get_clean();
     $this->assertEqual('this is the test asset css file', $result);
     $Dispatcher->params = $Dispatcher->parseParams('theme/test_theme/js/theme.js');
     ob_start();
     $Dispatcher->asset('theme/test_theme/js/theme.js');
     $result = ob_get_clean();
     $this->assertEqual('root theme js file', $result);
     $Dispatcher->params = $Dispatcher->parseParams('theme/test_theme/js/one/theme_one.js');
     ob_start();
     $Dispatcher->asset('theme/test_theme/js/one/theme_one.js');
     $result = ob_get_clean();
     $this->assertEqual('nested theme js file', $result);
     ob_start();
     $Dispatcher->asset('test_plugin/root.js');
     $result = ob_get_clean();
     $expected = file_get_contents(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS . 'test_plugin' . DS . 'webroot' . DS . 'root.js');
     $this->assertEqual($result, $expected);
     ob_start();
     $Dispatcher->dispatch('test_plugin/flash/plugin_test.swf');
     $result = ob_get_clean();
     $file = file_get_contents(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS . 'test_plugin' . DS . 'webroot' . DS . 'flash' . DS . 'plugin_test.swf');
     $this->assertEqual($file, $result);
     $this->assertEqual('this is just a test to load swf file from the plugin.', $result);
     ob_start();
     $Dispatcher->dispatch('test_plugin/pdfs/plugin_test.pdf');
     $result = ob_get_clean();
     $file = file_get_contents(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS . 'test_plugin' . DS . 'webroot' . DS . 'pdfs' . DS . 'plugin_test.pdf');
     $this->assertEqual($file, $result);
     $this->assertEqual('this is just a test to load pdf file from the plugin.', $result);
     ob_start();
     $Dispatcher->asset('test_plugin/js/test_plugin/test.js');
     $result = ob_get_clean();
     $this->assertEqual('alert("Test App");', $result);
     $Dispatcher->params = $Dispatcher->parseParams('test_plugin/js/test_plugin/test.js');
     ob_start();
     $Dispatcher->asset('test_plugin/js/test_plugin/test.js');
     $result = ob_get_clean();
     $this->assertEqual('alert("Test App");', $result);
     $Dispatcher->params = $Dispatcher->parseParams('test_plugin/css/test_plugin_asset.css');
     ob_start();
     $Dispatcher->asset('test_plugin/css/test_plugin_asset.css');
     $result = ob_get_clean();
     $this->assertEqual('this is the test plugin asset css file', $result);
     $Dispatcher->params = $Dispatcher->parseParams('test_plugin/img/cake.icon.gif');
     ob_start();
     $Dispatcher->asset('test_plugin/img/cake.icon.gif');
     $result = ob_get_clean();
     $file = file_get_contents(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS . 'test_plugin' . DS . 'webroot' . DS . 'img' . DS . 'cake.icon.gif');
     $this->assertEqual($file, $result);
     $Dispatcher->params = $Dispatcher->parseParams('plugin_js/js/plugin_js.js');
     ob_start();
     $Dispatcher->asset('plugin_js/js/plugin_js.js');
     $result = ob_get_clean();
     $expected = "alert('win sauce');";
     $this->assertEqual($result, $expected);
     $Dispatcher->params = $Dispatcher->parseParams('plugin_js/js/one/plugin_one.js');
     ob_start();
     $Dispatcher->asset('plugin_js/js/one/plugin_one.js');
     $result = ob_get_clean();
     $expected = "alert('plugin one nested js file');";
     $this->assertEqual($result, $expected);
     Configure::write('debug', $debug);
     //reset the header content-type without page can render as plain text.
     header('Content-type: text/html');
     $Dispatcher->params = $Dispatcher->parseParams('test_plugin/css/theme_one.htc');
     ob_start();
     $Dispatcher->asset('test_plugin/css/unknown.extension');
     $result = ob_get_clean();
     $this->assertEqual('Testing a file with unknown extension to mime mapping.', $result);
     header('Content-type: text/html');
     $Dispatcher->params = $Dispatcher->parseParams('test_plugin/css/theme_one.htc');
     ob_start();
     $Dispatcher->asset('test_plugin/css/theme_one.htc');
     $result = ob_get_clean();
     $this->assertEqual('htc file', $result);
     header('Content-type: text/html');
 }
Example #25
0
 /**
  * Build path references. Merges the supplied $paths
  * with the base paths and the default core paths.
  *
  * @param array $paths paths defines in config/bootstrap.php
  * @return void
  * @access public
  */
 function buildPaths($paths)
 {
     $_this =& Configure::getInstance();
     $core = $_this->corePaths();
     $basePaths = array('model' => array(MODELS), 'behavior' => array(BEHAVIORS), 'controller' => array(CONTROLLERS), 'component' => array(COMPONENTS), 'view' => array(VIEWS), 'helper' => array(HELPERS), 'plugin' => array(APP . 'plugins' . DS), 'vendor' => array(APP . 'vendors' . DS, VENDORS), 'locale' => array(APP . 'locale' . DS), 'shell' => array(), 'datasource' => array(MODELS . 'datasources'));
     foreach ($basePaths as $type => $default) {
         $pathsVar = $type . 'Paths';
         $merge = array();
         if (isset($core[$type])) {
             $merge = $core[$type];
         }
         if ($type === 'model' || $type === 'controller' || $type === 'helper') {
             $merge = array_merge(array(APP), $merge);
         }
         if (!is_array($default)) {
             $default = array($default);
         }
         $_this->{$pathsVar} = $default;
         if (isset($paths[$pathsVar]) && !empty($paths[$pathsVar])) {
             $path = array_flip(array_flip(array_merge($_this->{$pathsVar}, (array) $paths[$pathsVar], $merge)));
             $_this->{$pathsVar} = array_values($path);
         } else {
             $path = array_flip(array_flip(array_merge($_this->{$pathsVar}, $merge)));
             $_this->{$pathsVar} = array_values($path);
         }
     }
 }
Example #26
0
 /**
  * Get the names of the plugin controllers ...
  *
  * This function will get an array of the plugin controller names, and
  * also makes sure the controllers are available for us to get the
  * method names by doing an App::import for each plugin controller.
  *
  * @return array of plugin names.
  *
  */
 function _get_plugin_controller_names()
 {
     App::import('Core', 'File', 'Folder');
     $paths = Configure::getInstance();
     $folder =& new Folder();
     // Change directory to the plugins
     $folder->cd(APP . 'plugins');
     // Get a list of the files that have a file name that ends
     // with controller.php
     $files = $folder->findRecursive('.*_controller\\.php');
     // Get the list of plugins
     $Plugins = Configure::listObjects('plugin');
     // Loop through the controllers we found int the plugins directory
     foreach ($files as $f => $fileName) {
         // Get the base file name
         $file = basename($fileName);
         // Get the controller name
         $file = Inflector::camelize(substr($file, 0, strlen($file) - strlen('_controller.php')));
         // Loop through the plugins
         foreach ($Plugins as $pluginName) {
             if (preg_match('/^' . $pluginName . '/', $file)) {
                 // First get rid of the App controller for the plugin
                 // We do this because the app controller is never called
                 // directly ...
                 if (preg_match('/^' . $pluginName . 'App/', $file)) {
                     unset($files[$f]);
                 } else {
                     if (!App::import('Controller', $pluginName . '.' . $file)) {
                         debug('Error importing ' . $file . ' for plugin ' . $pluginName);
                     }
                     /// Now prepend the Plugin name ...
                     // This is required to allow us to fetch the method names.
                     $files[$f] = $file;
                 }
                 break;
             }
         }
     }
     return $files;
 }
Example #27
0
 /**
  * Initializes the environment and loads the Cake core.
  *
  * @return boolean Success.
  * @access private
  */
 function __bootstrap()
 {
     define('ROOT', $this->params['root']);
     define('APP_DIR', $this->params['app']);
     define('APP_PATH', $this->params['working'] . DS);
     define('WWW_ROOT', APP_PATH . $this->params['webroot'] . DS);
     if (!is_dir(ROOT . DS . APP_DIR . DS . 'tmp')) {
         define('TMP', CORE_PATH . 'cake' . DS . 'console' . DS . 'templates' . DS . 'skel' . DS . 'tmp' . DS);
     }
     $includes = array(CORE_PATH . 'cake' . DS . 'config' . DS . 'paths.php', CORE_PATH . 'cake' . DS . 'libs' . DS . 'object.php', CORE_PATH . 'cake' . DS . 'libs' . DS . 'inflector.php', CORE_PATH . 'cake' . DS . 'libs' . DS . 'configure.php', CORE_PATH . 'cake' . DS . 'libs' . DS . 'file.php', CORE_PATH . 'cake' . DS . 'libs' . DS . 'cache.php', CORE_PATH . 'cake' . DS . 'libs' . DS . 'string.php', CORE_PATH . 'cake' . DS . 'libs' . DS . 'class_registry.php', CORE_PATH . 'cake' . DS . 'console' . DS . 'error.php');
     foreach ($includes as $inc) {
         if (!(require $inc)) {
             $this->stderr("Failed to load Cake core file {$inc}");
             return false;
         }
     }
     Configure::getInstance(file_exists(CONFIGS . 'bootstrap.php'));
     if (!file_exists(APP_PATH . 'config' . DS . 'core.php')) {
         include_once CORE_PATH . 'cake' . DS . 'console' . DS . 'templates' . DS . 'skel' . DS . 'config' . DS . 'core.php';
         App::build();
     }
     return true;
 }
Example #28
0
File: view.php Project: venka10/RUS
 /**
  * Returns layout filename for this template as a string.
  *
  * @return string Filename for layout file (.thtml).
  * @access protected
  */
 function _getLayoutFileName()
 {
     if (isset($this->webservices) && !is_null($this->webservices)) {
         $type = strtolower($this->webservices) . DS;
     } else {
         $type = null;
     }
     $paths = Configure::getInstance();
     $viewPaths = am($this->pluginPaths, $paths->viewPaths);
     $name = $this->subDir . $type . $this->layout;
     foreach ($viewPaths as $path) {
         if (file_exists($path . 'layouts' . DS . $name . $this->ext)) {
             return $path . 'layouts' . DS . $name . $this->ext;
         } elseif (file_exists($path . 'layouts' . DS . $name . '.ctp')) {
             return $path . 'layouts' . DS . $name . '.ctp';
         }
     }
     if (!is_null($this->pluginPath)) {
         $layoutFileName = APP . $this->pluginPath . 'views' . DS . 'layouts' . DS . $name . $this->ext;
     } else {
         $layoutFileName = VIEWS . 'layouts' . DS . $name . $this->ext;
     }
     $layoutFileName = fileExistsInPath(LIBS . 'view' . DS . 'templates' . DS . 'layouts' . DS . $type . $this->layout . '.thtml');
     if (empty($layoutFileName) && !empty($type)) {
         $layoutFileName = fileExistsInPath(LIBS . 'view' . DS . 'templates' . DS . 'layouts' . DS . $type . 'default.thtml');
     }
     return $layoutFileName;
 }
Example #29
0
 * @since         CakePHP(tm) v 0.2.9
 * @version       $Revision$
 * @modifiedby    $LastChangedBy$
 * @lastmodified  $Date$
 * @license       http://www.opensource.org/licenses/mit-license.php The MIT License
 */
if (!defined('PHP5')) {
    define('PHP5', PHP_VERSION >= 5);
}
if (!defined('E_DEPRECATED')) {
    define('E_DEPRECATED', 8192);
}
if (!defined('E_STRICT')) {
    define('E_STRICT', 2048);
}
error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT);
/**
 * Configuration, directory layout and standard libraries
 */
if (!isset($bootstrap)) {
    require CORE_PATH . 'cake' . DS . 'basics.php';
    $TIME_START = getMicrotime();
    require CORE_PATH . 'cake' . DS . 'config' . DS . 'paths.php';
    require LIBS . 'object.php';
    require LIBS . 'inflector.php';
    require LIBS . 'configure.php';
}
require LIBS . 'cache.php';
Configure::getInstance();
$url = null;
require CAKE . 'dispatcher.php';
Example #30
0
S2Paths::set($s2_app, 'S2_VIEWS_OVERRIDES', S2Paths::get($s2_app, 'S2_APP_OVERRIDES') . 'views' . DS);
S2Paths::set($s2_app, 'S2_HELPERS_OVERRIDES', S2Paths::get($s2_app, 'S2_VIEWS_OVERRIDES') . 'helpers' . DS);
S2Paths::set($s2_app, 'S2_THEMES_OVERRIDES', S2Paths::get($s2_app, 'S2_VIEWS_OVERRIDES') . 'themes' . DS);
S2Paths::set($s2_app, 'S2_JS_OVERRIDES', S2Paths::get($s2_app, 'S2_VIEWS_OVERRIDES') . 'js' . DS);
S2Paths::set($s2_app, 'S2_VIEWS_URL_OVERRIDES', S2Paths::get($s2_app, 'S2_APP_URL_OVERRIDES') . 'views' . _DS);
S2Paths::set($s2_app, 'S2_THEMES_URL_OVERRIDES', S2Paths::get($s2_app, 'S2_VIEWS_URL_OVERRIDES') . 'themes' . _DS);
S2Paths::set($s2_app, 'S2_IMAGES_URL_OVERRIDES', S2Paths::get($s2_app, 'S2_VIEWS_URL_OVERRIDES') . 'images' . _DS);
S2Paths::set($s2_app, 'S2_CSS_URL_OVERRIDES', S2Paths::get($s2_app, 'S2_VIEWS_URL_OVERRIDES') . 'css' . _DS);
S2Paths::set($s2_app, 'S2_JS_URL_OVERRIDES', S2Paths::get($s2_app, 'S2_VIEWS_URL_OVERRIDES') . 'js' . _DS);
S2Paths::set($s2_app, 'S2_ADMIN_VIEWS_OVERRIDES', S2Paths::get($s2_app, 'S2_APP_OVERRIDES') . 'views' . DS . 'admin' . DS);
S2Paths::set($s2_app, 'S2_ADMIN_HELPERS_OVERRIDES', S2Paths::get($s2_app, 'S2_ADMIN_VIEWS_OVERRIDES') . 'helpers' . DS);
S2Paths::set($s2_app, 'S2_ADMIN_VIEWS_URL_OVERRIDES', S2Paths::get($s2_app, 'S2_VIEWS_URL_OVERRIDES') . 'admin' . _DS);
S2Paths::set($s2_app, 'S2_CSS_ADMIN_URL_OVERRIDES', S2Paths::get($s2_app, 'S2_ADMIN_VIEWS_URL_OVERRIDES') . 'css' . _DS);
S2Paths::set($s2_app, 'S2_JS_ADMIN_URL_OVERRIDES', S2Paths::get($s2_app, 'S2_ADMIN_VIEWS_URL_OVERRIDES') . 'js' . _DS);
// Create the file registry
$Configure =& Configure::getInstance($s2_app);
$s2App =& App::getInstance($s2_app);
require_once dirname(__FILE__) . DS . 'config' . DS . 'core.php';
# Set app variable in I18n class
$import = App::import('Lib', 'I18n');
if (!$import) {
    $clear = clearCache('', 'core');
    if (!$clear) {
        echo 'You need to delete the file registry in /components/com_s2framework/tmp/cache/core/';
        exit;
    }
    $page = $_SERVER['PHP_SELF'];
    header("Location: index.php?option=com_jreviews");
    exit;
}
$Translate =& I18n::getInstance();