示例#1
0
 require_once $stylepath . '/newcache.inc.php';
 $rs = sql("SELECT `hide_flag` as hide_flag, `verify_all` as verify_all FROM `user` WHERE `user_id` =  " . $user->getUserId());
 $record = sql_fetch_array($rs);
 $hide_flag = $record['hide_flag'];
 $verify_all = $record['verify_all'];
 if ($hide_flag == 10) {
     // user is banned for creating new caches for some reason
     $tplname = 'newcache_forbidden';
     require_once $rootpath . '/lib/caches.inc.php';
 }
 // display info for begginner about number of find caches to possible register first cache
 $rsnfc = sql("SELECT COUNT(`cache_logs`.`cache_id`) as num_fcaches FROM cache_logs,caches WHERE cache_logs.cache_id=caches.cache_id AND (caches.type='1' OR caches.type='2' OR caches.type='3' OR caches.type='7' OR caches.type='8') AND cache_logs.type='1' AND cache_logs.deleted='0' AND `cache_logs`.`user_id` = " . sql_escape($usr['userid']) . "");
 $rec = sql_fetch_array($rsnfc);
 $num_find_caches = $rec['num_fcaches'];
 tpl_set_var('number_finds_caches', $num_find_caches);
 if ($num_find_caches < $NEED_FIND_LIMIT && !$user->isIngnoreGeocacheLimitWhileCreatingNewGeocache()) {
     $tplname = 'newcache_beginner';
     require_once $rootpath . '/lib/caches.inc.php';
 }
 $errors = false;
 // set if there was any errors
 $rsnc = sql("SELECT COUNT(`caches`.`cache_id`) as num_caches FROM `caches` WHERE `user_id` = " . sql_escape($usr['userid']) . "\n                                    AND status = 1");
 $record = sql_fetch_array($rsnc);
 $num_caches = $record['num_caches'];
 $cacheLimitByTypePerUser = common::getUserActiveCacheCountByType($db, $usr['userid']);
 if ($num_caches < $NEED_APPROVE_LIMIT) {
     // user needs approvement for first 3 caches to be published
     $needs_approvement = true;
     tpl_set_var('hide_publish_start', '<!--');
     tpl_set_var('hide_publish_end', '-->');
     tpl_set_var('approvement_note', '<div class="notice"><font color="red"><b>' . tr('first_cache_approvement') . '</b></font></div>');
 tpl_set_var('country', htmlspecialchars($record['country'], ENT_COMPAT, 'UTF-8'));
 tpl_set_var('registered', strftime("%d-%m-%Y", strtotime($record['date_created'])));
 tpl_set_var('email', strip_tags($record['email']));
 tpl_set_var('description', nl2br($record['description']));
 if ($record['is_active_flag']) {
     tpl_set_var('is_active_flags', '&nbsp;<a href="admin_users.php?userid=' . $user_id . '&amp;is_active_flag=1"><font color="#ff0000">' . tr('lock') . ' ' . tr('user_account') . '</font></a>&nbsp;<img src="' . $stylepath . '/images/blue/atten-red.png" align="top" alt="" />');
 } else {
     tpl_set_var('is_active_flags', '&nbsp;<a href="admin_users.php?userid=' . $user_id . '&amp;is_active_flag=1"><font color="#228b22">' . tr('unlock') . ' ' . tr('user_account') . '</font></a>&nbsp;<img src="' . $stylepath . '/images/blue/atten-green.png" align="bottom" alt="" />');
 }
 if (!$record['stat_ban']) {
     tpl_set_var('stat_ban', '&nbsp;<a href="admin_users.php?userid=' . $user_id . '&amp;stat_ban=1"><font color="#ff0000">' . tr('lock') . ' ' . tr('user_stats') . '</font></a>&nbsp;<img src="' . $stylepath . '/images/blue/atten-red.png" align="top" alt="" />');
 } else {
     tpl_set_var('stat_ban', '&nbsp;<a href="admin_users.php?userid=' . $user_id . '&amp;stat_ban=1"><font color="#228b22">' . tr('unlock') . ' ' . tr('user_stats') . '</font></a>&nbsp;<img src="' . $stylepath . '/images/blue/atten-green.png" align="top" alt="" />');
 }
 if ($user->getFoundGeocachesCount() < 10) {
     $ignoreFoundLimit = $user->isIngnoreGeocacheLimitWhileCreatingNewGeocache();
     if ($ignoreFoundLimit) {
         $translation = tr('ignoreFoundLimitRm');
     } else {
         $translation = tr('ignoreFoundLimitAdd');
     }
     $ignoreFoundLimitHtml = '<a href="admin_users.php?userid=' . $user_id . '&amp;ignoreFoundLimit=' . (int) (!$ignoreFoundLimit) . '"><font color="#ff0000">' . $translation . '</font></a><img src="' . $stylepath . '/images/blue/atten-red.png" align="top" alt="" />';
     tpl_set_var('ignoreFoundLimit', $ignoreFoundLimitHtml);
 } else {
     tpl_set_var('ignoreFoundLimit', 'n/d');
 }
 // force all caches to be verified - form
 $verify_all = $record['verify_all'];
 if ($verify_all == 0) {
     tpl_set_var('hide_flag', '<p><img src="tpl/stdstyle/images/blue/arrow2.png" alt="" align="middle" />&nbsp;&nbsp;<a href="admin_users.php?userid=' . $user_id . '&amp;verify_all=1"><font color="#ff0000">' . tr('admin_users_verify_all') . '</font></a>&nbsp;<img src="' . $stylepath . '/images/blue/atten-red.png" align="top" alt="" /></p>');
 } else {