v3.0.5 code review: lots of small fixes and cleanup

- fixed nano selection in search form
- removed unused, duplicate thumb replacement pics
- freed mysql result in lib1 helppage-link generation
- fixed logpic-is-on-first-page calculation
- fixed and improved user option set handling
- readded map dragzoom
- improved log pic pages layout
- user pics page counter fix
This commit is contained in:
following
2013-03-15 12:23:21 +01:00
parent a1ea6b6aff
commit 1c40b83bd2
31 changed files with 66 additions and 223 deletions
+1 -1
View File
@@ -317,7 +317,7 @@ function fix_magic_quotes_gpc()
}
}
// wiki help embedding
// external help embedding
// pay attention to use only ' quotes in $text (escape other ')
//
// see corresponding function in lib/common.inc.php
-6
View File
@@ -32,10 +32,4 @@
define('DB_MODE_BUSINESSLAYER', 1);
define('DB_MODE_USER', 2);
define('DB_DATE_FORMAT', '%Y-%m-%d %H:%M:%S');
// constants for user options (must match values in DB!)
define('USR_OPT_GMZOOM', 1);
define('USR_OPT_SHOWSTATS', 5);
define('USR_OPT_TRANSLANG', 6);
define('USR_OPT_PICSTAT', 11);
?>
+11
View File
@@ -53,4 +53,15 @@
// As of march 2013, there are a good deal of OC.de caches with 50-100 pics,
// but only one with more (~500 pics). If lots of caches have >100 pics,
// it may pay out to limit the gallery e.g. to 60 pics and implement browsing.
// constants for user options (must match values in DB!)
define('USR_OPT_GMZOOM', 1);
define('USR_OPT_SHOWSTATS', 5);
define('USR_OPT_MAP_MENU', 6);
define('USR_OPT_MAP_OVERVIEW', 7);
define('USR_OPT_MAP_MAXCACHES', 8);
define('USR_OPT_MAP_ICONSET', 9);
define('USR_OPT_MAP_PREVIEW', 10);
define('USR_OPT_PICSTAT', 11);
define('USR_OPT_TRANSLANG', 12);
?>
+2 -8
View File
@@ -25,14 +25,6 @@ function get_logpics($purpose, $userid=0, $cacheid=0, $startat=0)
{
global $login;
// Variables to return for res_logpictures are
//
// from pictures: uuid, url and title
// from cache_logs: id, cache_id, date and type (type currently unused)
// from user: user_id and username, only if no $userid param is given
$rs = false;
$fields = "`pics`.`uuid` AS `pic_uuid`, `pics`.`url` AS `pic_url`,
`pics`.`title`, `pics`.`date_created`,
`logs`.`user_id`, `logs`.`cache_id`,
@@ -44,6 +36,8 @@ function get_logpics($purpose, $userid=0, $cacheid=0, $startat=0)
"INNER JOIN `cache_status` ON `caches`.`status`=`cache_status`.`id` AND `allow_user_view`=1";
$join_user = "INNER JOIN `user` ON `user`.`user_id`=`logs`.`user_id`";
$rs = false;
switch ($purpose)
{
case LOGPICS_FOR_STARTPAGE_GALLERY:
+2 -2
View File
@@ -239,9 +239,9 @@ class picture
return null;
else
$rs = sql("SELECT `id` FROM `cache_logs` WHERE `cache_id`='&1'
ORDER BY `date` DESC
ORDER BY `date`, `id` DESC
LIMIT &2",
$this->getCacheId(), MAX_LOGENTRIES_ON_CACHEPAGE);
$this->getCacheId(), MAX_LOGENTRIES_ON_CACHEPAGE);
$firstlogs = false;
while ($r = sql_fetch_assoc($rs))
if ($r['id'] == $this->getLogId())
+5 -5
View File
@@ -1,6 +1,6 @@
<?php
/***************************************************************************
* You can find the license in the docs directory
* For license information see doc/license.txt
*
* Unicode Reminder メモ
*
@@ -10,6 +10,7 @@
global $opt;
require_once($opt['rootpath'] . '../lib/htmlpurifier-4.2.0/library/HTMLPurifier.auto.php');
require_once($opt['rootpath'] . 'lib2/logic/const.inc.php');
class useroptions
{
@@ -17,7 +18,7 @@ class useroptions
var $nUserId = 0;
var $nOptions;
function __construct($nUserId=ID_NEW, $optionset=1)
function __construct($nUserId=ID_NEW)
{
$this->nUserId = $nUserId+0;
@@ -31,13 +32,12 @@ class useroptions
$rs = sqll("SELECT `p`.`id`, `p`.`name`, `p`.`default_value`, `p`.`check_regex`, `p`.`option_order`, IFNULL(`u`.`option_visible`, 0) AS `option_visible`, `p`.`internal_use`, IFNULL(`u`.`option_value`, `p`.`default_value`) AS `option_value`
FROM `profile_options` AS `p`
LEFT JOIN `user_options` AS `u` ON `p`.`id`=`u`.`option_id` AND (`u`.`user_id` IS NULL OR `u`.`user_id`='&1')
WHERE `optionset`='&2'
UNION
SELECT `u`.`option_id` AS `id`, `p`.`name`, `p`.`default_value`, `p`.`check_regex`, `p`.`option_order`, `u`.`option_visible`, `p`.`internal_use`, IFNULL(`u`.`option_value`, `p`.`default_value`) AS `option_value`
FROM `user_options` AS `u`
LEFT JOIN `profile_options` AS `p` ON `p`.`id`=`u`.`option_id`
WHERE `u`.`user_id`='&1'",
$this->nUserId, $optionset);
$this->nUserId);
}
while($record = sql_fetch_array($rs))
@@ -52,7 +52,7 @@ class useroptions
{
return $this->nUserId;
}
function getOptSet()
function getOptSet($pId)
{
return $this->nOptions[$pId]['optionset'];
}