当前位置: 首页>>代码示例>>PHP>>正文


PHP serendipity_userLoggedIn函数代码示例

本文整理汇总了PHP中serendipity_userLoggedIn函数的典型用法代码示例。如果您正苦于以下问题:PHP serendipity_userLoggedIn函数的具体用法?PHP serendipity_userLoggedIn怎么用?PHP serendipity_userLoggedIn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了serendipity_userLoggedIn函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: generate_content

 function generate_content(&$title)
 {
     global $serendipity;
     $title = $this->get_config('title', $title);
     $login_url = $this->get_config('login_url');
     $logout_url = $this->get_config('logout_url');
     if ($login_url == "") {
         $login_url = serendipity_currentURL();
     }
     if ($logout_url == "") {
         $logout_url = serendipity_currentURL();
     }
     if (isset($serendipity['POST']['action']) && !isset($serendipity['POST']['logout']) && !serendipity_userLoggedIn()) {
         echo '<div class="serendipity_center serendipity_msg_important">' . WRONG_USERNAME_OR_PASSWORD . '</div>';
     } elseif (serendipity_userLoggedIn()) {
         echo '<div class="serendipity_center">' . WELCOME_BACK . ' ' . $_SESSION['serendipityUser'] . '</div>';
         echo '<form id="loginform" action="' . $logout_url . '" method="post">';
         echo '<input type="hidden" name="serendipity[logout]" value="true" />';
         echo '<input type="submit" name="serendipity[action]" value="' . LOGOUT . ' &gt;" />';
         $show_entry = false;
         $show_media = false;
         if (function_exists('serendipity_checkPermission')) {
             if (serendipity_checkPermission('adminEntries')) {
                 $show_entry = true;
             }
             if (serendipity_checkPermission('adminImages') && serendipity_checkPermission('adminImagesAdd')) {
                 $show_media = true;
             }
         } elseif (!$serendipity['no_create']) {
             $show_entry = true;
             $show_media = true;
         }
         if ($show_entry) {
             echo '<div class="loginform_link_entry"><a href="' . $serendipity['baseURL'] . 'serendipity_admin.php?serendipity[adminModule]=entries&amp;serendipity[adminAction]=new">' . NEW_ENTRY . '</a></div>';
         }
         if ($show_media) {
             echo '<div class="loginform_link_media"><a href="' . $serendipity['baseURL'] . 'serendipity_admin.php?serendipity[adminModule]=media&amp;serendipity[adminAction]=addSelect">' . ADD_MEDIA . '</a></div>';
         }
         echo '</form>';
         return true;
     }
     // Logout is performed in bundled event plugin!
     echo '<form id="loginform" action="' . $login_url . '" method="post">';
     echo '<fieldset id="loginform_userdata" style="border: none;">';
     echo '<label for="username">' . USERNAME . '</label>';
     echo '<input id="username" type="text" name="serendipity[user]" value="" />';
     echo '<label for="s9ypassw">' . PASSWORD . '</label>';
     echo '<input id="s9ypassw" type="password" name="serendipity[pass]" value="" />';
     echo '</fieldset>';
     echo '<fieldset id="loginform_login" style="border: none;">';
     echo '<input id="autologin" type="checkbox" name="serendipity[auto]" /><label for="autologin"> ' . AUTOMATIC_LOGIN . '</label>';
     echo '<input type="submit" id="loginform_submit" name="serendipity[action]" value="' . LOGIN . ' &gt;" />';
     echo '</fieldset>';
     echo '</form>';
     if (class_exists('serendipity_event_forgotpassword')) {
         echo '<div class="forgot_password"><a href="' . $serendipity['baseURL'] . '/serendipity_admin.php?forgotpassword=1">' . PLUGIN_EVENT_FORGOTPASSWORD_LOST_PASSWORD . '</a></div>';
     }
     return true;
 }
开发者ID:sqall01,项目名称:additional_plugins,代码行数:59,代码来源:serendipity_plugin_loginform.php

示例2: event_hook


//.........这里部分代码省略.........
                 if (empty($serendipity['GET']['subpage'])) {
                     $serendipity['GET']['subpage'] = $nice_url;
                 }
                 return true;
                 break;
             case 'entry_display':
                 if ($this->selected()) {
                     if (is_array($eventData)) {
                         $eventData['clean_page'] = true;
                         // This is important to not display an entry list!
                     } else {
                         $eventData = array('clean_page' => true);
                     }
                 }
                 // Silence pedantic warnings about missing default TZ settings
                 if (function_exists("date_default_timezone_get")) {
                     $tz = @date_default_timezone_get();
                     date_default_timezone_set($tz);
                 }
                 if (version_compare($serendipity['version'], '1.4', '<=')) {
                     $this->show();
                 }
                 return true;
                 break;
             case 'entries_header':
                 // this one really rolls up output
                 $this->show();
                 return true;
                 break;
                 /* put here all you css stuff you need for the frontend of eventcal pages */
             /* put here all you css stuff you need for the frontend of eventcal pages */
             case 'css':
                 if (stristr($eventData, '#eventcal_wrapper')) {
                     // class exists in CSS, so a user has customized it and we don't need default
                     return true;
                 }
                 $tfile = serendipity_getTemplateFile('style_eventcal_backend.css', 'serendipityPath');
                 if ($tfile) {
                     echo str_replace('{TEMPLATE_PATH}', 'templates/' . $serendipity['defaultTemplate'] . '/', @file_get_contents($tfile));
                 }
                 if (!$tfile || $tfile == 'style_eventcal_backend.css') {
                     $tfile = dirname(__FILE__) . '/style_eventcal_backend.css';
                     echo str_replace('{TEMPLATE_PATH}', $serendipity['eventcal']['pluginpath'], @file_get_contents($tfile));
                 }
                 return true;
                 break;
             case 'backend_sidebar_entries':
                 // forbid entry if not admin
                 if (serendipity_userLoggedIn() && $_SESSION['serendipityAuthedUser'] === true && $_SESSION['serendipityUserlevel'] == '255') {
                     echo '<li class="serendipitySideBarMenuLink serendipitySideBarMenuEntryLinks">
                         <a href="?serendipity[adminModule]=event_display&serendipity[adminAction]=eventcal">
                         ' . PLUGIN_EVENTCAL_ADMIN_NAME . '
                         </a>
                     </li>';
                 }
                 return true;
                 break;
             case 'backend_sidebar_entries_event_display_eventcal':
                 // forbid entry if not admin
                 if (serendipity_userLoggedIn() && $_SESSION['serendipityAuthedUser'] === true && $_SESSION['serendipityUserlevel'] == '255') {
                     if (!is_object($serendipity['smarty'])) {
                         serendipity_smarty_init();
                         // if not set to avoid member function assign() on a non-object error, start Smarty templating
                     }
                     /* show backend administration menu */
                     $this->backend_eventcal_menu();
                 }
                 return true;
                 break;
                 /* put here all you css stuff you need for the backend of eventcal pages */
             /* put here all you css stuff you need for the backend of eventcal pages */
             case 'css_backend':
                 if (stristr($eventData, '#eventcal_wrapper')) {
                     // class exists in CSS, so a user has customized it and we don't need default
                     return true;
                 }
                 $tfile = serendipity_getTemplateFile('style_eventcal_backend.css', 'serendipityPath');
                 if ($tfile) {
                     $tfilecontent = str_replace('{TEMPLATE_PATH}', 'templates/' . $serendipity['defaultTemplate'] . '/', @file_get_contents($tfile));
                 }
                 if ((!$tfile || $tfile == 'style_eventcal_backend.css') && !$tfilecontent) {
                     $tfile = dirname(__FILE__) . '/style_eventcal_backend.css';
                     $tfilecontent = str_replace('{TEMPLATE_PATH}', $serendipity['eventcal']['pluginpath'], @file_get_contents($tfile));
                 }
                 // add replaced css content to the end of serendipity_admin.css
                 if (!empty($tfilecontent)) {
                     $this->backend_eventcal_css($eventData, $tfilecontent);
                 }
                 return true;
                 break;
             default:
                 return false;
                 break;
         }
         // switch end
     } else {
         return false;
     }
     // isset hooks end
 }
开发者ID:sqall01,项目名称:additional_plugins,代码行数:101,代码来源:serendipity_event_cal.php

示例3: event_hook

 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';
//.........这里部分代码省略.........
开发者ID:sqall01,项目名称:additional_plugins,代码行数:101,代码来源:serendipity_event_adduser.php

示例4: event_hook

 function event_hook($event, &$bag, &$eventData, $addData = null)
 {
     global $serendipity;
     $debug = true;
     $hooks =& $bag->get('event_hooks');
     if (isset($hooks[$event])) {
         $captchas_ttl = $this->get_config('captchas_ttl', 7);
         $_captchas = $this->get_config('captchas', 'yes');
         $captchas = $_captchas !== 'no' && ($_captchas === 'yes' || $_captchas === 'scramble' || serendipity_db_bool($_captchas));
         // Check if the entry is older than the allowed amount of time. Enforce kaptchas if that is true
         // of if kaptchas are activated for every entry
         $show_captcha = $captchas && isset($eventData['timestamp']) && ($captchas_ttl < 1 || $eventData['timestamp'] < time() - $captchas_ttl * 60 * 60 * 24) ? true : false;
         // Plugins can override with custom captchas
         if (isset($serendipity['plugins']['disable_internal_captcha'])) {
             $show_captcha = false;
         }
         $forcemoderation = $this->get_config('forcemoderation', 60);
         $forcemoderation_treat = $this->get_config('forcemoderation_treat', 'moderate');
         $forcemoderationt = $this->get_config('forcemoderationt', 60);
         $forcemoderationt_treat = $this->get_config('forcemoderationt_treat', 'moderate');
         $links_moderate = $this->get_config('links_moderate', 10);
         $links_reject = $this->get_config('links_reject', 20);
         if (function_exists('imagettftext') && function_exists('imagejpeg')) {
             $max_char = 5;
             $min_char = 3;
             $use_gd = true;
         } else {
             $max_char = $min_char = 5;
             $use_gd = false;
         }
         switch ($event) {
             case 'fetchcomments':
                 if (is_array($eventData) && !$_SESSION['serendipityAuthedUser'] && serendipity_db_bool($this->get_config('hide_email', false))) {
                     // Will force emails to be not displayed in comments and RSS feed for comments. Will not apply to logged in admins (so not in the backend as well)
                     @reset($eventData);
                     while (list($idx, $comment) = each($eventData)) {
                         $eventData[$idx]['no_email'] = true;
                     }
                 }
                 break;
             case 'frontend_saveComment':
                 /*
                     $fp = fopen('/tmp/spamblock2.log', 'a');
                     fwrite($fp, date('Y-m-d H:i') . "\n" . print_r($eventData, true) . "\n" . print_r($addData, true) . "\n");
                     fclose($fp);
                 */
                 if (!is_array($eventData) || serendipity_db_bool($eventData['allow_comments'])) {
                     $this->checkScheme();
                     $serendipity['csuccess'] = 'true';
                     $logfile = $this->logfile = $this->get_config('logfile', $serendipity['serendipityPath'] . 'spamblock.log');
                     $required_fields = $this->get_config('required_fields', '');
                     $checkmail = $this->get_config('checkmail');
                     // Check CSRF [comments only, cannot be applied to trackbacks]
                     if ($addData['type'] == 'NORMAL' && serendipity_db_bool($this->get_config('csrf', true))) {
                         if (!serendipity_checkFormToken(false)) {
                             $this->log($logfile, $eventData['id'], 'REJECTED', PLUGIN_EVENT_SPAMBLOCK_CSRF_REASON, $addData);
                             $eventData = array('allow_comments' => false);
                             $serendipity['messagestack']['comments'][] = PLUGIN_EVENT_SPAMBLOCK_CSRF_REASON;
                         }
                     }
                     // Check required fields
                     if ($addData['type'] == 'NORMAL' && !empty($required_fields)) {
                         $required_field_list = explode(',', $required_fields);
                         foreach ($required_field_list as $required_field) {
                             $required_field = trim($required_field);
                             if (empty($addData[$required_field])) {
                                 $this->log($logfile, $eventData['id'], 'REJECTED', PLUGIN_EVENT_SPAMBLOCK_REASON_REQUIRED_FIELD, $addData);
                                 $eventData = array('allow_comments' => false);
                                 $serendipity['messagestack']['comments'][] = sprintf(PLUGIN_EVENT_SPAMBLOCK_REASON_REQUIRED_FIELD, $required_field);
                                 return false;
                             }
                         }
                     }
                     /*
                     if ($addData['type'] != 'NORMAL' && empty($addData['name'])) {
                         $eventData = array('allow_coments' => false);
                         $this->log($logfile, $eventData['id'], 'INVALIDGARV', 'INVALIDGARV', $addData);
                         return false;
                     }
                     */
                     // Check whether to allow comments from registered authors
                     if (serendipity_userLoggedIn() && $this->inGroup()) {
                         return true;
                     }
                     // Check if the user has verified himself via email already.
                     if ($addData['type'] == 'NORMAL' && (string) $checkmail === 'verify_once') {
                         $auth = serendipity_db_query("SELECT *\n                                                            FROM {$serendipity['dbPrefix']}options\n                                                           WHERE okey  = 'mail_confirm'\n                                                             AND name  = '" . serendipity_db_escape_string($addData['email']) . "'\n                                                             AND value = '" . serendipity_db_escape_string($addData['name']) . "'", true);
                         if (!is_array($auth)) {
                             // Filter authors names, Filter URL, Filter Content, Filter Emails, Check for maximum number of links before rejecting
                             // moderate false
                             if (false === $this->wordfilter($logfile, $eventData, $wordmatch, $addData, true)) {
                                 // already there #$this->log($logfile, $eventData['id'], 'REJECTED', PLUGIN_EVENT_SPAMBLOCK_FILTER_WORDS, $addData);
                                 // already there #$eventData = array('allow_comments' => false);
                                 // already there #$serendipity['messagestack']['emails'][] = PLUGIN_EVENT_SPAMBLOCK_ERROR_BODY;
                                 return false;
                             } elseif (serendipity_db_bool($this->get_config('killswitch', false)) === true) {
                                 $this->log($logfile, $eventData['id'], 'REJECTED', PLUGIN_EVENT_SPAMBLOCK_REASON_KILLSWITCH, $addData);
                                 $eventData = array('allow_comments' => false);
                                 $serendipity['messagestack']['comments'][] = PLUGIN_EVENT_SPAMBLOCK_ERROR_KILLSWITCH;
                                 return false;
//.........这里部分代码省略.........
开发者ID:vonnordmann,项目名称:Serendipity,代码行数:101,代码来源:serendipity_event_spamblock.php

示例5: die

<?php

if (IN_serendipity !== true) {
    die("Don't hack!");
}
$probelang = dirname(__FILE__) . '/' . $serendipity['charset'] . 'lang_' . $serendipity['lang'] . '.inc.php';
if (file_exists($probelang)) {
    include $probelang;
}
include dirname(__FILE__) . '/lang_en.inc.php';
$serendipity['smarty']->assign(array('currpage' => "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']));
$template_config = array(array('var' => 'feedburner', 'name' => FEEDBURNER_102, 'type' => 'string', 'default' => ''), array('var' => 'delicious', 'name' => DELICIOUS_102, 'type' => 'string', 'default' => ''), array('var' => 'flickr', 'name' => 'flickr URI', 'type' => 'string', 'default' => ''), array('var' => 'technorati', 'name' => 'technorati URI', 'type' => 'string', 'default' => ''), array('var' => 'addthiswidget', 'name' => 'addthis.com Bookmark Widget', 'type' => 'boolean', 'default' => 'false'), array('var' => 'addthisaccount', 'name' => 'addthis.com Account', 'type' => 'string', 'default' => ''), array('var' => 'amount', 'name' => NAVLINK_AMOUNT, 'type' => 'string', 'default' => '5'));
$template_loaded_config = serendipity_loadThemeOptions($template_config, $serendipity['smarty_vars']['template_option']);
if (isset($_POST['serendipity']['template']['amount']) && serendipity_userLoggedIn() && serendipity_checkPermission('adminTemplates')) {
    $temp_post = $_POST['serendipity']['template']['amount'];
    if (is_numeric($temp_post)) {
        $template_loaded_config['amount'] = $temp_post;
    }
}
$navlinks = array();
for ($i = 0; $i < $template_loaded_config['amount']; $i++) {
    $navlinks[] = array('title' => $template_loaded_config['navlink' . $i . 'text'], 'href' => $template_loaded_config['navlink' . $i . 'url'], 'akey' => $template_loaded_config['navlink' . $i . 'key']);
    $template_config[] = array('var' => 'navlink' . $i . 'text', 'name' => NAV_LINK_TEXT . ' #' . $i, 'type' => 'string', 'default' => 'Link #' . $i);
    $template_config[] = array('var' => 'navlink' . $i . 'url', 'name' => NAV_LINK_URL . ' #' . $i, 'type' => 'string', 'default' => '#');
    $template_config[] = array('var' => 'navlink' . $i . 'key', 'name' => NAV_LINK_KEY . ' #' . $i, 'type' => 'string', 'default' => $i);
}
$serendipity['smarty']->assign_by_ref('navlinks', $navlinks);
开发者ID:yellowled,项目名称:serendipity-themes,代码行数:27,代码来源:config.inc.php

示例6: generate_content

 function generate_content(&$title)
 {
     global $serendipity;
     $title = $this->get_config('title');
     if (!serendipity_db_bool($this->get_config('sidebar_login', true))) {
         // Disable sidebar; Fallback to Event-Plugin.
         return false;
     }
     if (serendipity_userLoggedIn()) {
         return false;
     }
     $ug = (array) explode(',', $this->get_config('usergroups', false));
     foreach ($ug as $cid) {
         if ($cid === false || empty($cid)) {
             continue;
         }
         $this->usergroups[$cid] = $cid;
     }
     $url = serendipity_currentURL();
     $username = substr($serendipity['POST']['adduser_user'], 0, 40);
     $password = substr($serendipity['POST']['adduser_pass'], 0, 32);
     $email = $serendipity['POST']['adduser_email'];
     echo '<div style="padding-left: 4px; padding-right: 10px"><a id="adduser"></a>';
     if (!serendipity_common_adduser::adduser($username, $password, $email, $this->get_config('userlevel', USERLEVEL_EDITOR), $this->usergroups, serendipity_db_bool($this->get_config('no_create', false)), serendipity_db_bool($this->get_config('right_publish', true)), serendipity_db_bool($this->get_config('straight_insert', false)), serendipity_db_bool($this->get_config('approve', false)), serendipity_db_bool($this->get_config('use_captcha', false)))) {
         serendipity_common_adduser::loginform($url, array(), $this->get_config('instructions'), $username, $password, $email, serendipity_db_bool($this->get_config('use_captcha', false)));
     }
     echo '</div>';
     return true;
 }
开发者ID:sqall01,项目名称:additional_plugins,代码行数:29,代码来源:serendipity_plugin_adduser.php

示例7: serendipity_printComments

/**
 * Print a list of comments to an entry
 *
 * @access public
 * @param   array       The list of comments to display
 * @param   int         The parentID of a comment to show. Can contain the constant for VIEWMODE_THREADED/LINEAR. [recursive usage]
 * @param   int         The current nesting depth of a comment [recursive usage]
 * @param   string      A string repesenting the actual comment (1.1.2.1)
 * @return  string      The HTML construct of all comments
 */
function serendipity_printComments($comments, $parentid = 0, $depth = 0, $trace = null, $smarty_block = 'COMMENTS', $smarty_file = 'comments.tpl')
{
    global $serendipity;
    static $_smartyComments;
    /* - $_smartyComments holds the ending smarty array.
       - $depth is the current depth of the recurrence.
       - $i is the position in the current depth. */
    if ($parentid === VIEWMODE_THREADED) {
        $parentid = 0;
    }
    /* Wait a second, we just got attacked by a call with level 0,
       this must mean we've started over */
    if ($depth == 0) {
        $_smartyComments = array();
    }
    $i = 0;
    foreach ($comments as $comment) {
        if ($parentid === VIEWMODE_LINEAR || !isset($comment['parent_id']) || $comment['parent_id'] == $parentid) {
            $i++;
            $comment['comment'] = serendipity_specialchars(strip_tags($comment['body']));
            $comment['url'] = strip_tags($comment['url']);
            $comment['link_delete'] = $serendipity['baseURL'] . 'comment.php?serendipity[delete]=' . $comment['id'] . '&amp;serendipity[entry]=' . $comment['entry_id'] . '&amp;serendipity[type]=comments';
            /* Fix invalid cases in protocoll part */
            if (!empty($comment['url'])) {
                $comment['url'] = preg_replace('@^http://@i', 'http://', $comment['url']);
                $comment['url'] = preg_replace('@^https://@i', 'https://', $comment['url']);
            }
            /* Fix fucked links */
            if (!empty($comment['url']) && substr($comment['url'], 0, 7) != 'http://' && substr($comment['url'], 0, 8) != 'https://') {
                $comment['url'] = 'http://' . $comment['url'];
            }
            if (!empty($comment['url'])) {
                if (!@parse_url($comment['url'])) {
                    $comment['url'] = '';
                }
                $comment['url'] = serendipity_specialchars($comment['url'], ENT_QUOTES);
            }
            $addData = array('from' => 'functions_entries:printComments');
            serendipity_plugin_api::hook_event('frontend_display', $comment, $addData);
            if (isset($comment['no_email']) && $comment['no_email']) {
                $comment['email'] = false;
            } elseif (!empty($comment['email'])) {
                $comment['clear_email'] = $comment['email'];
                $comment['email'] = serendipity_specialchars(str_replace('@', '[at]', $comment['email']));
            }
            $comment['body'] = $comment['comment'];
            $comment['pos'] = $i;
            $comment['trace'] = $trace . $i;
            $comment['depth'] = $depth;
            $comment['author'] = serendipity_specialchars($comment['author']);
            if (isset($comment['title'])) {
                $comment['title'] = serendipity_specialchars($comment['title']);
            }
            if (serendipity_userLoggedIn()) {
                if ($comment['subscribed'] == 'true') {
                    if ($comment['status'] == 'approved') {
                        $comment['body'] .= '<div class="serendipity_subscription_on"><em>' . ACTIVE_COMMENT_SUBSCRIPTION . '</em></div>';
                    } else {
                        $comment['body'] .= '<div class="serendipity_subscription_pending"><em>' . PENDING_COMMENT_SUBSCRIPTION . '</em></div>';
                    }
                } else {
                    #$comment['body'] .= '<div class="serendipity_subscription_off"><em>' . NO_COMMENT_SUBSCRIPTION . '</em></div>';
                }
            }
            $_smartyComments[] = $comment;
            if ($comment['id'] && $parentid !== VIEWMODE_LINEAR) {
                serendipity_printComments($comments, $comment['id'], $depth + 1, $trace . $i . '.', $smarty_block, $smarty_file);
            }
        }
    }
    /* We are inside a recusive child, and we need to break out */
    if ($depth !== 0) {
        return true;
    }
    $serendipity['smarty']->assignByRef($smarty_block == 'COMMENTS' ? 'comments' : 'trackbacks', $_smartyComments);
    unset($_smartyComments);
    return serendipity_smarty_fetch($smarty_block, $smarty_file);
}
开发者ID:jimjag,项目名称:Serendipity,代码行数:88,代码来源:functions_comments.inc.php

示例8: foreach

            if (is_array($metadata['additional_fields'])) {
                // Fix up array keys, because "." are not allowed when wanting to output using Smarty
                foreach ($metadata['additional_fields'] as $_aid => $af) {
                    $aid = str_replace('.', '', $_aid);
                    $metadata['additional_fields'][$aid] = $af;
                }
            }
            $metadata['fullFeed'] = $plugin->get_config('fullfeed', false);
            if ($metadata['fullFeed'] === 'client') {
                if ($_GET['fullFeed'] || $serendipity['GET']['fullFeed']) {
                    $metadata['fullFeed'] = true;
                } else {
                    $metadata['fullFeed'] = false;
                }
            }
            if ($_GET['type'] == 'content' && !isset($_GET['category']) && !isset($serendipity['GET']['tag']) && $plugin->get_config('show_feedburner') === 'force' && !preg_match('@FeedBurn@i', $_SERVER['HTTP_USER_AGENT']) && !(serendipity_userLoggedIn() && isset($_GET['forceLocal']))) {
                $fbid = $plugin->get_config('fb_id');
                if (stristr($fbid, 'http://')) {
                    $url = $fbid;
                } else {
                    $url = 'http://feeds.feedburner.com/' . $fbid;
                }
                header('Status: 302 Found');
                header('Location: ' . $url);
                exit;
            }
            $metadata['showMail'] = serendipity_db_bool($plugin->get_config('show_mail', $metadata['showMail']));
            break;
        }
    }
}
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:31,代码来源:rss.php

示例9: event_hook

    function event_hook($event, &$bag, &$eventData, $addData = null)
    {
        global $serendipity;
        $hooks =& $bag->get('event_hooks');
        $serendipity['plugin_dlm_version'] =& $bag->get('version');
        if (isset($hooks[$event])) {
            switch ($event) {
                case 'entry_display':
                    if ($this->selected()) {
                        if (is_array($eventData)) {
                            $eventData['clean_page'] = true;
                        } else {
                            $eventData = array('clean_page' => true);
                        }
                    }
                    return true;
                    break;
                case 'backend_sidebar_entries':
                    $this->setupDB();
                    // forbid entry if not admin
                    if (serendipity_userLoggedIn() && $_SESSION['serendipityAuthedUser'] === true && $_SESSION['serendipityUserlevel'] == '255') {
                        ?>
                    <li class="serendipitySideBarMenuLink serendipitySideBarMenuEntryLinks"><a href="?serendipity[adminModule]=event_display&amp;serendipity[adminAction]=downloadmanager"><?php 
                        echo PLUGIN_DOWNLOADMANAGER_TITLE;
                        ?>
</a></li>
                    <?php 
                    }
                    break;
                case 'backend_dlm_filecopy':
                    if (!serendipity_db_bool($this->get_config('chg2archivespath'))) {
                        $oldfilepath = $this->get_config('absdownloadspath') ? $this->get_config('absdownloadspath') : $serendipity['serendipityPath'] . 'templates_c/.dlmanager/files';
                        $newfilepath = $serendipity['serendipityPath'] . 'archives/.dlm/files';
                        // upgrade the old encoded files to new dir
                        $updown = $this->backend_dlm_upgrade($oldfilepath, $newfilepath, 'absdownloadspath');
                        $oldinpath = $this->get_config('absincomingpath') ? $this->get_config('absincomingpath') : $serendipity['serendipityPath'] . $serendipity['uploadPath'] . '.dlmanager/incoming';
                        $newinpath = $serendipity['serendipityPath'] . 'archives/.dlm/ftpin';
                        // upgrade the old incoming ftp/trash files to new dir
                        $upin = $this->backend_dlm_upgrade($oldinpath, $newinpath, 'absincomingpath');
                        if (true === ($updown || $upin)) {
                            $this->set_config('chg2archivespath', true);
                            $url = $_SERVER['PHP_SELF'] . '?serendipity[adminModule]=event_display&serendipity[adminAction]=downloadmanager&cpdone=1';
                            $this->backend_dlm_refresh($url);
                        }
                    }
                    break;
                case 'backend_sidebar_entries_event_display_downloadmanager':
                    $serendipity['dlm']['stopadminprocess'] = false;
                    if (!is_object(isset($serendipity['smarty']))) {
                        serendipity_smarty_init();
                        // if not set to avoid member function assign() on a non-object error, start Smarty templating
                    }
                    // load the 0.24 upgrade hook
                    if (version_compare($serendipity['plugin_dlm_version'], '0.24', '<=')) {
                        serendipity_plugin_api::hook_event('backend_dlm_filecopy', $addData);
                    } else {
                        if (!serendipity_db_bool($this->get_config('chg2archivespath'))) {
                            $this->set_config('chg2archivespath', true);
                        }
                    }
                    if (intval($_GET['cpdone']) == 0) {
                        $this->set_config('chg2archivespath', true);
                    }
                    if (intval(isset($_GET['cpdone'])) || $serendipity['dlm']['stopadminprocess'] === false) {
                        $this->ADMIN_showDownloads();
                    }
                    break;
                case 'external_plugin':
                    $uri_parts = explode('?', str_replace('&amp;', '&', $eventData));
                    // Try to get request parameters from eventData name
                    if (!empty($uri_parts[1])) {
                        $reqs = explode('&', $uri_parts[1]);
                        foreach ($reqs as $id => $req) {
                            $val = explode('=', $req);
                            if (empty($_REQUEST[$val[0]])) {
                                $_REQUEST[$val[0]] = $val[1];
                            }
                        }
                    }
                    $parts = explode('_', $uri_parts[0]);
                    if (!empty($parts[1])) {
                        $param = (int) $parts[1];
                    } else {
                        $param = null;
                    }
                    switch ($parts[0]) {
                        case 'dlfile':
                            $fileid = intval($parts[1]);
                            serendipity_db_query("UPDATE {$serendipity['dbPrefix']}dma_downloadmanager_files SET dlcount = dlcount+1 WHERE id = " . $fileid);
                            $sql = "SELECT * FROM {$serendipity['dbPrefix']}dma_downloadmanager_files WHERE id = " . $fileid;
                            $file = serendipity_db_query($sql);
                            $mime = $this->getMime($file[0]['realfilename']);
                            $contenttype = $mime['TYPE'];
                            $filename = $file[0]['realfilename'];
                            $filename = str_replace(' ', '_', $filename);
                            $path = $this->globs['dlmpath'];
                            $sysname = $file[0]['systemfilename'];
                            $filesize = $file[0]['filesize'];
                            if (function_exists("getallheaders")) {
                                $headers = getallheaders();
//.........这里部分代码省略.........
开发者ID:sqall01,项目名称:additional_plugins,代码行数:101,代码来源:serendipity_event_downloadmanager.php

示例10: event_hook

    function event_hook($event, &$bag, &$eventData, $addData = null)
    {
        global $serendipity;
        static $cache = null;
        static $method = null;
        $hooks =& $bag->get('event_hooks');
        if (isset($hooks[$event])) {
            switch ($event) {
                case 'css':
                    if (strpos($eventData, '#twitter_update_list')) {
                        // class exists in CSS, so a user has customized it and we don't need default
                        return true;
                    }
                    $this->addToCSS($eventData);
                    return true;
                    break;
                case 'backend_header':
                    $this->add_backend_header_parts();
                    return true;
                case 'backend_publish':
                    // If signaled, we don't want to announce, don't do it!
                    if (isset($serendipity['POST']['properties']['microblogging_dontannounce'])) {
                        return true;
                    }
                    // eventData is the entry here
                    return $this->twitter_published_entry($eventData);
                    break;
                case 'backend_delete_entry':
                    $this->entry_deleted((int) $eventData);
                    return true;
                    break;
                case 'external_plugin':
                    $parts = explode('_', $eventData);
                    $command = $parts[0];
                    if ($command == 'cacheplugintwitter') {
                        $next_check = (int) $this->updateTwitterTimelineCache($parts);
                        $this->show_img(dirname(__FILE__) . '/img/pixel.png', (int) $next_check);
                        return true;
                    }
                    $parts = explode('=', $eventData);
                    $command = $parts[0];
                    $fparts = explode('&', $parts[1]);
                    if ($command == "tweetback") {
                        if (!$_SESSION['serendipityAuthedUser']) {
                            echo "DON'T HACK!<br>";
                            return true;
                        }
                        $article_url = preg_replace('@^tweetback=@', '', $eventData);
                        $article_url = $this->urldecode($article_url);
                        if (empty($article_url)) {
                            echo "Dont hack!";
                        }
                        $shorturls = $this->create_short_urls($article_url);
                        $entries = $entries = $this->search($article_url, null);
                        if (is_array($entries)) {
                            $this->debug_entries($entries, $article_url, $shorturls);
                        } else {
                            echo "<p><b>ERROR</b> while fetching search results for URL {$article_url}<br/>Might be a Twitter Overload.<br/>Try again later</p>";
                        }
                        return true;
                    } else {
                        if ($command == "gtweetback.png") {
                            $nextcheck = $this->check_tweetbacks_global();
                            if (empty($nextcheck)) {
                                $nextcheck = time() + 30 * 60;
                            }
                            // Default for hackers
                            $this->show_img(dirname(__FILE__) . '/img/pixel.png', $nextcheck, 'image/png');
                            return true;
                        } else {
                            if ($command == "twitteroa-del") {
                                $this->twitteroalog($command);
                                // Remove current twitter OAuth key and token to allow to re-connect
                                if (!serendipity_userLoggedIn()) {
                                    die("Don't hack!");
                                }
                                $idx = $fparts[0];
                                // Remove access tokens
                                $u = $this->get_config('twittername' . $idx);
                                $kd = $this->set_config('twitteroa_key_' . $idx . $u, '');
                                $td = $this->set_config('twitteroa_token_' . $idx . $u, '');
                                // Remove old application, so it will change to the s9y app next time:
                                $csecret = $this->set_config('twitteroa_consumer_secret' . $idx, '');
                                $ckey = $this->set_config('twitteroa_consumer_key' . $idx, '');
                                serendipity_die('<div align="center">
                        <h1>' . PLUGIN_EVENT_TWITTER_VERBINDUNG_DEL_OK . '</h1>
                        <a href="javascript:window.close()">' . PLUGIN_EVENT_TWITTER_CLOSEWINDOW . '</a>
                        </div>');
                                return true;
                            } else {
                                if ($command == "twitteroa-redirect") {
                                    $this->twitteroalog($command);
                                    if (!serendipity_userLoggedIn()) {
                                        die("Don't hack!");
                                    }
                                    $idx = $fparts[0];
                                    $u = $this->get_config('twittername' . $idx);
                                    $kd = $this->get_config('twitteroa_key_' . $idx . $u);
                                    $td = $this->get_config('twitteroa_token_' . $idx . $u);
                                    $ckey = $this->get_config('twitteroa_consumer_key' . $idx);
//.........这里部分代码省略.........
开发者ID:sqall01,项目名称:additional_plugins,代码行数:101,代码来源:serendipity_event_twitter.php

示例11: checkSubmit

 /**
  * Guestbook form submit POST checks, validate & insert into db
  *
  * @return boolean on error
  */
 function checkSubmit()
 {
     global $serendipity;
     global $messages;
     if (!is_array($messages)) {
         $messages = array();
     }
     $valid['captcha'] = FALSE;
     $valid['data_length'] = FALSE;
     $valid['data_email'] = FALSE;
     $valid['message'] = FALSE;
     $serendipity['guestbook_message_header'] = FALSE;
     $authenticated_user = serendipity_userLoggedIn() ? true : false;
     $gb_automoderate = serendipity_db_bool($this->get_config('automoderate'), false);
     if (empty($serendipity['POST']['guestbookform'])) {
         return false;
     }
     if (!isset($serendipity['POST']['email']) || empty($serendipity['POST']['email'])) {
         $serendipity['POST']['email'] = 'nospam@example.com';
     }
     if (empty($serendipity['POST']['name']) && empty($serendipity['POST']['email']) && empty($serendipity['POST']['comment'])) {
         array_push($messages, PLUGIN_GUESTBOOK_MESSAGE . ': ' . PLUGIN_GUESTBOOK_ERROR_DATA . ' - ' . ERROR_NOINPUT);
         return false;
     }
     if (!$serendipity['POST']['email'] || !$serendipity['POST']['name'] || !$serendipity['POST']['comment']) {
         array_push($messages, ERROR_NOINPUT);
         return false;
     }
     // do not allow non logged-in manual BBCode in comments
     if (!$authenticated_user) {
         $serendipity['POST']['comment'] = $this->bbc_reverse($serendipity['POST']['comment']);
     }
     // find Spamblock global set force auto moderation
     if ($hit = preg_grep("|/forcemoderation_treat|i", array_keys($serendipity))) {
         $forcemoderate = array_values($hit);
     }
     // if force moderate is set to moderate, advice security to not support 'stripped' or 'stripped-by-key' POST mark
     // this does only happen true, if not automoderate is set in both plugins and strip tags really removed some tags.
     if (isset($serendipity[$forcemoderate[0]]) == 'moderate' && $gb_automoderate === true) {
         $serendipity['POST'] = $this->strip_security($serendipity['POST'], array('name', 'email', 'comment', 'admincomment', 'url'), false, false);
     } else {
         $serendipity['POST'] = $this->strip_security($serendipity['POST'], array('name', 'email', 'comment', 'admincomment', 'url'));
     }
     if ($serendipity['POST']['stripped'] === true) {
         array_push($messages, ERROR_OCCURRED . '<br>' . ERROR_DATASTRIPPED);
         return false;
     }
     // Fake call to spamblock and other comment plugins, if not in backend.
     $ca = array('id' => 0, 'allow_comments' => true, 'last_modified' => time(), 'timestamp' => strtotime("-8 day", time()));
     if (!is_numeric($_POST['guestbook']['id'])) {
         $commentInfo = array('type' => 'NORMAL', 'source' => 'guestbookform', 'name' => $serendipity['POST']['name'], 'email' => $serendipity['POST']['email'], 'url' => $serendipity['POST']['url'], 'comment' => $serendipity['POST']['comment']);
         serendipity_plugin_api::hook_event('frontend_saveComment', $ca, $commentInfo);
     }
     // End of fake call.
     // listen to Spamblock Plugin and do some specific guestbook checks, if captcha and entry were allowed
     if (serendipity_db_bool($ca['allow_comments']) === true) {
         if (trim($serendipity['POST']['name']) == '') {
             array_push($messages, ERROR_NAMEEMPTY);
         }
         if (isset($serendipity['POST']['url'])) {
             $serendipity['POST']['url'] = trim($serendipity['POST']['url']);
         }
         if (trim($serendipity['POST']['comment']) == '') {
             array_push($messages, ERROR_TEXTEMPTY);
         }
         if (trim($serendipity['POST']['email']) == '') {
             array_push($messages, ERROR_EMAILEMPTY);
         }
         if (strlen(trim($serendipity['POST']['name'])) < 3 || strlen(trim($serendipity['POST']['comment'])) < 10) {
             array_push($messages, ERROR_DATATOSHORT);
         } else {
             $valid['data_length'] = TRUE;
         }
         if ($this->strip_input($serendipity['POST']['comment']) === false) {
             array_push($messages, ERROR_DATANOTAGS . ' ' . $serendipity['messagestack']['comments'][0]);
             if (!empty($serendipity['messagestack']['comments'][0])) {
                 unset($serendipity['messagestack']['comments']);
             }
         }
         if (isset($serendipity['POST']['email']) && !empty($serendipity['POST']['email']) && trim($serendipity['POST']['email']) != '') {
             if (!$this->is_valid_email($serendipity['POST']['email'])) {
                 array_push($messages, ERROR_NOVALIDEMAIL . ' <span class="gb_msgred">' . $this->html_specialchars($serendipity['POST']['email']) . '</span>');
             } else {
                 $valid['data_email'] = TRUE;
             }
         }
         if (isset($serendipity['POST']['captcha']) && !empty($serendipity['POST']['captcha'])) {
             if (serendipity_db_bool($ca['allow_comments']) === true || strtolower($serendipity['POST']['captcha']) == strtolower($_SESSION['spamblock']['captcha'])) {
                 $valid['captcha'] = TRUE;
             } elseif (!$authenticated_user) {
                 if ($serendipity['csuccess'] != 'moderate') {
                     array_push($messages, ERROR_ISFALSECAPTCHA);
                 }
                 /* else {
                        array_push($messages, $serendipity['moderate_reason'] . PLUGIN_GUESTBOOK_AUTOMODERATE_ERROR . PLUGIN_GUESTBOOK_DBDONE_APP);
//.........这里部分代码省略.........
开发者ID:sqall01,项目名称:additional_plugins,代码行数:101,代码来源:serendipity_event_guestbook.php

示例12: array

$startpagerows = array();
for ($j = 0; $j < $template_loaded_config['startpage_cat_windows']; $j++) {
    $startpagerows[] = array('cat_intro' => $template_loaded_config['startpagerow' . $j . 'cat_intro'], 'win_column' => $template_loaded_config['startpagerow' . $j . 'win_column'], 'kategorie' => $template_loaded_config['startpagerow' . $j . 'kategorie'], 'show_title' => $template_loaded_config['startpagerow' . $j . 'show_title'], 'title_text' => $template_loaded_config['startpagerow' . $j . 'title_text'], 'truncated_qty' => $template_loaded_config['startpagerow' . $j . 'truncated_qty'], 'titlesonly_qty' => $template_loaded_config['startpagerow' . $j . 'titlesonly_qty'], 'thedesign' => $template_loaded_config['startpagerow' . $j . 'thedesign'], 'the_title' => $template_loaded_config['startpagerow' . $j . 'the_title'], 'catdescription' => $template_loaded_config['startpagerow' . $j . 'catdescription']);
    $template_config[] = array('var' => 'startpagerow' . $j . 'cat_intro', 'type' => 'content', 'default' => ' <b><p style="color:#FFFFFF; background-color: blue">' . STARTROWS_TITLE . ' #' . $j . STARTROW . ' </p></b>');
    $template_config[] = array('var' => 'startpagerow' . $j . 'win_column', 'name' => WIN_COLUMN, 'type' => 'select', 'default' => '3', 'select_values' => array('3' => '3 Spalten'));
    $template_config[] = array('var' => 'startpagerow' . $j . 'kategorie', 'name' => STARTROW_ASSIGN_ID, 'type' => 'select', 'default' => '', 'select_values' => $catsel);
    $template_config[] = array('var' => 'startpagerow' . $j . 'show_title', 'name' => STARTROW_SHOW_TITLE, 'type' => 'boolean', 'default' => 'true');
    $template_config[] = array('var' => 'startpagerow' . $j . 'title_text', 'name' => STARTROW_TITLE_TEXT, 'type' => 'string', 'default' => '');
    $template_config[] = array('var' => 'startpagerow' . $j . 'truncated_qty', 'name' => STARTROW_TRUNCATE_QTY, 'type' => 'string', 'default' => '100');
    $template_config[] = array('var' => 'startpagerow' . $j . 'titlesonly_qty', 'name' => STARTROW_TITLES_ONLY_QTY, 'type' => 'string', 'default' => '3');
    $template_config[] = array('var' => 'startpagerow' . $j . 'thedesign', 'name' => THE_DESIGN, 'type' => 'select', 'default' => 'design1', 'select_values' => array('design1' => 'Design 1', 'design2' => 'Design 2', 'designac' => 'Acordion', 'designslide' => 'Slider Design', 'designtabs' => 'Design Tabs'));
    $template_config[] = array('var' => 'startpagerow' . $j . 'the_title', 'name' => THE_TITLE, 'type' => 'string', 'default' => 'A Title for row ' . $j);
    $template_config[] = array('var' => 'startpagerow' . $j . 'catdescription', 'name' => CATDESCRIPTION, 'type' => 'string', 'default' => 'This  is Description ' . $j);
}
$serendipity['smarty']->assign_by_ref('startpagerows', $startpagerows);
if (isset($_POST['serendipity']['template']['startpage_cat_windows']) && serendipity_userLoggedIn() && serendipity_checkPermission('adminTemplates')) {
    $temp_post = $_POST['serendipity']['template']['startpage_cat_windows'];
    if (is_numeric($temp_post)) {
        $template_loaded_config['startpage_cat_windows'] = $temp_post;
    }
}
// Save custom field variables within the serendipity "Edit/Create Entry" backend.
//                Any custom variables can later be queried inside the .tpl files through
//                  {if $entry.properties.key_value == 'true'}...{/if}
// Function to get the content of a non-boolean entry variable
function entry_option_get_value($property_key, &$eventData)
{
    global $serendipity;
    if (isset($eventData['properties'][$property_key])) {
        return $eventData['properties'][$property_key];
    }
开发者ID:reinhardl,项目名称:Universal,代码行数:31,代码来源:config.inc.php

示例13: serendipity_smarty_init

/**
 * Initialize the Smarty framework for use in Serendipity
 *
 * @access public
 * @return null
 */
function serendipity_smarty_init($vars = array())
{
    global $serendipity, $template_config;
    if (!isset($serendipity['smarty'])) {
        $template_dir = $serendipity['serendipityPath'] . $serendipity['templatePath'] . $serendipity['template'];
        if (!defined('IN_serendipity_admin') && file_exists($template_dir . '/template.inc.php')) {
            // If this file exists, a custom template engine will be loaded.
            // Beware: Smarty is used in the Admin backend, despite of this.
            include $template_dir . '/template.inc.php';
        } else {
            // Set a session variable if Smarty fails:
            $prev_smarty = $_SESSION['no_smarty'];
            $_SESSION['no_smarty'] = true;
            // Default Smarty Engine will be used
            @define('SMARTY_DIR', S9Y_PEAR_PATH . 'Smarty/libs/');
            if (!class_exists('Smarty')) {
                include SMARTY_DIR . 'Smarty.class.php';
            }
            if (!class_exists('Smarty')) {
                return false;
            }
            $serendipity['smarty'] = new Smarty();
            if ($serendipity['production'] === 'debug') {
                $serendipity['smarty']->force_compile = true;
                $serendipity['smarty']->debugging = true;
            }
            $serendipity['smarty']->template_dir = array($template_dir);
            $p = explode(',', $serendipity['template_engine']);
            foreach ($p as $te) {
                $serendipity['smarty']->template_dir[] = $serendipity['serendipityPath'] . $serendipity['templatePath'] . $te;
            }
            $serendipity['smarty']->template_dir[] = $serendipity['serendipityPath'] . $serendipity['templatePath'] . 'default';
            $serendipity['smarty']->compile_dir = $serendipity['serendipityPath'] . PATH_SMARTY_COMPILE;
            if (!is_dir($serendipity['smarty']->compile_dir) || !is_writable($serendipity['smarty']->compile_dir)) {
                printf(DIRECTORY_WRITE_ERROR, $serendipity['smarty']->compile_dir);
                return false;
            }
            // Hooray for Smarty:
            $_SESSION['no_smarty'] = $prev_smarty;
            $serendipity['smarty']->config_dir = $template_dir;
            $serendipity['smarty']->secure_dir = array($serendipity['serendipityPath'] . $serendipity['templatePath']);
            $serendipity['smarty']->security_settings['MODIFIER_FUNCS'] = array('sprintf', 'sizeof', 'count', 'rand', 'print_r', 'str_repeat');
            $serendipity['smarty']->security_settings['ALLOW_CONSTANTS'] = true;
            $serendipity['smarty']->security = true;
            $serendipity['smarty']->use_sub_dirs = false;
            $serendipity['smarty']->compile_check = true;
            $serendipity['smarty']->compile_id =& $serendipity['template'];
            $serendipity['smarty']->register_modifier('makeFilename', 'serendipity_makeFilename');
            $serendipity['smarty']->register_modifier('xhtml_target', 'serendipity_xhtml_target');
            $serendipity['smarty']->register_modifier('emptyPrefix', 'serendipity_emptyPrefix');
            $serendipity['smarty']->register_modifier('formatTime', 'serendipity_smarty_formatTime');
            $serendipity['smarty']->register_modifier('serendipity_utf8_encode', 'serendipity_utf8_encode');
            $serendipity['smarty']->register_modifier('ifRemember', 'serendipity_ifRemember');
            $serendipity['smarty']->register_modifier('checkPermission', 'serendipity_checkPermission');
            $serendipity['smarty']->register_modifier('serendipity_refhookPlugin', 'serendipity_smarty_refhookPlugin');
            $serendipity['smarty']->register_function('serendipity_printSidebar', 'serendipity_smarty_printSidebar');
            $serendipity['smarty']->register_function('serendipity_hookPlugin', 'serendipity_smarty_hookPlugin');
            $serendipity['smarty']->register_function('serendipity_showPlugin', 'serendipity_smarty_showPlugin');
            $serendipity['smarty']->register_function('serendipity_getFile', 'serendipity_smarty_getFile');
            $serendipity['smarty']->register_function('serendipity_printComments', 'serendipity_smarty_printComments');
            $serendipity['smarty']->register_function('serendipity_printTrackbacks', 'serendipity_smarty_printTrackbacks');
            $serendipity['smarty']->register_function('serendipity_rss_getguid', 'serendipity_smarty_rss_getguid');
            $serendipity['smarty']->register_function('serendipity_fetchPrintEntries', 'serendipity_smarty_fetchPrintEntries');
            $serendipity['smarty']->register_function('serendipity_getTotalCount', 'serendipity_smarty_getTotalCount');
            $serendipity['smarty']->register_function('pickKey', 'serendipity_smarty_pickKey');
            $serendipity['smarty']->register_function('serendipity_showCommentForm', 'serendipity_smarty_showCommentForm');
            $serendipity['smarty']->register_function('serendipity_getImageSize', 'serendipity_smarty_getImageSize');
            $serendipity['smarty']->register_prefilter('serendipity_replaceSmartyVars');
        }
        if (!isset($serendipity['smarty_raw_mode'])) {
            if (file_exists($serendipity['smarty']->config_dir . '/layout.php') && $serendipity['template'] != 'default') {
                $serendipity['smarty_raw_mode'] = true;
            } else {
                $serendipity['smarty_raw_mode'] = false;
            }
        }
        if (!isset($serendipity['smarty_file'])) {
            $serendipity['smarty_file'] = 'index.tpl';
        }
        $category = false;
        $category_info = array();
        if (isset($serendipity['GET']['category'])) {
            $category = (int) $serendipity['GET']['category'];
            if (isset($GLOBALS['cInfo'])) {
                $category_info = $GLOBALS['cInfo'];
            } else {
                $category_info = serendipity_fetchCategoryInfo($category);
            }
        }
        if (!isset($serendipity['smarty_vars']['head_link_stylesheet'])) {
            $serendipity['smarty_vars']['head_link_stylesheet'] = serendipity_rewriteURL('serendipity.css');
        }
        $serendipity['smarty']->assign(array('head_charset' => LANG_CHARSET, 'head_version' => $serendipity['version'], 'head_title' => $serendipity['head_title'], 'head_subtitle' => $serendipity['head_subtitle'], 'head_link_stylesheet' => $serendipity['smarty_vars']['head_link_stylesheet'], 'is_xhtml' => true, 'use_popups' => $serendipity['enablePopup'], 'is_embedded' => !$serendipity['embed'] || $serendipity['embed'] === 'false' || $serendipity['embed'] === false ? false : true, 'is_raw_mode' => $serendipity['smarty_raw_mode'], 'is_logged_in' => serendipity_userLoggedIn(), 'entry_id' => isset($serendipity['GET']['id']) && is_numeric($serendipity['GET']['id']) ? $serendipity['GET']['id'] : false, 'is_single_entry' => isset($serendipity['GET']['id']) && is_numeric($serendipity['GET']['id']), 'blogTitle' => $serendipity['blogTitle'], 'blogSubTitle' => !empty($serendipity['blogSubTitle']) ? $serendipity['blogSubTitle'] : '', 'blogDescription' => $serendipity['blogDescription'], 'serendipityHTTPPath' => $serendipity['serendipityHTTPPath'], 'serendipityBaseURL' => $serendipity['baseURL'], 'serendipityRewritePrefix' => $serendipity['rewrite'] == 'none' ? $serendipity['indexFile'] . '?/' : '', 'serendipityIndexFile' => $serendipity['indexFile'], 'serendipityVersion' => $serendipity['expose_s9y'] ? $serendipity['version'] : '', 'lang' => $serendipity['lang'], 'category' => $category, 'category_info' => $category_info, 'template' => $serendipity['template'], 'dateRange' => !empty($serendipity['range']) ? $serendipity['range'] : array()));
        if (count($vars) > 0) {
//.........这里部分代码省略.........
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:101,代码来源:functions_smarty.inc.php

示例14: showForum

 function showForum()
 {
     global $serendipity;
     if (!headers_sent()) {
         header('HTTP/1.0 200');
         header('Status: 200 OK');
     }
     $ERRORMSG = "";
     $THREAD_UNREAD_ANNOUNCEMENT = "<img src=\"" . $this->DMA_forum_getRelPath() . "/img/thread_unread_announce.png\" width=\"20\" height=\"20\" border=\"0\" alt=\"" . PLUGIN_FORUM_ALT_READ . "\" title=\"" . PLUGIN_FORUM_ALT_READ . "\" />";
     $THREAD_READ_ANNOUNCEMENT = "<img src=\"" . $this->DMA_forum_getRelPath() . "/img/thread_read_announce.png\" width=\"20\" height=\"20\" border=\"0\" alt=\"" . PLUGIN_FORUM_ALT_READ . "\" title=\"" . PLUGIN_FORUM_ALT_READ . "\" />";
     $THREAD_UNREAD = "<img src=\"" . $this->DMA_forum_getRelPath() . "/img/thread_unread.png\" width=\"20\" height=\"18\" border=\"0\" alt=\"" . PLUGIN_FORUM_ALT_UNREAD . "\" title=\"" . PLUGIN_FORUM_ALT_UNREAD . "\" />";
     $THREAD_HUGE_UNREAD = "<img src=\"" . $this->DMA_forum_getRelPath() . "/img/thread_huge_unread.png\" width=\"20\" height=\"18\" border=\"0\" alt=\"" . PLUGIN_FORUM_ALT_UNREAD . "\" title=\"" . PLUGIN_FORUM_ALT_UNREAD . "\" />";
     $THREAD_READ = "<img src=\"" . $this->DMA_forum_getRelPath() . "/img/thread_read.png\" width=\"20\" height=\"18\" border=\"0\" alt=\"" . PLUGIN_FORUM_ALT_READ . "\" title=\"" . PLUGIN_FORUM_ALT_READ . "\" />";
     $THREAD_HUGE_READ = "<img src=\"" . $this->DMA_forum_getRelPath() . "/img/thread_huge_read.png\" width=\"20\" height=\"18\" border=\"0\" alt=\"" . PLUGIN_FORUM_ALT_READ . "\" title=\"" . PLUGIN_FORUM_ALT_READ . "\" />";
     $DEL_FILE_BUTTON = "<img src=\"" . serendipity_getTemplateFile('admin/img/delete.png') . "\" width=\"18\" height=\"18\" border=\"0\" alt=\"" . DELETE . "\" title=\"" . DELETE . "\" />";
     if (!isset($_SESSION['forum_visited']) || intval($_SESSION['forum_visited']) <= 0) {
         if (serendipity_userLoggedIn()) {
             $sql = "SELECT visits, lastvisit FROM {$serendipity['dbPrefix']}dma_forum_users WHERE authorid = '" . intval($serendipity['authorid']) . "'";
             $visits = serendipity_db_query($sql);
             if (is_array($visits) && count($visits) >= 1) {
                 $q = "UPDATE {$serendipity['dbPrefix']}dma_forum_users SET visits = visits+1, lastvisit = '" . time() . "' WHERE authorid = '" . intval($serendipity['authorid']) . "'";
                 serendipity_db_query($q);
             } else {
                 $q = "INSERT INTO {$serendipity['dbPrefix']}dma_forum_users (authorid, visits, lastvisit) VALUES ('" . intval($serendipity['authorid']) . "', '1', '" . time() . "')";
                 serendipity_db_query($q);
             }
             $_SESSION['forum_visited'] = 1;
         }
     }
     if (is_array($_COOKIE) && trim($_COOKIE['s9yread']) != "") {
         $READARRAY = unserialize(stripslashes(trim($_COOKIE['s9yread'])));
     } else {
         $READARRAY = array();
     }
     // POST part
     if (isset($serendipity['POST']['action']) && trim($serendipity['POST']['action']) == "reply") {
         if (!isset($serendipity['POST']['authorname']) || trim($serendipity['POST']['authorname']) == "") {
             if (serendipity_userLoggedIn()) {
                 $serendipity['POST']['authorname'] = $serendipity['serendipityUser'];
             } else {
                 $serendipity['POST']['authorname'] = PLUGIN_FORUM_GUEST;
             }
         }
         if ($this->get_config('use_captchas')) {
             // Fake call to spamblock and other comment plugins.
             $ca = array('id' => 0, 'allow_comments' => 'true', 'moderate_comments' => false, 'last_modified' => 1, 'timestamp' => 1);
             $commentInfo = array('type' => 'NORMAL', 'source' => 'commentform', 'name' => $serendipity['POST']['authorname'], 'url' => '', 'comment' => $serendipity['POST']['comment'], 'email' => '');
             serendipity_plugin_api::hook_event('frontend_saveComment', $ca, $commentInfo);
         } else {
             $ca['allow_comments'] = true;
         }
         if ($ca['allow_comments'] === false) {
             $ERRORMSG = PLUGIN_FORUM_ERR_WRONG_CAPTCHA_STRING;
         } else {
             $serendipity['POST']['title'] = trim($serendipity['POST']['title']);
             $serendipity['POST']['comment'] = trim($serendipity['POST']['comment']);
             $serendipity['POST']['authorname'] = trim($serendipity['POST']['authorname']);
             if (!isset($serendipity['POST']['comment']) || strlen(trim($serendipity['POST']['comment'])) <= 3) {
                 $ERRORMSG = PLUGIN_FORUM_ERR_MISSING_MESSAGE;
             } else {
                 $sql = "SELECT * FROM {$serendipity['dbPrefix']}dma_forum_threads WHERE threadid='" . intval($serendipity['POST']['threadid']) . "'";
                 $thread = serendipity_db_query($sql);
                 if ($thread[0]['flag'] == 1) {
                     $ERRORMSG = PLUGIN_FORUM_ERR_THREAD_CLOSED;
                 } else {
                     if (trim($serendipity['POST']['comment']) == $_SESSION['lastposttext']) {
                         $ERRORMSG = PLUGIN_FORUM_ERR_DOUBLE_POST;
                     } elseif ($_SESSION['lastposttime'] >= time() - 10) {
                         $ERRORMSG = PLUGIN_FORUM_ERR_POST_INTERVAL;
                     } else {
                         $now = time();
                         $postid = DMA_forum_InsertReply(intval($serendipity['POST']['boardid']), intval($serendipity['POST']['threadid']), intval($serendipity['POST']['replyto']), trim($serendipity['POST']['authorname']), trim($serendipity['POST']['title']), trim($serendipity['POST']['comment']), $this->get_config('itemsperpage'), $this->get_config('notifymail_from'), $this->get_config('notifymail_name'), $this->get_config('pageurl'), $this->get_config('admin_notify'));
                         if (serendipity_userLoggedIn() && $this->get_config('fileupload_reguser') || $this->get_config('fileupload_guest')) {
                             DMA_forum_uploadFiles($postid, $this->get_config('uploaddir'));
                             if ($this->SUCCESS <= 0) {
                                 if (count($this->UPLOAD_TOOBIG) >= 1) {
                                     $ERRORMSG = PLUGIN_FORUM_ERR_FILE_TOO_BIG;
                                 } elseif (count($this->UPLOAD_NOTCOPIED) >= 1) {
                                     $ERRORMSG = PLUGIN_FORUM_ERR_FILE_NOT_COPIED;
                                 }
                             }
                         }
                     }
                 }
             }
         }
         if (serendipity_userLoggedIn()) {
             $POST_AUTHORNAME = $serendipity['serendipityUser'];
         } else {
             $POST_AUTHORNAME = trim($serendipity['POST']['authorname']);
         }
         $POST_TITLE = trim($serendipity['POST']['title']);
         $POST_MESSAGE = trim($serendipity['POST']['comment']);
         if (isset($ERRORMSG) && trim($ERRORMSG) != "") {
             $_GET['boardid'] = intval($serendipity['POST']['boardid']);
             $_GET['threadid'] = intval($serendipity['POST']['threadid']);
             $_GET['replyto'] = intval($serendipity['POST']['replyto']);
             $_GET['quote'] = 0;
         }
     } elseif (isset($serendipity['POST']['action']) && trim($serendipity['POST']['action']) == "edit") {
//.........这里部分代码省略.........
开发者ID:sqall01,项目名称:additional_plugins,代码行数:101,代码来源:serendipity_event_forum.php

示例15: logger

 function logger($type = 'frontend_login', $eventData = array())
 {
     global $serendipity;
     $f2b = $this->get_config('fail2ban');
     if ($f2b != '') {
         $fp = fopen($f2b, 'a');
         if ($type == 'fail') {
             if (empty($eventData['user'])) {
                 return false;
             }
             if ($this->failtrack) {
                 return false;
             }
             $this->failtrack = true;
             $msg = date('M d H:i:s ') . $_SERVER['HTTP_HOST'] . ' s9y[' . $_SERVER['REMOTE_PORT'] . $eventData['mode'] . ']: auth failure username: ' . $eventData['user'] . ' from ' . $_SERVER['REMOTE_ADDR'] . ' / ' . $_SERVER['REQUEST_URI'] . " (" . serialize($eventData['ext']) . ")\n";
         } elseif (serendipity_userLoggedIn() && !$_SESSION['login_tracked_' . $type]) {
             $msg = date('M d H:i:s ') . $_SERVER['HTTP_HOST'] . ' s9y[' . $_SERVER['REMOTE_PORT'] . ']: auth okay: ' . $serendipity['serendipityUser'] . ' from ' . $_SERVER['REMOTE_ADDR'] . ' / ' . $_SERVER['REQUEST_URI'] . "\n";
         }
         fwrite($fp, $msg);
         fclose($fp);
     }
     if ($type == 'fail') {
         return false;
     }
     if (!serendipity_userLoggedIn()) {
         return false;
     }
     if ($_SESSION['login_tracked_' . $type]) {
         return false;
     }
     $timestamp = time();
     $authorid = (int) $serendipity['authorid'];
     $referer = serendipity_db_escape_string($_SERVER['HTTP_REFERER']);
     $ip = serendipity_db_escape_string($_SERVER['REMOTE_ADDR']);
     $ua = serendipity_db_escape_string($_SERVER['HTTP_USER_AGENT']);
     $i = serendipity_db_query("INSERT INTO {$serendipity['dbPrefix']}loginlog (timestamp, authorid, action, ip, referer, user_agent)\n                                   VALUES ({$timestamp}, {$authorid}, '{$type}', '{$ip}', '{$referer}', '{$ua}')");
     $_SESSION['login_tracked_' . $type] = true;
     return true;
 }
开发者ID:sqall01,项目名称:additional_plugins,代码行数:39,代码来源:serendipity_event_externalauth.php


注:本文中的serendipity_userLoggedIn函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。