当前位置: 首页>>代码示例>>PHP>>正文


PHP XDb::xQuery方法代码示例

本文整理汇总了PHP中Utils\Database\XDb::xQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP XDb::xQuery方法的具体用法?PHP XDb::xQuery怎么用?PHP XDb::xQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Utils\Database\XDb的用法示例。


在下文中一共展示了XDb::xQuery方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: intval

        }
        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);
    }
}
开发者ID:kojoty,项目名称:opencaching-pl,代码行数:31,代码来源:cachemapsettings.php

示例2: urlencode

             } 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) {
开发者ID:kojoty,项目名称:opencaching-pl,代码行数:32,代码来源:cacheratings.php

示例3: isset

<?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();
开发者ID:kojoty,项目名称:opencaching-pl,代码行数:27,代码来源:addignore.php

示例4: bulletins

     $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();
     }
开发者ID:kojoty,项目名称:opencaching-pl,代码行数:31,代码来源:admin_bulletin.php


注:本文中的Utils\Database\XDb::xQuery方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。