-- Patches for languages (and some security fixes):
In your admin/serverlog.php file,
find:
PHP Code:
<tr>
<td align="center" bgcolor="#CCCCCC"><strong>Date Range </strong><strong>Match search term </strong></td>
<td align="center" bgcolor="#CCCCCC"><strong>Search Match </strong></td>
<td align="center" bgcolor="#CCCCCC"><strong>Global Actions </strong></td>
<td width="25%" bgcolor="#FF9900"><strong>Info</strong></td>
</tr>
replace with:
PHP Code:
<tr>
<td align="center" bgcolor="#CCCCCC"><?php echo DATE_RANGE. ' ' . MATCH_SEARCH_TERM; ?></td>
<td align="center" bgcolor="#CCCCCC"><?php echo MATCH_SEARCH; ?></td>
<td align="center" bgcolor="#CCCCCC"><?php echo GLOBAL_ACTIONS; ?></td>
<td width="25%" bgcolor="#FF9900"><?php echo INFO; ?></td>
</tr>
Then, two lines below, find:
PHP Code:
<strong>coming soon</strong>
replace with:
PHP Code:
<?php echo COMING_SOON; ?>
Then, find:
PHP Code:
<td align="center" valign="top" bgcolor="#CCCCCC"><strong>coming soon </strong></td>
<td align="center" valign="top" bgcolor="#CCCCCC"><p><strong>coming soon </strong></p> </td>
<td width="25%" valign="top" bgcolor="#FF9900"><p>Built by: <a href="http://www.seamless-packages.co.uk">Seamless-packages</a> <br>
Author: Warren Lloyd <br>
Version: 0.1beta</p>
<p><a href="#"></a> </p></td>
</tr>
</table>
replace with:
PHP Code:
<td align="center" valign="top" bgcolor="#CCCCCC"><p><?php echo COMING_SOON; ?></p></td>
<td align="center" valign="top" bgcolor="#CCCCCC"><p><?php echo COMING_SOON; ?></p></td>
<td width="25%" valign="top" bgcolor="#FF9900"><p><?php echo COPYRIGHT_AUTHOR_URL; ?></p>
<p><?php zen_href_link('#', '', 'NONSSL'); ?></a></p></td>
</tr>
</table>
Then, find:
PHP Code:
switch( $_GET['action'] ){
case "delete":
$sqldelete = "delete from zen_search_log where id = $id";
$result = mysql_query( $sqldelete )
or die("invalid query: " . mysql_error());
echo "<h1>Item $id deleted</h1>";
break;
case "deleteall":
$sqldelete = "delete from zen_search_log where id = $id";
$result = mysql_query( $sqldelete )
or die("invalid query: " . mysql_error());
echo "<h1>Item $id deleted</h1>";
break;
}
Replace with:
PHP Code:
switch( $_GET['action'] ){
case "delete":
if (isset($_GET['id']) || isset($_POST['id'])) {
$id = (isset($_POST['id']) && $_POST['id'] != 0) ? intval(trim($_POST['id'])) : 0;
} else {
$id = 0;
} ###### End of if statement.
if ($id <= 0) {
$messageStack->add_session(ENTRY_SEARCHLOG_ID_NOT_FOUND, 'error');
} ###### End of if statement.
if ($id >= 1) {
$sqldelete = "delete from " . TABLE_SEARCHLOG . " where id = ".(int)$id;
$result = mysql_query($sqldelete);
if (!$result) {
$messageStack->add_session(ENTRY_SEARCHLOG_DELETE_FAILED, 'error');
} else {
$messageStack->add_session(ENTRY_SEARCHLOG_DELETE_SUCCESSFUL, 'success');
break;
} ###### End of if statement.
case "deleteall":
$sqldelete = "delete from " . TABLE_SEARCHLOG . " where id = ".(int)$id;
$result = mysql_query( $sqldelete )
if (!$result) {
$messageStack->add_session(ENTRY_SEARCHLOG_DELETE_FAILED, 'error');
} else {
$messageStack->add_session(ENTRY_SEARCHLOG_DELETE_SUCCESSFUL, 'success');
} ###### End of if statement.
break;
} ###### End of switch case statement.
} ###### End of if statement.
Then, find:
PHP Code:
echo "<table width=\"100%\" border=\"0\" cellpadding=\"4\" cellspacing=\"0\">
<tr>
<td width=\"110\"><b>Search Term</b></td>
<td><b>Number of times searched for</b></td>
<td><b>Date</b></td>
<td><b>Action</b></td>
</tr>";
$color1 = "#BFD8BC";
$color2 = "#E0E0E0";
$row_count = 0;
if(!isset($_GET['page'])){
$page = 1;
} else {
$page = $_GET['page'];
}
// Define the number of results per page
if (isset($resultcount)) {
$max_results = $resultcount;
} else {
$max_results = 15;
}
// Figure out the limit for the query based
// on the current page number.
$from = (($page * $max_results) - $max_results);
// Perform MySQL query on only the current page number's results
if (isset($theDate) && isset($theDate2)) {
replace with:
PHP Code:
<?php
$color1 = "#BFD8BC";
$color2 = "#E0E0E0";
$row_count = 0;
if (!isset($_GET['page']) || empty($_GET['page'])) {
$page = 1;
} else {
$page = intval(trim($_GET['page']));
} ###### End of if statement.
// Define the number of results per page
if (isset($resultcount) && $resultcount != 0) {
$max_results = intval(trim($resultcount));
} else {
$max_results = 15;
} ###### End of if statement.
// Figure out the limit for the query based
// on the current page number.
$set_page = intval(trim($page));
$set_max_results = intval(trim($max_results));
$from = (isset($set_page) && isset($set_max_results) && $set_page != 0 && $set_max_results != 0) ? ($set_page * $set_max_results) - $set_max_results) : 0;
$set_from = (isset($from)) ? trim($from) : "";
// Perform MySQL query on only the current page number's results
if ($_SESSION['admin_id'] && isset($theDate) && isset($theDate2) && $theDate != "0000-00-00" && $theDate2 != "0000-00-00") {
Then, find:
PHP Code:
$sql = "SELECT id, date, searchterm, count(*) AS Number
FROM zen_search_log
WHERE searchterm is not null and searchterm not like ''
and date BETWEEN '$theDate' and '$theDate2'
GROUP BY searchterm
ORDER BY Number desc LIMIT $from, $max_results";
} else {
$sql = "SELECT id, date, searchterm, count(*) AS Number
FROM zen_search_log
WHERE searchterm is not null and searchterm not like ''
GROUP BY searchterm
ORDER BY Number desc LIMIT $from, $max_results";}
$result = mysql_query($sql)
or die ("invalid query: " . mysql_error());
replace with:
PHP Code:
$searchlog = "SELECT id, date, searchterm, count(*) AS Number
FROM " . TABLE_SEARCHLOG . "
WHERE searchterm is not null and searchterm not like '' and date BETWEEN '$theDate' and '$theDate2'
GROUP BY searchterm
ORDER BY Number desc
LIMIT $from, $max_results";
} else {
$searchlog = "SELECT id, date, searchterm, count(*) AS Number
FROM " . TABLE_SEARCHLOG . "
WHERE searchterm is not null and searchterm not like ''
GROUP BY searchterm
ORDER BY Number desc
LIMIT $from, $max_results";
} ###### End of if statement.
$result = mysql_query($searchlog);
if (!$result || $db->Recordcount() <= 0) {
$messageStack->add_session(SEARCHLOG_FAILED_TO_SELECT_FIELDS, 'error');
} ###### End of if statement.
Then, find:
PHP Code:
echo "</table>";
replace with:
PHP Code:
?>
</table>
<?php
Then, find:
PHP Code:
if (isset($dateone) && isset($datetwo)) {
$total_results = mysql_result(mysql_query("SELECT count( DISTINCT searchterm )
FROM zen_search_log
WHERE searchterm IS NOT NULL
and date BETWEEN '$theDate' and '$theDate2'
AND searchterm NOT LIKE ''"),0);
} else {
$total_results = mysql_result(mysql_query("SELECT count( DISTINCT searchterm )
FROM zen_search_log
WHERE searchterm IS NOT NULL
AND searchterm NOT LIKE ''"),0);
}
replace with:
PHP Code:
if (isset($dateone) && isset($datetwo) && $dateone != "0000-00-00" && $datetwo != "0000-00-00") {
$total_results = mysql_result(mysql_query("SELECT count( DISTINCT searchterm )
FROM " . TABLE_SEARCHLOG . "
WHERE searchterm IS NOT NULL
and date BETWEEN '$theDate' and '$theDate2'
AND searchterm NOT LIKE ''"),0);
} else {
$total_results = mysql_result(mysql_query("SELECT count( DISTINCT searchterm )
FROM " . TABLE_SEARCHLOG . "
WHERE searchterm IS NOT NULL
AND searchterm NOT LIKE ''"),0);
}
Then, find:
PHP Code:
echo "<center>Select a Page<br />";
replace with:
PHP Code:
echo SEARCHLOG_SELECT_PAGE . "<br />";
Then, find:
PHP Code:
// Build Previous Link
if($page > 1){
$prev = ($page - 1);
echo "<a href=\"".zen_href_link(FILENAME_SEARCH_LOG, "page=".intval(trim($prev))", "NONSSL")."\"><<Previous</a> ";
}
for($i = 1; $i <= $total_pages; $i++){
if(($page) == $i){
echo "$i ";
} else {
echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$i\">$i</a> ";
}
}
// Build Next Link
if($page < $total_pages){
$next = ($page + 1);
echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$next\">Next>></a>";
}
Replace with:
PHP Code:
// Build Previous Link
if($page > 1) {
$prev = ($page - 1);
echo "<a href=\"".zen_href_link(FILENAME_SEARCH_LOG, "page=".intval(trim($prev)), "NONSSL")."\">" . SEARCHLOG_PREVIOUS_PAGE . "</a> ";
}
for($i = 1; $i <= $total_pages; $i++){
if(($page) == $i) {
echo "$i ";
} else {
echo "<a href=\"".zen_href_link(FILENAME_SEARCH_LOG, "page=".$prev, "NONSSL")."\">" . $i . "</a> ";
}
}
// Build Next Link
if($page < $total_pages){
$next = ($page + 1);
echo "<a href=\"".zen_href_link(FILENAME_SEARCH_LOG, "page=".intval(trim($next)), "NONSSL")."\">" . SEARCHLOG_NEXT_PAGE . "</a>";
}
Then, from your admin/includes/extra_datafiles/searchlog.php file, make sure you have these readings:
PHP Code:
define('TABLE_SEARCHLOG', 'search_log');
define('FILENAME_SEARCH_LOG', 'searchlog');
Then, from your admin/includes/languages/extra_definitions/searchlog.php file, make sure you have these readings:
PHP Code:
define('BOX_REPORTS_SEARCH_LOG','Search Log');
define('HEADING_TITLE','Search Log');
define('DATE_RANGE', '<strong>Date Range </strong>');
define('MATCH_SEARCH_TERM', '<strong>Match search term </strong>');
define('MATCH_SEARCH', '<strong>Search Match </strong>');
define('NUMBER_TIMES_SEARCHED_FOR', '<b>Number of times searched for</b>');
define('GLOBAL_ACTIONS', '<strong>Global Actions </strong>');
define('INFO', '<strong>Info</strong>');
define('COMING_SOON', '<strong>coming soon</strong>');
define('ENTRY_DELETE_LINK', '[ DELETE ] <b>cannot undo</b>');
define('ENTRY_SEARCHLOG_DELETE_SUCCESSFUL', 'Success ! Selected item deleted:');
define('ENTRY_SEARCHLOG_DELETE_FAILED', 'Error: Failed to delete the selected item named:');
define('ENTRY_SEARCHLOG_ID_NOT_FOUND', 'Error: Search ID could not be found.');
define('SEARCHLOG_FAILED_TO_SELECT_FIELDS', 'Error: Failed to select one or more fields from the ' . TABLE_SEARCHLOG . '. It might, also, be possible that your table is empty.');
define('SEARCHLOG_DATE', '<b>Date</b>');
define('SEARCHLOG_ACTION', '<b>Action</b>');
define('SEARCHLOG_TOP_5', 'Search Log Top 5');
define('SEARCHLOG_SELECT_PAGE', '<center>Select a Page</center>');
define('SEARCHLOG_PREVIOUS_PAGE', '<< Previous');
define('SEARCHLOG_NEXT_PAGE', 'Next >>');
define('COPYRIGHT_AUTHOR_URL', 'Built by: <a href=\"http://www.seamless-packages.co.uk\">Seamless-packages</a><br />Author: Warren Lloyd <br />Version: 0.1 beta');
Then, from your admin/includes/languages/extra_configures/searchlog.php file, make sure you have these readings:
PHP Code:
define('FILENAME_SEARCH_LOG', 'searchlog');
Recall: This is NOT a new posted MOD but corrections from the first beta release.