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


PHP XDb::instance方法代码示例

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


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

示例1: urlencode

<?php

use Utils\Database\XDb;
use lib\Objects\User\User;
use Utils\Email\Email;
//prepare the templates and include all neccessary
if (!isset($rootpath)) {
    $rootpath = '';
}
require_once './lib/common.inc.php';
//Preprocessing
if ($error == false) {
    $db = XDb::instance();
    $description = "";
    //user logged in?
    if ($usr == false) {
        $target = urlencode(tpl_get_current_page());
        tpl_redirect('login.php?target=' . $target);
    } else {
        tpl_set_var('desc_updated', '');
        tpl_set_var('displayGeoPathSection', displayGeoPatchSection('table'));
        if (isset($_POST['description'])) {
            $q = "UPDATE user SET description = :1 WHERE user_id=:2";
            $db->multiVariableQuery($q, strip_tags($_POST['description']), (int) $usr['userid']);
            tpl_set_var('desc_updated', "<font color='green'>" . tr('desc_updated') . "</font>");
        }
        if (isset($_POST['submit']) && isset($_POST['bulletin'])) {
            $q = "UPDATE user SET get_bulletin = :1 WHERE user_id = :2 ";
            $db->multiVariableQuery($q, $_POST['bulletin'], $usr['userid']);
        }
        $q = "SELECT description, get_bulletin FROM user WHERE user_id = :1 LIMIT 1";
开发者ID:kojoty,项目名称:opencaching-pl,代码行数:31,代码来源:myprofile.php

示例2: DisplayAllOpensprawdzaczCaches

 public function DisplayAllOpensprawdzaczCaches($OpensprawdzaczSetup, $opt)
 {
     /**
      * Displays initial form for cache waypoint (OPXXXX) input
      *
      * and
      *
      * display list of caches in Opensprawdzacz.
      */
     /**
      *  if isset $_GET['op_keszynki'] means that user entered cache OP, and want search for this
      *  cache through Opensprawdzacz.
      *  This part get cache waypoint from url, check if cache owner allow specified cahe for check by
      *  OpenSprawdzacz
      *
      */
     if (isset($_GET['op_keszynki'])) {
         $this->cache_wp = XDb::xEscape($_GET['op_keszynki']);
         $this->cache_wp = strtoupper($this->cache_wp);
     } else {
         $formularz = '
                 <form action="' . $OpensprawdzaczSetup->scriptname . '" method="get">
                 ' . tr('os_podaj_waypoint') . ':
                         <input type="text" name="op_keszynki" maxlength="6"/>
                         <button type="submit" name="przeslanie_waypointa" value="' . tr('submit') . '" style="font-size:14px;width:160px"><b>' . tr('submit') . '</b></button>
                 </form>
                                 ';
         if (isset($_GET['sort'])) {
             $sort_tmp = XDb::xEscape($_GET['sort']);
             switch ($sort_tmp) {
                 case 'autor':
                     $sortowanie = '`user`.`username`';
                     break;
                 case 'nazwa':
                     $sortowanie = '`caches`.`name`';
                     break;
                 case 'wpt':
                     $sortowanie = '`caches`.`wp_oc`';
                     break;
                 case 'szczaly':
                     $sortowanie = '`opensprawdzacz`.`proby`';
                     break;
                 case 'sukcesy':
                     $sortowanie = '`opensprawdzacz`.`sukcesy`';
                     break;
                 default:
                     $sortowanie = '`caches`.`name`';
                     break;
             }
         } else {
             $sortowanie = '`caches`.`name`';
         }
         $zapytajka = "\n\n        SELECT `waypoints`.`cache_id`,\n        `waypoints`.`type`,\n        `waypoints`.`stage`,\n        `waypoints`.`desc`,\n        `caches`.`name`,\n        `caches`.`wp_oc`,\n        `caches`.`user_id`,\n        `caches`.`type`,\n        `caches`.`status`,\n        `user`.`username`,\n        `cache_type`.`sort`,\n        `cache_type`.`icon_small`,\n        `opensprawdzacz`.`proby`,\n        `opensprawdzacz`.`sukcesy`\n        FROM   `waypoints`\n        LEFT JOIN   `opensprawdzacz`\n        ON   `waypoints`.`cache_id` = `opensprawdzacz`.`cache_id`,\n        `caches`, `user`, `cache_type`\n        WHERE   `waypoints`.`opensprawdzacz` = 1\n        AND   `waypoints`.`type` = 3\n        AND   `caches`.`type` = `cache_type`.`id`\n        AND   `caches`.`user_id` = `user`.`user_id`\n        AND   `waypoints`.`cache_id` = `caches`.`cache_id`\n        ORDER BY   {$sortowanie}\n        LIMIT   0, 1000\n\n        ";
         $status = array('1' => '<img src="tpl/stdstyle/images/log/16x16-found.png" border="0" alt="Gotowa do szukania">', '2' => '<img src="tpl/stdstyle/images/log/16x16-temporary.png" border="0" alt="Tymczasowo niedost�pna">', '3' => '<img src="tpl/stdstyle/images/log/16x16-dnf.png" border="0" alt="zarchiwizowana">', '4' => '<img src="tpl/stdstyle/images/log/16x16-temporary.png" border="0" alt="Ukryta do czasu weryfikacji">', '5' => '<img src="tpl/stdstyle/images/log/16x16-temporary.png" border="0" alt="jeszcze niedost�pna">', '6' => '<img src="tpl/stdstyle/images/log/16x16-dnf.png" border="0" alt="Zablokowana przez COG">');
         $conn = XDb::instance();
         $conn->query('SET CHARSET utf8');
         $keszynki_opensprawdzacza = $conn->query($zapytajka)->fetchAll();
         $ile_keszynek = count($keszynki_opensprawdzacza);
         $pag = new Pagination();
         // $dane = array("hej","dupa","laska", "scierwo");
         $numbers = $pag->Paginate($keszynki_opensprawdzacza, $OpensprawdzaczSetup->caches_on_page);
         $result = $pag->fetchResult();
         /*
          foreach ($result as $r)
          {
          echo "<div>aa$r</div>";
          }
         */
         $paginacja = ' ';
         if (isset($_GET["sort"])) {
             $sort = '&sort=' . $_GET["sort"];
         } else {
             $sort = '';
         }
         if (isset($_GET["page"])) {
             $tPage = XDb::xEscape($_GET["page"]);
         } else {
             $tPage = 1;
         }
         if ($tPage > 1) {
             $paginacja .= '<a href="' . $OpensprawdzaczSetup->scriptname . '?page=' . ($num - 1) . $sort . '">[<' . tr('os_f02') . ']</a> ';
         }
         foreach ($numbers as $num) {
             if ($num == $tPage) {
                 $paginacja .= '<b>[' . $num . ']</b>';
             } else {
                 $paginacja .= '<a href="' . $OpensprawdzaczSetup->scriptname . '?page=' . $num . $sort . '">[' . $num . ']</a> ';
             }
         }
         if ($tPage < count($numbers)) {
             $paginacja .= '<a href="' . $OpensprawdzaczSetup->scriptname . '?page=' . ($tPage + 1) . $sort . '">[' . tr('os_f01') . ' &#62;]</a> ';
         }
         $tabelka_keszynek = '';
         $proby = 0;
         $trafienia = 0;
         foreach ($result as $dane_keszynek) {
             $proby = $proby + $dane_keszynek['proby'];
             $trafienia = $trafienia + $dane_keszynek['sukcesy'];
             if ($dane_keszynek['status'] == 1 || $dane_keszynek['status'] == 2) {
                 $tabelka_keszynek .= '
//.........这里部分代码省略.........
开发者ID:kojoty,项目名称:opencaching-pl,代码行数:101,代码来源:opensprawdzacz_classes.php


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