本文整理汇总了PHP中sprintf_esc函数的典型用法代码示例。如果您正苦于以下问题:PHP sprintf_esc函数的具体用法?PHP sprintf_esc怎么用?PHP sprintf_esc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sprintf_esc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Validate
function Validate($post)
{
global $currentUser;
if (!$currentUser)
return array("you have to be logged in!");
if (!$currentUser->CanPostInBBS())
return array("not allowed lol.");
$message = trim($post["message"]);
if (!$message)
return array("not too meaningful, is it...");
$topic = SQLLib::SelectRow(sprintf_esc("SELECT * FROM bbs_topics where id=%d",$this->topic));
if (!$topic)
return array("you sneaky bastard you >_<");
if ($topic->closed)
return array("closed, capisci?");
$r = SQLLib::SelectRow(sprintf_esc("SELECT author,topic,post FROM bbs_posts WHERE topic = %d ORDER BY added DESC LIMIT 1",(int)$this->topic));
if ($r && $r->author == get_login_id() && $r->post == $message)
return array("ERROR! DOUBLEPOST == ROB IS JARIG!");
return array();
}
示例2: Validate
function Validate($post)
{
global $currentUser;
if (!$currentUser)
return array("you have to be logged in!");
if (!$currentUser->CanPostInProdComments())
return array("not allowed lol.");
$message = $post["comment"];
$message = str_replace(html_entity_decode('­', 0, 'UTF-8'),"",$message);
$message = trim($message);
if (!$message)
return array("not too meaningful, is it...");
$r = SQLLib::SelectRow(sprintf_esc("SELECT id FROM prods where id=%d",$this->prod));
if (!$r)
return array("you sneaky bastard you >_<");
$r = SQLLib::SelectRow(sprintf_esc("SELECT comment,who,which FROM comments WHERE which = %d ORDER BY addedDate DESC LIMIT 1",$this->prod));
if ($r && $r->who == get_login_id() && $r->comment == $message)
return array("ERROR! DOUBLEPOST == ROB IS JARIG!");
return array();
}
示例3: LoadFromDB
function LoadFromDB() {
$s = new SQLSelect();
$perPage = get_setting("prodlistprods");
$this->page = (int)max( 1, (int)$_GET["page"] );
$s = new BM_Query("prods");
if (is_array($_GET["type"]))
{
$cond = array();
foreach($_GET["type"] as $type)
$cond[] = sprintf_esc("FIND_IN_SET('%s',prods.type)",$type);
$s->AddWhere(implode(" OR ",$cond));
}
if (is_array($_GET["platform"]))
{
global $PLATFORMS;
$platforms = array();
foreach($_GET["platform"] as $platform)
foreach($PLATFORMS as $k=>$v)
if ($v["name"] == $platform)
$platforms[] = $k;
if ($platforms)
{
$s->AddJoin("LEFT","prods_platforms as pp","pp.prod = prods.id");
$s->AddWhere(sprintf_esc("pp.platform in (%s)",implode(",",$platforms)));
}
}
$dir = "DESC";
if ($_GET["reverse"])
$dir = "ASC";
switch($_GET["order"])
{
case "type": $s->AddOrder("prods.type ".$dir); break;
case "name": $s->AddOrder("prods.name ".$dir); break;
case "group": $s->AddOrder("prods.group1 ".$dir); $s->AddOrder("prods.group2 ".$dir); $s->AddOrder("prods.group3 ".$dir); break;
case "party": $s->AddOrder("prods_party.name ".$dir); $s->AddOrder("prods.party_year ".$dir); $s->AddOrder("prods.party_place ".$dir); break;
case "thumbup": $s->AddOrder("prods.voteup ".$dir); break;
case "thumbpig": $s->AddOrder("prods.votepig ".$dir); break;
case "thumbdown": $s->AddOrder("prods.votedown ".$dir); break;
case "avg": $s->AddOrder("prods.voteavg ".$dir); break;
case "views": $s->AddOrder("prods.views ".$dir); break;
case "added": $s->AddOrder("prods.addedDate ".$dir); break;
}
$s->AddOrder("prods.releaseDate ".$dir);
$s->AddOrder("prods.addedDate ".$dir);
$s->SetLimit( $perPage, (int)(($this->page-1) * $perPage) );
//echo $s->GetQuery();
$this->prods = $s->performWithCalcRows( $this->count );
PouetCollectPlatforms($this->prods);
PouetCollectAwards($this->prods);
}
示例4: LoadFromDB
function LoadFromDB() {
$id = SQLLib::SelectRow("SELECT prods.id as id FROM prods ORDER BY RAND() LIMIT 1")->id;
$s = new BM_Query("prods");
$s->AddWhere(sprintf_esc("prods.id = %d",$id));
$s->SetLimit(1);
$data = $s->perform();
$this->data = reset($data);
$a = array(&$this->data);
PouetCollectPlatforms($a);
}
示例5: LoadFromDB
function LoadFromDB()
{
$this->prod = PouetProd::spawn( $_GET["which"] );
$s = new BM_Query();
$s->AddField("added");
$s->AddTable("nfos");
$s->SetLimit(1);
$s->attach(array("nfos"=>"user"),array("users as user"=>"id"));
$s->AddWhere(sprintf_esc("prod=%d",$this->prod->id));
list($this->nfo) = $s->perform();
}
示例6: LoadFromDB
function LoadFromDB() {
$s = new BM_Query("parties");
$s->AddField("count(*) as c");
$s->AddField("prods.party_year");
$s->AddJoin("","prods","prods.party=parties.id");
$s->AddWhere(sprintf_esc("parties.id != %d",NO_PARTY_ID));
//$s->AddWhere(sprintf_esc("prods.id is not null");
$s->AddGroup("prods.party,prods.party_year");
$s->AddOrder("prods.releaseDate desc, prods.id desc");
$s->SetLimit(POUET_CACHE_MAX);
$this->data = $s->perform();
//PouetCollectPlatforms($this->data);
}
示例7: PouetBoxAdminEditTopic
function PouetBoxAdminEditTopic( $id )
{
parent::__construct();
$this->id = (int)$id;
$this->uniqueID = "pouetbox_edittopic";
$this->topic = SQLLib::SelectRow(sprintf_esc("select * from bbs_topics where id = %d",$this->id));
$this->title = "edit this topic: "._html($this->topic->topic);
$this->formifier = new Formifier();
$this->fields = array();
$row = SQLLib::selectRow("DESC bbs_topics category");
preg_match_all("/'([^']+)'/",$row->Type,$m);
$this->categories = $m[1];
}
示例8: Commit
function Commit($data)
{
SQLLib::Query(sprintf_esc("UPDATE prods SET party=null, party_year=0, party_compo=0, party_place=0 WHERE party=%d",$this->party->id));
SQLLib::Query(sprintf_esc("UPDATE prods SET invitation=0, invitationyear=0 WHERE invitation=%d",$this->party->id));
SQLLib::Query(sprintf_esc("DELETE FROM partiesaka WHERE party1=%d OR party1=%d",$this->party->id,$this->party->id));
SQLLib::Query(sprintf_esc("DELETE FROM prodotherparty WHERE party=%d",$this->party->id));
SQLLib::Query(sprintf_esc("DELETE FROM partylinks WHERE party=%d",$this->party->id));
SQLLib::Query(sprintf_esc("DELETE FROM listitems WHERE itemid=%d AND type='party'",$this->party->id));
SQLLib::Query(sprintf_esc("DELETE FROM parties WHERE id=%d",$this->party->id));
gloperator_log( "party", (int)$this->party->id, "party_delete", get_object_vars($this->party) );
return array();
}
示例9: LoadFromDB
function LoadFromDB()
{
global $currentUser;
$ids = SQLLib::SelectRows(sprintf_esc("select prodID from watchlist where userID = %d",$currentUser->id));
if (!count($ids)) return;
$i = array();
foreach($ids as $v) $i[] = $v->prodID;
$s = new BM_Query("prods");
$s->AddWhere( sprintf_esc("prods.id in (%s)",implode(",",$i) ) );
$this->prods = $s->perform();
PouetCollectPlatforms($this->prods);
}
示例10: LoadFromDB
function LoadFromDB()
{
$s = new BM_Query("comments");
$s->AddField("comments.rating");
$s->AddField("comments.addedDate");
$s->attach(array("comments"=>"which"),array("prods as prod"=>"id"));
$s->attach(array("comments"=>"who"),array("users as user"=>"id"));
$s->AddOrder("comments.addedDate DESC");
$s->AddWhere(sprintf_esc("(UNIX_TIMESTAMP()-UNIX_TIMESTAMP(comments.addedDate))<=(3600*%d)",get_setting("commentshours")));
$this->comments = $s->perform();
$a = array();
foreach($this->comments as $v) $a[] = &$v->prod;
PouetCollectPlatforms($a);
}
示例11: LoadFromDB
function LoadFromDB()
{
if ($this->id)
{
$s = new BM_Query("faq");
$s->AddWhere(sprintf_esc("id = %d",$this->id));
$item = $s->perform();
$this->item = $item[0];
$this->fields["category"]["value"] = $this->item->category;
$this->fields["question"]["value"] = $this->item->question;
$this->fields["answer"]["value"] = $this->item->answer;
$this->fields["deprecated"]["value"] = $this->item->deprecated;
}
}
示例12: LoadFromDB
function LoadFromDB()
{
/// $this->nfo = SQLLib::SelectRow( sprintf_esc("select * from othernfos where id = %d", $_GET["which"] ) );
$s = new BM_Query();
$s->AddField("othernfos.added");
$s->AddField("othernfos_board.name");
$s->AddTable("othernfos");
$s->SetLimit(1);
$s->attach(array("othernfos"=>"adder"),array("users as user"=>"id"));
$s->attach(array("othernfos"=>"refID"),array("boards as board"=>"id"));
$s->AddWhere(sprintf_esc("othernfos.id=%d",$_GET["which"]));
$s->GetQuery();
list($this->nfo) = $s->perform();
}
示例13: LoadFromDB
function LoadFromDB() {
$s = new SQLSelect();
$this->group = PouetGroup::Spawn($this->id);
$this->addeduser = PouetUser::Spawn($this->group->addedUser);
// not to boast or anything, but this is fucking beautiful.
$sub = new SQLSelect();
$sub->AddField("max(comments.addedDate) as maxDate");
$sub->AddField("comments.which");
$sub->AddTable("comments");
$sub->AddJoin("left","prods","prods.id = comments.which");
//$sub->AddOrder("comments.addedDate desc");
$sub->AddGroup("comments.which");
$sub->AddWhere(sprintf_esc("(prods.group1 = %d) or (prods.group2 = %d) or (prods.group3 = %d)",$this->id,$this->id,$this->id));
$s = new BM_Query("prods");
$s->AddField("cmts.addedDate as lastcomment");
$s->AddField("cmts.rating as lastcommentrating");
$s->AddJoin("left","(select comments.addedDate,comments.who,comments.which,comments.rating from (".$sub->GetQuery().") as dummy left join comments on dummy.maxDate = comments.addedDate and dummy.which = comments.which) as cmts","cmts.which=prods.id");
$s->attach(array("cmts"=>"who"),array("users as user"=>"id"));
$s->AddWhere(sprintf_esc("(prods.group1 = %d) or (prods.group2 = %d) or (prods.group3 = %d)",$this->id,$this->id,$this->id));
$r = !!$_GET["reverse"];
switch($_GET["order"])
{
case "type": $s->AddOrder("prods.type ".($r?"DESC":"ASC")); break;
case "party": $s->AddOrder("prods_party.name ".($r?"DESC":"ASC")); $s->AddOrder("prods.party_year ".($r?"DESC":"ASC")); $s->AddOrder("prods.party_place ".($r?"DESC":"ASC")); break;
case "release": $s->AddOrder("prods.releaseDate ".($r?"ASC":"DESC")); break;
case "thumbup": $s->AddOrder("prods.voteup ".($r?"ASC":"DESC")); break;
case "thumbpig": $s->AddOrder("prods.votepig ".($r?"ASC":"DESC")); break;
case "thumbdown": $s->AddOrder("prods.votedown ".($r?"ASC":"DESC")); break;
case "avg": $s->AddOrder("prods.voteavg ".($r?"ASC":"DESC")); break;
case "views": $s->AddOrder("prods.views ".($r?"ASC":"DESC")); break;
case "latestcomment": $s->AddOrder("lastcomment ".($r?"ASC":"DESC")); break;
default: $s->AddOrder("prods.name ".($r?"DESC":"ASC")); break;
}
$this->prods = $s->perform();
PouetCollectPlatforms($this->prods);
PouetCollectAwards($this->prods);
$s = new BM_Query("affiliatedboards");
$s->attach(array("affiliatedboards"=>"board"),array("boards as board"=>"id"));
$s->AddWhere(sprintf_esc("affiliatedboards.group=%d",$this->id));
$this->affil = $s->perform();
}
示例14: LoadFromDB
function LoadFromDB()
{
parent::LoadFromDB();
$this->links = SQLLib::selectRow(sprintf_esc("select * from partylinks where party = %d and year = %d",$this->id,$this->year));
$this->fields["download"]["value"] = $this->links->download;
$this->fields["csdbID"]["value"] = $this->links->csdb;
$this->fields["slengpungID"]["value"] = $this->links->slengpung;
//$this->fields["zxdemoID"]["value"] = $this->links->zxdemo;
$this->fields["demozooID"]["value"] = $this->links->demozoo;
$this->fields["artcity"]["value"] = $this->links->artcity;
foreach($_POST as $k=>$v)
if ($this->fields[$k])
$this->fields[$k]["value"] = $v;
}
示例15: LoadFromDB
function LoadFromDB() {
$s = new SQLSelect();
$perPage = get_setting("bbsbbstopics");
$this->page = (int)max( 1, (int)$_GET["page"] );
$s = new BM_query();
$s->AddField("bbs_topics.id as id");
$s->AddField("bbs_topics.lastpost as lastpost");
$s->AddField("bbs_topics.firstpost as firstpost");
$s->AddField("bbs_topics.topic as topic");
$s->AddField("bbs_topics.count as count");
$s->AddField("bbs_topics.category as category");
$s->AddTable("bbs_topics");
$s->attach(array("bbs_topics"=>"userfirstpost"),array("users as firstuser"=>"id"));
$s->attach(array("bbs_topics"=>"userlastpost"),array("users as lastuser"=>"id"));
$dir = "DESC";
if ($_GET["reverse"])
$dir = "ASC";
switch($_GET["order"])
{
case "firstpost": $s->AddOrder("bbs_topics.firstpost ".$dir); break;
case "userfirstpost": $s->AddOrder("bbs_topics_firstuser.nickname ".$dir); break;
case "userlastpost": $s->AddOrder("bbs_topics_lastuser.nickname ".$dir); break;
case "topic": $s->AddOrder("bbs_topics.topic ".$dir); break;
case "category": $s->AddOrder("bbs_topics.category ".$dir); break;
case "count": $s->AddOrder("bbs_topics.count ".$dir); break;
case "lastpost":
default: $s->AddOrder("bbs_topics.lastpost ".$dir); break;
}
$s->AddOrder("bbs_topics.lastpost ".$dir);
$s->SetLimit( $perPage, (int)(($this->page - 1) * $perPage) );
if ($_GET["category"])
$s->AddWhere(sprintf_esc("category='%s'",$_GET["category"]));
//echo $s->GetQuery();
$this->topics = $s->performWithCalcRows( $this->count );
//PouetCollectPlatforms($this->prods);
//$this->maxtopics = SQLLib::SelectRow("SELECT MAX(views) as m FROM prods")->m;
}