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


PHP DB::quote方法代码示例

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


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

示例1: incSetting

 /**
  * Update settings so the value increases by one for this type
  *
  * @param string  Name of type (code|other)
  */
 public static function incSetting($name, $inc = 1)
 {
     $name = \Kofradia\DB::quote('github_' . $name);
     $inc = (int) $inc;
     \Kofradia\DB::get()->exec("\n\t\t\tINSERT INTO settings SET name = {$name}, value = 1\n\t\t\tON DUPLICATE KEY UPDATE value = value + {$inc}");
     \Kofradia\Settings::reload();
 }
开发者ID:Kuzat,项目名称:kofradia,代码行数:12,代码来源:Hendelser.php

示例2: add_emails

 /**
  * Legg til e-post i køen
  * @param object email $email
  * @param array receivers
  * @param string subject
  * @param bool sende e-posten med en gang
  */
 public static function add_emails(email $email, $receivers, $subject, $send_now = false)
 {
     global $_base;
     if (!is_array($receivers)) {
         $receivers = array($receivers);
     }
     if (!isset($email->data) || !$email->data) {
         throw new HSException("Email must be formatted before input.");
     }
     // sett opp tag
     $id = uniqid("", true);
     $add = array();
     foreach ($receivers as $item) {
         $more = $send_now ? ", " . (time() + self::$timeout) . ", " . \Kofradia\DB::quote($id) : "";
         $add[] = "(" . \Kofradia\DB::quote($item) . "," . \Kofradia\DB::quote($subject) . "," . \Kofradia\DB::quote($email->data[0]) . "," . \Kofradia\DB::quote($email->data[1]) . "," . \Kofradia\DB::quote($email->params) . "{$more})";
     }
     // noen vi skal legge til?
     if (count($add) > 0) {
         $more = $send_now ? ", m_active_end, m_active_id" : "";
         \Kofradia\DB::get()->exec("INSERT INTO mailer (m_receiver, m_subject, m_headers, m_body, m_params{$more}) VALUES " . implode(", ", $add));
     }
     // skal e-postene sendes med en gang?
     if ($send_now) {
         return array($add, self::send_tag($id));
     }
     return count($add);
 }
开发者ID:Kuzat,项目名称:kofradia,代码行数:34,代码来源:class.mailer.php

示例3: set_data

 /**
  * Oppdater en Hall of Fame (oppnådd)
  */
 protected static function set_data($name, $sub, $data, $extra = null)
 {
     $a = \Kofradia\DB::get()->exec("\n\t\t\tINSERT IGNORE INTO hall_of_fame\n\t\t\tSET\n\t\t\t\thof_name = " . \Kofradia\DB::quote($name) . ",\n\t\t\t\thof_sub = " . \Kofradia\DB::quote($sub) . ",\n\t\t\t\thof_time = " . time() . ",\n\t\t\t\thof_data = " . \Kofradia\DB::quote(serialize($data)));
     $affected = $a > 0;
     // logg
     list($subject, $url) = self::get_subject($name, $extra);
     $text = self::get_text($name, $sub, $data);
     putlog("INFO", "%bHALL OF FAME:%b %u" . $subject . "%u ble " . $text . " {$url}");
     // spillerlogg
     $up = null;
     if ($name != "familie" && $name != "familie_rank") {
         $up = $extra;
     }
     if ($name == "ff_owner") {
         $up = $extra[1];
     }
     if ($up) {
         $up->add_log("hall_of_fame", $text);
     }
     // ff-logg
     if ($name == "familie") {
         $extra->add_log("info", 'Broderskapet ble det første broderskap i spillet og havnet på <a href="&rpath;/hall_of_fame">Hall of Fame</a>!');
     } elseif ($name == "familie_rank") {
         $extra->add_log("info", 'Broderskapet har for øyeblikket flest poeng av alle broderskap på spillet i historien og havnet på <a href="&rpath;/hall_of_fame">Hall of Fame</a>!');
     }
     self::cache_load(true);
     return $affected;
 }
开发者ID:Kuzat,项目名称:kofradia,代码行数:31,代码来源:class.hall_of_fame.php

示例4: putlog

/** Lagre til logg systemet */
function putlog($area, $msg)
{
    global $_base;
    static $b = "";
    static $c = "";
    static $u = "";
    static $locations = array("LOG" => array("#SMLogs", "SMAFIA"), "SPAM" => array("#SMLogs", "SMAFIA"), "INFO" => array("#SMLogs", "SMAFIA", "#kofradia", "QuakeNet"), "SPAMLOG" => array("#SMLogs", "SMAFIA"), "ANTIBOT" => array("#SMLogs", "SMAFIA"), "SUPERLOG" => array("#SMLogs", "SMAFIA"), "PROFILVIS" => array("#SMLogs", "SMAFIA"), "CREWCHAN" => array("#SMLogs", "SMAFIA", "#opers", "SMAFIA"), "ANTIBOT_ERROR" => array("#opers", "SMAFIA"), "FF" => array("#SMLogs", "SMAFIA", "#FF", "SMAFIA"), "ABUSE" => array("#SMLogs", "SMAFIA", "#SMAbuse", "SMAFIA"), "ABUSE2" => array("#SMLogs", "SMAFIA", "#SMAbuse", "SMAFIA", "#opers", "SMAFIA"), "NOTICE" => array("#SMLogs", "SMAFIA", "#SMNotice", "SMAFIA"), "DF" => array("#SMDF", "SMAFIA"));
    // bytt ut juksetegnene med spesialtegn
    $msg = str_replace(array("%b", "%c", "%u", "\r", "\n"), array($b, $c, $u, "", ""), $msg);
    $file = $area == "INT" ? LOGFILE_INT : LOGFILE;
    if ($area == "LOG") {
        $sid = 0;
        if (login::$logged_in) {
            $sid = login::$info['ses_id'];
        } elseif (isset($_SESSION[$GLOBALS['__server']['session_prefix'] . 'login_info']['ses_id'])) {
            $sid = $_SESSION[$GLOBALS['__server']['session_prefix'] . 'login_info']['ses_id'];
        }
        $msg .= " {$c}15(SID: " . login::$info['ses_id'] . ")";
    }
    // skriv til databasen og
    if ($area != "INT") {
        global $_base;
        if (isset($locations[$area])) {
            for ($i = 0; $i < count($locations[$area]); $i += 2) {
                $chan = $locations[$area][$i];
                $net = $locations[$area][$i + 1];
                \Kofradia\DB::get()->exec("INSERT INTO log_irc SET li_network = " . \Kofradia\DB::quote($net) . ", li_channel = " . \Kofradia\DB::quote($chan) . ", li_time = " . time() . ", li_message = " . \Kofradia\DB::quote($msg));
            }
        } else {
            $err = "UKJENT({$area}): ";
            \Kofradia\DB::get()->exec("INSERT INTO log_irc SET li_time = " . time() . ", li_message = " . \Kofradia\DB::quote($err . $msg));
        }
    }
    // fjern IRC-tegn fra loggmeldingen som legges i tekstloggen
    $text = str_replace(array($b, $u), array("", "'"), preg_replace("/{$c}(\\d{1,2}(,\\d{1,2})?)?/", "", $msg));
    // vis informasjon til konsoll for scheduler bakgrunn-scriptet
    if (defined("SCHEDULER_REPEATING")) {
        $t = microtime(true);
        $m = sprintf("%02d", round(($t - (int) $t) * 100));
        echo ess::$b->date->get((int) $t)->format("H:i:s.") . $m . ": " . $text . "\n";
    }
    // finnes ikke loggfilen?
    if (!file_exists($file)) {
        $fh = fopen($file, "a");
        if (!$fh) {
            throw new HSException("error (putlog_mf)", sysreport::EXCEPTION_ANONYMOUS);
        }
        fwrite($fh, "\r\n" . $_base->date->get()->format("d-m-Y H:i:s ") . "{$area}: {$text}");
        fclose($fh);
        chmod($file, 0777);
    } else {
        $fh = fopen($file, "a");
        if (!$fh) {
            throw new HSException("error (putlog_mf)", sysreport::EXCEPTION_ANONYMOUS);
        }
        fwrite($fh, "\r\n" . $_base->date->get()->format("d-m-Y H:i:s ") . "{$area}: {$text}");
        fclose($fh);
    }
}
开发者ID:Kuzat,项目名称:kofradia,代码行数:60,代码来源:inc.mainfunctions.php

示例5: load

 /**
  * Load specific poll
  *
  * @param int
  * @param \user
  * @return \Kofradia\Polls\Poll
  */
 public static function load($poll_id, \user $user = null)
 {
     $poll_id = \Kofradia\DB::quote($poll_id);
     $result = \Kofradia\DB::get()->query("\n\t\t\tSELECT p_id, p_active, p_ft_id, p_title, p_text, p_time_start, p_time_end" . ($user ? ", pv_po_id, pv_time" : "") . "\n\t\t\tFROM polls" . ($user ? "\n\t\t\t\tLEFT JOIN polls_votes ON pv_up_id = " . $user->player->id . " AND pv_p_id = p_id" : "") . "\n\t\t\tWHERE p_id = {$poll_id}\n\t\t\tGROUP BY p_id");
     if ($row = $result->fetch()) {
         return static::createFromData($row, $user);
     }
 }
开发者ID:Kuzat,项目名称:kofradia,代码行数:15,代码来源:Poll.php

示例6: set

 /**
  * Sett telleren til bestemt verdi
  * @param string $name
  * @param integer $count
  */
 public static function set($name, $value)
 {
     global $_base;
     $value = (int) $value;
     // forsøk å sett telleren til bestemt verdi
     $affected = \Kofradia\DB::get()->exec("UPDATE tasks SET t_ant = {$value} WHERE t_name = " . \Kofradia\DB::quote($name));
     // oppdater cache
     self::load(true);
     return $affected;
 }
开发者ID:Kuzat,项目名称:kofradia,代码行数:15,代码来源:class.tasks.php

示例7: add_row

 /**
  * Legg til oppføring
  */
 public static function add_row($html, $time = null)
 {
     $time = (int) $time;
     if (!$time) {
         $time = time();
     }
     if (empty($html)) {
         throw new HSException("Mangler HTML.");
     }
     // legg til oppføringen
     \Kofradia\DB::get()->exec("INSERT INTO livefeed SET lf_time = {$time}, lf_html = " . \Kofradia\DB::quote($html));
 }
开发者ID:Kuzat,项目名称:kofradia,代码行数:15,代码来源:class.livefeed.php

示例8: generate

 /**
  * Generate autologin-row for a user
  *
  * @param int $u_id
  * @param int $expire timestamp
  * @param optional string $redirect
  * @param optional int $type (1=resets password)
  * @return string hash
  */
 public static function generate($u_id, $expire, $redirect = null, $type = null)
 {
     $u_id = (int) $u_id;
     $expire = (int) $expire;
     $type = $type === null ? null : (int) $type;
     // generer hash
     $hash = mb_substr(sha1(sha1($u_id . $expire . uniqid()) . ($redirect ? $redirect : "doh")), 0, 16);
     // opprett
     $redirect = $redirect ? ", al_redirect = " . \Kofradia\DB::quote($redirect) : "";
     \Kofradia\DB::get()->exec("\n\t\t\tINSERT INTO autologin\n\t\t\tSET al_u_id = {$u_id}, al_hash = " . \Kofradia\DB::quote($hash) . ", al_time_created = " . time() . ",\n\t\t\t\tal_time_expire = " . $expire . "{$redirect}, al_type = " . \Kofradia\DB::quote($type));
     return $hash;
 }
开发者ID:Kuzat,项目名称:kofradia,代码行数:21,代码来源:Autologin.php

示例9: addToDb

 /**
  * Add to database
  */
 public function addToDb()
 {
     // already in db?
     if ($this->id) {
         return;
     }
     Hendelser::incSetting("count_events");
     foreach ($this->getDescriptionHTML() as $text) {
         if ($this->event_name == "push") {
             Hendelser::incSetting("count_code", $this->getLogCount());
         } else {
             Hendelser::incSetting("count_other", $this->getLogCount());
         }
     }
     \Kofradia\DB::get()->exec("\n\t\t\tINSERT INTO github_log\n\t\t\tSET gl_time = " . $this->event_time->getTimestamp() . ", gl_event_type = " . \Kofradia\DB::quote($this->event_name) . ",\n\t\t\t    gl_contents = " . \Kofradia\DB::quote(serialize($this)) . ", gl_log_count = " . $this->getLogCount());
 }
开发者ID:Kuzat,项目名称:kofradia,代码行数:19,代码来源:Event.php

示例10: update_data

 /**
  * Oppdater data
  */
 public static function update_data()
 {
     global $_base;
     // hent data
     $data = self::get_changes();
     if (!$data) {
         return false;
     }
     // lagre ny data
     $data_sql = \Kofradia\DB::quote(serialize($data));
     \Kofradia\DB::get()->exec("INSERT INTO settings SET name = 'wordpress_data', value = {$data_sql} ON DUPLICATE KEY UPDATE value = {$data_sql}");
     // sjekk for ny data
     self::check_new($data);
     // last inn settings på nytt
     require PATH_APP . "/scripts/update_db_settings.php";
 }
开发者ID:Kuzat,项目名称:kofradia,代码行数:19,代码来源:class.wordpress_entries.php

示例11: __construct

 public function __construct()
 {
     ess::$b->page->add_title("Meldinger", "Ny melding");
     // maks antall mottakere
     $this->receivers_limit = access::has("forum_mod") ? 9 : 4;
     // opprette melding?
     if (isset($_POST['message'])) {
         $this->create();
     } elseif (isset($_GET['mottaker'])) {
         $result = \Kofradia\DB::get()->query("\n\t\t\t\tSELECT up_id, up_name, up_access_level\n\t\t\t\tFROM users_players\n\t\t\t\tWHERE up_name = " . \Kofradia\DB::quote($_GET['mottaker']) . "\n\t\t\t\tORDER BY up_access_level = 0, up_last_online DESC\n\t\t\t\tLIMIT 1");
         while ($row = $result->fetch()) {
             $this->receivers[] = $row;
         }
     }
     // vis skjema
     $this->show();
 }
开发者ID:Kuzat,项目名称:kofradia,代码行数:17,代码来源:innboks_ny.php

示例12: action_notify

 /**
  * Handle notify URLs from PayPal
  */
 public function action_notify()
 {
     file_put_contents(PATH_ROOT . "/paypal.log", print_r($_POST, true), FILE_APPEND);
     // TODO: remove this when tested on production
     if (!isset($_POST['receiver_email']) || $_POST['receiver_email'] != 'henrist@henrist.net') {
         die;
     }
     // should really check for duplicates, but we don't
     // but it must be "completed"
     if (!isset($_POST['payment_status']) || $_POST['payment_status'] != 'Completed') {
         die;
     }
     // verify it
     $verify = Donation::verifyPayPalData($_POST);
     if (!$verify) {
         die;
     }
     // check for user etc
     $custom = postval("custom");
     if (!preg_match('~^(.*):(.*);public=(0|1)$~', $custom, $matches)) {
         die;
     }
     trigger_error("should add");
     $player = null;
     if ($matches[1] != "gjest") {
         // find this player
         $result = DB::get()->query("\n\t\t\t\tSELECT up_id\n\t\t\t\tFROM users_players\n\t\t\t\t\tLEFT JOIN users ON up_u_id = u_id\n\t\t\t\t\tLEFT JOIN sessions ON u_id = ses_u_id\n\t\t\t\tWHERE ses_id = " . DB::quote($matches[1]) . " AND up_id = " . DB::quote($matches[2]) . " LIMIT 1");
         if ($up_id = $result->fetchColumn(0)) {
             $player = \player::get($up_id);
         }
     }
     $time = \ess::$b->date->parse(postval("payment_date"));
     // add it
     $d = Donation::create(postval("mc_gross"), $time, $matches[3] ? $player->id : null);
     putlog("CREWCHAN", sprintf("%%uDONASJON:%%u %s %s ble donert av %s", postval("mc_currency"), postval("mc_gross"), $player ? $player->data['up_name'] . ($matches[3] ? ' (synlig)' : ' (som anonym)') : 'anonym gjest'));
     // no output
     die;
 }
开发者ID:Kuzat,项目名称:kofradia,代码行数:41,代码来源:Donations.php

示例13: array_pop

                            $aktive[] = "-";
                        }
                    }
                    // finnes feltet?
                    if (isset($wpFelt[$name]) && !in_array($name, $aktive)) {
                        $aktive[] = $name;
                    }
                }
                // er siste en seperator?
                if (end($aktive) == "-") {
                    array_pop($aktive);
                }
                // lagre
                $wp->params->update("fields", implode(",", $aktive));
                $data = $wp->params->build();
                \Kofradia\DB::get()->exec("UPDATE stats_whatpulse SET sw_params = " . \Kofradia\DB::quote($data) . " WHERE sw_up_id = " . $player->id);
                $_base->page->add_message("WhatPulse informasjonen ble oppdatert. Sjekk profilen din!");
            }
            redirect::handle();
        }
        // javascript
        $_base->page->add_js('
function wpHentFelt(form)
{
	var elms = [];
	var op = form.wpAktiveFelt.options;
	
	for (var i = 0; i < op.length; i++)
	{
		elms.push(op[i].value);
	}
开发者ID:Kuzat,项目名称:kofradia,代码行数:31,代码来源:index.php

示例14: intval

}
$q = $_POST['q'];
// limit
$limit = intval(min(100, max(1, postval("limit", 10))));
// ekskluder?
$exclude = "";
$exclude_ids = array();
if (isset($_POST['exclude'])) {
    $exclude_ids = array_unique(array_map("intval", explode(",", $_POST['exclude'])));
    if (count($exclude_ids) > 0) {
        $exclude = "up_id NOT IN (" . implode(",", $exclude_ids) . ") AND ";
    }
}
// ignorere egne deaktiverte spillere?
if (isset($_POST['is'])) {
    $exclude .= "up_u_id != " . login::$user->id . " AND ";
}
// hent brukere
$q2 = \Kofradia\DB::quote(str_replace("_", "\\_", $q));
$result = \Kofradia\DB::get()->query("SELECT SQL_CALC_FOUND_ROWS up_id, up_name, up_access_level FROM users_players WHERE {$exclude}up_name LIKE {$q2} ORDER BY LENGTH(up_name), up_name LIMIT {$limit}");
$result2 = \Kofradia\DB::get()->query("SELECT FOUND_ROWS()");
$num = $result2->fetchColumn(0);
// logg
putlog("LOG", "%c3%bFINN-SPILLER:%b%c %u" . login::$user->player->data['up_name'] . "%u søkte etter %u{$q}%u!");
// xml
$data = '<userlist query="' . htmlspecialchars($q) . '" limit="' . $limit . '" results="' . $num . '">';
while ($row = $result->fetch()) {
    $data .= '<user up_id="' . $row['up_id'] . '" up_name="' . htmlspecialchars($row['up_name']) . '">' . htmlspecialchars(game::profile_link($row['up_id'], $row['up_name'], $row['up_access_level'])) . '</user>';
}
$data .= '</userlist>';
ajax::xml($data);
开发者ID:Kuzat,项目名称:kofradia,代码行数:31,代码来源:find_user.php

示例15: generate_images

 /**
  * Generer bilder
  */
 public function generate_images($first = NULL)
 {
     // slett gamle bilder
     \Kofradia\DB::get()->exec("DELETE FROM users_antibot_validate WHERE antibotid = {$this->data['id']}");
     // lås anti-boten
     \Kofradia\DB::get()->beginTransaction();
     \Kofradia\DB::get()->query("SELECT id FROM users_antibot WHERE id = {$this->data['id']} FOR UPDATE")->closeCursor();
     // har noen bilder nå?
     $result = \Kofradia\DB::get()->query("SELECT COUNT(*) FROM users_antibot_validate WHERE antibotid = {$this->data['id']}");
     if ($result->fetchColumn(0) > 0) {
         \Kofradia\DB::get()->commit();
         return $this->get_images();
     }
     $images = array("data" => array(), "info" => array(), "valid" => 0);
     // generer bildene
     $data = antibot_generate::image_create_all(2, 6);
     $time = time();
     // opprett bildene og putt i databasen
     foreach ($data as $key => $image) {
         $imgnum = $key + 1;
         // legg til i databasen
         $valid = $image['valid'] ? '1' : '0';
         \Kofradia\DB::get()->exec("INSERT INTO users_antibot_validate SET antibotid = {$this->data['id']}, imgnum = {$imgnum}, valid = {$valid}, time = {$time}, data = " . \Kofradia\DB::quote($image['data']));
         // legg til i $antibot
         $images['info'][$imgnum] = array("time" => $time, "valid" => $valid);
         $images['data'][$imgnum] = $image['data'];
         if ($valid) {
             $images['valid']++;
         }
     }
     // avslutt lås
     \Kofradia\DB::get()->commit();
     return $images;
 }
开发者ID:Kuzat,项目名称:kofradia,代码行数:37,代码来源:class.antibot.php


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