本文整理汇总了PHP中pnDBGetTables函数的典型用法代码示例。如果您正苦于以下问题:PHP pnDBGetTables函数的具体用法?PHP pnDBGetTables怎么用?PHP pnDBGetTables使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pnDBGetTables函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
}
示例2: 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;
}
}
}
示例3: 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) . "'");
}
示例4: smarty_resource_userdb_fetch
/**
* Smarty plugin
* -------------------------------------------------------------
* Type: resource
* Name: userdb
* Purpose: read user maintained source as a template
* $tpl_name is parsed as a uri type of string where
* the path to the template field is encoded as:
*
* table/source_field?field=condtional&field=conditional...
*
* results in:
* SELECT source_field FROM table WHERE conditions...
* -------------------------------------------------------------
*/
function smarty_resource_userdb_fetch($tpl_name, &$tpl_source, &$smarty, $default = false)
{
$_url = parse_url($tpl_name);
// (required) expected syntax: table/source_field
$_path_items = explode('/', $_url['path']);
$table = $_path_items[0];
$source = $_path_items[1];
// Theme Configuration
$skinid = pnModAPIFunc('Xanthia', 'user', 'getSkinID', array('skin' => $table));
$dbconn =& pnDBGetConn(true);
$pntable =& pnDBGetTables();
$table = $pntable['theme_tplsource'];
$column =& $pntable['theme_tplsource_column'];
$query = "SELECT {$column['tpl_source']}\n\t\t\t\t\tFROM {$table}\n\t\t\t\t\tWHERE {$column['tpl_file_name']}='{$source}'\n\t\t\t\t\tAND {$column['tpl_skin_id']}= '{$skinid}' LIMIT 1";
$result =& $dbconn->Execute($query);
if ($result->EOF) {
} else {
list($tpl_source) = $result->fields;
}
$result->MoveNext();
$result->Close();
if ($tpl_source) {
return true;
} else {
return $default;
}
}
示例5: Upgrade
/**
* upgrade
*
* @todo recode using DBUtil
*/
public function Upgrade($oldversion) {
switch ($oldversion) {
case '0.2':
// Create the system init hook (previous versions are for Zikula 1.2)
EventUtil::registerPersistentModuleHandler('IWstats', 'core.postinit', array('IWstats_Listeners', 'coreinit'));
case '3.0.0':
// Add new fields. Stop in case of error
if (!DBUtil::changeTable('IWstats')) {
return false;
}
// Create indexes. Don't stop in case of error
$table = pnDBGetTables();
$c = $table['IWstats_column'];
DBUtil::createIndex($c['ipForward'], 'IWstats', 'ipForward');
DBUtil::createIndex($c['ipClient'], 'IWstats', 'ipClient');
DBUtil::createIndex($c['userAgent'], 'IWstats', 'userAgent');
break;
}
// Update successful
return true;
}
示例6: mediashare_mediahandlerapi_getHandlerInfo
function mediashare_mediahandlerapi_getHandlerInfo($args)
{
$dom = ZLanguage::getModuleDomain('mediashare');
$mimeType = strtolower($args['mimeType']);
$filename = strtolower($args['filename']);
if (!empty($filename)) {
$dotPos = strpos($filename, '.');
if ($dotPos === false) {
$fileType = '';
} else {
$fileType = substr($filename, $dotPos + 1);
}
} else {
$fileType = '';
}
$pntable = pnDBGetTables();
$handlersTable = $pntable['mediashare_mediahandlers'];
$handlersColumn = $pntable['mediashare_mediahandlers_column'];
$sql = "SELECT DISTINCT {$handlersColumn['handler']},\r\n {$handlersColumn['foundMimeType']},\r\n {$handlersColumn['foundFileType']}\r\n FROM {$handlersTable}\r\n WHERE {$handlersColumn['mimeType']} = '" . DataUtil::formatForStore($mimeType) . "'\r\n OR {$handlersColumn['fileType']} = '" . DataUtil::formatForStore($fileType) . "'\r\n\t\t\t\t\t\t\t\t\t\t\t\tAND {$handlersColumn['active']} =\t1 ";
$result = DBUtil::executeSQL($sql);
$errormsg = __f('Unable to locate media handler for \'%1$s\' (%2$s)', array($filename, $mimeType), $dom);
if ($result === false) {
return LogUtil::registerError(__f('Error in %1$s: %2$s.', array('mediahandlerapi.getHandlerInfo', $errormsg), $dom));
}
if (!$result) {
return LogUtil::registerError($errormsg);
}
$colArray = array('handlerName', 'mimeType', 'fileType');
$handler = DBUtil::marshallObjects($result, $colArray);
return $handler[0];
}
示例7: 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);
}
示例8: Lenses_adminapi_delete
function Lenses_adminapi_delete($args)
{
// Permission check.
if (!pnSecAuthAction(0, 'Lenses::', '::', ACCESS_ADMIN)) {
pnSessionSetVar('errormsg', _MODULENOAUTH);
return false;
}
// Extract arguments.
extract($args);
// Ensure valid values were passed in.
if (empty($tid) || !is_numeric($tid) || empty($item_type) || !is_string($item_type)) {
pnSessionSetVar('errormsg', _MODARGSERROR);
return false;
}
// Call API function to verify bifocal type exists.
$item_exists = pnModAPIFunc('Lenses', 'user', 'get', array('tid' => $tid, 'item_type' => $item_type));
// Verify sphere exists.
if (!$item_exists) {
pnSessionSetVar('errormsg', _NOSUCHITEM);
return false;
}
// Get a reference to the database object.
$dbconn =& pnDBGetConn(true);
// Get a reference to PostNuke's table info.
$pntable =& pnDBGetTables();
switch ($item_type) {
case 'lens':
$table =& $pntable['lenses'];
$field =& $pntable['lenses_column'];
break;
case 'company':
$table =& $pntable['lenses_companies'];
$field =& $pntable['lenses_companies_column'];
break;
case 'polymer':
$table =& $pntable['lenses_polymers'];
$field =& $pntable['lenses_polymers_column'];
break;
default:
break;
}
// Create an sql query to delete the sphere.
$sql = "DELETE FROM {$table} WHERE {$field['tid']} = '" . (int) $tid . "'";
// Execute the SQL query.
$result = $dbconn->Execute($sql);
// Check for any database errors.
if ($dbconn->ErrorNo() != 0) {
pnSessionSetVar('errormsg', _DELETEFAILED);
return false;
}
// Start a new output object.
// This function isn't an output function, but needs an output
// object started before the cache can be cleared.
$pnRender =& new pnRender('Lenses');
// Clear the cache.
$pnRender->clear_cache();
// Return success.
return true;
}
示例9: 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;
}
}
}
示例10: blocks_topic_block
function blocks_topic_block($row)
{
//global $topic, $catid;
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
$currentlang = pnUserGetLang();
if (!pnSecAuthAction(0, 'Topicblock::', "{$row['title']}::", ACCESS_READ)) {
return;
}
$language = pnConfigGetVar('language');
$topic = "";
$catid = "";
if (pnConfigGetVar('multilingual') == 1) {
$column =& $pntable['stories_column'];
$querylang = "AND ({$column['alanguage']}='{$currentlang}' OR {$column['alanguage']}='')";
/* the OR is needed to display stories who are posted to ALL languages */
} else {
$querylang = '';
}
$column =& $pntable['topics_column'];
$result = $dbconn->Execute("SELECT {$column['topicid']} AS topicid, {$column['topicname']} as topicname FROM {$pntable['topics']} ORDER BY topicname");
if ($result->EOF) {
return;
} else {
$boxstuff = '<span class="pn-normal">';
if ($topic == "") {
$boxstuff .= "<strong><big>·</big></strong> <b><a href=\"modules.php?op=modload&name=Topics&file=index\">" . _ALL_TOPICS . "</a></b><br>";
} else {
$boxstuff .= "<strong><big>·</big></strong> <a href=\"modules.php?op=modload&name=News&file=index&catid={$catid}\">" . _ALL_TOPICS . "</a><br>";
}
while (!$result->EOF) {
$srow = $result->GetRowAssoc(false);
$result->MoveNext();
if (pnSecAuthAction(0, 'Topics::Topic', "{$srow['topicname']}::{$srow['topicid']}", ACCESS_READ)) {
$column =& $pntable['stories_column'];
$result2 = $dbconn->Execute("SELECT {$column['time']} AS unixtime FROM {$pntable['stories']} WHERE {$column['topic']}={$srow['topicid']} {$querylang} 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 ($topic == $srow['topicid']) {
$boxstuff .= "<strong><big>·</big></strong> <span class=\"pn-title\"><b>{$srow['topicname']}</b></span> <span class=\"pn-sub\">({$sdate})</span><br>";
} else {
$boxstuff .= "<strong><big>·</big></strong> <a class=\"pn-normal\" href=\"modules.php?op=modload&name=News&file=index&catid={$catid}&topic={$srow['topicid']}\">{$srow['topicname']}</a> <span class=\"pn-sub\">({$sdate})</span><br>";
}
}
}
}
}
$boxstuff .= '</span>';
if (empty($row['title'])) {
$row['title'] = _TOPICS;
}
$row['content'] = $boxstuff;
return themesideblock($row);
}
示例11: admin_menu
function admin_menu($help_file = '')
{
$pntable = pnDBGetTables();
list($newsubs) = db_select_one_row("SELECT count(*) FROM {$pntable['queue']}");
if (!pnSecAuthAction(0, "::", '::', ACCESS_EDIT)) {
// suppress admin display - return to index.
pnRedirect('index.php');
} else {
menu_title('admin.php', _ADMINMENU);
menu_graphic(pnConfigGetVar('admingraphic'));
if ($help_file != '') {
menu_help($help_file, _ONLINEMANUAL);
}
$mods = pnModGetAdminMods();
if ($mods == false) {
// there aren't admin modules
return;
}
foreach ($mods as $mod) {
// Hack until the new news module comes into being
// TODO - remove this at appropriate time
if ($mod['name'] == 'AddStory') {
$mod['name'] = 'Stories';
}
if (pnSecAuthAction(0, "{$mod['name']}::", '::', ACCESS_EDIT)) {
if (file_exists("modules/" . pnVarPrepForOS($mod['directory']) . "/pnadmin.php")) {
$file = "modules/" . pnVarPrepForOS($mod['directory']) . "/pnimages/admin.";
if (file_exists($file . 'gif')) {
$imgfile = $file . 'gif';
} elseif (file_exists($file . 'jpg')) {
$imgfile = $file . 'jpg';
} elseif (file_exists($file . 'png')) {
$imgfile = $file . 'png';
} else {
$imgfile = 'modules/NS-Admin/images/default.gif';
}
menu_add_option(pnVarPrepForDisplay(pnModURL($mod['name'], 'admin')), $mod['displayname'], $imgfile);
} else {
$file = "modules/" . pnVarPrepForOS($mod['directory']) . "/images/admin.";
if (file_exists($file . 'gif')) {
$imgfile = $file . 'gif';
} elseif (file_exists($file . 'jpg')) {
$imgfile = $file . 'jpg';
} elseif (file_exists($file . 'png')) {
$imgfile = $file . 'png';
} else {
$imgfile = 'modules/NS-Admin/images/default.gif';
}
menu_add_option("admin.php?module={$mod['directory']}&op=main", $mod['displayname'], $imgfile);
}
}
}
}
}
示例12: 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);
}
示例13: mediashare_sourcesapi_addSource
function mediashare_sourcesapi_addSource($args)
{
$dom = ZLanguage::getModuleDomain('mediashare');
$title = $args['title'];
$name = $args['name'];
$pntable = pnDBGetTables();
$sourcesColumn = $pntable['mediashare_sources_column'];
$source = array('name' => $name, 'title' => $title, 'formEncType' => '');
$result = DBUtil::insertObject($source, 'mediashare_sources', 'id');
if ($result === false) {
return LogUtil::registerError(__f('Error in %1$s: %2$s.', array('sourcesapi.addSource', 'Could not add a source.'), $dom));
}
return true;
}
示例14: blocks_weblinks_display
function blocks_weblinks_display($row)
{
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
if (!pnSecAuthAction(0, 'Weblinksblock::', "{$row['title']}::", ACCESS_READ)) {
return;
}
$url = explode('|', $row['url']);
if (!$url[0]) {
$row['content'] = 'You forgot to set the module name!';
return themesideblock($row);
}
if (!$url[1]) {
$url[1] = 10;
}
$links_col =& $pntable['links_links_column'];
$linksok = 0;
$linkcount = 0;
$result = $dbconn->Execute("SELECT {$links_col['cat_id']}, {$links_col['title']} FROM {$pntable['links_links']} ORDER BY {$links_col['date']} DESC");
while (list($cid, $title) = $result->fields) {
$result->MoveNext();
$linkcount++;
if (pnSecAuthAction(0, "Web Links::Category", "{$title}::{$cid}", ACCESS_READ)) {
$linksok++;
}
if ($linksok == $url[1]) {
break;
}
}
$oldurl = $url[1];
$url[1] = $linkcount;
$row['content'] = '<span class="pn-normal">';
$links_col =& $pntable['links_links_column'];
$cats_col =& $pntable['links_categories_column'];
$sql = "SELECT {$links_col['lid']} as lid, {$links_col['cat_id']} as catid, {$links_col['title']} as title, {$links_col['description']} as description, {$links_col['hits']} as hits, IF({$links_col['cat_id']}, CONCAT('/', {$cats_col['title']}), {$cats_col['title']}) AS cattitle\n FROM {$pntable['links_links']}\n LEFT JOIN {$pntable['links_categories']}\n ON {$cats_col['cat_id']}={$links_col['cat_id']}\n ORDER BY {$links_col['date']} DESC";
$result = $dbconn->SelectLimit($sql, $url[1]);
while (!$result->EOF) {
$lrow = $result->GetRowAssoc(false);
if (pnSecAuthAction(0, "Web Links::Category", "{$lrow['cattitle']}::{$lrow['catid']}", ACCESS_READ)) {
$lrow['title'] = pnVarPrepForDisplay($lrow['title']);
$lrow['description'] = pnVarPrepHTMLDisplay($lrow['description']);
$lrow['cattitle'] = pnVarPrepForDisplay($lrow['cattitle']);
$row['content'] .= "<strong><big>·</big></strong> <a href=\"modules.php?op=modload&name={$url['0']}&file=index&req=visit&lid={$lrow['lid']}\" target=\"_blank\" title=\"{$lrow['cattitle']}:\n{$lrow['description']}\" class=\"pn-sub\">{$lrow['title']}</a><br>\n";
$result->MoveNext();
}
}
//$row['content'] .= "<div align=\"right\"><font class=\"pn-sub\"><a href=\"modules.php?op=modload&name=Web_Links&file=index&req=NewLinks&newlinkshowdays=10\">"._READMORE."</a></font></div>";
$row['content'] .= '</span>';
return themesideblock($row);
}
示例15: dplink_user_main
function dplink_user_main()
{
$url = trim(pnModGetVar('dplink', 'url'));
$window = pnModGetVar('dplink', 'use_window');
$wrap = pnModGetVar('dplink', 'use_postwrap');
$user_data = array();
$home = pnGetBaseURL();
$home .= 'user.php?op=loginscreen&module=NS-User';
if (!pnUserLoggedIn()) {
pnRedirect($home);
}
// We need to get the user password string from the database
$uid = pnUserGetVar('uid');
list($dbconn) = pnDBGetConn();
$pntables = pnDBGetTables();
$usertable = $pntables['users'];
$usercol =& $pntables['users_column'];
$sql = "SELECT {$usercol['uname']}, {$usercol['pass']}, {$usercol['name']}, {$usercol['email']} " . "FROM {$usertable} WHERE {$usercol['uid']} = {$uid}";
$result = $dbconn->Execute($sql);
if ($dbconn->ErrorNo() != 0) {
die('Could not get user details');
}
if ($result->EOF) {
die('Could not get user detail');
}
list($uname, $password, $user_name, $user_email) = $result->fields;
$result->Close();
$user_data['login'] = $uname;
$user_data['passwd'] = $password;
$user_data['name'] = $user_name;
$user_data['email'] = $user_email;
$parm = serialize($user_data);
$check = md5($parm);
$cparm = gzcompress($parm);
$bparm = urlencode(base64_encode($cparm));
if ($window) {
$url .= '/index.php?login=pn&userdata=' . $bparm . '&check=' . $check;
header('Location: ' . $url);
} else {
$url .= '/index.php?login=pn%26userdata=' . $bparm . '%26check=' . $check;
if ($wrap) {
header('Location: modules.php?op=modload&name=PostWrap&file=index&page=' . $url);
} else {
header('Location: modules.php?op=modload&name=dplink&file=index&url=' . $url);
}
}
exit;
}