Example #1
0
 public static function load()
 {
     $agrs = func_get_args();
     for ($i = 0, $n = count($agrs); $i < $n; $i++) {
         include_dir($agrs[$i]);
     }
 }
Example #2
0
 public static function once($path, $read = false)
 {
     //separador de directorios
     $s = '/';
     //vemos si es la primera vez que usamos la funcion
     if (!$read) {
         //obtenemos los dos ultimos caracteres
         $tree = substr($path, -2);
         if ($tree == '.*') {
             //eliminamos el asterisco y activamos la recursividad
             $path = preg_replace('!\\.\\*$!', '', $path);
             $read = true;
         }
         //obtenemos el document_root del archivo en caso de usarse
         $path = preg_replace('!^root\\.!', $_SERVER['DOCUMENT_ROOT'] . $s, $path);
         //cambiamos el punto por el separador
         $path = str_replace('.', $s, $path);
     }
     //abrimos el directorio
     if ($handle = opendir($path)) {
         while (false !== ($file = readdir($handle))) {
             if ($file != "." && $file != "..") {
                 //si es un directorio lo recorremos en caso de activar la recursividad
                 if (is_dir($path . $s . $file) and $read) {
                     include_dir($path . $s . $file, true);
                 } else {
                     $ext = substr(strtolower($file), -3);
                     if ($ext == 'php') {
                         if ($file != "Required") {
                             include_once $path . $s . $file;
                         }
                     }
                 }
             }
         }
         //cerramos el directorio
         closedir($handle);
     }
 }
Example #3
0
 function execute(&$action, &$request, $do_overwrite = FALSE)
 {
     $cache = array();
     /**
      * Fileserver caching
      */
     if (!CACHE_IN_DB && USE_CACHE) {
         /* Include the cache file */
         include_dir(CACHE_DIR);
         //			if(!isset($cache) || !is_array($cache) || empty($cache)) {
         //				trigger_error('FILE: The cache array does not exist or it is empty.', E_USER_ERROR);
         //			}
     }
     /**
      * Database caching
      */
     if (CACHE_IN_DB && USE_CACHE) {
         $result = $request['dba']->executeQuery("SELECT * FROM " . K4CACHE);
         if (!$result->hasNext()) {
             trigger_error('DB: The cache array does not exist or it is empty.', E_USER_ERROR);
         }
         while ($result->next()) {
             $temp = $result->current();
             $cache[$temp['varname']] = force_unserialize($temp['data']);
             unset($temp);
             // memory saving
         }
         /* Set the Global variables */
         $GLOBALS['_SETTINGS'] =& $cache['settings'];
         $GLOBALS['_MAPS'] =& $cache['maps'];
         $GLOBALS['_USERGROUPS'] =& $cache['usergroups'];
         $GLOBALS['_ACRONYMS'] =& $cache['acronyms'];
         $GLOBALS['_CENSORS'] =& $cache['censors'];
         $GLOBALS['_SPIDERS'] =& $cache['spiders'];
         $GLOBALS['_SPIDERAGENTS'] =& $cache['spider_agents'];
         $GLOBALS['_PROFILEFIELDS'] =& $cache['profile_fields'];
         $GLOBALS['_ALLFORUMS'] =& $cache['all_forums'];
         $GLOBALS['_FLAGGEDUSERS'] =& $cache['flagged_users'];
         $GLOBALS['_BANNEDUSERIDS'] =& $cache['banned_user_ids'];
         $GLOBALS['_BANNEDUSERIPS'] =& $cache['banned_user_ips'];
         $GLOBALS['_STYLESETS'] =& $cache['styles'];
         $GLOBALS['_FAQCATEGORIES'] =& $cache['faq_categories'];
         $GLOBALS['_MAILQUEUE'] = isset($cache['mail_queue']) ? $cache['mail_queue'] : array();
         $GLOBALS['_DATASTORE'] = isset($cache['datastore']) ? $cache['datastore'] : array();
         $GLOBALS['_USERTITLES'] =& $cache['user_titles'];
         $GLOBALS['_FILTERS'] =& $cache['filters'];
         $GLOBALS['_FORUMFILTERS'] =& $cache['forum_filters'];
     }
     /**
      * Make sure the cache files exist
      */
     if (!CACHE_IN_DB && USE_CACHE) {
         if (!isset($GLOBALS['_SETTINGS']) || !isset($GLOBALS['_MAPS']) || !isset($GLOBALS['_ALLFORUMS'])) {
             /* Create the cache file using the class functions */
             $methods = get_class_methods($this);
             foreach ($methods as $function) {
                 if (substr($function, 0, 6) == 'cache_') {
                     $this->{$function}($cache, $request);
                 }
             }
             /* Create the cache file */
             DBCache::createCache($cache);
         }
     }
     /* Add the extra values onto the end of the userinfo query params variable */
     global $_QUERYPARAMS;
     if (is_array($GLOBALS['_PROFILEFIELDS']) && !empty($GLOBALS['_PROFILEFIELDS'])) {
         foreach ($GLOBALS['_PROFILEFIELDS'] as $temp) {
             $_QUERYPARAMS['userinfo'] .= ', ui.' . $temp['name'] . ' AS ' . $temp['name'];
         }
     }
     $GLOBALS['_QUERYPARAMS'] = $_QUERYPARAMS;
     /* Execute the queue after we get/check the cached file(s) */
     //execute_mail_queue($request['dba'], $cache['mail_queue']);
     /* Add all of the forums to the template */
     global $_ALLFORUMS;
     $all_forums = new AllForumsIterator($_ALLFORUMS);
     $request['template']->setList('all_forums', $all_forums);
     return FALSE;
 }
Example #4
0
<?php

session_start();
define('DOCROOT', getcwd() . DIRECTORY_SEPARATOR);
require 'system/HappyPuppy.php';
require 'settings/routes.php';
require 'settings/database.php';
include_dir('views/helpers/*.php');
run();
Example #5
0
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
define('__DEBUG__', true);
include_dir(DOCROOT . '/controllers/*.php');
function include_dir($pattern)
{
    ob_start();
    foreach (glob($pattern) as $file) {
        include_once $file;
    }
    ob_end_clean();
}
function Run()
{
    try {
        HappyPuppy::getInstance()->dispatch();
    } catch (Exception $e) {
        if (__DEBUG__ == true) {
            echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
Example #6
0
include_once "../../classes/class.database.php";
include_once "../../functions/func.common.php";
/* CONECTION STARTS */
switch ($_SERVER["HTTP_HOST"]) {
    case "localhost":
        $DB = new DataBase();
        break;
    default:
        $DB = new DataBase();
        break;
}
/* REDIRECTS IF THERE WAS AN ERROR */
if (!$DB->Connect()) {
    header("Location: ../../includes/inc.error.php?error=" . $DB->Error);
}
include_dir("../../classes");
session_name("admin");
session_cache_expire(15800);
session_start();
/* SECURIRTY CHECKS */
$Security = new Security();
if ($Security->checkProfile($_SESSION['admin_id'])) {
    $Admin = new AdminData();
    $Cookies = new Login($Admin->User);
    $Cookies->setCookies();
    // $URL 	= 'http://localhost/projects/admin/files/modules/main/process.php';
    // $Meli 		= new Meli('4853777712698373', 'zhBim3Li6QKCTUht49YLnhpbT66CQwGm', $_SESSION['access_token'], $_SESSION['refresh_token']);
    // if(!$_SESSION['code'] && !$_SESSION['access_token']) {
    // 	// Redirects to ML if APP don't have access
    // 	header("Location: ".$Meli->getAuthUrl($URL, Meli::$AUTH_URL['MLA']));
    // 	die();
Example #7
0
$GLOBALS['defaults']['request_methods'] = array('GET', 'POST', 'PUT', 'DELETE');
// Function for including entire directories of files
function include_dir($path)
{
    if (!is_dir($path)) {
        trigger_error("Can not find required directory: {$path}", E_USER_ERROR);
    }
    $dir = dir($path);
    while (($file = $dir->read()) !== false) {
        if (is_file($path . '/' . $file) and preg_match('/^(.+)\\.php$/i', $file)) {
            require_once $path . '/' . $file;
        }
    }
    $dir->close();
}
// Include Phooey core files
include_dir(SYSTEM_INC_DIR);
// Include Site-specific files
include_dir(SITE_DIR . 'lib/');
// Load the database connection file
if (file_exists(GLOBAL_CONFIG_DIR . 'db.yaml')) {
    $db_config = Spyc::YAMLLoad(GLOBAL_CONFIG_DIR . 'db.yaml');
    // Connect to a database if config is set
    if (!empty($db_config)) {
        $db = @mysql_connect($db_config['hostname'], $db_config['username'], $db_config['password']);
        @mysql_select_db($db_config['database'], $db);
    }
}
$request = new Request();
$site = new Site(SITE_DIR, '/');
$site->serve($request);
Example #8
0
 public static function init($dir = '')
 {
     $dir = $dir ? APPPATH . $dir . '/' : APPPATH . 'language/';
     include_dir($dir . self::getLang());
 }
Example #9
0
<?php

require_once "constants.php";
//The order is important, so don't change please :);
require_once _SSORM_ROOT . "config/db_config.php";
//require_once _SSORM_ROOT."includes/commonfiles.php";
require_once _SSORM_ROOT . "includes/global_functions.php";
require_once _SSORM_ROOT . "includes/ssorm.php";
//includes all the models
include_dir(_SSORM_ROOT . "models/");
require_once _SSORM_ROOT . "includes/underControl.php";
//INCLUDE related functions
//includes all the files from a directory
function include_dir($dir)
{
    if (($dh = opendir($dir)) !== false) {
        while (($entry = readdir($dh)) !== false) {
            if ($entry != "." && $entry != "..") {
                if (is_file($dir . $entry)) {
                    require_once $dir . $entry;
                }
            }
        }
    } else {
        echo "BAD DIRECTORY";
    }
}
Example #10
0
define('PATH_TO_CORE', 'core/');
define('PATH_TO_SCHEMA_CACHE', 'core/db/logs/schema-cache.txt');
define('PATH_TO_LOG', 'core/log.txt');
define('PATH_TO_HELPERS', 'helpers/');
define('PATH_TO_LIB', 'lib/');
include 'core/utils.php';
// get core
include_dir(PATH_TO_CORE);
// for timer, etc
do_hooks('absolute_beginning');
// get helpers, lib
include_dir(PATH_TO_HELPERS);
include_dir(PATH_TO_LIB);
// get config
include PATH_TO_CONFIG;
// log the request
if ($config['keep_log']) {
    write_to_log("\n" . $_SERVER['REQUEST_METHOD'] . ' ' . $_SERVER['REQUEST_URI'] . "\n");
}
// set error reporting (defined in config)
if ($config['error_reporting']) {
    error_reporting($config['error_reporting']);
}
// connect to database
if (!empty($config['database'])) {
    $db = new Database($config['database']);
}
// load application
include_dir(PATH_TO_MODELS);
include_dir(PATH_TO_APP_HELPERS);