function loadComponent($filename, $fullPath) { if (is_file($fullPath)) { #packageComponents $filenameParts = explode('.', $filename); $numParts = count($filenameParts); $lastPos = $numParts > 1 ? $numParts - 1 : 0; switch ($filenameParts[$lastPos]) { case 'md': #$this->core->debug(0, "loadPackage: $filename Documentation should be in it's packages /doc folder."); break; case 'php': case 'module': #$this->core->debug(0, "loadPackage: $filename Module. ($fullPath)"); loadModules($this->core, $fullPath, false); break; case 'macro': #$this->core->debug(0, "loadPackage: $filename Macro."); $this->core->addItemsToAnArray('Core', 'macrosToLoad', array($filename => $fullPath)); break; case 'template': #$this->core->debug(0, "loadPackage: $filename Template."); $this->core->addItemsToAnArray('Core', 'templatesToLoad', array($filename => $fullPath)); break; } # $this->core->debug(packageVerbosity, "loadEnabledPackages: File $filename"); } else { $this->core->debug(packageVerbosity, "loadEnabledPackages: Not doing anything with directories yet {$filename}"); } }
public function checkReady() { //for every module $modules = loadModules("*"); foreach ($modules as $module) { if (method_exists($module, "isReady")) { if ($module->isReady() != 1) { debug('System not ready, fail at ' . get_class($module)); return false; } } } return true; }
/** * function to manage the loading of modules * @param: $path - path to the modules, on first run, this is not supplied * so the default is taken $modules_path * @param: $count - number of times the function has recalled itself */ function loadModules($path,$count) { //load globals global $modules_path; //path to the file $filePath=0; $filePath=($path?$path:$modules_path); //increment counter $count+=1; //loop only if if($handle=opendir($filePath)) { //loop through directory while(false!==($file=readdir($handle))) { if($file!="." && $file!="..") { //if count<2, proceed at will if($count<2) { if(isDir($filePath,$file)) { //loop through directory loadModules($filePath."$file/",$count); } else { //include module file include_once $filePath."$file"; } } else { //only inlcude what's inside directory classes if(isDir($filePath,$file) && $file=="classes") { //loop through directory only if it's called classes loadModules($filePath."$file/",$count); } else if(!isDir($filePath,$file)){ //include module file include_once $filePath."$file"; } } } } closedir($handle); } }
<?php pushKeywords('web', 'tool', 'easy', 'simple'); loadModules('strings.php'); setTitle('Tools for the Compuationally Impaired');
function dispatchEventToModules($event_type, &$data) { $modules = loadModules("*"); foreach ($modules as $module) { if (method_exists($module, $event_type)) { call_user_func_array(array($module, $event_type), array(&$data)); } } }
<?php $options = array('ascii' => 'ASCII', 'hex' => 'Hexadecimal', 'dec' => 'Decimal', 'bin' => 'Binary'); loadSyrups('tools.php'); loadModules('stringconvert.php'); pushStyles('stringconvert.css'); pushKeywords('ascii', 'hexadecimal', 'binary', 'decimal', 'converter'); $from = 'ascii'; $to = 'hex'; if (!isempty($_POST['from'])) { if (array_key_exists($_POST['from'], $options)) { $from = $_POST['from']; } } if (!isempty($_POST['to'])) { if (array_key_exists($_POST['to'], $options)) { $to = $_POST['to']; } } $input = null; $output = null; if (!isempty($_POST['input'])) { $input = $_POST['input']; $output = sc_convert($input, $from, $to); } setTitle('String Converter::' . $SP_TITLE); include ROOT . '/header.php'; ?> <h1>String Converter</h1> <h2><?php echo $options[$from] . ' to ' . $options[$to];
# @license http://www.gnu.org/licenses/gpl-3.0.txt GPL header('Content-type: text/html; charset=utf-8'); if (!isset($_GET['debug'])) { error_reporting(0); } ob_start(); define('VERSION', '2.3'); define('VERSION_DATE', '2012-02-24'); define("BASE_PATH", dirname($_SERVER["SCRIPT_FILENAME"]) . "/"); define("BASE_URL", str_replace(basename(__FILE__), "", $_SERVER['SCRIPT_URI'])); define("SYSTEM", BASE_PATH . "system/"); define("SYSTEM_URL", BASE_URL . "system/"); $mini = $_GET['mini'] == true ? true : false; define("MINI", $mini); require_once SYSTEM . "assistants/launch.php"; loadModules(); loadPlugins(); $manager->office->generateMenu(); call_anchor($manager->office->cubicle("BRANCH")); call_anchor($manager->office->cubicle("REQUEST")); call_anchor("start"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title><?php $manager->office->pageTitle(); ?> </title> <?php
<?php $MODULES = loadModules(); ?> <!DOCTYPE html> <html> <head> <meta charset='utf-8'/> <title><?php echo $APPNAME; ?> </title> <link rel="icon" type="image/png" href="./skin/icon.png" /> <link rel='stylesheet' type='text/css' href='./skin/home.css'/> <?php echo $MODULES['styles']; ?> </head> <body> <div id='LOADING_OVERLAY'></div> <section id='desktop'></section> <nav id='taskbar'> <div id='OpenDoor'></div> <div id='trail-list'></div> </nav> <iframe id='IFRAME' style="display:none;"></iframe>
function handler() { global $ARI_VERSION; // version $ari_version = $ARI_VERSION; // check error $error = $_SESSION['ari_error']; // load modules loadModules(); // login to database $success = databaseLogon(); if ($success) { // check if login is needed $content = loginBlock(); if (!isset($content)) { list($nav_menu, $subnav_menu, $content) = handleBlock(); } } else { $display = new Display(); $content .= $display->displayHeaderText("ARI"); $content .= $display->displayLine(); $content .= checkErrorMessage(); } // log off any databases needed databaseLogoff(); // check for ajax request and refresh or if not build the page if (isset($_REQUEST['ajax_refresh'])) { echo "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>\n <response>\n <nav_menu><![CDATA[" . $nav_menu . "]]></nav_menu>\n <subnav_menu><![CDATA[" . $subnav_menu . "]]></subnav_menu>\n <content><![CDATA[" . $content . "]]></content>\n </response>"; } else { // build the page include_once "./theme/page.tpl.php"; } }
//session management session_start(); //session_register("TRAILANALYTICSISSUES"); //database requirements include_once("conf.db.php"); //default variables include_once("conf.variables.php"); //htaccess variables include_once("conf.variables.htaccess.php"); //default functions include_once("conf.functions.php"); //load all vl modules loadModules("",0); //mailer object $mail = new mailer(); //vlDC object $vlDC = new vlDC(); //$vlDC->debugOn(); $vlDC->sRequestURI=$home_url; // ExcelFile($filename, $encoding); $excelData = new Spreadsheet_Excel_Reader(); // Set output Encoding. $excelData->setOutputEncoding('CP1251'); /*** * if you want you can change 'iconv' to mb_convert_encoding: * $data->setUTFEncoder('mb');
<?php # Copyright (c) 2012, Kevin Sandom under the BSD License. See LICENSE for full details. define('programName', 'mass'); $description = "A commandline tool/API for doing awesome stuff on many nodes of a cluster."; $profile = 'commandLine'; define('configDir', '~%configDir%~'); define('storageDir', '~%storageDir%~'); include "{$configDir}/core.php"; # initiate core $core = core::assert(); $core->set('General', 'EOL', '<BR>'); $core->set('General', 'configDir', configDir); $core->set('General', 'storageDir', storageDir); $core->set('General', 'profile', $profile); $core->set('General', 'hostsDir', storageDir . '/data/1LayerHosts'); $core->set('General', 'programName', programName); $core->set('General', 'description', $description); include configDir . '/interfaces/basicWeb.php'; $core->setRef('BasicWeb', 'arguments', $_REQUEST); loadModules($core, "{$configDir}/profiles/{$profile}/modules"); $core->callFeature("registerForEvent", "Mass,finishLate,outNow"); $core->go();
<?php use Zend\Mvc\Service\ServiceManagerConfig; use Zend\ServiceManager\ServiceManager; date_default_timezone_set('UTC'); mb_internal_encoding('utf-8'); error_reporting(E_ALL ^ E_NOTICE); const APP_ENV = 'dev'; /** * This makes our life easier when dealing with paths. Everything is relative * to the application root now. */ chdir(dirname(__DIR__)); /** Initialize the autoloader */ require 'init_autoloader.php'; $appConfig = (include 'config/application.config.php'); $configLocal = (include __DIR__ . '/config.php'); // use ModuleManager to load this module and it's dependencies $config = array('modules' => array('DoctrineModule', 'DoctrineORMModule', 'Libra', 'LibraModuleManager', 'LibraApp', 'LibraArticle', 'LibraNavigation', 'LibraLocale', 'LibraMarkdown', 'LibraArticleImageZooming', 'ZfcBase', 'ZfcUser', 'ZfcUserDoctrineORM', 'ZfcTwig', 'Application'), 'module_listener_options' => array('config_glob_paths' => array('config/constructed/navigation.php'), 'module_paths' => array('module', 'vendor')), 'service_manager' => array('use_defaults' => true, 'factories' => array('Navigation' => 'Zend\\Navigation\\Service\\DefaultNavigationFactory', 'AdminNavigation' => 'LibraApp\\Service\\AdminNavigationFactory'))); function loadModules($config) { $smConfig = isset($config['service_manager']) ? $config['service_manager'] : array(); $serviceManager = new ServiceManager(new ServiceManagerConfig($smConfig)); $serviceManager->setService('ApplicationConfig', $config); $serviceManager->get('ModuleManager')->loadModules(); //$serviceManager->get('Application')->bootstrap(); } loadModules($config);
<body> <div class="container"> <h1>LiteFileServer installer</h1> <?php } //cli if (!file_exists(__DIR__ . "/include/config.php")) { showMessage("Cannot find <strong>include/config.php</strong> file, please remember to create a copy of <strong>config.sample.php</strong> as <strong>config.php </strong> and edit it with your DB values."); die($end_string); } else { showMessage("config.php found, testing database connection", "success"); } //include core require_once 'include/core.php'; loadModules("*"); //check config has valid values if (ADMIN_PASS == "" || ADMIN_MAIL == "") { showMessage("Error: Config.php must be changed, edit the config.php and add a password and an email for the admin account."); die($end_string); } //check if config works $database = getSQLDB(); if (!$database) { showMessage("Cannot connect to database, check that the info inside config.php is correct and your databse running."); die($end_string); } else { showMessage("Database connection established", "success"); } //check if there is data still $system = getModule("system");