コード例 #1
0
        }
        if (isset($_GET['h_avail'])) {
            $columns[] = 'active = ' . ($_GET['h_avail'] == 'true' ? 1 : 0);
        }
        if (isset($_GET['h_temp_unavail'])) {
            $columns[] = 'notactive = ' . ($_GET['h_temp_unavail'] == 'true' ? 1 : 0);
        }
        if (isset($_GET['h_arch'])) {
            $columns[] = 'archived = ' . ($_GET['h_arch'] == 'true' ? 0 : 1);
        }
        if (isset($_GET['be_ftf'])) {
            $columns[] = 'be_ftf = ' . ($_GET['be_ftf'] == 'true' ? 1 : 0);
        }
        global $powerTrailModuleSwitchOn;
        if (isset($_GET['powertrail_only']) && $powerTrailModuleSwitchOn === true) {
            //powertrail_only param update only if powertrails are enabled
            $columns[] = 'powertrail_only = ' . ($_GET['powertrail_only'] == 'true' ? 1 : 0);
        }
        if (isset($_GET['min_score']) && is_numeric($_GET['min_score'])) {
            $columns[] = 'min_score = ' . intval($_GET['min_score']);
        }
        if (isset($_GET['max_score']) && is_numeric($_GET['max_score'])) {
            $columns[] = 'max_score = ' . intval($_GET['max_score']);
        }
        if (isset($_GET['h_noscore'])) {
            $columns[] = 'noscore = ' . ($_GET['h_noscore'] == 'true' ? 1 : 0);
        }
        $q = 'REPLACE map_settings SET ' . implode(',', $columns);
        XDb::xQuery($q);
    }
}
コード例 #2
0
             } else {
                 $thisline = mb_ereg_replace('{GPicon}', '<img src="images/rating-star-empty.png" class="icon16" alt="" title="" />', $thisline);
             }
             $thisline = mb_ereg_replace('{userid}', urlencode($record['user_id']), $thisline);
             $thisline = mb_ereg_replace('{username}', htmlspecialchars($record['username'], ENT_COMPAT, 'UTF-8'), $thisline);
             $thisline = mb_ereg_replace('{rating_absolute}', $record['anzahl'], $thisline);
             $cacheicon = myninc::checkCacheStatusByUser($record, $usr['userid']);
             $thisline = mb_ereg_replace('{cacheicon}', $cacheicon, $thisline);
             $file_content .= $thisline . "\n";
         }
         tpl_set_var('num_ratings', $rows);
     }
 }
 tpl_set_var('content', $file_content);
 $rs = XDb::xQuery('SELECT COUNT(*) `count`
         FROM `caches`
         WHERE caches.`status`=1  AND caches.type <> 6
         AND caches.`topratings`!=0');
 $r = XDb::xFetchArray($rs);
 $count = $r['count'];
 XDb::xFreeResults($rs);
 $frompage = $startat / 100 - 3;
 if ($frompage < 1) {
     $frompage = 1;
 }
 $topage = $frompage + 8;
 if (($topage - 1) * $perpage > $count) {
     $topage = ceil($count / $perpage);
 }
 $thissite = $startat / 100 + 1;
 $pages = '';
 if ($startat > 0) {
コード例 #3
0
ファイル: addignore.php プロジェクト: kojoty/opencaching-pl
<?php

use Utils\Database\XDb;
//prepare the templates and include all neccessary
require_once './lib/common.inc.php';
//Preprocessing
if ($error == false) {
    $cache_id = isset($_REQUEST['cacheid']) ? $_REQUEST['cacheid'] : '';
    $target = isset($_REQUEST['target']) ? $_REQUEST['target'] : 'myignores.php';
    if ($usr !== false) {
        //add to caches
        $rs = XDb::xQuery('SELECT ignorer_count FROM caches WHERE cache_id=\'' . XDb::xEscape($cache_id) . '\'');
        if ($record = Xdb::xFetchArray($rs)) {
            XDb::xSql('UPDATE caches SET ignorer_count=\'' . ($record['ignorer_count'] + 1) . '\'
                       WHERE cache_id=\'' . XDb::xEscape($cache_id) . '\'');
            //add watch
            XDb::xSql('INSERT INTO `cache_ignore` (`cache_id`, `user_id`)
                       VALUES (\'' . XDb::xEscape($cache_id) . '\', \'' . XDb::xEscape($usr['userid']) . '\')');
            //add to user
            $rs = XDb::xSql('SELECT cache_ignores FROM user WHERE user_id=\'' . XDb::xEscape($usr['userid']) . '\'');
            $record = XDb::xFetchArray($rs);
            XDb::xSql('UPDATE user SET cache_ignores=\'' . ($record['cache_ignores'] + 1) . '\' WHERE user_id=\'' . XDb::xEscape($usr['userid']) . '\'');
            tpl_redirect($target);
        }
    }
}
tpl_BuildTemplate();
コード例 #4
0
     $tplname = 'admin_bulletin_preview';
     tpl_BuildTemplate();
 } else {
     if (isset($_POST['bulletin_final']) && $_POST['bulletin_final'] != "" && $_SESSION['submitted'] != true) {
         // wysłanie
         $email_headers = "Content-Type: text/plain; charset=utf-8\r\n";
         $email_headers .= "From: " . $site_name . " <" . $mail_rr . ">\r\n";
         $email_headers .= "Reply-To: " . $mail_rr . "\r\n";
         $bulletin = $_SESSION['bulletin'];
         $q = "INSERT INTO bulletins (content, user_id)\n                VALUES ('" . XDb::xEscape($bulletin) . "', " . XDb::xEscape(intval($usr['userid'])) . ")";
         XDb::xQuery($q);
         $tr_newsletter_removal = tr('newsletter_removal');
         $bulletin .= "\r\n\r\n" . $tr_newsletter_removal . " " . $absolute_server_URI . "myprofile.php?action=change.";
         //get emails
         $q = "SELECT `email` FROM `user` WHERE `is_active_flag`=1 AND get_bulletin=1 AND rules_confirmed=1";
         $rs = XDb::xQuery($q);
         $tr_newsletter = $short_sitename . " " . tr('newsletter');
         while ($email = XDb::xFetchArray($rs)) {
             mb_send_mail($email['email'], $tr_newsletter . " " . date("Y-m-d"), stripslashes($bulletin), $email_headers);
         }
         $_SESSION['submitted'] = true;
         tpl_set_var('bulletin', stripslashes($_SESSION['bulletin']));
         unset($_SESSION['bulletin']);
         $tplname = 'admin_bulletin_sent';
         tpl_BuildTemplate();
     } else {
         // formularz
         $_SESSION['submitted'] = false;
         $tplname = 'admin_bulletin';
         tpl_BuildTemplate();
     }