/** * Loads the operations definition for the current module * @return bool true if the operations were loaded, false if an error occured */ function loadDefinition() { $pathList = eZModule::globalPathList(); foreach ( $pathList as $path ) { $definitionFile = $path . '/' . $this->ModuleName . '/operation_definition.php'; if ( file_exists( $definitionFile ) ) break; $definitionFile = null; } if ( $definitionFile === null ) { eZDebug::writeError( 'Missing operation definition file for module: ' . $this->ModuleName, __METHOD__ ); return false; } unset( $OperationList ); include( $definitionFile ); if ( !isset( $OperationList ) ) { eZDebug::writeError( 'Missing operation definition list for module: ' . $this->ModuleName, __METHOD__ ); return false; } $this->OperationList = $OperationList; $this->IsValid = true; return true; }
function loadDefinition() { $definitionFile = null; $pathList = eZModule::globalPathList(); if ($pathList) { foreach ($pathList as $path) { $definitionFile = $path . '/' . $this->ModuleName . '/function_definition.php'; if (file_exists($definitionFile)) { break; } $definitionFile = null; } } if ($definitionFile === null) { eZDebug::writeError('Missing function definition file for module: ' . $this->ModuleName, 'eZModuleFunctionInfo::loadDefinition'); return false; } unset($FunctionList); include $definitionFile; if (!isset($FunctionList)) { eZDebug::writeError('Missing function definition list for module: ' . $this->ModuleName, 'eZModuleFunctionInfo::loadDefinition'); return false; } $this->FunctionList = $FunctionList; $this->IsValid = true; return true; }
/** * Trasforma le variabili $_GET in view_parameters e redirige la richiesta in base al parametro $_GET['RedirectUrlAlias'] * * @see modules/ocsearch/action.php * @param array $requestFields * @param eZModule $module */ public static function redirect(array $requestFields, eZModule $module = null) { $result = new OCClassSearchFormFetcher(); $result->setRequestFields($requestFields); if ($module) { $redirect = '/'; if (isset($requestFields['RedirectUrlAlias'])) { $redirect = $requestFields['RedirectUrlAlias']; } elseif (isset($requestFields['RedirectNodeID'])) { $node = eZContentObjectTreeNode::fetch($requestFields['RedirectNodeID']); if ($node instanceof eZContentObjectTreeNode) { $redirect = $node->attribute('url_alias'); } } $redirect = rtrim($redirect, '/') . $result->getViewParametersString(); $module->redirectTo($redirect); } }
function modify( $tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters, $placement ) { $uri = new eZURI( $namedParameters[ 'uri' ] ); $moduleName = $uri->element( 0 ); $moduleList = eZINI::instance( 'module.ini' )->variable( 'ModuleSettings', 'ModuleList' ); if ( in_array( $moduleName, $moduleList, true ) ) $check = eZModule::accessAllowed( $uri ); $operatorValue = isset( $check['result'] ) ? $check['result'] : false; }
/** * Finds all available modules in the system * @return array $modulename => $path */ static function getModuleList() { $out = array(); foreach (eZModule::globalPathList() as $path) { foreach (scandir($path) as $subpath) { if ($subpath != '.' && $subpath != '..' && is_dir($path . '/' . $subpath) && file_exists($path . '/' . $subpath . '/module.php')) { $out[$subpath] = $path . '/' . $subpath . '/module.php'; } } } return $out; }
/** * List all existing operations (optionally, in a given module) * @author G. Giunta * @copyright (C) G. Giunta 2010-2016 * @license Licensed under GNU General Public License v2.0. See file license.txt * */ // generic info for all views: module name, extension name, ... $operationList = array(); $modules = eZModuleLister::getModuleList(); if ($Params['modulename'] != '' && !array_key_exists($Params['modulename'], $modules)) { /// @todo } else { foreach ($modules as $modulename => $path) { if ($Params['modulename'] == '' || $Params['modulename'] == $modulename) { $module = eZModule::exists($modulename); if ($module instanceof eZModule) { $moduleOperationInfo = new eZModuleOperationInfo($modulename); /// @todo prevent warning to be generated here $moduleOperationInfo->loadDefinition(); if ($moduleOperationInfo->isValid()) { $extension = ''; if (preg_match('#extension/([^/]+)/modules/#', $path, $matches)) { $extension = $matches[1]; } foreach ($moduleOperationInfo->OperationList as $op) { $operationList[$op['name'] . '_' . $modulename] = $op; $operationList[$op['name'] . '_' . $modulename]['module'] = $modulename; $operationList[$op['name'] . '_' . $modulename]['extension'] = $extension; } }
if ( isset( $rerunURLList[$errorNumber] ) ) $errorRerunURL = $rerunURLList[$errorNumber]; $Result = array(); $Result['content'] = false; $Result['rerun_uri'] = $errorRerunURL; $module->setExitStatus( eZModule::STATUS_RERUN ); return $Result; } else if ( $errorHandlerType == 'embed' ) { $errorEmbedURL = $errorINI->variable( 'ErrorSettings', 'DefaultEmbedURL' ); if ( isset( $embedURLList[$errorNumber] ) ) $errorEmbedURL = $embedURLList[$errorNumber]; $uri = new eZURI( $errorEmbedURL ); $moduleName = $uri->element(); $embedModule = eZModule::exists( $moduleName ); if ( $module instanceof eZModule ) { $uri->increase(); $viewName = false; if ( !$embedModule->singleFunction() ) { $viewName = $uri->element(); $uri->increase(); } $embedParameters = $uri->elements( false ); $embedResult = $embedModule->run( $viewName, $embedParameters ); $embedContent = $embedResult['content']; } // write reason to debug
} $db->commit(); } } $tpl = eZTemplate::factory(); $triggers = eZTrigger::fetchList(array('module' => $moduleName, 'function' => $functionName)); $showModuleList = false; $showFunctionList = false; $functionList = array(); $moduleList = array(); if ($moduleName == '*') { $showModuleList = true; $ini = eZINI::instance('module.ini'); $moduleList = $ini->variable('ModuleSettings', 'ModuleList'); } elseif ($functionName == '*') { $mod = eZModule::exists($moduleName); $functionList = array_keys($mod->attribute('available_functions')); eZDebug::writeNotice($functionList, "functions"); $showFunctionList = true; } $tpl->setVariable('current_module', $moduleName); $tpl->setVariable('current_function', $functionName); $tpl->setVariable('show_functions', $showFunctionList); $tpl->setVariable('show_modules', $showModuleList); $tpl->setVariable('possible_triggers', $possibleTriggers); $tpl->setVariable('modules', $moduleList); $tpl->setVariable('functions', $functionList); $tpl->setVariable('triggers', $triggers); $tpl->setVariable('module', $Module); $Result['content'] = $tpl->fetch('design:trigger/list.tpl'); $Result['path'] = array(array('text' => ezpI18n::tr('kernel/trigger', 'Trigger'), 'url' => false), array('text' => ezpI18n::tr('kernel/trigger', 'List'), 'url' => false));
} $GLOBALS['eZCurrentAccess'] = $access; // Check for new extension loaded by siteaccess eZExtension::activateExtensions('access'); $db = eZDB::instance(); if ($db->isConnected()) { eZSession::start(); } else { exitWithInternalError(); return; } $moduleINI = eZINI::instance('module.ini'); $globalModuleRepositories = $moduleINI->variable('ModuleSettings', 'ModuleRepositories'); $globalModuleRepositories[] = 'extension/eztags/modules'; eZModule::setGlobalPathList($globalModuleRepositories); $module = eZModule::exists('tags'); if (!$module) { exitWithInternalError(); return; } $function_name = 'treemenu'; $uri->increase(); $uri->increase(); $currentUser = eZUser::currentUser(); $siteAccessResult = $currentUser->hasAccessTo('user', 'login'); $tagsReadResult = $currentUser->hasAccessTo('tags', 'read'); $hasAccessToSite = false; if ($siteAccessResult['accessWord'] == 'limited') { $policyChecked = false; foreach ($siteAccessResult['policies'] as $policy) { if (isset($policy['SiteAccess'])) {
<?php /** * @copyright Copyright (C) eZ Systems AS. All rights reserved. * @license For full copyright and license information view LICENSE file distributed with this source code. * @version 2014.11.1 * @package kernel */ // Redirect to visual module which is the correct place for this functionality $module = $Params['Module']; $parameters = $Params["Parameters"]; $visualModule = eZModule::exists('visual'); if ($visualModule) { return $module->forward($visualModule, 'templatecreate', $parameters); }
public static function urlToAction($url) { if (preg_match("#^content/view/full/([0-9]+)\$#", $url, $matches)) { return "eznode:" . $matches[1]; } if (preg_match("#^([a-zA-Z0-9]+)/#", $url, $matches)) { $name = $matches[1]; $module = eZModule::exists($name); if ($module !== null) { return 'module:' . $url; } } return false; }
/** * Sets whether to use exceptions inside the kernel. * * @param bool $useExceptions */ public function setUseExceptions($useExceptions) { eZModule::$useExceptions = (bool) $useExceptions; }
function allValuesAsArrayWithNames() { $returnValue = null; $valueList = $this->attribute('values_as_array'); $names = array(); $policy = $this->attribute('policy'); if (!$policy) { return $returnValue; } $currentModule = $policy->attribute('module_name'); $mod = eZModule::exists($currentModule); if (!is_object($mod)) { eZDebug::writeError('Failed to fetch instance for module ' . $currentModule); return $returnValue; } $functions = $mod->attribute('available_functions'); $functionNames = array_keys($functions); $currentFunction = $policy->attribute('function_name'); $limitationValueArray = array(); $limitation = $functions[$currentFunction][$this->attribute('identifier')]; if ($limitation && isset($limitation['class']) && count($limitation['values'] == 0)) { $obj = new $limitation['class'](array()); $limitationValueList = call_user_func_array(array($obj, $limitation['function']), $limitation['parameter']); foreach ($limitationValueList as $limitationValue) { $limitationValuePair = array(); $limitationValuePair['Name'] = $limitationValue['name']; $limitationValuePair['value'] = $limitationValue['id']; $limitationValueArray[] = $limitationValuePair; } } else { if ($limitation['name'] === 'Node') { foreach ($valueList as $value) { $node = eZContentObjectTreeNode::fetch($value, false, false); if ($node == null) { continue; } $limitationValuePair = array(); $limitationValuePair['Name'] = $node['name']; $limitationValuePair['value'] = $value; $limitationValuePair['node_data'] = $node; $limitationValueArray[] = $limitationValuePair; } } else { if ($limitation['name'] === 'Subtree') { foreach ($valueList as $value) { $subtreeObject = eZContentObjectTreeNode::fetchByPath($value, false); if ($subtreeObject != null) { $limitationValuePair = array(); $limitationValuePair['Name'] = $subtreeObject['name']; $limitationValuePair['value'] = $value; $limitationValuePair['node_data'] = $subtreeObject; $limitationValueArray[] = $limitationValuePair; } } } else { $limitationValueArray = $limitation['values']; } } } $limitationValuesWithNames = array(); foreach (array_keys($valueList) as $key) { $value = $valueList[$key]; if (isset($limitationValueArray)) { reset($limitationValueArray); foreach (array_keys($limitationValueArray) as $ckey) { if ($value == $limitationValueArray[$ckey]['value']) { $limitationValuesWithNames[] = $limitationValueArray[$ckey]; } } } } return $limitationValuesWithNames; }
/** * @param eZModule $Module * @param int $error * @param bool $store * @param array $errorParameters * * @return array */ protected static function contentViewGenerateError(eZModule $Module, $error, $store = true, array $errorParameters = array()) { $content = $Module->handleError($error, 'kernel', $errorParameters); return array('content' => $content, 'scope' => 'viewcache', 'store' => $store, 'binarydata' => serialize($content)); }
/** * Checks if access is allowed to a module/view based on site.ini[SiteAccessRules]Rules settings * * @see eZModule::accessAllowed() * @param eZURI $uri * @return array An associative array with: * 'result' => bool Indicates if access is allowed * 'module' => string Module name * 'view' => string View name * 'view_checked' => bool Indicates if view access has been checked */ function accessAllowed(eZURI $uri) { return eZModule::accessAllowed($uri); }
/** * Loads a module object by name. * The only difference with exists() is that the $module parameter will be * assigned the found module. * * @param string $moduleName The name of the module to find (ex: content) * @param mixed $module This parameter will receive the found module object * @param array|string * Either an array of path or a single path string. These will be * used as additionnal locations that will be looked into * @param boolean $showError * If true an error will be shown if the module it not found. * @return eZModule The eZModule object, or null if the module wasn't found * @see exists() */ static function findModule($moduleName, $module = null, $pathList = null, $showError = false) { if ($pathList === null) { $pathList = array(); } else { if (!is_array($pathList)) { $pathList = array($pathList); } } $searchPathList = eZModule::globalPathList(); if ($searchPathList === null) { $searchPathList = array(); } $searchPathList = array_merge($searchPathList, $pathList); $triedList = array(); $triedDirList = array(); $foundADir = false; foreach ($searchPathList as $path) { $dir = "{$path}/{$moduleName}"; $file = "{$dir}/module.php"; if (file_exists($file)) { if ($module === null) { $module = new eZModule($path, $file, $moduleName, false); } else { $module->initialize($path, $file, $moduleName, false); } return $module; } else { if (!file_exists($dir)) { $triedDirList[] = $dir; } else { $foundADir = true; $triedList[] = $dir; } } } $msg = "Could not find module named '{$moduleName}'"; if ($foundADir) { $msg = "\nThese directories had a directory named '{$moduleName}' but did not contain the module.php file:\n" . implode(", ", $triedList) . "\n" . "This usually means it is missing or has a wrong name."; if (count($triedDirList) > 0) { $msg .= "\n\nThese directories were tried too but none of them exists:\n" . implode(', ', $triedDirList); } } else { if (count($triedDirList) > 0) { $msg .= "\nThese directories were tried but none of them exists:\n" . implode(", ", $triedDirList); } } if ($showError) { eZDebug::writeWarning($msg); } return null; }
function fetchModule($uri, $check, &$module, &$module_name, &$function_name, &$params) { $module_name = $uri->element(); if ($check !== null and isset($check["module"])) { $module_name = $check["module"]; } // Try to fetch the module object $module = eZModule::exists($module_name); if (!$module instanceof eZModule) { return false; } $uri->increase(); $function_name = ""; if (!$module->singleFunction()) { $function_name = $uri->element(); $uri->increase(); } // Override it if required if ($check !== null and isset($check["function"])) { $function_name = $check["function"]; } $params = $uri->elements(false); return true; }
$cli->output(); } $rows = eZPersistentObject::fetchObjectList(eZPolicy::definition(), array(), null, false, null, false, false, array(array('operation' => 'count( * )', 'name' => 'count'))); $total = $rows[0]['count']; if (!$optDryRun) { $cli->output("{$total} policies to check... (In the progess bar, 'R' means that the policy was removed)"); } else { $cli->output("{$total} policies to check..."); } if (!$optDryRun) { $script->setIterationData('R', '.'); $script->resetIteration($total); } $limitation = array('offset' => 0, 'limit' => 100); $db = eZDB::instance(); $modules = eZModule::globalPathList(); $removedPolicies = 0; while (true) { $policies = eZPersistentObject::fetchObjectList(eZPolicy::definition(), null, null, null, $limitation, true); if (empty($policies)) { break; } foreach ($policies as $policy) { if ($policy->attribute('module_name') === '*') { continue; } $moduleExists = false; foreach ($modules as $module) { if (file_exists($module . '/' . $policy->attribute('module_name'))) { $moduleExists = true; break;
$tpl->setVariable('current_module', $currentModule); $tpl->setVariable('functions', $functionNames); $tpl->setVariable('no_functions', false); $Result = array(); $Result['path'] = array(array('url' => false, 'text' => ezpI18n::tr('kernel/role', 'Create new policy, step two: select function'))); $Result['content'] = $tpl->fetch('design:role/createpolicystep2.tpl'); return; } if ($http->hasPostVariable('CreatePolicy') || $http->hasPostVariable('Step1')) { // Set flag for audit. If true audit will be processed $http->setSessionVariable('RoleWasChanged', true); $Module->setTitle('Edit ' . $role->attribute('name')); $tpl->setVariable('modules', $modules); $moduleList = array(); foreach ($modules as $module) { $moduleList[] = eZModule::exists($module); } $tpl->setVariable('module_list', $moduleList); $tpl->setVariable('role', $role); $tpl->setVariable('module', $Module); $Result = array(); $Result['path'] = array(array('url' => false, 'text' => ezpI18n::tr('kernel/role', 'Create new policy, step one: select module'))); $Result['content'] = $tpl->fetch('design:role/createpolicystep1.tpl'); return; } // Set flag for audit. If true audit will be processed // Cancel button was pressed if ($http->hasPostVariable('CancelPolicyButton')) { $http->setSessionVariable('RoleWasChanged', false); } $policies = $role->attribute('policies');
// reload soap.ini cache now that override paths have changed $soapINI->loadCache(); /*! Reads settings from i18n.ini and passes them to eZTextCodec. */ function eZUpdateTextCodecSettings() { $ini = eZINI::instance('i18n.ini'); list($i18nSettings['internal-charset'], $i18nSettings['http-charset'], $i18nSettings['mbstring-extension']) = $ini->variableMulti('CharacterSettings', array('Charset', 'HTTPCharset', 'MBStringExtension'), array(false, false, 'enabled')); eZTextCodec::updateSettings($i18nSettings); } // Initialize text codec settings eZUpdateTextCodecSettings(); // Initialize module loading $moduleRepositories = eZModule::activeModuleRepositories(); eZModule::setGlobalPathList($moduleRepositories); // Load soap extensions $enableSOAP = $soapINI->variable('GeneralSettings', 'EnableSOAP'); if ($enableSOAP == 'true') { eZSys::init('soap.php'); // Login if we have username and password. if (eZHTTPTool::username() and eZHTTPTool::password()) { eZUser::loginUser(eZHTTPTool::username(), eZHTTPTool::password()); } $server = new eZSOAPServer(); foreach ($soapINI->variable('ExtensionSettings', 'SOAPExtensions') as $extension) { include_once eZExtension::baseDirectory() . '/' . $extension . '/soap/initialize.php'; } $server->processRequest(); } ob_end_flush();
$currentModule = $policy->attribute( 'module_name' ); $currentFunction = $policy->attribute( 'function_name' ); $roleID = $policy->attribute( 'role_id' ); $role = eZRole::fetch( $roleID ); $roleName = $role->attribute( 'name' ); $limitationValueList = $policy->limitationList(); $nodeList = array(); $subtreeList = array(); if ( $currentModule == '*' ) { $functions = array(); } else { $mod = eZModule::exists( $currentModule ); $functions = $mod->attribute( 'available_functions' ); } $currentFunctionLimitations = array(); if ( isset( $functions[$currentFunction] ) && $functions[$currentFunction] ) { foreach ( $functions[$currentFunction] as $key => $limitation ) { if ( ( count( $limitation['values'] ) == 0 ) && array_key_exists( 'class', $limitation ) ) { $obj = new $limitation['class']( array() ); $limitationValueList = call_user_func_array( array( $obj, $limitation['function'] ), $limitation['parameter'] ); $limitationValueArray = array(); foreach ( $limitationValueList as $limitationValue ) { $limitationValuePair = array();
public function __construct($action, $request) { $moduleRepositories = eZModule::activeModuleRepositories(); eZModule::setGlobalPathList($moduleRepositories); parent::__construct($action, $request); }
$uri = eZURI::instance(eZSys::requestURI()); $moduleName = $uri->element(); $module = eZModule::findModule($moduleName); if (!$module instanceof eZModule) { exitWithInternalError("'{$moduleName}' module does not exist, or is not a valid module."); return; } // check existance of view $viewName = $uri->element(1); $moduleViews = $module->attribute('views'); if (!isset($moduleViews[$viewName])) { exitWithInternalError("'{$viewName}' view does not exist on the current module."); return; } // Check if module / view is disabled $moduleCheck = eZModule::accessAllowed($uri); if (!$moduleCheck['result']) { exitWithInternalError('$moduleName/$viewName is disabled.'); } // check access to view $ini = eZINI::instance(); $currentUser = eZUser::currentUser(); if (!hasAccessToBySetting($moduleName, $viewName, $ini->variable('RoleSettings', 'PolicyOmitList')) && !$currentUser->hasAccessToView($module, $viewName, $params)) { exitWithInternalError("User does not have access to the {$moduleName}/{$viewName} policy."); return; } // run module view $uri->increase(); $uri->increase(); $GLOBALS['eZRequestedModule'] = $module; $moduleResult = $module->run($viewName, $uri->elements(false), false, $uri->userParameters());
function initialize() { if (ob_get_length() != 0) { ob_end_clean(); } $debugINI = eZINI::instance('debug.ini'); eZDebugSetting::setDebugINI($debugINI); // Initialize text codec settings $this->updateTextCodecSettings(); // Initialize debug settings $this->updateDebugSettings($this->UseDebugOutput); // Set the different permissions/settings. $ini = eZINI::instance(); $iniFilePermission = $ini->variable('FileSettings', 'StorageFilePermissions'); $iniDirPermission = $ini->variable('FileSettings', 'StorageDirPermissions'); $iniVarDirectory = eZSys::cacheDirectory(); eZCodePage::setPermissionSetting(array('file_permission' => octdec($iniFilePermission), 'dir_permission' => octdec($iniDirPermission), 'var_directory' => $iniVarDirectory)); eZExecution::addCleanupHandler('eZDBCleanup'); eZExecution::addFatalErrorHandler('eZFatalError'); eZDebug::setHandleType(eZDebug::HANDLE_FROM_PHP); if ($this->UseExtensions) { // Check for extension eZExtension::activateExtensions('default'); // Extension check end } else { if (!$this->isQuiet()) { $cli = eZCLI::instance(); $cli->output("Notice: This script uses 'use-extensions' => false, meaning extension settings are not loaded!"); } } $siteaccess = $this->SiteAccess; if ($siteaccess) { $access = array('name' => $siteaccess, 'type' => eZSiteAccess::TYPE_STATIC); } else { $ini = eZINI::instance(); $siteaccess = $ini->variable('SiteSettings', 'DefaultAccess'); $access = array('name' => $siteaccess, 'type' => eZSiteAccess::TYPE_DEFAULT); } $access = eZSiteAccess::change($access); if ($this->UseExtensions) { // Check for siteaccess extension eZExtension::activateExtensions('access'); // Extension check end } // Now that all extensions are activated and siteaccess has been changed, reset // all eZINI instances as they may not take into account siteaccess specific settings. eZINI::resetAllInstances(false); // Set the global setting which is read by the session lib $GLOBALS['eZSiteBasics']['session-required'] = $this->UseSession; if ($this->UseSession) { $db = eZDB::instance(); if ($db->isConnected()) { eZSession::start(); } else { $this->setIsInitialized(false); $this->InitializationErrorMessage = 'database error: ' . $db->errorMessage(); return; } } if ($this->User) { $userLogin = $this->User['login']; $userPassword = $this->User['password']; if ($userLogin and $userPassword) { $userID = eZUser::loginUser($userLogin, $userPassword); if (!$userID) { $cli = eZCLI::instance(); if ($this->isLoud()) { $cli->warning('Failed to login with user ' . $userLogin); } eZExecution::cleanup(); eZExecution::setCleanExit(); } } } // Initialize module handling if ($this->UseModules) { $moduleRepositories = eZModule::activeModuleRepositories($this->UseExtensions); eZModule::setGlobalPathList($moduleRepositories); } $this->setIsInitialized(true); }
} else { $operationResult = eZContentOperationCollection::removeFeedForNode($nodeID); } } if (!isset($operationResult['status']) || !$operationResult['status']) { return $module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel'); } return $module->redirectToView('view', array('full', $nodeID)); } else { // Check if there are any custom actions to handle $customActions = eZINI::instance('datatype.ini')->variable('ViewSettings', 'CustomActionMap'); foreach ($customActions as $customActionName => $customActionUrl) { if ($http->hasPostVariable($customActionName)) { if (strpos($customActionUrl, '/') !== false) { list($customActionModuleName, $customActionViewName) = explode('/', $customActionUrl); $customActionModule = eZModule::exists($customActionModuleName); if (!$customActionModule instanceof eZModule) { eZDebug::writeError("Could not load custom action module for: {$customActionUrl}", "kernel/content/action.php"); } $result = $customActionModule->run($customActionViewName, array()); if (isset($result['content']) && $result['content']) { return $result; } else { $module->setExitStatus($customActionModule->exitStatus()); $module->setRedirectURI($customActionModule->redirectURI()); return $result; } } else { return $module->run($customActionUrl); } }
} // Redirect to request URI if it is set, if not view the new object in main node if ( $upload->attribute( 'result_uri' ) ) { $uri = $upload->attribute( 'result_uri' ); return $module->redirectTo( $uri ); } else if ( $upload->attribute( 'result_module' ) ) { $data = $upload->attribute( 'result_module' ); $moduleName = $data[0]; $view = $data[1]; $parameters = isset( $data[2] ) ? $data[2] : array(); $userParameters = isset( $data[3] ) ? $data[3] : array(); $resultModule = eZModule::findModule( $moduleName, $module ); $resultModule->setCurrentAction( $upload->attribute( 'result_action_name' ), $view ); $actionParameters = false; if ( $upload->hasAttribute( 'result_action_parameters' ) ) { $actionParameters = $upload->attribute( 'result_action_parameters' ); } if ( $actionParameters ) { foreach ( $actionParameters as $actionParameterName => $actionParameter ) { $resultModule->setActionParameter( $actionParameterName, $actionParameter, $view ); } } return $resultModule->run( $view, $parameters, false, $userParameters );
/** * Reloads extensions and changes siteaccess globally * If you only want changes on a instance of ini, use {@link eZSiteAccess::getIni()} * * - clears all in-memory caches used by the INI system * - re-builds the list of paths where INI files are searched for * - runs {@link eZSiteAccess::change()} * - re-searches module paths {@link eZModule::setGlobalPathList()} * * @since 4.4 * @param array $access An associative array with 'name' (string), 'type' (int) and 'uri_part' (array). * See {@link eZSiteAccess::match()} for array structure definition * @param eZINI|null $siteINI Optional parameter to be able to only do change on specific instance of site.ini * If set, then global siteacceess will not be changed as well. * @return array The $access parameter */ static function load( array $access, eZINI $siteINI = null ) { $currentSiteAccess = $GLOBALS['eZCurrentAccess']; unset( $GLOBALS['eZCurrentAccess'] ); // Clear all ini override dirs if ( $siteINI instanceof eZINI ) { $siteINI->resetOverrideDirs(); } else { eZINI::resetAllInstances(); eZExtension::clearActiveExtensionsMemoryCache(); eZTemplateDesignResource::clearInMemoryCache(); } // Reload extensions, siteaccess and access extensions eZExtension::activateExtensions( 'default', $siteINI ); $access = self::change( $access, $siteINI ); eZExtension::activateExtensions( 'access', $siteINI ); // Restore current (old) siteacces if changes where only to be applied to locale instance of site.ini if ( $siteINI instanceof eZINI ) { $GLOBALS['eZCurrentAccess'] = $currentSiteAccess; } else { $moduleRepositories = eZModule::activeModuleRepositories(); eZModule::setGlobalPathList( $moduleRepositories ); } return $access; }
eZWebDAVContentBackend::appendLogEntry("****************************************"); // $templateResult = null; // eZDisplayResult( $templateResult ); } // Check and proceed only if WebDAV functionality is enabled: if ($enable === 'true') { eZExecution::addCleanupHandler('eZDBCleanup'); eZExecution::addFatalErrorHandler('eZFatalError'); eZDebug::setHandleType(eZDebug::HANDLE_FROM_PHP); if (!isset($_SERVER['REQUEST_URI']) or !isset($_SERVER['REQUEST_METHOD'])) { // We stop the script if these are missing // e.g. if run from the shell eZExecution::cleanExit(); } include_once "access.php"; eZModule::setGlobalPathList(array("kernel")); eZWebDAVContentBackend::appendLogEntry("========================================"); eZWebDAVContentBackend::appendLogEntry("Requested URI is: " . $_SERVER['REQUEST_URI'], 'webdav.php'); $ini = eZINI::instance('site.ini'); // Initialize/set the index file. eZSys::init('webdav.php', $ini->variable('SiteAccessSettings', 'ForceVirtualHost') === 'true'); // @as 2009-03-04 - added cleaning up of the REQUEST_URI and HTTP_DESTINATION $_SERVER['REQUEST_URI'] = urldecode($_SERVER['REQUEST_URI']); if (isset($_SERVER['HTTP_DESTINATION'])) { $_SERVER['HTTP_DESTINATION'] = urldecode($_SERVER['HTTP_DESTINATION']); } eZWebDAVContentBackend::appendLogEntry("Used (cleaned) URI is: " . $_SERVER['REQUEST_URI'], 'webdav.php'); // The top/root folder is publicly available (without auth): if ($_SERVER['REQUEST_URI'] == '' or $_SERVER['REQUEST_URI'] == '/' or $_SERVER['REQUEST_URI'] == '/webdav.php/' or $_SERVER['REQUEST_URI'] == '/webdav.php') { // $requestUri = $_SERVER['REQUEST_URI']; // if ( $requestUri == '' )
$db = eZDB::instance(); if ( $db->isConnected() ) { eZSession::start(); } else { exitWithInternalError(); return; } $moduleINI = eZINI::instance( 'module.ini' ); $globalModuleRepositories = $moduleINI->variable( 'ModuleSettings', 'ModuleRepositories' ); eZModule::setGlobalPathList( $globalModuleRepositories ); $module = eZModule::exists( 'content' ); if ( !$module ) { exitWithInternalError(); return; } $function_name = 'treemenu'; $uri->increase(); $uri->increase(); $currentUser = eZUser::currentUser(); $siteAccessResult = $currentUser->hasAccessTo( 'user', 'login' ); $hasAccessToSite = false; if ( $siteAccessResult[ 'accessWord' ] == 'limited' ) {
/** * Forwards the current execution to another module/view with the existing * parameters. * * @param eZModule $module The eZModule object the request will be forwarded to * @param string $functionName The function to run in that module * @param array $parameters * An array of parameters that will be added to the request. These * will be merged with the existing parameters * @return array The forwarded module/view result */ function forward($module, $functionName, $parameters = false) { $Return = null; if ($module && $functionName) { $viewName = self::currentView(); if ($parameters === false) { $parameters = array(); } $parameters = array_merge($parameters, $this->OriginalViewParameters); $unorderedParameters = $this->OriginalUnorderedParameters; $userParameters = $this->UserParameters; $Return = $module->run($functionName, $parameters, $unorderedParameters, $userParameters); // override default navigation part if ($Return['is_default_navigation_part'] === true) { if ($this->singleFunction()) { $function = $this->Module["function"]; } else { $function = $this->Functions[$functionName]; } if (isset($function['default_navigation_part'])) { $Return['navigation_part'] = $function['default_navigation_part']; } } $this->RedirectURI = $module->redirectURI(); $this->setExitStatus($module->exitStatus()); } return $Return; }