コード例 #1
0
 protected function bootstrap($disableSessions = true, $loadZikulaCore = true, $fakeRequest = true)
 {
     define('_ZINSTALLVER', \Zikula_Core::VERSION_NUM);
     $kernel = $this->getContainer()->get('kernel');
     $loader = (require $kernel->getRootDir() . '/autoload.php');
     \ZLoader::register($loader);
     if ($loadZikulaCore && !$this->getContainer()->has('zikula')) {
         $core = new Zikula_Core();
         $core->setKernel($kernel);
         $core->boot();
         foreach ($GLOBALS['ZConfig'] as $config) {
             $core->getContainer()->loadArguments($config);
         }
         $GLOBALS['ZConfig']['System']['temp'] = $core->getContainer()->getParameter('temp_dir');
         $GLOBALS['ZConfig']['System']['datadir'] = $core->getContainer()->getParameter('datadir');
         $GLOBALS['ZConfig']['System']['system.chmod_dir'] = $core->getContainer()->getParameter('system.chmod_dir');
         \ServiceUtil::getManager($core);
         \EventUtil::getManager($core);
     }
     if ($disableSessions) {
         // Disable sessions.
         $this->getContainer()->set('session.storage', new MockArraySessionStorage());
         $this->getContainer()->set('session.handler', new NullSessionHandler());
     }
     if ($fakeRequest) {
         // Fake request
         $request = Request::create('http://localhost/install');
         $this->getContainer()->set('request', $request);
     }
 }
コード例 #2
0
ファイル: ZLoader.php プロジェクト: planetenkiller/core
 /**
  * Base setup.
  *
  * @return void
  */
 public static function register()
 {
     spl_autoload_register(array('ZLoader', 'autoload'));
     self::$autoloaders = new UniversalClassLoader();
     self::$autoloaders->register();
     $mapClassLoader = new \Symfony\Component\ClassLoader\MapClassLoader(self::map());
     $mapClassLoader->register();
     self::$moduleLoader = new \Zikula\Framework\ModuleClassLoader();
     self::$moduleLoader->spl_autoload_register();
 }
コード例 #3
0
 /**
  * Base setup.
  *
  * @return void
  */
 public static function register()
 {
     self::$map = self::map();
     spl_autoload_register(array('ZLoader', 'autoload'));
     self::$autoloaders = new Zikula_KernelClassLoader();
     self::$autoloaders->spl_autoload_register();
     self::addAutoloader('Doctrine', ZLOADER_PATH . '/vendor/Doctrine');
     self::addAutoloader('Categories', 'system/Categories/lib');
     self::addAutoloader('Zend_Log', ZLOADER_PATH . '/vendor');
 }
コード例 #4
0
ファイル: view.php プロジェクト: BGCX261/zoombi-svn-to-git
 public function &block($a_name)
 {
     if (isset($this->m_block[$a_name])) {
         return $this->m_block[$a_name];
     }
     $file = null;
     $file = ZLoader::_loadFile($a_name, 'view', 'ZView');
     if (!$file || empty($file)) {
         trigger_error('Block ' . $a_name . ' not found.');
     }
     $block = new ZViewBlock($this->getParent(), 'ViewBlock');
     $block->setViewFile($file);
     $this->m_block[$a_name] =& $block;
     return $this->m_block[$a_name];
 }
コード例 #5
0
ファイル: bootstrap.php プロジェクト: Silwereth/core
 * Copyright Zikula Foundation 2009 - Zikula Application Framework
 *
 * This work is contributed to the Zikula Foundation under one or more
 * Contributor Agreements and licensed to You under the following license:
 *
 * @license GNU/LGPLv3 (or at your option, any later version).
 * @package Zikula
 *
 * Please see the NOTICE file distributed with this source code for further
 * information regarding copyright and licensing.
 */
use Symfony\Component\Debug\Debug;
use Symfony\Component\Yaml\Yaml;
use Zikula\Core\Event\GenericEvent;
$loader = (require __DIR__ . '/../app/autoload.php');
ZLoader::register($loader);
/**
 * create aliases for psr-4 1.4.1-classnames to psr-0 <= 1.4.0-legacy for BC
 */
class_alias('\\Zikula\\CategoriesModule\\Entity\\CategoryEntity', '\\Zikula\\Module\\CategoriesModule\\Entity\\CategoryEntity', true);
class_alias('\\Zikula\\UsersModule\\Entity\\UserEntity', '\\Zikula\\Module\\UsersModule\\Entity\\UserEntity', true);
class_alias('\\Zikula\\ExtensionsModule\\Entity\\ExtensionVarEntity', '\\Zikula\\Core\\Doctrine\\Entity\\ExtensionVarEntity', true);
class_alias('\\Zikula\\ExtensionsModule\\Entity\\ExtensionEntity', '\\Zikula\\Core\\Doctrine\\Entity\\ExtensionEntity', true);
class_alias('\\Zikula\\ExtensionsModule\\Entity\\ExtensionDependencyEntity', '\\Zikula\\Core\\Doctrine\\Entity\\ExtensionDependencyEntity', true);
class_alias('\\Zikula\\CategoriesModule\\Entity\\AbstractCategoryAssignment', '\\Zikula\\Core\\Doctrine\\Entity\\AbstractEntityCategory', true);
$kernelConfig = Yaml::parse(file_get_contents(__DIR__ . '/../app/config/parameters.yml'));
if (is_readable($file = __DIR__ . '/../app/config/custom_parameters.yml')) {
    $kernelConfig = array_merge($kernelConfig, Yaml::parse(file_get_contents($file)));
}
$kernelConfig = $kernelConfig['parameters'];
if ($kernelConfig['env'] !== 'prod') {
コード例 #6
0
ファイル: ModUtil.php プロジェクト: rtznprmpftl/Zikulacore
 /**
  * Register all autoloaders for all modules.
  *
  * @internal
  *
  * @return void
  */
 public static function registerAutoloaders()
 {
     $modules = self::getModsTable();
     unset($modules[0]);
     foreach ($modules as $module) {
         $base = $module['type'] == self::TYPE_MODULE ? 'modules' : 'system';
         ZLoader::addModule($module['directory'], ZIKULA_ROOT . "/{$base}");
     }
 }
コード例 #7
0
ファイル: Plugin.php プロジェクト: projectesIF/Sirius
    /**
     * Initialise.
     *
     * Runs ar plugin init time.
     *
     * @throws InvalidArgumentException If invalid configuration given.
     *
     * @return void
     */
    public function initialize()
    {
        define('SWIFT_REQUIRED_LOADED', true);
        define('SWIFT_INIT_LOADED', true);

        // register namespace
        ZLoader::addAutoloader('Swift', dirname(__FILE__) . '/lib/vendor/SwiftMailer/classes');

        // initialize Swift
        //require_once realpath($this->baseDir . '/lib/vendor/SwiftMailer/swift_init.php'); // dont use this as it fails in virtual hosting environments with open_basedir restrictions
        // Load in dependency maps
        require_once dirname(__FILE__) . '/lib/vendor/SwiftMailer/dependency_maps/cache_deps.php';
        require_once dirname(__FILE__) . '/lib/vendor/SwiftMailer/dependency_maps/mime_deps.php';
        require_once dirname(__FILE__) . '/lib/vendor/SwiftMailer/dependency_maps/transport_deps.php';

        // load configuration (todo: move this to persistence).
        include dirname(__FILE__) . '/configuration/config.php';

        $this->serviceManager['swiftmailer.preferences.sendmethod'] = $config['sendmethod'];

        $preferences = Swift_Preferences::getInstance();
        $this->serviceManager['swiftmailer.preferences.charset'] = $config['charset'];
        $this->serviceManager['swiftmailer.preferences.cachetype'] = $config['cachetype'];
        $this->serviceManager['swiftmailer.preferences.tempdir'] = $config['tempdir'];
        $preferences->setCharset($config['charset']);
        $preferences->setCacheType($config['cachetype']);
        $preferences->setTempDir($config['tempdir']);

        // determine the correct transport
        $type = $config['transport']['type'];
        $args = $config['transport'][$type];
        switch ($type) {
            case 'mail':
                $this->serviceManager['swiftmailer.transport.mail.extraparams'] = $args['extraparams'];
                $definition = new Zikula_ServiceManager_Definition('Swift_MailTransport', array(new Zikula_ServiceManager_Argument('swiftmailer.transport.mail.extraparams')));
                break;

            case 'smtp':
                $this->serviceManager['swiftmailer.transport.smtp.host'] = $args['host'];
                $this->serviceManager['swiftmailer.transport.smtp.port'] = $args['port'];
                $definition = new Zikula_ServiceManager_Definition('Swift_SmtpTransport', array(
                                new Zikula_ServiceManager_Argument('swiftmailer.transport.smtp.host'),
                                new Zikula_ServiceManager_Argument('swiftmailer.transport.smtp.port')));

                if ($args['username'] && $args['password']) {
                    $this->serviceManager['swiftmailer.transport.smtp.username'] = $args['username'];
                    $this->serviceManager['swiftmailer.transport.smtp.password'] = $args['password'];
                    $definition->addMethod('setUserName', new Zikula_ServiceManager_Argument('swiftmailer.transport.smtp.username'));
                    $definition->addMethod('setPassword', new Zikula_ServiceManager_Argument('swiftmailer.transport.smtp.password'));
                }
                if (isset($args['encryption'])) {
                    $this->serviceManager['swiftmailer.transport.smtp.encryption'] = $args['encryption'];
                    $definition->addMethod('setEncryption', new Zikula_ServiceManager_Argument('swiftmailer.transport.smtp.encryption'));
                }
                break;

            case 'sendmail':
                $this->serviceManager['swiftmailer.transport.mail.command'] = $args['command'];
                $definition = new Zikula_ServiceManager_Definition('Swift_SendmailTransport', array(new Zikula_ServiceManager_Argument('swiftmailer.transport.mail.command')));
                break;

            default:
                // error
                throw new InvalidArgumentException('Invalid transport type, must be mail, smtp or sendmail');
                break;
        }

        // register transport
        $this->serviceManager->registerService('swiftmailer.transport', $definition);

        // define and register mailer using transport service
        $definition = new Zikula_ServiceManager_Definition('Swift_Mailer', array(new Zikula_ServiceManager_Reference('swiftmailer.transport')));
        $this->serviceManager->registerService('mailer', $definition, false);

        // register simple mailer service
        $definition = new Zikula_ServiceManager_Definition('SystemPlugins_SwiftMailer_Mailer', array(new Zikula_ServiceManager_Reference('zikula.servicemanager')));
        $this->serviceManager->registerService('mailer.simple', $definition);
    }
コード例 #8
0
ファイル: upgrade.php プロジェクト: planetenkiller/core
 * Contributor Agreements and licensed to You under the following license:
 *
 * @license GNU/LGPLv3 (or at your option, any later version).
 * @package Installer
 *
 * Please see the NOTICE file distributed with this source code for further
 * information regarding copyright and licensing.
 */
use Zikula\Core\Event\GenericEvent;
ini_set('mbstring.internal_encoding', 'UTF-8');
ini_set('default_charset', 'UTF-8');
mb_regex_encoding('UTF-8');
ini_set('memory_limit', '64M');
ini_set('max_execution_time', 86400);
include __DIR__ . '/../app/bootstrap.php';
ZLoader::addAutoloader('Users', __DIR__ . '/system');
$eventManager = $core->getDispatcher();
$eventManager->attach('core.init', 'upgrade_suppressErrors');
// load zikula core
define('_ZINSTALLVER', Zikula_Core::VERSION_NUM);
define('_Z_MINUPGVER', '1.2.0');
// Signal that upgrade is running.
$GLOBALS['_ZikulaUpgrader'] = array();
// include config file for retrieving name of temporary directory
$GLOBALS['ZConfig']['System']['multilingual'] = true;
$GLOBALS['ZConfig']['System']['Z_CONFIG_USE_OBJECT_ATTRIBUTION'] = false;
$GLOBALS['ZConfig']['System']['Z_CONFIG_USE_OBJECT_LOGGING'] = false;
$GLOBALS['ZConfig']['System']['Z_CONFIG_USE_OBJECT_META'] = false;
// Lazy load DB connection to avoid testing DSNs that are not yet valid (e.g. no DB created yet)
$dbEvent = new GenericEvent(null, array('lazy' => true));
$connection = $eventManager->dispatch('doctrine.init_connection', $dbEvent)->getData();
コード例 #9
0
ファイル: lib.php プロジェクト: planetenkiller/core
function installmodules($lang = 'en')
{
    // This is a temporary hack for release 1.3.x to be able to install modules
    // load DoctrineExtensions plugin
    include_once __DIR__ . '/../plugins/DoctrineExtensions/Plugin.php';
    PluginUtil::loadPlugin('SystemPlugin_DoctrineExtensions_Plugin');
    // Lang validation
    $lang = DataUtil::formatForOS($lang);
    // create a result set
    $results = array();
    $sm = ServiceUtil::getManager();
    $coremodules = array('Extensions', 'Settings', 'Theme', 'Admin', 'Permissions', 'Groups', 'Blocks', 'Users');
    // manually install the modules module
    foreach ($coremodules as $coremodule) {
        $modpath = 'system';
        ZLoader::addModule($coremodule, $modpath);
        $bootstrap = __DIR__ . "/../{$modpath}/{$coremodule}/bootstrap.php";
        if (file_exists($bootstrap)) {
            include_once $bootstrap;
        }
        ModUtil::dbInfoLoad($coremodule, $coremodule);
        $className = "{$coremodule}_Installer";
        $instance = new $className($sm);
        if ($instance->install()) {
            $results[$coremodule] = true;
        }
    }
    // regenerate modules list
    $filemodules = ModUtil::apiFunc('ExtensionsModule', 'admin', 'getfilemodules');
    ModUtil::apiFunc('ExtensionsModule', 'admin', 'regenerate', array('filemodules' => $filemodules));
    // set each of the core modules to active
    reset($coremodules);
    foreach ($coremodules as $coremodule) {
        $mid = ModUtil::getIdFromName($coremodule, true);
        ModUtil::apiFunc('ExtensionsModule', 'admin', 'setstate', array('id' => $mid, 'state' => ModUtil::STATE_INACTIVE));
        ModUtil::apiFunc('ExtensionsModule', 'admin', 'setstate', array('id' => $mid, 'state' => ModUtil::STATE_ACTIVE));
    }
    // Add them to the appropriate category
    reset($coremodules);
    $coremodscat = array('Extensions' => __('System'), 'Permissions' => __('Users'), 'Groups' => __('Users'), 'Blocks' => __('Layout'), 'Users' => __('Users'), 'Theme' => __('Layout'), 'Admin' => __('System'), 'Settings' => __('System'));
    $categories = ModUtil::apiFunc('AdminModule', 'admin', 'getall');
    $modscat = array();
    foreach ($categories as $category) {
        $modscat[$category['name']] = $category['cid'];
    }
    foreach ($coremodules as $coremodule) {
        $category = $coremodscat[$coremodule];
        ModUtil::apiFunc('AdminModule', 'admin', 'addmodtocategory', array('module' => $coremodule, 'category' => $modscat[$category]));
    }
    // create the default blocks.
    $blockInstance = new Blocks_Installer($sm);
    $blockInstance->defaultdata();
    // install all the basic modules
    $modules = array(array('module' => 'SecurityCenter', 'category' => __('Security')), array('module' => 'Tour', 'category' => __('Content')), array('module' => 'Categories', 'category' => __('Content')), array('module' => 'Legal', 'category' => __('Content')), array('module' => 'Mailer', 'category' => __('System')), array('module' => 'Errors', 'category' => __('System')), array('module' => 'Theme', 'category' => __('Layout')), array('module' => 'Search', 'category' => __('Content')));
    foreach ($modules as $module) {
        // sanity check - check if module is already installed
        if (ModUtil::available($module['module'])) {
            continue;
        }
        $modpath = 'modules';
        //        ZLoader::addModule($module, $modpath);
        ZLoader::addAutoloader($module, "{$modpath}");
        $bootstrap = __DIR__ . "/../{$modpath}/{$module}/bootstrap.php";
        if (file_exists($bootstrap)) {
            include_once $bootstrap;
        }
        ZLanguage::bindModuleDomain($module);
        $results[$module['module']] = false;
        // #6048 - prevent trying to install modules which are contained in an install type, but are not available physically
        if (!file_exists('system/' . $module['module'] . '/') && !file_exists('modules/' . $module['module'] . '/')) {
            continue;
        }
        $mid = ModUtil::getIdFromName($module['module']);
        // init it
        if (ModUtil::apiFunc('ExtensionsModule', 'admin', 'initialise', array('id' => $mid)) == true) {
            // activate it
            if (ModUtil::apiFunc('ExtensionsModule', 'admin', 'setstate', array('id' => $mid, 'state' => ModUtil::STATE_ACTIVE))) {
                $results[$module['module']] = true;
            }
            // Set category
            ModUtil::apiFunc('AdminModule', 'admin', 'addmodtocategory', array('module' => $module['module'], 'category' => $modscat[$module['category']]));
        }
    }
    System::setVar('language_i18n', $lang);
    return $results;
}
コード例 #10
0
ファイル: boot.php プロジェクト: BGCX261/zoombi-svn-to-git
 /**
  * Load helper file
  * @param string $a_helper
  * @return string
  */
 public static final function helper($a_helper)
 {
     $v = null;
     try {
         $v = ZLoader::helper($a_helper);
     } catch (ZHelperException $e) {
         if (Zoombi::getApplication()->isMode(ZApplication::MODE_DEBUG)) {
             throw $e;
         }
     } catch (Exception $e) {
         if (Zoombi::getApplication()->isMode(ZApplication::MODE_DEBUG)) {
             throw $e;
         }
     }
     return $v;
 }
コード例 #11
0
ファイル: boot.php プロジェクト: BGCX261/zoombi-svn-to-git
 public static final function &factory($a_name)
 {
     ZLoader::getInstance()->factory($a_name);
 }
コード例 #12
0
ファイル: ModUtil.php プロジェクト: projectesIF/Sirius
 /**
  * Register all autoloaders for all modules.
  *
  * @internal
  *
  * @return void
  */
 public static function registerAutoloaders()
 {
     $modules = self::getModsTable();
     unset($modules[0]);
     foreach ($modules as $module) {
         $base = $module['type'] == self::TYPE_MODULE ? 'modules' : 'system';
         $path = "{$base}/{$module['directory']}/lib";
         ZLoader::addAutoloader($module['directory'], $path);
     }
 }
コード例 #13
0
ファイル: bootstrap.php プロジェクト: rtznprmpftl/Zikulacore
<?php

/**
 * Copyright Zikula Foundation 2009 - Zikula Application Framework
 *
 * This work is contributed to the Zikula Foundation under one or more
 * Contributor Agreements and licensed to You under the following license:
 *
 * @license GNU/LGPLv3 (or at your option, any later version).
 * @package Zikula
 *
 * Please see the NOTICE file distributed with this source code for further
 * information regarding copyright and licensing.
 */
$bootstrap = file_exists(__DIR__ . '/bootstrap.php.cache') ? __DIR__ . '/bootstrap.php.cache' : __DIR__ . '/autoload.php';
require_once $bootstrap;
require_once __DIR__ . '/AppKernel.php';
require_once __DIR__ . '/AppCache.php';
require_once __DIR__ . '/../src/legacy/ZLoader.php';
ZLoader::register();
コード例 #14
0
ファイル: object.php プロジェクト: BGCX261/zoombi-svn-to-git
 public function __get($a_property)
 {
     switch ($a_property) {
         default:
             break;
         case 'application':
             return Zoombi::getApplication();
         case 'database':
             return Zoombi::getApplication()->getDatabase();
         case 'registry':
             return Zoombi::getApplication()->getRegistry();
         case 'language':
             return Zoombi::getApplication()->getLanguage();
         case 'router':
             return Zoombi::getApplication()->getRouter();
         case 'load':
             return ZLoader::getInstance();
         case 'name':
             return $this->getName();
     }
     return $this->getProperty($a_property);
 }
コード例 #15
0
 /**
  * Add plugin to stack
  * @param mixed $a_plugin
  * @return ZPluginManager
  */
 public final function &addPlugin($a_plugin, $a_connectall = true)
 {
     $plg = $a_plugin;
     if (is_string($a_plugin)) {
         $plg = ZLoader::plugin($a_plugin);
     }
     if ($plg instanceof ZPlugin) {
         $this->addChildren($plg);
         $this->m_plugins[] =& $plg;
     }
     return $this;
 }
コード例 #16
0
 /**
  * Upgrade a module.
  *
  * @param array $args All parameters passed to this function.
  *                      numeric $args['id']                  The module ID.
  *                      boolean $args['interactive_upgrade'] Whether or not to upgrade in interactive mode.
  *
  * @return boolean True on success, false on failure.
  */
 public function upgrade($args)
 {
     // Argument check
     if (!isset($args['id']) || !is_numeric($args['id'])) {
         return LogUtil::registerArgsError();
     }
     // Get module information
     $modinfo = ModUtil::getInfo($args['id']);
     if (empty($modinfo)) {
         return LogUtil::registerError($this->__('Error! No such module ID exists.'));
     }
     switch ($modinfo['state']) {
         case ModUtil::STATE_NOTALLOWED:
             return LogUtil::registerError($this->__f('Error! No permission to upgrade %s.', $modinfo['name']));
             break;
         default:
             if ($modinfo['state'] > 10) {
                 return LogUtil::registerError($this->__f('Error! %s is not compatible with this version of Zikula.', $modinfo['name']));
             }
     }
     $osdir = DataUtil::formatForOS($modinfo['directory']);
     ModUtil::dbInfoLoad($modinfo['name'], $osdir);
     $modpath = $modinfo['type'] == ModUtil::TYPE_SYSTEM ? 'system' : 'modules';
     // load module maintainence functions
     $oomod = ModUtil::isOO($modinfo['name']);
     if ($oomod) {
         ZLoader::addAutoloader($osdir, "{$modpath}/{$osdir}/lib");
     }
     $bootstrap = "{$modpath}/{$osdir}/bootstrap.php";
     if (file_exists($bootstrap)) {
         include_once $bootstrap;
     }
     if ($modinfo['type'] == ModUtil::TYPE_MODULE) {
         if (is_dir("modules/{$osdir}/locale")) {
             ZLanguage::bindModuleDomain($modinfo['name']);
         }
     }
     if (!$oomod && file_exists($file = "{$modpath}/{$osdir}/pninit.php")) {
         if (!(include_once $file)) {
             LogUtil::registerError($this->__f("Error! Could not load a required file: '%s'.", $file));
         }
     }
     if ($oomod) {
         $className = ucwords($modinfo['name']) . '_Installer';
         $reflectionInstaller = new ReflectionClass($className);
         if (!$reflectionInstaller->isSubclassOf('Zikula_AbstractInstaller')) {
             LogUtil::registerError($this->__f("%s must be an instance of Zikula_AbstractInstaller", $className));
         }
         $installer = $reflectionInstaller->newInstanceArgs(array($this->serviceManager));
         $interactiveClass = ucwords($modinfo['name']) . '_Controller_Interactiveinstaller';
         $interactiveController = null;
         if (class_exists($interactiveClass)) {
             $reflectionInteractive = new ReflectionClass($interactiveClass);
             if (!$reflectionInteractive->isSubclassOf('Zikula_Controller_AbstractInteractiveInstaller')) {
                 LogUtil::registerError($this->__f("%s must be an instance of Zikula_Controller_AbstractInteractiveInstaller", $className));
             }
             $interactiveController = $reflectionInteractive->newInstance($this->serviceManager);
         }
     }
     // perform the actual upgrade of the module
     $func = $oomod ? array($installer, 'upgrade') : $modinfo['name'] . '_upgrade';
     $interactive_func = $oomod ? array($interactiveController, 'upgrade') : $modinfo['name'] . '_init_interactiveupgrade';
     // allow bypass of interactive upgrade during a new installation only.
     if (System::isInstalling() && is_callable($interactive_func) && !is_callable($func)) {
         return;
         // return void here
     }
     if (isset($args['interactive_upgrade']) && $args['interactive_upgrade'] == false && is_callable($interactive_func)) {
         if (is_array($interactive_func)) {
             // This must be an OO controller since callable is an array.
             // Because interactive installers extend the Zikula_AbstractController, is_callable will always return true because of the __call()
             // so we must check if the method actually exists by reflection - drak
             if ($reflectionInteractive->hasMethod('upgrade')) {
                 SessionUtil::setVar('interactive_upgrade', true);
                 return call_user_func($interactive_func, array('oldversion' => $modinfo['version']));
             }
         } else {
             // this is enclosed in the else so that if both conditions fail, execution will pass onto the non-interactive execution below.
             SessionUtil::setVar('interactive_upgrade', true);
             return call_user_func($interactive_func, array('oldversion' => $modinfo['version']));
         }
     }
     // non-interactive
     if (is_callable($func)) {
         $result = call_user_func($func, $modinfo['version']);
         if (is_string($result)) {
             if ($result != $modinfo['version']) {
                 // update the last successful updated version
                 $modinfo['version'] = $result;
                 $obj = DBUtil::updateObject($modinfo, 'modules', '', 'id', true);
             }
             return false;
         } elseif ($result != true) {
             return false;
         }
     }
     $modversion['version'] = '0';
     $modversion = Extensions_Util::getVersionMeta($osdir, $modpath);
     $version = $modversion['version'];
     // Update state of module
     $result = $this->setState(array('id' => $args['id'], 'state' => ModUtil::STATE_ACTIVE));
     if ($result) {
         LogUtil::registerStatus($this->__("Done! Module has been upgraded. Its status is now 'Active'."));
     } else {
         return false;
     }
     // Note the changes in the database...
     // Get module database info
     ModUtil::dbInfoLoad('Extensions');
     $obj = array('id' => $args['id'], 'version' => $version);
     DBUtil::updateObject($obj, 'modules');
     // legacy to be removed from 1.4 - remove hooks during upgrade since we cannot rely on
     // module authors to do this - drak
     if ($oomod) {
         $tables = DBUtil::getTables();
         $hooksCol = $tables['hooks_column'];
         $where = "{$hooksCol['smodule']} = '{$modinfo['name']}' OR {$hooksCol['tmodule']} = '{$modinfo['name']}'";
         $hooks = DBUtil::selectObjectArray('hooks', $where);
         if ($hooks) {
             foreach ($hooks as $hook) {
                 DBUtil::deleteObject($hook, 'hooks');
             }
             LogUtil::registerStatus($this->__f("NOTICE! Legacy hook configurations for %s have been removed.", $modinfo['name']));
         }
     }
     // Upgrade succeeded, issue event.
     $event = new Zikula_Event('installer.module.upgraded', null, $modinfo);
     $this->eventManager->notify($event);
     // Success
     return true;
 }
コード例 #17
0
ファイル: boot.php プロジェクト: BGCX261/zoombi-svn-to-git
 /**
  * Library class loader
  * @param $a_path
  * @return bool True if load success
  */
 public static final function import($a_path)
 {
     return ZLoader::library($a_path);
 }
コード例 #18
0
ファイル: ZLoader.php プロジェクト: rmaiwald/core
 /**
  * Base setup.
  *
  * @param $autoloader
  *
  * @return void
  */
 public static function register($autoloader)
 {
     spl_autoload_register(array('ZLoader', 'autoload'));
     self::$autoloader = $autoloader;
 }
コード例 #19
0
ファイル: orig_upgrade.php プロジェクト: Git-Host/AMPPS
 * This work is contributed to the Zikula Foundation under one or more
 * Contributor Agreements and licensed to You under the following license:
 *
 * @license GNU/LGPLv3 (or at your option, any later version).
 * @package Installer
 *
 * Please see the NOTICE file distributed with this source code for further
 * information regarding copyright and licensing.
 */
ini_set('mbstring.internal_encoding', 'UTF-8');
ini_set('default_charset', 'UTF-8');
mb_regex_encoding('UTF-8');
ini_set('memory_limit', '64M');
ini_set('max_execution_time', 86400);
include 'lib/bootstrap.php';
ZLoader::addAutoloader('Users', 'system/Users/lib', '_');
include_once __DIR__ . '/plugins/Doctrine/Plugin.php';
// check if the config.php was renewed
if (!isset($GLOBALS['ZConfig']['Log']['log.to_debug_toolbar'])) {
    echo __('It seems to be that your config.php is outdated. Please check the release notes for more information.');
    die;
}
PluginUtil::loadPlugin('SystemPlugin_Doctrine_Plugin');
$eventManager = $core->getEventManager();
$eventManager->attach('core.init', 'upgrade_suppressErrors');
// load zikula core
define('_ZINSTALLVER', Zikula_Core::VERSION_NUM);
define('_Z_MINUPGVER', '1.2.0');
// Signal that upgrade is running.
$GLOBALS['_ZikulaUpgrader'] = array();
// include config file for retrieving name of temporary directory
コード例 #20
0
ファイル: ModUtil.php プロジェクト: rmaiwald/core
 /**
  * Initialize object oriented module.
  *
  * @param string $moduleName Module name.
  *
  * @return boolean
  */
 public static function initOOModule($moduleName)
 {
     if (self::isInitialized($moduleName)) {
         return true;
     }
     $modinfo = self::getInfo(self::getIdFromName($moduleName));
     if (!$modinfo) {
         return false;
     }
     $modpath = $modinfo['type'] == self::TYPE_SYSTEM ? 'system' : 'modules';
     $osdir = DataUtil::formatForOS($modinfo['directory']);
     if (false === strpos($modinfo['directory'], '/')) {
         ZLoader::addAutoloader($moduleName, array(realpath("{$modpath}"), realpath("{$modpath}/{$osdir}/lib")));
     }
     // load optional bootstrap
     $bootstrap = "{$modpath}/{$osdir}/bootstrap.php";
     if (file_exists($bootstrap)) {
         include_once $bootstrap;
     }
     // register any event handlers.
     // module handlers must be attached from the bootstrap.
     if (is_dir("config/EventHandlers/{$osdir}")) {
         EventUtil::attachCustomHandlers("config/EventHandlers/{$osdir}");
     }
     // load any plugins
     PluginUtil::loadPlugins("{$modpath}/{$osdir}/plugins", "ModulePlugin_{$osdir}");
     self::$ooModules[$moduleName]['initialized'] = true;
     return true;
 }
コード例 #21
0
ファイル: SystemListeners.php プロジェクト: Silwereth/core
 /**
  * Adds an autoloader entry for the cached (generated) doctrine models.
  *
  * Implements 'core.init' events when Zikula_Core::STAGE_CONFIG.
  *
  * @param Zikula_Event $event Event.
  *
  * @return void
  */
 public function setupAutoloaderForGeneratedCategoryModels(Zikula_Event $event)
 {
     if ($event['stage'] == Zikula_Core::STAGE_CONFIG) {
         ZLoader::addAutoloader('GeneratedDoctrineModel', CacheUtil::getLocalDir('doctrinemodels'));
     }
 }
コード例 #22
0
ファイル: loader.php プロジェクト: BGCX261/zoombi-svn-to-git
 /**
  * Load from library
  * @param string $a_path
  * @return bool True if load success else return false
  */
 public static final function library($a_path)
 {
     $i = ZLoader::getInstance();
     if (key_exists($a_path, $i->m_library)) {
         return true;
     }
     $i->m_library[$a_path] = true;
     $exp_path = explode('.', $a_path);
     $classname = array_pop($exp_path);
     $i->emit(new ZEvent($i, 'onLibrary', $classname));
     if ($exp_path[0] == 'zoombi') {
         array_shift($exp_path);
         $new_path = array();
         foreach ($exp_path as $p) {
             array_push($new_path, ucwords($p));
         }
         $exp_path = $new_path;
         $new_path = is_array($exp_path) ? implode(Zoombi::DS, $exp_path) : $exp_path;
         $filename = Zoombi::fromFrameworkDir($new_path . Zoombi::DS . strtolower($classname) . '.php');
         $code = null;
         if (file_exists($filename)) {
             $code = (include_once $filename);
         }
         if ($code != -1) {
             $i->emit(new ZEvent($i, 'onLibrarySucess', $classname));
             return true;
         }
     } else {
         $new_path = implode(Zoombi::DS, $exp_path);
         $filename = Zoombi::fromFrameworkDir($new_path . Zoombi::DS . $classname . '.php');
         $code = $this->loadFile($filename);
         if ($code) {
             if (class_exists($classname)) {
                 $i->emit(new ZEvent($i, 'onLibrarySucess', $classname));
             }
             return true;
         }
     }
     $i->emit(new ZEvent($i, 'onLibraryFailed', $classname));
     return false;
 }
コード例 #23
0
ファイル: bootstrap.php プロジェクト: projectesIF/Sirius
/**
 * Copyright Zikula Foundation 2009 - Zikula Application Framework
 *
 * This work is contributed to the Zikula Foundation under one or more
 * Contributor Agreements and licensed to You under the following license:
 *
 * @license GNU/LGPLv3 (or at your option, any later version).
 * @package Zikula
 *
 * Please see the NOTICE file distributed with this source code for further
 * information regarding copyright and licensing.
 */

if (!defined('HTMLPURIFIER_PREFIX')) {
    define('HTMLPURIFIER_PREFIX', realpath(dirname(__FILE__) . '/lib/vendor/htmlpurifier'));
}

if (!defined('PHPIDS_PATH_PREFIX')) {
    define('PHPIDS_PATH_PREFIX', realpath(dirname(__FILE__) . '/lib/vendor/IDS'));
}

// include the PHPIDS and get access to the result object
set_include_path(get_include_path() . PATH_SEPARATOR . realpath(dirname(__FILE__) .'/lib/vendor'));
ZLoader::addAutoloader('HTMLPurifier', realpath(dirname(__FILE__) . '/lib/vendor/htmlpurifier'));
ZLoader::addAutoloader('IDS', realpath(dirname(__FILE__) . '/lib/vendor'));

// register event handlers
//EventUtil::attachCustomHandlers('system/SecurityCenter/lib/SecurityCenter/EventHandler');
EventUtil::attachEventHandler('SecurityCenter_EventHandler_Filter');

コード例 #24
0
 private function _processRoute(ZRoute &$a_route, &$a_code, &$a_message)
 {
     $ctl = null;
     if (!$a_route->controller) {
         $a_route->controller = $this->m_config->getValue('controller.default_name', 'index');
     }
     if (!$a_route->action) {
         $a_route->action = $this->m_config->getValue('controller.default_action', 'index');
     }
     try {
         $ctl = ZLoader::controller($a_route->getController());
     } catch (ZControllerException $e) {
         $a_code = $e->getCode();
         $a_message = $e->getMessage();
         return false;
     }
     if (!$ctl) {
         return false;
     }
     $this->setController($ctl);
     return true;
 }