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;
     }
 }
    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 
    }
 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
0
 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
0
/**
 * 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");
    }
}
 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;
     }
 }
 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;
     }
 }
 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');
 }
    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="&gt;" 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);
    }
 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;
 }
 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>';
     }
 }
 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;
 }
 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>';
 }
 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;
     }
 }
 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;
     }
 }
 function generate_content(&$title)
 {
     global $serendipity;
     $title = $this->title;
     // get local configuration (default, true, false)
     $use_links = $this->get_config('use_links', 'default');
     // get global configuration (true, false)
     $global_use_link = serendipity_get_config_var('top_as_links', false, true);
     // if local configuration say to use global default, do so
     if ($use_links === 'default') {
         $use_links = serendipity_db_bool($global_use_link);
     } else {
         $use_links = serendipity_db_bool($use_links);
     }
     echo serendipity_displayTopReferrers($this->get_config('limit', 10), $use_links, $this->get_config('interval', 7));
 }
 function show()
 {
     global $serendipity;
     $include_file = realpath($this->get_config('include'));
     ob_start();
     include $include_file;
     $content = ob_get_contents();
     ob_end_clean();
     if (serendipity_db_bool($this->get_config('markup'))) {
         $entry = array('body' => $content);
         serendipity_plugin_api::hook_event('frontend_display', $entry);
         echo $entry['body'];
     } else {
         echo $content;
     }
 }
 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'])) {
                     // Check for IP listed in SURBL
                     if (serendipity_db_bool($this->get_config('surbl_enabled', false))) {
                         require_once (defined('S9Y_PEAR_PATH') ? S9Y_PEAR_PATH : 'bundled-libs/') . 'Net/DNSBL/SURBL.php';
                         $surbl = new Net_DNSBL_SURBL();
                         if ($surbl->isListed($addData['url'])) {
                             $this->log($logfile, $eventData['id'], 'REJECTED', PLUGIN_EVENT_SPAMBLOCK_REASON_SURBL, $addData);
                             $eventData = array('allow_comments' => false);
                             $serendipity['messagestack']['comments'][] = PLUGIN_EVENT_SPAMBLOCK_ERROR_SURBL;
                             return false;
                         }
                         // BEGIN Code copied from http://www.phpfreaks.com/quickcode/Extract_All_URLs_on_a_Page/15.php
                         $urls = '(http|file|ftp)';
                         $ltrs = '\\w';
                         $gunk = '/#~:.?+=&%@!\\-';
                         $punc = '.:?\\-';
                         $any = "{$ltrs}{$gunk}{$punc}";
                         preg_match_all("{\n                              \\b\n                              {$urls}   :\n                              [{$any}] +?\n\n\n                              (?=\n                                 [{$punc}] *\n                                 [^{$any}]\n                                |\n                                 \$\n                               )\n                             }x", $addData['comment'], $matches);
                         // END Code copied from http://www.phpfreaks.com/quickcode/Extract_All_URLs_on_a_Page/15.php
                         foreach ($matches[0] as $surbl_check_url) {
                             if ($surbl->isListed($surbl_check_url)) {
                                 $eventData = array('allow_comments' => false);
                                 $serendipity['messagestack']['comments'][] = PLUGIN_EVENT_SPAMBLOCK_ERROR_SURBL;
                                 return false;
                             }
                         }
                     }
                 }
                 return true;
                 break;
             default:
                 return false;
                 break;
         }
     } else {
         return false;
     }
 }
 function event_hook($event, &$bag, &$eventData, $addData = null)
 {
     global $serendipity;
     $hooks =& $bag->get('event_hooks');
     if (isset($hooks[$event])) {
         switch ($event) {
             case 'frontend_configure':
                 if (serendipity_db_bool($this->get_config('enabled'))) {
                     $cfg = $this->get_config('blogdescription');
                     $c = explode('<br />', nl2br($cfg));
                     $tags = array();
                     foreach ($c as $k => $v) {
                         $v = trim($v);
                         $pos = strpos($v, ':');
                         if ($pos === false) {
                             $tags[] = $v;
                         } else {
                             $count = substr($v, 0, $pos);
                             if (!is_numeric($count)) {
                                 $tags[] = $v;
                             } else {
                                 $v = substr($v, $pos + 1);
                                 for ($i = 0; $i < $count; $i++) {
                                     $tags[] = $v;
                                 }
                             }
                         }
                     }
                     $count = count($tags);
                     if ($count > 0) {
                         $num = rand(0, $count - 1);
                         $desc = $tags[$num];
                         $serendipity['blogDescription'] = $desc;
                     }
                 }
                 return true;
                 break;
             default:
                 return false;
         }
     } else {
         return false;
     }
 }
 function generate_content(&$title)
 {
     global $serendipity;
     $title = $this->get_config('title', $this->title);
     $url = serendipity_currentURL(true);
     echo '<form id="language_chooser" action="' . $url . '" method="post"><div>';
     echo '<select style="font-size: ' . $this->get_config('size', '9') . 'px" name="user_language" onchange="document.getElementById(\'language_chooser\').submit();">';
     //        echo '<option value=""> </option>'."\n";
     foreach ($serendipity['languages'] as $lang_key => $language) {
         if (serendipity_db_bool($this->get_config($lang_key, 'false'))) {
             echo '<option value="' . $lang_key . '" ' . ($serendipity['lang'] == $lang_key ? 'selected="selected"' : '') . '>' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($language) : htmlspecialchars($language, ENT_COMPAT, LANG_CHARSET)) . '</option>';
         }
     }
     echo '</select>';
     if (serendipity_db_bool($this->get_config('show_submit', 'false'))) {
         echo '<input type="submit" name="submit" value="' . GO . '" size="4" />';
     }
     echo '</div></form>';
 }
 function generate_content(&$title)
 {
     global $serendipity;
     $title = $this->get_config('title');
     $show_where = $this->get_config('show_where', 'both');
     if ($show_where == 'extended' && (!isset($serendipity['GET']['id']) || !is_numeric($serendipity['GET']['id']))) {
         return false;
     } else {
         if ($show_where == 'overview' && isset($serendipity['GET']['id']) && is_numeric($serendipity['GET']['id'])) {
             return false;
         }
     }
     if (serendipity_db_bool($this->get_config('markup', 'true'))) {
         $entry = array('html_nugget' => $this->get_config('content'));
         serendipity_plugin_api::hook_event('frontend_display', $entry);
         echo $entry['html_nugget'];
     } else {
         echo $this->get_config('content');
     }
 }
 function generate_content(&$title)
 {
     global $serendipity;
     $title = $this->get_config('title', $this->title);
     $url = serendipity_currentURL(true);
     echo '<form id="theme_chooser" action="' . $url . '" method="post">' . "\n";
     echo '<select name="user_template" onchange="document.getElementById(\'theme_chooser\').submit();">' . "\n";
     foreach (serendipity_fetchTemplates() as $template) {
         if ($template == 'default-php' || $template == 'default-xml') {
             continue;
         }
         $templateInfo = serendipity_fetchTemplateInfo($template);
         echo '    <option value="' . $template . '" ' . (serendipity_get_config_var('template', 'default') == $template ? 'selected="selected"' : '') . '>' . substr($templateInfo['name'], 0, 25) . "</option>\n";
     }
     echo "</select>\n";
     if (serendipity_db_bool($this->get_config('show_submit', 'false'))) {
         echo '<input type="submit" name="submit" value="' . GO . '" size="4" />' . "\n";
     }
     echo "</form>\n";
 }
 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_count = serendipity_db_bool($this->get_config('showartcount', 'false'));
     $mincount = (int) $this->get_config('mincount');
     $authors = serendipity_fetchUsers(null, 'hidden', $is_count);
     $html = '';
     $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 (!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";
     $html .= sprintf('<div><a href="%s" title="%s">%s</a></div>' . "\n", $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'], ALL_AUTHORS, ALL_AUTHORS);
     print $html;
 }
 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] && !isset($serendipity['POST']['properties']['disable_markup_' . $this->instance])) {
                         $element = $temp['element'];
                         $this->markup($eventData[$element]);
                     }
                 }
                 return true;
                 break;
             default:
                 return false;
         }
     } else {
         return false;
     }
 }
 /**
  * Evaluates a player by an extension. Returns the complete HTML code
  * 
  */
 function GetPlayerByExt($ext, $filename, $valwidth = null, $valheight = null, $valalign = null, $mime = null)
 {
     static $downloadlink = null;
     if ($downloadlink === null) {
         $downloadlink = serendipity_db_bool($this->get_config('downloadlink'));
     }
     $this->playerUrlsAdded[] = $filename;
     $this->InitializeSupportedPlayers();
     if (!isset($this->supportedFiletypes[$ext])) {
         return "\n<!-- unknown fileext: {$ext} " . count($this->supportedFiletypes) . " -->";
     }
     $short = $this->supportedFiletypes[$ext];
     if (!isset($this->supportedPlayers[$short])) {
         return "<!-- no player for: " . $short . " -->";
     }
     $player = $this->supportedPlayers[$short];
     // Configure Player:
     // Add Height for controls
     if (isset($valheight) && $valheight > 0) {
         if ($short == 'w') {
             $valheight = $valheight + 43;
         } else {
             if ($short == 'q') {
                 $valheight = $valheight + 16;
             } else {
                 if ($short == 'v') {
                     $valheight = $valheight + 20;
                 }
             }
         }
     }
     // Replace align, width and height attributes in players
     $width = 'width="' . (isset($valwidth) && $valwidth > 0 ? $valwidth : $this->get_config('width', '200')) . '"';
     $height = 'height="' . (isset($valheight) && $valheight > 0 ? $valheight : $this->get_config('height', '200')) . '"';
     $intwidth = isset($valwidth) && $valwidth > 0 ? $valwidth : $this->get_config('width', '200');
     $intheight = isset($valheight) && $valheight > 0 ? $valheight : $this->get_config('height', '200');
     if (isset($valalign)) {
         $align = $valalign != 'noalign' ? 'align="' . $valalign . '"' : '';
     } else {
         if ($this->get_config('align', 'left') != 'noalign') {
             $align = 'align="' . $this->get_config('align', 'left') . '"';
         } else {
             $align = '';
         }
     }
     $filename = str_replace(array(' '), array('%20'), $filename);
     $filename = $this->absolve($filename);
     $filename_noext = preg_replace('@\\.' . $ext . '$@is', '', $filename);
     if ($mime == null) {
         $mime = $this->getFileMime($ext);
     }
     $result = str_replace(array('#url#', '#url_noext#', '#filename#', '#htmlid#', '#width#', '#height#', '#intwidth#', '#intheight#', '#align#', '#plugin#', '#mime#'), array($filename, $filename_noext, basename($filename), md5($filename), $width, $height, $intwidth, $intheight, $align, $this->GetPluginHttpPath(), $mime), $player);
     if ($downloadlink) {
         $result .= "\n<a href=\"" . $filename . "\" class=\"podcastdownload\">" . basename($filename) . "</a>\n";
     }
     return '<!-- podcastplayerstart -->' . $result . '<!-- podcastplayerend -->';
 }
 function generate_content(&$title)
 {
     global $serendipity;
     $title = $this->get_config('title', $this->title);
     $to_lower = serendipity_db_bool($this->get_config('lowercase_tags', 'true'));
     if ($this->get_config('max_tags', 0) != 0) {
         $limit = "LIMIT " . $this->get_config('max_tags', 0);
     } else {
         $limit = '';
     }
     $query = "SELECT et.tag, count(et.tag) AS total\n                    FROM {$serendipity['dbPrefix']}entrytags AS et\n         LEFT OUTER JOIN {$serendipity['dbPrefix']}entries AS e\n                      ON et.entryid = e.id\n                   WHERE e.isdraft = 'false' " . (!serendipity_db_bool($serendipity['showFutureEntries']) ? " AND e.timestamp <= " . time() : '') . "\n                GROUP BY et.tag\n                  HAVING count(et.tag) >= " . $this->get_config('treshold_tag_count') . "\n                ORDER BY total DESC {$limit}";
     $rows = serendipity_db_query($query);
     if (!is_array($rows)) {
         return;
     }
     // not sure if we can optimize this loop... :/
     // Probably through some SQL magick.
     foreach ($rows as $r) {
         if ($to_lower) {
             // set to_lower for frontend sidebar list/clouds (new)
             foreach ($r as &$t) {
                 if (function_exists('mb_strtolower')) {
                     $t = mb_strtolower($t);
                 } else {
                     $t = strtolower($t);
                 }
             }
         }
         $tags[$r['tag']] = $r['total'];
     }
     if ($this->get_config('order_by') == 'tag') {
         uksort($tags, 'strnatcasecmp');
         serendipity_plugin_api::hook_event('sort', $tags);
     } else {
         if ($this->get_config('order_by') == 'total') {
             serendipity_db_bool($this->get_config('sort_desc', 'false')) ? arsort($tags) : asort($tags);
         }
     }
     $xml = serendipity_db_bool($this->get_config('show_xml', 'true'));
     $nl = serendipity_db_bool($this->get_config('show_newline', 'true'));
     $scaling = serendipity_db_bool($this->get_config('scale_tag', 'false'));
     $useRotCanvas = serendipity_db_bool($this->get_config('use_rotacloud', 'false'));
     $useWordCloud = serendipity_db_bool($this->get_config('use_wordcloud', 'false'));
     serendipity_event_freetag::displayTags($tags, $xml, $nl, $scaling, $this->get_config('max_percent', 300), $this->get_config('min_percent', 100), serendipity_db_bool($this->get_config('use_flash')), serendipity_db_bool($this->get_config('flash_bg_trans', 'false')), $this->get_config('flash_tag_color', 'ff6600'), $this->get_config('flash_bg_color', 'ffffff'), $this->get_config('flash_width', 190), $this->get_config('flash_speed', 100), $this->get_config('taglink'), $this->get_config('template'), $this->get_config('xml_image', 'img/xml.gif'), $useRotCanvas, $this->get_config('rotacloud_tag_color', '3E5F81'), $this->get_config('rotacloud_tag_border_color', 'B1C1D1'), $this->get_config('rotacloud_width', '300'), $useWordCloud);
 }
 *   Attempt to connect to the database
 */
if (!serendipity_db_connect()) {
    $serendipity['lang'] = 'en';
    include S9Y_INCLUDE_PATH . 'include/lang.inc.php';
    serendipity_die(DATABASE_ERROR);
}
/*
 *   Load Configuration options from the database
 */
if (defined('USE_MEMSNAP')) {
    memSnap('Framework init');
}
serendipity_load_configuration();
$serendipity['lang'] = serendipity_getSessionLanguage();
if (isset($serendipity['autodetect_baseURL']) && serendipity_db_bool($serendipity['autodetect_baseURL']) || isset($serendipity['embed']) && serendipity_db_bool($serendipity['embed'])) {
    $serendipity['baseURL'] = 'http' . (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . (!strstr($_SERVER['HTTP_HOST'], ':') && !empty($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] != '80' && $_SERVER['SERVER_PORT'] != '443' ? ':' . $_SERVER['SERVER_PORT'] : '') . $serendipity['serendipityHTTPPath'];
}
/*
 * If a user is logged in, fetch his preferences. He possibly wants to have a different language
 */
if (IS_installed === true) {
    // Import HTTP auth (mostly used for RSS feeds)
    if ($serendipity['useHTTP-Auth'] && (isset($_REQUEST['http_auth']) || isset($_SERVER['PHP_AUTH_USER']))) {
        if (!isset($_SERVER['PHP_AUTH_USER'])) {
            header("WWW-Authenticate: Basic realm=\"Feed Login\"");
            header("HTTP/1.0 401 Unauthorized");
            header("Status: 401 Unauthorized");
            exit;
        } else {
            if (!isset($serendipity['POST']['user'])) {
示例#28
0
 $serendipity['dbPrefix'] = $_POST['dbPrefix'];
 echo CHECK_DATABASE_EXISTS . '...';
 $t = serendipity_db_query("SELECT * FROM {$serendipity['dbPrefix']}authors", false, 'both', false, false, false, true);
 if (is_array($t)) {
     echo ' <strong>' . THEY_DO . '</strong>, ' . WONT_INSTALL_DB_AGAIN;
     echo '<br />';
     echo '<br />';
 } else {
     echo ' <strong>' . THEY_DONT . '</strong>';
     echo '<br />';
     echo CREATE_DATABASE;
     serendipity_installDatabase();
     echo ' <strong>' . DONE . '</strong><br />';
     echo sprintf(CREATING_PRIMARY_AUTHOR, htmlspecialchars($_POST['user'])) . '...';
     $authorid = serendipity_addAuthor($_POST['user'], $_POST['pass'], $_POST['realname'], $_POST['email'], USERLEVEL_ADMIN, 1);
     $mail_comments = serendipity_db_bool($_POST['want_mail']) ? 1 : 0;
     serendipity_set_user_var('mail_comments', $mail_comments, $authorid);
     serendipity_set_user_var('mail_trackbacks', $mail_comments, $authorid);
     serendipity_set_user_var('right_publish', 1, $authorid);
     serendipity_addDefaultGroup('USERLEVEL_EDITOR_DESC', USERLEVEL_EDITOR);
     serendipity_addDefaultGroup('USERLEVEL_CHIEF_DESC', USERLEVEL_CHIEF);
     serendipity_addDefaultGroup('USERLEVEL_ADMIN_DESC', USERLEVEL_ADMIN);
     echo ' <strong>' . DONE . '</strong><br />';
     echo SETTING_DEFAULT_TEMPLATE . '... ';
     serendipity_set_config_var('template', $serendipity['defaultTemplate']);
     echo ' <strong>' . DONE . '</strong><br />';
     echo INSTALLING_DEFAULT_PLUGINS . '... ';
     include_once S9Y_INCLUDE_PATH . 'include/plugin_api.inc.php';
     serendipity_plugin_api::register_default_plugins();
     echo ' <strong>' . DONE . '</strong><br />';
 }
 function event_hook($event, &$bag, &$eventData, $addData = null)
 {
     global $serendipity;
     static $convert_fields = array('fullBody', 'summary', 'title', 'author');
     static $youtube = null;
     if ($youtube === null) {
         $youtube = serendipity_db_bool($this->get_config('youtube'));
     }
     $hooks =& $bag->get('event_hooks');
     if (isset($hooks[$event])) {
         switch ($event) {
             case 'backend_view_comment':
                 if (serendipity_db_bool($this->get_config('utf8_parse'))) {
                     foreach ($convert_fields as $convert_field) {
                         $this->fixUTFEntity($eventData[$convert_field]);
                     }
                 }
                 return true;
                 break;
             case 'frontend_display':
                 $this->cleanup_parse = serendipity_db_bool($this->get_config('xhtml_parse'));
                 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'];
                         $this->cleanup_tag = 'IMG';
                         $this->cleanup_checkfor = 'ALT';
                         $this->cleanup_val = '';
                         // Basic cleanup (core s9y functionality)
                         $eventData[$element] = xhtml_cleanup($eventData[$element]);
                         $eventData[$element] = preg_replace_callback('@(<img.+/?>)@imsU', array($this, 'clean_tag'), $eventData[$element]);
                         $eventData[$element] = preg_replace_callback("@<(a|iframe|param)(.*)(href|src|value)=(\"|')([^\"']+)(\"|')@isUm", array($this, 'clean_htmlspecialchars'), $eventData[$element]);
                         if ($youtube) {
                             $this->youtubify($eventData[$element]);
                         }
                     }
                 }
                 if (serendipity_db_bool($this->get_config('utf8_parse'))) {
                     $this->fixUTFEntity($eventData['author']);
                     $this->fixUTFEntity($eventData['comment']);
                 }
                 return true;
                 break;
             case 'frontend_display:html:per_entry':
                 if (serendipity_db_bool($this->get_config('utf8_parse'))) {
                     $this->fixUTFEntity($eventData['author']);
                     $this->fixUTFEntity($eventData['title']);
                 }
                 return true;
                 break;
             default:
                 return false;
         }
     } else {
         return false;
     }
 }
 function event_hook($event, &$bag, &$eventData, $addData = null)
 {
     global $serendipity;
     static $login_url = null;
     if ($login_url === null) {
         $login_url = $serendipity['baseURL'] . $serendipity['indexFile'] . '?/plugin/loginbox';
     }
     $hooks =& $bag->get('event_hooks');
     if (isset($hooks[$event])) {
         switch ($event) {
             case 'frontend_saveComment':
                 if (!isset($serendipity['csuccess'])) {
                     $serendipity['csuccess'] = 'true';
                 }
                 if (serendipity_db_bool($this->get_config('registered_only')) && !serendipity_userLoggedIn() && $addData['source2'] != 'adduser') {
                     $eventData = array('allow_comments' => false);
                     $serendipity['messagestack']['comments'][] = PLUGIN_ADDUSER_REGISTERED_ONLY_REASON;
                     return false;
                 }
                 if (serendipity_db_bool($this->get_config('registered_only')) && !$this->inGroup() && $addData['source2'] != 'adduser') {
                     $eventData = array('allow_comments' => false);
                     $serendipity['messagestack']['comments'][] = PLUGIN_ADDUSER_REGISTERED_ONLY_REASON;
                     return false;
                 }
                 if (serendipity_db_bool($this->get_config('true_identities')) && !serendipity_userLoggedIn()) {
                     $user = str_replace(" b", '', $addData['name']);
                     $user = serendipity_db_escape_string(preg_replace('@\\s+@', ' ', trim($user)));
                     $user = trim($user);
                     $authors = serendipity_db_query("SELECT authorid FROM {$serendipity['dbPrefix']}authors WHERE realname = '" . $user . "'");
                     if (is_array($authors) && isset($authors[0]['authorid'])) {
                         $eventData = array('allow_comments' => false);
                         $serendipity['messagestack']['comments'][] = sprintf(PLUGIN_ADDUSER_REGISTERED_CHECK_REASON, $login_url, 'onclick="javascript:loginbox = window.open(this.href, \'loginbox\', \'width=300,height=300,locationbar=no,menubar=no,personalbar=no,statusbar=yes,status=yes,toolbar=no\'); return false;"');
                     }
                 }
                 break;
             case 'external_plugin':
                 if ($eventData != 'loginbox') {
                     return true;
                 }
                 $out = array();
                 serendipity_plugin_api::hook_event('backend_login_page', $out);
                 serendipity_smarty_init();
                 $serendipity['smarty']->assign(array('loginform_add' => $out, 'loginform_url' => $login_url, 'loginform_user' => $_SESSION['serendipityUser'], 'loginform_mail' => $_SESSION['serendipityEmail'], 'close_window' => defined('LOGIN_ACTION'), 'is_logged_in' => serendipity_userLoggedIn(), 'is_error' => defined('LOGIN_ERROR')));
                 $filename = 'loginbox.tpl';
                 $tfile = serendipity_getTemplateFile($filename, 'serendipityPath');
                 if (!$tfile || $tfile == $filename) {
                     $tfile = dirname(__FILE__) . '/' . $filename;
                 }
                 $inclusion = $serendipity['smarty']->security_settings[INCLUDE_ANY];
                 $serendipity['smarty']->security_settings[INCLUDE_ANY] = true;
                 $serendipity['smarty']->display($tfile);
                 break;
             case 'frontend_display':
                 if (serendipity_db_bool($this->get_config('registered_only')) && !serendipity_userLoggedIn()) {
                     $serendipity['messagestack']['comments'][] = sprintf(PLUGIN_ADDUSER_REGISTERED_ONLY_REASON, $serendipity['baseURL'] . $serendipity['indexFile'] . '?serendipity[subpage]=adduser', $serendipity['baseURL'] . 'serendipity_admin.php');
                     $eventData['allow_comments'] = false;
                 }
                 break;
             case 'frontend_configure':
                 if (isset($serendipity['POST']['action']) && isset($serendipity['POST']['user']) && isset($serendipity['POST']['pass'])) {
                     serendipity_login();
                     if (serendipity_userLoggedIn()) {
                         define('LOGIN_ACTION', 'login');
                         header('X-s9y-auth: Login');
                     } else {
                         define('LOGIN_ERROR', true);
                     }
                 } elseif (isset($serendipity['POST']['action']) && isset($serendipity['POST']['logout'])) {
                     serendipity_logout();
                     if (!serendipity_userLoggedIn()) {
                         header('X-s9y-auth: Logout');
                         define('LOGIN_ACTION', 'logout');
                     }
                 }
                 if ((serendipity_db_bool($this->get_config('registered_only')) || serendipity_db_bool($this->get_config('true_identities'))) && $_SESSION['serendipityAuthedUser']) {
                     if (defined('IN_serendipity_admin') && $serendipity['GET']['adminAction'] == 'doEdit') {
                         // void
                     } else {
                         $serendipity['COOKIE']['name'] = isset($_SESSION['serendipityRealname']) ? $_SESSION['serendipityRealname'] : $_SESSION['serendipityUser'];
                         $serendipity['COOKIE']['email'] = $_SESSION['serendipityEmail'];
                         if ($serendipity['POST']['comment']) {
                             $serendipity['POST']['name'] = $serendipity['COOKIE']['name'];
                             $serendipity['POST']['email'] = $serendipity['COOKIE']['email'];
                         }
                     }
                 }
                 return true;
                 break;
             case 'entry_display':
                 if ($serendipity['GET']['subpage'] == 'adduser' || $serendipity['POST']['subpage'] == 'adduser' || !empty($serendipity['GET']['adduser_activation']) || !empty($this->clean_page)) {
                     if (is_array($eventData)) {
                         $eventData['clean_page'] = true;
                     }
                 }
                 break;
             case 'entries_header':
                 if ($serendipity['GET']['subpage'] == 'adduser' || $serendipity['POST']['subpage'] == 'adduser' || !empty($serendipity['GET']['adduser_activation'])) {
                     $this->clean_page = true;
                     $url = $serendipity['baseURL'] . $serendipity['indexFile'];
                     $hidden['subpage'] = 'adduser';
                     $username = substr($serendipity['POST']['adduser_user'], 0, 40);
                     $password = substr($serendipity['POST']['adduser_pass'], 0, 32);
                     $email = $serendipity['POST']['adduser_email'];
                     echo '<div id="adduser_form" style="padding-left: 4px; padding-right: 10px"><a id="adduser"></a>';
                     // Get the config from the sidebar plugin
                     $pair_config = array('userlevel' => USERLEVEL_EDITOR, 'no_create' => false, 'right_publish' => false, 'instructions' => $this->get_config('instructions', ''), 'usergroups' => array(), 'straight_insert' => false, 'approve' => false, 'use_captcha' => false);
                     $config = serendipity_db_query("SELECT name, value FROM {$serendipity['dbPrefix']}config WHERE name LIKE 'serendipity_plugin_adduser:%'");
                     if (is_array($config)) {
                         foreach ($config as $conf) {
                             $names = explode('/', $conf['name']);
                             if ($names[1] == 'instructions' && !empty($pair_config['instructions'])) {
                                 continue;
                             }
                             if ($names[1] == 'usergroups') {
                                 $ug = (array) explode(',', $conf['value']);
                                 foreach ($ug as $cid) {
                                     if ($cid === false || empty($cid)) {
                                         continue;
                                     }
                                     $pair_config[$names[1]][$cid] = $cid;
                                 }
                             } else {
                                 $pair_config[$names[1]] = serendipity_get_bool($conf['value']);
                             }
                         }
                     }
                     if (!serendipity_common_adduser::adduser($username, $password, $email, $pair_config['userlevel'], $pair_config['usergroups'], $pair_config['no_create'], $pair_config['right_publish'], $pair_config['straight_insert'], $pair_config['approve'], $pair_config['use_captcha'])) {
                         serendipity_common_adduser::loginform($url, $hidden, $pair_config['instructions'], $username, $password, $email, $pair_config['use_captcha']);
                     }
                     echo '</div>';
                 }
                 return true;
                 break;
             default:
                 return false;
         }
     } else {
         return false;
     }
 }