/**
     * Vetos (denies) a login attempt, and forces the user to change his password.
     *
     * This handler is triggered by the 'user.login.veto' event.  It vetos (denies) a
     * login attempt if the users's account record is flagged to force the user to change
     * his password maintained by the Users module. If the user does not maintain a
     * password on his Users account (e.g., he registered with and logs in with a Google
     * Account or an OpenID, and never established a Users password), then this handler
     * will not trigger a change of password.
     *
     * @param Zikula_Event $event The event that triggered this handler.
     *
     * @return void
     */
    public static function forcedPasswordChangeListener(Zikula_Event $event)
    {
        $userObj = $event->getSubject();

        $userMustChangePassword = UserUtil::getVar('_Users_mustChangePassword', $userObj['uid'], false);

        if ($userMustChangePassword && ($userObj['pass'] != Users_Constant::PWD_NO_USERS_AUTHENTICATION)) {
            $event->stop();
            $event->setData(array(
                'redirect_func'  => array(
                    'modname'   => self::$modname,
                    'type'      => 'user',
                    'func'      => 'changePassword',
                    'args'      => array(
                        'login'     => true,
                    ),
                    'session'   => array(
                        'var'       => 'Users_Controller_User_changePassword',
                        'namespace' => 'Zikula_Users',
                    )
                ),
            ));

            LogUtil::registerError(__("Your log-in request was not completed. You must change your web site account's password first."));
        }
    }
 /**
  * Event handler here.
  *
  * @param Zikula_Event $event Event handler.
  *
  * @return void
  */
 public function handler(Zikula_Event $event)
 {
     if (array_key_exists($event->data, $this->overrideMap)) {
         $event->data = $this->overrideMap[$event->data];
         $event->stop();
     }
 }
Esempio n. 3
0
 public static function getTypes(Zikula_Event $event)
 {
     $types = $event->getSubject();
     // add content types
     $types->add('Content_ContentType_Author');
     $types->add('Content_ContentType_Block');
     $types->add('Content_ContentType_Breadcrumb');
     $types->add('Content_ContentType_Camtasia');
     $types->add('Content_ContentType_ComputerCode');
     $types->add('Content_ContentType_ContentItem');
     $types->add('Content_ContentType_TableOfContents');
     $types->add('Content_ContentType_FlashMovie');
     $types->add('Content_ContentType_Flickr');
     $types->add('Content_ContentType_GoogleMap');
     $types->add('Content_ContentType_Heading');
     $types->add('Content_ContentType_Html');
     $types->add('Content_ContentType_JoinPosition');
     $types->add('Content_ContentType_ModuleFunc');
     $types->add('Content_ContentType_OpenStreetMap');
     $types->add('Content_ContentType_PageNavigation');
     $types->add('Content_ContentType_Quote');
     $types->add('Content_ContentType_Rss');
     $types->add('Content_ContentType_Slideshare');
     $types->add('Content_ContentType_TabNavigation');
     $types->add('Content_ContentType_Unfiltered');
     $types->add('Content_ContentType_Vimeo');
     $types->add('Content_ContentType_YouTube');
     // add layout types
     $types->add('Content_LayoutType_Column1');
     $types->add('Content_LayoutType_Column1woheader');
     $types->add('Content_LayoutType_Column1top');
     $types->add('Content_LayoutType_Column2header');
     $types->add('Content_LayoutType_Column2d2575');
     $types->add('Content_LayoutType_Column2d3070');
     $types->add('Content_LayoutType_Column2d3366');
     $types->add('Content_LayoutType_Column2d3862');
     $types->add('Content_LayoutType_Column2d6238');
     $types->add('Content_LayoutType_Column2d6633');
     $types->add('Content_LayoutType_Column2d7030');
     $types->add('Content_LayoutType_Column2d7525');
     $types->add('Content_LayoutType_Column3header');
     $types->add('Content_LayoutType_Column3d252550');
     $types->add('Content_LayoutType_Column3d255025');
     $types->add('Content_LayoutType_Column3d502525');
     $types->add('Content_LayoutType_Column4d25252525');
     $types->add('Content_LayoutType_Column212');
     $types->add('Content_LayoutType_Column21212');
     $types->add('Content_LayoutType_Column21212rightcol');
     // add Twitter Bootstrap layout types
     $types->add('Content_LayoutType_BootstrapColumn2c6c6');
     $types->add('Content_LayoutType_BootstrapColumn2c8c4');
     $types->add('Content_LayoutType_BootstrapColumn2c4c8');
     $types->add('Content_LayoutType_BootstrapColumn3c4c4c4');
     $types->add('Content_LayoutType_BootstrapColumn3c6c3c3');
     $types->add('Content_LayoutType_BootstrapColumn3c3c6c3');
     $types->add('Content_LayoutType_BootstrapColumn3c3c3c6');
     $types->add('Content_LayoutType_BootstrapColumn4c3c3c3c3');
 }
Esempio n. 4
0
 /**
  * Listener for the `module.content.gettypes` event.
  *
  * This event occurs when the Content module is 'searching' for Content plugins.
  * The subject is an instance of Content_Types.
  * You can register custom content types as well as custom layout types.
  *
  * @param Zikula_Event $event The event instance.
  */
 public static function contentGetTypes(Zikula_Event $event)
 {
     // intended is using the add() method to add a plugin like below
     $types = $event->getSubject();
     // plugin for showing a single item
     $types->add('Reviews_ContentType_Item');
     // plugin for showing a list of multiple items
     $types->add('Reviews_ContentType_ItemList');
 }
Esempio n. 5
0
 /**
  * Event handler here.
  *
  * @param Zikula_Event $event Event handler.
  *
  * @return void
  */
 public function handler(Zikula_Event $event)
 {
     // check if this is for this handler
     if (!($event->getSubject() instanceof Users_Api_Admin && $event['modfunc'][1] == 'getlinks')) {
         return;
     }
     if (SecurityUtil::checkPermission('Users::', '::', ACCESS_ADMIN)) {
         $event->data[] = array('url' => ModUtil::url('Users', 'admin', 'somelink'), 'text' => __('Here is another link'));
     }
 }
Esempio n. 6
0
 /**
  * On an module remove hook call this listener
  *
  * Listens for the 'user.account.create' event.
  *
  * @param Zikula_Event $event Event.
  */
 public static function onCreateUser(Zikula_Event $event)
 {
     if (!ModUtil::getVar('Dashboard', 'widgetsnewuser', false)) {
         return;
     }
     $user = $event->getSubject();
     $helper = new Dashboard_Helper_WidgetHelper(ServiceUtil::getService('doctrine.entitymanager'));
     $widgets = $helper->getRegisteredWidgets($user['uid']);
     foreach ($widgets as $widget) {
         Dashboard_Util::addUserWidget($user['uid'], $widget);
     }
 }
Esempio n. 7
0
 /**
  * Add 'anotherfunction' Event handler .
  *
  * @param Zikula_Event $event Handler.
  *
  * @return void
  */
 public function anotherfunction(Zikula_Event $event)
 {
     // check if this is for this handler
     $subject = $event->getSubject();
     if (!($event['method'] == 'anotherfunction' && $subject instanceof Users_Controller_Admin)) {
         return;
     }
     if (!SecurityUtil::checkPermission('Users::', '::', ACCESS_ADMIN)) {
         return LogUtil::registerPermissionError();
     }
     $view = Zikula_View_plugin::getModulePluginInstance($this->moduleName, $this->pluginName);
     $event->setData($view->fetch('anotherfunction.tpl'));
     $event->stop();
 }
Esempio n. 8
0
    /**
     * Clears the session variable namespace used by the Users module.
     *
     * Triggered by the 'user.logout.succeeded' and 'frontcontroller.exception' events.
     *
     * This is to ensure no leakage of authentication information across sessions or between critical
     * errors. This prevents, for example, the login process from becoming confused about its state
     * if it detects session variables containing authentication information which might make it think
     * that a re-attempt is in progress.
     *
     * @param Zikula_Event $event The event that triggered this handler.
     *
     * @return void
     */
    public static function clearUsersNamespaceListener(Zikula_Event $event)
    {
        $eventName = $event->getName();
        $modinfo = $event->hasArg('modinfo') ? $event->getArg('modinfo') : array();

        $doClear = ($eventName == 'user.logout.succeeded') || (($eventName == 'frontcontroller.exception')
                && isset($modinfo) && is_array($modinfo) && !empty($modinfo) && !isset($modinfo['name']) && ($modinfo['name'] == self::$modname));

        if ($doClear) {
            $serviceManager = ServiceUtil::getManager();
            $session = $serviceManager->getService('session');
            $session->clearNamespace('Zikula_Users');
            //Do not setNotified. Not handling the exception, just reacting to it.
        }
    }
Esempio n. 9
0
 /**
  * Listener for the `user.account.delete` event.
  *
  * Occurs after a user is deleted from the system.
  * All handlers are notified.
  * The full user record deleted is available as the subject.
  * This is a storage-level event, not a UI event. It should not be used for UI-level actions such as redirects.
  * The subject of the event is set to the user record that is being deleted.
  *
  * @param Zikula_Event $event The event instance.
  */
 public static function delete(Zikula_Event $event)
 {
     ModUtil::initOOModule('Reviews');
     $userRecord = $event->getSubject();
     $uid = $userRecord['uid'];
     $serviceManager = ServiceUtil::getManager();
     $entityManager = $serviceManager->getService('doctrine.entitymanager');
     $repo = $entityManager->getRepository('Reviews_Entity_Review');
     // delete all reviews created by this user
     $repo->deleteCreator($uid);
     // note you could also do: $repo->updateCreator($uid, 2);
     // set last editor to admin (2) for all reviews updated by this user
     $repo->updateLastEditor($uid, 2);
     // note you could also do: $repo->deleteLastEditor($uid);
 }
Esempio n. 10
0
 /**
  * Event handler.
  *
  * @param Zikula_Event $event Event.
  *
  * @return void
  */
 public function handler(Zikula_Event $event)
 {
     // subject must be an instance of Theme class.
     $theme = $event->getSubject();
     if (!$theme instanceof Theme) {
         return;
     }
     // register output filter to add MultiHook environment if requried
     if (ModUtil::available('MultiHook')) {
         $modinfo = ModUtil::getInfoFromName('MultiHook');
         if (version_compare($modinfo['version'], '5.0', '>=') == 1) {
             $theme->load_filter('output', 'multihook');
             ModUtil::apiFunc('MultiHook', 'theme', 'preparetheme');
         }
     }
 }
Esempio n. 11
0
    /**
     * Respond to 'get.pending_content' events with registration requests pending approval.
     *
     * When a 'get.pending_content' event is fired, the Users module will respond with the
     * number of registration requests that are pending administrator approval. The number
     * pending may not equal the total number of outstanding registration requests, depending
     * on how the 'moderation_order' module configuration variable is set, and whether e-mail
     * address verification is required.
     *
     * If the 'moderation_order' variable is set to require approval after e-mail verification
     * (and e-mail verification is also required) then the number of pending registration
     * requests will equal the number of registration requested that have completed the
     * verification process but have not yet been approved. For other values of
     * 'moderation_order', the number should equal the number of registration requests that
     * have not yet been approved, without regard to their current e-mail verification state.
     * If moderation of registrations is not enabled, then the value will always be 0.
     *
     * In accordance with the 'get_pending_content' conventions, the count of pending
     * registrations, along with information necessary to access the detailed list, is
     * assemped as a {@link Zikula_Provider_AggregateItem} and added to the event
     * subject's collection.
     *
     * @param Zikula_Event $event The event that was fired, a 'get_pending_content' event.
     *
     * @return void
     */
    public static function pendingContentListener(Zikula_Event $event)
    {
        if (SecurityUtil::checkPermission('Users::', '::', ACCESS_MODERATE)) {
            $approvalOrder = ModUtil::getVar(self::$modname, 'moderation_order', Users_Constant::APPROVAL_ANY);
            if ($approvalOrder == Users_Constant::APPROVAL_AFTER) {
                $numPendingApproval = ModUtil::apiFunc(self::$modname, 'registration', 'countAll', array('filter' => array('approved_by' => 0, 'isverified' => true)));
            } else {
                $numPendingApproval = ModUtil::apiFunc(self::$modname, 'registration', 'countAll', array('filter' => array('approved_by' => 0)));
            }

            if (!empty($numPendingApproval)) {
                $collection = new Zikula_Collection_Container(self::$modname);
                $collection->add(new Zikula_Provider_AggregateItem('registrations', __('Registrations pending approval'), $numPendingApproval, 'admin', 'viewRegistrations'));
                $event->getSubject()->add($collection);
            }
        }
    }
Esempio n. 12
0
 /**
  * Event handler here.
  *
  * @param Zikula_Event $event Event handler.
  *
  * @return void
  */
 public function handler(Zikula_Event $event)
 {
     // check if this is for this handler
     $subject = $event->getSubject();
     if (!($event['method'] == 'extensions' && $subject instanceof Users_Controller_Admin)) {
         return;
     }
     if (!SecurityUtil::checkPermission('Users::', '::', ACCESS_ADMIN)) {
         return LogUtil::registerPermissionError();
     }
     // Zikula Modules and Themes versions
     $view = Zikula_View::getInstance('Users');
     $view->assign('mods', ModuleUtil::getModules());
     $view->assign('themes', ThemeUtil::getAllThemes());
     $event->setData($view->fetch('users_admin_extensions.tpl'));
     $event->stop();
 }
Esempio n. 13
0
 /**
  * Listener for the `user.account.delete` event.
  *
  * Occurs after a user is deleted from the system.
  * All handlers are notified.
  * The full user record deleted is available as the subject.
  * This is a storage-level event, not a UI event. It should not be used for UI-level actions such as redirects.
  * The subject of the event is set to the user record that is being deleted.
  *
  * @param Zikula_Event $event The event instance.
  */
 public static function delete(Zikula_Event $event)
 {
     ModUtil::initOOModule('MUVideo');
     $userRecord = $event->getSubject();
     $uid = $userRecord['uid'];
     $serviceManager = ServiceUtil::getManager();
     $entityManager = $serviceManager->getService('doctrine.entitymanager');
     $repo = $entityManager->getRepository('MUVideo_Entity_Collection');
     // set creator to admin (2) for all collections created by this user
     $repo->updateCreator($uid, 2);
     // set last editor to admin (2) for all collections updated by this user
     $repo->updateLastEditor($uid, 2);
     $repo = $entityManager->getRepository('MUVideo_Entity_Movie');
     // set creator to admin (2) for all movies created by this user
     $repo->updateCreator($uid, 2);
     // set last editor to admin (2) for all movies updated by this user
     $repo->updateLastEditor($uid, 2);
 }
Esempio n. 14
0
 /**
  * Dynamically add menu links to administration for system services.
  *
  * Listens for 'module_dispatch.postexecute' events.
  *
  * @param Zikula_Event $event The event handler.
  *
  * @return void
  */
 public function addServiceLink(Zikula_Event $event)
 {
     // check if this is for this handler
     if (!($event['modfunc'][1] == 'getLinks' && $event['type'] == 'admin' && $event['api'] == true)) {
         return;
     }
     // notify EVENT here to gather any system service links
     $args = array('modname' => $event->getArgument('modname'));
     $localevent = new \Zikula\Core\Event\GenericEvent($event->getSubject(), $args);
     $this->eventManager->dispatch('module_dispatch.service_links', $localevent);
     $sublinks = $localevent->getData();
     if (!empty($sublinks)) {
         $event->data[] = array('url' => $this->getContainer()->get('router')->generate('zikulaextensionsmodule_admin_moduleservices', array('moduleName' => $event['modname'])), 'text' => __('Services'), 'icon' => 'cogs', 'links' => $sublinks);
     }
 }
Esempio n. 15
0
 /**
  * Initialise Zikula.
  *
  * Carries out a number of initialisation tasks to get Zikula up and
  * running.
  *
  * @param integer $stage Stage to load.
  *
  * @return boolean True initialisation successful false otherwise.
  */
 public function init($stage = self::STAGE_ALL)
 {
     $coreInitEvent = new Zikula_Event('core.init', $this);
     // store the load stages in a global so other API's can check whats loaded
     $this->stage = $this->stage | $stage;
     if ($stage & self::STAGE_PRE && $this->stage & ~self::STAGE_PRE) {
         ModUtil::flushCache();
         System::flushCache();
         $this->eventManager->notify(new Zikula_Event('core.preinit', $this));
     }
     // Initialise and load configuration
     if ($stage & self::STAGE_CONFIG) {
         if (System::isLegacyMode()) {
             require_once 'lib/legacy/Compat.php';
         }
         // error reporting
         if (!System::isInstalling()) {
             // this is here because it depends on the config.php loading.
             $event = new Zikula_Event('setup.errorreporting', null, array('stage' => $stage));
             $this->eventManager->notify($event);
         }
         // initialise custom event listeners from config.php settings
         $coreInitEvent->setArg('stage', self::STAGE_CONFIG);
         $this->eventManager->notify($coreInitEvent);
     }
     // Check that Zikula is installed before continuing
     if (System::getVar('installed') == 0 && !System::isInstalling()) {
         System::redirect(System::getBaseUrl() . 'install.php?notinstalled');
         System::shutDown();
     }
     if ($stage & self::STAGE_DB) {
         try {
             $dbEvent = new Zikula_Event('core.init', $this, array('stage' => self::STAGE_DB));
             $this->eventManager->notify($dbEvent);
         } catch (PDOException $e) {
             if (!System::isInstalling()) {
                 header('HTTP/1.1 503 Service Unavailable');
                 require_once System::getSystemErrorTemplate('dbconnectionerror.tpl');
                 System::shutDown();
             } else {
                 return false;
             }
         }
     }
     if ($stage & self::STAGE_TABLES) {
         // Initialise dbtables
         ModUtil::dbInfoLoad('Extensions', 'Extensions');
         ModUtil::initCoreVars();
         ModUtil::dbInfoLoad('Settings', 'Settings');
         ModUtil::dbInfoLoad('Theme', 'Theme');
         ModUtil::dbInfoLoad('Users', 'Users');
         ModUtil::dbInfoLoad('Groups', 'Groups');
         ModUtil::dbInfoLoad('Permissions', 'Permissions');
         ModUtil::dbInfoLoad('Categories', 'Categories');
         if (!System::isInstalling()) {
             ModUtil::registerAutoloaders();
         }
         $coreInitEvent->setArg('stage', self::STAGE_TABLES);
         $this->eventManager->notify($coreInitEvent);
     }
     if ($stage & self::STAGE_SESSIONS) {
         SessionUtil::requireSession();
         $coreInitEvent->setArg('stage', self::STAGE_SESSIONS);
         $this->eventManager->notify($coreInitEvent);
     }
     // Have to load in this order specifically since we cant setup the languages until we've decoded the URL if required (drak)
     // start block
     if ($stage & self::STAGE_LANGS) {
         $lang = ZLanguage::getInstance();
     }
     if ($stage & self::STAGE_DECODEURLS) {
         System::queryStringDecode();
         $coreInitEvent->setArg('stage', self::STAGE_DECODEURLS);
         $this->eventManager->notify($coreInitEvent);
     }
     if ($stage & self::STAGE_LANGS) {
         $lang->setup();
         $coreInitEvent->setArg('stage', self::STAGE_LANGS);
         $this->eventManager->notify($coreInitEvent);
     }
     // end block
     if ($stage & self::STAGE_MODS) {
         // Set compression on if desired
         if (System::getVar('UseCompression') == 1) {
             //ob_start("ob_gzhandler");
         }
         ModUtil::load('SecurityCenter');
         $coreInitEvent->setArg('stage', self::STAGE_MODS);
         $this->eventManager->notify($coreInitEvent);
     }
     if ($stage & self::STAGE_THEME) {
         // register default page vars
         PageUtil::registerVar('title');
         PageUtil::setVar('title', System::getVar('defaultpagetitle'));
         PageUtil::registerVar('keywords', true);
         PageUtil::registerVar('stylesheet', true);
         PageUtil::registerVar('javascript', true);
         PageUtil::registerVar('jsgettext', true);
         PageUtil::registerVar('body', true);
         PageUtil::registerVar('header', true);
         PageUtil::registerVar('footer', true);
         $theme = Zikula_View_Theme::getInstance();
         // set some defaults
         // Metadata for SEO
         $this->serviceManager['zikula_view.metatags']['description'] = System::getVar('defaultmetadescription');
         $this->serviceManager['zikula_view.metatags']['keywords'] = System::getVar('metakeywords');
         $coreInitEvent->setArg('stage', self::STAGE_THEME);
         $this->eventManager->notify($coreInitEvent);
     }
     // check the users status, if not 1 then log him out
     if (UserUtil::isLoggedIn()) {
         $userstatus = UserUtil::getVar('activated');
         if ($userstatus != Users_Constant::ACTIVATED_ACTIVE) {
             UserUtil::logout();
             // TODO - When getting logged out this way, the existing session is destroyed and
             //        then a new one is created on the reentry into index.php. The message
             //        set by the registerStatus call below gets lost.
             LogUtil::registerStatus(__('You have been logged out.'));
             System::redirect(ModUtil::url('Users', 'user', 'login'));
         }
     }
     if ($stage & self::STAGE_POST && $this->stage & ~self::STAGE_POST) {
         $this->eventManager->notify(new Zikula_Event('core.postinit', $this, array('stages' => $stage)));
     }
 }
Esempio n. 16
0
 /**
  * Event listener for module.postexecute.
  *
  * @param Zikula_Event $event Event.
  *
  * @return void
  */
 public function modexecPost(Zikula_Event $event)
 {
     if (count($this->_stack) == 0) {
         return;
     }
     // pos to last stack entry
     $stackPos = count($this->_stack) - 1;
     // extract value of stack entry
     $lastExecPos = $this->_stack[$stackPos];
     // remove from stack
     unset($this->_stack[$stackPos]);
     $this->_stack = array_values($this->_stack);
     // calculate time
     $startTime = $this->_executions[$lastExecPos]['time'];
     $this->_executions[$lastExecPos]['time'] = (microtime(true) - $startTime) * 1000;
     $this->_executions[$lastExecPos]['level'] = count($this->_stack);
     $this->_executions[$lastExecPos]['data'] = $event->getData();
 }
Esempio n. 17
0
 /**
  * Run a module function.
  *
  * @param string  $modname    The name of the module.
  * @param string  $type       The type of function to run.
  * @param string  $func       The specific function to run.
  * @param array   $args       The arguments to pass to the function.
  * @param boolean $api        Whether or not to execute an API (or regular) function.
  * @param string  $instanceof Perform instanceof checking of target class.
  *
  * @throws Zikula_Exception_NotFound If method was not found.
  * @throws InvalidArgumentException  If the controller is not an instance of the class specified in $instanceof.
  *
  * @return mixed.
  */
 public static function exec($modname, $type = 'user', $func = 'main', $args = array(), $api = false, $instanceof = null)
 {
     // define input, all numbers and booleans to strings
     $modname = isset($modname) ? (string) $modname : '';
     $ftype = $api ? 'api' : '';
     $loadfunc = $api ? 'ModUtil::loadApi' : 'ModUtil::load';
     // validate
     if (!System::varValidate($modname, 'mod')) {
         return null;
     }
     // Remove from 1.4
     if (System::isLegacyMode() && $modname == 'Modules') {
         LogUtil::log(__('Warning! "Modules" module has been renamed to "Extensions".  Please update your ModUtil::func() and ModUtil::apiFunc() calls.'));
         $modname = 'Extensions';
     }
     $modinfo = self::getInfo(self::getIDFromName($modname));
     $path = $modinfo['type'] == self::TYPE_SYSTEM ? 'system' : 'modules';
     $controller = null;
     $modfunc = null;
     $loaded = call_user_func_array($loadfunc, array($modname, $type));
     if (self::isOO($modname)) {
         $result = self::getCallable($modname, $type, $func, $api);
         if ($result) {
             $modfunc = $result['callable'];
             $controller = $modfunc[0];
             if (!is_null($instanceof)) {
                 if (!$controller instanceof $instanceof) {
                     throw new InvalidArgumentException(__f('%1$s must be an instance of $2$s', array(get_class($controller), $instanceof)));
                 }
             }
         }
     }
     $modfunc = $modfunc ? $modfunc : "{$modname}_{$type}{$ftype}_{$func}";
     $eventManager = EventUtil::getManager();
     if ($loaded) {
         $preExecuteEvent = new Zikula_Event('module_dispatch.preexecute', $controller, array('modname' => $modname, 'modfunc' => $modfunc, 'args' => $args, 'modinfo' => $modinfo, 'type' => $type, 'api' => $api));
         $postExecuteEvent = new Zikula_Event('module_dispatch.postexecute', $controller, array('modname' => $modname, 'modfunc' => $modfunc, 'args' => $args, 'modinfo' => $modinfo, 'type' => $type, 'api' => $api));
         if (is_callable($modfunc)) {
             $eventManager->notify($preExecuteEvent);
             // Check $modfunc is an object instance (OO) or a function (old)
             if (is_array($modfunc)) {
                 if ($modfunc[0] instanceof Zikula_AbstractController) {
                     $reflection = call_user_func(array($modfunc[0], 'getReflection'));
                     $subclassOfReflection = new ReflectionClass($reflection->getParentClass());
                     if ($subclassOfReflection->hasMethod($modfunc[1])) {
                         // Don't allow front controller to access any public methods inside the controller's parents
                         throw new Zikula_Exception_NotFound();
                     }
                     $modfunc[0]->preDispatch();
                 }
                 $postExecuteEvent->setData(call_user_func($modfunc, $args));
                 if ($modfunc[0] instanceof Zikula_AbstractController) {
                     $modfunc[0]->postDispatch();
                 }
             } else {
                 $postExecuteEvent->setData($modfunc($args));
             }
             return $eventManager->notify($postExecuteEvent)->getData();
         }
         // get the theme
         if (ServiceUtil::getManager()->getService('zikula')->getStage() & Zikula_Core::STAGE_THEME) {
             $theme = ThemeUtil::getInfo(ThemeUtil::getIDFromName(UserUtil::getTheme()));
             if (file_exists($file = 'themes/' . $theme['directory'] . '/functions/' . $modname . "/{$type}{$ftype}/{$func}.php") || file_exists($file = 'themes/' . $theme['directory'] . '/functions/' . $modname . "/pn{$type}{$ftype}/{$func}.php")) {
                 include_once $file;
                 if (function_exists($modfunc)) {
                     EventUtil::notify($preExecuteEvent);
                     $postExecuteEvent->setData($modfunc($args));
                     return EventUtil::notify($postExecuteEvent)->getData();
                 }
             }
         }
         if (file_exists($file = "config/functions/{$modname}/{$type}{$ftype}/{$func}.php") || file_exists($file = "config/functions/{$modname}/pn{$type}{$ftype}/{$func}.php")) {
             include_once $file;
             if (is_callable($modfunc)) {
                 $eventManager->notify($preExecuteEvent);
                 $postExecuteEvent->setData($modfunc($args));
                 return $eventManager->notify($postExecuteEvent)->getData();
             }
         }
         if (file_exists($file = "{$path}/{$modname}/{$type}{$ftype}/{$func}.php") || file_exists($file = "{$path}/{$modname}/pn{$type}{$ftype}/{$func}.php")) {
             include_once $file;
             if (is_callable($modfunc)) {
                 $eventManager->notify($preExecuteEvent);
                 $postExecuteEvent->setData($modfunc($args));
                 return $eventManager->notify($postExecuteEvent)->getData();
             }
         }
         // try to load plugin
         // This kind of eventhandler should
         // 1. Check $event['modfunc'] to see if it should run else exit silently.
         // 2. Do something like $result = {$event['modfunc']}({$event['args'});
         // 3. Save the result $event->setData($result).
         // 4. $event->setNotify().
         // return void
         // This event means that no $type was found
         $event = new Zikula_Event('module_dispatch.type_not_found', null, array('modfunc' => $modfunc, 'args' => $args, 'modinfo' => $modinfo, 'type' => $type, 'api' => $api), false);
         $eventManager->notify($event);
         if ($preExecuteEvent->isStopped()) {
             return $preExecuteEvent->getData();
         }
         return false;
     }
     // Issue not found exception for controller requests
     if (!System::isLegacyMode() && !$api) {
         throw new Zikula_Exception_NotFound(__f('The requested controller action %s_Controller_%s::%s() could not be found', array($modname, $type, $func)));
     }
 }
Esempio n. 18
0
 /**
  * Configure Doctrine 1.x instance.
  *
  * Listens for 'doctrine.configure' events.
  * Subject is either Doctrine_Manager, Doctrine_Connection or Doctrine_Table.
  *
  * @param Zikula_Event $event Event.
  *
  * @return void
  */
 public function configureDoctrine(Zikula_Event $event)
 {
     $object = $event->getSubject();
     if ($object instanceof Doctrine_Manager) {
         // Cross-DBMS portability options
         // Modes are bitwised, so they can be combined using | and removed using ^.
         // See http://www.doctrine-project.org/documentation/manual/1_2/en/configuration#portability:portability-mode-attributes
         // Turn on all portability features (commented out as this is the default setting)
         $object->setAttribute('portability', Doctrine_Core::PORTABILITY_ALL);
         // Turn off identifier quoting, as it causes more problems than it solves
         // See http://www.doctrine-project.org/documentation/manual/1_2/en/configuration#identifier-quoting
         $object->setAttribute(Doctrine_Core::ATTR_QUOTE_IDENTIFIER, false);
         // What should be exported when exporting classes to the db
         // Modes are bitwised, so they can be combined using | and removed using ^.
         // See http://www.doctrine-project.org/documentation/manual/1_2/en/configuration#exporting
         $object->setAttribute(Doctrine_Core::ATTR_EXPORT, Doctrine_Core::EXPORT_ALL);
         // Validation attributes (default is VALIDATE_NONE)
         // Modes are bitwised, so they can be combined using | and removed using ^.
         // See http://www.doctrine-project.org/documentation/manual/1_2/en/configuration#naming-convention-attributes:validation-attributes
         // Turn on all validation functionality, at least while we are in development mode
         $object->setAttribute(Doctrine_Core::ATTR_VALIDATE, Doctrine_Core::VALIDATE_ALL);
         // naming convention of database related elements
         // affect importing schemas from the database to classes
         // as well as exporting classes into database tables.
         // Index names (default: [name]_idx)
         $object->setAttribute(Doctrine_Core::ATTR_IDXNAME_FORMAT, '%s');
         // Sequence names (default: [name]_seq)
         // $object->setAttribute(Doctrine_Core::ATTR_SEQNAME_FORMAT, '%s_sequence');
         // Database names
         // $object->setAttribute(Doctrine_Core::ATTR_DBNAME_FORMAT, 'myframework_%s');
         // Allow overriding of accessors
         $object->setAttribute(Doctrine_Core::ATTR_AUTO_ACCESSOR_OVERRIDE, true);
         // Enable auto loading of custom Doctrine_Table classes in addition to Doctrine_Record
         $object->setAttribute(Doctrine_Core::ATTR_AUTOLOAD_TABLE_CLASSES, true);
         // Set model loading strategy to conservative
         // see http://www.doctrine-project.org/documentation/manual/1_2/en/introduction-to-models#autoloading-models
         $object->setAttribute(Doctrine_Core::ATTR_MODEL_LOADING, Doctrine_Core::MODEL_LOADING_CONSERVATIVE);
         //$object->setAttribute(Doctrine_Core::ATTR_MODEL_LOADING, Doctrine_Core::MODEL_LOADING_AGGRESSIVE);
         // enable dql hooks (used by Categorisable doctrine template)
         $object->setAttribute(Doctrine_Core::ATTR_USE_DQL_CALLBACKS, true);
         $object->registerHydrator(DoctrineUtil::HYDRATE_SINGLE_SCALAR_ARRAY, 'Zikula_Doctrine_Hydrator_SingleScalarArray');
         // tell doctrine our extended Doctrine_Query class (Doctrine_Query::create() returns a Zikula_Doctrine_Query instance)
         $object->setAttribute(Doctrine_Core::ATTR_QUERY_CLASS, 'Zikula_Doctrine_Query');
         return;
     }
     if ($object instanceof Doctrine_Connection) {
         // set connection options
         // fetch / hydration mode
         //            $object->setAttribute(Doctrine_Core::ATTR_FETCHMODE, Doctrine_Core::FETCH_ASSOC);
         //            $object->setAttribute(Doctrine_Core::ATTR_HYDRATE_OVERWRITE, Doctrine_Core::HYDRATE_RECORD);
         // default column options
         //            $object->setAttribute(Doctrine_Core::ATTR_DEFAULT_COLUMN_OPTIONS,
         //                                            array('type' => 'string',
         //                                                  'length' => 255,
         //                                                  'notnull' => true));
         // properties of default added primary key in models
         // %s is replaced with the table name
         //            $object->setAttribute(Doctrine_Core::ATTR_DEFAULT_IDENTIFIER_OPTIONS,
         //                                            array('name' => '%s_id',
         //                                                  'type' => 'string',
         //                                                  'length' => 16));
         return;
     } elseif ($object instanceof Doctrine_Table) {
         // set table options
         return;
     }
     throw new Exception(get_class($object) . ' is not valid in configureDoctrine()');
 }
Esempio n. 19
0
    public static function moduleservices(Zikula_Event $event)
    {
        // check if this is for this handler
        $subject = $event->getSubject();
        if (!($event['method'] == 'moduleservices' && strrpos(get_class($subject), '_Controller_Admin'))) {
           return;
        }

        $moduleName = $subject->getName();
        if (!SecurityUtil::checkPermission($moduleName.'::', '::', ACCESS_ADMIN)) {
            return LogUtil::registerPermissionError();
        }

        $view = Zikula_View::getInstance('Extensions', false);
        $view->assign('currentmodule', $moduleName);

        // notify EVENT here to gather any system service links
        $localevent = new Zikula_Event('module_dispatch.service_links', $subject, array('modname' => $moduleName));
        EventUtil::notify($localevent);
        $sublinks = $localevent->getData();
        $view->assign('sublinks', $sublinks);

        $event->setData($view->fetch('extensions_hookui_moduleservices.tpl'));
        $event->stop();
    }
Esempio n. 20
0
 /**
  * Listener for the `module.users.ui.login.succeeded` event.
  *
  * Occurs right after a successful attempt to log in, and just prior to redirecting the user to the desired page.
  * All handlers are notified.
  *
  * The event subject contains the user's user record (from `UserUtil::getVars($event['uid'])`).
  * The arguments of the event are as follows:
  *     `'authentication_module'` an array containing the authenticating module name (`'modname'`) and method (`'method'`)
  *       used to log the user in.
  *     `'redirecturl'` will contain the value of the 'returnurl' parameter, if one was supplied, or an empty
  *       string. This can be modified to change where the user is redirected following the login.
  *
  * __The `'redirecturl'` argument__ controls where the user will be directed at the end of the log-in process.
  * Initially, it will be the value of the returnurl parameter provided to the log-in process, or blank if none was provided.
  *
  * The action following login depends on whether WCAG compliant log-in is enabled in the Users module or not. If it is enabled,
  * then the user is redirected to the returnurl immediately. If not, then the user is first displayed a log-in landing page,
  * and then meta refresh is used to redirect the user to the returnurl.
  *
  * If a `'redirecturl'` is specified by any entity intercepting and processing the `module.users.ui.login.succeeded` event, then
  * the URL provided replaces the one provided by the returnurl parameter to the login process. If it is set to an empty
  * string, then the user is redirected to the site's home page. An event handler should carefully consider whether
  * changing the `'redirecturl'` argument is appropriate. First, the user may be expecting to return to the page where
  * he was when he initiated the log-in process. Being redirected to a different page might be disorienting to the user.
  * Second, all event handlers are being notified of this event. This is not a `notify()` event. An event handler
  * that was notified prior to the current handler may already have changed the `'redirecturl'`.
  *
  * Finally, this event only fires in the event of a "normal" UI-oriented log-in attempt. A module attempting to log in
  * programmatically by directly calling the core functions will not see this event fired.
  */
 public static function succeeded(Zikula_Event $event)
 {
     $user = $event->getSubject();
     $uid = $user['uid'];
     MUBoard_Util_View::actualUser($uid, 1);
     MUBoard_Util_View::actualPostings($uid);
 }
Esempio n. 21
0
 /**
  * Template override handler for 'zikula_view.template_override'.
  *
  * @param Zikula_Event $event Event handler.
  *
  * @return void
  */
 public function _templateOverride(Zikula_Event $event)
 {
     if (array_key_exists($event->data, $this->_overrideMap)) {
         $event->data = $this->_overrideMap[$event->data];
         $event->stopPropagation();
     }
 }
Esempio n. 22
0
 /**
  * Listens for 'bootstrap.getconfig'
  *
  * @param Zikula_Event $event Event.
  *
  * @return void
  */
 public function getConfigFile(Zikula_Event $event)
 {
     if (is_readable('config/config.php')) {
         include 'config/config.php';
     }
     if (is_readable('config/personal_config.php')) {
         include 'config/personal_config.php';
     }
     if (is_readable('config/multisites_config.php')) {
         include 'config/multisites_config.php';
     }
     foreach ($GLOBALS['ZConfig'] as $config) {
         $event->getSubject()->getServiceManager()->loadArguments($config);
     }
     $event->stop();
 }
Esempio n. 23
0
    /**
     * Format a variable for HTML display. This method is recursive array safe.
     *
     * @param string $var The variable to format.
     *
     * @return string The formatted variable.
     */
    public static function formatForDisplayHTML($var)
    {
        // This search and replace finds the text 'x@y' and replaces
        // it with HTML entities, this provides protection against
        // email harvesters
        //
        // Note that the use of \024 and \022 are needed to ensure that
        // this does not break HTML tags that might be around either
        // the username or the domain name
        static $search = array(
        '/([^\024])@([^\022])/se');

        static $replace = array('"&#" .
                                sprintf("%03d", ord("\\1")) .
                                ";@&#" .
                                sprintf("%03d", ord("\\2")) . ";";');

        static $allowedtags = null;
        static $outputfilter;
        static $event;
        if (!$event) {
            $event = new Zikula_Event('system.outputfilter');
        }

        if (!isset($allowedtags)) {
            $allowedHTML = array();
            $allowableHTML = System::getVar('AllowableHTML');
            if (is_array($allowableHTML)) {
                foreach ($allowableHTML as $k => $v) {
                    if ($k == '!--') {
                        if ($v != 0) {
                            $allowedHTML[] = "$k.*?--";
                        }
                    } else {
                        switch ($v) {
                            case 0:
                                break;
                            case 1:
                                $allowedHTML[] = "/?$k\s*/?";
                                break;
                            case 2:
                                $allowedHTML[] = "/?\s*$k" . "(\s+[\w:]+\s*=\s*(\"[^\"]*\"|'[^']*'))*" . '\s*/?';
                                break;
                        }
                    }
                }
            }

            if (count($allowedHTML) > 0) {
                $allowedtags = '~<\s*(' . implode('|', $allowedHTML) . ')\s*>~is';
            } else {
                $allowedtags = '';
            }
        }

        if (!isset($outputfilter)) {
            if (ModUtil::available('SecurityCenter') && !System::isInstalling()) {
                $outputfilter = System::getVar('outputfilter');
            } else {
                $outputfilter = 0;
            }
        }

        if (is_array($var)) {
            foreach ($var as $k => $v) {
                $var[$k] = self::formatForDisplayHTML($v);
            }
        } else {
            // Run additional filters
            if ($outputfilter > 0) {
                $event->setData($var)->setArg('filter', $outputfilter);
                $var = EventUtil::notify($event)->getData();
            }

            // Preparse var to mark the HTML that we want
            if (!empty($allowedtags)) {
                $var = preg_replace($allowedtags, "\022\\1\024", $var);
            }

            // Encode email addresses
            $var = preg_replace($search, $replace, $var);

            // Fix html entities
            $var = htmlspecialchars($var);

            // Fix the HTML that we want
            $var = preg_replace_callback('#\022([^\024]*)\024#', create_function('$m', 'return DataUtil::formatForDisplayHTML_callback($m);'), $var);

            // Fix entities if required
            if (System::getVar('htmlentities')) {
                $var = preg_replace('/&amp;([a-z#0-9]+);/i', "&\\1;", $var);
            }
        }

        return $var;
    }
Esempio n. 24
0
    /**
     * Respond to a `module.users.ui.process_edit` event to store profile data gathered when editing or creating a user account.
     * 
     * Parameters passed in via POST:
     * ------------------------------
     * array dynadata An array containing the profile items to store for the user.
     *
     * @param Zikula_Event $event The event that triggered this function call, containing the id of the user for which profile information should be stored.
     * 
     * @return void
     */
    public function processEdit(Zikula_Event $event)
    {
        if ($this->request->isPost()) {
            if ($this->validation && !$this->validation->hasErrors()) {
                $user = $event->getSubject();
                $dynadata = $this->request->getPost()->has('dynadata') ? $this->request->getPost()->get('dynadata') : array();

                foreach ($dynadata as $dudName => $dudItem) {
                    UserUtil::setVar($dudName, $dudItem, $user['uid']);
                }
            }
        }
    }
Esempio n. 25
0
 /**
  * Listener for the `moduleplugin.ckeditor.externalplugins` event.
  *
  * Adds external plugin to CKEditor.
  *
  * @param Zikula_Event $event The event instance.
  */
 public static function getCKEditorPlugins(Zikula_Event $event)
 {
     // intended is using the add() method to add a plugin like below
     $plugins = $event->getSubject();
     $plugins->add(array('name' => 'muvideo', 'path' => 'modules/MUVideo/docs/scribite/plugins/CKEditor/vendor/ckeditor/plugins/muvideo/', 'file' => 'plugin.js', 'img' => 'ed_muvideo.gif'));
 }
Esempio n. 26
0
 public static function getTypes(Zikula_Event $event) {
     $types = $event->getSubject();
     $types->add('News_ContentType_NewsArticles');
 }
Esempio n. 27
0
    /**
     * Responds to process_edit hook-like event notifications.
     *
     * @param Zikula_Event $event The event that triggered this function call.
     *
     * @return void
     *
     * @throws Zikula_Exception_Fatal Thrown if a user account does not exist for the uid specified by the event.
     */
    public function processEdit(Zikula_Event $event)
    {
        $activePolicies = $this->helper->getActivePolicies();
        $eventName = $event->getName();

        if (isset($this->validation) && !$this->validation->hasErrors()) {
            $user = $event->getSubject();
            $uid = $user['uid'];

            if (!UserUtil::isLoggedIn()) {
                if (($eventName == 'module.users.ui.process_edit.login_screen') || ($eventName == 'module.users.ui.process_edit.login_block')) {
                    $policiesAcceptedAtLogin = $this->validation->getObject();

                    $nowUTC = new DateTime('now', new DateTimeZone('UTC'));
                    $nowUTCStr = $nowUTC->format(DateTime::ISO8601);

                    if ($activePolicies['termsOfUse'] && $policiesAcceptedAtLogin['termsOfUse']) {
                        UserUtil::setVar(Legal_Constant::ATTRIBUTE_TERMSOFUSE_ACCEPTED, $nowUTCStr, $uid);
                    }

                    if ($activePolicies['privacyPolicy'] && $policiesAcceptedAtLogin['privacyPolicy']) {
                        UserUtil::setVar(Legal_Constant::ATTRIBUTE_PRIVACYPOLICY_ACCEPTED, $nowUTCStr, $uid);
                    }

                    if ($activePolicies['agePolicy'] && $policiesAcceptedAtLogin['agePolicy']) {
                        UserUtil::setVar(Legal_Constant::ATTRIBUTE_AGEPOLICY_CONFIRMED, $nowUTCStr, $uid);
                    }

                    if ($activePolicies['cancellationRightPolicy'] && $policiesAcceptedAtLogin['cancellationRightPolicy']) {
                        UserUtil::setVar(Legal_Constant::ATTRIBUTE_CANCELLATIONRIGHTPOLICY_ACCEPTED, $nowUTCStr, $uid);
                    }

                    if ($activePolicies['tradeConditions'] && $policiesAcceptedAtLogin['tradeConditions']) {
                        UserUtil::setVar(Legal_Constant::ATTRIBUTE_TRADECONDITIONS_ACCEPTED, $nowUTCStr, $uid);
                    }

                    // Force the reload of the user record
                    $user = UserUtil::getVars($uid, true);
                } else {
                    $isRegistration = UserUtil::isRegistration($uid);

                    $user = UserUtil::getVars($uid, false, 'uid', $isRegistration);
                    if (!$user) {
                        throw new Zikula_Exception_Fatal(__('A user account or registration does not exist for the specified uid.', $this->domain));
                    }

                    $policiesAcceptedAtRegistration = $this->validation->getObject();

                    $nowUTC = new DateTime('now', new DateTimeZone('UTC'));
                    $nowUTCStr = $nowUTC->format(DateTime::ISO8601);

                    if ($activePolicies['termsOfUse'] && $policiesAcceptedAtRegistration['termsOfUse']) {
                        UserUtil::setVar(Legal_Constant::ATTRIBUTE_TERMSOFUSE_ACCEPTED, $nowUTCStr, $uid);
                    }

                    if ($activePolicies['privacyPolicy'] && $policiesAcceptedAtRegistration['privacyPolicy']) {
                        UserUtil::setVar(Legal_Constant::ATTRIBUTE_PRIVACYPOLICY_ACCEPTED, $nowUTCStr, $uid);
                    }

                    if ($activePolicies['agePolicy'] && $policiesAcceptedAtRegistration['agePolicy']) {
                        UserUtil::setVar(Legal_Constant::ATTRIBUTE_AGEPOLICY_CONFIRMED, $nowUTCStr, $uid);
                    }

                    if ($activePolicies['cancellationRightPolicy'] && $policiesAcceptedAtRegistration['cancellationRightPolicy']) {
                        UserUtil::setVar(Legal_Constant::ATTRIBUTE_CANCELLATIONRIGHTPOLICY_ACCEPTED, $nowUTCStr, $uid);
                    }

                    if ($activePolicies['tradeConditions'] && $policiesAcceptedAtRegistration['tradeConditions']) {
                        UserUtil::setVar(Legal_Constant::ATTRIBUTE_TRADECONDITIONS_ACCEPTED, $nowUTCStr, $uid);
                    }

                    // Force the reload of the user record
                    $user = UserUtil::getVars($uid, true, 'uid', $isRegistration);
                }
            } else {
                $isRegistration = UserUtil::isRegistration($uid);

                $user = UserUtil::getVars($uid, false, 'uid', $isRegistration);
                if (!$user) {
                    throw new Zikula_Exception_Fatal(__('A user account or registration does not exist for the specified uid.', $this->domain));
                }

                $policiesAcceptedAtRegistration = $this->validation->getObject();
                $editablePolicies = $this->helper->getEditablePolicies();

                $nowUTC = new DateTime('now', new DateTimeZone('UTC'));
                $nowUTCStr = $nowUTC->format(DateTime::ISO8601);

                if ($activePolicies['termsOfUse'] && $editablePolicies['termsOfUse']) {
                    if ($policiesAcceptedAtRegistration['termsOfUse']) {
                        UserUtil::setVar(Legal_Constant::ATTRIBUTE_TERMSOFUSE_ACCEPTED, $nowUTCStr, $uid);
                    } elseif (($policiesAcceptedAtRegistration['termsOfUse'] === 0) || ($policiesAcceptedAtRegistration['termsOfUse'] === "0")) {
                        UserUtil::delVar(Legal_Constant::ATTRIBUTE_TERMSOFUSE_ACCEPTED, $uid);
                    }
                }

                if ($activePolicies['privacyPolicy'] && $editablePolicies['privacyPolicy']) {
                    if ($policiesAcceptedAtRegistration['privacyPolicy']) {
                        UserUtil::setVar(Legal_Constant::ATTRIBUTE_PRIVACYPOLICY_ACCEPTED, $nowUTCStr, $uid);
                    } elseif (($policiesAcceptedAtRegistration['privacyPolicy'] === 0) || ($policiesAcceptedAtRegistration['termsOfUse'] === "0")) {
                        UserUtil::delVar(Legal_Constant::ATTRIBUTE_PRIVACYPOLICY_ACCEPTED, $uid);
                    }
                }

                if ($activePolicies['agePolicy'] && $editablePolicies['agePolicy']) {
                    if ($policiesAcceptedAtRegistration['agePolicy']) {
                        UserUtil::setVar(Legal_Constant::ATTRIBUTE_AGEPOLICY_CONFIRMED, $nowUTCStr, $uid);
                    } elseif (($policiesAcceptedAtRegistration['agePolicy'] === 0) || ($policiesAcceptedAtRegistration['termsOfUse'] === "0")) {
                        UserUtil::delVar(Legal_Constant::ATTRIBUTE_AGEPOLICY_CONFIRMED, $uid);
                    }
                }

                if ($activePolicies['cancellationRightPolicy'] && $editablePolicies['cancellationRightPolicy']) {
                    if ($policiesAcceptedAtRegistration['cancellationRightPolicy']) {
                        UserUtil::setVar(Legal_Constant::ATTRIBUTE_CANCELLATIONRIGHTPOLICY_ACCEPTED, $nowUTCStr, $uid);
                    } elseif (($policiesAcceptedAtRegistration['cancellationRightPolicy'] === 0) || ($policiesAcceptedAtRegistration['cancellationRightPolicy'] === "0")) {
                        UserUtil::delVar(Legal_Constant::ATTRIBUTE_CANCELLATIONRIGHTPOLICY_ACCEPTED, $uid);
                    }
                }

                if ($activePolicies['tradeConditions'] && $editablePolicies['tradeConditions']) {
                    if ($policiesAcceptedAtRegistration['tradeConditions']) {
                        UserUtil::setVar(Legal_Constant::ATTRIBUTE_TRADECONDITIONS_ACCEPTED, $nowUTCStr, $uid);
                    } elseif (($policiesAcceptedAtRegistration['tradeConditions'] === 0) || ($policiesAcceptedAtRegistration['tradeConditions'] === "0")) {
                        UserUtil::delVar(Legal_Constant::ATTRIBUTE_TRADECONDITIONS_ACCEPTED, $uid);
                    }
                }

                // Force the reload of the user record
                $user = UserUtil::getVars($uid, true, 'uid', $isRegistration);
            }
        }
    }
Esempio n. 28
0
 /**
  * Registers Imagine smarty plugins dir.
  *
  * @param Zikula_Event $event
  */
 public function registerPlugins(Zikula_Event $event)
 {
     $event->getSubject()->addPluginDir("{$this->baseDir}/templates/plugins");
 }
Esempio n. 29
0
 /**
  * Event listener for controller_api.method_not_found.
  *
  * @param Zikula_Event $event Event.
  *
  * @return void
  */
 public function logModControllerAPINotFound(Zikula_Event $event)
 {
     $this->_log[] = array('type' => Zikula_AbstractErrorHandler::EMERG, 'errstr' => 'Execute Controller API method failed: Method not found ' . get_class($event->getSubject()) . '->' . $event['method']);
 }
Esempio n. 30
0
 /**
  * Available plugins list.
  *
  * @return array List of the available plugins.
  */
 public static function getPluginsAvailable()
 {
     $classNames = array();
     $classNames['category'] = 'FilterUtil_Filter_Category';
     $classNames['default'] = 'FilterUtil_Filter_Default';
     $classNames['date'] = 'FilterUtil_Filter_Date';
     $classNames['mnlist'] = 'FilterUtil_Filter_Mnlist';
     $classNames['pmlist'] = 'FilterUtil_Filter_Pmlist';
     $classNames['replaceName'] = 'FilterUtil_Filter_ReplaceName';
     // collect classes from other providers also allows for override
     // TODO A [This is only allowed for the module which owns this object.]
     $event = new Zikula_Event('zikula.filterutil.get_plugin_classes');
     $event->setData($classNames);
     $classNames = EventUtil::getManager()->notify($event)->getData();
     return $classNames;
 }