Skip to content
Permalink
Browse files

loggig fixes and improvements

- 4627: fixed error message for wrong log dates
- fixed log password case insensitivity for non-ASCII-chars in new logs
* simplified code for new logs and editing logs
* replaced redundant log type checks by cache_logtype query
* code formatting
  • Loading branch information...
following
following committed Aug 26, 2012
1 parent 1fe1639 commit 69cbda86f87363e2e9cbd98042f227d0adf4c9b2
@@ -1868,7 +1868,7 @@ INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('1409', 'error m
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('1411', 'are you sure that this log entry shall be removed?', '2010-09-07 20:19:03');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('1412', 'do you want to send {log_user_name} a note?', '2010-09-07 20:19:03');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('1413', 'Remove log entry', '2010-09-07 20:19:03');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('1414', 'date is invalid, format: TT-MM-JJJJ', '2010-09-07 20:19:03');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('1414', 'date is invalid', '2012-08-26 09:10:00');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('1415', '(only for found logs)', '2010-09-07 20:19:03');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('1416', 'Submit a new cache', '2010-09-07 20:19:04');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('1417', 'If this is your first cache on Opencaching.de, be sure to check out the <a href=\"articles.php?page=cacheinfo\">description</a> of the individual fields.', '2010-09-07 20:19:04');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1411', 'DE', 'Bist du sicher, dass dieser Logeintrag entfernt werden soll?', '2010-09-10 23:47:01');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1412', 'DE', 'M\&ouml;chtest du {log_user_name} eine Bemerkung dazu senden?', '2010-09-10 23:46:49');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1413', 'DE', 'Logeintrag entfernen', '2010-09-10 23:46:43');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1414', 'DE', 'Datum ist nicht korrekt. Format: TT-MM-JJJJ', '2010-09-10 23:46:32');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1414', 'DE', 'ungültiges Datum', '2012-08-26 09:10:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1415', 'DE', '(nur für Gefunden-Logs)', '2010-09-10 23:44:54');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1416', 'DE', 'Neuen Cache eintragen', '2010-09-10 23:44:37');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1417', 'DE', 'Falls dies dein erster Cache auf Opencaching.de sein sollte, lies bitte zuerst die <a href=\"articles.php?page=cacheinfo\">Beschreibung</a> zu den einzelnen Feldern durch.', '2010-09-10 23:46:21');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1411', 'EN', 'Are you sure that this log entry shall be removed?', '2010-09-10 23:47:06');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1412', 'EN', 'do you want to send {log_user_name} a note? ', '2010-09-10 23:46:49');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1413', 'EN', 'Remove log entry', '2010-09-10 23:46:43');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1414', 'EN', 'Date is invalid, format: TT-MM-JJJJ', '2010-09-10 23:46:37');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1414', 'EN', 'Date is invalid', '2012-08-26 09:10:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1415', 'EN', '(only for found logs)', '2010-09-10 23:44:54');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1416', 'EN', 'Submit a new cache', '2010-09-10 23:44:37');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1417', 'EN', 'If this is your first cache on Opencaching.de, be sure to check out the <a href=\"articles.php?page=cacheinfo\">description</a> of the individual fields.', '2010-09-10 23:46:21');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1411', 'ES', '¿Estás seguro de que quieres eliminar este log?', '2010-12-09 00:18:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1412', 'ES', '¿Deseas enviar una nota a {log_user_name}?', '2010-12-09 00:18:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1413', 'ES', 'Borrar el long de entrada', '2010-12-09 00:18:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1414', 'ES', 'Fecha es invalida. Formato: DD-MM-AAAA', '2010-12-09 00:18:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1414', 'ES', 'Fecha es invalida', '2012-08-26 09:10:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1415', 'ES', '(solo para logs de encontrados)', '2010-12-09 00:18:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1416', 'ES', 'Entrada de una nuevo cache', '2010-12-09 00:18:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1417', 'ES', 'Si este es tu primer cache en Opencaching.de , asegúrese de comprobar el tamaño de la <a href=\"articles.php?page=cacheinfo\">descripción</a>', '2010-12-09 00:18:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1411', 'IT', 'Vuoi veramente cancellare questo log?', '2010-09-10 23:47:01');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1412', 'IT', 'Vuoi inviare un commento a {log_user_name}?', '2010-09-10 23:46:49');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1413', 'IT', 'Cancella il log', '2010-09-10 23:46:43');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1414', 'IT', 'La data non è valida. Formato: GG-MM-AAAA', '2010-09-10 23:46:32');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1414', 'IT', 'La data non è valida.', '2012-08-26 09:10:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1415', 'IT', '(solo per i log \"trovata\")', '2010-09-10 23:44:54');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1416', 'IT', 'Proponi una nuova cache', '2010-09-10 23:44:37');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1417', 'IT', 'Se questa è la tua prima cache su Opencaching.de, assicurati di controllare le dimensioni nella <a href=\"articles.php?page=cacheinfo\">descrizione</a>', '2010-10-27 18:49:19');
@@ -166,80 +166,35 @@
}
//validate date
$date_not_ok = true;
$date_ok = false;
if (is_numeric($log_date_day) && is_numeric($log_date_month) && is_numeric($log_date_year))
{
if (checkdate($log_date_month, $log_date_day, $log_date_year) == true)
{
$date_not_ok = false;
}
if($date_not_ok == false)
{
if(isset($_POST['submitform']))
{
if(mktime(0, 0, 0, $log_date_month, $log_date_day, $log_date_year)>=mktime())
{
$date_not_ok = true;
}
else
{
$date_not_ok = false;
}
}
}
if (checkdate($log_date_month, $log_date_day, $log_date_year) &&
$log_date_year >= 2000)
$date_ok = true;
if ($date_ok)
if (isset($_POST['submitform']))
if (mktime(0, 0, 0, $log_date_month, $log_date_day, $log_date_year) >= mktime())
$date_ok = false;
}
if ($cache_type == 6)
{
switch($log_type)
{
case 1:
case 2:
$logtype_not_ok = true;
break;
default:
$logtype_not_ok = false;
break;
}
}
else
{
switch($log_type)
{
case 7:
case 8:
$logtype_not_ok = true;
break;
default:
$logtype_not_ok = false;
break;
}
}
$logtype_ok = sqlValue("SELECT COUNT(*) FROM cache_logtype WHERE cache_type_id='" . sql_escape($cache_type) . "' AND log_type_id='" . sql_escape($log_type) . "'", 0) > 0;
// not a found log? then ignore the rating
if ($log_type != 1 && $log_type != 7)
$top_option = 0;
$pw_not_ok = false;
if (($use_log_pw) && $log_type == 1)
{
if (isset($_POST['log_pw']))
{
if (mb_strtolower($log_pw) != mb_strtolower($_POST['log_pw']))
{
$pw_not_ok = true;
$all_ok = false;
}
}
else
$pw_ok = true;
if ($use_log_pw && $log_type == 1)
if (!isset($_POST['log_pw']) ||
mb_strtolower($log_pw) != mb_strtolower($_POST['log_pw']))
{
$pw_not_ok = true;
$pw_ok = false;
$all_ok = false;
}
}
//store?
if (isset($_POST['submitform']) && $date_not_ok == false && $logtype_not_ok == false && $pw_not_ok == false)
if (isset($_POST['submitform']) && $date_ok && $logtype_ok && $pw_ok)
{
//store changed data
sql("UPDATE `cache_logs` SET `type`='&1',
@@ -307,7 +262,7 @@
tpl_set_var('reset', $reset);
tpl_set_var('submit', $submit);
tpl_set_var('logid', $log_id);
tpl_set_var('date_message', ($date_not_ok == true) ? $date_message : '');
tpl_set_var('date_message', !$date_ok ? $date_message : '');
if ($descMode != 1)
tpl_set_var('logtext', htmlspecialchars($log_text, ENT_COMPAT, 'UTF-8'), true);
@@ -333,26 +288,18 @@
}
if ($use_log_pw == true && $log_pw != '')
{
if ($pw_not_ok == true && isset($_POST['submitform']))
{
if (!$pw_ok && isset($_POST['submitform']))
tpl_set_var('log_pw_field', $log_pw_field_pw_not_ok);
}
else
{
tpl_set_var('log_pw_field', $log_pw_field);
}
}
else
{
tpl_set_var('log_pw_field', '');
}
// build smilies
$smilies = '';
if ($descMode != 3)
{
for($i=0; $i<count($smileyshow); $i++)
for ($i=0; $i<count($smileyshow); $i++)
{
if($smileyshow[$i] == '1')
{
@@ -19,7 +19,7 @@
$error_wrong_node = t('This log entry has been created on another Opencaching website. The cache can only be edited there.');
$date_message = '<span class="errormsg">' . t('date is invalid, format: TT-MM-JJJJ') . '</span>';
$date_message = '<span class="errormsg">' . t('date is invalid') . '</span>';
$smiley_link = '<a href="javascript:insertSmiley(\'{smiley_text}\')">{smiley_image}</a>';
$log_pw_field = '<tr><td colspan="2">' . t('passwort to log:') . ' <input class="input100" type="text" name="log_pw" maxlength="20" value="" /> ' . t('(only for found logs)') . '</td></tr>
@@ -18,7 +18,7 @@
****************************************************************************/
$submit = t('Log this cache');
$date_message = '<span class="errormsg">' . t('date is invalid, format: TT-MM-JJJJ') . '</span>';
$date_message = '<span class="errormsg">' . t('date is invalid') . '</span>';
$log_pw_field = '<tr><td colspan="2">' . t('passwort to log:') . ' <input class="input100" type="text" name="log_pw" maxlength="20" value="" /> ' . t('(only for found-logs)') . '</td></tr><tr><td class="spacer" colspan="2"></td></tr>';
$log_pw_field_pw_not_ok = '<tr><td colspan="2">' . t('passwort to log:') . ' <input type="text" name="log_pw" maxlength="20" size="20" value=""/><span class="errormsg"> ' . t('Invalid password!') . '</span></td></tr><tr><td class="spacer" colspan="2"></td></tr>';
@@ -159,79 +159,34 @@
//validate data
if (is_numeric($log_date_month) && is_numeric($log_date_day) && is_numeric($log_date_year))
{
$date_not_ok = (checkdate($log_date_month, $log_date_day, $log_date_year) == false);
if($date_not_ok == false)
{
$date_ok = checkdate($log_date_month, $log_date_day, $log_date_year)
&& ($log_date_year >= 2000);
if ($date_ok)
if (isset($_POST['submitform']))
{
if(mktime(0, 0, 0, $log_date_month, $log_date_day, $log_date_year)>=mktime())
{
$date_not_ok = true;
}
else
{
$date_not_ok = false;
}
}
}
if (mktime(0, 0, 0, $log_date_month, $log_date_day, $log_date_year) >= mktime())
$date_ok = false;
}
else
{
$date_not_ok = true;
}
if ($cache_type == 6)
{
switch($log_type)
{
case 1:
case 2:
$logtype_not_ok = true;
break;
default:
$logtype_not_ok = false;
break;
}
}
else
{
switch($log_type)
{
case 7:
case 8:
$logtype_not_ok = true;
break;
default:
$logtype_not_ok = false;
break;
}
}
$date_ok = false;
$logtype_ok = sqlValue("SELECT COUNT(*) FROM cache_logtype WHERE cache_type_id='" . sql_escape($cache_type) . "' AND log_type_id='" . sql_escape($log_type) . "'", 0) > 0;
// not a found log? then ignore the rating
if ($log_type != 1 && $log_type != 7)
$top_option = 0;
$pw_not_ok = false;
$pw_ok = true;
if (isset($_POST['submitform']))
{
$all_ok = ($date_not_ok == false) && ($logtype_not_ok == false);
$all_ok = $date_ok && $logtype_ok;
if (($all_ok) && ($use_log_pw) && $log_type == 1)
{
if (isset($_POST['log_pw']))
if ($all_ok && $use_log_pw && $log_type == 1)
if (!isset($_POST['log_pw']) ||
mb_strtolower($log_pw) != mb_strtolower($_POST['log_pw']))
{
if (strtolower($log_pw) != strtolower($_POST['log_pw']))
{
$pw_not_ok = true;
$all_ok = false;
}
}
else
{
$pw_not_ok = true;
$pw_ok = false;
$all_ok = false;
}
}
}
if (isset($_POST['submitform']) && ($all_ok == true))
@@ -248,10 +203,10 @@
// update cache_status
$rs = sql("SELECT `log_types`.`cache_status` FROM `log_types` WHERE `id`='&1'", $log_type);
if($record = sql_fetch_array($rs))
if ($record = sql_fetch_array($rs))
{
$cache_status = $record['cache_status'];
if($cache_status != 0)
if ($cache_status != 0)
{
$rs = sql("UPDATE `caches` SET `status`='&1' WHERE `cache_id`='&2'", $cache_status, $cache_id);
}
@@ -336,50 +291,41 @@
tpl_set_var('logtext', $log_text);
$listed_on = array();
if($wp_gc > "")
if ($wp_gc > "")
$listed_on[] = '<a href="http://www.geocaching.com/seek/cache_details.aspx?wp='.$wp_gc.'" target="_blank">geocaching.com</a> <a href="http://www.geocaching.com/seek/log.aspx?wp='.$wp_gc.'" target="_blank">(loggen)</a>';
if($wp_nc > "")
if ($wp_nc > "")
$listed_on[] = 'navicache.com';
if(sizeof($listed_on))
if (sizeof($listed_on))
{
tpl_set_var('listed_start', "");
tpl_set_var('listed_end', "");
tpl_set_var('listed_on', sizeof($listed_on) == 0 ? $listed_only_oc : implode(", ", $listed_on));
}
else
{
tpl_set_var('listed_start', "<!--");
tpl_set_var('listed_end', "-->");
tpl_set_var('listed_start', "<!--");
tpl_set_var('listed_end', "-->");
}
if ($use_log_pw == true)
{
if ($pw_not_ok == true)
{
if (!$pw_ok == true)
tpl_set_var('log_pw_field', $log_pw_field_pw_not_ok);
}
else
{
tpl_set_var('log_pw_field', $log_pw_field);
}
}
else
{
tpl_set_var('log_pw_field', '');
}
if ($date_not_ok == true)
{
if (!$date_ok)
tpl_set_var('date_message', $date_message);
}
// build smilies
$smilies = '';
if ($descMode != 3)
{
for($i=0; $i<count($smileyshow); $i++)
for ($i=0; $i<count($smileyshow); $i++)
{
if($smileyshow[$i] == '1')
if ($smileyshow[$i] == '1')
{
$tmp_smiley = $smiley_link;
$tmp_smiley = mb_ereg_replace('{smiley_image}', $smileyimage[$i], $tmp_smiley);
@@ -35,13 +35,15 @@
</ul>
<p>Korrigiert (Bugfixes):</p>
<ul class="changelog">
<li class="changelogitem">Anzeige von &bdquo;Nicht gefunden&ldquo; und &bdquo;Veröffentlicht am&ldquo; in der Druckansicht</li>
<li class="changelogitem">Anzeige von &bdquo;nicht gefunden&ldquo; und &bdquo;veröffentlicht am&ldquo; in der Druckansicht</li>
<li class="changelogitem">Anzeige der Event-Teilnehmerzahl in der Logzusammenfassungszeile</li>
<li class="changelogitem">seltenen Fehler bei der Erzeugung von OC-Wegpunkten behoben</li>
<li class="changelogitem">Empfehlungen gehen beim mehrfachen Loggen eines Caches &ndash; z.B. Fund + Hinweis &ndash; nicht mehr verloren.</li>
<li class="changelogitem">Empfehlungen gehen beim Löschen eines von mehreren Logs des gleichen Benutzers oder beim Bearbeiten von einem der Logs nicht mehr verloren.</li>
<li class="changelogitem">Mehrfachlogs eines Benutzers zählen bei der Bewertungsübersicht auf der Startseite nur noch einmal.</li>
<li class="changelogitem"><a href="doc/xml/">Das XML-Interface</a> schneidet im Standardzeichensatz keine Daten mehr bei unbekannten Zeichen ab.</li>
<li class="changelogitem">Fehlermeldung bei ungültigem Logdatum korrigiert</li>
<li class="changelogitem">Schreibweisenabhängigkeit von Logpasswörtern korrigiert (Groß-/Kleinschreibung ist nun immer egal)</li>
</ul>
<br />

@@ -41,6 +41,8 @@
<li class="changelogitem">Recommendations are no longer lost when deleting one of multiple logs of the same user, or when editing one of them.</li>
<li class="changelogitem">Multiple logs by the same used only count once at the homepage top ratings list.</li>
<li class="changelogitem"><a href="doc/xml/">XML-Interface</a> will not truncate default charset data at unknown characters.</li>
<li class="changelogitem">fixed error message for invalid log date</li>
<li class="changelogitem">fixed case insensitivity of log passwords</li>
</ul>
<br />

0 comments on commit 69cbda8

Please sign in to comment.
You can’t perform that action at this time.