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
<?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 #3
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;
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]];
     }
 }
Exemple #5
0
 public static function download($fileNameResource, $extResource, $fileNameResult, $data, $mode = [])
 {
     $fileNameResult = $fileNameResult . '.' . $extResource;
     # checking tmp directory for save result
     $assetsPath = Setting::getAssetPath();
     $tmpDir = $assetsPath . DIRECTORY_SEPARATOR . "exports";
     if (!is_dir($tmpDir)) {
         mkdir($tmpDir, 0777, TRUE);
     }
     # checking fileNameResourse
     $fileNameResourceExplode = explode('.', $fileNameResource);
     if (count($fileNameResourceExplode) == 2) {
         $pathResources = Yii::getPathOfAlias('app.modules.' . $fileNameResourceExplode[0] . '.reports.' . $fileNameResourceExplode[1]);
     } else {
         $pathResources = Yii::getPathOfAlias('app.reports.' . $fileNameResourceExplode[0]);
     }
     $pathResources .= '.' . $extResource;
     if (file_exists($pathResources) != true) {
         // throw new CDbException('The specified file cannot be found.');
         echo 'The specified file cannot be found.';
         exit;
     }
     $allow_ext = array('odt', 'ods', 'odp', 'odg', 'odf', 'docx', 'xlsx', 'pptx');
     if (!in_array($extResource, $allow_ext)) {
         echo 'Extension File yang diijinkan hanya [odt, ods, odp, odg, odf, docx, xlsx, pptx]';
         exit;
     }
     // spl_autoload_unregister(array('YiiBase','autoload'));
     // Include classes
     require_once Yii::getPathOfAlias('ext.ertong.tbs.opentbs.demo.tbs_class') . '.php';
     require_once Yii::getPathOfAlias('ext.ertong.tbs.opentbs.tbs_plugin_opentbs') . '.php';
     // 		spl_autoload_register(array('YiiBase','autoload'));
     // prevent from a PHP configuration problem when using mktime() and date()
     if (version_compare(PHP_VERSION, '5.1.0') >= 0) {
         if (ini_get('date.timezone') == '') {
             date_default_timezone_set('UTC');
         }
     }
     // Initialize the TBS instance
     $TBS = new clsTinyButStrong();
     // new instance of TBS
     $TBS->Plugin(TBS_INSTALL, OPENTBS_PLUGIN);
     // load the OpenTBS plugin
     $template = $pathResources;
     $TBS->LoadTemplate($template, OPENTBS_ALREADY_UTF8);
     // Also merge some [onload] automatic fields (depends of the type of document).
     # get Key of array data
     foreach (array_keys($data) as $key) {
         $TBS->MergeBlock($key, $data[$key]);
     }
     if (isset($mode['x_picture'])) {
         $x_picture = $mode['x_picture'];
         $TBS->PlugIn(OPENTBS_MERGE_SPECIAL_ITEMS);
     }
     $save_as = isset($_POST['save_as']) && trim($_POST['save_as']) !== '' && $_SERVER['SERVER_NAME'] == 'localhost' ? trim($_POST['save_as']) : '';
     $output_file_name = $fileNameResult;
     if ($save_as === '') {
         // Output the result as a downloadable file (only streaming, no data saved in the server)
         $TBS->Show(OPENTBS_DOWNLOAD, $output_file_name);
         // Be sure that no more output is done, otherwise the download file is corrupted with extra data.
         exit;
     } else {
         // Output the result as a file on the server.
         $TBS->Show(OPENTBS_FILE, $output_file_name);
         // Also merges all [onshow] automatic fields.
         // The script can continue.
         exit("File [{$output_file_name}] has been created.");
     }
 }
Exemple #6
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;