Skip to content
Permalink
Browse files

added admin reports & cache status history

  • Loading branch information...
following5 committed May 27, 2013
1 parent 04f9d86 commit 239003bff494b21e0c8820da76c69e35cc64abca
@@ -151,4 +151,18 @@ function dbv_105() // HTML user profile texts
}
}
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");
}
?>
@@ -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';
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&nbsp;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');
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&nbsp;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;");
@@ -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 ...
Oops, something went wrong.

0 comments on commit 239003b

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