本文整理汇总了PHP中pnVarPrepForStore函数的典型用法代码示例。如果您正苦于以下问题:PHP pnVarPrepForStore函数的具体用法?PHP pnVarPrepForStore怎么用?PHP pnVarPrepForStore使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pnVarPrepForStore函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateUserPass
function updateUserPass($username, $md5pass)
{
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
$column =& $pntable['users_column'];
$result = $dbconn->Execute("UPDATE {$pntable['users']}\n SET {$column['pass']} = '" . pnVarPrepForStore($md5pass) . "'\n WHERE {$column['uname']}='" . pnVarPrepForStore($username) . "'");
}
示例2: blocks_related_block
function blocks_related_block($row)
{
global $sid, $story;
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
if (!pnSecAuthAction(0, 'Relatedblock::', "{$row['title']}::", ACCESS_READ)) {
return;
}
if ($story['topic']) {
$row['content'] = '<font class="pn-normal">';
$column =& $pntable['stories_column'];
$sql = "SELECT {$column['sid']} as sid, {$column['title']} as title FROM {$pntable['stories']} WHERE {$column['topic']}=" . pnVarPrepForStore($story['topic']) . " ORDER BY {$column['counter']} DESC";
$result = $dbconn->SelectLimit($sql, 1);
$mrow = $result->GetRowAssoc(false);
$result->MoveNext();
$column =& $pntable['related_column'];
$result = $dbconn->Execute("SELECT {$column['name']} as name, {$column['url']} as url FROM {$pntable['related']} WHERE {$column['tid']}=" . pnVarPrepForStore($story['topic']) . "");
while (!$result->EOF) {
$lrow = $result->GetRowAssoc(false);
$result->MoveNext();
$row['content'] .= "<strong><big>·</big></strong> <a href=\"{$lrow['url']}\" target=\"_blank\">" . pnVarPrepForDisplay($lrow['name']) . "</a><br>\n";
}
$row['content'] .= "<strong><big>·</big></strong> <a href=\"advtopics.php?topic={$story['topic']}\">" . _MOREABOUT . " " . pnVarPrepForDisplay($story['topicname']) . "</a><br>\n" . "<strong><big>·</big></strong> <a class=\"pn-normal\" href=\"modules.php?op=modload&name=Search&file=index&action=search&overview=1&active_stories=1&stories_author={$story['aid']}\">" . _NEWSBY . " " . pnVarPrepForDisplay($story['aid']) . "</a><br>\n" . '</font><br><hr noshade width="95%" size="1"><b>' . _MOSTREAD . " " . pnVarPrepForDisplay($story['topicname']) . ":</b><br>\n" . "<center><a href=\"advarticle.php?sid={$mrow['sid']}\">" . pnVarPrepForDisplay($mrow['title']) . "</a></center><br><br>\n" . '<div align="right">' . "<a href=\"print.php?sid={$mrow['sid']}\"><img src=\"images/global/print.gif\" border=\"0\" alt=\"" . _PRINTER . "\"></a> " . "<a class=\"pn-normal\" href=\"modules.php?op=modload&name=Recommend_Us&file=index&req=FriendSend&sid={$sid}\"><img src=\"images/global/friend.gif\" border=\"0\" Alt=\"" . _FRIEND . "\"></a>\n" . '</div>';
return themesideblock($row);
}
}
示例3: blocks_ephem_block
function blocks_ephem_block($row)
{
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
$currentlang = pnUserGetLang();
if (!pnSecAuthAction(0, 'Ephemeridsblock::', "{$row['title']}::", ACCESS_READ)) {
return;
}
if (pnConfigGetVar('multilingual') == 1) {
$column =& $pntable['ephem_column'];
$querylang = "AND ({$column['elanguage']}='" . pnVarPrepForStore($currentlang) . "' OR {$column['elanguage']}='')";
} else {
$querylang = "";
}
$today = getdate();
$eday = $today['mday'];
$emonth = $today['mon'];
$column =& $pntable['ephem_column'];
$result = $dbconn->Execute("SELECT {$column['yid']}, {$column['content']}\n FROM {$pntable['ephem']}\n WHERE {$column['did']}='" . pnVarPrepForStore($eday) . "' AND {$column['mid']}='" . pnVarPrepForStore($emonth) . "' {$querylang}");
$boxstuff = '<span class="pn-normal"><b>' . _ONEDAY . '</b></span><br />';
while (list($yid, $content) = $result->fields) {
$result->MoveNext();
$boxstuff .= '<br /><br />';
$boxstuff .= '<b>' . pnVarPrepForDisplay($yid) . '</b><br />' . pnVarPrepHTMLDisplay(nl2br($content)) . '';
}
if (empty($row['title'])) {
$row['title'] = _EPHEMERIDS;
}
$row['content'] = $boxstuff;
return themesideblock($row);
}
示例4: pnBannerDisplay
/**
* Function to display banners in all pages
*/
function pnBannerDisplay($type = 0)
{
// test on config settings
if (pnConfigGetVar('banners') != 1) {
return ' ';
}
// added check for numeric type - markwest
if (!is_numeric($type)) {
return ' ';
}
$dbconn =& pnDBGetConn(true);
$pntable =& pnDBGetTables();
$column =& $pntable['banner_column'];
$bresult =& $dbconn->Execute("SELECT count(*) AS count FROM {$pntable['banner']}\n\t\t\t\t\t\t\t\tWHERE {$column['type']} = '" . (int) pnVarPrepForStore($type) . "'");
list($numrows) = $bresult->fields;
// we no longer need this, free the resources
$bresult->Close();
/* Get a random banner if exist any. */
/* More efficient random stuff, thanks to Cristian Arroyo from http://www.planetalinux.com.ar */
if ($numrows > 1) {
$numrows = $numrows - 1;
mt_srand((double) microtime() * 1000000);
$bannum = mt_rand(0, $numrows);
} else {
$bannum = 0;
}
$column =& $pntable['banner_column'];
//$query = buildSimpleQuery ('banner', array ('bid', 'imageurl','clickurl'), "$column[type] = $type", '', 1, $bannum);
$query = "SELECT {$column['bid']}, {$column['imageurl']}, {$column['clickurl']}\n\t\t\t\tFROM {$pntable['banner']}\n\t\t\t\tWHERE {$column['type']} = '" . (int) pnVarPrepForStore($type) . "'";
$bresult2 =& $dbconn->SelectLimit($query, 1, $bannum);
list($bid, $imageurl, $clickurl) = $bresult2->fields;
// we no longer need this, free the resources
$bresult2->Close();
$myIP = pnConfigGetVar('myIP');
$myhost = pnServerGetVar("REMOTE_ADDR");
if (!empty($myIP) && substr($myhost, 0, strlen($myIP)) == $myIP) {
// itevo, MNA: added temporary variable to check when inserting a finished banner (insert only when variable is not set)
$ignore_bannerfinish = 1;
} else {
$dbconn->Execute("UPDATE {$pntable['banner']}\n SET {$column['impmade']}={$column['impmade']}+1\n WHERE {$column['bid']}=" . (int) pnVarPrepForStore($bid) . "");
}
if ($numrows > 0) {
$aborrar =& $dbconn->Execute("SELECT {$column['cid']},{$column['imptotal']},\n {$column['impmade']}, {$column['clicks']},\n {$column['date']}\n FROM {$pntable['banner']}\n WHERE {$column['bid']}=" . (int) pnVarPrepForStore($bid) . "");
list($cid, $imptotal, $impmade, $clicks, $date) = $aborrar->fields;
$aborrar->Close();
/* Check if this impression is the last one and print the banner */
if ($imptotal == $impmade && !isset($ignore_bannerfinish)) {
$column =& $pntable['bannerfinish_column'];
$dbconn->Execute("INSERT INTO {$pntable['bannerfinish']}\n ( {$column['bid']}, {$column['cid']}, {$column['impressions']}, {$column['clicks']}, {$column['datestart']}, {$column['dateend']} )\n VALUES (NULL, '" . pnVarPrepForStore($cid) . "', '" . pnVarPrepForStore($impmade) . "', '" . pnVarPrepForStore($clicks) . "', '" . pnVarPrepForStore($date) . "', now())");
$dbconn->Execute("DELETE FROM {$pntable['banner']} WHERE {$column['bid']}=" . (int) pnVarPrepForStore($bid) . "");
}
list($bid, $clickurl, $imageurl) = pnVarPrepForDisplay($bid, $clickurl, $imageurl);
if ($type == 1 or $type == 2 or $type == 0) {
echo "<a href=\"banners.php?op=click&bid={$bid}\" title=\"{$clickurl}\"><img src=\"{$imageurl}\" alt=\"{$clickurl}\" /></a>";
} else {
$content = "<a href=\"banners.php?op=click&bid={$bid}\" title=\"{$clickurl}\"><img src=\"{$imageurl}\" alt=\"{$clickurl}\" /></a>";
return $content;
}
}
}
示例5: pnBannerDisplay
/**
* Function to display banners in all pages
*/
function pnBannerDisplay($type = 0)
{
// test on config settings
if (pnConfigGetVar('banners') != 1) {
return ' ';
}
// added check for numeric type - markwest
if (!is_numeric($type)) {
return ' ';
}
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
$column =& $pntable['banner_column'];
$bresult = $dbconn->Execute("SELECT count(*) AS count FROM {$pntable['banner']}\n\t\t\t\t\t\t\t\tWHERE {$column['type']} = {$type}");
list($numrows) = $bresult->fields;
// we no longer need this, free the resources
$bresult->Close();
/* Get a random banner if exist any. */
/* More efficient random stuff, thanks to Cristian Arroyo from http://www.planetalinux.com.ar */
if ($numrows > 1) {
$numrows = $numrows - 1;
mt_srand((double) microtime() * 1000000);
$bannum = mt_rand(0, $numrows);
} else {
$bannum = 0;
}
$column =& $pntable['banner_column'];
$query = buildSimpleQuery('banner', array('bid', 'imageurl', 'clickurl'), "{$column['type']} = {$type}", '', 1, $bannum);
$bresult2 = $dbconn->Execute($query);
list($bid, $imageurl, $clickurl) = $bresult2->fields;
// we no longer need this, free the resources
$bresult2->Close();
$myIP = pnConfigGetVar('myIP');
$myhost = getenv("REMOTE_ADDR");
if ($myIP == $myhost) {
// do nothing
} else {
$dbconn->Execute("UPDATE {$pntable['banner']}\n SET {$column['impmade']}={$column['impmade']}+1\n WHERE {$column['bid']}=" . pnVarPrepForStore($bid) . "");
}
if ($numrows > 0) {
$aborrar = $dbconn->Execute("SELECT {$column['cid']},{$column['imptotal']},\n {$column['impmade']}, {$column['clicks']},\n {$column['date']}\n FROM {$pntable['banner']}\n WHERE {$column['bid']}=" . pnVarPrepForStore($bid) . "");
list($cid, $imptotal, $impmade, $clicks, $date) = $aborrar->fields;
$aborrar->Close();
/* Check if this impression is the last one and print the banner */
if ($imptotal == $impmade) {
$column =& $pntable['bannerfinish_column'];
$dbconn->Execute("INSERT INTO {$pntable['bannerfinish']}\n ( {$column['bid']}, {$column['cid']}, {$column['impressions']}, {$column['clicks']}, {$column['datestart']}, {$column['dateend']} )\n VALUES (NULL, '" . pnVarPrepForStore($cid) . "', '" . pnVarPrepForStore($impmade) . "', '" . pnVarPrepForStore($clicks) . "', '" . pnVarPrepForStore($date) . "', now())");
$dbconn->Execute("DELETE FROM {$pntable['banner']} WHERE {$column['bid']}=" . pnVarPrepForStore($bid) . "");
}
if ($type == 1 or $type == 2 or $type == 0) {
echo "<a href=\"banners.php?op=click&bid={$bid}\" target=\"_blank\" title=\"{$clickurl}\"><img src=\"{$imageurl}\" border=\"0\" alt=\"" . _CLICK . "\"></a>";
} else {
$content = "<a href=\"banners.php?op=click&bid={$bid}\" target=\"_blank\" title=\"{$clickurl}\"><img src=\"{$imageurl}\" border=\"0\" alt=\"" . _CLICK . "\"></a>";
return $content;
}
}
}
示例6: blocks_category_block
function blocks_category_block($row)
{
global $topic, $catid;
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
if (!pnSecAuthAction(0, 'Categoryblock::', "{$row['title']}::", ACCESS_READ)) {
return;
}
if (pnConfigGetVar('multilingual') == 1) {
$column =& $pntable['stories_column'];
$querylang = "AND ({$column['alanguage']}='" . pnVarPrepForStore(pnUserGetLang()) . "' OR {$column['alanguage']}='')";
/* the OR is needed to display stories who are posted to ALL languages */
} else {
$querylang = '';
}
$column =& $pntable['stories_cat_column'];
$result = $dbconn->Execute("SELECT {$column['catid']} as catid, {$column['title']} as title FROM {$pntable['stories_cat']} ORDER BY {$column['title']}");
if ($result->EOF) {
return;
} else {
$boxstuff = '<span class="pn-normal">';
if ($catid == "") {
// $boxstuff .= '<strong><big>·</big></strong> <b>'._ALL_CATEGORIES.'</b><br />';
$boxstuff .= "";
} else {
$boxstuff .= "<strong><big>·</big></strong> <a href=\"modules.php?op=modload&name=News&file=index&topic={$topic}\">" . _ALL_CATEGORIES . "</a><br />";
}
for (; !$result->EOF; $result->MoveNext()) {
$srow = $result->GetRowAssoc(false);
if (pnSecAuthAction(0, 'Stories::Category', "{$srow['title']}::{$srow['catid']}", ACCESS_READ)) {
$column =& $pntable['stories_column'];
$result2 = $dbconn->Execute("SELECT {$column['time']} AS unixtime\n FROM {$pntable['stories']}\n WHERE {$column['catid']}=" . pnVarPrepForStore($srow['catid']) . " {$querylang}\n ORDER BY {$column['time']} DESC");
if (!$result2->EOF) {
$story = $result2->GetRowAssoc(false);
$story['unixtime'] = $result2->UnixTimeStamp($story['unixtime']);
$sdate = ml_ftime(_DATEBRIEF, $story['unixtime']);
if ($catid == $srow['catid']) {
$boxstuff .= "<strong><big>·</big></strong> <span class=\"pn-title\"><b>" . pnVarPrepForDisplay($srow['title']) . "</b></span> <span class=\"pn-sub\">(" . pnVarPrepForDisplay($sdate) . ")</span><br />";
} else {
$boxstuff .= "<strong><big>·</big></strong> <a class=\"pn-normal\" href=\"modules.php?op=modload&name=News&file=index&catid={$srow['catid']}&topic={$topic}\">" . pnVarPrepForDisplay($srow['title']) . "</a> <span class=\"pn-sub\">(" . pnVarPrepForDisplay($sdate) . ")</span><br />";
}
}
}
}
}
$boxstuff .= '</span>';
if (empty($row['title'])) {
$row['title'] = _CATEGORIES;
}
$row['content'] = $boxstuff;
return themesideblock($row);
}
示例7: blocks_user_block
function blocks_user_block($row)
{
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
if (!pnSecAuthAction(0, 'Userblock::', "{$row['title']}::", ACCESS_READ)) {
return;
}
if (pnUserLoggedIn() && pnUserGetVar('ublockon') == 1) {
$column =& $pntable['users_column'];
$uid = pnUserGetVar('uid');
$getblock = $dbconn->Execute("SELECT {$column['ublock']} FROM {$pntable['users']} WHERE {$column['uid']}=" . pnVarPrepForStore($uid) . "");
list($ublock) = $getblock->fields;
$username = pnUserGetVar('name');
$row['title'] = _MENUFOR . " " . pnVarPrepForDisplay($username) . "";
$row['content'] = $ublock;
return themesideblock($row);
}
}
示例8: getusrinfo
function getusrinfo($user)
{
global $userinfo;
if (empty($user)) {
return;
}
if (isset($userinfo['uid'])) {
return $userinfo;
}
$user3 = cookiedecode();
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
$column = $pntable['users_column'];
$sql = "SELECT {$column['uid']} AS uid,\n {$column['name']} AS name,\n {$column['uname']} AS uname,\n {$column['email']} AS email,\n {$column['femail']} AS femail,\n {$column['url']} AS url,\n {$column['user_avatar']} AS user_avatar,\n {$column['user_icq']} AS user_icq,\n {$column['user_occ']} AS user_occ,\n {$column['user_from']} AS user_from,\n {$column['user_intrest']} AS user_intrest,\n {$column['user_sig']} AS user_sig,\n {$column['user_viewemail']} AS user_viewemail,\n {$column['user_theme']} AS user_theme,\n {$column['user_aim']} AS user_aim,\n {$column['user_yim']} AS user_yim,\n {$column['user_msnm']} AS user_msnm,\n {$column['pass']} AS pass,\n {$column['storynum']} AS storynum,\n {$column['umode']} AS umode,\n {$column['uorder']} AS uorder,\n {$column['thold']} AS thold,\n {$column['noscore']} AS noscore,\n {$column['bio']} AS bio,\n {$column['ublockon']} AS ublockon,\n {$column['ublock']} AS ublock,\n {$column['theme']} AS theme,\n {$column['commentmax']} AS commentmax,\n {$column['timezone_offset']} AS timezone_offset\n FROM {$pntable['users']}\n WHERE {$column['uname']} = '" . pnVarPrepForStore($user3[1]) . "'";
$result = $dbconn->Execute($sql);
if ($result->PO_RecordCount() == 1) {
$userinfo = $result->GetRowAssoc(false);
} else {
echo "Problem obtaining user information<br>";
}
return $userinfo;
}
示例9: search_downloads
function search_downloads()
{
list($q, $active_downloads, $bool, $startnum, $total) = pnVarCleanFromInput('q', 'active_downloads', 'bool', 'startnum', 'total');
if (empty($active_downloads)) {
return;
}
if (!pnModAvailable('Downloads')) {
return;
}
$dbconn =& pnDBGetConn(true);
$pntable =& pnDBGetTables();
$output =& new pnHTML();
if (!isset($startnum) || !is_numeric($startnum)) {
$startnum = 1;
}
if (isset($total) && !is_numeric($total)) {
unset($total);
}
$w = search_split_query($q);
$flag = false;
// fifers: have to explicitly name the columns so that if the underlying DB column names change, the code to access them doesn't. We use the column names in assoc array later...
$column =& $pntable['downloads_downloads_column'];
$query = "SELECT {$column['lid']} as lid, {$column['title']} as title, {$column['name']} as name, {$column['description']} as description, {$column['cid']} as cid FROM {$pntable['downloads_downloads']} WHERE \n";
foreach ($w as $word) {
if ($flag) {
switch ($bool) {
case 'AND':
$query .= ' AND ';
break;
case 'OR':
default:
$query .= ' OR ';
break;
}
}
$query .= '(';
// downloads
$query .= "{$column['description']} LIKE '" . pnVarPrepForStore($word) . "' OR \n";
$query .= "{$column['title']} LIKE '" . pnVarPrepForStore($word) . "' OR \n";
$query .= "{$column['submitter']} LIKE '" . pnVarPrepForStore($word) . "' OR \n";
$query .= "{$column['name']} LIKE '" . pnVarPrepForStore($word) . "' OR \n";
$query .= "{$column['homepage']} LIKE '" . pnVarPrepForStore($word) . "' \n";
$query .= ')';
$flag = true;
}
$query .= " ORDER BY {$column['lid']}";
if (empty($total)) {
$total = 0;
$countres =& $dbconn->Execute($query);
// check for a db error
if ($dbconn->ErrorNo() != 0) {
return;
}
while (!$countres->EOF) {
$row = $countres->GetRowAssoc(false);
// we have a download id so get its category
$column2 =& $pntable['downloads_categories_column'];
$result2 =& $dbconn->Execute("SELECT {$column2['title']} \n\t\t\t\t\t\t\t\t\tFROM {$pntable['downloads_categories']} \n\t\t\t\t\t\t\t\t\tWHERE {$column2['cid']}={$row['cid']}");
list($title) = $result2->fields;
if (pnSecAuthAction(0, 'Downloads::Item', "{$row['title']}::{$row['lid']}", ACCESS_READ) && pnSecAuthAction(0, 'Downloads::Category', "{$title}::{$row['cid']}", ACCESS_READ)) {
$total++;
}
$countres->MoveNext();
}
}
$result = $dbconn->SelectLimit($query, 10, $startnum - 1);
// check for a db error
if ($dbconn->ErrorNo() != 0) {
return;
}
if (!$result->EOF) {
$output->Text(_DOWNLOADS . ': ' . $total . ' ' . _SEARCHRESULTS);
$output->SetInputMode(_PNH_VERBATIMINPUT);
// Rebuild the search string from previous information
$url = "index.php?name=Search&action=search&active_downloads=1&bool={$bool}&q={$q}";
$output->Text("<dl>");
while (!$result->EOF) {
$row = $result->GetRowAssoc(false);
// we have a download id so get its category
$column2 =& $pntable['downloads_categories_column'];
$result2 =& $dbconn->Execute("SELECT {$column2['title']} \n\t\t\t\t\t\t\t\t\tFROM {$pntable['downloads_categories']} \n\t\t\t\t\t\t\t\t\tWHERE {$column2['cid']}={$row['cid']}");
list($title) = $result2->fields;
if (pnSecAuthAction(0, 'Downloads::Item', "{$row['title']}::{$row['lid']}", ACCESS_READ) && pnSecAuthAction(0, 'Downloads::Category', "{$title}::{$row['cid']}", ACCESS_READ)) {
$row['description'] = strip_tags($row['description']);
if (strlen($row['description']) > 128) {
$row['description'] = substr($row['description'], 0, 125) . '...';
}
$output->Text("<dt><a href=\"index.php?name=Downloads&req=viewdownloaddetails&lid={$row['lid']}\">" . pnVarPrepForDisplay($row[title]) . "</a></dt>");
$output->Text("<dd>" . pnVarPrepForDisplay($row[description]) . "</dd>");
}
$result->MoveNext();
}
$output->Text("</dl>");
// Mung URL for template
$urltemplate = $url . "&startnum=%%&total={$total}";
$output->Pager($startnum, $total, $urltemplate, 10);
} else {
$output->SetInputMode(_PNH_VERBATIMINPUT);
$output->Text(_SEARCH_NO_DOWNLOADS);
$output->SetInputMode(_PNH_PARSEINPUT);
//.........这里部分代码省略.........
示例10: WHERE
$dbconn->Execute("UPDATE {$pntable['counter']}\n SET {$column['count']}={$column['count']}+1\n WHERE ({$column['type']}='total' AND {$column['var']}='hits')\n OR ({$column['var']}='" . pnVarPrepForStore($browser) . "' AND {$column['type']}='browser')\n OR ({$column['var']}='" . pnVarPrepForStore($os) . "' AND {$column['type']}='os')");
/* Per-Day-Counter */
$xydate = date("dmY");
$column =& $pntable['stats_date_column'];
$xyval = $dbconn->Execute("SELECT {$column['hits']} as hits\n FROM {$pntable['stats_date']}\n WHERE {$column['date']}='" . pnVarPrepForStore($xydate) . "'");
if ($dbconn->ErrorNo() != 0) {
echo "Error accessing stats information<P>";
}
$ttemp = $xyval->GetRowAssoc(false);
$xyval->MoveNext();
$happend = $ttemp['hits'];
if ($happend == "" || $happend == false || !$happend) {
$column =& $pntable['stats_date_column'];
$dbconn->Execute("INSERT INTO {$pntable['stats_date']}\n ({$column['date']}, {$column['hits']}) VALUES ('" . pnVarPrepForStore($xydate) . "','1')");
} else {
$column =& $pntable['stats_date_column'];
$dbconn->Execute("UPDATE {$pntable['stats_date']}\n SET {$column['hits']}={$column['hits']}+1\n WHERE {$column['date']}='" . pnVarPrepForStore($xydate) . "'");
}
/* Per-Hour-Counter */
$xyhour = date("G");
$column =& $pntable['stats_hour_column'];
$dbconn->Execute("UPDATE {$pntable['stats_hour']}\n SET {$column['hits']}={$column['hits']}+1\n WHERE {$column['hour']}='" . pnVarPrepForStore($xyhour) . "'");
/* Weekday-Counter */
$xyweekday = date("w");
$column =& $pntable['stats_week_column'];
$dbconn->Execute("UPDATE {$pntable['stats_week']}\n SET {$column['hits']}={$column['hits']}+1\n WHERE {$column['weekday']}='" . pnVarPrepForStore($xyweekday) . "'");
/* Month-Counter */
$xymonth = date("m");
$column =& $pntable['stats_month_column'];
$dbconn->Execute("UPDATE {$pntable['stats_month']}\n SET {$column['hits']}={$column['hits']}+1\n WHERE {$column['month']}='" . pnVarPrepForStore($xymonth) . "'");
}
示例11: pnConfigSetVar
/**
* set a configuration variable
* @param name the name of the variable
* @param value the value of the variable
* @returns bool
* @return true on success, false on failure
*/
function pnConfigSetVar($name, $value)
{
/*
* The database parameter are not allowed to change
*/
if (empty($name) || $name == 'dbtype' || $name == 'dbhost' || $name == 'dbuname' || $name == 'dbpass' || $name == 'dbname' || $name == 'system' || $name == 'prefix' || $name == 'encoded') {
return false;
}
/*
* Test on missing record
*
* Also solve SF-bug #580951
*/
$must_insert = true;
global $pnconfig;
foreach ($pnconfig as $k => $v) {
/*
* Test if the key name is in the array
*/
if ($k == $name) {
/*
* Set flag
*/
$must_insert = false;
/*
* Test on change. If not, just quit now
*/
if ($v == $value) {
return true;
}
/*
* End loop after success
*/
break;
}
}
/*
* Fetch base data
*/
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
$table = $pntable['module_vars'];
$columns =& $pntable['module_vars_column'];
/*
* Update the table
*/
if ($must_insert) {
/*
* Insert
*/
$query = "INSERT INTO {$table}\n ({$columns['modname']},\n {$columns['name']},\n {$columns['value']})\n VALUES ('" . pnVarPrepForStore(_PN_CONFIG_MODULE) . "',\n '" . pnVarPrepForStore($name) . "',\n '" . pnVarPrepForStore(serialize($value)) . "')";
} else {
/*
* Update
*/
$query = "UPDATE {$table}\n SET {$columns['value']}='" . pnVarPrepForStore(serialize($value)) . "'\n WHERE {$columns['modname']}='" . pnVarPrepForStore(_PN_CONFIG_MODULE) . "'\n AND {$columns['name']}='" . pnVarPrepForStore($name) . "'";
}
$dbconn->Execute($query);
if ($dbconn->ErrorNo() != 0) {
return false;
}
/*
* Update my vars
*/
$pnconfig[$name] = $value;
return true;
}
示例12: postcalendar_admin_categoryLimitsUpdate
function postcalendar_admin_categoryLimitsUpdate()
{
if (!PC_ACCESS_ADMIN) {
return _POSTCALENDAR_NOAUTH;
}
$output = new pnHTML();
$output->SetInputMode(_PNH_VERBATIMINPUT);
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
list($id, $del, $catId, $startTimeH, $startTimeM, $endTimeH, $endTimeM, $limit, $newCatId, $newStartTimeH, $newStartTimeM, $newEndTimeH, $newEndTimeM, $newLimit, ) = pnVarCleanFromInput('id', 'del', 'catid', 'starttimeh', 'starttimem', 'endtimeh', 'endtimem', 'limit', 'newcatid', 'newstarttimeh', 'newstarttimem', 'newendtimeh', 'newendtimem', 'newlimit');
$updates = array();
if (isset($id)) {
foreach ($id as $k => $i) {
$found = false;
if (count($del)) {
foreach ($del as $d) {
if ($i == $d) {
$found = true;
break;
}
}
}
if (!$found) {
$start = date("H:i:s", mktime($startTimeH[$k], $startTimeM[$k], 0));
$end = date("H:i:s", mktime($endTimeH[$k], $endTimeM[$k], 0));
$update_sql = "UPDATE {$pntable['postcalendar_limits']}\n\t\t SET pc_catid='" . pnVarPrepForStore($catId[$k]) . "',\n\t\t pc_starttime='" . pnVarPrepForStore($start) . "',\n\t\t pc_endtime='" . pnVarPrepForStore($end) . "',\n\t\t pc_limit='" . pnVarPrepForStore($limit[$k]) . "'\n\t\t WHERE pc_limitid={$i}";
array_push($updates, $update_sql);
}
}
}
$dels = implode(",", $del);
$delete = "DELETE FROM {$pntable['postcalendar_limits']} WHERE pc_limitid IN ({$dels})";
$e = $msg = '';
if (!pnModAPIFunc(__POSTCALENDAR__, 'admin', 'updateCategoryLimit', array('updates' => $updates))) {
$e .= 'UPDATE FAILED';
}
if (isset($dels)) {
if (!pnModAPIFunc(__POSTCALENDAR__, 'admin', 'deleteCategoryLimit', array('delete' => $delete))) {
$e .= 'DELETE FAILED';
}
}
if (isset($newLimit) && $newLimit > 0) {
$start = date("H:i:s", mktime($newStartTimeH, $newStartTimeM, 0));
$end = date("H:i:s", mktime($newEndTimeH, $newEndTimeM, 0));
if (!pnModAPIFunc(__POSTCALENDAR__, 'admin', 'addCategoryLimit', array('catid' => $newCatId, 'starttime' => $start, 'endtime' => $end, 'limit' => $newLimit))) {
$e .= 'INSERT FAILED';
}
}
if (empty($e)) {
$msg = 'DONE';
}
$output->Text(postcalendar_admin_categoryLimits($msg, $e));
return $output->GetOutput();
}
示例13: postcalendar_userapi_buildSubmitForm
//.........这里部分代码省略.........
// PARSE SELECT_END_DATE_TIME
//=================================================================
$output->SetOutputMode(_PNH_RETURNOUTPUT);
//if there is no end date we want the box to read todays date instead of jan 01 1994 :)
if ($event_endmonth == 0 && $event_endday == 0 && $event_endyear == 0) {
$event_endmonth = $month;
$event_endday = $day;
$event_endyear = $year;
}
if (_SETTING_USE_INT_DATES) {
$sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildDaySelect', array('pc_day' => $day, 'selected' => $event_endday));
$formdata = $output->FormSelectMultiple('event_endday', $sel_data, 0, 1, "", "", false, '');
$sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildMonthSelect', array('pc_month' => $month, 'selected' => $event_endmonth));
$formdata .= $output->FormSelectMultiple('event_endmonth', $sel_data, 0, 1, "", "", false, '');
} else {
$sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildMonthSelect', array('pc_month' => $month, 'selected' => $event_endmonth));
$formdata = $output->FormSelectMultiple('event_endmonth', $sel_data, 0, 1, "", "", false, '');
$sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildDaySelect', array('pc_day' => $day, 'selected' => $event_endday));
$formdata .= $output->FormSelectMultiple('event_endday', $sel_data, 0, 1, "", "", false, '');
}
$sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildYearSelect', array('pc_year' => $year, 'selected' => $event_endyear));
$formdata .= $output->FormSelectMultiple('event_endyear', $sel_data, 0, 1, "", "", false, '');
$output->SetOutputMode(_PNH_KEEPOUTPUT);
$tpl->assign('SelectEndDate', $formdata);
//=================================================================
// PARSE SELECT_TIMED_EVENT
//=================================================================
$stimes = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildTimeSelect', array('hselected' => $event_starttimeh, 'mselected' => $event_starttimem));
$output->SetOutputMode(_PNH_RETURNOUTPUT);
$timed_hours = $output->FormSelectMultiple('event_starttimeh', $stimes['h'], 0, 1, "", "", false, '');
$timed_minutes = $output->FormSelectMultiple('event_starttimem', $stimes['m'], 0, 1, "", "", false, '');
if (!_SETTING_TIME_24HOUR) {
$ampm = array();
$ampm[0]['id'] = pnVarPrepForStore(_AM_VAL);
$ampm[0]['name'] = pnVarPrepForDisplay(_PC_AM);
$ampm[1]['id'] = pnVarPrepForStore(_PM_VAL);
$ampm[1]['name'] = pnVarPrepForDisplay(_PC_PM);
if ($event_startampm == "AM" || $event_startampm == _AM_VAL) {
$ampm[0]['selected'] = 1;
} else {
$ampm[1]['selected'] = 1;
}
$timed_ampm = $output->FormSelectMultiple('event_startampm', $ampm, 0, 1, "", "", false, '');
} else {
$timed_ampm = '';
}
$output->SetOutputMode(_PNH_KEEPOUTPUT);
$tpl->assign('SelectTimedHours', $timed_hours);
$tpl->assign('SelectTimedMinutes', $timed_minutes);
$tpl->assign('SelectTimedAMPM', $timed_ampm);
$tpl->assign('event_startday', $event_startday);
$tpl->assign('event_startmonth', $event_startmonth);
$tpl->assign('event_startyear', $event_startyear);
$tpl->assign('event_starttimeh', $event_starttimeh);
$tpl->assign('event_starttimem', $event_starttimem);
$tpl->assign('event_startampm', $event_startampm);
$tpl->assign('event_dur_hours', $event_dur_hours);
$tpl->assign('event_dur_minutes', $event_dur_minutes);
//=================================================================
// PARSE SELECT_DURATION
//=================================================================
$event_dur_hours = (int) $event_dur_hours;
for ($i = 0; $i <= 24; $i += 1) {
$TimedDurationHours[$i] = array('value' => $i, 'selected' => $event_dur_hours == $i ? 'selected' : '', 'name' => sprintf('%02d', $i));
}
$tpl->assign('TimedDurationHours', $TimedDurationHours);
示例14: pnSessionDestroy
/**
* PHP function to destroy a session
* @private
*/
function pnSessionDestroy($sessid)
{
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
$sessioninfocolumn =& $pntable['session_info_column'];
$sessioninfotable = $pntable['session_info'];
$query = "DELETE FROM {$sessioninfotable}\n WHERE {$sessioninfocolumn['sessid']} = '" . pnVarPrepForStore($sessid) . "'";
$dbconn->Execute($query);
if ($dbconn->ErrorNo() != 0) {
return false;
}
return true;
}
示例15: modules_admin_modify
function modules_admin_modify()
{
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
$output = new pnHTML();
$id = pnVarCleanFromInput('id');
$dbid = pnVarPrepForStore($id);
$modulestable = $pntable['modules'];
$modulescolumn =& $pntable['modules_column'];
$query = "SELECT {$modulescolumn['name']},\n {$modulescolumn['displayname']},\n {$modulescolumn['description']}\n FROM {$modulestable}\n WHERE {$modulescolumn['id']} = {$dbid}";
$result = $dbconn->Execute($query);
if ($result->EOF) {
$output->Text(_ERRMODNOSUCHMODID);
return $output->GetOutput();
}
list($name, $displayname, $description) = $result->fields;
$result->Close();
if (!pnSecAuthAction(0, 'Modules::', "{$name}::{$id}", ACCESS_ADMIN)) {
$output->Text(_MODULESEDITNOAUTH);
return $output->GetOutput();
}
// Start form
$output->FormStart(pnModURL('Modules', 'admin', 'update'));
$output->FormHidden('authid', pnSecGenAuthKey());
$output->FormHidden('id', $id);
// Name
$output->Text(_MODULESNEWNAME);
$output->Linebreak();
$output->FormText('newdisplayname', $displayname, 30, 30);
$output->Linebreak(2);
// Description
$output->Text(_MODULESNEWDESCRIPTION);
$output->Linebreak();
$output->FormText('newdescription', $description, 60, 254);
$output->Linebreak(2);
// Hooks
$hookstable = $pntable['hooks'];
$hookscolumn =& $pntable['hooks_column'];
$sql = "SELECT DISTINCT {$hookscolumn['smodule']},\n {$hookscolumn['tmodule']}\n FROM {$hookstable}\n WHERE {$hookscolumn['smodule']} IS NULL\n OR {$hookscolumn['smodule']} = '" . pnVarPrepForStore($name) . "'\n ORDER BY {$hookscolumn['tmodule']},\n {$hookscolumn['smodule']} DESC";
$result = $dbconn->Execute($sql);
$displayed = array();
for (; !$result->EOF; $result->MoveNext()) {
list($smodname, $tmodname) = $result->fields;
// Only display once
if (isset($displayed[$tmodname])) {
continue;
}
$displayed[$tmodname] = true;
if (!empty($smodname)) {
$checked = 1;
} else {
$checked = 0;
}
$output->Text(_MODULESACTIVATE . ' ' . strtolower($tmodname) . ' ' . _MODULESFORTHIS);
$output->FormCheckbox('hooks_' . pnVarPrepForDisplay($tmodname), $checked);
$output->Linebreak(2);
}
$result->Close();
// End form
$output->FormSubmit(_COMMIT);
$output->FormEnd();
return $output->GetOutput();
}