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


PHP SQL::cmd方法代码示例

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


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

示例1: add

 */
class Badges
{
    public static $badgelist = array(1 => array("title" => "Autobiograph", "medal" => 3, "desc" => "Hat sein Benutzerprofil vervollständigt", "key" => "b%b_u%u"), 2 => array("title" => "Bürgerpolizist", "medal" => 3, "desc" => "Hat einen Beitrag gemeldet", "key" => "b%b_u%u"), 3 => array("title" => "Schreiberling", "medal" => 3, "desc" => "Hat die erste Frage gestellt", "key" => "b%b_u%u"), 4 => array("title" => "Helfer", "medal" => 3, "desc" => "Hat die erste Antwort geschrieben", "key" => "b%b_u%u"), 5 => array("title" => "Blabberer", "medal" => 3, "desc" => "Hat die erste Kommentar geschrieben", "key" => "b%b_u%u"), 6 => array("title" => "Callboy", "medal" => 3, "desc" => "Hilft Usern auch über Skype", "key" => "b%b_u%u"), 9 => array("title" => "Kritiker", "medal" => 3, "desc" => "Bewertete einen Beitrag negativ / downvote", "key" => "b%b_u%u"), 10 => array("title" => "Redakteur", "medal" => 3, "desc" => "Editiere einen Beitrag", "key" => "b%b_u%u"), 21 => array("title" => "Elementare Frage", "medal" => 1, "desc" => "Stellte eine Frage mit mindestens 500 Views", "key" => "b%b_u%u_q%q"), 24 => array("title" => "Gute Frage", "medal" => 2, "desc" => "Frage wurde mindestens 3mal positiv bewertet / upvoted", "key" => "b%b_u%u_q%q"), 31 => array("title" => "Wichtige Frage", "medal" => 2, "desc" => "Stellte eine Frage mit mindestens 250 Views", "key" => "b%b_u%u_q%q"), 41 => array("title" => "Populäre Frage", "medal" => 3, "desc" => "Stellte eine Frage mit mindestens 150 Views", "key" => "b%b_u%u_q%q"), 51 => array("title" => "Tolle Antwort", "medal" => 3, "desc" => "Antwort wurde 3mal positiv bewertet / upvoted", "key" => "b%b_u%u_a%a"), 52 => array("title" => "Gute Antwort", "medal" => 2, "desc" => "Antwort wurde 10mal positiv bewertet / upvoted", "key" => "b%b_u%u_a%a"), 53 => array("title" => "Großartige Antwort", "medal" => 1, "desc" => "Antwort wurde 25mal positiv bewertet / upvoted", "key" => "b%b_u%u_a%a"));
    public static function add($badge, $user = null, $data = array())
    {
        if ($user == null) {
            $user = MyUser::id();
        }
        if (!isset(self::$badgelist[$badge + 0])) {
            throw new Exception("Badge existiert nicht! (" . ($badge + 0) . ")");
        }
        $binfo = self::$badgelist[$badge + 0];
        $db = new SQL(0);
        $w = array();
        $w["keyID"] = $binfo["key"];
        $w["keyID"] = str_replace(array("%b", "%u", "%q", "%a"), array($badge + 0, $user + 0, isset($data["question"]) ? $data["question"] : 0, isset($data["answer"]) ? $data["answer"] : 0), $w["keyID"]);
        $w["user"] = $user + 0;
        $w["badge"] = $badge + 0;
        $w["medal"] = $binfo["medal"];
        $w["dt_received"] = time();
        if (isset($data["question"])) {
            $w["question"] = $data["question"] + 0;
        }
        $db->CreateUpdate(0, 'user_badges', $w);
        switch ($w["medal"]) {
            case 1:
                $db->cmd(0, 'UPDATE LOW_PRIORITY IGNORE user_list as T1 SET award_gold = (SELECT count(*) FROM user_badges WHERE user= T1.id AND medal=1) WHERE id={0} LIMIT 1', true, array($w["user"]));
                break;
            case 2:
                $db->cmd(0, 'UPDATE LOW_PRIORITY IGNORE user_list as T1 SET award_silver = (SELECT count(*) FROM user_badges WHERE user= T1.id AND medal=2) WHERE id={0} LIMIT 1', true, array($w["user"]));
                break;
            case 3:
                $db->cmd(0, 'UPDATE LOW_PRIORITY IGNORE user_list as T1 SET award_bronce = (SELECT count(*) FROM user_badges WHERE user= T1.id AND medal=3) WHERE id={0} LIMIT 1', true, array($w["user"]));
开发者ID:andreaskasper,项目名称:askbot_php,代码行数:34,代码来源:Badges.php

示例2: allread

 public static function allread($data)
 {
     if (!MyUser::isloggedin()) {
         throw new APIException("Nicht angemeldet...", 100);
     }
     $db = new SQL(0);
     $db->cmd(0, 'DELETE * FROM user_notification WHERE user = {0}', true, array(MyUser::id()));
     return true;
 }
开发者ID:andreaskasper,项目名称:askbot_php,代码行数:9,代码来源:notification.php

示例3: Release

 public static function Release($question = 0, $Receiver_User = 0)
 {
     $db = new SQL(0);
     $rows = $db->cmdrows(0, 'SELECT * FROM question_bounty WHERE question={0} GROUP BY currency', array($question + 0));
     foreach ($rows as $row) {
         switch ($row["currency"]) {
             case "kar":
                 Karma::add($Receiver_User, 6, $row["amount"], $row["question"]);
                 break;
             case "BTC":
                 break;
             case "EUR":
                 break;
             default:
         }
     }
     $db->cmd(0, 'UPDATE questions SET is_bounty =0 WHERE question={0} LIMIT 1', true, array($question + 0));
     $db->cmd(0, 'DELETE FROM question_bounty WHERE question={0}', true, array($question + 0));
 }
开发者ID:andreaskasper,项目名称:askbot_php,代码行数:19,代码来源:Bounty.php

示例4: add

 public static function add($user, $msgid, $points = 0, $question = null)
 {
     $db = new SQL(0);
     $w = array();
     $w["user"] = $user;
     $w["msgid"] = $msgid;
     $w["points"] = $points;
     if ($question != null) {
         $w["question"] = $question;
     }
     $w["created"] = time();
     $db->CreateUpdate(0, "karma_log", $w);
     $db->cmd(0, 'UPDATE user_list SET karma = (SELECT sum(points) FROM karma_log WHERE user = user_list.id) WHERE id={0} LIMIT 1', true, array($user));
     return true;
 }
开发者ID:andreaskasper,项目名称:askbot_php,代码行数:15,代码来源:Karma.php

示例5: SQL

<?php

$db = new SQL(0);
if (MyUser::isloggedin()) {
    $db->cmd(0, 'INSERT LOW_PRIORITY IGNORE INTO user_action SET user={0}, last_action = {0} ON DUPLICATE KEY UPDATE last_action ={1}', true, array(MyUser::id(), time()));
}
开发者ID:andreaskasper,项目名称:askbot_php,代码行数:6,代码来源:lastseen.php

示例6: OpenIDAddLogin

        }
    }
    //print_r($_GET);
}
function OpenIDAddLogin($openIdentifier, $data)
{
    $userlist = $openIdentifier;
    $db = new SQL(0);
    $w = array();
    $w["username"] = $userlist;
    $w["provider"] = "openid";
    $w["user"] = MyUser::id();
    $db->CreateUpdate(0, 'user_login', $w);
    PageEngine::AddSuccessMessage("openid", "Zugriffsart hinzugefügt");
}
function OpenIDRegisterLogin($openIdentifier, $data)
{
    $userlist = $openIdentifier;
    $db = new SQL(0);
    $row = $db->cmdrow(0, 'SELECT * FROM user_login WHERE username="{0}" AND provider="openid" LIMIT 0,1', array($userlist));
    if (!isset($row["username"])) {
        $db->cmd(0, 'INSERT IGNORE INTO user_list ');
        $w = array();
        if (isset($data["nickname"])) {
            $w["username"] = $data["nickname"] . "#" . rand(0, 99999);
        } else {
            $w["username"] = "User#" . rand(0, 99999);
        }
        $w["email_standard"] = $data["email"];
        if (isset($data["language"])) {
开发者ID:andreaskasper,项目名称:askbot_php,代码行数:30,代码来源:login.php

示例7: reopen

 public static function reopen($data)
 {
     if (!isset($data["question"])) {
         throw new APIException("Benötigter Parameter fehlt (question).", 50);
     }
     if (!MyUser::isloggedin()) {
         throw new APIException("User ist nicht angemeldet.", 100);
     }
     if (MyUser::getKarmaPoints() < 250) {
         throw new APIException("Du benötigst 250 Karma-Punkte um eine Frage zu öffnen.", 200);
     }
     $db = new SQL(0);
     $db->cmd(0, 'UPDATE questions SET is_closed="0" WHERE id={0} LIMIT 1', true, array($data["question"]));
     return true;
 }
开发者ID:andreaskasper,项目名称:askbot_php,代码行数:15,代码来源:question.php

示例8: Akismet

            $akismet = new Akismet(SiteConfig::val("akismet/host"), SiteConfig::val("akismet/key"));
            $akismet->setCommentContent($w["txt"]);
            $akismet->setPermalink(Question::PermalinkByData($w["question"], "Frage"));
            $akismet->setUserIP($_SERVER["REMOTE_ADDR"]);
            try {
                if ($akismet->isCommentSpam()) {
                    $w["isSPAM"] = 2;
                } else {
                    $w["isSPAM"] = -2;
                }
            } catch (Exception $ex) {
            }
        }
        $db->CreateUpdate(0, 'answers', $w);
        $answerID = $db->LastInsertKey();
        $db->cmd(0, 'UPDATE questions SET date_action={1},user_action="{2}", count_answers = (SELECT count(*) FROM answers WHERE question=questions.id) WHERE id={0} LIMIT 1', true, array($w["question"], time(), MyUser::id() + 0));
        $_SESSION["myuser"]["lastwritten"]["answers"][$answerID] = true;
        Karma::RuleAction("CREATE_ANSWER", array("user" => MyUser::id(), "question" => $w["question"], "answer" => $answerID));
        Badges::add(4, MyUser::id(), array("question" => $w["question"]));
        //Erste Antwort geschrieben
    }
}
if (isset($_POST["act"]) and $_POST["act"] == "addComment") {
    if (strlen($_POST["comment"]) >= 10 and MyUser::isloggedin()) {
        $w = array();
        $db = new SQL(0);
        $w["question"] = $_POST["question"] + 0;
        $w["answer"] = $_POST["answer"] + 0;
        $w["text"] = $_POST["comment"];
        $w["created"] = time();
        $w["user"] = MyUser::id();
开发者ID:andreaskasper,项目名称:askbot_php,代码行数:31,代码来源:question.php

示例9: tags2array

    $w["title"] = $info["title"];
    $w["text"] = $info["question"];
    $w["user"] = MyUser::id();
    $w["dt_created"] = time();
    $db->CreateUpdate(0, 'qatext_versions', $w);
    $w2 = array();
    $w2["id"] = $info["id"];
    $w2["title"] = $_POST["title"];
    $w2["question"] = $_POST["text"];
    $w2["author"] = MyUser::id();
    $w2["tags"] = implode(",", tags2array($_POST["tags"]));
    $w2["date_edited"] = time();
    $w2["date_action"] = time();
    $w2["user_action"] = MyUser::id() + 0;
    $db->CreateUpdate(0, 'questions', $w2);
    $db->cmd(0, 'DELETE FROM `question_tags` WHERE question={0}', true, array($info["id"]));
    foreach (tags2array($_POST["tags"]) as $a) {
        $w3 = array();
        $w3["question"] = $info["id"];
        $w3["tag"] = $a;
        $db->CreateUpdate(0, "question_tags", $w3);
    }
    Badges::add(10, MyUser::id());
    //Erfolg Redakteur: Editiere einen Beitrag
    header("Location: " . Question::PermalinkByData($info["id"], $info["title"]));
    exit(1);
}
function tags2array($text)
{
    $g = explode(",", $text);
    $out = array();
开发者ID:andreaskasper,项目名称:askbot_php,代码行数:31,代码来源:question_edit.php

示例10: SQL

<?php

if (isset($_POST["act"]) and $_POST["act"] == "save") {
    $db = new SQL(0);
    $db->cmd(0, 'DELETE FROM user_rights WHERE user={0}', true, array($params["user_id"] + 0));
    foreach ($_POST as $key => $value) {
        if (substr($key, 0, 6) == "right_" and $value == "1") {
            $right = substr($key, 6);
            $w = array();
            $w["user"] = $params["user_id"] + 0;
            $w["right"] = $right;
            $db->CreateUpdate(0, "user_rights", $w);
        }
    }
}
开发者ID:andreaskasper,项目名称:askbot_php,代码行数:15,代码来源:userprofile_rights.php

示例11: _e

<?php

if (isset($_POST["act"]) && $_POST["act"] == "doSQL") {
    $db = new SQL(0);
    $db->cmd(0, $_POST["cmd"], true);
}
PageEngine::html("html_head", array("title" => _e("Administration Upgrade Datenbankvergleich")));
PageEngine::html("header", array("searchquery" => isset($_GET["query"]) ? $_GET["query"] : ""));
$db = new SQL(0);
?>
	<div id="Content" class="content-wrapper PageUserprofile">
		<article>
		
			<h1><?php 
echo _e("Verzeichnisprüfung");
?>
</h1>
			<ul>
<?php 
if (!is_dir($_ENV["basepath"] . "/app/cache")) {
    echo '<li style="color:#800000;">Verzeichnis app/cache fehlt!</li>';
} elseif (@chmod($_ENV["basepath"] . "/app/cache", 0755)) {
    echo '<li style="color:#008000;">Verzeichnis app/cache Ok!</li>';
} else {
    echo '<li style="color:#800000;">Verzeichnis app/cache ist nicht beschreibbar.</li>';
}
?>
			
</ul>
	<h1 class="search-result-summary"><?php 
echo _e("Datenbankprüfung");
开发者ID:andreaskasper,项目名称:askbot_php,代码行数:31,代码来源:page_check.php

示例12: accept

 public static function accept($data)
 {
     $out = array();
     if (!MyUser::isloggedin()) {
         throw new APIException("User ist nicht angemeldet.", 100);
     }
     if (!isset($data["answer"])) {
         throw new APIException("Benötigter Parameter fehlt (answer).", 50);
     }
     $db = new SQL(0);
     $info = $db->cmdrow(0, 'SELECT * FROM answers WHERE id={0} LIMIT 0,1', array($data["answer"] + 0));
     if (!isset($info["id"])) {
         throw new APIException("Diese Antwort existiert nicht (mehr)", 300);
     }
     if ($info["right_answer"] == "1") {
         throw new APIException("Dies ist bereits die beste Antwort", 330);
     }
     $qinfo = $db->cmdrow(0, 'SELECT * FROM questions WHERE id={0} LIMIT 0,1', array($info["question"] + 0));
     if (!isset($qinfo["id"])) {
         throw new APIException("Diese Frage existiert nicht (mehr)", 300);
     }
     if ($qinfo["is_closed"] == "1") {
         throw new APIException("Diese Frage ist bereits geschlossen", 310);
     }
     if ($qinfo["author"] != MyUser::id()) {
         throw new APIException("Dies ist nicht ihre Frage", 320);
     }
     if ($info["author"] == MyUser::id() and MyUser::getKarmaPoints() < 50) {
         throw new APIException("Deine eigene Antwort darf erst ab 50 Karma Punkten die beste Antwort sein", 210);
     }
     $db->cmd(0, 'UPDATE answers SET right_answer = "1" WHERE id={0} LIMIT 1', true, array($info["id"]));
     $db->cmd(0, 'UPDATE questions SET is_answered = "1" WHERE id={0} LIMIT 1', true, array($info["question"]));
     if (MyUser::id() != $info["author"]) {
         Karma::RuleAction("ACCEPT_ANSWER", array("user" => $info["author"], "question" => $info["question"], "answer" => $info["id"]));
     }
     if (MyUser::id() != $info["author"] && $info["is_bounty"] == "1") {
         Bounty::Release($info["question"], $info["author"]);
     }
     //Gib dem Autor die Bounty
     return true;
 }
开发者ID:andreaskasper,项目名称:askbot_php,代码行数:41,代码来源:answer.php

示例13: array

}
$tags = $db->cmdrows(0, "SELECT * FROM question_tags WHERE question={0} ORDER BY tag ASC", array($info["id"]));
switch (isset($_GET["sort"]) ? $_GET["sort"] : "") {
    case "oldest":
        $ansorder = "date_created ASC";
        break;
    case "latest":
        $ansorder = "date_created DESC";
        break;
    default:
        $ansorder = "count_votes DESC";
}
$answers = $db->cmdrows(0, "SELECT T1.*,T2.username as authorname,T2.email_standard as authoremail, T2.GooglePlus, T2.country, T2.show_country, T2.karma as authorkarma, T2.award_gold, T2.award_silver, T2.award_bronce, T2.website as authorwebsite, T2.FlattrUID, T3.vote as MyVote, T4.right as authorexpert\r\tFROM answers as T1\r\tLEFT JOIN user_list as T2 ON T1.author=T2.id \r\tLEFT JOIN answer_votes as T3 ON T1.id=T3.answer AND T3.user={1}\r\tLEFT JOIN user_rights as T4 ON T1.author=T4.user AND T4.right = 'expert'\r\tWHERE T1.question={0} \r\tORDER BY " . $ansorder . ", right_answer DESC", array($info["id"], MyUser::id() + 0));
$bounties = $db->cmdrows(0, 'SELECT sum(amount) as amount, currency FROM question_bounty WHERE question={0} GROUP BY currency', array($info["id"] + 0), "currency");
if ($info["author"] != MyUser::id()) {
    $db->cmd(0, 'INSERT LOW_PRIORITY IGNORE INTO `question_views` (`question`, `IP`, `day`) VALUES (' . $info["id"] . ', "' . $_SERVER["REMOTE_ADDR"] . '", ' . date("Ymd") . ');', true);
    $db->cmd(0, 'UPDATE LOW_PRIORITY `questions` SET count_views=(SELECT count(*) FROM `question_views` WHERE question=questions.id) WHERE id={0} LIMIT 1', true, array($info["id"]));
    if ($info["count_views"] == 500) {
        Badges::add(21, $info["author"], array("question" => $info["id"]));
    } elseif ($info["count_views"] == 250) {
        Badges::add(31, $info["author"], array("question" => $info["id"]));
    } elseif ($info["count_views"] == 150) {
        Badges::add(41, $info["author"], array("question" => $info["id"]));
    }
}
$rows = $db->cmdrows(0, 'SELECT T1.*,T2.username FROM comments as T1 LEFT JOIN user_list as T2 ON T1.user=T2.id WHERE question = {0} ORDER BY created ASC', array($info["id"]));
$comments = array();
foreach ($rows as $row) {
    $comments[$row["answer"]][] = $row;
}
$tagsy = array();
开发者ID:andreaskasper,项目名称:askbot_php,代码行数:31,代码来源:page_question.php

示例14: SQL

</div>
<aside><ul>
	<li class="completed"><a>Einleitung</a></li>
	<li class="completed"><a>Voraussetzungen</a></li>
	<li class="completed"><a>Datenbank Einstellungen</a></li>
	<li class="completed"><a>Administrations Details</a></li>
	<li class="completed"><a>Konfiguration</a></li>
	<li class="completed"><a>Erweiterte Einstellungen</a></li>
	<li class="completed"><a>Erstelle Datenbank</a></li>
	<li class="active"><a>Abschluss</a></li>
</ul></aside>
<article>
	<h1>Schreibvorgang</h1>
	<p>Jetzt wird die Konfiguration angelegt</p>
	<fieldset>
		<legend>Fortschritt</legend>
		<table class="std01">
		
		<?php 
include $_ENV["basepath"] . "/app/code/classes/class.SQL.php";
$db = new SQL(0, "mysql://" . $_POST["mysql_username"] . ":" . $_POST["mysql_password"] . "@" . $_POST["mysql_host"] . ":" . $_POST["mysql_port"] . "/" . $_POST["mysql_database"] . "/");
?>
		<tr><th>Öffne Datenbank-Server:</th><td class="yes">fertig...</td></tr>
		<?php 
$f = file_get_contents($_ENV["basepath"] . "/app/code/install.mysql.sql");
$i = 0;
$command = "";
foreach (explode(chr(13), str_replace(chr(10), chr(13), $f)) as $line) {
    $i++;
    if (substr($line, 0, 2) == "--") {
        continue;
开发者ID:andreaskasper,项目名称:askbot_php,代码行数:31,代码来源:install_page5.php


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