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


PHP SQL::cmdrow方法代码示例

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


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

示例1: votedown

 public static function votedown($data)
 {
     $out = array();
     if (!MyUser::isloggedin()) {
         throw new APIException("User ist nicht angemeldet.", 100);
     }
     if (MyUser::getKarmaPoints() < 100) {
         throw new APIException("Du benötigst 100 Karma-Punkte um einen negativen Vote zu geben.", 200);
     }
     if (!isset($data["question"])) {
         throw new APIException("Benötigter Parameter fehlt (question).", 50);
     }
     $db = new SQL(0);
     $row = $db->cmdrow(0, 'SELECT * FROM questions WHERE id={0}', array($data["question"] + 0));
     if (!isset($row["id"])) {
         throw new APIException("Diese Frage existiert nicht (mehr)", 300);
     }
     if ($row["author"] == MyUser::id()) {
         throw new APIException("Sie dürfen nicht auf Ihre eigene Frage voten", 301);
     }
     $raw = $db->cmdrow(0, 'SELECT * FROM question_votes WHERE question={0} AND user={1} LIMIT 0,1', array($data["question"] + 0, MyUser::id()));
     $w = array();
     $w["question"] = $data["question"] + 0;
     $w["user"] = MyUser::id();
     $w["vote"] = -1;
     $db->CreateUpdate(0, "question_votes", $w);
     $db->cmd(0, 'UPDATE questions as T1 SET count_votes = (SELECT sum(vote) FROM question_votes WHERE question=T1.id) WHERE id={0} LIMIT 1', false, array($w["question"]));
     $out["sumvotes"] = self::getVotes(array("question" => $w["question"]));
     if (!isset($raw["id"])) {
         Karma::RuleAction("VOTEDOWN_QUESTION", array("user" => $row["author"], "question" => $w["question"]));
     }
     Badge::add(9, MyUser::id(), array("question" => $w["question"]));
     //Kritiker: für downvote
     return $out;
 }
开发者ID:andreaskasper,项目名称:askbot_php,代码行数:35,代码来源:question.php

示例2: _load

 private static function _load($id)
 {
     if (isset(self::$_cache[$id])) {
         return;
     }
     $db = new SQL(0);
     self::$_cache[$id + 0] = $db->cmdrow(0, 'SELECT * FROM user_list WHERE id={0} LIMIT 0,1', array($id + 0));
 }
开发者ID:andreaskasper,项目名称:askbot_php,代码行数:8,代码来源:UserProfile.php

示例3: _load

 protected static function _load($id)
 {
     if (isset(self::$_cache[$id])) {
         return self::$_cache[$id];
     }
     $db = new SQL(0);
     $row = $db->cmdrow(0, 'SELECT * FROM questions WHERE id={0} LIMIT 0,1', array($id));
     if (!isset($row["id"])) {
         return null;
     }
     self::$_cache[$row["id"]] = $row;
     return $row;
 }
开发者ID:andreaskasper,项目名称:askbot_php,代码行数:13,代码来源:Question.php

示例4: 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

示例5: _load

 private static function _load()
 {
     if (!self::isloggedin()) {
         return false;
     }
     $db = new SQL(0);
     self::$_usercache = $db->cmdrow(0, 'SELECT * FROM user_list WHERE id={0} LIMIT 0,1', array(self::id()));
 }
开发者ID:andreaskasper,项目名称:askbot_php,代码行数:8,代码来源:MyUser.php

示例6: html

<?php

$db = new SQL(0);
$info = $db->cmdrow(0, 'SELECT * FROM questions WHERE id={0} LIMIT 0,1', array($params["id"]));
$versions = $db->cmdrows(0, 'SELECT * FROM qatext_versions WHERE type="q" AND keyid="{0}" ORDER BY dt_created ASC', array($info["id"] + 0));
PageEngine::html("html_head");
PageEngine::html("header");
?>
	<div id="Content" class="content-wrapper PageQuestionEdit">
		<article class="ContentLeft">
			<h1>Frage bearbeiten [<a href="<?php 
echo Question::PermalinkByData($info["id"], $info["title"]);
?>
">zurück</a>]</h1>
			<SELECT name="revision">
<?php 
foreach ($versions as $row) {
    echo '<OPTION value="V' . $row["id"] . '">Sicherung vom ' . date("d.m.Y H:i:s", $row["dt_created"]) . ' Uhr</OPTION>';
}
?>
			<OPTION value="current">Aktuelle Version</OPTION>
			</SELECT><button id="BtnLoadRevision" type="button" DISABLED="DISABLED">laden</button>
			<form method="POST"><INPUT type="hidden" name="action" value="save"/>
			
			<b>Titel:</b>
			<INPUT class="gblue" type="text" name="title" value="<?php 
echo html($info["title"]);
?>
"/>
			
			<p><?php 
开发者ID:andreaskasper,项目名称:askbot_php,代码行数:31,代码来源:page_question_edit.php

示例7: _e

<?php

PageEngine::html("html_head");
PageEngine::html("header", array("searchquery" => isset($_GET["query"]) ? $_GET["query"] : ""));
$db = new SQL(0);
$userinfo = $db->cmdrow(0, 'SELECT * FROM user_list WHERE id={0} LIMIT 0,1', array($params["user_id"]));
$infos = $db->cmdrows(0, 'SELECT T1.*, T2.title FROM karma_log as T1 LEFT JOIN questions as T2 ON T1.question=T2.id WHERE user={0} ORDER BY created DESC', array($userinfo["id"]));
?>
	<div id="Content" class="content-wrapper PageUserKarma">
		<article>
			
			<h1 class="search-result-summary"><?php 
echo _e("{0}'s Karma Übersicht", array(0 => html($userinfo["username"])));
?>
</h1>
<?php 
PageEngine::html("box_userprofile_navi", array("id" => $userinfo["id"], "name" => $userinfo["username"]));
?>
			
			<script type="text/javascript" src="https://www.google.com/jsapi"></script>
			<script type="text/javascript">
				google.load("visualization", "1", {packages:["corechart"]});
				google.setOnLoadCallback(drawChart);
				function drawChart() {
					var data = google.visualization.arrayToDataTable(<?php 
$out = array(array("Datum", "Karma"));
$rows = $db->cmdrows(0, 'SELECT sum(points) as Karma, substr(stamp,1,10) as Datum FROM karma_log WHERE user={0} GROUP BY Datum ORDER BY Datum ASC', array($userinfo["id"]));
$raws = array();
$sum = 0;
$time = $userinfo["dt_registered"] - 86400;
foreach ($rows as $row) {
开发者ID:andreaskasper,项目名称:askbot_php,代码行数:31,代码来源:page_userkarma.php

示例8: 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

示例9: SQL

<?php

if (isset($_POST["action"]) and $_POST["action"] == "save") {
    $db = new SQL(0);
    $info = $db->cmdrow(0, 'SELECT T1.*, T2.title FROM answers as T1 LEFT JOIN questions as T2 ON T1.question=T2.id WHERE T1.id={0} LIMIT 0,1', array($params["id"] + 0));
    if ($info["author"] != MyUser::id() && !isset($_SESSION["myuser"]["lastwritten"]["answers"][$info["id"]])) {
        die("Dies ist nicht Ihre Frage.");
    }
    $w = array();
    $w["keyid"] = $info["id"];
    $w["type"] = "a";
    $w["title"] = "";
    $w["text"] = $info["txt"];
    $w["user"] = MyUser::id();
    $w["dt_created"] = time();
    $db->CreateUpdate(0, 'qatext_versions', $w);
    $w2 = array();
    $w2["id"] = $info["id"];
    $w2["txt"] = $_POST["text"];
    $w2["author"] = MyUser::id();
    $w2["date_edited"] = time();
    $db->CreateUpdate(0, 'answers', $w2);
    $w3 = array();
    $w3["id"] = $info["question"] + 0;
    $w3["date_action"] = time();
    $w3["user_action"] = MyUser::id();
    $db->CreateUpdate(0, 'questions', $w3);
    Badges::add(10, MyUser::id());
    //Erfolg Redakteur: Editiere einen Beitrag
    header("Location: " . Question::PermalinkByData($info["question"], $info["title"]) . "#answer-" . $w2["id"]);
    exit(1);
开发者ID:andreaskasper,项目名称:askbot_php,代码行数:31,代码来源:answer_edit.php

示例10: _e

<?php

PageEngine::html("html_head");
PageEngine::html("header", array("searchquery" => isset($_GET["query"]) ? $_GET["query"] : ""));
$db = new SQL(0);
$info = $db->cmdrow(0, 'SELECT * FROM user_list as T1 LEFT JOIN user_action as T2 ON T1.id=T2.user WHERE T1.id={0} LIMIT 0,1', array($params["user_id"]));
$rows = $db->cmdrows(0, 'SELECT * FROM user_rights WHERE user={0}', array($info["id"]));
foreach ($rows as $row) {
    $rinfo[$row["right"]] = $row;
}
?>
	<div id="Content" class="content-wrapper PageUserprofile">
		<article>
			
			<h1 class="search-result-summary"><?php 
echo _e("{0}'s Profil-Übersicht", array(0 => html($info["username"])));
?>
</h1>
<?php 
PageEngine::html("box_userprofile_navi", array("id" => $info["id"], "name" => $info["username"]));
?>
			
			<table class="wrapper"><tr style="vertical-align: top;">
			<td style="text-align: center;">
				<div class="box_gravatar" style="width:140px; height:140px margin-bottom: 10px; position: relative;">
					<img class="profile photo" src="http://www.gravatar.com/avatar/<?php 
echo md5($info["email_standard"]);
?>
?s=140&d=identicon" style="border: #EEE 1px solid; padding: 5px; border-radius: 3px; ">
		<?php 
if (isset($rinfo["expert"])) {
开发者ID:andreaskasper,项目名称:askbot_php,代码行数:31,代码来源:page_userprofilerights.php

示例11: userexists

 public static function userexists($name)
 {
     $db = new SQL(0);
     $row = $db->cmdrow(0, 'SELECT id FROM user_list WHERE username LIKE "{0}" LIMIT 0,1', array($name));
     return isset($row["id"]);
 }
开发者ID:andreaskasper,项目名称:askbot_php,代码行数:6,代码来源:Userlist.php

示例12: _e

?>
			
</ul>
	<h1 class="search-result-summary"><?php 
echo _e("Datenbankprüfung");
?>
</h1>

<?php 
$doc = new DOMDocument();
$doc->load($_ENV["basepath"] . "/app/code/install.mysql.xml");
foreach ($doc->getElementsByTagName("table") as $child) {
    $CreateSQL1 = trim($child->textContent);
    $TableName = $child->attributes->item(0)->value;
    try {
        $row = $db->cmdrow(0, 'SHOW CREATE TABLE `' . $TableName . '`');
    } catch (Exception $ex) {
        $row[1] = "";
    }
    $CreateSQL2 = trim($row[1] . ";");
    $CreateSQL1b = preg_replace("`AUTO_INCREMENT=([0-9]+)`", "AUTO_INCREMENT=???", $CreateSQL1);
    $CreateSQL2b = preg_replace("`AUTO_INCREMENT=([0-9]+)`", "AUTO_INCREMENT=???", $CreateSQL2);
    $CreateSQL1c = str_replace(array(chr(10), chr(32), chr(13)), "", $CreateSQL1b);
    $CreateSQL2c = str_replace(array(chr(10), chr(32), chr(13)), "", $CreateSQL2b);
    echo '<h4 style="margin-bottom:0px; padding-bottom:0px;">' . html($TableName) . '</h4>';
    if ($CreateSQL1c == $CreateSQL2c) {
        echo '<p style="color: green; margin-top: 0px;">korrekt</p>';
    } else {
        $CreateSQL1 = preg_replace("@ AUTO\\_INCREMENT\\=[0-9]+@", "", $CreateSQL1);
        $CreateSQL2 = preg_replace("@ AUTO\\_INCREMENT\\=[0-9]+@", "", $CreateSQL2);
        $out = diff_line_text($CreateSQL2, $CreateSQL1);
开发者ID:andreaskasper,项目名称:askbot_php,代码行数:31,代码来源:page_check.php

示例13: _e

<?php

$db = new SQL(0);
$info = $db->cmdrow(0, 'SELECT T1.*,T2.*,T3.right FROM user_list as T1 LEFT JOIN user_action as T2 ON T1.id=T2.user LEFT JOIN user_rights as T3 ON T1.id=T3.user AND T3.right="expert" WHERE T1.id={0} LIMIT 0,1', array($params["user_id"]));
$str = WebCache::get("http://www.gravatar.com/" . md5(strtolower(trim($info["email_standard"]))) . ".json", 10000, array("entry", "}"));
$gdata = json_decode($str, true);
PageEngine::html("html_head", array("title" => _h("{0}'s Karmaprofil", array($info["username"]))));
PageEngine::html("header", array("searchquery" => isset($_GET["query"]) ? $_GET["query"] : ""));
?>
	<div id="Content" class="content-wrapper PageUserprofile">
		<article>
			
			<h1 class="search-result-summary"><?php 
echo _e("{0}'s Profil bearbeiten", array(0 => html($info["username"])));
?>
</h1>
<?php 
PageEngine::html("box_userprofile_navi", array("id" => $info["id"], "name" => $info["username"]));
?>
			
			<table class="wrapper"><tr style="vertical-align: top;">
			<td style="text-align: center;">
				<div class="box_gravatar" style="width:140px; height:140px margin-bottom: 10px; position: relative;">
					<img class="profile photo" src="http://www.gravatar.com/avatar/<?php 
echo md5($info["email_standard"]);
?>
?s=140&d=identicon" style="border: #EEE 1px solid; padding: 5px; border-radius: 3px; ">
		<?php 
if (isset($info["right"]) and $info["right"] == "expert") {
    echo '<img src="' . get_path("/skins/default/images/icons/expert.png") . '" TITLE="Experte für dieses Thema" style="position: absolute; width: 70px; height: 70px; bottom: -35px; right: -35px;"/>';
}
开发者ID:andreaskasper,项目名称:askbot_php,代码行数:31,代码来源:page_userprofileedit.php

示例14: _e

<?php

$db = new SQL(0);
$info = $db->cmdrow(0, 'SELECT * FROM tag_details WHERE tag = "{0}" LIMIT 0,1', array($params["id"]));
PageEngine::html("html_head", array("title" => $params["id"], "index" => isset($info["long_desc"])));
PageEngine::html("header");
?>
	<div id="Content" class="content-wrapper PageUserprofile">
		<article class="ContentLeft">
<?php 
PageEngine::html("box_tags_navi", array("tag" => $params["id"]));
?>
		
			<h1 class="search-result-summary"><?php 
echo _e("Infos for Tag '{0}'", array(0 => $params["id"]));
?>
</h1>
<?php 
BBCode::render(isset($info["long_desc"]) ? $info["long_desc"] : "", true);
if (!isset($info["long_desc"]) or trim($info["long_desc"]) == "") {
    echo '<p class="noTagDescription">' . _e("Dieser Tag hat aktuell noch keine Erklärung. Ab 2500 Karma Punkten kannst Du diesen Artikel erstellen und so anderen Usern helfen oder einen kurzen Einblick in das Thema bieten.") . '</p>';
}
if (MyUser::isloggedin() and MyUser::getKarmaPoints() >= 2500 or MyUser::hasAdminRight()) {
    echo '<a href="' . get_path("/tags/" . urlencode($params["id"]) . "/info/edit") . '"><button class="blue" type="button">' . _e("edit") . '</button></a>';
}
?>
		
		</article>
		
		<aside class="ContentRight">
		<div style="text-align: center;">
开发者ID:andreaskasper,项目名称:askbot_php,代码行数:31,代码来源:page_tags_info.php

示例15: UsernameAlreadyInUse

function UsernameAlreadyInUse($name, $myuserid = 0)
{
    $db = new SQL(0);
    $row = $db->cmdrow(0, 'SELECT id FROM user_list WHERE username = "{0}" AND id != {1} LIMIT 0,1', array($name, $myuserid + 0));
    return isset($row["id"]);
}
开发者ID:andreaskasper,项目名称:askbot_php,代码行数:6,代码来源:userprofile_edit.php


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