本文整理汇总了PHP中serendipity_db_bool函数的典型用法代码示例。如果您正苦于以下问题:PHP serendipity_db_bool函数的具体用法?PHP serendipity_db_bool怎么用?PHP serendipity_db_bool使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了serendipity_db_bool函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: event_hook
function event_hook($event, &$bag, &$eventData, $addData = null)
{
global $serendipity;
$hooks =& $bag->get('event_hooks');
if (isset($hooks[$event])) {
switch ($event) {
case 'frontend_display':
foreach ($this->markup_elements as $temp) {
if (serendipity_db_bool($this->get_config($temp['name'], true)) && isset($eventData[$temp['element']]) && !$eventData['properties']['ep_disable_markup_' . $this->instance] && !in_array($this->instance, (array) $serendipity['POST']['properties']['disable_markups'])) {
@(include_once 'Cache/Lite.php');
if (!class_exists('Cache_Lite')) {
$this->debugMsg('Cache_Lite not available.');
return false;
}
$options = array('cacheDir' => $serendipity['serendipityPath'] . 'templates_c/', 'lifeTime' => 604800, 'hashedDirectoryLevel' => 2, 'automaticCleaningFactor' => 200);
$this->cache = new Cache_Lite($options);
$element = $temp['element'];
$eventData[$element] = $this->autotitle($eventData[$element]);
}
}
return true;
break;
default:
return false;
}
} else {
return false;
}
}
示例2: generate_content
function generate_content(&$title)
{
global $serendipity;
$title = $this->title;
?>
<div class="serendipityPlug">
<?php
if (serendipity_db_bool($this->get_config('image', 'true'))) {
?>
<a title="<?php
echo $title;
?>
Serendipity" href="http://www.s9y.org/"><img src="<?php
echo serendipity_getTemplateFile('img/s9y_banner_small.png');
?>
" alt="Serendipity PHP Weblog" style="border: 0px" /></a>
<?php
}
if (serendipity_db_bool($this->get_config('text', 'false'))) {
?>
<div>
<a title="<?php
echo $title;
?>
Serendipity" href="http://www.s9y.org/">Serendipity PHP Weblog</a>
</div>
<?php
}
?>
</div>
<?php
}
示例3: setupDB
function setupDB()
{
global $serendipity;
if (serendipity_db_bool($this->get_config('db_built4', false))) {
return true;
}
if (serendipity_db_bool($this->get_config('db_built3', false))) {
$sql = "UPDATE {$serendipity['dbPrefix']}mycalendar SET eventdate2 = eventdate WHERE (eventdate2 = 0) OR eventdate2 IS NULL;";
serendipity_db_schema_import($sql);
$this->set_config('db_built4', 'true');
return true;
}
if (serendipity_db_bool($this->get_config('db_built2', false))) {
$sql = "ALTER TABLE {$serendipity['dbPrefix']}mycalendar ADD eventdate2 int(10) {UNSIGNED} default null;";
serendipity_db_schema_import($sql);
$this->set_config('db_built3', 'true');
return true;
}
if (serendipity_db_bool($this->get_config('db_built', false))) {
$sql = "ALTER TABLE {$serendipity['dbPrefix']}mycalendar ADD eventurltitle varchar(255) default null;";
serendipity_db_schema_import($sql);
$this->set_config('db_built2', 'true');
return true;
}
$sql = "CREATE TABLE {$serendipity['dbPrefix']}mycalendar (\n eventid {AUTOINCREMENT} {PRIMARY},\n eventname varchar(255) NOT NULL default '',\n eventurl varchar(255) NOT NULL default '',\n eventurltitle varchar(255) NOT NULL default '',\n eventdate int(10) {UNSIGNED} default null,\n eventdate2 int(10) {UNSIGNED} default null,\n eventcategory varchar(255) NOT NULL default '',\n eventtype varchar(255) NOT NULL default ''\n );";
serendipity_db_schema_import($sql);
$this->set_config('db_built4', 'true');
}
示例4: event_hook
function event_hook($event, &$bag, &$eventData, $addData = null)
{
global $serendipity;
$hooks =& $bag->get('event_hooks');
if (isset($hooks[$event])) {
switch ($event) {
case 'frontend_saveComment':
if (!is_array($eventData) || serendipity_db_bool($eventData['allow_comments'])) {
$serendipity['csuccess'] = 'true';
if ($this->bogo($addData)) {
$eventData = array('allow_comments' => false);
$serendipity['messagestack']['comments'][] = PLUGIN_EVENT_SPAMBLOCK_ERROR_RBL . ' (' . implode(', ', $dnsbl->getTxt($remoteIP)) . ')';
return false;
}
}
return true;
break;
default:
return false;
break;
}
} else {
return false;
}
}
示例5: serendipity_gzCompression
/**
* Optionally turn on GZip Compression, if configured
*
* @access public
*/
function serendipity_gzCompression()
{
global $serendipity;
if (isset($serendipity['useGzip']) && serendipity_db_bool($serendipity['useGzip']) && function_exists('ob_gzhandler') && extension_loaded('zlib') && serendipity_ini_bool(ini_get('zlib.output_compression')) == false && serendipity_ini_bool(ini_get('session.use_trans_sid')) == false) {
ob_start("ob_gzhandler");
}
}
示例6: event_hook
function event_hook($event, &$bag, &$eventData)
{
global $serendipity;
$hooks =& $bag->get('event_hooks');
if (isset($hooks[$event])) {
switch ($event) {
case 'frontend_display':
foreach ($this->markup_elements as $temp) {
if (serendipity_db_bool($this->get_config($temp['name'], true)) && isset($eventData[$temp['element']]) && !$eventData['properties']['ep_disable_markup_' . $this->instance] && !isset($serendipity['POST']['properties']['disable_markup_' . $this->instance])) {
$element = $temp['element'];
$eventData[$element] = $this->_s9y_markup($eventData[$element]);
}
}
return true;
break;
case 'frontend_comment':
if (serendipity_db_bool($this->get_config('COMMENT', true))) {
echo '<div class="serendipity_commentDirection serendipity_comment_s9ymarkup">' . PLUGIN_EVENT_S9YMARKUP_TRANSFORM . '</div>';
}
return true;
break;
default:
return false;
}
} else {
return false;
}
}
示例7: event_hook
function event_hook($event, &$bag, &$eventData, $addData = null)
{
global $serendipity;
$hooks =& $bag->get('event_hooks');
if (isset($hooks[$event])) {
switch ($event) {
case 'frontend_saveComment':
if (!is_array($eventData) || serendipity_db_bool($eventData['allow_comments'])) {
if (strtolower($_POST['response']) != strtolower($this->get_config('response'))) {
$eventData = array('allow_comments' => false);
$serendipity['messagestack']['comments'][] = $this->get_config('error');
return false;
}
}
return true;
break;
case 'frontend_comment':
echo '<div class="serendipity_challengeresponse">' . $this->get_config('challenge') . '<br />
<input type="text" name="response" value="" />
</div>';
return true;
break;
default:
return false;
break;
}
} else {
return false;
}
}
示例8: setupDB
function setupDB()
{
global $serendipity;
if (serendipity_db_bool($this->get_config('db_built', false))) {
return true;
}
#FIXME: Add hooks for XML / exporting to convert images/text to ascii art/text or text-only.
# That doesn't belong here.
$sql = "CREATE TABLE {$serendipity['dbPrefix']}mymood (\n mood_id {AUTOINCREMENT} {PRIMARY},\n mood_name varchar(255) NOT NULL default '',\n mood_img varchar(255) NOT NULL default '',\n mood_ascii varchar(255) NOT NULL default ''\n )";
serendipity_db_schema_import($sql);
# Setting up some basic moods...
$moods = array();
$default_moods = explode('|`|', PLUGIN_MYMOOD_LISTOFMOODS);
foreach ($default_moods as $mood_s) {
$info_array = explode('|~|', $mood_s);
$moods[] = array('mood_name' => $info_array[0], 'mood_img' => $info_array[1], 'mood_ascii' => $info_array[2]);
}
#gar! hafta check if there's already one defined...stupid 5000 'Happy's in my db...
#fixme: this may need some sort of case insensitive stuff...
# also will want to add that to the adding part..
foreach ($moods as $mood_array) {
$check_q = "SELECT mood_id FROM {$serendipity['dbPrefix']}mymood WHERE mood_name='{$mood_array['mood_name']}'";
$t = serendipity_db_query($check_q);
if (!empty($t[0])) {
continue;
}
$insert_q = "INSERT INTO {$serendipity['dbPrefix']}mymood\n (mood_name, mood_img, mood_ascii)\n VALUES (\n '{$mood_array['mood_name']}', '{$mood_array['mood_img']}','{$mood_array['mood_ascii']}')";
serendipity_db_query($insert_q);
}
$this->set_config('db_built', 'true');
}
示例9: generate_content
function generate_content(&$title)
{
global $serendipity;
$title = $this->title;
$fullentry = serendipity_db_bool($this->get_config('fullentry', 'true'));
?>
<form id="searchform" action="<?php
echo $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'];
?>
" method="get">
<div>
<input type="hidden" name="serendipity[action]" value="search" />
<input type="hidden" name="serendipity[fullentry]" value="<?php
echo $fullentry;
?>
" />
<input type="text" id="serendipityQuickSearchTermField" name="serendipity[searchTerm]" size="13" />
<input class="quicksearch_submit" type="submit" value=">" name="serendipity[searchButton]" title="<?php
echo GO;
?>
" style="width: 2em;" />
</div>
<div id="LSResult" style="display: none;"><div id="LSShadow"></div></div>
</form>
<?php
serendipity_plugin_api::hook_event('quicksearch_plugin', $serendipity);
}
示例10: generate_content
function generate_content(&$title)
{
global $serendipity;
if (serendipity_db_bool($this->get_config('loggedin_only', TRUE))) {
// show content if logged on only
if ($_SESSION['serendipityAuthedUser'] != true) {
return;
}
}
$title = $this->get_config('title', $this->title);
$statsCached = $this->loadCachedStats();
$stats = array();
if (!empty($statsCached)) {
$stats = $statsCached;
}
$days = explode(',', $this->get_config('days'));
$searches = preg_split('/(?:\\r?\\n|\\r)/', $this->get_config('db_search_pattern'));
$todayAtMidnight = mktime(0, 0, 0, date("n"), date("j"), date("Y"));
$timestampDay = 60 * 60 * 24;
$statsString = '';
foreach ($days as $day) {
if (!isset($stats[$day])) {
$stats[$day] = array();
}
$timestamp = $todayAtMidnight - $timestampDay * (trim($day) - 1);
if ($day == 1) {
$statsString .= '<b>' . PLUGIN_SPAMBLOCK_BEE_TODAY . '</b> <br>';
} else {
$statsString .= '<b>' . sprintf(PLUGIN_SPAMBLOCK_BEE_LAST_X_DAYS, $day) . '</b><br>';
}
foreach ($searches as $search) {
$singleSearch = explode(':', $search, 2);
$singleSearch[0] = trim($singleSearch[0]);
$singleSearch[1] = trim($singleSearch[1]);
if (empty($statsCached)) {
$sql = "SELECT COUNT(*) as total FROM {$serendipity['dbPrefix']}spamblocklog WHERE reason like '%s' and timestamp>%d;";
$singleSql = sprintf($sql, serendipity_db_escape_string($singleSearch[1]), $timestamp);
$result = serendipity_db_query($singleSql, true);
if (!empty($result['total'])) {
$stats[$day][$singleSearch[1]] = $result['total'];
} else {
$stats[$day][$singleSearch[1]] = 0;
}
}
$searchResult = isset($stats[$day][$singleSearch[1]]) ? $stats[$day][$singleSearch[1]] : 0;
if ($searchResult) {
$statsString .= "{$singleSearch[0]}: {$searchResult}<br>";
}
}
}
if (empty($statsCached)) {
$this->cacheStats($stats);
}
echo $statsString;
}
示例11: generate_content
function generate_content(&$title)
{
global $serendipity;
$title = $this->get_config('title');
if (serendipity_db_bool($this->get_config('show_users'))) {
echo $this->displayUserList();
}
if (serendipity_db_bool($this->get_config('show_groups'))) {
echo "<br />\n";
echo '<a href="' . $serendipity['baseURL'] . $serendipity['indexFile'] . '?/serendipity[subpage]=userprofiles">' . USERCONF_GROUPS . '</a>';
}
}
示例12: generate_content
function generate_content(&$title)
{
global $serendipity;
$title = $this->get_config('title', $this->title);
$sort = $this->get_config('sort_order');
if ($sort == 'none') {
$sort = '';
} else {
$sort .= ' ' . $this->get_config('sort_method');
}
$is_form = serendipity_db_bool($this->get_config('allow_select'));
$is_count = serendipity_db_bool($this->get_config('showartcount'));
$mincount = (int) $this->get_config('mincount');
$authors = serendipity_fetchUsers(null, 'hidden', $is_count);
$html = '';
if ($is_form) {
$html .= '<form action="' . $serendipity['baseURL'] . $serendipity['indexFile'] . '?frontpage" method="post">';
}
$image = $this->get_config('image', serendipity_getTemplateFile('img/xml.gif'));
$image = $image == "'none'" || $image == 'none' ? '' : $image;
$html .= '<ul class="plainList">' . "\n";
if (is_array($authors) && count($authors)) {
foreach ($authors as $auth) {
if ($is_count) {
if ($auth['artcount'] < $mincount) {
continue;
}
$entrycount = " ({$auth['artcount']})";
} else {
$entrycount = "";
}
$html .= '<li>';
if ($is_form) {
$html .= '<input style="width: 15px" type="checkbox" name="serendipity[multiAuth][]" value="' . $auth['authorid'] . '" />';
}
if (!empty($image)) {
$html .= '<a class="serendipity_xml_icon" href="' . serendipity_feedAuthorURL($auth, 'serendipityHTTPPath') . '"><img src="' . $image . '" alt="XML" style="border: 0px" /></a> ';
}
$html .= '<a href="' . serendipity_authorURL($auth, 'serendipityHTTPPath') . '" title="' . serendipity_specialchars($auth['realname']) . '">' . serendipity_specialchars($auth['realname']) . $entrycount . '</a>';
$html .= '</li>' . "\n";
}
}
$html .= '</ul>' . "\n";
if ($is_form) {
$html .= '<div><input type="submit" name="serendipity[isMultiAuth]" value="' . GO . '" /></div>';
}
$html .= sprintf('<div><a href="%s" title="%s">%s</a></div>', $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'], ALL_AUTHORS, ALL_AUTHORS);
if ($is_form) {
$html .= '</form>';
}
print $html;
}
示例13: generate_content
function generate_content(&$title)
{
global $serendipity;
$title = $this->title;
if (serendipity_db_bool($this->get_config('https', 'false'))) {
$base = str_replace('http://', 'https://', $serendipity['baseURL']);
} else {
$base = $serendipity['serendipityHTTPPath'];
}
$link = $base . ($serendipity['rewrite'] == 'none' ? $serendipity['indexFile'] . '?/' : '') . PATH_ADMIN;
$text = $_SESSION['serendipityAuthedUser'] === true ? SUPERUSER_OPEN_ADMIN : SUPERUSER_OPEN_LOGIN;
echo '<a href="' . $link . '" rel="nofollow" title="' . $text . '">' . $text . '</a>';
}
示例14: event_hook
function event_hook($event, &$bag, &$eventData, $addData = null)
{
global $serendipity;
$hooks =& $bag->get('event_hooks');
if (isset($hooks[$event])) {
switch ($event) {
case 'frontend_display':
if ($bag->get('scrambles_true_content') && is_array($addData) && isset($addData['no_scramble'])) {
return true;
}
case 'frontend_display_cache':
$serendipity['encodeExitsCallback_entry_id'] = (int) (isset($eventData['entry_id']) ? $eventData['entry_id'] : $eventData['id']);
// Fetch all existing links from the database. They have been inserted there by our trackback-discovery.
if (empty($serendipity['encodeExitsCallback_entry_id'])) {
$this->links = array();
} else {
#echo "SELECT id, link FROM {$serendipity['dbPrefix']}references WHERE entry_id = {$serendipity['encodeExitsCallback_entry_id']} AND type = ''<br />\n";
$this->links = serendipity_db_query("SELECT id, link FROM {$serendipity['dbPrefix']}references WHERE entry_id = {$serendipity['encodeExitsCallback_entry_id']} AND (type = '' OR type IS NULL)", false, 'both', false, 'link', 'id');
#echo "<pre>" . print_r($this->links, true) . "</pre><br />\n";
}
foreach ($this->markup_elements as $temp) {
if (serendipity_db_bool($this->get_config($temp['name'], true)) && isset($eventData[$temp['element']]) && !$eventData['properties']['ep_disable_markup_' . $this->instance] && !isset($serendipity['POST']['properties']['disable_markup_' . $this->instance])) {
$element = $temp['element'];
$eventData[$element] = preg_replace_callback("#<a(.*)href=(\"|')http(s?)://([^\"']+)(\"|')([^>]*)>#isUm", array($this, '_encodeExitsCallback'), $eventData[$element]);
if ($temp['element'] == 'comment' && !empty($eventData['url'])) {
switch (trim($this->get_config('commentredirection'))) {
case 'bmi':
$eventData['url'] = 'http://bmi.pifo.biz/?' . $eventData['url'];
break;
case 's9y':
$eventData['url'] = $this->_encodeExitsCallback(array(1 => ' ', 2 => '"', 3 => '', 4 => $eventData['url'], 5 => '"'), true);
break;
case 'google':
$eventData['url'] = 'http://www.google.com/url?sa=D&q=' . $eventData['url'];
break;
default:
break;
}
}
}
}
return true;
break;
default:
return false;
}
} else {
return false;
}
}
示例15: event_hook
function event_hook($event, &$bag, &$eventData, $addData = null)
{
global $serendipity;
$hooks =& $bag->get('event_hooks');
if (isset($hooks[$event])) {
switch ($event) {
case 'frontend_saveComment':
if (!is_array($eventData) || serendipity_db_bool($eventData['allow_comments'])) {
$serendipity['csuccess'] = 'true';
// Check for IP listed in RBL
require_once (defined('S9Y_PEAR_PATH') ? S9Y_PEAR_PATH : 'bundled-libs/') . 'Net/DNSBL.php';
$dnsbl = new Net_DNSBL();
$remoteIP = $_SERVER['REMOTE_ADDR'];
$dnsbl->setBlacklists(explode(',', $this->get_config('rbllist')));
if ($dnsbl->isListed($remoteIP)) {
$eventData = array('allow_comments' => false);
// old - but missing $dnsbl->getTxt() function in delivered old DNSBL.php
//$serendipity['messagestack']['comments'][] = PLUGIN_EVENT_SPAMBLOCK_ERROR_RBL . ' ('.implode(', ', $dnsbl->getTxt($remoteIP)).')';
$serendipity['messagestack']['comments'][] = PLUGIN_EVENT_SPAMBLOCK_ERROR_RBL . ' (' . $remoteIP . ')';
return false;
}
// Check for IP listed in http:BL
require_once 'httpbl.php';
$honeypot_apikey = $this->get_config('httpBL_key');
if (!empty($honeypot_apikey)) {
$h = new http_bl($honeypot_apikey);
// known spammer
// DEBUG $remoteIP = '206.51.226.106';
// A quick tip for testing: change $remoteIP = '$_SERVER['REMOTE_ADDR']; on line 89 to e.g.
// $remoteIP = '109.200.6.202'; // Comments should get rejected as this ip is on both blacklists right now.
$r = $h->query($remoteIP);
if ($r == 2) {
$eventData = array('allow_comments' => false);
$reason = PLUGIN_EVENT_SPAMBLOCK_REASON_HONEYPOT . $h->type_txt . ' [' . $h->type_num . '] with a score of ' . $h->score . ', last seen since ' . $h->days . ' days';
$serendipity['messagestack']['comments'][] = $reason;
}
return false;
}
}
return true;
break;
default:
return false;
break;
}
} else {
return false;
}
}