/** * Index - Lista Resultados * * @param array $arrDataFromForm * @return boolean */ public function createController(array $arrDataFromForm = array()) { $dirHelper = new DirHelper($arrDataFromForm); $maskHelper = new MaskHelper($dirHelper); $templateController = file_get_contents($this->strTemplateControllerDir . 'SkeletonController.php'); $templateController = $maskHelper->searchAndReplaceAllMasks($templateController); file_put_contents($dirHelper->getStrDirPathController() . '/' . $dirHelper->getStrControllerName() . '.php', $templateController); return true; }
/** * get all controller as key ,actions as value */ protected function _get_modules($dir) { unset($actions); $p = $dir; $lists = DirHelper::listFile($p, 'Controller.php'); $dirs = $lists['dir']; if (!$dirs) { return; } $i = 0; foreach ($dirs as $dir) { $key = substr($dir, 0, -4); $name = str_replace($p, '', $key); if (substr($name, 0, 1) == '/') { $name = substr($name, 1); } $module_name = substr($name, 0, strpos($name, '/')); $class = ucfirst(substr($key, strrpos($key, '/') + 1)); $line = @file_get_contents($dir); preg_match_all('/.*class.*extends(.*)/i', $line, $out); if (false !== strpos($out[1][0], 'AdminController')) { $new_dirs[$module_name . '.' . $class . "##" . $i] = $dir; $i++; } } if (!$new_dirs) { return; } foreach ($new_dirs as $k => $dir) { $lineNumber = 0; $file = fopen($dir, 'r'); while (feof($file) === false) { ++$lineNumber; $line = fgets($file); preg_match('/public[ \\t]+function[ \\t]+action([A-Z]{1}[a-zA-Z0-9]+)[ \\t]*\\(/', $line, $matches); if ($matches !== array()) { $name = $matches[1]; $k = str_replace('Controller', '', $k); $k = strtolower($k); $actions[substr($k, 0, strpos($k, '##'))][strtolower($name)] = array('name' => $name, 'line' => $lineNumber); } } } return $actions; }
<?php include __DIR__ . "/config/settings.php"; require_once __DIR__ . "/classes/analyse/user.php"; require_once __DIR__ . "/classes/dirHelper.php"; require_once __DIR__ . "/classes/analyse/country.php"; require_once __DIR__ . "/classes/analyse/reference.php"; require_once __DIR__ . "/classes/analyse/security.php"; require_once __DIR__ . "/classes/analyse/UASparser.php"; $user = new User(getenv("REMOTE_ADDR"), $_SERVER['HTTP_USER_AGENT']); $dirhelper = new DirHelper(__DIR__); if ($dirhelper->checkExists($fstat_data_dir) == false || $dirhelper->checkExists($fstat_cache_dir) == false || $dirhelper->checkExists($fstat_cache_dir . "ip/") == false) { return 0; } //Delete old entrys in the Ip directory $dirhelper->deleteOldIPs($fstat_cache_dir . "ip", $fstat_new_user); //get the user from cache, on success it is a old user is_new is false then $user->getFromCache(__DIR__ . "/" . $fstat_cache_dir . "ip"); if ($user->is_new) { //Daten auswerten $current_folder = __DIR__ . "/" . $fstat_data_dir . "stat/" . gmdate("Y", $user->time) . "/" . gmdate("m", $user->time); if ($dirhelper->checkExists($fstat_data_dir . "stat") == false || $dirhelper->checkExists($fstat_data_dir . "stat/" . gmdate("Y", $user->time)) == false || $dirhelper->checkExists($current_folder, true) == false) { //quit the execution here return 0; } //User Agent Parser $parser = new UAS\Parser(__DIR__ . "/" . $fstat_cache_dir, $fstat_update_interval, false, $fstat_update_auto); $uaa = $parser->Parse($user->agent); //ReferParser $ref = new Reference(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ""); $ref->parse();
<?php if (!isset($is_include)) { header('Content-type: text/xml'); error_reporting(0); //keine Fehler anzeigen //error_reporting(E_ALL ^ E_NOTICE); //alle Fehler ausser Notice anzeigen //error_reporting(E_ALL); // alle Fehler anzeigen } include __DIR__ . "/../config/settings.php"; include __DIR__ . "/../functions/backend_include.php"; //(re)defines $backend require_once __DIR__ . "/../classes/dirHelper.php"; $dirhelper = new DirHelper(__DIR__ . "/../"); $use_cached = false; if ($backend->getModus() == Backend::MODUS_MONTH) { $path = $fstat_data_dir . "paths/" . $backend->getTime()->getStartYear(); $dirhelper->checkExists($path, false); //actually does nothing than creating, if not exists $path = $path . "/" . str_pad($backend->getTime()->getStartMonth(), 2, "0", STR_PAD_LEFT); $dirhelper->checkExists($path, false); //actually does nothing than creating, if not exists $cache_filename = __DIR__ . "/../" . $path . "/cache.xml"; if (is_file($cache_filename)) { $use_cached = true; } } elseif ($backend->getModus() == Backend::MODUS_YEAR) { $path = $fstat_data_dir . "paths/" . $backend->getTime()->getStartYear(); $dirhelper->checkExists($path, false); //actually does nothing than creating, if not exists $cache_filename = __DIR__ . "/../" . $path . "/cache.xml";
public function __construct($filename) { $this->filename = $filename; //Create cache dir DirHelper::createCache(); //Init $this->initInstances(); //parse file $this->myParser(); }