Constants rewritten (internal TODO)
authorRoland Häder <roland@mxchange.org>
Sun, 11 Oct 2009 17:33:23 +0000 (17:33 +0000)
committerRoland Häder <roland@mxchange.org>
Sun, 11 Oct 2009 17:33:23 +0000 (17:33 +0000)
inc/functions.php
inc/modules/admin/admin-inc.php
templates/de/html/admin/admin_main_footer.tpl
templates/de/html/admin/admin_main_header.tpl
templates/de/html/admin/admin_welcome.tpl
templates/de/html/admin/admin_welcome_admins.tpl

index 6737f4580844963e85acfa5ea4bbd88aec7d6eb9..361b71180b06a5c4ac1e1adf9bb2fa1fb5e276fd 100644 (file)
@@ -128,6 +128,7 @@ function OUTPUT_HTML ($HTML, $newLine = true) {
                        $OUTPUT = str_replace('{!_MYSQL_PREFIX!}', getConfig('_MYSQL_PREFIX'), $OUTPUT);
 
                        // Prepare the content and eval() it...
+                       $content = array();
                        $newContent = '';
                        $eval = "\$newContent = \"".COMPILE_CODE(smartAddSlashes($OUTPUT))."\";";
                        eval($eval);
@@ -1021,20 +1022,6 @@ function COMPILE_CODE ($code, $simple = false, $constants = true, $full = true)
        // But shall I keep simple quotes for later use?
        if ($simple) $code = str_replace("'", '{QUOT}', $code);
 
-       // Compile {?some_var?} to getConfig('some_var')
-       preg_match_all('/\{\?(([a-zA-Z0-9-_]+)*)\?\}/', $code, $matches);
-
-       // Some entries found?
-       if ((count($matches) > 0) && (count($matches[0]) > 0)) {
-               // Replace all matches
-               foreach ($matches[0] as $key => $match) {
-                       // Replace it
-                       //* DEBUG: */ if ($key == 0) { print '<pre>'; debug_print_backtrace(); print '</pre>'; }
-                       //* DEBUG: */ print $match.'='.$matches[1][$key].' ('.$key.')<br />';
-                       $code = str_replace($match, getConfig($matches[1][$key]), $code);
-               } // END - foreach
-       } // END - if
-
        // Find $content[bla][blub] entries
        preg_match_all('/\$(content|GLOBALS|DATA)((\[([a-zA-Z0-9-_]+)\])*)/', $code, $matches);
 
@@ -1081,6 +1068,21 @@ function COMPILE_CODE ($code, $simple = false, $constants = true, $full = true)
                } // END - foreach
        } // END - if
 
+       // Compile {?some_var?} to getConfig('some_var')
+       preg_match_all('/\{\?(([a-zA-Z0-9-_]+)*)\?\}/', $code, $matches);
+
+       // Some entries found?
+       if ((count($matches) > 0) && (count($matches[0]) > 0)) {
+               // Replace all matches
+               foreach ($matches[0] as $key => $match) {
+                       // Replace it
+                       //* DEBUG: */ if ($key == 0) { print '<pre>'; debug_print_backtrace(); print '</pre>'; }
+                       //* DEBUG: */ print htmlentities($match).'['.strlen($match).']='.$matches[1][$key].'='.getConfig($matches[1][$key]).' (key='.$key.',len='.strlen($code).')<br />';
+                       $code = str_replace($match, getConfig($matches[1][$key]), $code);
+                       //* DEBUG: */ if (($match == '{?URL?}') && (strlen($code) > 10000)) die('<pre>'.htmlentities($code).'</pre>');
+               } // END - foreach
+       } // END - if
+
        // Return compiled code
        return $code;
 }
index bb1bb5e5b9d85a63375d85f873c20745758946ad..a9d93afa433b7fa6d07da999d942f9d0abe444e4 100644 (file)
@@ -253,20 +253,20 @@ function ADMIN_DO_ACTION ($wht) {
        $act = getModeAction(getModule(), $wht);
 
        // Define admin login name and ID number
-       define('__ADMIN_LOGIN', getSession('admin_login'));
-       define('__ADMIN_ID'   , getCurrentAdminId());
+       $content['login'] = getSession('admin_login');
+       $content['id']    = getCurrentAdminId();
 
        // Preload templates
        if (EXT_IS_ACTIVE('admins')) {
-               define('__ADMIN_WELCOME', LOAD_TEMPLATE('admin_welcome_admins', true));
+               $content['welcome'] = LOAD_TEMPLATE('admin_welcome_admins', true, $content);
        } else {
-               define('__ADMIN_WELCOME', LOAD_TEMPLATE('admin_welcome', true));
+               $content['welcome'] = LOAD_TEMPLATE('admin_welcome', true, $content);
        }
-       define('__ADMIN_FOOTER' , LOAD_TEMPLATE('admin_footer' , true));
-       define('__ADMIN_MENU'   , ADD_ADMIN_MENU($act, $wht, true));
+       $content['footer'] = LOAD_TEMPLATE('admin_footer' , true, $content);
+       $content['menu']   = ADD_ADMIN_MENU($act, $wht, true, $content);
 
        // Tableset header
-       LOAD_TEMPLATE('admin_main_header');
+       LOAD_TEMPLATE('admin_main_header', false, $content);
 
        // Check if action/what pair is valid
        $result_action = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_admin_menu`
@@ -297,7 +297,7 @@ LIMIT 1", array($act, $wht, $wht), __FUNCTION__, __LINE__);
        SQL_FREERESULT($result_action);
 
        // Tableset footer
-       LOAD_TEMPLATE('admin_main_footer');
+       LOAD_TEMPLATE('admin_main_footer', false, $content);
 }
 
 //
index f522fd0c930f344c4332fc65de7df2e808f1321a..507b5f5b8638a0c16b4742093d5db05022d3765c 100644 (file)
@@ -5,6 +5,8 @@
        <td class="admin_content">&nbsp;</td>
 </tr>
 <tr>
-       <td align="center" colspan="2">{!__ADMIN_FOOTER!}</td>
+       <td align="center" colspan="2">
+               $content[footer]
+       </td>
 </tr>
 </table>
\ No newline at end of file
index 439a098cf427b2b5a704bbabc951a1948647d732..c5a800700dd9e54219c18e4f241854a46477f70c 100644 (file)
@@ -1,8 +1,11 @@
 <table border="0" cellspacing="0" cellpadding="0" class="admin_main">
        <tr>
                <td colspan="2" align="center" class="admin_welcome">
-               {!__ADMIN_WELCOME!}</td>
+                       $content[welcome]
+               </td>
        </tr>
        <tr>
-               <td class="admin_menu" valign="top">{!__ADMIN_MENU!}</td>
+               <td class="admin_menu" valign="top">
+                       $content[menu]
+               </td>
                <td class="admin_content" valign="top">
\ No newline at end of file
index 919904c961765b75d59d466a8d85eec7c2bc2d4f..b9b6fa3a3f03c72cdab599fd0e53a41ea27fe7f2 100644 (file)
@@ -6,7 +6,7 @@
                        <div align="left" class="tiny">&nbsp;&nbsp;Hallo $username!</div>
                </td>
                <td align="center" width="300" class="dashed"><div class="tiny">
-                       Aktueller Admin:&nbsp;[<span class="admin_note" title="Erweiterung admins nicht installiert.">{!__ADMIN_LOGIN!}</span>]
+                       Aktueller Admin:&nbsp;[<span class="admin_note" title="Erweiterung admins nicht installiert.">$content[login]</span>]
                </div></td>
                <td align="center" width="100" class="top2 bottom2 right2"><div class="tiny"> <a class="menu_blur admin_logout"
                        href="{?URL?}/modules.php?module=admin&amp;action=logout">Ausloggen</a>
index 30859d627a0a55d820325a5bdf8d944c42917f30..01a6d3b58f594cf0777c4ae87c556967d18fcfc3 100644 (file)
@@ -8,7 +8,7 @@
                </td>
                <td align="center" width="300" class="dashed"><div class="tiny">
                Aktueller Admin:&nbsp;[<a
-                       href="{?URL?}/modules.php?module=admin&amp;what=admins_edit&admin={!__ADMIN_ID!}"><strong>{!__ADMIN_LOGIN!}</strong></a>]
+                       href="{?URL?}/modules.php?module=admin&amp;what=admins_edit&amp;admin=$content[id]"><strong>$content[login]</strong></a>]
                </div></td>
                <td align="center" width="100" class="top2 bottom2 right2"><div class="tiny">
                        <a class="menu_blur admin_logout" href="{?URL?}/modules.php?module=admin&amp;action=logout">Ausloggen</a>