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


PHP Db::queryField方法代码示例

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


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

示例1: get

 /**
  * @param $userID
  * @param $serverID
  * @return int|string
  */
 public function get($userID, $serverID)
 {
     foreach ($this->config->get("admins", "permissions") as $adminID) {
         if ($adminID == $userID) {
             return 2;
         }
     }
     return $this->db->queryField("SELECT permission FROM permissions WHERE userID = :userID AND serverID = :serverID", "permission", [":userID" => $userID, ":serverID" => $serverID]);
 }
开发者ID:sovereignbot,项目名称:citadel,代码行数:14,代码来源:Permissions.php

示例2: doPopulatePrice

 protected static function doPopulatePrice($typeID, $date)
 {
     global $redis;
     $todaysLookup = 'CREST-Market:' . date('Ymd');
     $todaysLookupTypeID = $todaysLookup . ":{$typeID}";
     $isDone = $redis->get($todaysLookupTypeID) == 'true';
     if ($typeID != 2233 && $isDone) {
         return;
     }
     static::doPopulateRareItemPrices($todaysLookup);
     // Populate rare items and today's lookup and do some cleanup
     if ($typeID == 2233) {
         $gantry = self::getItemPrice(3962, $date, true);
         $nodes = self::getItemPrice(2867, $date, true);
         $modules = self::getItemPrice(2871, $date, true);
         $mainframes = self::getItemPrice(2876, $date, true);
         $cores = self::getItemPrice(2872, $date, true);
         $total = $gantry + ($nodes + $modules + $mainframes + $cores) * 8;
         Db::execute('replace into zz_item_price_lookup (typeID, priceDate, lowPrice, avgPrice, highPrice) values (:typeID, :date, :low, :avg, :high)', array(':typeID' => $typeID, ':date' => $date, ':low' => $total, ':avg' => $total, ':high' => $total));
         $redis->setex($todaysLookupTypeID, 86400, 'true');
         return $total;
     }
     $url = "https://public-crest.eveonline.com/market/10000002/types/{$typeID}/history/";
     $raw = Util::getData($url, 0);
     $json = json_decode($raw, true);
     if (isset($json['items'])) {
         foreach ($json['items'] as $row) {
             $hasRow = Db::queryField('select count(1) count from zz_item_price_lookup where typeID = :typeID and priceDate = :date', 'count', array(':typeID' => $typeID, ':date' => $row['date']));
             if ($hasRow == 0) {
                 Db::execute('insert ignore into zz_item_price_lookup (typeID, priceDate, lowPrice, avgPrice, highPrice) values (:typeID, :date, :low, :avg, :high)', array(':typeID' => $typeID, ':date' => $row['date'], ':low' => $row['lowPrice'], ':avg' => $row['avgPrice'], ':high' => $row['highPrice']));
             }
         }
     }
     $redis->setex($todaysLookupTypeID, 86400, 'true');
 }
开发者ID:esnoeijs,项目名称:zKillboard,代码行数:35,代码来源:Price.php

示例3: irc_log

function irc_log($nick, $uhost, $command, $params)
{
    $id = Db::queryField("SELECT id FROM zz_irc_access WHERE name = :nick AND host = :uhost", "id", array(":nick" => $nick, ":uhost" => $uhost));
    if ($id == null) {
        $id = 0;
    }
    Db::execute("INSERT INTO zz_irc_log (id, nick, command, parameters) VALUES (:id, :nick, :command, :params)", array(":nick" => $nick, ":id" => $id, ":command" => $command, ":params" => implode(" ", $params)));
}
开发者ID:Covert-Inferno,项目名称:zKillboard,代码行数:8,代码来源:zkbBot.php

示例4: getItemBasePrice

 /**
  * @static
  * @param	$typeID int
  * @return null
  */
 protected static function getItemBasePrice($typeID)
 {
     // Market failed, faction pricing failed, do we have a basePrice in the database?
     $price = Db::queryField("select basePrice from ccp_invTypes where typeID = :typeID", "basePrice", array(":typeID" => $typeID));
     self::storeItemPrice($typeID, $price);
     if ($price != null) {
         return $price;
     }
 }
开发者ID:Covert-Inferno,项目名称:zKillboard,代码行数:14,代码来源:Price.php

示例5: beSocial

 public static function beSocial($killID)
 {
     if ($killID < 0) {
         return;
     }
     $ircMin = 5000000000;
     $twitMin = 10000000000;
     // This is an array of characters we like to laugh at :)
     $laugh = array(1633218082, 924610627, 619471207, 268946627, 179004085, 428663616);
     $count = Db::queryField("select count(*) count from zz_social where killID = :killID", "count", array(":killID" => $killID), 0);
     if ($count != 0) {
         return;
     }
     // Get victim info
     $victimInfo = Db::queryRow("select * from zz_participants where killID = :killID and isVictim = 1", array(":killID" => $killID));
     if ($victimInfo == null) {
         return;
     }
     $totalPrice = $victimInfo["total_price"];
     if (!in_array($victimInfo["characterID"], $laugh)) {
         // If in laugh array, skip the checks
         // Check the minimums, min. price and happened in last 12 hours
         if ($totalPrice < $ircMin) {
             return;
         }
     }
     Info::addInfo($victimInfo);
     $url = "https://zkillboard.com/detail/{$killID}/";
     if ($totalPrice >= $twitMin) {
         $url = Twit::shortenUrl($url);
     }
     $message = "|g|" . $victimInfo["shipName"] . "|n| worth |r|" . Util::formatIsk($totalPrice) . " ISK|n| was destroyed! {$url}";
     if (!isset($victimInfo["characterName"])) {
         $victimInfo["characterName"] = $victimInfo["corporationName"];
     }
     if (strlen($victimInfo["characterName"]) < 25) {
         $name = $victimInfo["characterName"];
         if (Util::endsWith($name, "s")) {
             $name .= "'";
         } else {
             $name .= "'s";
         }
         $message = "{$name} {$message}";
     }
     Db::execute("insert into zz_social (killID) values (:killID)", array(":killID" => $killID));
     Log::irc("{$message}");
     $message = Log::stripIRCColors($message);
     if ($totalPrice >= $twitMin) {
         $message .= " #tweetfleet #eveonline";
         $return = Twit::sendMessage($message);
         $twit = "https://twitter.com/eve_kill/status/" . $return->id;
         Log::irc("Message was also tweeted: |g|{$twit}");
     }
 }
开发者ID:Covert-Inferno,项目名称:zKillboard,代码行数:54,代码来源:Social.php

示例6: retrieve

 public static function retrieve($locker, $default = null)
 {
     if (!isset($locker) || $locker === null) {
         return $default;
     }
     $contents = Db::queryField("select contents from zz_storage where locker = :locker", "contents", array(":locker" => $locker), 1);
     if ($contents === null) {
         return $default;
     }
     return $contents;
 }
开发者ID:cvweiss,项目名称:zlibrary,代码行数:11,代码来源:Storage.php

示例7: checkPassword

 /**
  * @param string $plainTextPassword
  */
 public static function checkPassword($plainTextPassword, $storedPassword = NULL)
 {
     if ($plainTextPassword && $storedPassword) {
         return self::pwCheck($plainTextPassword, $storedPassword);
     } else {
         $userID = user::getUserID();
         if ($userID) {
             $storedPw = Db::queryField("SELECT password FROM zz_users WHERE id = :userID", "password", array(":userID" => $userID), 0);
             return self::pwCheck($plainTextPassword, $storedPw);
         }
     }
 }
开发者ID:Covert-Inferno,项目名称:zKillboard,代码行数:15,代码来源:Password.php

示例8: getSubdomainParameters

 public static function getSubdomainParameters($serverName)
 {
     global $app, $twig, $baseAddr, $fullAddr, $mdb;
     // Are we looking at an aliased subdomain?
     $alias = Db::queryField('select alias from zz_subdomains where subdomain = :serverName', 'alias', array(':serverName' => $serverName), 60);
     if ($alias) {
         header("Location: http://{$alias}");
         exit;
     }
     if ($serverName != $baseAddr && strlen(str_replace(".{$baseAddr}", '', $serverName)) > 5) {
         $serverName = Db::queryField('select subdomain from zz_subdomains where alias = :serverName', 'subdomain', array(':serverName' => $serverName));
         if (strlen($serverName) == 0) {
             header("Location: http://{$baseAddr}");
             exit;
         }
     }
     $adfree = Db::queryField('select count(*) count from zz_subdomains where adfreeUntil >= now() and subdomain = :serverName', 'count', array(':serverName' => $serverName));
     $board = str_replace(".{$baseAddr}", '', $serverName);
     $board = str_replace('_', ' ', $board);
     $board = preg_replace('/^dot\\./i', '.', $board);
     $board = preg_replace('/\\.dot$/i', '.', $board);
     try {
         if ($board == 'www') {
             $app->redirect($fullAddr, 302);
         }
     } catch (Exception $e) {
         return;
     }
     if ($board == $baseAddr) {
         return [];
     }
     $numDays = 7;
     $faction = null;
     //Db::queryRow("select * from ccp_zfactions where ticker = :board", array(":board" => $board), 3600);
     $alli = $mdb->findDoc('information', ['cacheTime' => 3600, 'type' => 'allianceID', 'ticker' => strtoupper($board)], ['memberCount' => -1]);
     $corp = $mdb->findDoc('information', ['cacheTime' => 3600, 'type' => 'corporationID', 'ticker' => strtoupper($board)], ['memberCount' => -1]);
     $columnName = null;
     $id = null;
     if ($faction) {
         $p = array('factionID' => (int) $faction['factionID']);
         $twig->addGlobal('statslink', '/faction/' . $faction['factionID'] . '/');
     } elseif ($alli) {
         $p = array('allianceID' => (int) $alli['id']);
         $twig->addGlobal('statslink', '/alliance/' . $alli['id'] . '/');
     } elseif ($corp) {
         $p = array('corporationID' => (int) $corp['id']);
         $twig->addGlobal('statslink', '/corporation/' . $corp['id'] . '/');
     } else {
         $p = array();
     }
     return $p;
 }
开发者ID:Nord001,项目名称:zKillboard,代码行数:52,代码来源:Subdomains.php

示例9: execute

 public function execute($nick, $uhost, $channel, $command, $parameters, $nickAccessLevel)
 {
     $keyIDs = array();
     $entity = implode(" ", $parameters);
     if (sizeof($parameters) == 1 && (int) $parameters[0]) {
         $keyIDs[] = (int) $parameters[0];
     } else {
         // Perform a search
         $chars = array();
         $corps = array();
         $charResult = Db::query("select characterID from zz_characters where name = :s", array(":s" => $entity));
         foreach ($charResult as $char) {
             $chars[] = $char["characterID"];
         }
         foreach ($chars as $charID) {
             $corpID = Db::queryField("select corporationID from zz_participants where characterID = :c order by killID desc limit 1", "corporationID", array(":c" => $charID));
             if ($corpID !== null && $corpID > 0) {
                 $corps[] = $corpID;
             }
         }
         if (sizeof($chars)) {
             $keys = Db::query("select distinct keyID from zz_api_characters where isDirector = 'F' and characterID in (" . implode(",", $chars) . ")");
             foreach ($keys as $key) {
                 $keyIDs[] = $key["keyID"];
             }
         } else {
             $corpID = Db::queryField("select corporationID from zz_corporations where name = :s order by memberCount desc", "corporationID", array(":s" => $entity));
             if ($corpID !== null && $corpID > 0) {
                 $corps[] = $corpID;
             }
         }
         if (sizeof($corps)) {
             $keys = Db::query("select distinct keyID from zz_api_characters where isDirector = 'T' and corporationID in (" . implode(",", $corps) . ")");
             foreach ($keys as $key) {
                 $keyIDs[] = $key["keyID"];
             }
         }
     }
     if (sizeof($keyIDs) == 0) {
         irc_out("|r|Unable to locate any keys associated with {$entity} |n|");
     } else {
         $keyIDs = array_unique($keyIDs);
         sort($keyIDs);
         $key = sizeof($keyIDs) == 1 ? "keyID" : "keyIDs";
         $keys = implode(", ", $keyIDs);
         Db::execute("update zz_api set errorCode = 0, errorCount = 0, lastValidation = 0 where keyID in ({$keys})");
         if (sizeof($keyIDs)) {
             irc_out("Revalidating {$key}: {$keys}");
         }
     }
 }
开发者ID:Covert-Inferno,项目名称:zKillboard,代码行数:51,代码来源:irc_revalapi.php

示例10: get

 public static function get($killID)
 {
     $kill = RedisCache::get("Kill{$killID}");
     if ($kill != null) {
         return $kill;
     }
     $kill = Db::queryField('select kill_json from zz_killmails where killID = :killID', 'kill_json', array(':killID' => $killID));
     if ($kill != '') {
         RedisCache::set("Kill{$killID}", $kill);
         return $kill;
     }
     return;
     // No such kill in database
 }
开发者ID:WreckerWorld,项目名称:zKillboard,代码行数:14,代码来源:Killmail.php

示例11: applyBalances

function applyBalances()
{
    global $walletCharacterID, $baseAddr, $mdb;
    $toBeApplied = Db::query('select * from zz_account_wallet where paymentApplied = 0', array(), 0);
    if ($toBeApplied == null) {
        $toBeApplied = [];
    }
    foreach ($toBeApplied as $row) {
        if ($row['ownerID2'] != $walletCharacterID) {
            continue;
        }
        $userID = null;
        $reason = $row['reason'];
        if (strpos($reason, ".{$baseAddr}") !== false) {
            global $adFreeMonthCost;
            $months = $row['amount'] / $adFreeMonthCost;
            $bonusMonths = floor($months / 6);
            $months += $bonusMonths;
            $subdomain = trim(str_replace('DESC: ', '', $reason));
            $subdomain = str_replace('http://', '', $subdomain);
            $subdomain = str_replace('https://', '', $subdomain);
            $subdomain = str_replace('/', '', $subdomain);
            $aff = Db::execute("insert into zz_subdomains (subdomain, adfreeUntil) values (:subdomain, date_add(now(), interval {$months} month)) on duplicate key update adfreeUntil = date_add(if(adfreeUntil is null, now(), adfreeUntil), interval {$months} month)", array(':subdomain' => $subdomain));
            if ($aff) {
                Db::execute('update zz_account_wallet set paymentApplied = 1 where refID = :refID', array(':refID' => $row['refID']));
            }
            continue;
        }
        if ($reason) {
            $reason = trim(str_replace('DESC: ', '', $reason));
            $userID = Db::queryField('select id from zz_users where username = :reason', 'id', array(':reason' => $reason));
        }
        if ($userID == null) {
            $charID = $row['ownerID1'];
            $keyIDs = $mdb->find('apiCharacters', ['characterID' => (int) $charID]);
            foreach ($keyIDs as $keyIDRow) {
                if ($userID) {
                    continue;
                }
                $keyID = (int) $keyIDRow['keyID'];
                $userID = $mdb->findField('apis', 'userID', ['keyID' => $keyID]);
            }
        }
        if ($userID) {
            Db::execute('insert into zz_account_balance values (:userID, :amount) on duplicate key update balance = balance + :amount', array(':userID' => $userID, ':amount' => $row['amount']));
            Db::execute('update zz_account_wallet set paymentApplied = 1 where refID = :refID', array(':refID' => $row['refID']));
        }
    }
}
开发者ID:WreckerWorld,项目名称:zKillboard,代码行数:49,代码来源:fetchWallet.php

示例12: getWars

 public static function getWars($id, $active = true, $combined = false)
 {
     if (!self::isAlliance($id)) {
         $alliID = Db::queryField('select allianceID from zz_corporations where corporationID = :id', 'allianceID', array(':id' => $id));
         if ($alliID != 0) {
             $id = $alliID;
         }
     }
     $active = $active ? '' : 'not';
     $aggressing = Db::query("select * from zz_wars where aggressor = :id and timeFinished is {$active} null", array(':id' => $id));
     $defending = Db::query("select * from zz_wars where defender = :id and timeFinished is {$active} null", array(':id' => $id));
     if ($combined) {
         return array_merge($aggressing, $defending);
     }
     return array('agr' => $aggressing, 'dfd' => $defending);
 }
开发者ID:nasimnabavi,项目名称:zKillboard,代码行数:16,代码来源:War.php

示例13: registerUser

 public static function registerUser($username, $password, $email)
 {
     if (strtolower($username) == "evekill" || strtolower($username) == "eve-kill") {
         return array("type" => "error", "message" => "Restrictd user name");
     }
     $check = Db::queryField("SELECT count(*) count FROM zz_users WHERE email = :email OR username = :username", "count", array(":email" => $email, ":username" => $username), 0);
     if ($check == 0) {
         $hashedpassword = Password::genPassword($password);
         Db::execute("INSERT INTO zz_users (username, password, email) VALUES (:username, :password, :email)", array(":username" => $username, ":password" => $hashedpassword, ":email" => $email));
         $subject = "zKillboard Registration";
         $message = "Thank you, {$username}, for registering at zKillboard.com";
         Email::send($email, $subject, $message);
         $message = "You have been registered, you should recieve a confirmation email in a moment, in the mean time you can click login and login!";
         return array("type" => "success", "message" => $message);
     } else {
         $message = "Username / email is already registered";
         return array("type" => "error", "message" => $message);
     }
 }
开发者ID:Covert-Inferno,项目名称:zKillboard,代码行数:19,代码来源:Registration.php

示例14: registerUser

 public static function registerUser($username, $password, $email)
 {
     global $baseAddr;
     if (strtolower($username) == 'evekill' || strtolower($username) == 'eve-kill') {
         return array('type' => 'error', 'message' => 'Restrictd user name');
     }
     $check = Db::queryField('SELECT count(*) count FROM zz_users WHERE email = :email OR username = :username', 'count', array(':email' => $email, ':username' => $username), 0);
     if ($check == 0) {
         $hashedpassword = Password::genPassword($password);
         Db::execute('INSERT INTO zz_users (username, password, email) VALUES (:username, :password, :email)', array(':username' => $username, ':password' => $hashedpassword, ':email' => $email));
         $subject = "{$baseAddr} Registration";
         $message = "Thank you, {$username}, for registering at {$baseAddr}";
         //Email::send($email, $subject, $message);
         $message = 'You have been registered!';
         return array('type' => 'success', 'message' => $message);
     } else {
         $message = 'Username / email is already registered';
         return array('type' => 'error', 'message' => $message);
     }
 }
开发者ID:WreckerWorld,项目名称:zKillboard,代码行数:20,代码来源:Registration.php

示例15: getUserTrackerData

 public static function getUserTrackerData()
 {
     $entities = array("character", "corporation", "alliance", "faction", "ship", "item", "system", "region");
     $entlist = array();
     foreach ($entities as $ent) {
         Db::execute("update zz_users_config set locker = 'tracker_{$ent}' where locker = '{$ent}'");
         $result = UserConfig::get("tracker_{$ent}");
         $part = array();
         if ($result != null) {
             foreach ($result as $row) {
                 switch ($ent) {
                     case "system":
                         $row["solarSystemID"] = $row["id"];
                         $row["solarSystemName"] = $row["name"];
                         $sunType = Db::queryField("SELECT sunTypeID FROM ccp_systems WHERE solarSystemID = :id", "sunTypeID", array(":id" => $row["id"]));
                         $row["sunTypeID"] = $sunType;
                         break;
                     case "item":
                         $row["typeID"] = $row["id"];
                         $row["shipName"] = $row["name"];
                         break;
                     case "ship":
                         $row["shipTypeID"] = $row["id"];
                         $row["{$ent}Name"] = $row["name"];
                         break;
                     default:
                         $row["{$ent}ID"] = $row["id"];
                         $row["{$ent}Name"] = $row["name"];
                         break;
                 }
                 $part[] = $row;
             }
         }
         $entlist[$ent] = $part;
     }
     return $entlist;
 }
开发者ID:Covert-Inferno,项目名称:zKillboard,代码行数:37,代码来源:Account.php


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