added admin reports & cache status history
This commit is contained in:
@ -151,4 +151,18 @@
|
||||
}
|
||||
}
|
||||
|
||||
function dbv_106() // Cache status logging
|
||||
{
|
||||
if (!sql_table_exists('cache_status_modified'))
|
||||
sql(
|
||||
"CREATE TABLE `cache_status_modified` (
|
||||
`cache_id` int(10) unsigned NOT NULL,
|
||||
`date_modified` datetime NOT NULL,
|
||||
`old_state` tinyint(2) unsigned NOT NULL,
|
||||
`new_state` tinyint(2) unsigned NOT NULL,
|
||||
`user_id` int(10) unsigned NOT NULL default '0',
|
||||
UNIQUE KEY `cache_id` (`cache_id`,`date_modified`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8");
|
||||
}
|
||||
|
||||
?>
|
41
htdocs/adminhistory.php
Normal file
41
htdocs/adminhistory.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/***************************************************************************
|
||||
* For license information see doc/license.txt
|
||||
*
|
||||
* Unicode Reminder メモ
|
||||
***************************************************************************/
|
||||
|
||||
require('./lib2/web.inc.php');
|
||||
require_once('./lib2/logic/cache.class.php');
|
||||
|
||||
$tpl->name = 'adminhistory';
|
||||
$tpl->menuitem = MNU_ADMIN_HISTORY;
|
||||
|
||||
$login->verify();
|
||||
if ($login->userid == 0)
|
||||
$tpl->redirect_login();
|
||||
|
||||
if (($login->admin & ADMIN_USER) != ADMIN_USER)
|
||||
$tpl->error(ERROR_NO_ACCESS);
|
||||
|
||||
if (isset($_REQUEST['wp']))
|
||||
$cache_id = sql_value("SELECT `cache_id` FROM `caches` WHERE `wp_oc`='&1'", 0, $_REQUEST['wp']);
|
||||
else
|
||||
$cache_id = isset($_REQUEST['cacheid']) ? $_REQUEST['cacheid']+0 : -1;
|
||||
|
||||
$showhistory = false;
|
||||
$error = '';
|
||||
|
||||
if ($cache_id>=0 && sql_value("SELECT COUNT(*) FROM `caches` WHERE `cache_id`='&1'", 0, $cache_id) <> 1)
|
||||
$error = $translate->t('Cache not found', '', '', 0);
|
||||
else if ($cache_id > 0)
|
||||
{
|
||||
$showhistory = true;
|
||||
$cache = new Cache($cache_id);
|
||||
$cache->setTplHistoryData(0);
|
||||
}
|
||||
|
||||
$tpl->assign('showhistory', $showhistory);
|
||||
$tpl->assign('error', $error);
|
||||
$tpl->display();
|
||||
?>
|
@ -118,7 +118,9 @@
|
||||
`u1`.`username` AS `usernick`,
|
||||
IFNULL(`cr`.`adminid`, 0) AS `adminid`,
|
||||
IFNULL(`u2`.`username`, '') AS `adminnick`,
|
||||
IFNULL(`tt2`.`text`, `crr`.`name`) AS `reason`, `cr`.`note`, IFNULL(tt.text, crs.name) AS `status`,
|
||||
IFNULL(`tt2`.`text`, `crr`.`name`) AS `reason`,
|
||||
`cr`.`note`,
|
||||
IFNULL(tt.text, crs.name) AS `status`,
|
||||
`cr`.`date_created`, `cr`.`lastmodified`,
|
||||
`c`.`name` AS `cachename`,
|
||||
`c`.`user_id` AS `ownerid`
|
||||
@ -158,6 +160,9 @@
|
||||
$tpl->assign('list', false);
|
||||
$tpl->assign('otheradmin',$record['adminid']>0 && $record['adminid'] != $login->userid);
|
||||
$tpl->assign('ownreport',$record['adminid'] == $login->userid);
|
||||
|
||||
$cache = new cache($record['cacheid']);
|
||||
$cache->setTplHistoryData($id);
|
||||
}
|
||||
|
||||
$tpl->assign('error', $error);
|
||||
|
@ -871,8 +871,8 @@ INSERT INTO `sys_menu` (`id`, `id_string`, `title`, `title_trans_id`, `menustrin
|
||||
INSERT INTO `sys_menu` (`id`, `id_string`, `title`, `title_trans_id`, `menustring`, `menustring_trans_id`, `access`, `href`, `visible`, `parent`, `position`, `color`, `sitemap`, `only_if_parent`) VALUES ('62', 'MNU_CACHES_USERDETAILS', 'User details', '801', 'User details', '801', '0', 'viewuserdetails.php', '0', '10', '4', '', '0', NULL);
|
||||
INSERT INTO `sys_menu` (`id`, `id_string`, `title`, `title_trans_id`, `menustring`, `menustring_trans_id`, `access`, `href`, `visible`, `parent`, `position`, `color`, `sitemap`, `only_if_parent`) VALUES ('63', 'MNU_MYPROFILE_ADOPT', 'Adoptions', '827', 'Adoptions', '827', '0', 'adoptcache.php', '1', '9', '8', '', '1', NULL);
|
||||
INSERT INTO `sys_menu` (`id`, `id_string`, `title`, `title_trans_id`, `menustring`, `menustring_trans_id`, `access`, `href`, `visible`, `parent`, `position`, `color`, `sitemap`, `only_if_parent`) VALUES ('64', 'MNU_CACHES_ADOPT', 'Adoptions', '827', 'Adoptions', '827', '0', 'adoptcache.php', '0', '10', '9', '', '0', NULL);
|
||||
INSERT INTO `sys_menu` (`id`, `id_string`, `title`, `title_trans_id`, `menustring`, `menustring_trans_id`, `access`, `href`, `visible`, `parent`, `position`, `color`, `sitemap`, `only_if_parent`) VALUES ('65', 'MNU_ADMIN_USER', 'Manage User', '859', 'Manage User', '859', '0', 'adminuser.php', '1', '12', '4', '', '0', NULL);
|
||||
INSERT INTO `sys_menu` (`id`, `id_string`, `title`, `title_trans_id`, `menustring`, `menustring_trans_id`, `access`, `href`, `visible`, `parent`, `position`, `color`, `sitemap`, `only_if_parent`) VALUES ('66', 'MNU_ADMIN_NEWS', 'News approve', '873', 'News approve', '873', '1', 'newsapprove.php', '1', '12', '6', '', '0', NULL);
|
||||
INSERT INTO `sys_menu` (`id`, `id_string`, `title`, `title_trans_id`, `menustring`, `menustring_trans_id`, `access`, `href`, `visible`, `parent`, `position`, `color`, `sitemap`, `only_if_parent`) VALUES ('65', 'MNU_ADMIN_USER', 'Manage User', '859', 'Manage User', '859', '0', 'adminuser.php', '1', '12', '5', '', '0', NULL);
|
||||
INSERT INTO `sys_menu` (`id`, `id_string`, `title`, `title_trans_id`, `menustring`, `menustring_trans_id`, `access`, `href`, `visible`, `parent`, `position`, `color`, `sitemap`, `only_if_parent`) VALUES ('66', 'MNU_ADMIN_NEWS', 'News approve', '873', 'News approve', '873', '1', 'newsapprove.php', '1', '12', '7', '', '0', NULL);
|
||||
INSERT INTO `sys_menu` (`id`, `id_string`, `title`, `title_trans_id`, `menustring`, `menustring_trans_id`, `access`, `href`, `visible`, `parent`, `position`, `color`, `sitemap`, `only_if_parent`) VALUES ('67', 'MNU_START_DONATE', 'Donations', '900', 'Donations', '900', '0', 'articles.php?page=donations', '1', '1', '7', '', '1', NULL);
|
||||
INSERT INTO `sys_menu` (`id`, `id_string`, `title`, `title_trans_id`, `menustring`, `menustring_trans_id`, `access`, `href`, `visible`, `parent`, `position`, `color`, `sitemap`, `only_if_parent`) VALUES ('68', 'MNU_START_TOS', 'Terms of use', '906', 'Terms of use', '906', '0', 'articles.php?page=impressum#tos', '1', '1', '10', '', '1', NULL);
|
||||
INSERT INTO `sys_menu` (`id`, `id_string`, `title`, `title_trans_id`, `menustring`, `menustring_trans_id`, `access`, `href`, `visible`, `parent`, `position`, `color`, `sitemap`, `only_if_parent`) VALUES ('69', 'MNU_START_TEAM', 'Our Team', '907', 'Our Team', '907', '0', 'articles.php?page=team', '1', '1', '8', '', '1', NULL);
|
||||
@ -881,13 +881,14 @@ INSERT INTO `sys_menu` (`id`, `id_string`, `title`, `title_trans_id`, `menustrin
|
||||
INSERT INTO `sys_menu` (`id`, `id_string`, `title`, `title_trans_id`, `menustring`, `menustring_trans_id`, `access`, `href`, `visible`, `parent`, `position`, `color`, `sitemap`, `only_if_parent`) VALUES ('86', 'MNU_START_CHANGELOG', 'Changelog', '1797', 'Changelog', '1797', '0', 'articles.php?page=changelog', '0', '0', '10', '', '1', NULL);
|
||||
INSERT INTO `sys_menu` (`id`, `id_string`, `title`, `title_trans_id`, `menustring`, `menustring_trans_id`, `access`, `href`, `visible`, `parent`, `position`, `color`, `sitemap`, `only_if_parent`) VALUES ('87', 'MNU_START_OPERATOR', 'Operator Association', '1798', 'Operator Association', '1798', '0', 'articles.php?page=verein', '1', '1', '9', '', '1', NULL);
|
||||
INSERT INTO `sys_menu` (`id`, `id_string`, `title`, `title_trans_id`, `menustring`, `menustring_trans_id`, `access`, `href`, `visible`, `parent`, `position`, `color`, `sitemap`, `only_if_parent`) VALUES ('88', 'MNU_VERIFY_EMAIL', 'Verify e-mail address', '1824', 'Verify e-mail address', '1824', '0', 'verifyemail.php', '0', '0', '0', '', '0', NULL);
|
||||
INSERT INTO `sys_menu` (`id`, `id_string`, `title`, `title_trans_id`, `menustring`, `menustring_trans_id`, `access`, `href`, `visible`, `parent`, `position`, `color`, `sitemap`, `only_if_parent`) VALUES ('89', 'MNU_ADMIN_ADMINS', 'Admins', '1831', 'Admins', '1831', '1', 'admins.php', '1', '12', '7', '', '0', NULL);
|
||||
INSERT INTO `sys_menu` (`id`, `id_string`, `title`, `title_trans_id`, `menustring`, `menustring_trans_id`, `access`, `href`, `visible`, `parent`, `position`, `color`, `sitemap`, `only_if_parent`) VALUES ('89', 'MNU_ADMIN_ADMINS', 'Admins', '1831', 'Admins', '1831', '1', 'admins.php', '1', '12', '8', '', '0', NULL);
|
||||
INSERT INTO `sys_menu` (`id`, `id_string`, `title`, `title_trans_id`, `menustring`, `menustring_trans_id`, `access`, `href`, `visible`, `parent`, `position`, `color`, `sitemap`, `only_if_parent`) VALUES ('90', 'MNU_START_NEWLOGPICS', 'Picture gallery', '1940', 'Picture gallery', '1940', '0', 'newlogpics.php', '1', '7', '2', '', '1', NULL);
|
||||
INSERT INTO `sys_menu` (`id`, `id_string`, `title`, `title_trans_id`, `menustring`, `menustring_trans_id`, `access`, `href`, `visible`, `parent`, `position`, `color`, `sitemap`, `only_if_parent`) VALUES ('91', 'MNU_START_OPENCACHING', 'About Opencaching', '1963', 'About Opencaching', '1963', '0', '!http://wiki.opencaching.de/index.php/Opencaching.de', '1', '1', '2', '', '1', NULL);
|
||||
INSERT INTO `sys_menu` (`id`, `id_string`, `title`, `title_trans_id`, `menustring`, `menustring_trans_id`, `access`, `href`, `visible`, `parent`, `position`, `color`, `sitemap`, `only_if_parent`) VALUES ('92', 'MNU_MYPROFILE_PUBLIC', 'Public profile', '1952', 'Public profile', '1952', '0', 'viewprofile.php', '1', '9', '2', '', '1', NULL);
|
||||
INSERT INTO `sys_menu` (`id`, `id_string`, `title`, `title_trans_id`, `menustring`, `menustring_trans_id`, `access`, `href`, `visible`, `parent`, `position`, `color`, `sitemap`, `only_if_parent`) VALUES ('93', 'MNU_ADMIN_RESTORE', 'Vandalism', '1880', 'Vandalism', '1880', '0', 'restorecaches.php', '1', '12', '5', '', '0', NULL);
|
||||
INSERT INTO `sys_menu` (`id`, `id_string`, `title`, `title_trans_id`, `menustring`, `menustring_trans_id`, `access`, `href`, `visible`, `parent`, `position`, `color`, `sitemap`, `only_if_parent`) VALUES ('93', 'MNU_ADMIN_RESTORE', 'Vandalism', '1880', 'Vandalism', '1880', '0', 'restorecaches.php', '1', '12', '6', '', '0', NULL);
|
||||
INSERT INTO `sys_menu` (`id`, `id_string`, `title`, `title_trans_id`, `menustring`, `menustring_trans_id`, `access`, `href`, `visible`, `parent`, `position`, `color`, `sitemap`, `only_if_parent`) VALUES ('94', 'MNU_START_NEWLOGSREST', 'Without Germany', '121', 'Without Germany', '121', '0', 'newlogsrest.php', '1', '7', '1', '', '1', NULL);
|
||||
INSERT INTO `sys_menu` (`id`, `id_string`, `title`, `title_trans_id`, `menustring`, `menustring_trans_id`, `access`, `href`, `visible`, `parent`, `position`, `color`, `sitemap`, `only_if_parent`) VALUES ('95', 'MNU_MYPROFILE_OKAPI', 'OKAPI Applications', '2008', 'OKAPI Apps', '2009', '0', '!okapi/apps/', '1', '9', '9', '', '1', NULL);
|
||||
INSERT INTO `sys_menu` (`id`, `id_string`, `title`, `title_trans_id`, `menustring`, `menustring_trans_id`, `access`, `href`, `visible`, `parent`, `position`, `color`, `sitemap`, `only_if_parent`) VALUES ('96', 'MNU_ADMIN_HISTORY', 'Cache history', '2059', 'Cache history', '2059', '1', 'adminhistory.php', '1', '12', '4', '', '0', NULL);
|
||||
|
||||
-- Table sys_trans
|
||||
SET NAMES 'utf8';
|
||||
@ -2473,6 +2474,15 @@ INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2050', 'JavaScr
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2051', 'Recommended on', '2013-05-14 13:48:04');
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2052', 'Nature protection', '2013-04-25 23:00:00');
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2053', 'Withdraw adoption offer', '2013-04-25 23:00:00');
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2055', 'Other reports for this cache', '2013-05-27 22:00:00');
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2056', 'Report date', '2013-05-27 22:00:00');
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2057', 'Reason', '2013-05-27 22:00:00');
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2058', 'Deleted logs', '2013-05-27 22:00:00');
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2059', 'Cache history', '2013-05-27 22:00:00');
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2060', 'Cache code', '2013-05-27 22:00:00');
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2061', 'Cache not found', '2013-05-27 22:00:00');
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2062', 'Status changes', '2013-05-27 22:00:00');
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2063', 'Changed by', '2013-05-27 22:00:00');
|
||||
|
||||
-- Table sys_trans_ref
|
||||
SET NAMES 'utf8';
|
||||
@ -6289,6 +6299,15 @@ INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUE
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2051', 'DE', 'empfohlen am', '2013-04-25 23:00:00');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2052', 'DE', 'Naturschutz', '2013-04-25 23:00:00');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2053', 'DE', 'Adoptionsangebot zurückziehen', '2013-04-25 23:00:00');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2055', 'DE', 'Weitere Meldungen für diesen Cache', '2013-04-25 23:00:00');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2056', 'DE', 'Gemeldet am', '2013-04-25 23:00:00');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2057', 'DE', 'Grund', '2013-04-25 23:00:00');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2058', 'DE', 'Gelöschte Logs', '2013-04-25 23:00:00');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2059', 'DE', 'Cache-Historie', '2013-04-25 23:00:00');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2060', 'DE', 'Cache-Code', '2013-04-25 23:00:00');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2061', 'DE', 'Cache nicht gefunden', '2013-04-25 23:00:00');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2062', 'DE', 'Statusänderungen', '2013-04-25 23:00:00');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2063', 'DE', 'Geändert von', '2013-04-25 23:00:00');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1', 'EN', 'Reorder IDs \r', '2010-09-02 00:15:30');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2', 'EN', 'The database could not be reconnected.', '2010-08-28 11:48:07');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('3', 'EN', 'Testing – please do not login', '2010-08-28 11:48:07');
|
||||
@ -7835,6 +7854,15 @@ INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUE
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2051', 'EN', 'Recommended on', '2013-05-12 22:00:00');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2052', 'EN', 'Nature Protection', '2013-02-19 05:48:07');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2053', 'EN', 'Withdraw adoption offer', '2013-02-19 05:48:07');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2055', 'EN', 'Other reports for this cache', '2013-04-25 23:00:00');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2056', 'EN', 'Report date', '2013-04-25 23:00:00');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2057', 'EN', 'Reason', '2013-04-25 23:00:00');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2058', 'EN', 'Deleted logs', '2013-04-25 23:00:00');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2059', 'EN', 'Cache history', '2013-04-25 23:00:00');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2060', 'EN', 'Cache code', '2013-04-25 23:00:00');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2061', 'EN', 'Cache not found', '2013-04-25 23:00:00');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2062', 'EN', 'Status changes', '2013-04-25 23:00:00');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2063', 'EN', 'Changed by', '2013-04-25 23:00:00');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1', 'ES', 'Reordenar ID', '2010-12-09 00:17:55');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2', 'ES', 'La base de datos no se pudo conectar.', '2010-12-09 00:17:55');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('3', 'ES', 'En pruebas - por favor, no entre.', '2010-12-09 00:17:55');
|
||||
|
@ -715,7 +715,9 @@
|
||||
IF OLD.`status`=5 AND NEW.`status`=1 THEN
|
||||
CALL sp_notify_new_cache(NEW.`cache_id`, NEW.`longitude`, NEW.`latitude`);
|
||||
END IF;
|
||||
|
||||
IF NEW.`status`<>OLD.`status` THEN
|
||||
INSERT INTO `cache_status_modified` (`cache_id`, `date_modified`, `old_state`, `new_state`, `user_id`) VALUES (NEW.`cache_id`, NOW(), OLD.`status`, NEW.`status`, IFNULL(@STATUS_CHANGE_USER_ID,0));
|
||||
END IF;
|
||||
SET @dont_update_listingdate=0;
|
||||
END;");
|
||||
|
||||
|
10
htdocs/doc/sql/tables/cache_status_modified.sql
Normal file
10
htdocs/doc/sql/tables/cache_status_modified.sql
Normal file
@ -0,0 +1,10 @@
|
||||
SET NAMES 'utf8';
|
||||
DROP TABLE IF EXISTS `cache_status_modified`;
|
||||
CREATE TABLE `cache_status_modified` (
|
||||
`cache_id` int(10) unsigned NOT NULL,
|
||||
`date_modified` datetime NOT NULL,
|
||||
`old_state` tinyint(2) unsigned NOT NULL,
|
||||
`new_state` tinyint(2) unsigned NOT NULL,
|
||||
`user_id` int(10) unsigned NOT NULL default '0',
|
||||
UNIQUE KEY `cache_id` (`cache_id`,`date_modified`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
|
@ -475,6 +475,7 @@ function getWaypoints($cacheid)
|
||||
|
||||
// save to DB
|
||||
// status update will trigger touching the last_modified date of all depending records
|
||||
sql("SET @STATUS_CHANGE_USER_ID='&1'", $usr['userid']);
|
||||
sql("UPDATE `caches` SET `name`='&1', `longitude`='&2', `latitude`='&3', `type`='&4', `date_hidden`='&5', `country`='&6', `size`='&7', `difficulty`='&8', `terrain`='&9', `status`='&10', `search_time`='&11', `way_length`='&12', `logpw`='&13', `wp_gc`='&14', `wp_nc`='&15', `date_activate` = $activation_date WHERE `cache_id`='&16'", $cache_name, $cache_lon, $cache_lat, $cache_type, date('Y-m-d', mktime(0, 0, 0, $cache_hidden_month, $cache_hidden_day, $cache_hidden_year)), $cache_country, $sel_size, $cache_difficulty, $cache_terrain, $status, $search_time, $way_length, $log_pw, $wp_gc, $wp_nc, $cache_id);
|
||||
|
||||
// do not use slave server for the next time ...
|
||||
|
@ -196,8 +196,10 @@ class cache
|
||||
}
|
||||
function setStatus($value)
|
||||
{
|
||||
$login;
|
||||
if (sql_value("SELECT COUNT(*) FROM `cache_status` WHERE `id`='&1'", 0, $value) == 1)
|
||||
{
|
||||
sql("SET @STATUS_CHANGE_USER_ID='&1'", $login->user_id);
|
||||
return $this->reCache->setValue('status', $value);
|
||||
}
|
||||
else
|
||||
@ -296,13 +298,13 @@ class cache
|
||||
{
|
||||
// admins may view owner-deleted logs
|
||||
$table = 'cache_logs_archived';
|
||||
$delfields = 'IFNULL(`u2`.`username`,"") AS `deleted_by_name`, `deletion_date`';
|
||||
$delfields = 'IFNULL(`u2`.`username`,"") AS `deleted_by_name`, `deletion_date`, "1" AS `deleted`';
|
||||
$addjoin = 'LEFT JOIN `user` `u2` ON `u2`.`user_id`=`cache_logs`.`deleted_by`';
|
||||
}
|
||||
else
|
||||
{
|
||||
$table = 'cache_logs';
|
||||
$delfields = '"" AS `deleted_by_name`, NULL AS `deletion_date`';
|
||||
$delfields = '"" AS `deleted_by_name`, NULL AS `deletion_date`, "0" AS `deleted`';
|
||||
$addjoin = '';
|
||||
}
|
||||
|
||||
@ -461,5 +463,59 @@ class cache
|
||||
{
|
||||
sql("DELETE FROM `cache_rating` WHERE `cache_id`='&1' AND `user_id`='&2'", $this->nCacheId, $nUserId);
|
||||
}
|
||||
|
||||
// retrieves admin cache history data and stores it to template variables
|
||||
// for display by adminhistory.tpl and adminreports.tpl
|
||||
function setTplHistoryData($exclude_report_id)
|
||||
{
|
||||
global $opt, $tpl;
|
||||
|
||||
// (other) reports for this cache
|
||||
$rs = sql("SELECT `cr`.`id`, `cr`.`date_created`, `cr`.`lastmodified`,
|
||||
`cr`.`userid`, `cr`.`adminid`,
|
||||
`users`.`username` AS `usernick`,
|
||||
`admins`.`username` AS `adminnick`,
|
||||
IFNULL(`tt`.`text`, `crs`.`name`) AS `status`,
|
||||
IFNULL(`tt2`.`text`, `crr`.`name`) AS `reason`
|
||||
FROM `cache_reports` AS `cr`
|
||||
LEFT JOIN `cache_report_reasons` AS `crr` ON `cr`.`reason`=`crr`.`id`
|
||||
LEFT JOIN `user` AS `users` ON `users`.`user_id`=`cr`.`userid`
|
||||
LEFT JOIN `user` AS `admins` ON `admins`.`user_id`=`cr`.`adminid`
|
||||
LEFT JOIN `cache_report_status` AS `crs` ON `cr`.`status`=`crs`.`id`
|
||||
LEFT JOIN `sys_trans_text` AS `tt` ON `crs`.`trans_id`=`tt`.`trans_id` AND `tt`.`lang`='&2'
|
||||
LEFT JOIN `sys_trans_text` AS `tt2` ON `crr`.`trans_id`=`tt2`.`trans_id` AND `tt2`.`lang`='&2'
|
||||
WHERE `cr`.`cacheid`='&1' AND `cr`.`id`<>'&3'
|
||||
ORDER BY `cr`.`status`,`cr`.`id` DESC", $this->getCacheId(), $opt['template']['locale'], $exclude_report_id);
|
||||
$tpl->assign_rs('reports',$rs);
|
||||
sql_free_result($rs);
|
||||
|
||||
// user; deleted logs
|
||||
$rs = sql("SELECT * FROM `caches` WHERE `cache_id`='&1'", $this->getCacheId());
|
||||
$rCache = sql_fetch_array($rs);
|
||||
$tpl->assign('cache', $rCache);
|
||||
sql_free_result($rs);
|
||||
$tpl->assign('ownername', sql_value("SELECT `username` FROM `user` WHERE `user_id`='&1'", "", $rCache['user_id']));
|
||||
|
||||
$tpl->assign('deleted_logs', $this->getLogsArray($this->getCacheId(), 0, 1000, true));
|
||||
|
||||
// status changes
|
||||
$rs = sql("SELECT `csm`.`date_modified`,
|
||||
`csm`.`old_state` AS `old_status_id`,
|
||||
`csm`.`new_state` AS `new_status_id`,
|
||||
`user`.`username`,
|
||||
IFNULL(`stt_old`.`text`,`cs_old`.`name`) AS `old_status`,
|
||||
IFNULL(`stt_new`.`text`,`cs_new`.`name`) AS `new_status`
|
||||
FROM `cache_status_modified` `csm`
|
||||
LEFT JOIN `cache_status` `cs_old` ON `cs_old`.`id`=`csm`.`old_state`
|
||||
LEFT JOIN `sys_trans_text` `stt_old` ON `stt_old`.`trans_id`=`cs_old`.`trans_id` AND `stt_old`.`lang`='&2'
|
||||
LEFT JOIN `cache_status` `cs_new` ON `cs_new`.`id`=`csm`.`new_state`
|
||||
LEFT JOIN `sys_trans_text` `stt_new` ON `stt_new`.`trans_id`=`cs_new`.`trans_id` AND `stt_new`.`lang`='&2'
|
||||
LEFT JOIN `user` ON `user`.`user_id`=`csm`.`user_id`
|
||||
WHERE `cache_id`='&1'
|
||||
ORDER BY `date_modified` DESC", $this->getCacheId(), $opt['template']['locale']);
|
||||
$tpl->assign_rs('status_changes',$rs);
|
||||
sql_free_result($rs);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
@ -238,7 +238,10 @@
|
||||
// update cache_status
|
||||
$new_cache_status = sqlValue("SELECT `cache_status` FROM `log_types` WHERE `id`='" . sql_escape($log_type) . "'", 0);
|
||||
if ($new_cache_status > 0)
|
||||
{
|
||||
sql("SET @STATUS_CHANGE_USER_ID='&1'", $usr['userid']);
|
||||
$rs = sql("UPDATE `caches` SET `status`='&1' WHERE `cache_id`='&2'", $new_cache_status, $cache_id);
|
||||
}
|
||||
|
||||
// insert log
|
||||
sql("INSERT INTO `cache_logs` (`id`, `cache_id`, `user_id`, `type`, `oc_team_comment`, `date`, `text`, `text_html`, `text_htmledit`, `node`)
|
||||
|
50
htdocs/templates2/ocstyle/adminhistory.tpl
Normal file
50
htdocs/templates2/ocstyle/adminhistory.tpl
Normal file
@ -0,0 +1,50 @@
|
||||
{***************************************************************************
|
||||
* You can find the license in the docs directory
|
||||
*
|
||||
* Unicode Reminder メモ
|
||||
***************************************************************************}
|
||||
{* OCSTYLE *}
|
||||
<div class="content2-pagetitle">
|
||||
<img src="resource2/{$opt.template.style}/images/misc/32x32-tools.png" style="align: left; margin-right: 10px;" width="32" height="32" alt="World" />
|
||||
{t}Cache history{/t}
|
||||
</div>
|
||||
|
||||
<form method="POST" action="adminhistory.php">
|
||||
<p>
|
||||
<b>{t}Cache code{/t}:</b>
|
||||
<input type="text" width="10" name="wp" />
|
||||
<input type="submit" name="submitform" value="{t}Show{/t}" class="formbutton" onclick="submitbutton('submitform')" />
|
||||
</p>
|
||||
</form>
|
||||
|
||||
{if $showhistory}
|
||||
<p>
|
||||
<a href="viewcache.php?cacheid={$cache.cache_id}">{$cache.name}</a>
|
||||
{t}by{/t}
|
||||
<a href="viewprofile.php?userid={$cache.user_id}">{$ownername}</a>
|
||||
</p>
|
||||
<br />
|
||||
|
||||
<div class="content2-container bg-blue02">
|
||||
<p class="content-title-noshade-size2">
|
||||
<img src="resource2/{$opt.template.style}/images/misc/32x32-tools.png" style="align: left; margin-right: 10px;" width="22" height="22" alt="" />
|
||||
{t}Cache reports{/t}
|
||||
</p>
|
||||
</div>
|
||||
{include file="adminreport_history.tpl"}
|
||||
|
||||
<div class="content2-container bg-blue02">
|
||||
<p class="content-title-noshade-size2">
|
||||
<img src="resource2/{$opt.template.style}/images/description/22x22-logs.png" style="align: left; margin-right: 10px;" width="22" height="22" alt="" />
|
||||
{t}Deleted logs{/t}
|
||||
</p>
|
||||
</div>
|
||||
<div class="content2-container">
|
||||
{include file="res_logentry.tpl" header=false footer=false footbacklink=false cache=$cache logs=$deleted_logs}
|
||||
</div>
|
||||
|
||||
{include file="res_status_changes.tpl"}
|
||||
|
||||
{else}
|
||||
<p class="errormsg">{$error}</p>
|
||||
{/if}
|
36
htdocs/templates2/ocstyle/adminreport_history.tpl
Normal file
36
htdocs/templates2/ocstyle/adminreport_history.tpl
Normal file
@ -0,0 +1,36 @@
|
||||
{***************************************************************************
|
||||
* You can find the license in the docs directory
|
||||
*
|
||||
* Unicode Reminder メモ
|
||||
***************************************************************************}
|
||||
{* OCSTYLE *}
|
||||
|
||||
<table class="table" width="98%">
|
||||
{if $reports|@count}
|
||||
<tr>
|
||||
<th>{t}ID{/t}</th>
|
||||
<th>{t}Report date{/t}</th>
|
||||
<th>{t}Reporter{/t}</th>
|
||||
<th>{t}Reason{/t}</th>
|
||||
<th>{t}Admin{/t}</th>
|
||||
<th>{t}Last modified{/t}</th>
|
||||
<th>{t}Status{/t}</th>
|
||||
</tr>
|
||||
|
||||
{foreach from=$reports item=report}
|
||||
<tr>
|
||||
<td><a href="adminreports.php?id={$report.id}">{$report.id}</a></td>
|
||||
<td>{$report.date_created|date_format:$opt.format.date}</td>
|
||||
<td><a href="viewprofile.php?userid={$report.userid}">{$report.usernick}</a></td>
|
||||
<td>{$report.reason}</td>
|
||||
<td><a href="viewprofile.php?userid={$report.adminid}">{$report.adminnick}</a></td>
|
||||
<td>{$report.lastmodified|date_format:$opt.format.date}</td>
|
||||
<td>{$report.status}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
|
||||
{else}
|
||||
<tr><td></td></tr>
|
||||
{/if}
|
||||
</table>
|
||||
|
@ -32,7 +32,7 @@
|
||||
{foreach from=$reportedcaches item=rc}
|
||||
<tr>
|
||||
{if $rc.otheradmin > $otheradmins}
|
||||
<td colspan=5"><p style="line-height: 2.5em;">{t}(*) New reports{/t}</p>
|
||||
<td colspan="5"><p style="line-height: 2.5em;">{t}(*) New reports{/t}</p>
|
||||
</td></tr>
|
||||
<tr><th>{t}ID{/t}</th><th>{t}Name{/t}</th><th>{t}Owner{/t}</th><th>{t}Reporter{/t}</th><th>{t}Admin{/t}</th><th>{t}Date{/t}</th></tr>
|
||||
{assign var="otheradmins" value=$rc.otheradmin}
|
||||
@ -105,6 +105,34 @@
|
||||
</p><br />{t}Warning: This report is already assigned to another admin. Consult him first before you assume the report!{/t}
|
||||
{/if}
|
||||
{/if}
|
||||
<br />
|
||||
|
||||
{if $reports|@count}
|
||||
<div class="content2-container bg-blue02">
|
||||
<p class="content-title-noshade-size2">
|
||||
<img src="resource2/{$opt.template.style}/images/misc/32x32-tools.png" style="align: left; margin-right: 10px;" width="22" height="22" alt="" />
|
||||
{t}Other reports for this cache{/t}
|
||||
</p>
|
||||
</div>
|
||||
{include file="adminreport_history.tpl"}
|
||||
{/if}
|
||||
|
||||
{if $deleted_logs|@count}
|
||||
<div class="content2-container bg-blue02">
|
||||
<p class="content-title-noshade-size2">
|
||||
<img src="resource2/{$opt.template.style}/images/description/22x22-logs.png" style="align: left; margin-right: 10px;" width="22" height="22" alt="" />
|
||||
{t}Deleted logs{/t}
|
||||
</p>
|
||||
</div>
|
||||
<div class="content2-container">
|
||||
{include file="res_logentry.tpl" header=false footer=false footbacklink=false cache=$cache logs=$deleted_logs}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{if $status_changes|@count}
|
||||
{include file="res_status_changes.tpl"}
|
||||
{/if}
|
||||
|
||||
{/if}
|
||||
|
||||
</form>
|
||||
|
@ -43,7 +43,7 @@
|
||||
</p>
|
||||
|
||||
{* Ocprop: /\?logid=([0-9a-f\-]+)" *}
|
||||
{if $cache.userid==$login.userid || $logItem.userid==$login.userid}
|
||||
{if $logItem.deleted !== "1" && ($cache.userid==$login.userid || $logItem.userid==$login.userid)}
|
||||
<p class="editlog"><img src="images/trans.gif" border="0" width="16" height="16" alt="" title="" />
|
||||
{if $logItem.userid==$login.userid && ($cache.userid==$login.userid || $cache.status!=6 || $cache.adminlog)}
|
||||
<a href="editlog.php?logid={$logItem.id|urlencode}"><img src="resource2/{$opt.template.style}/images/action/16x16-properties.png" border="0" align="middle" border="0" width="16" height="16" alt="" /></a>
|
||||
|
32
htdocs/templates2/ocstyle/res_status_changes.tpl
Normal file
32
htdocs/templates2/ocstyle/res_status_changes.tpl
Normal file
@ -0,0 +1,32 @@
|
||||
{***************************************************************************
|
||||
* You can find the license in the docs directory
|
||||
*
|
||||
* Unicode Reminder メモ
|
||||
***************************************************************************}
|
||||
{* OCSTYLE *}
|
||||
|
||||
<div class="content2-container bg-blue02">
|
||||
<p class="content-title-noshade-size2">
|
||||
<img src="resource2/{$opt.template.style}/images/description/22x22-logs.png" style="align: left; margin-right: 10px;" width="22" height="22" alt="" />
|
||||
{t}Status changes{/t}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<table class="table" width="80%">
|
||||
{if $status_changes|@count}
|
||||
<tr>
|
||||
<th>{t}Date{/t}</th>
|
||||
<th>{t}Status{/t}</th>
|
||||
<th>{t}Changed by{/t}</th>
|
||||
</tr>
|
||||
{foreach from=$status_changes item=change}
|
||||
<tr>
|
||||
<td>{$change.date_modified|date_format:$opt.format.date}</td>
|
||||
<td>{$change.old_status} → {$change.new_status} {include file="res_cachestatus.tpl" status=$change.new_status_id}</td>
|
||||
<td>{$change.username}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{else}
|
||||
<tr><td></td></tr>
|
||||
{/if}
|
||||
</table>
|
Reference in New Issue
Block a user