Exemple #1
0
<?php

## Setting initialization
Setting::initPath();
$basePath = Setting::getBasePath();
$modules = Setting::getModules();
## define config
$config = array('basePath' => $basePath, 'name' => !Setting::get('app.name') ? "Plansys" : Setting::get('app.name'), 'preload' => array('log', 'EJSUrlManager'), 'import' => array('app.models.*', 'application.models.*', 'application.forms.*', 'app.forms.*', 'app.components.utility.*', 'application.components.*', 'application.components.ui.*', 'application.components.ui.FormFields.*', 'application.components.ui.Widgets.*', 'application.components.utility.*', 'application.components.models.*', 'application.components.codegen.*', 'application.components.repo.*', 'application.behaviors.*', 'ext.YiiJasper.*'), 'runtimePath' => Setting::getRuntimePath(), 'sourceLanguage' => 'en_us', 'language' => 'id', 'modulePath' => Setting::getModulePath(), 'controllerMap' => Setting::getControllerMap(), 'modules' => array_merge($modules, array('nfy' => array('class' => 'nfy.NfyModule'))), 'aliases' => array('nfy' => Setting::getBasePath() . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'nfy'), 'components' => array('assetManager' => array('basePath' => Setting::getAssetPath()), 'img' => array('class' => 'application.extensions.simpleimage.CSimpleImage'), 'ldap' => Setting::getLDAP(), 'nfy' => array('class' => 'nfy.components.NfyDbQueue', 'id' => 'Notifications', 'timeout' => 30), 'todo' => array('class' => 'application.components.ui.Widgets.TodoWidget'), 'EJSUrlManager' => array('class' => 'ext.JSUrlManager.EJSUrlManager'), 'user' => array('allowAutoLogin' => true, 'class' => 'WebUser'), 'db' => Setting::getDB(), 'errorHandler' => array('class' => 'ErrorHandler'), 'log' => array('class' => 'CLogRouter', 'routes' => array(array('class' => 'CFileLogRoute', 'levels' => 'error, warning'))), 'widgetFactory' => array(), 'cache' => array('class' => 'system.caching.CFileCache'), 'clientScript' => array('packages' => array('jquery' => array('basePath' => "application.static.js.lib", 'js' => array('jquery.js'), 'coreScriptPosition' => CClientScript::POS_HEAD))), 'ePdf' => array('class' => 'ext.yiipdf.EYiiPdf', 'params' => array('HTML2PDF' => array('librarySourcePath' => 'application.extensions.html2pdf.*', 'classFile' => 'html2pdf.class.php')))), 'params' => array());
$config = Setting::finalizeConfig($config);
return $config;
Exemple #2
0
 public static function getModules()
 {
     $modules = glob(Setting::getBasePath() . DIRECTORY_SEPARATOR . "modules" . DIRECTORY_SEPARATOR . "*");
     $appModules = glob(Setting::getAppPath() . DIRECTORY_SEPARATOR . "modules" . DIRECTORY_SEPARATOR . "*");
     $return = [];
     foreach ($modules as $key => $module) {
         $m = Setting::explodeLast(DIRECTORY_SEPARATOR, $module);
         $return[$m] = ['class' => 'application.modules.' . $m . '.' . ucfirst($m) . 'Module'];
     }
     foreach ($appModules as $key => $module) {
         $m = Setting::explodeLast(DIRECTORY_SEPARATOR, $module);
         if (!is_file($module . DIRECTORY_SEPARATOR . ucfirst($m) . 'Module.php')) {
             continue;
         }
         $return[$m] = ['class' => 'app.modules.' . $m . '.' . ucfirst($m) . 'Module'];
     }
     return $return;
 }
Exemple #3
0
<?php

require_once dirname(__FILE__) . '/../components/utility/Helper.php';
require_once dirname(__FILE__) . '/../components/utility/Setting.php';
## Setting initialization
Setting::init(__FILE__);
Setting::initPath();
$basePath = Setting::getBasePath();
$modules = Setting::getModules();
## components
$components = array('assetManager' => array('basePath' => Setting::getAssetPath()), 'db' => Setting::getDB(), 'log' => array('class' => 'CLogRouter', 'routes' => array(array('class' => 'CFileLogRoute', 'levels' => 'error, warning'))));
$dbLists = Setting::getDBList();
$components = $dbLists + $components;
$imports = array('app.models.*', 'application.models.*', 'application.forms.*', 'application.components.*', 'application.components.ui.*', 'application.components.ui.FormFields.*', 'application.components.ui.Widgets.*', 'application.components.utility.*', 'application.components.models.*', 'application.components.codegen.*', 'application.components.repo.*', 'application.behaviors.*');
foreach ($dbLists as $db => $val) {
    array_splice($imports, 1, 0, "app.models.{$db}.*");
}
## define config
$config = array('basePath' => dirname(__FILE__) . DIRECTORY_SEPARATOR . '..', 'name' => 'Plansys Console', 'preload' => array('log', 'EJSUrlManager'), 'import' => $imports, 'runtimePath' => Setting::getRuntimePath(), 'sourceLanguage' => 'en_us', 'language' => 'id', 'modulePath' => Setting::getModulePath(), 'commandMap' => Setting::getCommandMap($modules), 'modules' => $modules, 'components' => $components, 'params' => array());
$config = Setting::finalizeConfig($config);
return $config;
Exemple #4
0
 public static function getCheckList($checkGroup = "")
 {
     $checkLists = ["Checking Directory Permission" => [["title" => 'Checking base directory permissions', "check" => function () {
         return Setting::checkPath(Setting::getBasePath(), true);
     }], ["title" => 'Checking app directory permissions', "check" => function () {
         return Setting::checkPath(Setting::getAppPath());
     }], ["title" => 'Checking assets directory permissions', "check" => function () {
         return Setting::checkPath(Setting::getAssetPath(), true);
     }], ["title" => 'Checking runtime directory permissions', "check" => function () {
         return Setting::checkPath(Setting::getRuntimePath(), true);
     }], ["title" => 'Checking config directory permissions', "check" => function () {
         return Setting::checkPath(Setting::getConfigPath(), true);
     }], ["title" => 'Checking repository directory permissions', "check" => function () {
         $repo = Setting::get('repo.path');
         if (!is_dir($repo)) {
             @mkdir($repo, 0777, true);
         }
         return Setting::checkPath(realpath($repo), true);
     }]], "Checking Framework Requirements" => [['title' => 'Checking PHP Version ( > 5.5.0 )', 'check' => function () {
         $result = version_compare(PHP_VERSION, "5.5.0", ">");
         $msg = "Current PHP version is:" . PHP_VERSION;
         return $result !== true ? $msg : true;
     }], ['title' => 'Reflection Extension', 'check' => function () {
         $result = class_exists('Reflection', false);
         $msg = "Reflection class does not exists!";
         return $result !== true ? $msg : true;
     }], ['title' => 'PCRE Extension', 'check' => function () {
         $result = extension_loaded("pcre");
         $msg = "Extension \"pcre\" is not loaded";
         return $result !== true ? $msg : true;
     }], ['title' => 'SPL extension', 'check' => function () {
         $result = extension_loaded("SPL");
         $msg = "Extension \"SPL\" is not loaded";
         return $result !== true ? $msg : true;
     }], ['title' => 'DOM extension', 'check' => function () {
         $result = class_exists("DOMDocument", false);
         $msg = "DomDocument class does not exists!";
         return $result !== true ? $msg : true;
     }], ['title' => 'PDO extension', 'check' => function () {
         $result = extension_loaded("pdo");
         $msg = "Extension \"pdo\" is not loaded";
         return $result !== true ? $msg : true;
     }], ['title' => 'PDO MySQL extension', 'check' => function () {
         $result = extension_loaded("pdo_mysql");
         $msg = "Extension \"pdo_mysql\" is not loaded";
         return $result !== true ? $msg : true;
     }], ['title' => 'Mcrypt extension', 'check' => function () {
         $result = extension_loaded("mcrypt");
         $msg = "Extension \"mcrypt\" is not loaded";
         return $result !== true ? $msg : true;
     }], ['title' => 'CURL extension', 'check' => function () {
         $result = extension_loaded("curl");
         $msg = "Extension \"curl\" is not loaded";
         return $result !== true ? $msg : true;
     }], ['title' => 'GD extension with FreeType support<br />or ImageMagick extension with <br/> PNG support', 'check' => function () {
         if (extension_loaded('imagick')) {
             $imagick = new Imagick();
             $imagickFormats = $imagick->queryFormats('PNG');
         }
         if (extension_loaded('gd')) {
             $gdInfo = gd_info();
         }
         if (isset($imagickFormats) && in_array('PNG', $imagickFormats)) {
             return true;
         } elseif (isset($gdInfo)) {
             if ($gdInfo['FreeType Support']) {
                 return true;
             }
             return "GD Extension is loaded but no Freetype support";
         }
         return "GD Extension / ImageMagick is not loaded";
     }], ['title' => 'Ctype extension', 'check' => function () {
         $result = extension_loaded("ctype");
         $msg = "Extension \"ctype\" is not loaded";
         return $result !== true ? $msg : true;
     }], ['title' => 'Checking Server variables', 'check' => function () {
         return Installer::checkServerVar();
     }]]];
     if ($checkGroup == "") {
         return $checkLists;
     } else {
         return [$checkGroup => $checkLists[$checkGroup]];
     }
 }