本文整理汇总了PHP中sql_table函数的典型用法代码示例。如果您正苦于以下问题:PHP sql_table函数的具体用法?PHP sql_table怎么用?PHP sql_table使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sql_table函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SEARCH
function SEARCH($text)
{
global $blogid;
// $text = preg_replace ("/[<,>,=,?,!,#,^,(,),[,\],:,;,\\\,%]/","",$text);
/* * * for jp * * * * * * * * * * */
$this->encoding = strtolower(preg_replace('|[^a-z0-9-_]|i', '', _CHARSET));
if ($this->encoding != 'utf-8') {
$text = mb_convert_encoding($text, "UTF-8", $this->encoding);
}
$text = str_replace(" ", ' ', $text);
$text = preg_replace("/[<>=?!#^()[\\]:;\\%]/", "", $text);
$this->ascii = '[\\x00-\\x7F]';
$this->two = '[\\xC0-\\xDF][\\x80-\\xBF]';
$this->three = '[\\xE0-\\xEF][\\x80-\\xBF][\\x80-\\xBF]';
$this->jpmarked = $this->boolean_mark_atoms_jp($text);
/* * * * * * * * * * * * * * * * */
$this->querystring = $text;
// $this->marked = $this->boolean_mark_atoms($text);
$this->inclusive = $this->boolean_inclusive_atoms($text);
$this->blogs = array();
// get all public searchable blogs, no matter what, include the current blog allways.
$res = sql_query('SELECT bnumber FROM ' . sql_table('blog') . ' WHERE bincludesearch=1 ');
while ($obj = sql_fetch_object($res)) {
$this->blogs[] = intval($obj->bnumber);
}
}
示例2: do_backup
/**
* This function creates an sql dump of the database and sends it to
* the user as a file (can be gzipped if they want)
*
* @requires
* no output may have preceded (new headers are sent)
* @param gzip
* 1 = compress backup file, 0 = no compression (default)
*/
function do_backup($gzip = 0)
{
global $manager;
// tables of which backup is needed
$tables = array(sql_table('actionlog'), sql_table('ban'), sql_table('blog'), sql_table('comment'), sql_table('config'), sql_table('item'), sql_table('karma'), sql_table('member'), sql_table('skin'), sql_table('skin_desc'), sql_table('team'), sql_table('template'), sql_table('template_desc'), sql_table('plugin'), sql_table('plugin_event'), sql_table('plugin_option'), sql_table('plugin_option_desc'), sql_table('category'), sql_table('activation'), sql_table('tickets'));
// add tables that plugins want to backup to the list
// catch all output generated by plugins
ob_start();
$res = sql_query('SELECT pfile FROM ' . sql_table('plugin'));
while ($plugName = sql_fetch_object($res)) {
$plug =& $manager->getPlugin($plugName->pfile);
if ($plug) {
$tables = array_merge($tables, (array) $plug->getTableList());
}
}
ob_end_clean();
// remove duplicates
$tables = array_unique($tables);
// make sure browsers don't cache the backup
header("Pragma: no-cache");
// don't allow gzip compression when extension is not loaded
if ($gzip != 0 && !extension_loaded("zlib")) {
$gzip = 0;
}
if ($gzip) {
// use an output buffer
@ob_start();
@ob_implicit_flush(0);
// set filename
$filename = 'nucleus_db_backup_' . strftime("%Y-%m-%d-%H-%M-%S", time()) . ".sql.gz";
} else {
$filename = 'nucleus_db_backup_' . strftime("%Y-%m-%d-%H-%M-%S", time()) . ".sql";
}
// send headers that tell the browser a file is coming
header("Content-Type: text/x-delimtext; name=\"{$filename}\"");
header("Content-disposition: attachment; filename={$filename}");
// dump header
echo "#\n";
echo "# " . _BACKUP_BACKUPFILE_TITLE . " \n";
echo "# " . _ADMINPAGEFOOT_OFFICIALURL . "\n";
echo "#\n";
echo "# " . _BACKUP_BACKUPFILE_BACKUPDATE . gmdate("d-m-Y H:i:s", time()) . " GMT\n";
global $nucleus;
echo "# " . _BACKUP_BACKUPFILE_NUCLEUSVERSION . $nucleus['version'] . "\n";
echo "#\n";
echo "# " . _BACKUP_WARNING_NUCLEUSVERSION . "\n";
echo "#\n";
// dump all tables
reset($tables);
array_walk($tables, array(&$this, '_backup_dump_table'));
if ($gzip) {
$Size = ob_get_length();
$Crc = crc32(ob_get_contents());
$contents = gzcompress(ob_get_contents());
ob_end_clean();
echo "‹" . substr($contents, 0, strlen($contents) - 4) . $this->gzip_PrintFourChars($Crc) . $this->gzip_PrintFourChars($Size);
}
exit;
}
示例3: getComment
/**
* Returns the requested comment
*
* @static
*/
function getComment($commentid)
{
$query = 'SELECT `cnumber` AS commentid, `cbody` AS body, `cuser` AS user, `cmail` AS userid, `cemail` AS email, `cmember` AS memberid, `ctime`, `chost` AS host, `mname` AS member, `cip` AS ip, `cblog` AS blogid' . ' FROM ' . sql_table('comment') . ' LEFT OUTER JOIN ' . sql_table('member') . ' ON `cmember` = `mnumber`' . ' WHERE `cnumber` = ' . intval($commentid);
$comments = sql_query($query);
$aCommentInfo = sql_fetch_assoc($comments);
if ($aCommentInfo) {
$aCommentInfo['timestamp'] = strtotime($aCommentInfo['ctime']);
}
return $aCommentInfo;
}
示例4: removeBan
/**
* Removes a ban from the banlist (correct iprange is needed as argument)
* Returns 1 on success, 0 on error
*/
function removeBan($blogid, $iprange)
{
global $manager;
$blogid = intval($blogid);
$manager->notify('PreDeleteBan', array('blogid' => $blogid, 'range' => $iprange));
$query = 'DELETE FROM ' . sql_table('ban') . " WHERE blogid={$blogid} and iprange='" . sql_real_escape_string($iprange) . "'";
sql_query($query);
$result = sql_affected_rows() > 0;
$manager->notify('PostDeleteBan', array('blogid' => $blogid, 'range' => $iprange));
return $result;
}
示例5: NP_SpamBayes
function NP_SpamBayes()
{
global $DIR_PLUGINS;
$this->table_cat = sql_table('plug_sb_cat');
// categories
$this->table_wf = sql_table('plug_sb_wf');
// word frequencies
$this->table_ref = sql_table('plug_sb_ref');
// references
$this->table_log = sql_table('plug_sb_log');
// logging
include_once $DIR_PLUGINS . "spambayes/spambayes.php";
$this->spambayes = new NaiveBayesian($this);
}
示例6: event_PostAuthentication
public function event_PostAuthentication(&$data)
{
global $CONF;
static $blogid = 0;
static $blogs = array();
MediaUtils::$lib_path = preg_replace('#/*$#', '', $this->getDirectory());
MediaUtils::$prefix = (bool) $CONF['MediaPrefix'];
MediaUtils::$maxsize = (int) $CONF['MaxUploadSize'];
$suffixes = explode(',', $CONF['AllowedTypes']);
foreach ($suffixes as $suffix) {
$suffix = trim($suffix);
if (!in_array($suffix, MediaUtils::$suffixes)) {
MediaUtils::$suffixes[] = strtolower($suffix);
}
}
$result = sql_query('SELECT bnumber, bshortname FROM ' . sql_table('blog') . ';');
while (FALSE !== ($row = sql_fetch_assoc($result))) {
$blogs[$row['bnumber']] = $row['bshortname'];
}
MediaUtils::$blogs =& $blogs;
if (array_key_exists('blogid', $_GET)) {
$blogid = (int) $_GET['blogid'];
} else {
if (array_key_exists('blogid', $_POST)) {
$blogid = (int) $_POST['blogid'];
} else {
if (array_key_exists('itemid', $_GET) && function_exists('getBlogIDFromItemID')) {
$blogid = (int) getBlogIDFromItemID((int) $_GET['itemid']);
} else {
if (array_key_exists('itemid', $_POST) && function_exists('getBlogIDFromItemID')) {
$blogid = (int) getBlogIDFromItemID((int) $_POST['itemid']);
} else {
if (array_key_exists(MediaUtils::$cookiename, $_COOKIE)) {
$blogid = (int) $_COOKIE['blogid'];
} else {
return;
}
}
}
}
}
MediaUtils::$blogid =& $blogid;
MediaUtils::$bshortname =& MediaUtils::$blogs[MediaUtils::$blogid];
return;
}
示例7: trimLog
/**
* (Static) Method to trim the action log (from over 500 back to 250 entries)
*/
function trimLog()
{
static $checked = 0;
// only check once per run
if ($checked) {
return;
}
// trim
$checked = 1;
$iTotal = quickQuery('SELECT COUNT(*) AS result FROM ' . sql_table('actionlog'));
// if size > 500, drop back to about 250
$iMaxSize = 500;
$iDropSize = 250;
if ($iTotal > $iMaxSize) {
$tsChop = quickQuery('SELECT timestamp as result FROM ' . sql_table('actionlog') . ' ORDER BY timestamp DESC LIMIT ' . $iDropSize . ',1');
sql_query('DELETE FROM ' . sql_table('actionlog') . ' WHERE timestamp < \'' . $tsChop . '\'');
}
}
示例8: doSkinVar
function doSkinVar($skinType, $numOfPostsToShow)
{
global $blog;
if ($numOfPostsToShow <= 0) {
$numOfPostsToShow = 10;
}
$q = "SELECT inumber as id, ititle as title, " . "citem,COUNT(cnumber) as num_of_comments, " . "SUM(SubComment.cVal)*POW(COUNT(cnumber),2)*MAX(SubComment.iVal) as CurrentVal " . "FROM ( " . "SELECT *, " . "SQRT(1.0 / POW((DATEDIFF(c.ctime,CURDATE()) / 365),2)) as cVal," . "SQRT(1.0 / POW((DATEDIFF(i.itime,CURDATE()) / 365),2)) as iVal " . "FROM " . sql_table('comment') . " as c " . "INNER JOIN " . sql_table('item') . " as i " . "ON i.inumber=c.citem) as SubComment " . "GROUP BY inumber, ititle " . "ORDER BY `CurrentVal` DESC " . "LIMIT 0, " . intval($numOfPostsToShow);
$res = mysql_query($q);
echo $this->getOption('header');
$link_templ = $this->getOption('link');
while ($row = mysql_fetch_array($res)) {
$out = str_replace("%l", createItemLink($row[id]), $link_templ);
$out = str_replace("%p", $row['title'], $out);
$out = str_replace("%c", $row['num_of_comments'], $out);
$out = str_replace("%s", $row['CurrentVal'], $out);
echo $out;
}
echo $this->getOption('footer');
}
示例9: export
/**
* Outputs the XML contents of the export file
*
* @param $setHeaders
* set to 0 if you don't want to send out headers
* (optional, default 1)
*/
function export($setHeaders = 1)
{
if ($setHeaders) {
// make sure the mimetype is correct, and that the data does not show up
// in the browser, but gets saved into and XML file (popup download window)
header('Content-Type: text/xml');
header('Content-Disposition: attachment; filename="skinbackup.xml"');
header('Expires: 0');
header('Pragma: no-cache');
}
echo "<nucleusskin>\n";
// meta
echo "\t<meta>\n";
// skins
foreach ($this->skins as $skinId => $skinName) {
$skinName = htmlspecialchars($skinName, ENT_QUOTES);
if (strtoupper(_CHARSET) != 'UTF-8') {
$skinName = mb_convert_encoding($skinName, 'UTF-8', _CHARSET);
}
echo "\t\t" . '<skin name="' . htmlspecialchars($skinName, ENT_QUOTES) . '" />' . "\n";
}
// templates
foreach ($this->templates as $templateId => $templateName) {
$templateName = htmlspecialchars($templateName, ENT_QUOTES);
if (strtoupper(_CHARSET) != 'UTF-8') {
$templateName = mb_convert_encoding($templateName, 'UTF-8', _CHARSET);
}
echo "\t\t" . '<template name="' . htmlspecialchars($templateName, ENT_QUOTES) . '" />' . "\n";
}
// extra info
if ($this->info) {
if (strtoupper(_CHARSET) != 'UTF-8') {
$skin_info = mb_convert_encoding($this->info, 'UTF-8', _CHARSET);
} else {
$skin_info = $this->info;
}
echo "\t\t<info><![CDATA[" . $skin_info . "]]></info>\n";
}
echo "\t</meta>\n\n\n";
// contents skins
foreach ($this->skins as $skinId => $skinName) {
$skinId = intval($skinId);
$skinObj = new SKIN($skinId);
$skinName = htmlspecialchars($skinName, ENT_QUOTES);
$contentT = htmlspecialchars($skinObj->getContentType(), ENT_QUOTES);
$incMode = htmlspecialchars($skinObj->getIncludeMode(), ENT_QUOTES);
$incPrefx = htmlspecialchars($skinObj->getIncludePrefix(), ENT_QUOTES);
$skinDesc = htmlspecialchars($skinObj->getDescription(), ENT_QUOTES);
if (strtoupper(_CHARSET) != 'UTF-8') {
$skinName = mb_convert_encoding($skinName, 'UTF-8', _CHARSET);
$contentT = mb_convert_encoding($contentT, 'UTF-8', _CHARSET);
$incMode = mb_convert_encoding($incMode, 'UTF-8', _CHARSET);
$incPrefx = mb_convert_encoding($incPrefx, 'UTF-8', _CHARSET);
$skinDesc = mb_convert_encoding($skinDesc, 'UTF-8', _CHARSET);
}
echo "\t" . '<skin name="' . $skinName . '" type="' . $contentT . '" includeMode="' . $incMode . '" includePrefix="' . $incPrefx . '">' . "\n";
echo "\t\t" . '<description>' . $skinDesc . '</description>' . "\n";
$que = 'SELECT' . ' stype,' . ' scontent ' . 'FROM ' . sql_table('skin') . ' WHERE' . ' sdesc = ' . $skinId;
$res = sql_query($que);
while ($partObj = sql_fetch_object($res)) {
$type = htmlspecialchars($partObj->stype, ENT_QUOTES);
$cdata = $this->escapeCDATA($partObj->scontent);
if (strtoupper(_CHARSET) != 'UTF-8') {
$type = mb_convert_encoding($type, 'UTF-8', _CHARSET);
$cdata = mb_convert_encoding($cdata, 'UTF-8', _CHARSET);
}
echo "\t\t" . '<part name="' . $type . '">';
echo '<![CDATA[' . $cdata . ']]>';
echo "</part>\n\n";
}
echo "\t</skin>\n\n\n";
}
// contents templates
foreach ($this->templates as $templateId => $templateName) {
$templateId = intval($templateId);
$templateName = htmlspecialchars($templateName, ENT_QUOTES);
$templateDesc = htmlspecialchars(TEMPLATE::getDesc($templateId), ENT_QUOTES);
if (strtoupper(_CHARSET) != 'UTF-8') {
$templateName = mb_convert_encoding($templateName, 'UTF-8', _CHARSET);
$templateDesc = mb_convert_encoding($templateDesc, 'UTF-8', _CHARSET);
}
echo "\t" . '<template name="' . $templateName . '">' . "\n";
echo "\t\t" . '<description>' . $templateDesc . "</description>\n";
$que = 'SELECT' . ' tpartname,' . ' tcontent' . ' FROM ' . sql_table('template') . ' WHERE' . ' tdesc = ' . $templateId;
$res = sql_query($que);
while ($partObj = sql_fetch_object($res)) {
$type = htmlspecialchars($partObj->tpartname, ENT_QUOTES);
$cdata = $this->escapeCDATA($partObj->tcontent);
if (strtoupper(_CHARSET) != 'UTF-8') {
$type = mb_convert_encoding($type, 'UTF-8', _CHARSET);
$cdata = mb_convert_encoding($cdata, 'UTF-8', _CHARSET);
}
echo "\t\t" . '<part name="' . $type . '">';
//.........这里部分代码省略.........
示例10: getSqlItemList
/**
* Returns the SQL query used to fill out templates for a list of items
*
* @param $itemarray
* an array holding the item numbers of the items to be displayed
* @param $showDrafts
* 0=do not show drafts 1=show drafts
* @param $showFuture
* 0=do not show future posts 1=show future posts
* @returns
* either a full SQL query, or an empty string
* @note
* No LIMIT clause is added. (caller should add this if multiple pages are requested)
*/
function getSqlItemList($itemarray, $showDrafts = 0, $showFuture = 0)
{
if (!is_array($itemarray)) {
return '';
}
$showDrafts = intval($showDrafts);
$showFuture = intval($showFuture);
$items = array();
foreach ($itemarray as $value) {
if (intval($value)) {
$items[] = intval($value);
}
}
if (!count($items)) {
return '';
}
//$itemlist = implode(',',$items);
$i = count($items);
$query = '';
foreach ($items as $value) {
$query .= '(' . 'SELECT' . ' i.inumber as itemid,' . ' i.ititle as title,' . ' i.ibody as body,' . ' m.mname as author,' . ' m.mrealname as authorname,' . ' i.itime,' . ' i.imore as more,' . ' m.mnumber as authorid,' . ' m.memail as authormail,' . ' m.murl as authorurl,' . ' c.cname as category,' . ' i.icat as catid,' . ' i.iclosed as closed';
$query .= ' FROM ' . sql_table('item') . ' as i, ' . sql_table('member') . ' as m, ' . sql_table('category') . ' as c' . ' WHERE' . ' i.iblog = ' . $this->blogid . ' and i.iauthor = m.mnumber' . ' and i.icat = c.catid';
if (!$showDrafts) {
$query .= ' and i.idraft=0';
}
// exclude drafts
if (!$showFuture) {
$query .= ' and i.itime<=' . mysqldate($this->getCorrectTime());
}
// don't show future items
//$query .= ' and i.inumber IN ('.$itemlist.')';
$query .= ' and i.inumber = ' . intval($value);
$query .= ')';
$i--;
if ($i) {
$query .= ' UNION ';
}
}
return $query;
}
示例11: doAction
function doAction($type = '')
{
global $CONF, $manager;
if (!$type) {
$type = 'google';
}
if ($type !== 'google' && $type !== 'yahoo') {
return;
}
$sitemap = array();
$blog_res = sql_query('SELECT * FROM ' . sql_table('blog'));
while ($blog = sql_fetch_array($blog_res)) {
if ($this->getBlogOption($blog['bnumber'], 'IncludeSitemap') == 'yes') {
if ($blog['bnumber'] != $CONF['DefaultBlog']) {
$sitemap[] = array('loc' => $this->_prepareLink($blog['bnumber'], createBlogidLink($blog['bnumber'])), 'priority' => '1.0', 'changefreq' => 'daily');
} else {
$sitemap[] = array('loc' => $blog['burl'], 'priority' => '1.0', 'changefreq' => 'daily');
}
$params = array(sql_table('category'), $blog['bnumber']);
$cat_res = sql_query(vsprintf('SELECT * FROM %s WHERE cblog=%s ORDER BY catid', $params));
while ($cat = sql_fetch_array($cat_res)) {
$sitemap[] = array('loc' => $this->_prepareLink($blog['bnumber'], createCategoryLink($cat['catid'])), 'priority' => '1.0', 'changefreq' => 'daily');
}
$b =& $manager->getBlog($blog['bnumber']);
$item_res = sql_query('
SELECT
*,
UNIX_TIMESTAMP(itime) AS timestamp
FROM
' . sql_table('item') . '
WHERE
iblog = ' . $blog['bnumber'] . ' AND
idraft = 0
AND itime <= ' . mysqldate($b->getCorrectTime()) . '
ORDER BY
inumber DESC
');
$now = $_SERVER['HTTP_REQUEST_TIME'];
while ($item = sql_fetch_array($item_res)) {
$tz = date('O', $item['timestamp']);
$tz = substr($tz, 0, 3) . ':' . substr($tz, 3, 2);
$pasttime = $now - $item['timestamp'];
if ($pasttime < 86400 * 2) {
$fq = 'hourly';
} elseif ($pasttime < 86400 * 14) {
$fq = 'daily';
} elseif ($pasttime < 86400 * 62) {
$fq = 'weekly';
} else {
$fq = 'monthly';
}
$sitemap[] = array('loc' => $this->_prepareLink($blog['bnumber'], createItemLink($item['inumber'])), 'lastmod' => gmdate('Y-m-d\\TH:i:s', $item['timestamp']) . $tz, 'priority' => '1.0', 'changefreq' => $fq);
}
}
}
$eventdata = array('sitemap' => &$sitemap);
$manager->notify('SiteMap', $eventdata);
if ($type == 'google') {
header("Content-type: application/xml");
echo "<?xml version='1.0' encoding='UTF-8'?>\n\n";
echo "<urlset xmlns='http://www.sitemaps.org/schemas/sitemap/0.9' ";
echo "xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' ";
echo "xsi:schemaLocation='http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd'>\n";
$tpl = "\t\t<%s>%s</%s>\n";
foreach ($sitemap as $url) {
echo "\t<url>\n";
foreach ($url as $key => $value) {
echo sprintf($tpl, $key, htmlspecialchars($value, ENT_QUOTES, _CHARSET), $key);
}
echo "\t</url>\n";
}
echo "</urlset>\n";
} else {
header("Content-type: text/plain");
foreach ($sitemap as $url) {
echo $url['loc'] . "\n";
}
}
exit;
}
示例12: _getRecentItems
/**
* Returns a list of recent items (Nucleus Version)
* ($amount = max 20);
*/
function _getRecentItems($blogid, $username, $password, $amount)
{
$blogid = intval($blogid);
$amount = intval($amount);
// 1. login
$mem = new MEMBER();
if (!$mem->login($username, $password)) {
return _error(1, "Could not log in");
}
// 2. check if allowed
if (!BLOG::existsID($blogid)) {
return _error(2, "No such blog ({$blogid})");
}
if (!$mem->teamRights($blogid)) {
return _error(3, "Not a team member");
}
$amount = intval($amount);
if ($amount < 1 or $amount > 20) {
return _error(5, "Amount parameter must be in range 1..20");
}
// 3. create and return list of recent items
// Struct returned has dateCreated, userid, blogid and content
$structarray = array();
// the array in which the structs will be stored
$query = "SELECT ibody, iauthor, ibody, imore, ititle, iclosed, idraft, itime" . ' FROM ' . sql_table('item') . " WHERE iblog={$blogid}" . " ORDER BY itime DESC" . " LIMIT {$amount}";
$r = sql_query($query);
while ($obj = sql_fetch_object($r)) {
$newstruct = new xmlrpcval(array("publishDate" => new xmlrpcval(iso8601_encode(strtotime($obj->itime)), "dateTime.iso8601"), "userid" => new xmlrpcval($obj->iauthor, "string"), "blogid" => new xmlrpcval($blogid, "string"), "title" => new xmlrpcval($obj->ititle, "string"), "body" => new xmlrpcval($obj->ibody, "string"), "more" => new xmlrpcval($obj->imore, "string"), "draft" => new xmlrpcval($obj->idraft, "boolean"), "closed" => new xmlrpcval($obj->iclosed, "boolean")), 'struct');
array_push($structarray, $newstruct);
}
return new xmlrpcresp(new xmlrpcval($structarray, "array"));
}
示例13: _insertPluginOptions
/**
* @static
* @todo document this
*/
function _insertPluginOptions($context, $contextid = 0)
{
// get all current values for this contextid
// (note: this might contain doubles for overlapping contextids)
$aIdToValue = array();
$res = sql_query('SELECT oid, ovalue FROM ' . sql_table('plugin_option') . ' WHERE ocontextid=' . intval($contextid));
while ($o = sql_fetch_object($res)) {
$aIdToValue[$o->oid] = $o->ovalue;
}
// get list of oids per pid
$query = 'SELECT * FROM ' . sql_table('plugin_option_desc') . ',' . sql_table('plugin') . ' WHERE opid=pid and ocontext=\'' . sql_real_escape_string($context) . '\' ORDER BY porder, oid ASC';
$res = sql_query($query);
$aOptions = array();
while ($o = sql_fetch_object($res)) {
if (in_array($o->oid, array_keys($aIdToValue))) {
$value = $aIdToValue[$o->oid];
} else {
$value = $o->odef;
}
array_push($aOptions, array('pid' => $o->pid, 'pfile' => $o->pfile, 'oid' => $o->oid, 'value' => $value, 'name' => $o->oname, 'description' => $o->odesc, 'type' => $o->otype, 'typeinfo' => $o->oextra, 'contextid' => $contextid, 'extra' => ''));
}
global $manager;
$manager->notify('PrePluginOptionsEdit', array('context' => $context, 'contextid' => $contextid, 'options' => &$aOptions));
$iPrevPid = -1;
foreach ($aOptions as $aOption) {
// new plugin?
if ($iPrevPid != $aOption['pid']) {
$iPrevPid = $aOption['pid'];
if (!defined('_PLUGIN_OPTIONS_TITLE')) {
define('_PLUGIN_OPTIONS_TITLE', 'Options for %s');
}
echo '<tr><th colspan="2">' . sprintf(_PLUGIN_OPTIONS_TITLE, htmlspecialchars($aOption['pfile'], ENT_QUOTES)) . '</th></tr>';
}
$meta = NucleusPlugin::getOptionMeta($aOption['typeinfo']);
if (@$meta['access'] != 'hidden') {
echo '<tr>';
listplug_plugOptionRow($aOption);
echo '</tr>';
}
}
}
示例14: RegistPath
function RegistPath($objID, $path, $bid, $oParam, $name, $new = FALSE)
{
global $CONF;
switch ($oParam) {
case 'item':
case 'member':
if (preg_match('/.html$/', $path)) {
$path = substr($path, 0, -5);
}
break;
case 'blog':
case 'category':
case 'subcategory':
break;
default:
return;
break;
}
$bid = intval($bid);
$objID = intval($objID);
$name = rawurlencode($name);
if ($new && $oParam == 'item') {
$tque = 'SELECT itime as result FROM %s WHERE inumber = %d';
$itime = quickQuery(sprintf($tque, sql_table('item'), $objID));
list($y, $m, $d, $trush) = sscanf($itime, '%d-%d-%d %s');
$param['year'] = sprintf('%04d', $y);
$param['month'] = sprintf('%02d', $m);
$param['day'] = sprintf('%02d', $d);
$dfItem = $this->getOption('customurl_dfitem');
$ikey = TEMPLATE::fill($dfItem, $param);
if ($path == $ikey) {
$path = $ikey . '_' . $objID;
}
} elseif (!$new && strlen($path) == 0) {
$del_que = 'DELETE FROM %s WHERE obj_id = %d AND obj_param = "%s"';
sql_query(sprintf($del_que, _CUSTOMURL_TABLE, $objID, $oParam));
$msg = array(0, _DELETE_PATH, $name, _DELETE_MSG);
return $msg;
exit;
}
$dotslash = array('.', '/');
$path = str_replace($dotslash, '_', $path);
if (!preg_match('/^[-_a-zA-Z0-9]+$/', $path)) {
$msg = array(1, _INVALID_ERROR, $name, _INVALID_MSG);
return $msg;
exit;
}
$tempPath = $path;
if ($oParam == 'item' || $oParam == 'member') {
$tempPath .= '.html';
}
$conf_que = 'SELECT obj_id FROM %s' . ' WHERE obj_name = "%s"' . ' AND obj_bid = %d' . ' AND obj_param = "%s"' . ' AND obj_id != %d';
$res = sql_query(sprintf($conf_que, _CUSTOMURL_TABLE, $tempPath, $bid, $oParam, $objID));
if ($res && sql_num_rows($res)) {
$msg = array(0, _CONFLICT_ERROR, $name, _CONFLICT_MSG);
$path .= '_' . $objID;
}
if ($oParam == 'category' && !$msg) {
$conf_cat = 'SELECT obj_id FROM %s WHERE obj_name = "%s"' . ' AND obj_param = "blog"';
$res = sql_query(sprintf($conf_cat, _CUSTOMURL_TABLE, $tempPath));
if ($res && sql_num_rows($res)) {
$msg = array(0, _CONFLICT_ERROR, $name, _CONFLICT_MSG);
$path .= '_' . $objID;
}
}
if ($oParam == 'blog' && !$msg) {
$conf_blg = 'SELECT obj_id FROM %s WHERE obj_name = "%s"' . ' AND obj_param = "category"';
$res = sql_query(sprintf($conf_blg, _CUSTOMURL_TABLE, $tempPath));
if ($res && sql_num_rows($res)) {
$msg = array(0, _CONFLICT_ERROR, $name, _CONFLICT_MSG);
$path .= '_' . $objID;
}
}
$newPath = $path;
if ($oParam == 'item' || $oParam == 'member') {
$newPath .= '.html';
}
$query = 'SELECT * FROM %s WHERE obj_id = %d AND obj_param = "%s"';
$res = sql_query(sprintf($query, _CUSTOMURL_TABLE, $objID, $oParam));
$row = sql_fetch_object($res);
$pathID = $row->id;
if ($pathID) {
$query = 'UPDATE %s SET obj_name = "%s" WHERE id = %d';
sql_query(sprintf($query, _CUSTOMURL_TABLE, $newPath, $pathID));
} else {
$query = 'INSERT INTO %s (obj_param, obj_name, obj_id, obj_bid)' . ' VALUES ("%s", "%s", %d, %d)';
sql_query(sprintf($query, _CUSTOMURL_TABLE, $oParam, $newPath, $objID, $bid));
}
switch ($oParam) {
case 'blog':
$this->setBlogOption($objID, 'customurl_bname', $path);
break;
case 'category':
$this->setCategoryOption($objID, 'customurl_cname', $path);
break;
case 'member':
$this->setMemberOption($objID, 'customurl_mname', $path);
break;
default:
break;
//.........这里部分代码省略.........
示例15: _getRecentItemsBlogger
/**
* Returns a list of recent items
*/
function _getRecentItemsBlogger($blogid, $username, $password, $amount)
{
$blogid = intval($blogid);
$amount = intval($amount);
// 1. login
$mem = new MEMBER();
if (!$mem->login($username, $password)) {
return _error(1, "Could not log in");
}
// 2. check if allowed
if (!BLOG::existsID($blogid)) {
return _error(2, "No such blog ({$blogid})");
}
if (!$mem->teamRights($blogid)) {
return _error(3, "Not a team member");
}
$amount = intval($amount);
if ($amount < 1 or $amount > 20) {
return _error(5, "Amount parameter must be in range 1..20");
}
// 3. create and return list of recent items
// Struct returned has dateCreated, userid, blogid and content
$blog = new BLOG($blogid);
$structarray = array();
// the array in which the structs will be stored
$query = "SELECT mname, ibody, iauthor, ibody, inumber, ititle as title, itime, cname as category" . ' FROM ' . sql_table('item') . ', ' . sql_table('category') . ', ' . sql_table('member') . " WHERE iblog={$blogid} and icat=catid and iauthor=mnumber" . " ORDER BY itime DESC" . " LIMIT {$amount}";
$r = sql_query($query);
while ($row = sql_fetch_assoc($r)) {
// remove linebreaks if needed
if ($blog->convertBreaks()) {
$row['ibody'] = removeBreaks($row['ibody']);
}
$content = blogger_specialTags($row) . $row['ibody'];
$newstruct = new xmlrpcval(array("userid" => new xmlrpcval($row['iauthor'], "string"), "dateCreated" => new xmlrpcval(iso8601_encode(strtotime($row['itime'])), "dateTime.iso8601"), "blogid" => new xmlrpcval($blogid, "string"), "content" => new xmlrpcval($content, "string"), "postid" => new xmlrpcval($row['inumber'], "string"), "authorName" => new xmlrpcval($row['mname'], 'string'), "title" => new xmlrpcval($row['title'], 'string')), 'struct');
array_push($structarray, $newstruct);
}
return new xmlrpcresp(new xmlrpcval($structarray, "array"));
}