| [ Index ] |
PHP Cross Reference of Zikula 1.1.2 CORE |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Zikula Application Framework 4 * 5 * @copyright (c) 2001, Zikula Development Team 6 * @link http://www.zikula.org 7 * @version $Id: index.php 24469 2008-07-12 21:36:44Z markwest $ 8 * @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html 9 */ 10 11 // include base api 12 include 'includes/pnAPI.php'; 13 14 // start PN 15 pnInit(PN_CORE_ALL & ~PN_CORE_AJAX); 16 17 if (SessionUtil::hasExpired()) { 18 // Session has expired, display warning 19 header('HTTP/1.0 403 Access Denied'); 20 Loader::includeOnce('header.php'); 21 echo pnModAPIFunc('Users', 'user', 'expiredsession'); 22 Loader::includeOnce('footer.php'); 23 pnShutDown(); 24 } 25 26 // Get variables 27 // Note the op parameter is re-added here for gallery embedding 28 // this should be removed once gallery has been updated for better 29 // detection of zikula - assuming this parameter exists is 30 // far from the best solution - markwest 31 $module = FormUtil::getPassedValue('module', null, 'GETPOST'); 32 $type = FormUtil::getPassedValue('type', 'user', 'GETPOST'); 33 $func = FormUtil::getPassedValue('func', 'main', 'GETPOST'); 34 $name = FormUtil::getPassedValue('name', null, 'GETPOST'); 35 $file = FormUtil::getPassedValue('file', 'index', 'GETPOST'); 36 37 // Check for site closed 38 if (pnConfigGetVar('siteoff') && !SecurityUtil::checkPermission('Settings::', 'SiteOff::', ACCESS_ADMIN) && !($module == 'Users' && $func == 'siteofflogin')) { 39 if (SecurityUtil::checkPermission('Users::', '::', ACCESS_OVERVIEW) && pnUserLoggedIn()){ 40 pnUserLogOut(); 41 } 42 header('HTTP/1.1 503 Service Unavailable'); 43 if (file_exists('config/templates/siteoff.htm')) { 44 Loader::requireOnce('config/templates/siteoff.htm'); 45 } else { 46 Loader::requireOnce('includes/templates/siteoff.htm'); 47 } 48 pnShutDown(); 49 } 50 51 // check requested module and set to start module if not present 52 if (empty($name) && empty($module)) { 53 // legacy hack - some older themes rely on $GLOBALS['index'] being 1 for center blocks 54 $GLOBALS['index'] = 1; 55 $module = pnConfigGetVar('startpage'); 56 $type = pnConfigGetVar('starttype'); 57 $func = pnConfigGetVar('startfunc'); 58 $args = explode(',', pnConfigGetVar('startargs')); 59 $arguments = array(); 60 foreach ($args as $arg) { 61 if (!empty($arg)) { 62 $argument = explode('=', $arg); 63 $arguments[$argument[0]] = $argument[1]; 64 pnQueryStringSetVar($argument[0], $argument[1]); 65 } 66 } 67 } elseif (empty($module) && !empty($name)) { 68 $module = $name; 69 } 70 71 // get module information 72 $modinfo = pnModGetInfo(pnModGetIDFromName($module)); 73 74 if ($type <> 'init' && !empty($module) && !pnModAvailable($modinfo['name'])) { 75 Loader::includeOnce('header.php'); 76 LogUtil::registerError(pnML('_MODULENOTAVAILABLE', array('m' => DataUtil::formatForDisplay(strip_tags($module))), true)); 77 echo pnModFunc('Errors', 'user', 'main', array('type' => 404)); 78 Loader::includeOnce('footer.php'); 79 pnShutDown(); 80 } 81 82 if ($modinfo['type'] == 2 || $modinfo['type'] == 3) { 83 // New-new style of loading modules 84 if (!isset($arguments)) { 85 $arguments = array(); 86 } 87 88 // we need to force the mod load if we want to call a modules interactive init 89 // function because the modules is not active right now 90 $force_modload = ($type=='init') ? true : false; 91 if (empty($type)) $type = 'user'; 92 if (empty($func)) $func = 'main'; 93 if (pnModLoad($modinfo['name'], $type, $force_modload)) { 94 if (pnConfigGetVar('PN_CONFIG_USE_TRANSACTIONS')) { 95 $dbConn = pnDBGetConn(true); 96 $dbConn->StartTrans(); 97 } 98 99 $return = pnModFunc($modinfo['name'], $type, $func, $arguments); 100 101 if (pnConfigGetVar('PN_CONFIG_USE_TRANSACTIONS')) { 102 if ($dbConn->HasFailedTrans()) { 103 $return = pnML('_TRANSACTIONFAILED') . $return; 104 } 105 $dbConn->CompleteTrans(); 106 } 107 } else { 108 $return = false; 109 } 110 111 // Sort out return of function. Can be 112 // true - finished 113 // false - display error msg 114 // text - return information 115 if ($return !== true) { 116 Loader::includeOnce('header.php'); 117 if ($return === false) { 118 // check for existing errors or set a generic error 119 if (!LogUtil::hasErrors()) { 120 LogUtil::registerError(pnML('_FAILEDTOLOADMODULEATFUNC', array('m' => $modinfo['displayname'], 'f' => $func), true), 404); 121 } 122 echo pnModFunc('Errors', 'user', 'main'); 123 } elseif (is_string($return) && strlen($return) > 1) { 124 // Text 125 echo $return; 126 } elseif (is_array($return)) { 127 $pnRender = pnRender::getInstance($modinfo['name']); 128 $pnRender->assign($return); 129 if (isset($return['template'])) { 130 echo $pnRender->fetch($return['template']); 131 } else { 132 $modname = strtolower($modinfo['name']); 133 $type = strtolower($type); 134 $func = strtolower($func); 135 echo $pnRender->fetch("{$modname}_{$type}_{$func}.htm"); 136 } 137 } else { 138 LogUtil::registerError(pnML('_MODULERETURNED', array('m' => $modinfo['displayname'], 'f' => $func), true), 404); 139 echo pnModFunc('Errors', 'user', 'main'); 140 } 141 Loader::includeOnce('footer.php'); 142 } 143 } elseif ($modinfo['type'] == 1) { 144 // Old-old style of loading modules 145 define('LOADED_AS_MODULE', '1'); 146 // ensure that the module table information is available 147 pnModDBInfoLoad($modinfo['name'], $modinfo['directory']); 148 if (file_exists('modules/' . DataUtil::formatForOS($modinfo['directory']) . '/' . DataUtil::formatForOS($file) . '.php')) { 149 include 'modules/' . DataUtil::formatForOS($modinfo['directory']) . '/' . DataUtil::formatForOS($file) . '.php'; 150 } else { 151 // Failed to load the module 152 header('HTTP/1.0 404 Not Found'); 153 Loader::includeOnce('header.php'); 154 LogUtil::registerError(pnML('_FAILEDTOLOADMODULE', array('m' => $modinfo['displayname']), true), 404); 155 echo pnModFunc('Errors', 'user', 'main'); 156 Loader::includeOnce('footer.php'); 157 pnShutDown(); 158 } 159 } else { 160 Loader::includeOnce('header.php'); 161 Loader::includeOnce('footer.php'); 162 } 163 pnShutDown();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Fri Aug 21 20:39:03 2009 | Cross-referenced by PHPXref 0.7 |