View of /branches/mambo5/app/config/bootstrap.php
Parent Directory
|
Revision Log
Revision 2 -
(download)
(annotate)
Fri Dec 3 04:30:31 2010 UTC (2 years, 5 months ago) by enjoyman
File size: 5132 byte(s)
Fri Dec 3 04:30:31 2010 UTC (2 years, 5 months ago) by enjoyman
File size: 5132 byte(s)
first commit mambo5 with cakephp1.3.6.
<?php /** * This file is loaded automatically by the app/webroot/index.php file after the core bootstrap.php * * This is an application wide file to load any function that is not used within a class * define. You can also use this to include or require any files in your application. * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org) * * Licensed under The MIT License * Redistributions of files must retain the above copyright notice. * * @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org) * @link http://cakephp.org CakePHP(tm) Project * @package cake * @subpackage cake.app.config * @since CakePHP(tm) v 0.10.8.2117 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ /** * The settings below can be used to set additional paths to models, views and controllers. * This is related to Ticket #470 (https://trac.cakephp.org/ticket/470) * * App::build(array( * 'plugins' => array('/full/path/to/plugins/', '/next/full/path/to/plugins/'), * 'models' => array('/full/path/to/models/', '/next/full/path/to/models/'), * 'views' => array('/full/path/to/views/', '/next/full/path/to/views/'), * 'controllers' => array('/full/path/to/controllers/', '/next/full/path/to/controllers/'), * 'datasources' => array('/full/path/to/datasources/', '/next/full/path/to/datasources/'), * 'behaviors' => array('/full/path/to/behaviors/', '/next/full/path/to/behaviors/'), * 'components' => array('/full/path/to/components/', '/next/full/path/to/components/'), * 'helpers' => array('/full/path/to/helpers/', '/next/full/path/to/helpers/'), * 'vendors' => array('/full/path/to/vendors/', '/next/full/path/to/vendors/'), * 'shells' => array('/full/path/to/shells/', '/next/full/path/to/shells/'), * 'locales' => array('/full/path/to/locale/', '/next/full/path/to/locale/') * )); * */ /** * As of 1.3, additional rules for the inflector are added below * * Inflector::rules('singular', array('rules' => array(), 'irregular' => array(), 'uninflected' => array())); * Inflector::rules('plural', array('rules' => array(), 'irregular' => array(), 'uninflected' => array())); * */ if (file_exists(CONFIGS.DS.'configuration.xml')) { $config = Configure::getInstance(); //Interpret the configuration XML file into an object if (!$mXML = simplexml_load_file(CONFIGS.DS.'configuration.xml')) { echo "Couldn't parse the XML file: ". CONFIGS.DS.'configuration.xml'; exit; } else { foreach ($mXML->option as $option) { $optionName = $option->name; $optionSetting = $option->setting; $config->$optionName = $optionSetting; } } } function mosMakePassword($length) { $salt = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; $len = strlen($salt); $makepass=""; mt_srand(10000000*(double)microtime()); for ($i = 0; $i < $length; $i++) $makepass .= $salt[mt_rand(0,$len - 1)]; return $makepass; } /** * Chmods files and directories recursivel to given permissions * @param path The starting file or directory (no trailing slash) * @param filemode Integer value to chmod files. NULL = dont chmod files. * @param dirmode Integer value to chmod directories. NULL = dont chmod directories. * @return TRUE=all succeeded FALSE=one or more chmods failed */ function mosChmodRecursive($path, $filemode=NULL, $dirmode=NULL) { $ret = TRUE; if (is_dir($path)) { $dh = opendir($path); while ($file = readdir($dh)) { if ($file != '.' && $file != '..') { $fullpath = $path.'/'.$file; if (is_dir($fullpath)) { if (!mosChmodRecursive($fullpath, $filemode, $dirmode)) $ret = FALSE; } else { if (isset($filemode)) if (!@chmod($fullpath, $filemode)) $ret = FALSE; } // if } // if } // while closedir($dh); if (isset($dirmode)) if (!@chmod($path, $dirmode)) $ret = FALSE; } else { if (isset($filemode)) $ret = @chmod($path, $filemode); } // if return $ret; } // mosChmodRecursive function get_php_setting($val) { $r = (ini_get($val) == '1' ? 1 : 0); return $r ? 'ON' : 'OFF'; } function writableCell($folder) { echo "<tr>"; //echo "<td class=\"item\">" . $folder . "/</td>"; echo "<td class=\"item\">" . $folder . "</td>"; echo "<td align=\"left\">"; echo is_writable( "../$folder" ) ? '<b><span class="green">Writeable</span></b>' : '<b><span class="red">Unwriteable</span></b>' . "</td>"; echo "</tr>"; } function validEmail($email) { /* In the past we validated different ways throughout the code. Here is another method we used for reference: (preg_match("/[\w\.\-]+@\w+[\w\.\-]*?\.\w{1,4}/", $email )==false) */ if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) { return false; } else { return true; } }
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |

