added listing-admin functions
This commit is contained in:
parent
d500c122fc
commit
bb2d7f8e16
@ -343,7 +343,12 @@
|
||||
|
||||
function dbv_118() // resize field password to fit to the new hashed passwords
|
||||
{
|
||||
sql("ALTER TABLE `user` MODIFY COLUMN `password` VARCHAR(128)");
|
||||
sql("ALTER TABLE `user` MODIFY COLUMN `password` VARCHAR(128) default NULL");
|
||||
}
|
||||
|
||||
function dbv_119() // resize admin status field to enable more detailed rights
|
||||
{
|
||||
sql("ALTER TABLE `user` MODIFY COLUMN `admin` smallint(5) unsigned NOT NULL default '0'");
|
||||
}
|
||||
|
||||
|
||||
|
@ -32,6 +32,7 @@
|
||||
if ($record['admin'] & ADMIN_NEWS) $rights[] = "newsapprove";
|
||||
if ($record['admin'] & ADMIN_RESTORE) $rights[] = "vand.restore";
|
||||
if ($record['admin'] & 128) $rights[] = "root";
|
||||
if ($record['admin'] & ADMIN_LISTING) $rights[] = "listing";
|
||||
$admin['rights'] = implode(", ", $rights);
|
||||
$admins[] = $admin;
|
||||
}
|
||||
|
@ -117,6 +117,7 @@
|
||||
|
||||
$opt['logic']['pictures']['dummy']['replacepic'] = $dev_basepath . $dev_codepath . 'htdocs/images/no_image_license.png';
|
||||
$opt['logic']['license']['disclaimer'] = true;
|
||||
$opt['logic']['admin']['listingadmin_notification'] = 'root';
|
||||
|
||||
$opt['template']['locales']['DA']['show'] = false;
|
||||
$opt['template']['locales']['FR']['show'] = false;
|
||||
|
@ -456,6 +456,8 @@
|
||||
// admin may use OC-team-comment log flag only when processing a cache report
|
||||
// see also setting in lib/settings.inc.php!
|
||||
$opt['logic']['admin']['team_comments_only_for_reports'] = true;
|
||||
$opt['logic']['admin']['enable_listing_admins'] = false;
|
||||
$opt['logic']['admin']['listingadmin_notification'] = ''; // Email address(es), comma separated
|
||||
|
||||
/* Database charset
|
||||
* frontend and php charsets are UTF-8
|
||||
|
@ -2588,6 +2588,9 @@ INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2160', 'Faceboo
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2161', 'Only one account can be created per E-Mail address. First name, last name and country are optional.', '2013-08-07 18:30:00');
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2162', 'Your log entries', '2010-08-28 11:48:04');
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2163', 'There are no log entries yet for your geocaches.', '2010-08-28 11:48:04');
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2164', 'Cache listing {occode} has been modified by {username}', '2010-08-28 11:48:04');
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2165', 'The cache description of {occode} has been modified by {username}', '2010-08-28 11:48:04');
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2166', 'The modifications can be checked via vandalism restore function.', '2010-08-28 11:48:04');
|
||||
|
||||
-- Table sys_trans_ref
|
||||
SET NAMES 'utf8';
|
||||
@ -6628,6 +6631,9 @@ INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUE
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2161', 'DE', 'Pro E-Mail-Adresse kann nur ein Benutzeraccount eingerichtet werden. Die Angabe von Vorname, Nachname und Land sind freiwillig.', '2013-08-07 18:30:00');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2162', 'DE', 'Deine Logeinträge', '2010-08-28 11:48:06');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2163', 'DE', 'Es gibt noch keine Logeinträge für deine Caches.', '2010-08-28 11:48:06');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2164', 'DE', 'Das Cachelisting {occode} wurde von {username} verändert.', '2010-08-28 11:48:06');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2165', 'DE', 'Die Cachebeschreibung von {occode} wurde von {username} verändert.', '2010-08-28 11:48:06');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2166', 'DE', 'Was geändert wurde, ist über die Vandalismus-Revertierfunktion einsehbar.', '2010-08-28 11:48:06');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1', 'EN', 'Reorder IDs', '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');
|
||||
|
@ -8,7 +8,7 @@ CREATE TABLE `user` (
|
||||
`last_modified` datetime NOT NULL COMMENT 'via Trigger (user)',
|
||||
`last_login` date default NULL,
|
||||
`username` varchar(60) NOT NULL,
|
||||
`password` varchar(32) default NULL,
|
||||
`password` varchar(128) default NULL,
|
||||
`email` varchar(60) default NULL,
|
||||
`email_problems` int(10) NOT NULL default '0',
|
||||
`first_email_problem` date default NULL,
|
||||
@ -37,7 +37,7 @@ CREATE TABLE `user` (
|
||||
`no_htmledit_flag` tinyint(1) NOT NULL default '0',
|
||||
`notify_radius` int(10) unsigned NOT NULL default '0',
|
||||
`notify_oconly` tinyint(1) NOT NULL default '1',
|
||||
`admin` tinyint(3) unsigned NOT NULL default '0',
|
||||
`admin` smallint(5) unsigned NOT NULL default '0',
|
||||
`data_license` tinyint(1) NOT NULL default '0',
|
||||
`description` mediumtext NOT NULL,
|
||||
`desc_htmledit` tinyint(1) unsigned NOT NULL default '1',
|
||||
|
@ -82,13 +82,13 @@ function getWaypoints($cacheid)
|
||||
}
|
||||
else
|
||||
{
|
||||
$cache_rs = sql("SELECT `caches`.`uuid`, `caches`.`user_id`, `caches`.`name`, `stat_caches`.`picture`, `caches`.`type`, `caches`.`size`, `caches`.`date_hidden`, `caches`.`date_activate`, `caches`.`longitude`, `caches`.`latitude`, `caches`.`country`, `caches`.`terrain`, `caches`.`difficulty`, `caches`.`desc_languages`, `caches`.`status`, `caches`.`search_time`, `caches`.`way_length`, `caches`.`logpw`, `caches`.`wp_gc`, `caches`.`wp_nc`, `caches`.`node`, `user`.`username` FROM `caches` INNER JOIN `user` ON `caches`.`user_id`=`user`.`user_id` LEFT JOIN `stat_caches` ON `caches`.`cache_id`=`stat_caches`.`cache_id` WHERE `caches`.`cache_id`='&1'", $cache_id);
|
||||
$cache_rs = sql("SELECT `caches`.`uuid`, `caches`.`user_id`, `caches`.`name`, `stat_caches`.`picture`, `caches`.`type`, `caches`.`size`, `caches`.`date_hidden`, `caches`.`date_activate`, `caches`.`longitude`, `caches`.`latitude`, `caches`.`country`, `caches`.`terrain`, `caches`.`difficulty`, `caches`.`desc_languages`, `caches`.`status`, `caches`.`search_time`, `caches`.`way_length`, `caches`.`logpw`, `caches`.`wp_oc`, `caches`.`wp_gc`, `caches`.`wp_nc`, `caches`.`node`, `user`.`username` FROM `caches` INNER JOIN `user` ON `caches`.`user_id`=`user`.`user_id` LEFT JOIN `stat_caches` ON `caches`.`cache_id`=`stat_caches`.`cache_id` WHERE `caches`.`cache_id`='&1'", $cache_id);
|
||||
$cache_record = sql_fetch_array($cache_rs);
|
||||
sql_free_result($cache_rs);
|
||||
|
||||
if ($cache_record !== false)
|
||||
{
|
||||
if ($cache_record['user_id'] == $usr['userid'])
|
||||
if ($cache_record['user_id'] == $usr['userid'] || $login->listingAdmin())
|
||||
{
|
||||
$tplname = 'editcache';
|
||||
|
||||
@ -479,6 +479,18 @@ function getWaypoints($cacheid)
|
||||
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);
|
||||
|
||||
// send notification on admin intervention
|
||||
if ($cache_record['user_id'] != $usr['userid'] &&
|
||||
$opt['logic']['admin']['listingadmin_notification'] != '')
|
||||
{
|
||||
mail(
|
||||
$opt['logic']['admin']['listingadmin_notification'],
|
||||
mb_ereg_replace('{occode}', $cache_record['wp_oc'],
|
||||
mb_ereg_replace('{username}', $usr['username'],
|
||||
t('Cache listing {occode} has been modified by {username}'))),
|
||||
t('The modifications can be checked via vandalism restore function.'));
|
||||
}
|
||||
|
||||
// generate status-change log
|
||||
if ($status != $status_old && $status_old != 5)
|
||||
{
|
||||
|
@ -66,7 +66,7 @@
|
||||
else
|
||||
{
|
||||
|
||||
$desc_rs = sql("SELECT `cache_desc`.`cache_id` `cache_id`, `cache_desc`.`node` `node`, `cache_desc`.`language` `language`, `caches`.`name` `name`, `caches`.`user_id` `user_id`, `cache_desc`.`desc` `desc`, `cache_desc`.`hint` `hint`, `cache_desc`.`short_desc` `short_desc`, `cache_desc`.`desc_html` `desc_html`, `cache_desc`.`desc_htmledit` `desc_htmledit` FROM `caches`, `cache_desc` WHERE (`caches`.`cache_id` = `cache_desc`.`cache_id`) AND `cache_desc`.`id`='&1'", $descid);
|
||||
$desc_rs = sql("SELECT `cache_desc`.`cache_id` `cache_id`, `cache_desc`.`node` `node`, `cache_desc`.`language` `language`, `caches`.`name` `name`, `caches`.`user_id` `user_id`, `caches`.`wp_oc`, `cache_desc`.`desc` `desc`, `cache_desc`.`hint` `hint`, `cache_desc`.`short_desc` `short_desc`, `cache_desc`.`desc_html` `desc_html`, `cache_desc`.`desc_htmledit` `desc_htmledit` FROM `caches`, `cache_desc` WHERE (`caches`.`cache_id` = `cache_desc`.`cache_id`) AND `cache_desc`.`id`='&1'", $descid);
|
||||
$desc_record = sql_fetch_array($desc_rs);
|
||||
sql_free_result($desc_rs);
|
||||
|
||||
@ -81,7 +81,7 @@
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($desc_record['user_id'] == $usr['userid'])
|
||||
if ($desc_record['user_id'] == $usr['userid'] || $login->listingAdmin())
|
||||
{
|
||||
$tplname = 'editdesc';
|
||||
|
||||
@ -181,6 +181,18 @@
|
||||
$desclang,
|
||||
$descid);
|
||||
|
||||
// send notification on admin intervention
|
||||
if ($desc_record['user_id'] != $usr['userid'] &&
|
||||
$opt['logic']['admin']['listingadmin_notification'] != '')
|
||||
{
|
||||
mail(
|
||||
$opt['logic']['admin']['listingadmin_notification'],
|
||||
mb_ereg_replace('{occode}', $desc_record['wp_oc'],
|
||||
mb_ereg_replace('{username}', $usr['username'],
|
||||
t('The cache description of {occode} has been modified by {username}'))),
|
||||
'');
|
||||
}
|
||||
|
||||
// do not use slave server for the next time ...
|
||||
db_slave_exclude();
|
||||
|
||||
|
@ -149,6 +149,12 @@ class login
|
||||
return ($this->admin & $privilege) == $privilege;
|
||||
}
|
||||
|
||||
public function listingAdmin()
|
||||
{
|
||||
global $opt;
|
||||
return $this->hasAdminPriv(ADMIN_LISTING) && $opt['logic']['admin']['enable_listing_admins'];
|
||||
}
|
||||
|
||||
function checkLoginsCount()
|
||||
{
|
||||
global $opt;
|
||||
|
@ -151,6 +151,8 @@
|
||||
|
||||
// admin may use OC-team-comment log flag only when processing a cache report
|
||||
$opt['logic']['admin']['team_comments_only_for_reports'] = true;
|
||||
$opt['logic']['admin']['enable_listing_admins'] = false;
|
||||
$opt['logic']['admin']['listingadmin_notification'] = 'root';
|
||||
|
||||
// see config2/settings-dist.inc.php
|
||||
$opt['template']['default']['locale'] = 'DE'; // may be overwritten by $opt['domain'][...]['locale']
|
||||
|
@ -150,6 +150,8 @@
|
||||
// admin may use OC-team-comment log flag only when processing a cache report
|
||||
// see also setting in config2/settings.inc.php!
|
||||
$opt['logic']['admin']['team_comments_only_for_reports'] = true;
|
||||
$opt['logic']['admin']['enable_listing_admins'] = false;
|
||||
$opt['logic']['admin']['listingadmin_notification'] = 'contact@opencaching.xx';
|
||||
|
||||
// see config2/settings-dist.inc.php
|
||||
$opt['template']['default']['locale'] = 'DE'; // may be overwritten by $opt['domain'][...]['locale']
|
||||
|
@ -35,6 +35,7 @@
|
||||
define('ADMIN_NEWS', 8); // approve news entries
|
||||
define('ADMIN_RESTORE', 16); // restore vandalized listings
|
||||
define('ADMIN_ROOT', 128 | 127); // root + all previous rights
|
||||
define('ADMIN_LISTING', 1024); // can edit any cache listings
|
||||
|
||||
define('ATTRIB_SELECTED', 1);
|
||||
define('ATTRIB_UNSELECTED', 2);
|
||||
|
@ -339,6 +339,12 @@ class login
|
||||
return ($this->admin & $privilege) == $privilege;
|
||||
}
|
||||
|
||||
public function listingAdmin()
|
||||
{
|
||||
global $opt;
|
||||
return $this->hasAdminPriv(ADMIN_LISTING) && $opt['logic']['admin']['enable_listing_admins'];
|
||||
}
|
||||
|
||||
function logged_in()
|
||||
{
|
||||
return $this->userid > 0;
|
||||
|
@ -110,7 +110,7 @@
|
||||
<li class="group"><a style="background-image: url(resource2/{$opt.template.style}/images/viewcache/ignore-18.png);background-repeat:no-repeat;" href="ignore.php?cacheid={$cache.cacheid|urlencode}&action=addignore">{t}Ignore{/t}</a></li>
|
||||
{/if}
|
||||
|
||||
{if $login.userid==$cache.userid}
|
||||
{if $login.userid==$cache.userid || $listing_admin }
|
||||
<li class="group"><a style="background-image: url(resource2/{$opt.template.style}/images/viewcache/page.png);background-repeat:no-repeat;" href="editcache.php?cacheid={$cache.cacheid|urlencode}">{t}Edit{/t}</a></li>
|
||||
{/if}
|
||||
{/if}
|
||||
|
@ -343,6 +343,7 @@ function getChildWaypoints($cacheid)
|
||||
$tpl->assign('cachemap', $cachemap);
|
||||
|
||||
$tpl->assign('shortlink_domain', $opt['logic']['shortlink_domain']);
|
||||
$tpl->assign('listing_admin', $login->listingAdmin());
|
||||
|
||||
// display the page
|
||||
$tpl->display();
|
||||
|
Loading…
x
Reference in New Issue
Block a user