Example #1
0
 public static function configSectionInject($s)
 {
     if (is_array($s)) {
         self::$config = array_merge(self::$config, $s);
     } else {
         if (file_exists(__APP__ . '/' . $s . '/config.inc')) {
             self::$config = array_merge(self::$config, include __APP__ . '/' . $s . '/config.inc');
         }
     }
 }
Example #2
0
 static function init()
 {
     define("DP_VER", "1.0.1", false);
     defined("CORE_PATH") or define("CORE_PATH", __DIR__);
     defined("ROOT_PATH") or define("ROOT_PATH", dirname(CORE_PATH));
     defined("PLUGIN_PATH") or define("PLUGIN_PATH", ROOT_PATH . "/plugins");
     defined("APP_PATH") or define("APP_PATH", ROOT_PATH . "/app");
     defined("LOG_PATH") or define("LOG_PATH", ROOT_PATH . "/logs");
     function L($module = _MODULE_)
     {
         return app::in($module . "Logic", $module . "\\libs\\" . $module);
     }
     function P($lib, $module = _MODULE_)
     {
         return app::in($module . "_" . $lib, $module . "\\libs\\" . $lib);
     }
     function C($key, $item = "")
     {
         if (!isset(app::$config[$key])) {
             $split = explode(".", $key);
             $dest = count($split) > 1 ? $split[0] . "/config/" . $split[1] : "config/" . $split[0];
             app::$config[$key] = (include APP_PATH . "/{$dest}.php");
         }
         return empty($item) ? app::$config[$key] : app::$config[$key][$item];
     }
     //autoload
     spl_autoload_register(function ($className) {
         $class = "/" . str_replace("\\", "/", $className) . ".php";
         self::autoLoad($class, array(CORE_PATH, APP_PATH, ROOT_PATH));
     });
     plugin::init();
     session::start();
     self::$config = (include ROOT_PATH . "/config/app.php");
     empty(self::$config['db']) || db::connect(self::$config['db']);
     empty(self::$config['rule']) || router::set(self::$config['rule']);
 }
Example #3
0
 /**
  * Init config of the module
  */
 public function initConfig()
 {
     $config = array();
     include $this->name . '/config.php';
     \app::$config = array_merge(\app::$config, $config);
 }
Example #4
0
                <input type="checkbox" onclick="if(this.checked) document.getElementById('pass1').type = 'text'; else document.getElementById('pass1').type = 'password';"><?php 
            echo tr('Check Password');
            ?>
            </div>
	    <div><br>
		
	    </div>
            <input type="hidden" name="step" value="validstep4" />
            <?php 
            break 2;
        case 5:
            include 'modules/core/classes/app.php';
            class_alias('core\\classes\\app', 'app');
            include 'profiles/www/config.php';
            define('PREFIX', $config['db']['prefix']);
            app::$config = $config;
            app::$activeModules = array_filter($config['modules']);
            $config['aliasClasses'] = array('app' => 'core\\classes\\app', 'request' => 'core\\classes\\request', 'response' => 'core\\classes\\response', 'block' => 'core\\classes\\block', 'tools' => 'core\\classes\\tools', 'view' => 'core\\classes\\view', 'module' => 'core\\classes\\module', 'PDOconnection' => 'core\\classes\\PDOconnection', 'config' => 'core\\classes\\config', 'queryBuilder' => 'core\\classes\\queryBuilder', 'entity' => 'core\\classes\\entity', 'theme' => 'core\\classes\\theme', 'page' => 'core\\classes\\page', 'css' => 'core\\classes\\css', 'user' => 'core\\classes\\user', 'pagination' => 'core\\classes\\pagination', 'img' => 'core\\classes\\img', 'field' => 'core\\classes\\field', 'field_ident' => 'core\\fields\\ident', 'field_string' => 'core\\fields\\string', 'field_numeric' => 'core\\fields\\numeric', 'field_decimal' => 'core\\fields\\decimal', 'field_price' => 'core\\fields\\price', 'field_percent' => 'core\\fields\\percent', 'field_mail' => 'core\\fields\\mail', 'field_password' => 'core\\fields\\password', 'field_state' => 'core\\fields\\state', 'field_date' => 'core\\fields\\date', 'field_publication' => 'core\\fields\\publication', 'field_image' => 'core\\fields\\image', 'field_url' => 'core\\fields\\url', 'field_url_rewriting' => 'core\\fields\\url_rewriting', 'field_wysiwyg' => 'core\\fields\\wysiwyg', 'field_textarea' => 'core\\fields\\textarea', 'field_user' => 'core\\fields\\user', 'field_ip' => 'core\\fields\\ip', 'field_boolean' => 'core\\fields\\boolean', 'field_foreignkey' => 'core\\fields\\foreignkey', 'field_formasso' => 'core\\fields\\formasso');
            app::$aliasClasses = $config['aliasClasses'];
            define('PROFILE_PATH', 'profiles/www/modules/');
            $toInclude = array('config', 'queryBuilder', 'entity', 'field', 'field_ident', 'field_string', 'field_numeric', 'field_decimal', 'field_price', 'field_percent', 'field_mail', 'field_password', 'field_state', 'field_date', 'field_publication', 'field_image', 'field_flash', 'field_url', 'field_url_rewriting', 'field_wysiwyg', 'field_textarea', 'field_user', 'field_ip', 'field_boolean', 'field_foreignkey', 'field_formasso', 'PDOconnection', 'tools', 'module');
            foreach ($config['aliasClasses'] as $alias => $class) {
                if (in_array($alias, $toInclude)) {
                    include 'modules/' . str_replace('\\', '/', $class) . '.php';
                    class_alias($class, $alias);
                }
            }
            //create SQL tables
            include 'modules/core/module.php';
            $core = new \core\module('core');
            $core->install();
 /**
  *
  * @expectedException Application\Exceptions\ValidateException
  */
 public function testLastUsedPasswordsMaxReached()
 {
     // User should be a service provider
     $user = clone $this->_user;
     $user->id = null;
     $user->setOrganizationId(self::PROVIDER_COMMERCIAL_ORG_ID);
     $user->save();
     // Update password N times
     $limit = \app::config('lastUsedPasswordsLimit');
     $loops = $limit + 5;
     for ($i = 0; $i < $loops; $i++) {
         $lastPassword = '******' . rand(1000, 9999);
         $user = $this->_service->updatePassword($user, $lastPassword);
         $lastUsedPasswords = $this->_service->getLastUsedPasswords($user->id);
         $this->assertNotEmpty($lastUsedPasswords);
     }
     $this->assertEquals(count($lastUsedPasswords), $limit);
     // Try to insert an existent password in a list
     $this->_service->updatePassword($user, $lastPassword);
 }