root / tags / milestone_3 / phpBB / adm / pagestart.php
History | View | Annotate | Download (11.5 kB)
| 1 | 3646 | psotfx | <?php
|
|---|---|---|---|
| 2 | 5114 | acydburn | /**
|
| 3 | 5114 | acydburn | * |
| 4 | 5114 | acydburn | * @package acp |
| 5 | 5114 | acydburn | * @version $Id$ |
| 6 | 5114 | acydburn | * @copyright (c) 2005 phpBB Group |
| 7 | 5114 | acydburn | * @license http://opensource.org/licenses/gpl-license.php GNU Public License |
| 8 | 5114 | acydburn | * |
| 9 | 5114 | acydburn | */ |
| 10 | 3646 | psotfx | |
| 11 | 4970 | psotfx | if (!defined('IN_PHPBB')) |
| 12 | 3646 | psotfx | {
|
| 13 | 4970 | psotfx | exit;
|
| 14 | 3646 | psotfx | } |
| 15 | 3646 | psotfx | |
| 16 | 5114 | acydburn | /**
|
| 17 | 5114 | acydburn | */ |
| 18 | 3646 | psotfx | define('NEED_SID', true); |
| 19 | 4970 | psotfx | define('IN_ADMIN', true); |
| 20 | 3646 | psotfx | require($phpbb_root_path . 'common.'.$phpEx); |
| 21 | 4062 | psotfx | require($phpbb_root_path . 'includes/functions_admin.'.$phpEx); |
| 22 | 3646 | psotfx | |
| 23 | 3646 | psotfx | // Start session management
|
| 24 | 5244 | acydburn | $user->session_begin();
|
| 25 | 4970 | psotfx | $auth->acl($user->data); |
| 26 | 4970 | psotfx | $user->setup('admin'); |
| 27 | 4970 | psotfx | // End session management
|
| 28 | 3650 | psotfx | |
| 29 | 3650 | psotfx | // Did user forget to login? Give 'em a chance to here ...
|
| 30 | 5117 | acydburn | if (!$user->data['is_registered']) |
| 31 | 3650 | psotfx | {
|
| 32 | 5117 | acydburn | if ($user->data['is_bot']) |
| 33 | 5117 | acydburn | {
|
| 34 | 5117 | acydburn | redirect("../index.$phpEx$SID");
|
| 35 | 5117 | acydburn | } |
| 36 | 5117 | acydburn | |
| 37 | 4970 | psotfx | login_box('', $user->lang['LOGIN_ADMIN'], $user->lang['LOGIN_ADMIN_SUCCESS'], true); |
| 38 | 3650 | psotfx | } |
| 39 | 3650 | psotfx | |
| 40 | 4970 | psotfx | // Have they authenticated (again) as an admin for this session?
|
| 41 | 5083 | acydburn | if (!$user->data['session_admin']) |
| 42 | 4970 | psotfx | {
|
| 43 | 4970 | psotfx | login_box('', $user->lang['LOGIN_ADMIN_CONFIRM'], $user->lang['LOGIN_ADMIN_SUCCESS'], true, false); |
| 44 | 4970 | psotfx | } |
| 45 | 3646 | psotfx | |
| 46 | 4970 | psotfx | // Is user any type of admin? No, then stop here, each script needs to
|
| 47 | 4970 | psotfx | // check specific permissions but this is a catchall
|
| 48 | 4970 | psotfx | if (!$auth->acl_get('a_')) |
| 49 | 4970 | psotfx | {
|
| 50 | 4970 | psotfx | trigger_error($user->lang['NO_ADMIN']); |
| 51 | 4970 | psotfx | } |
| 52 | 4970 | psotfx | |
| 53 | 4781 | psotfx | // Some oft used variables
|
| 54 | 4781 | psotfx | $safe_mode = (@ini_get('safe_mode') || @strtolower(ini_get('safe_mode')) == 'on') ? true : false; |
| 55 | 4950 | psotfx | $file_uploads = (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on') ? true : false; |
| 56 | 4781 | psotfx | |
| 57 | 4781 | psotfx | |
| 58 | 3646 | psotfx | // -----------------------------
|
| 59 | 3646 | psotfx | // Functions
|
| 60 | 3969 | psotfx | function adm_page_header($sub_title, $meta = '', $table_html = true) |
| 61 | 3646 | psotfx | {
|
| 62 | 3646 | psotfx | global $config, $db, $user, $phpEx; |
| 63 | 3646 | psotfx | |
| 64 | 3646 | psotfx | define('HEADER_INC', true); |
| 65 | 3646 | psotfx | |
| 66 | 3646 | psotfx | // gzip_compression
|
| 67 | 3646 | psotfx | if ($config['gzip_compress']) |
| 68 | 3646 | psotfx | {
|
| 69 | 3646 | psotfx | if (extension_loaded('zlib') && !headers_sent()) |
| 70 | 3646 | psotfx | {
|
| 71 | 3646 | psotfx | ob_start('ob_gzhandler');
|
| 72 | 3646 | psotfx | } |
| 73 | 3646 | psotfx | } |
| 74 | 3646 | psotfx | |
| 75 | 3646 | psotfx | header("Content-type: text/html; charset=" . $user->lang['ENCODING']); |
| 76 | 3646 | psotfx | |
| 77 | 3646 | psotfx | ?>
|
| 78 | 3646 | psotfx | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
| 79 | 3646 | psotfx | <html>
|
| 80 | 3646 | psotfx | <head>
|
| 81 | 3646 | psotfx | <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $user->lang['ENCODING']; ?>"> |
| 82 | 3646 | psotfx | <meta http-equiv="Content-Style-Type" content="text/css"> |
| 83 | 3646 | psotfx | <link rel="stylesheet" href="subSilver.css" type="text/css"> |
| 84 | 3646 | psotfx | <?php
|
| 85 | 3646 | psotfx | |
| 86 | 3646 | psotfx | echo $meta; |
| 87 | 3646 | psotfx | |
| 88 | 3646 | psotfx | ?>
|
| 89 | 3646 | psotfx | <style type="text/css"> |
| 90 | 3646 | psotfx | <!--
|
| 91 | 3646 | psotfx | th { background-image: url('images/cellpic3.gif') }
|
| 92 | 3646 | psotfx | td.cat { background-image: url('images/cellpic1.gif') }
|
| 93 | 3646 | psotfx | //--> |
| 94 | 3646 | psotfx | </style>
|
| 95 | 4907 | psotfx | <title><?php echo $config['sitename'] . ' - ' . $page_title; ?></title> |
| 96 | 3646 | psotfx | </head>
|
| 97 | 3646 | psotfx | <body>
|
| 98 | 3646 | psotfx | |
| 99 | 3646 | psotfx | <?php
|
| 100 | 3646 | psotfx | |
| 101 | 3646 | psotfx | if ($table_html) |
| 102 | 3646 | psotfx | {
|
| 103 | 3646 | psotfx | |
| 104 | 3646 | psotfx | ?>
|
| 105 | 3646 | psotfx | <a name="top"></a> |
| 106 | 3646 | psotfx | |
| 107 | 3646 | psotfx | <table width="100%" cellspacing="0" cellpadding="0" border="0"> |
| 108 | 3646 | psotfx | <tr>
|
| 109 | 3646 | psotfx | <td colspan="2" height="25" align="right" nowrap="nowrap"><span class="subtitle">» <i><?php echo $sub_title; ?></i></span> </td> |
| 110 | 3646 | psotfx | </tr>
|
| 111 | 3646 | psotfx | </table>
|
| 112 | 3646 | psotfx | |
| 113 | 3646 | psotfx | <table width="95%" cellspacing="0" cellpadding="0" border="0" align="center"> |
| 114 | 3646 | psotfx | <tr>
|
| 115 | 3646 | psotfx | <td><br clear="all" /> |
| 116 | 3646 | psotfx | |
| 117 | 3646 | psotfx | <?php
|
| 118 | 3646 | psotfx | |
| 119 | 3646 | psotfx | } |
| 120 | 3646 | psotfx | |
| 121 | 3646 | psotfx | } |
| 122 | 3646 | psotfx | |
| 123 | 3969 | psotfx | function adm_page_footer($copyright_html = true) |
| 124 | 3646 | psotfx | {
|
| 125 | 3646 | psotfx | global $cache, $config, $db, $phpEx; |
| 126 | 3646 | psotfx | |
| 127 | 3961 | psotfx | if (!empty($cache)) |
| 128 | 3961 | psotfx | {
|
| 129 | 3961 | psotfx | $cache->unload();
|
| 130 | 3961 | psotfx | } |
| 131 | 3961 | psotfx | |
| 132 | 4365 | ludovic_arnaud | // Close our DB connection. |
| 133 | 4365 | ludovic_arnaud | $db->sql_close();
|
| 134 | 4365 | ludovic_arnaud | |
| 135 | 3646 | psotfx | ?>
|
| 136 | 3646 | psotfx | |
| 137 | 3646 | psotfx | </td>
|
| 138 | 3646 | psotfx | </tr>
|
| 139 | 3646 | psotfx | </table>
|
| 140 | 3646 | psotfx | <?php
|
| 141 | 3646 | psotfx | |
| 142 | 3646 | psotfx | if ($copyright_html) |
| 143 | 3646 | psotfx | {
|
| 144 | 3646 | psotfx | |
| 145 | 3646 | psotfx | ?>
|
| 146 | 3646 | psotfx | |
| 147 | 3961 | psotfx | <div class="copyright" align="center">Powered by phpBB <?php echo $config['version']; ?> © 2002 <a href="http://www.phpbb.com/" target="_phpbb">phpBB Group</a></div> |
| 148 | 3646 | psotfx | |
| 149 | 3646 | psotfx | <br clear="all" /> |
| 150 | 3646 | psotfx | |
| 151 | 3646 | psotfx | </body>
|
| 152 | 3646 | psotfx | </html>
|
| 153 | 3646 | psotfx | <?php
|
| 154 | 3646 | psotfx | |
| 155 | 3646 | psotfx | } |
| 156 | 3646 | psotfx | |
| 157 | 3646 | psotfx | exit; |
| 158 | 3646 | psotfx | } |
| 159 | 3646 | psotfx | |
| 160 | 5071 | acydburn | function adm_page_message($title, $message, $show_header = false) |
| 161 | 3646 | psotfx | {
|
| 162 | 5071 | acydburn | global $phpEx, $SID, $user; |
| 163 | 3646 | psotfx | |
| 164 | 3646 | psotfx | if ($show_header) |
| 165 | 3646 | psotfx | {
|
| 166 | 3646 | psotfx | |
| 167 | 3646 | psotfx | ?>
|
| 168 | 3646 | psotfx | |
| 169 | 3646 | psotfx | <table width="100%" cellspacing="0" cellpadding="0" border="0"> |
| 170 | 3646 | psotfx | <tr>
|
| 171 | 4781 | psotfx | <td><a href="<?php echo "../index.$phpEx$SID"; ?>"><img src="images/header_left.jpg" width="200" height="60" alt="phpBB Logo" title="phpBB Logo" border="0"/></a></td> |
| 172 | 3646 | psotfx | <td width="100%" background="images/header_bg.jpg" height="60" align="right" nowrap="nowrap"><span class="maintitle"><?php echo $user->lang['ADMIN_TITLE']; ?></span> </td> |
| 173 | 3646 | psotfx | </tr>
|
| 174 | 3646 | psotfx | </table>
|
| 175 | 3646 | psotfx | |
| 176 | 3646 | psotfx | <?php
|
| 177 | 3646 | psotfx | |
| 178 | 3646 | psotfx | } |
| 179 | 3646 | psotfx | |
| 180 | 3646 | psotfx | ?>
|
| 181 | 3646 | psotfx | |
| 182 | 3646 | psotfx | <br /><br /> |
| 183 | 3646 | psotfx | |
| 184 | 4781 | psotfx | <table class="bg" width="80%" cellspacing="1" cellpadding="4" border="0" align="center"> |
| 185 | 3646 | psotfx | <tr>
|
| 186 | 3646 | psotfx | <th><?php echo $title; ?></th> |
| 187 | 3646 | psotfx | </tr>
|
| 188 | 3646 | psotfx | <tr>
|
| 189 | 5071 | acydburn | <td class="row1" align="center"><?php echo $message; ?></td> |
| 190 | 3646 | psotfx | </tr>
|
| 191 | 3646 | psotfx | </table>
|
| 192 | 3646 | psotfx | |
| 193 | 3646 | psotfx | <br /> |
| 194 | 3646 | psotfx | |
| 195 | 3646 | psotfx | <?php
|
| 196 | 3646 | psotfx | |
| 197 | 3646 | psotfx | } |
| 198 | 4781 | psotfx | |
| 199 | 4781 | psotfx | function adm_page_confirm($title, $message) |
| 200 | 4781 | psotfx | {
|
| 201 | 4781 | psotfx | global $phpEx, $SID, $user; |
| 202 | 4781 | psotfx | |
| 203 | 4950 | psotfx | // Grab data from GET and POST arrays ... note this is _not_ |
| 204 | 4781 | psotfx | // validated! Everything is typed as string to ensure no |
| 205 | 4781 | psotfx | // funny business on displayed hidden field data. Validation |
| 206 | 4781 | psotfx | // will be carried out by whatever processes this form. |
| 207 | 4781 | psotfx | $var_ary = array_merge($_GET, $_POST); |
| 208 | 4781 | psotfx | |
| 209 | 4781 | psotfx | $s_hidden_fields = ''; |
| 210 | 4781 | psotfx | foreach ($var_ary as $key => $var)
|
| 211 | 4781 | psotfx | {
|
| 212 | 4781 | psotfx | if (empty($var)) |
| 213 | 4781 | psotfx | {
|
| 214 | 4781 | psotfx | continue; |
| 215 | 4781 | psotfx | } |
| 216 | 4781 | psotfx | |
| 217 | 4781 | psotfx | if (is_array($var)) |
| 218 | 4781 | psotfx | {
|
| 219 | 4781 | psotfx | foreach ($var as $k => $v)
|
| 220 | 4781 | psotfx | {
|
| 221 | 4781 | psotfx | if (is_array($v)) |
| 222 | 4781 | psotfx | {
|
| 223 | 4781 | psotfx | foreach ($v as $_k => $_v)
|
| 224 | 4781 | psotfx | {
|
| 225 | 4781 | psotfx | set_var($var[$k][$_k], $_v, 'string'); |
| 226 | 4781 | psotfx | $s_hidden_fields .= "<input type=\"hidden\" name=\"${key}[$k][$_k]\" value=\"" . addslashes($_v) . '" />'; |
| 227 | 4781 | psotfx | } |
| 228 | 4781 | psotfx | } |
| 229 | 4781 | psotfx | else |
| 230 | 4781 | psotfx | {
|
| 231 | 4781 | psotfx | set_var($var[$k], $v, 'string'); |
| 232 | 4781 | psotfx | $s_hidden_fields .= "<input type=\"hidden\" name=\"${key}[$k]\" value=\"" . addslashes($v) . '" />'; |
| 233 | 4781 | psotfx | } |
| 234 | 4781 | psotfx | } |
| 235 | 4781 | psotfx | } |
| 236 | 4781 | psotfx | else |
| 237 | 4781 | psotfx | {
|
| 238 | 4781 | psotfx | set_var($var, $var, 'string'); |
| 239 | 4781 | psotfx | $s_hidden_fields .= '<input type="hidden" name="' . $key . '" value="' . addslashes($var) . '" />'; |
| 240 | 4781 | psotfx | } |
| 241 | 4781 | psotfx | unset($var_ary[$key]); |
| 242 | 4781 | psotfx | } |
| 243 | 4781 | psotfx | |
| 244 | 4781 | psotfx | ?>
|
| 245 | 4781 | psotfx | |
| 246 | 4781 | psotfx | <br /><br /> |
| 247 | 4781 | psotfx | |
| 248 | 4833 | acydburn | <form name="confirm" method="post" action="<?php echo $_SERVER['SCRIPT_NAME'] . $SID; ?>"> |
| 249 | 4781 | psotfx | <table class="bg" width="80%" cellspacing="1" cellpadding="4" border="0" align="center"> |
| 250 | 4781 | psotfx | <tr>
|
| 251 | 4781 | psotfx | <th><?php echo $title; ?></th> |
| 252 | 4781 | psotfx | </tr>
|
| 253 | 4781 | psotfx | <tr>
|
| 254 | 4781 | psotfx | <td class="row1" align="center"><?php echo $message; ?><br /><br /><input class="btnlite" type="submit" name="confirm" value="<?php echo $user->lang['YES']; ?>" /> <input class="btnmain" type="submit" name="cancel" value="<?php echo $user->lang['NO']; ?>" /></td> |
| 255 | 4781 | psotfx | </tr>
|
| 256 | 4781 | psotfx | </table>
|
| 257 | 4781 | psotfx | |
| 258 | 4781 | psotfx | <?php echo $s_hidden_fields; ?> |
| 259 | 4781 | psotfx | </form>
|
| 260 | 4781 | psotfx | |
| 261 | 4781 | psotfx | <br /> |
| 262 | 4781 | psotfx | |
| 263 | 4781 | psotfx | <?php
|
| 264 | 4781 | psotfx | |
| 265 | 4781 | psotfx | adm_page_footer(); |
| 266 | 4781 | psotfx | |
| 267 | 4781 | psotfx | } |
| 268 | 4907 | psotfx | |
| 269 | 4970 | psotfx | |
| 270 | 4970 | psotfx | function build_cfg_template($tpl_type, $config_key, $options = '') |
| 271 | 4970 | psotfx | {
|
| 272 | 4970 | psotfx | global $new, $user; |
| 273 | 4970 | psotfx | |
| 274 | 4970 | psotfx | $tpl = ''; |
| 275 | 4970 | psotfx | $name = 'config[' . $config_key . ']'; |
| 276 | 4970 | psotfx | |
| 277 | 4970 | psotfx | switch ($tpl_type[0]) |
| 278 | 4970 | psotfx | {
|
| 279 | 4970 | psotfx | case 'text': |
| 280 | 4970 | psotfx | case 'password': |
| 281 | 4970 | psotfx | $size = (int) $tpl_type[1]; |
| 282 | 4970 | psotfx | $maxlength = (int) $tpl_type[2]; |
| 283 | 4970 | psotfx | |
| 284 | 4970 | psotfx | $tpl = '<input class="post" type="' . $tpl_type[0] . '"' . (($size) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength) ? $maxlength : 255) . '" name="' . $name . '" value="' . $new[$config_key] . '" />'; |
| 285 | 4970 | psotfx | break; |
| 286 | 4970 | psotfx | |
| 287 | 4970 | psotfx | case 'dimension': |
| 288 | 4970 | psotfx | $size = (int) $tpl_type[1]; |
| 289 | 4970 | psotfx | $maxlength = (int) $tpl_type[2]; |
| 290 | 4970 | psotfx | |
| 291 | 4970 | psotfx | $tpl = '<input class="post" type="text"' . (($size) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength) ? $maxlength : 255) . '" name="config[' . $config_key . '_height]" value="' . $new[$config_key . '_height'] . '" /> x <input class="post" type="text"' . (($size) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength) ? $maxlength : 255) . '" name="config[' . $config_key . '_width]" value="' . $new[$config_key . '_width'] . '" />'; |
| 292 | 4970 | psotfx | break; |
| 293 | 4970 | psotfx | |
| 294 | 4970 | psotfx | case 'textarea': |
| 295 | 4970 | psotfx | $rows = (int) $tpl_type[1]; |
| 296 | 4970 | psotfx | $cols = (int) $tpl_type[2]; |
| 297 | 4970 | psotfx | |
| 298 | 4970 | psotfx | $tpl = '<textarea name="' . $name . '" rows="' . $rows . '" cols="' . $cols . '">' . $new[$config_key] . '</textarea>'; |
| 299 | 4970 | psotfx | break; |
| 300 | 4970 | psotfx | |
| 301 | 4970 | psotfx | case 'radio': |
| 302 | 4970 | psotfx | $key_yes = ($new[$config_key]) ? ' checked="checked"' : ''; |
| 303 | 4970 | psotfx | $key_no = (!$new[$config_key]) ? ' checked="checked"' : ''; |
| 304 | 4970 | psotfx | |
| 305 | 4970 | psotfx | $tpl_type_cond = explode('_', $tpl_type[1]);
|
| 306 | 4970 | psotfx | $type_no = ($tpl_type_cond[0] == 'disabled' || $tpl_type_cond[0] == 'enabled') ? false : true; |
| 307 | 4970 | psotfx | |
| 308 | 4970 | psotfx | $tpl_no = '<input type="radio" name="' . $name . '" value="0"' . $key_no . ' />' . (($type_no) ? $user->lang['NO'] : $user->lang['DISABLED']); |
| 309 | 4970 | psotfx | $tpl_yes = '<input type="radio" name="' . $name . '" value="1"' . $key_yes . ' />' . (($type_no) ? $user->lang['YES'] : $user->lang['ENABLED']); |
| 310 | 4970 | psotfx | |
| 311 | 4970 | psotfx | $tpl = ($tpl_type_cond[0] == 'yes' || $tpl_type_cond[0] == 'enabled') ? $tpl_yes . ' ' . $tpl_no : $tpl_no . ' ' . $tpl_yes; |
| 312 | 4970 | psotfx | break; |
| 313 | 4970 | psotfx | |
| 314 | 4970 | psotfx | case 'select': |
| 315 | 4970 | psotfx | eval('$s_options = ' . str_replace('{VALUE}', $new[$config_key], $options) . ';');
|
| 316 | 4970 | psotfx | $tpl = '<select name="' . $name . '">' . $s_options . '</select>'; |
| 317 | 4970 | psotfx | break; |
| 318 | 4970 | psotfx | |
| 319 | 4970 | psotfx | case 'custom': |
| 320 | 4970 | psotfx | eval('$tpl = ' . str_replace('{VALUE}', $new[$config_key], $options) . ';');
|
| 321 | 4970 | psotfx | break; |
| 322 | 4970 | psotfx | |
| 323 | 4970 | psotfx | default: |
| 324 | 4970 | psotfx | break; |
| 325 | 4970 | psotfx | } |
| 326 | 4970 | psotfx | |
| 327 | 4970 | psotfx | return $tpl; |
| 328 | 4970 | psotfx | } |
| 329 | 4970 | psotfx | |
| 330 | 4970 | psotfx | |
| 331 | 5114 | acydburn | /** |
| 332 | 5114 | acydburn | * @package acp |
| 333 | 5114 | acydburn | * General ACP module class |
| 334 | 5114 | acydburn | */ |
| 335 | 4907 | psotfx | class module |
| 336 | 4907 | psotfx | {
|
| 337 | 4907 | psotfx | var $id = 0; |
| 338 | 4907 | psotfx | var $type; |
| 339 | 4907 | psotfx | var $name; |
| 340 | 4907 | psotfx | var $mode; |
| 341 | 4907 | psotfx | |
| 342 | 4907 | psotfx | // Private methods, should not be overwritten |
| 343 | 4907 | psotfx | function create($module_type, $module_url, $selected_mod = false, $selected_submod = false) |
| 344 | 4907 | psotfx | {
|
| 345 | 4907 | psotfx | global $template, $auth, $db, $user, $config; |
| 346 | 4907 | psotfx | |
| 347 | 4907 | psotfx | $sql = 'SELECT module_id, module_title, module_filename, module_subs, module_acl |
| 348 | 4907 | psotfx | FROM ' . MODULES_TABLE . " |
| 349 | 4907 | psotfx | WHERE module_type = 'acp' |
| 350 | 4907 | psotfx | AND module_enabled = 1 |
| 351 | 4907 | psotfx | ORDER BY module_order ASC"; |
| 352 | 4907 | psotfx | $result = $db->sql_query($sql);
|
| 353 | 4907 | psotfx | |
| 354 | 4907 | psotfx | while ($row = $db->sql_fetchrow($result))
|
| 355 | 4907 | psotfx | {
|
| 356 | 4907 | psotfx | // Authorisation is required for the basic module |
| 357 | 4907 | psotfx | if ($row['module_acl']) |
| 358 | 4907 | psotfx | {
|
| 359 | 4907 | psotfx | $is_auth = false; |
| 360 | 4907 | psotfx | |
| 361 | 4907 | psotfx | eval('$is_auth = (' . preg_replace(array('#acl_([a-z_]+)#e', '#cfg_([a-z_]+)#e'), array('$auth->acl_get("\\1")', '$config["\\1"]'), $row['module_acl']) . ');');
|
| 362 | 4907 | psotfx | |
| 363 | 4907 | psotfx | // The user is not authorised to use this module, skip it |
| 364 | 4907 | psotfx | if (!$is_auth) |
| 365 | 4907 | psotfx | {
|
| 366 | 4907 | psotfx | continue; |
| 367 | 4907 | psotfx | } |
| 368 | 4907 | psotfx | } |
| 369 | 4907 | psotfx | |
| 370 | 4907 | psotfx | $selected = ($row['module_filename'] == $selected_mod || $row['module_id'] == $selected_mod || (!$selected_mod && !$i)) ? true : false; |
| 371 | 4907 | psotfx | /* |
| 372 | 4907 | psotfx | // Get the localised lang string if available, or make up our own otherwise |
| 373 | 4907 | psotfx | $template->assign_block_vars($module_type . '_section', array(
|
| 374 | 4907 | psotfx | 'L_TITLE' => (isset($user->lang[strtoupper($module_type) . '_' . $row['module_title']])) ? $user->lang[strtoupper($module_type) . '_' . $row['module_title']] : ucfirst(str_replace('_', ' ', strtolower($row['module_title']))), |
| 375 | 4950 | psotfx | 'S_SELECTED' => $selected,
|
| 376 | 4907 | psotfx | 'U_TITLE' => $module_url . '&i=' . $row['module_id']) |
| 377 | 4907 | psotfx | ); |
| 378 | 4907 | psotfx | */ |
| 379 | 4907 | psotfx | if ($selected) |
| 380 | 4907 | psotfx | {
|
| 381 | 4907 | psotfx | $module_id = $row['module_id']; |
| 382 | 4907 | psotfx | $module_name = $row['module_filename']; |
| 383 | 4907 | psotfx | |
| 384 | 4907 | psotfx | if ($row['module_subs']) |
| 385 | 4907 | psotfx | {
|
| 386 | 4907 | psotfx | $j = 0; |
| 387 | 4907 | psotfx | $submodules_ary = explode("\n", $row['module_subs']);
|
| 388 | 4907 | psotfx | foreach ($submodules_ary as $submodule) |
| 389 | 4907 | psotfx | {
|
| 390 | 4907 | psotfx | $submodule = explode(',', trim($submodule));
|
| 391 | 4907 | psotfx | $submodule_title = array_shift($submodule); |
| 392 | 4907 | psotfx | |
| 393 | 4907 | psotfx | $is_auth = true; |
| 394 | 4907 | psotfx | foreach ($submodule as $auth_option) |
| 395 | 4907 | psotfx | {
|
| 396 | 4907 | psotfx | if (!$auth->acl_get($auth_option))
|
| 397 | 4907 | psotfx | {
|
| 398 | 4907 | psotfx | $is_auth = false; |
| 399 | 4907 | psotfx | } |
| 400 | 4907 | psotfx | } |
| 401 | 4907 | psotfx | |
| 402 | 4907 | psotfx | if (!$is_auth) |
| 403 | 4907 | psotfx | {
|
| 404 | 4907 | psotfx | continue; |
| 405 | 4907 | psotfx | } |
| 406 | 4907 | psotfx | |
| 407 | 4907 | psotfx | $selected = ($submodule_title == $selected_submod || (!$selected_submod && !$j)) ? true : false; |
| 408 | 4907 | psotfx | /* |
| 409 | 4907 | psotfx | // Get the localised lang string if available, or make up our own otherwise |
| 410 | 4907 | psotfx | $template->assign_block_vars("{$module_type}_section.{$module_type}_subsection", array(
|
| 411 | 4907 | psotfx | 'L_TITLE' => (isset($user->lang[strtoupper($module_type) . '_' . strtoupper($submodule_title)])) ? $user->lang[strtoupper($module_type) . '_' . strtoupper($submodule_title)] : ucfirst(str_replace('_', ' ', strtolower($submodule_title))), |
| 412 | 4950 | psotfx | 'S_SELECTED' => $selected,
|
| 413 | 4907 | psotfx | 'U_TITLE' => $module_url . '&i=' . $module_id . '&mode=' . $submodule_title |
| 414 | 4907 | psotfx | )); |
| 415 | 4907 | psotfx | */ |
| 416 | 4907 | psotfx | if ($selected) |
| 417 | 4907 | psotfx | {
|
| 418 | 4907 | psotfx | $this->mode = $submodule_title;
|
| 419 | 4907 | psotfx | } |
| 420 | 4907 | psotfx | |
| 421 | 4907 | psotfx | $j++; |
| 422 | 4907 | psotfx | } |
| 423 | 4907 | psotfx | } |
| 424 | 4907 | psotfx | } |
| 425 | 4907 | psotfx | |
| 426 | 4907 | psotfx | $i++; |
| 427 | 4907 | psotfx | } |
| 428 | 4907 | psotfx | $db->sql_freeresult($result);
|
| 429 | 4907 | psotfx | |
| 430 | 4907 | psotfx | if (!$module_id) |
| 431 | 4907 | psotfx | {
|
| 432 | 4907 | psotfx | trigger_error('MODULE_NOT_EXIST');
|
| 433 | 4907 | psotfx | } |
| 434 | 4907 | psotfx | |
| 435 | 4907 | psotfx | $this->type = $module_type;
|
| 436 | 4907 | psotfx | $this->id = $module_id;
|
| 437 | 4907 | psotfx | $this->name = $module_name;
|
| 438 | 4907 | psotfx | } |
| 439 | 4907 | psotfx | |
| 440 | 4907 | psotfx | // Public methods to be overwritten by modules |
| 441 | 4907 | psotfx | function module() |
| 442 | 4907 | psotfx | {
|
| 443 | 4907 | psotfx | // Module name |
| 444 | 4907 | psotfx | // Module filename |
| 445 | 4907 | psotfx | // Module description |
| 446 | 4907 | psotfx | // Module version |
| 447 | 4907 | psotfx | // Module compatibility |
| 448 | 4907 | psotfx | return false; |
| 449 | 4907 | psotfx | } |
| 450 | 4907 | psotfx | |
| 451 | 4907 | psotfx | function init() |
| 452 | 4907 | psotfx | {
|
| 453 | 4907 | psotfx | return false; |
| 454 | 4907 | psotfx | } |
| 455 | 4907 | psotfx | |
| 456 | 4907 | psotfx | function install() |
| 457 | 4907 | psotfx | {
|
| 458 | 4907 | psotfx | return false; |
| 459 | 4907 | psotfx | } |
| 460 | 4907 | psotfx | |
| 461 | 4907 | psotfx | function uninstall() |
| 462 | 4907 | psotfx | {
|
| 463 | 4907 | psotfx | return false; |
| 464 | 4907 | psotfx | } |
| 465 | 4907 | psotfx | } |
| 466 | 3646 | psotfx | // End Functions |
| 467 | 3646 | psotfx | // ----------------------------- |
| 468 | 3646 | psotfx | |
| 469 | 3646 | psotfx | ?> |

