Пример #1
0
 public static function initalSetting($resetSetting = false, $resetErrorLog = false)
 {
     Email::$path = Setting::getRuntimePath() . DIRECTORY_SEPARATOR . "email";
     if (!file_exists(Email::$path)) {
         mkdir(Email::$path, 0777);
     }
     Email::$setting = Email::$path . DIRECTORY_SEPARATOR . "setting.json";
     if (!file_exists(Email::$setting)) {
         touch(Email::$setting);
         Email::$data = ['email' => Setting::get("email")];
         $result = @file_put_contents(Email::$setting, json_encode(Email::$data, JSON_PRETTY_PRINT));
     }
     $file = @file_get_contents(Email::$setting);
     if ($resetSetting) {
         Email::$data = ['email' => Setting::get("email")];
         $result = @file_put_contents(Email::$setting, json_encode(Email::$data, JSON_PRETTY_PRINT));
     } else {
         $setting = json_decode($file, true);
         Email::$data = $setting;
     }
     Email::$errorLog = Email::$path . DIRECTORY_SEPARATOR . "error.log";
     if (!file_exists(Email::$errorLog)) {
         touch(Email::$errorLog);
     }
     if ($resetErrorLog) {
         $fh = fopen(Email::$errorLog, 'w');
         fclose($fh);
     }
 }
Пример #2
0
 public static function checkDaemon()
 {
     $file = Setting::getRuntimePath() . DIRECTORY_SEPARATOR . "daemon_lastrun.txt";
     $lastrun = false;
     if (is_file($file)) {
         $lastrun = file_get_contents($file);
     }
     ## run marker treshold, in seconds
     if (!$lastrun || time() - $lastrun > 10) {
         return false;
     } else {
         return true;
     }
 }
Пример #3
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;
Пример #4
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;
Пример #5
0
<?php

## Setting initialization
Setting::initPath();
$basePath = Setting::getBasePath();
$modules = Setting::getModules();
## components
$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))));
$dbLists = Setting::getDBList();
$components = $dbLists + $components;
$imports = 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.*');
foreach ($dbLists as $db => $val) {
    array_splice($imports, 1, 0, "app.models.{$db}.*");
}
## define config
$config = array('basePath' => $basePath, 'viewPath' => Setting::getViewPath(), 'name' => !Setting::get('app.name') ? "Plansys" : Setting::get('app.name'), 'preload' => array('log', 'EJSUrlManager'), 'import' => $imports, 'runtimePath' => Setting::getRuntimePath(), 'sourceLanguage' => 'en_us', 'language' => 'id', 'modulePath' => Setting::getModulePath(), 'controllerMap' => Setting::getControllerMap(), 'modules' => $modules, 'components' => $components, 'params' => array());
$config = Setting::finalizeConfig($config);
return $config;
Пример #6
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]];
     }
 }
Пример #7
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();
## define config
$config = array('basePath' => dirname(__FILE__) . DIRECTORY_SEPARATOR . '..', 'name' => 'Plansys Console', 'preload' => array('log', 'EJSUrlManager'), 'import' => 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.*'), 'runtimePath' => Setting::getRuntimePath(), 'preload' => array('log'), 'modules' => array_merge($modules, array('nfy')), 'aliases' => array('nfy' => realpath(__DIR__ . '/../modules/nfy')), 'commandMap' => Setting::getCommandMap($modules), 'components' => array('assetManager' => array('basePath' => Setting::getAssetPath()), 'db' => Setting::getDB(), 'nfy' => array('class' => 'nfy.components.NfyDbQueue', 'id' => 'Notifications', 'timeout' => 30), 'log' => array('class' => 'CLogRouter', 'routes' => array(array('class' => 'CFileLogRoute', 'levels' => 'error, warning')))));
$config = Setting::finalizeConfig($config, "console");
return $config;