From 9d81813f782e6e9edf693eabcc73e5ce4660aee6 Mon Sep 17 00:00:00 2001
From: =?utf8?q?Roland=20H=C3=A4der?= <roland@mxchange.org>
Date: Tue, 16 Sep 2008 17:44:21 +0000
Subject: [PATCH] Obsolete templates removed, surfbar fixed (admin add, userid
 not used)

---
 .gitattributes                                |  5 -
 inc/databases.php                             |  2 +-
 inc/libs/surfbar_functions.php                |  8 +-
 inc/modules/admin/what-admins_contact.php     | 98 -------------------
 inc/modules/admin/what-cache_stats.php        | 12 ++-
 .../de/emails/admins_mail_contact_admin.tpl   | 16 ---
 .../de/emails/admins_msg_contact_admin.tpl    | 16 ---
 .../html/admin/admin_admins_contact_form.tpl  | 33 -------
 .../html/member/member_support_contacted.tpl  | 20 ----
 9 files changed, 12 insertions(+), 198 deletions(-)
 delete mode 100644 inc/modules/admin/what-admins_contact.php
 delete mode 100644 templates/de/emails/admins_mail_contact_admin.tpl
 delete mode 100644 templates/de/emails/admins_msg_contact_admin.tpl
 delete mode 100644 templates/de/html/admin/admin_admins_contact_form.tpl
 delete mode 100644 templates/de/html/member/member_support_contacted.tpl

diff --git a/.gitattributes b/.gitattributes
index 12f352f3c8..9fb971a6f3 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -272,7 +272,6 @@ inc/modules/admin/what-add_surfbar_url.php -text
 inc/modules/admin/what-admin_add.php -text
 inc/modules/admin/what-adminedit.php -text
 inc/modules/admin/what-admins_add.php -text
-inc/modules/admin/what-admins_contact.php -text
 inc/modules/admin/what-admins_contct.php -text
 inc/modules/admin/what-admins_edit.php -text
 inc/modules/admin/what-admins_mails.php -text
@@ -634,9 +633,7 @@ templates/de/emails/admin/admin_wernis_request.tpl -text
 templates/de/emails/admins/.htaccess -text
 templates/de/emails/admins/admins_mail_contct_admin.tpl -text
 templates/de/emails/admins/admins_msg_contct_admin.tpl -text
-templates/de/emails/admins_mail_contact_admin.tpl -text
 templates/de/emails/admins_mail_contct_admin.tpl -text
-templates/de/emails/admins_msg_contact_admin.tpl -text
 templates/de/emails/admins_msg_contct_admin.tpl -text
 templates/de/emails/back-admin.tpl -text
 templates/de/emails/back-member.tpl -text
@@ -756,7 +753,6 @@ templates/de/html/admin/admin_add_surfbar_url.tpl -text
 templates/de/html/admin/admin_admin_add.tpl -text
 templates/de/html/admin/admin_admins_add.tpl -text
 templates/de/html/admin/admin_admins_add_acl.tpl -text
-templates/de/html/admin/admin_admins_contact_form.tpl -text
 templates/de/html/admin/admin_admins_contct_default.tpl -text
 templates/de/html/admin/admin_admins_contct_form.tpl -text
 templates/de/html/admin/admin_admins_contct_select.tpl -text
@@ -1298,7 +1294,6 @@ templates/de/html/member/member_reflinks_row.tpl -text
 templates/de/html/member/member_reflinks_table.tpl -text
 templates/de/html/member/member_stats_row.tpl -text
 templates/de/html/member/member_stats_table.tpl -text
-templates/de/html/member/member_support_contacted.tpl -text
 templates/de/html/member/member_support_contcted.tpl -text
 templates/de/html/member/member_support_form.tpl -text
 templates/de/html/member/member_surfbar_book_dynamic.tpl -text
diff --git a/inc/databases.php b/inc/databases.php
index cd82d19dd9..f62d148d50 100644
--- a/inc/databases.php
+++ b/inc/databases.php
@@ -113,7 +113,7 @@ define('USAGE_BASE', "usage");
 define('SERVER_URL', "http://www.mxchange.org");
 
 // This current patch level
-define('CURR_SVN_REVISION', "340");
+define('CURR_SVN_REVISION', "341");
 
 // Take a prime number which is long (if you know a longer one please try it out!)
 define('_PRIME', 591623);
diff --git a/inc/libs/surfbar_functions.php b/inc/libs/surfbar_functions.php
index 7df9fd5b81..ec045622f3 100644
--- a/inc/libs/surfbar_functions.php
+++ b/inc/libs/surfbar_functions.php
@@ -53,7 +53,7 @@ function SURFBAR_ADMIN_ADD_URL ($url) {
 	} elseif (SURFBAR_LOOKUP_BY_URL($url, "0")) {
 		// URL already found in surfbar!
 		return false;
-	} elseif (!SURFBAR_IF_USER_BOOK_MORE_URLS("0")) {
+	} elseif (!SURFBAR_IF_USER_BOOK_MORE_URLS()) {
 		// No more allowed!
 		return false;
 	}
@@ -110,7 +110,7 @@ function SURFBAR_MEMBER_ADD_URL ($url) {
 	} elseif (SURFBAR_LOOKUP_BY_URL($url, $GLOBALS['userid'])) {
 		// URL already found in surfbar!
 		return false;
-	} elseif (!SURFBAR_IF_USER_BOOK_MORE_URLS()) {
+	} elseif (!SURFBAR_IF_USER_BOOK_MORE_URLS($GLOBALS['userid'])) {
 		// No more allowed!
 		return false;
 	}
@@ -413,8 +413,8 @@ WHERE userid NOT IN (".implode(",", $UIDs).") AND status='%s'",
 function SURFBAR_IF_USER_BOOK_MORE_URLS ($uid=0) {
 	global $_CONFIG;
 
-	// Simply check it out
-	return (SURFBAR_GET_TOTAL_USER_URLS($uid) < $_CONFIG['surfbar_max_order']);
+	// Is this admin and userid is zero or does the user has some URLs left to book?
+	return ((($uid == 0) && (IS_ADMIN())) || (SURFBAR_GET_TOTAL_USER_URLS($uid) < $_CONFIG['surfbar_max_order']));
 }
 // Get total amount of URLs of given status for current user
 function SURFBAR_GET_TOTAL_USER_URLS ($uid=0) {
diff --git a/inc/modules/admin/what-admins_contact.php b/inc/modules/admin/what-admins_contact.php
deleted file mode 100644
index 146e16fd19..0000000000
--- a/inc/modules/admin/what-admins_contact.php
+++ /dev/null
@@ -1,98 +0,0 @@
-<?php
-/************************************************************************
- * MXChange v0.2.1                                    Start: 06/19/2004 *
- * ================                             Last change: 06/19/2004 *
- *                                                                      *
- * -------------------------------------------------------------------- *
- * File              : what-admins_contact.php                          *
- * -------------------------------------------------------------------- *
- * Short description : Contact an admin through mail or message         *
- * -------------------------------------------------------------------- *
- * Kurzbeschreibung  : Admin per Mail oder Nachricht kontaktieren       *
- * -------------------------------------------------------------------- *
- *                                                                      *
- * -------------------------------------------------------------------- *
- * Copyright (c) 2003 - 2008 by Roland Haeder                           *
- * For more information visit: http://www.mxchange.org                  *
- *                                                                      *
- * 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; either version 2 of the License, or    *
- * (at your option) any later version.                                  *
- *                                                                      *
- * 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 St, Fifth Floor, Boston,               *
- * MA  02110-1301  USA                                                  *
- ************************************************************************/
-
-// Some security stuff...
-if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
-	$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
-	require($INC);
-}
-
-// Add description as navigation point
-ADD_DESCR("admin", basename(__FILE__));
-
-if (($_POST['ok'] != '') && ($_GET['admin'] != ''))
-{
-	// Send mail or message
-	if ((EXT_IS_ACTIVE("msg")) && ($_POST['type'] == "msg"))
-	{
-		// Add message
-		$msg = LOAD_EMAIL_TEMPLATE("admins_msg_contact_admin", $_POST['text'], "0");
-		SEND_ADMIN_MESSAGE($_GET['admin'], ADMINS_MSG_FROM_ADMIN, $msg);
-	}
-	 else
-	{
-		// Send mail
-		$result = SQL_QUERY("SELECT email FROM "._MYSQL_PREFIX."_admins WHERE id='".$_GET['admin']."' LIMIT 1", __FILE__, __LINE__);
-		list($email) = SQL_FETCHROW($result);
-		$msg = LOAD_EMAIL_TEMPLATE("admins_mail_contact_admin", $_POST['text'], "0");
-		SEND_EMAIL($email, ADMINS_MSG_FROM_ADMIN, $msg);
-	}
-	// Mail / message dropped
-	LOAD_TEMPLATE("admin_settings_saved", false, ADMINS_ADMIN_CONTACTED);
-}
- elseif ($_GET['admin'] != '')
-{
-	// Load contact form template
-	define('__ADMIN', $_GET['admin']);
-	if (EXT_IS_ACTIVE("msg"))
-	{
-		// Add option to select between mail and message
-		define('ADMINS_MESSAGING_SELECTION', "<TR>
-  <TD colspan=\"3\" align=\"center\" class=\"admin_title bottom2\" height=\"28\">".ADMINS_SELECT_CONTACT_TYPE."</TD>
-</TR>
-<TR><TD colspan=\"3\" class=\"seperator\">&nbsp;</TD></TR>
-<TR>
-  <TD align=\"right\"><INPUT type=\"radio\" name=\"type\" class=\"admin_normal\" value=\"mail\" checked>&nbsp;".ADMINS_CONTACT_TYPE_MAIL."</TD>
-  <TD width=\"10\" class=\"seperator\">&nbsp;</TD>
-  <TD><INPUT type=\"radio\" name=\"type\" class=\"admin_normal\" value=\"msg\">&nbsp;".ADMINS_CONTACT_TYPE_MSG."</TD>
-</TR>");
-	}
-	 else
-	{
-		// Outout hidden input
-		define('ADMINS_MESSAGING_SELECTION', "<TR>
-  <TD colspan=\"3\" align=\"center\" class=\"admin_title bottom2\" height=\"28\">
-    ".ADMINS_CONTACT_DEFAULT_MAIL."
-    <INPUT type=\"hidden\" name=\"type\" value=\"mail\">
-  </TD>
-</TR>");
-	}
-	LOAD_TEMPLATE("admin_admins_contact_form");
-}
- else
-{
-	// Please select an admin!
-	LOAD_TEMPLATE("admin_settings_saved", false, ADMINS_SELECT_ADMIN);
-}
-//
-?>
diff --git a/inc/modules/admin/what-cache_stats.php b/inc/modules/admin/what-cache_stats.php
index 121f202bde..ee2f431796 100644
--- a/inc/modules/admin/what-cache_stats.php
+++ b/inc/modules/admin/what-cache_stats.php
@@ -40,12 +40,14 @@ if ((!defined('__SECURITY')) || (!is_admin())) {
 // Add description as navigation point
 ADD_DESCR("admin", basename(__FILE__));
 
+// Calculate total hits
+$totalHits = ($_CONFIG['db_hits'] + $_CONFIG['cache_hits']);
+
 // Prepare data for the template
-define('__DB_HITS'   , $_CONFIG['db_hits']);
-$HITS = str_repeat("&nbsp;", abs(strlen($_CONFIG['db_hits']) - strlen($_CONFIG['cache_hits']))).$_CONFIG['cache_hits'];
-define('__CACHE_HITS', $HITS);
-define('__TOTAL_HITS', ($_CONFIG['db_hits'] + $_CONFIG['cache_hits']));
-define('__CACHE_PERC', TRANSLATE_COMMA(($_CONFIG['cache_hits'] / __TOTAL_HITS  * 100)));
+define('__DB_HITS'   , TRANSLATE_COMMA($_CONFIG['db_hits']));
+define('__CACHE_HITS', TRANSLATE_COMMA($_CONFIG['cache_hits']));
+define('__TOTAL_HITS', TRANSLATE_COMMA($totalHits));
+define('__CACHE_PERC', TRANSLATE_COMMA(($_CONFIG['cache_hits'] / $totalHits * 100)));
 
 // Load template
 LOAD_TEMPLATE("admin_cache_stats");
diff --git a/templates/de/emails/admins_mail_contact_admin.tpl b/templates/de/emails/admins_mail_contact_admin.tpl
deleted file mode 100644
index 24403f21bb..0000000000
--- a/templates/de/emails/admins_mail_contact_admin.tpl
+++ /dev/null
@@ -1,16 +0,0 @@
-{--HELLO_ADMIN--},
-
-ein anderer Administrator hat Ihnen soeben eine Mail geschickt!
-
-------------------------------------
-$content
-------------------------------------
-IP-Nummer: $REMOTE_ADDR
-------------------------------------
-Browser: $HTTP_USER_AGENT
-------------------------------------
-
-Mit freundlichem Gruss,
-  Ihr {!MAIN_TITLE!} Script
-
-{!URL!}/admin.php
diff --git a/templates/de/emails/admins_msg_contact_admin.tpl b/templates/de/emails/admins_msg_contact_admin.tpl
deleted file mode 100644
index 0a22a9f1b0..0000000000
--- a/templates/de/emails/admins_msg_contact_admin.tpl
+++ /dev/null
@@ -1,16 +0,0 @@
-{--HELLO_ADMIN--},
-
-ein anderer Administrator hat Ihnen soeben eine Nachricht in Ihren Account geschickt!
-
-------------------------------------
-$content
-------------------------------------
-IP-Nummer: $REMOTE_ADDR
-------------------------------------
-Browser: $HTTP_USER_AGENT
-------------------------------------
-
-Mit freundlichem Gruss,
-  Ihr {!MAIN_TITLE!} Script
-
-{!URL!}/admin.php
diff --git a/templates/de/html/admin/admin_admins_contact_form.tpl b/templates/de/html/admin/admin_admins_contact_form.tpl
deleted file mode 100644
index 8235f0a71c..0000000000
--- a/templates/de/html/admin/admin_admins_contact_form.tpl
+++ /dev/null
@@ -1,33 +0,0 @@
-<FORM action="{!URL!}/modules.php?module=admin&amp;what=admins_contact&amp;admin={!__ADMIN!}" method="POST" style="margin-bottom: 0px">
-<TABLE border="0" cellspacing="0" cellpadding="0" width="400" class="admin_table dashed">
-	<TR>
-		<TD width="195" class="admin_title bottom2" align="right" height="28"><STRONG>{--ADMINS_ADMIN_ID--}:</STRONG></TD>
-		<TD width="10" class="admin_title bottom2 seperator">&nbsp;</TD>
-		<TD width="195" class="admin_title bottom2"><STRONG>{!__ADMIN!}</STRONG></TD>
-	</TR>
-	<TR>
-		<TD colspan="3" class="seperator">&nbsp;</TD>
-	</TR>
-	<TR>
-		<TD colspan="3" align="center">{--ADMINS_ENTER_CONTACT_TEXT--}:<BR />
-			<TEXTAREA class="admin_normal" name="text" rows="5" cols="40"></TEXTAREA>
-		</TD>
-	</TR>
-	<TR>
-		<TD colspan="3" class="seperator bottom2">&nbsp;</TD>
-	</TR>
-	{--ADMINS_MESSAGING_SELECTION--}
-	<TR>
-		<TD colspan="3" class="seperator">&nbsp;</TD>
-	</TR>
-	<TR>
-		<TD class="admin_footer top2" align="right">
-			<INPUT type="reset" class="admin_reset" value="{--CLEAR_FORM--}" />
-		</TD>
-		<TD width="10" class="admin_footer top2 seperator">&nbsp;</TD>
-		<TD class="admin_footer top2">
-			<INPUT type="submit" name="ok" class="admin_submit" value="{--ADMINS_CONTACT_SUBMIT--}" />
-		</TD>
-	</TR>
-</TABLE>
-</FORM>
diff --git a/templates/de/html/member/member_support_contacted.tpl b/templates/de/html/member/member_support_contacted.tpl
deleted file mode 100644
index 05fb519a51..0000000000
--- a/templates/de/html/member/member_support_contacted.tpl
+++ /dev/null
@@ -1,20 +0,0 @@
-<TABLE border="0" cellspacing="0" cellpadding="0" width="500"
-	align="center" class="member_header">
-	<TR>
-		<TD style="height: 10px" class="seperator top2 left2 right2">&nbsp;</TD>
-	</TR>
-	<TR>
-		<TD align="center" colspan="2" class="left2 right2"><BIG><B
-			class="large">Vielen Dank, dass Sie uns kontaktiert haben!</STRONG></BIG></TD>
-	</TR>
-	<TR>
-		<TD style="height: 5px" colspan="2" class="seperator left2 right2">&nbsp;</TD>
-	</TR>
-	<TR>
-		<TD align="center" colspan="2" class="left2 right2">Einer unserer
-		Mitarbeiter wird sich um Ihr Anliegen k&uuml;mmern.</TD>
-	</TR>
-	<TR>
-		<TD style="height: 10px" class="seperator bottom2 left2 right2">&nbsp;</TD>
-	</TR>
-</TABLE>
-- 
2.39.5