Files
oc-server3/htdocs/myhome.php
following 67f3ae3ce2 consolidated page browsing code; updates #262
and
- fixed page browser display on search results page for last four pages
- set max. page count on all other pages to 15 (from 9 or none)
2013-07-14 16:41:09 +02:00

85 lines
4.3 KiB
PHP

<?php
/***************************************************************************
* For license information see doc/license.txt
*
* Unicode Reminder メモ
***************************************************************************/
require_once('./lib2/web.inc.php');
require('./lib2/logic/logpics.inc.php');
$tpl->name = 'myhome';
$tpl->menuitem = MNU_MYPROFILE_OVERVIEW;
$login->verify();
if ($login->userid == 0)
{
$tpl->redirect('login.php?target=myhome.php');
}
//get user record
$rsUser = sql("SELECT IFNULL(`stat_user`.`found`, 0) AS `found`, IFNULL(`stat_user`.`hidden`, 0) AS `hidden` FROM `user` LEFT JOIN `stat_user` ON `user`.`user_id`=`stat_user`.`user_id` WHERE `user`.`user_id`='&1' LIMIT 1", $login->userid);
$rUser = sql_fetch_array($rsUser);
sql_free_result($rsUser);
$tpl->assign('found', $rUser['found']);
// locked/hidden caches are visible for the user and must be added to public stats
$rUser['hidden'] += sql_value("SELECT COUNT(*) FROM `caches` WHERE `user_id`='&1' AND `status`=7", 0, $login->userid);
$tpl->assign('hidden', $rUser['hidden']);
//get last logs
$tpl->assign_rs('logs', sql("SELECT `cache_logs`.`cache_id` `cacheid`, `cache_logs`.`type` `type`, `cache_logs`.`date` `date`, `caches`.`name` `name`,
`user`.`user_id` AS `userid`, `user`.`username`, `caches`.`wp_oc`
FROM `cache_logs`, `caches`, `user`
WHERE `cache_logs`.`user_id`='&1'
AND `cache_logs`.`cache_id`=`caches`.`cache_id`
AND `caches`.`user_id`=`user`.`user_id`
ORDER BY `cache_logs`.`date` DESC, `cache_logs`.`date_created` DESC LIMIT 10", $login->userid));
//get last hidden caches
$tpl->assign_rs('caches', sql("SELECT `caches`.`cache_id`, `caches`.`name`, `caches`.`type`,
`caches`.`date_hidden`, `caches`.`status`, `caches`.`wp_oc`,
`found`,
/* COUNT(*) as `logcount`, */
MAX(`cache_logs`.`date`) AS `lastlog`,
(SELECT `type` FROM `cache_logs` `cl2`
WHERE `cl2`.`cache_id`=`caches`.`cache_id`
ORDER BY `date` DESC,`id` DESC LIMIT 1) AS `lastlog_type`
FROM `caches`
LEFT JOIN `stat_caches` ON `stat_caches`.`cache_id`=`caches`.`cache_id`
LEFT JOIN `cache_logs` ON `cache_logs`.`cache_id`=`caches`.`cache_id`
WHERE `caches`.`user_id`='&1'
AND `caches`.`status` != 5
GROUP BY `caches`.`cache_id`
ORDER BY `caches`.`date_hidden` DESC, `caches`.`date_created` DESC",
$login->userid));
if ($useragent_msie && $useragent_msie_version < 9)
$tpl->assign('dotfill','');
else
$tpl->assign('dotfill','...........................................................................................................');
$tpl->add_body_load('myHomeLoad()');
//get not published caches
$tpl->assign_rs('notpublished', sql("SELECT `caches`.`cache_id`, `caches`.`name`, `caches`.`date_hidden`, `caches`.`date_activate`, `caches`.`status`, `caches`.`wp_oc`, `caches`.`type`
FROM `caches`
WHERE `user_id`='&1'
AND `caches`.`status` = 5
ORDER BY `date_activate` DESC, `caches`.`date_created` DESC", $login->userid));
// get number of sent emails
// useless information when email protocol is cleaned-up (cronjob 'purge_logs')
// $tpl->assign('emails', sql_value("SELECT COUNT(*) FROM `email_user` WHERE `from_user_id`='&1'", 0, $login->userid));
// get log pictures
$allpics = isset($_REQUEST['allpics']) && $_REQUEST['allpics'];
$all_pictures = get_logpics(LOGPICS_FOR_MYHOME_GALLERY);
if ($allpics)
set_paged_pics(LOGPICS_FOR_MYHOME_GALLERY, 0, 0, "myhome.php?allpics=1");
else
$tpl->assign('pictures',$all_pictures);
$tpl->assign('allpics', $allpics ? 1 : 0);
$tpl->assign('total_pictures', count($all_pictures));
// display
$tpl->display();
?>