Move some functions that were previously declared in admin/global.php to a new includ...
authorRobert Sesek <rsesek@bluestatic.org>
Sat, 10 Jan 2009 20:21:11 +0000 (15:21 -0500)
committerRobert Sesek <rsesek@bluestatic.org>
Sat, 10 Jan 2009 20:21:11 +0000 (15:21 -0500)
* admin/global.php: Moved functions out of this, and into...
* includes/functions_admin.php: New file

admin/global.php
includes/functions_admin.php [new file with mode: 0644]

index 2f8a485313bc73e035648a5796c13e989a34824a..8bcc915f84f1e0bdd928f482c4a1df45be42bf4e 100755 (executable)
@@ -23,6 +23,7 @@ chdir('./../');
 
 require_once('./includes/init.php');
 require_once('./includes/functions.php');
+require_once('./includes/functions_admin.php');
 
 // ###################################################################
 // setup admin templates
@@ -55,19 +56,6 @@ BSTemplate::$globalVars = array(
 
 // ###################################################################
 
-function admin_footer()
-{
-       return BSTemplate::fetch('footer')->evaluate()->getTemplate();
-}
-
-function admin_login()
-{
-       BSTemplate::fetch('login')->evaluate()->flush();
-       exit;
-}
-
-// ###################################################################
-
 if (can_perform('canadminpanel'))
 {
        $session = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "adminsession WHERE sessionid = '" . $input->inputEscape(COOKIE_PREFIX . 'adminsession') . "'");
@@ -88,70 +76,4 @@ else
        admin_login();
 }
 
-// ###################################################################
-
-// ###################################################################
-/**
-* Callback function for the Pagination->BitProcessor()
-*
-* @param       string  Base link
-* @param       bool    Do not show this as a link
-* @param       integer Page number
-* @param       object  Page navigator framework
-*
-* @return      string  Processed HTML
-*/
-function AdminPageNavigatorBitCallback($baselink, $nolink, $number, $paginator)
-{
-       if ($nolink)
-       {
-               return '<strong>' . $number . '</strong>' . "\n";
-       }
-       else
-       {
-               return '<a href="' . $baselink . 'p=' . $number . '&amp;pp=' . $paginator->getPerPage() . '">' . $number . '</a>' . "\n";
-       }
-}
-
-// ###################################################################
-/**
-* Callback function for the Pagination->NavigatorProcessor()
-*
-* @param       string  Base URL
-* @param       integer Next page number
-* @param       integer Previous page number
-* @param       array   Show information
-* @param       string  Individual page bits
-* @param       object  Page navigator framework
-*
-* @return      string  Processed HTML
-*/
-function AdminPageNavigatorCallback($baselink, $nextpage, $prevpage, $show, $pagebits, $paginator)
-{
-       global $stylevar;
-       
-       $return = '';
-       
-       if ($show['first'])
-       {
-               $return .= '<a href="' . $baselink . 'p=1&amp;pp=' . $paginator->getPerPage() . '">' . T('First') . '</a> ...';
-       }
-       if ($show['prev'])
-       {
-               $return .= '<a href="' . $baselink . 'p=' . $prevpage . '&amp;pp=' . $paginator->getPerPage() . '">' . T('Prev') . '</a> ...';
-       }
-       
-       $return .= $pagebits;
-       
-       if ($show['next'])
-       {
-               $return .= '... <a href="' . $baselink . 'p=' . $nextpage . '&amp;pp=' . $paginator->getPerPage() . '">' . T('Next') . '</a>';
-       }
-       if ($show['last'])
-       {
-               $return .= '... <a href="' . $baselink . 'p=' . $paginator->getPageCount() . '&amp;pp=' . $paginator->getPerPage() . '">' . T('Last') . '</a>';
-       }
-       return '<div style="margin-top: 15px; float: ' . $stylevar['right'] . '">' . $return . '</div>';
-}
-
 ?>
\ No newline at end of file
diff --git a/includes/functions_admin.php b/includes/functions_admin.php
new file mode 100644 (file)
index 0000000..6778235
--- /dev/null
@@ -0,0 +1,103 @@
+<?php
+/*=====================================================================*\
+|| ###################################################################
+|| # Bugdar
+|| # Copyright (c)2004-2009 Blue Static
+|| #
+|| # This program is free software; you can redistribute it and/or modify
+|| # it under the terms of the GNU General Public License as published by
+|| # the Free Software Foundation; version 2 of the License.
+|| #
+|| # This program is distributed in the hope that it will be useful, but
+|| # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+|| # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+|| # more details.
+|| #
+|| # You should have received a copy of the GNU General Public License along
+|| # with this program; if not, write to the Free Software Foundation, Inc.,
+|| # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+|| ###################################################################
+\*=====================================================================*/
+
+/**
+ * Fetches, evaluates, and returns the footer template
+ *
+ * @return     string  Footer template code
+ */
+function admin_footer()
+{
+       return BSTemplate::fetch('footer')->evaluate()->getTemplate();
+}
+
+/**
+ * Displays the login screen and ends execution of the script
+ */
+function admin_login()
+{
+       BSTemplate::fetch('login')->evaluate()->flush();
+       exit;
+}
+
+/**
+ * Callback function for the Pagination->BitProcessor()
+ *
+ * @param      string  Base link
+ * @param      bool    Do not show this as a link
+ * @param      integer Page number
+ * @param      object  Page navigator framework
+ *
+ * @return     string  Processed HTML
+ */
+function AdminPageNavigatorBitCallback($baselink, $nolink, $number, $paginator)
+{
+       if ($nolink)
+       {
+               return '<strong>' . $number . '</strong>' . "\n";
+       }
+       else
+       {
+               return '<a href="' . $baselink . 'p=' . $number . '&amp;pp=' . $paginator->getPerPage() . '">' . $number . '</a>' . "\n";
+       }
+}
+
+/**
+ * Callback function for the Pagination->NavigatorProcessor()
+ *
+ * @param      string  Base URL
+ * @param      integer Next page number
+ * @param      integer Previous page number
+ * @param      array   Show information
+ * @param      string  Individual page bits
+ * @param      object  Page navigator framework
+ *
+ * @return     string  Processed HTML
+ */
+function AdminPageNavigatorCallback($baselink, $nextpage, $prevpage, $show, $pagebits, $paginator)
+{
+       global $stylevar;
+       
+       $return = '';
+       
+       if ($show['first'])
+       {
+               $return .= '<a href="' . $baselink . 'p=1&amp;pp=' . $paginator->getPerPage() . '">' . T('First') . '</a> ...';
+       }
+       if ($show['prev'])
+       {
+               $return .= '<a href="' . $baselink . 'p=' . $prevpage . '&amp;pp=' . $paginator->getPerPage() . '">' . T('Prev') . '</a> ...';
+       }
+       
+       $return .= $pagebits;
+       
+       if ($show['next'])
+       {
+               $return .= '... <a href="' . $baselink . 'p=' . $nextpage . '&amp;pp=' . $paginator->getPerPage() . '">' . T('Next') . '</a>';
+       }
+       if ($show['last'])
+       {
+               $return .= '... <a href="' . $baselink . 'p=' . $paginator->getPageCount() . '&amp;pp=' . $paginator->getPerPage() . '">' . T('Last') . '</a>';
+       }
+       return '<div style="margin-top: 15px; float: ' . $stylevar['right'] . '">' . $return . '</div>';
+}
+
+?>
\ No newline at end of file