Skip to content
Permalink
Browse files

merged branch 168-cachelists

  • Loading branch information...
following5 committed Jun 25, 2015
2 parents 9e1ffa2 + 288b823 commit 5afc1f808f607bb14e285dbcd5f21cd4f5cd0dbe
Showing with 2,557 additions and 213 deletions.
  1. +95 −0 bin/dbsv-update.php
  2. +1 −1 doc/license.txt
  3. +66 −0 htdocs/addtolist.php
  4. +29 −0 htdocs/cachelist.php
  5. +51 −0 htdocs/cachelists.php
  6. +3 −0 htdocs/dbmaintain.php
  7. +95 −6 htdocs/doc/sql/static-data/data.sql
  8. +310 −0 htdocs/doc/sql/stored-proc/maintain-123.inc.php
  9. +135 −0 htdocs/doc/sql/stored-proc/maintain-124.inc.php
  10. +50 −0 htdocs/doc/sql/stored-proc/maintain-125.inc.php
  11. +251 −17 htdocs/doc/sql/stored-proc/maintain-current.inc.php
  12. +8 −0 htdocs/doc/sql/tables/cache_list_items.sql
  13. +8 −0 htdocs/doc/sql/tables/cache_list_watches.sql
  14. +20 −0 htdocs/doc/sql/tables/cache_lists.sql
  15. +1 −0 htdocs/doc/sql/tables/caches.sql
  16. +8 −0 htdocs/doc/sql/tables/stat_cache_lists.sql
  17. +7 −2 htdocs/editcache.php
  18. +5 −1 htdocs/lang/de/ocstyle/editcache.tpl.php
  19. +14 −7 htdocs/lang/de/ocstyle/lib/menu.php
  20. +1 −0 htdocs/lib2/logic/cache.class.php
  21. +412 −0 htdocs/lib2/logic/cachelist.class.php
  22. +3 −0 htdocs/lib2/logic/user.class.php
  23. +10 −0 htdocs/lib2/search/search.html.inc.php
  24. +26 −0 htdocs/lib2/smarty/ocplugins/modifier.stripcrlf.php
  25. +174 −0 htdocs/mylists.php
  26. +19 −0 htdocs/mywatches.php
  27. +29 −4 htdocs/resource2/ocstyle/css/style_screen.css
  28. BIN htdocs/resource2/ocstyle/images/misc/16x16-list.png
  29. BIN htdocs/resource2/ocstyle/images/misc/32x32-list.png
  30. BIN htdocs/resource2/ocstyle/images/viewcache/list-18.png
  31. +45 −0 htdocs/resource2/tinymce/config/list.js.php
  32. +23 −0 htdocs/search.php
  33. +53 −0 htdocs/templates2/ocstyle/addtolist.tpl
  34. +2 −0 htdocs/templates2/ocstyle/articles/DE/cacheinfo.tpl
  35. +8 −0 htdocs/templates2/ocstyle/articles/EN/cacheinfo.tpl
  36. +81 −0 htdocs/templates2/ocstyle/cachelists.tpl
  37. +166 −0 htdocs/templates2/ocstyle/js/editor.inc.tpl
  38. +1 −148 htdocs/templates2/ocstyle/mydescription.tpl
  39. +1 −1 htdocs/templates2/ocstyle/mydetails.tpl
  40. +4 −3 htdocs/templates2/ocstyle/myignores.tpl
  41. +151 −0 htdocs/templates2/ocstyle/mylists.tpl
  42. +2 −2 htdocs/templates2/ocstyle/mytop5.tpl
  43. +17 −4 htdocs/templates2/ocstyle/mywatches.tpl
  44. +1 −1 htdocs/templates2/ocstyle/query.tpl
  45. +8 −0 htdocs/templates2/ocstyle/res_cachelist_link.tpl
  46. +43 −0 htdocs/templates2/ocstyle/res_cachelists.tpl
  47. +20 −1 htdocs/templates2/ocstyle/search.result.caches.tpl
  48. +2 −2 htdocs/templates2/ocstyle/usertops.tpl
  49. +48 −12 htdocs/templates2/ocstyle/viewcache.tpl
  50. +26 −0 htdocs/templates2/ocstyle/viewprofile.tpl
  51. +6 −1 htdocs/viewcache.php
  52. +18 −0 htdocs/viewprofile.php
@@ -373,6 +373,101 @@ function dbv_122() // add user profile flag for default setting of send-my-email
}
}
function dbv_123() // add tables, fields and procs for cache lists and list watches
{
if (!sql_table_exists('cache_lists'))
{
sql("
CREATE TABLE `cache_lists` (
`id` int(10) NOT NULL auto_increment,
`uuid` varchar(36) NOT NULL,
`user_id` int(10) NOT NULL,
`date_created` datetime NOT NULL,
`last_modified` datetime NOT NULL,
`last_added` datetime default NULL,
`name` varchar(80) NOT NULL,
`is_public` tinyint(1) NOT NULL default '0',
`entries` int(6) NOT NULL default '0' COMMENT 'via trigger in cache_list_items',
`watchers` int(10) NOT NULL default '0' COMMENT 'via trigger in cache_list_watches',
PRIMARY KEY (`id`),
UNIQUE KEY `uuid` (`uuid`),
KEY `name` (`name`),
KEY `user_id` (`user_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8");
}
if (!sql_table_exists('cache_list_items'))
{
sql("
CREATE TABLE `cache_list_items` (
`cache_list_id` int(10) NOT NULL,
`cache_id` int(10) NOT NULL,
UNIQUE KEY `cache_list_id` (`cache_list_id`,`cache_id`),
KEY `cache_id` (`cache_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8");
}
if (!sql_table_exists('cache_list_watches'))
{
sql("
CREATE TABLE `cache_list_watches` (
`cache_list_id` int(10) NOT NULL,
`user_id` int(10) NOT NULL,
UNIQUE KEY `cache_list_id` (`cache_list_id`,`user_id`),
KEY `user_id` (`user_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8");
}
if (!sql_field_exists('caches','show_cachelists'))
{
sql("ALTER TABLE `caches` ADD COLUMN `show_cachelists` tinyint(1) NOT NULL default '1'");
}
if (sql_field_exists('cache_watches','last_executed')) // obsolete pre-OC3 field
{
sql("ALTER TABLE `cache_watches` DROP COLUMN `last_executed`");
}
update_triggers(); // runs maintain-123.inc.php
}
function dbv_124() // update cache lists implementation
{
if (!sql_table_exists('stat_cache_lists'))
{
sql("
CREATE TABLE `stat_cache_lists` (
`cache_list_id` int(10) NOT NULL,
`entries` int(6) NOT NULL default '0' COMMENT 'via trigger in cache_list_items',
`watchers` int(6) NOT NULL default '0' COMMENT 'via trigger in cache_list_watches',
PRIMARY KEY (`cache_list_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8
SELECT `id` `cache_list_id`, `entries`, `watchers` FROM `cache_lists`");
}
if (sql_field_exists('cache_lists','entries'))
sql("ALTER TABLE `cache_lists` DROP COLUMN `entries`");
if (sql_field_exists('cache_lists','watchers'))
sql("ALTER TABLE `cache_lists` DROP COLUMN `watchers`");
if (!sql_field_exists('cache_lists','description'))
sql("ALTER TABLE `cache_lists` ADD COLUMN `description` mediumtext NOT NULL");
if (!sql_field_exists('cache_lists','desc_htmledit'))
sql("ALTER TABLE `cache_lists` ADD COLUMN `desc_htmledit` tinyint(1) unsigned NOT NULL default '1'");
update_triggers(); // runs maintain-124.inc.php
}
function dbv_125() // update cache lists implementation; preparation of XML interface export
{
global $opt;
if (!sql_field_exists('cache_lists','node'))
{
sql("ALTER TABLE `cache_lists` ADD COLUMN `node` tinyint(3) unsigned NOT NULL default '0' AFTER `uuid`");
sql("UPDATE `cache_lists` SET `node`='&1'", $opt['logic']['node']['id']);
}
if (!sql_field_exists('cache_lists','last_state_change'))
sql("ALTER TABLE `cache_lists` ADD COLUMN `last_state_change` datetime default NULL AFTER `last_added`");
update_triggers(); // runs maintain-125.inc.php
}
// When adding new mutations, take care that they behave well if run multiple
// times. This improves robustness of database versioning.
@@ -184,7 +184,7 @@ Icons
License : Creative Commons BY-SA 3.0
Author : Oxygen

4. 16x16 Icons 'flag-checker', 'footprints', 'clock select', lock
4. 16x16 Icons 'flag-checker', 'footprints', 'clock select', lock, list
Path : htdocs/resource2/ocstyle/images/misc/
htdocs/resource2/ocstyle/images/map/caches2/
htdocs/resource2/ocstyle/images/cachestatus/
@@ -0,0 +1,66 @@
<?php
/***************************************************************************
* For license information see doc/license.txt
*
* Unicode Reminder メモ
***************************************************************************/
require('./lib2/web.inc.php');
require_once('./lib2/logic/cachelist.class.php');
$tpl->name = 'addtolist';
$tpl->menuitem = MNU_CACHES_ADDTOLIST;
$login->verify();
if ($login->userid == 0)
$tpl->redirect_login();
$cacheid = isset($_REQUEST['cacheid']) ? $_REQUEST['cacheid'] + 0 : 0;
if (!$cacheid)
$tpl->redirect('index.php');
$tpl->assign('cacheid', $cacheid);
if (isset($_REQUEST['cancel']))
$tpl->redirect('viewcache.php?cacheid=' . $cacheid);
$newlist_name = isset($_REQUEST['newlist_name']) ? trim($_REQUEST['newlist_name']) : false;
$newlist_public = isset($_REQUEST['newlist_public']);
$newlist_watch = isset($_REQUEST['newlist_watch']);
if (isset($_REQUEST['save']) && isset($_REQUEST['listid']))
{
$listid = $_REQUEST['listid'] + 0;
if ($listid == 0)
{
$cachelist = new cachelist(ID_NEW, $login->userid);
if (!$cachelist->setName($newlist_name))
$tpl->assign('name_error', true);
else
{
$cachelist->setPublic($newlist_public);
if ($cachelist->save())
{
$cachelist->addCacheByID($cacheid);
if ($newlist_watch)
$cachelist->watch(true);
}
$tpl->redirect('viewcache.php?cacheid=' . $cacheid);
}
}
else
{
$cachelist = new cachelist($listid);
if ($cachelist->exist())
$cachelist->addCacheByID($cacheid);
$tpl->redirect('viewcache.php?cacheid=' . $cacheid);
}
}
$tpl->assign('cachename', sql_value("SELECT `name` FROM `caches` WHERE `cache_id`='&1'", '', $cacheid));
$tpl->assign('cachelists', cachelist::getMyLists());
$tpl->assign('default_list', cachelist::getMyLastAddedToListId());
$tpl->assign('newlist_name', $newlist_name);
$tpl->assign('newlist_public', $newlist_public);
$tpl->assign('newlist_watch', $newlist_watch);
$tpl->display();
?>
@@ -0,0 +1,29 @@
<?php
/***************************************************************************
* For license information see doc/license.txt
*
* Unicode Reminder メモ
*
* Shortcut for cachelist search
***************************************************************************/
require('./lib2/web.inc.php');
$id = isset($_REQUEST['id']) ? $_REQUEST['id'] + 0 : 0;
$watch = isset($_REQUEST['watch']);
$dontwatch = isset($_REQUEST['dontwatch']);
if ($id)
{
if ($watch || $dontwatch)
{
$list = new cachelist($id);
if ($list->exist())
$list->watch($watch);
}
$tpl->redirect("search.php?searchto=searchbylist&listid=" . $id . "&showresult=1&f_disabled=0&f_inactive=0&f_ignored=1&sort=byname");
}
else
$tpl->redirect("cachelists.php");
?>
@@ -0,0 +1,51 @@
<?php
/***************************************************************************
* For license information see doc/license.txt
*
* Unicode Reminder メモ
***************************************************************************/
require('./lib2/web.inc.php');
require_once('./lib2/logic/cachelist.class.php');
require_once('./lib2/pager.class.php');
$login->verify();
$tpl->name = 'cachelists';
$tpl->menuitem = MNU_CACHES_LISTS;
if (isset($_REQUEST['watchlist']))
{
$list = new cachelist($_REQUEST['watchlist'] + 0);
if ($list->exist())
$list->watch(true);
}
else if (isset($_REQUEST['dontwatchlist']))
{
$list = new cachelist($_REQUEST['dontwatchlist'] + 0);
if ($list->exist())
$list->watch(false);
}
$MAXITEMS = 30;
$startat = isset($_REQUEST['startat']) ? $_REQUEST['startat']+0 : 0;
$name_filter = isset($_REQUEST['name']) ? $_REQUEST['name'] : '';
$by_filter = isset($_REQUEST['by']) ? $_REQUEST['by'] : '';
$listcount = cachelist::getPublicListCount($name_filter, $by_filter);
$tpl->assign('name_filter', $name_filter);
$tpl->assign('by_filter', $by_filter);
$tpl->assign('cachelists', cachelist::getPublicLists($startat, $MAXITEMS, $name_filter, $by_filter));
$tpl->assign('show_status', false);
$tpl->assign('show_user', true);
// Do not show watchers because this would allow conclusions on what the list owner watches.
$tpl->assign('show_watchers', false);
$tpl->assign('show_edit', false);
$tpl->assign('togglewatch', 'cachelists.php');
$pager = new pager("cachelists.php?startat={offset}");
$pager->make_from_offset($startat, $listcount, $MAXITEMS);
$tpl->display();
?>
@@ -28,6 +28,7 @@
$procedures[] = 'sp_updateall_cache_listingdates';
$procedures[] = 'sp_updateall_cachelog_logdates';
$procedures[] = 'sp_updateall_rating_dates';
$procedures[] = 'sp_updateall_cachelist_counts';
$tpl->assign('procedures', $procedures);
@@ -61,6 +62,8 @@
sql("CALL sp_updateall_cachelog_logdates(@c)");
else if ($proc == 'sp_updateall_rating_dates')
sql("CALL sp_updateall_rating_dates(@c)");
else if ($proc == 'sp_updateall_cachelist_counts')
sql("CALL sp_updateall_cachelist_counts(@c)");
else
{
$bError = true;
Oops, something went wrong.

0 comments on commit 5afc1f8

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