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


PHP serendipity_fetchEntries函数代码示例

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


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

示例1: event_hook

    function event_hook($event, &$bag, &$eventData, $addData = null)
    {
        global $serendipity;
        static $is_cache = null;
        static $use_groups = null;
        static $use_users = null;
        static $ext_joins = null;
        $hooks =& $bag->get('event_hooks');
        if ($is_cache === null) {
            $is_cache = serendipity_db_bool($this->get_config('cache', 'true'));
            $use_groups = serendipity_db_bool($this->get_config('use_groups'));
            $use_users = serendipity_db_bool($this->get_config('use_users'));
            $ext_joins = serendipity_db_bool($this->get_config('use_ext_joins'));
        }
        if (isset($hooks[$event])) {
            switch ($event) {
                case 'frontend_entryproperties_query':
                    $eventData['and'] = $this->returnQueryCondition($is_cache);
                    return true;
                    break;
                case 'backend_display':
                    $is_sticky = isset($eventData['properties']['ep_is_sticky']) && serendipity_db_bool($eventData['properties']['ep_is_sticky']) || isset($serendipity['POST']['properties']['is_sticky']) && serendipity_db_bool($serendipity['POST']['properties']['is_sticky']) ? 'checked="checked"' : '';
                    $no_frontpage = isset($eventData['properties']['ep_no_frontpage']) && serendipity_db_bool($eventData['properties']['ep_no_frontpage']) || isset($serendipity['POST']['properties']['no_frontpage']) && serendipity_db_bool($serendipity['POST']['properties']['no_frontpage']) ? 'checked="checked"' : '';
                    $hiderss = isset($eventData['properties']['ep_hiderss']) && serendipity_db_bool($eventData['properties']['ep_hiderss']) || isset($serendipity['POST']['properties']['hiderss']) && serendipity_db_bool($serendipity['POST']['properties']['hiderss']) ? 'checked="checked"' : '';
                    $access_values = array(PLUGIN_EVENT_ENTRYPROPERTIES_ACCESS_PRIVATE => 'private', PLUGIN_EVENT_ENTRYPROPERTIES_ACCESS_PUBLIC => 'public', PLUGIN_EVENT_ENTRYPROPERTIES_ACCESS_MEMBERS => 'member');
                    if (isset($eventData['properties']['ep_access'])) {
                        $access = $eventData['properties']['ep_access'];
                    } elseif (isset($serendipity['POST']['properties']['access'])) {
                        $access = $serendipity['POST']['properties']['access'];
                    } else {
                        $access = $this->get_config('default_read', 'public');
                    }
                    if (isset($eventData['properties']['ep_access_groups'])) {
                        $access_groups = explode(';', $eventData['properties']['ep_access_groups']);
                    } elseif (isset($serendipity['POST']['properties']['access_groups'])) {
                        $access_groups = $serendipity['POST']['properties']['access_groups'];
                    } else {
                        $access_groups = array();
                    }
                    if (isset($eventData['properties']['ep_access_users'])) {
                        $access_users = explode(';', $eventData['properties']['ep_access_users']);
                    } elseif (isset($serendipity['POST']['properties']['access_users'])) {
                        $access_users = $serendipity['POST']['properties']['access_users'];
                    } else {
                        $access_users = array();
                    }
                    if (isset($eventData['properties']['ep_entrypassword'])) {
                        $password = $eventData['properties']['ep_entrypassword'];
                    } elseif (isset($serendipity['POST']['properties']['entrypassword'])) {
                        $password = $serendipity['POST']['properties']['entrypassword'];
                    } else {
                        $password = '';
                    }
                    ?>
                    <div class="entryproperties">
                        <input type="hidden" name="serendipity[propertyform]" value="true" />
                        <h3><?php 
                    echo PLUGIN_EVENT_ENTRYPROPERTIES_TITLE;
                    ?>
</h3>
<?php 
                    $elements = explode(',', $this->get_config('sequence'));
                    foreach ($elements as $element) {
                        $this->showBackend($element, $eventData, $is_sticky, $no_frontpage, $hiderss, $access_values, $access, $password, $use_groups, $access_groups, $use_users, $access_users);
                    }
                    ?>
                    </div>
<?php 
                    return true;
                    break;
                case 'backend_maintenance':
                    if ($is_cache && $serendipity['serendipityUserlevel'] >= USERLEVEL_ADMIN) {
                        echo '<section id="maintenance_buildcache" class="equal_heights quick_list">';
                        echo '<h3>' . PLUGIN_EVENT_ENTRYPROPERTY_BUILDCACHE . '</h3>';
                        echo '<a class="button_link build_cache" href="?serendipity[adminModule]=event_display&amp;serendipity[adminAction]=buildcache" data-delmsg="' . PLUGIN_EVENT_ENTRYPROPERTIES_CACHE_FETCHNEXT . '">' . PLUGIN_EVENT_ENTRYPROPERTY_BUILDCACHE . '</a></section>';
                    }
                    return true;
                    break;
                case 'backend_import_entry':
                    //TODO: (ph) Maybe handle caching?
                    if (is_array($addData) && !$addData['nl2br']) {
                        $props = array();
                        $props['no_nl2br'] = 'true';
                        $this->addProperties($props, $eventData);
                    }
                    break;
                case 'backend_sidebar_entries_event_display_buildcache':
                    if ($is_cache) {
                        $per_fetch = 25;
                        $page = isset($serendipity['GET']['page']) ? $serendipity['GET']['page'] : 1;
                        $from = ($page - 1) * $per_fetch;
                        $to = $page * $per_fetch;
                        printf('<h2>' . PLUGIN_EVENT_ENTRYPROPERTIES_CACHE_FETCHNO, $from, $to);
                        $entries = serendipity_fetchEntries(null, true, $per_fetch, false, false, 'timestamp DESC', '', true);
                        $total = serendipity_getTotalEntries();
                        printf(PLUGIN_EVENT_ENTRYPROPERTIES_CACHE_TOTAL . '</h2>', $total);
                        if (is_array($entries)) {
                            echo '<ul class="plainList">';
                            foreach ($entries as $idx => $entry) {
                                printf('<li>' . PLUGIN_EVENT_ENTRYPROPERTIES_CACHE_BUILDING, $entry['id'], serendipity_specialchars($entry['title']));
//.........这里部分代码省略.........
开发者ID:vonnordmann,项目名称:Serendipity,代码行数:101,代码来源:serendipity_event_entryproperties.php

示例2: sprintf

        if ($r === true) {
            echo sprintf(NO_ENTRIES_BLAHBLAH, $serendipity['GET']['searchTerm']);
            break;
        }
        echo sprintf(YOUR_SEARCH_RETURNED_BLAHBLAH, $serendipity["GET"]["searchTerm"], count($r));
        serendipity_printEntries($r);
        break;
        // Show the archive
    // Show the archive
    case "archives":
        serendipity_printArchives();
        break;
        // Welcome screen or whatever
    // Welcome screen or whatever
    default:
        serendipity_printEntries(serendipity_fetchEntries(null, true, $serendipity['fetchLimit']));
}
?>
            <?php 
echo $CLOSESHADOW;
?>
        </td>
        <td valign="top" align="left" class="serendipitySideBar">
            <?php 
//              serendipity_plugin_api::generate_plugins('left', 'span');
serendipity_plugin_api::generate_plugins('right', 'span');
?>

        </td>
    </tr>
</table>
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:31,代码来源:layout.php

示例3: mt_getRecentPostTitles

function mt_getRecentPostTitles($message)
{
    global $serendipity;
    $val = $message->params[1];
    $username = $val->getval();
    $val = $message->params[2];
    $password = $val->getval();
    $numposts = '10';
    if (count($message->params) > 3) {
        $val = $message->params[3];
        $numposts = $val->getval();
    }
    if (!serendipity_authenticate_author($username, $password)) {
        return new XML_RPC_Response('', XMLRPC_ERR_CODE_AUTHFAILED, XMLRPC_ERR_NAME_AUTHFAILED);
    }
    $entries = serendipity_fetchEntries('', false, $numposts, true);
    $xml_entries_vals = array();
    foreach ((array) $entries as $entry) {
        if ($entry['id']) {
            $xml_entries_vals[] = new XML_RPC_Value(array('postid' => new XML_RPC_Value($entry['id'], 'string'), 'title' => new XML_RPC_Value($entry['title'], 'string'), 'userid' => new XML_RPC_Value($entry['authorid'], 'string'), 'dateCreated' => new XML_RPC_Value(XML_RPC_iso8601_encode($entry['timestamp'], $serendipity['XMLRPC_GMT']) . ($serendipity['XMLRPC_GMT'] ? 'Z' : ''), 'dateTime.iso8601')), 'struct');
        }
    }
    $xml_entries = new XML_RPC_Value($xml_entries_vals, 'array');
    return new XML_RPC_Response($xml_entries);
}
开发者ID:sqall01,项目名称:additional_plugins,代码行数:25,代码来源:serendipity_xmlrpc.inc.php

示例4: showElementEntrylist

    function showElementEntrylist($filter = array(), $limit = 0)
    {
        global $serendipity;
        $filter_sql = implode(' AND ', $filter);
        $orderby = 'timestamp DESC';
        // Fetch the entries
        $entries = serendipity_fetchEntries(false, false, $limit, true, false, $orderby, $filter_sql);
        $rows = 0;
        if (!is_array($entries)) {
            return;
        }
        foreach ($entries as $entry) {
            $rows++;
            // Find out if the entry has been modified later than 30 minutes after creation
            if ($entry['timestamp'] <= $entry['last_modified'] - 60 * 30) {
                $lm = '<a href="#" title="' . LAST_UPDATED . ': ' . serendipity_formatTime(DATE_FORMAT_SHORT, $entry['last_modified']) . '" onclick="alert(this.title)"><img src="' . serendipity_getTemplateFile('admin/img/clock.png') . '" alt="*" style="border: 0px none ; vertical-align: bottom;" /></a>';
            } else {
                $lm = '';
            }
            if (!$serendipity['showFutureEntries'] && $entry['timestamp'] >= serendipity_serverOffsetHour()) {
                $entry_pre = '<a href="#" title="' . ENTRY_PUBLISHED_FUTURE . '" onclick="alert(this.title)"><img src="' . serendipity_getTemplateFile('admin/img/clock_future.png') . '" alt="*" style="border: 0px none ; vertical-align: bottom;" /></a> ';
            } else {
                $entry_pre = '';
            }
            if (serendipity_db_bool($entry['properties']['ep_is_sticky'])) {
                $entry_pre .= ' ' . STICKY_POSTINGS . ': ';
            }
            if (serendipity_db_bool($entry['isdraft'])) {
                $entry_pre .= ' ' . DRAFT . ': ';
            }
            ?>
            <div class="serendipity_admin_list_item serendipity_admin_list_item_<?php 
            echo $rows % 2 ? 'even' : 'uneven';
            ?>
">

                <table width="100%" cellspacing="0" cellpadding="3">
                    <tr>
                        <td>
                            <strong><?php 
            echo $entry_pre;
            ?>
<a href="?serendipity[action]=admin&amp;serendipity[adminModule]=entries&amp;serendipity[adminAction]=edit&amp;serendipity[id]=<?php 
            echo $entry['id'];
            ?>
" title="#<?php 
            echo $entry['id'];
            ?>
"><?php 
            echo serendipity_truncateString(function_exists('serendipity_specialchars') ? serendipity_specialchars($entry['title']) : htmlspecialchars($entry['title'], ENT_COMPAT, LANG_CHARSET), 50);
            ?>
</a></strong>
                        </td>
                        <td align="right">
                            <?php 
            echo serendipity_formatTime(DATE_FORMAT_SHORT, $entry['timestamp']) . ' ' . $lm;
            ?>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <?php 
            echo POSTED_BY . ' ' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($entry['author']) : htmlspecialchars($entry['author'], ENT_COMPAT, LANG_CHARSET));
            if (count($entry['categories'])) {
                echo ' ' . IN . ' ';
                $cats = array();
                foreach ($entry['categories'] as $cat) {
                    $caturl = serendipity_categoryURL($cat);
                    $cats[] = '<a href="' . $caturl . '">' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($cat['category_name']) : htmlspecialchars($cat['category_name'], ENT_COMPAT, LANG_CHARSET)) . '</a>';
                }
                echo implode(', ', $cats);
            }
            $entry['link'] = serendipity_archiveURL($entry['id'], $entry['title'], 'serendipityHTTPPath', true, array('timestamp' => $entry['timestamp']));
            $entry['preview_link'] = '?serendipity[noBanner]=true&amp;serendipity[noSidebar]=true&amp;serendipity[action]=admin&amp;serendipity[adminModule]=entries&amp;serendipity[adminAction]=preview&amp;serendipity[id]=' . $entry['id'];
            ?>

                        </td>
                        <td align="right">
                            <?php 
            if (serendipity_db_bool($entry['isdraft']) || !$serendipity['showFutureEntries'] && $entry['timestamp'] >= serendipity_serverOffsetHour()) {
                ?>
                            <a target="_blank" href="<?php 
                echo $entry['preview_link'];
                ?>
&amp;<?php 
                echo serendipity_setFormToken('url');
                ?>
" title="<?php 
                echo PREVIEW . ' #' . $entry['id'];
                ?>
" class="serendipityIconLink"><img src="<?php 
                echo serendipity_getTemplateFile('admin/img/zoom.png');
                ?>
" alt="<?php 
                echo PREVIEW;
                ?>
" /><?php 
                echo PREVIEW;
                ?>
</a>
//.........这里部分代码省略.........
开发者ID:sqall01,项目名称:additional_plugins,代码行数:101,代码来源:serendipity_event_dashboard.php

示例5: generate_content

 function generate_content(&$title)
 {
     global $serendipity;
     $title = $this->get_config('title', $this->title);
     $current_cat = $serendipity['GET']['category'];
     $current_page = $serendipity['GET']['page'];
     $current_auth = $serendipity['GET']['viewAuthor'];
     $current_rng = $serendipity['range'];
     $serendipity['GET']['page'] = 0;
     unset($serendipity['GET']['viewAuthor']);
     unset($serendipity['range']);
     $c = $this->get_config('category');
     if ($c > 0) {
         $serendipity['GET']['category'] = (int) $c;
     }
     $showtitle = serendipity_db_bool($this->get_config('showtitle'));
     $showext = serendipity_db_bool($this->get_config('showext'));
     if (serendipity_db_bool($this->get_config('skip'))) {
         $limit = serendipity_db_limit($serendipity['fetchLimit'], $this->get_config('number'));
     } else {
         $limit = serendipity_db_limit(0, $this->get_config('number'));
     }
     $entries = serendipity_fetchEntries(null, true, $limit, false, false, 'timestamp DESC', '', false, true);
     if (is_array($entries)) {
         foreach ($entries as $i => $entry) {
             serendipity_plugin_api::hook_event('frontend_display', $entry);
             /* Pulled from serendipity_printEntries */
             $entry['link'] = serendipity_archiveURL($entry['id'], $entry['title'], 'serendipityHTTPPath', true, array('timestamp' => $entry['timestamp']));
             $entry['commURL'] = serendipity_archiveURL($entry['id'], $entry['title'], 'baseURL', false, array('timestamp' => $entry['timestamp']));
             $entry['rdf_ident'] = serendipity_archiveURL($entry['id'], $entry['title'], 'baseURL', true, array('timestamp' => $entry['timestamp']));
             $entry['title'] = function_exists('serendipity_specialchars') ? serendipity_specialchars($entry['title']) : htmlspecialchars($entry['title'], ENT_COMPAT, LANG_CHARSET);
             $entry['link_allow_comments'] = $serendipity['baseURL'] . 'comment.php?serendipity[switch]=enable&amp;serendipity[entry]=' . $entry['id'];
             $entry['link_deny_comments'] = $serendipity['baseURL'] . 'comment.php?serendipity[switch]=disable&amp;serendipity[entry]=' . $entry['id'];
             $entry['allow_comments'] = serendipity_db_bool($entry['allow_comments']);
             $entry['moderate_comments'] = serendipity_db_bool($entry['moderate_comments']);
             $entry['link_popup_comments'] = $serendipity['serendipityHTTPPath'] . 'comment.php?serendipity[entry_id]=' . $entry['id'] . '&amp;serendipity[type]=comments';
             $entry['link_popup_trackbacks'] = $serendipity['serendipityHTTPPath'] . 'comment.php?serendipity[entry_id]=' . $entry['id'] . '&amp;serendipity[type]=trackbacks';
             $entry['link_edit'] = $serendipity['baseURL'] . 'serendipity_admin.php?serendipity[action]=admin&amp;serendipity[adminModule]=entries&amp;serendipity[adminAction]=edit&amp;serendipity[id]=' . $entry['id'];
             $entry['link_trackback'] = $serendipity['baseURL'] . 'comment.php?type=trackback&amp;entry_id=' . $entry['id'];
             $entry['link_rdf'] = serendipity_rewriteURL(PATH_FEEDS . '/ei_' . $entry['id'] . '.rdf');
             $entry['link_viewmode_threaded'] = $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'] . '?url=' . $entry['commURL'] . '&amp;serendipity[cview]=' . VIEWMODE_THREADED;
             $entry['link_viewmode_linear'] = $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'] . '?url=' . $entry['commURL'] . '&amp;serendipity[cview]=' . VIEWMODE_LINEAR;
             if ($_SESSION['serendipityAuthedUser'] === true && ($_SESSION['serendipityAuthorid'] == $entry['authorid'] || serendipity_checkPermission('adminEntriesMaintainOthers'))) {
                 $entry['is_entry_owner'] = true;
             }
             if (is_array($entry['categories'])) {
                 foreach ($entry['categories'] as $k => $v) {
                     $entry['categories'][$k]['category_link'] = serendipity_categoryURL($entry['categories'][$k]);
                 }
             }
             $entries[$i] = $entry;
         }
     }
     $serendipity['smarty']->assign(array('showtitle' => $showtitle, 'showext' => $showext, 'entries' => $entries));
     $tfile = serendipity_getTemplateFile('plugin_showentries.tpl', 'serendipityPath');
     if (!$tfile) {
         $tfile = dirname(__FILE__) . '/plugin_showentries.tpl';
     }
     $inclusion = $serendipity['smarty']->security_settings[INCLUDE_ANY];
     $serendipity['smarty']->security_settings[INCLUDE_ANY] = true;
     $content = $serendipity['smarty']->fetch('file:' . $tfile);
     $serendipity['smarty']->security_settings[INCLUDE_ANY] = $inclusion;
     echo $content;
     $serendipity['GET']['category'] = $current_cat;
     $serendipity['GET']['page'] = $current_page;
     $serendipity['GET']['viewAuthor'] = $current_auth;
     $serendipity['range'] = $current_rng;
 }
开发者ID:sqall01,项目名称:additional_plugins,代码行数:68,代码来源:serendipity_plugin_showentries.php

示例6: generate_content

 function generate_content(&$title)
 {
     global $serendipity;
     $title = $this->get_config('title', $this->title);
     $intro = $this->get_config('intro');
     $outro = $this->get_config('outro');
     $maxlength = $this->get_config('maxlength');
     $max_entries = $this->get_config('max_entries');
     $min_age = $this->get_config('min_age');
     $max_age = $this->get_config('max_age');
     $specialage = $this->get_config('specialage');
     $displaydate = $this->get_config('displaydate', 'true');
     $dateformat = $this->get_config('dateformat');
     $full = serendipity_db_bool($this->get_config('full'));
     $displayauthor = serendipity_db_bool($this->get_config('displayauthor', false));
     if (!is_numeric($min_age) || $min_age < 0 || $specialage == 'year') {
         $min_age = 365 + date('L', serendipity_serverOffsetHour());
     }
     if (!is_numeric($max_age) || $max_age < 1 || $specialage == 'year') {
         $max_age = 365 + date('L', serendipity_serverOffsetHour());
     }
     if (!is_numeric($max_entries) || $max_entries < 1) {
         $max_entries = 5;
     }
     if (!is_numeric($maxlength) || $maxlength < 0) {
         $maxlength = 30;
     }
     if (strlen($dateformat) < 1) {
         $dateformat = '%a, %d.%m.%Y %H:%M';
     }
     $oldLim = $serendipity['fetchLimit'];
     $nowts = serendipity_serverOffsetHour();
     $maxts = mktime(23, 59, 59, date('m', $nowts), date('d', $nowts), date('Y', $nowts));
     $mints = mktime(0, 0, 0, date('m', $nowts), date('d', $nowts), date('Y', $nowts));
     $e = serendipity_fetchEntries(array($mints - $max_age * 86400, $maxts - $min_age * 86400), $full, $max_entries);
     $serendipity['fetchLimit'] = $oldLim;
     echo empty($intro) ? '' : '<div class="serendipity_history_intro">' . $intro . '</div>' . "\n";
     if (!is_array($e)) {
         return false;
     }
     if (($e_c = count($e)) == 0) {
         return false;
     }
     for ($x = 0; $x < $e_c; $x++) {
         $url = serendipity_archiveURL($e[$x]['id'], $e[$x]['title'], 'serendipityHTTPPath', true, array('timestamp' => $e[$x]['timestamp']));
         $date = $displaydate == '0' ? '' : serendipity_strftime($dateformat, $e[$x]['timestamp']);
         $author = $displayauthor ? $e[$x]['author'] . ': ' : '';
         echo '<div class="serendipity_history_info">';
         if ($displayauthor) {
             echo '<span class="serendipity_history_author">' . $author . ' </span>';
         }
         if ($displaydate) {
             echo '<span class="serendipity_history_date">' . $date . ' </span>';
         }
         $t = $maxlength == 0 || strlen($e[$x]['title']) <= $maxlength ? $e[$x]['title'] : trim(serendipity_mb('substr', $e[$x]['title'], 0, $maxlength - 3)) . ' [...]';
         echo '<a href="' . $url . '" title="' . str_replace("'", "`", serendipity_specialchars($e[$x]['title'])) . '">"' . serendipity_specialchars($t) . '"</a></div>';
         if ($full) {
             echo '<div class="serendipity_history_body">' . strip_tags($e[$x]['body']) . '</div>';
         }
     }
     echo empty($outro) ? '' : '<div class="serendipity_history_outro">' . $outro . '</div>';
 }
开发者ID:vonnordmann,项目名称:Serendipity,代码行数:62,代码来源:serendipity_plugin_history.php

示例7: serendipity_smarty_fetchPrintEntries


//.........这里部分代码省略.........
    }
    if (empty($params['block'])) {
        $params['block'] = 'smarty_entries_' . $entrycount;
    }
    if (empty($params['use_hooks'])) {
        $params['use_hooks'] = false;
    }
    if (empty($params['use_footer'])) {
        $params['use_footer'] = false;
    }
    if (empty($params['groupmode'])) {
        $params['groupmode'] = 'date';
    }
    if (empty($params['skip_smarty_hooks'])) {
        $params['skip_smarty_hooks'] = true;
    }
    if (empty($params['skip_smarty_hook'])) {
        $params['skip_smarty_hook'] = array();
    }
    if (empty($params['prevent_reset'])) {
        $params['prevent_reset'] = false;
    }
    if (empty($params['select_key'])) {
        $params['select_key'] = null;
    }
    if (empty($params['group_by'])) {
        $params['group_by'] = null;
    }
    if (empty($params['returncode'])) {
        $params['returncode'] = 'array';
    }
    if (empty($params['joinauthors'])) {
        $params['joinauthors'] = true;
    }
    if (empty($params['joincategories'])) {
        $params['joincategories'] = true;
    }
    // Some functions deal with the $serendipity array. To modify them, we need to store
    // their original contents.
    $old_var = array();
    if (!empty($params['short_archives'])) {
        $old_var['short_archives'] = $serendipity['short_archives'];
        $serendipity['short_archives'] = $params['short_archives'];
    }
    $old_var['skip_smarty_hooks'] = $serendipity['skip_smarty_hooks'];
    $serendipity['skip_smarty_hooks'] = $params['skip_smarty_hooks'];
    $old_var['skip_smarty_hook'] = $serendipity['skip_smarty_hook'];
    $serendipity['skip_smarty_hook'] = $params['skip_smarty_hook'];
    foreach ($restore_var_GET_keys as $key) {
        if (!empty($params[$key])) {
            $old_var['GET'][$key] = $serendipity['GET'][$key];
            $serendipity['GET'][$key] = $params[$key];
        }
    }
    if (!empty($params['id'])) {
        $entry = serendipity_fetchEntry('id', (int) $params['id'], $params['full'], $params['fetchDrafts']);
    } else {
        $entry = serendipity_fetchEntries($params['range'], $params['full'], $params['limit'], $params['fetchDrafts'], $params['modified_since'], $params['orderby'], $params['filter_sql'], $params['noCache'], $params['noSticky'], $params['select_key'], $params['group_by'], $params['returncode'], $params['joinauthors'], $params['joincategories'], $params['joinown']);
        // Check whether the returned entries shall be grouped specifically
        switch ($params['groupmode']) {
            case 'date':
                // No regrouping required, printEntries() does it for us.
                break;
            case 'category':
                // Regroup by primary category
                $groupdata = array();
                foreach ($entry as $k => $_entry) {
                    if (is_array($entry['categories'])) {
                        $groupkey = $entry['categories'][0];
                    } else {
                        $groupkey = 'none';
                    }
                    $groupdata[$groupkey]['entries'] =& $_entry;
                }
                $entry =& $groupdata;
                break;
        }
    }
    if ($params['returncode'] == 'query') {
        return print_r($entry, true);
    }
    serendipity_printEntries($entry, !empty($params['id']) ? true : false, $params['preview'], 'ENTRIES', false, $params['use_hooks'], $params['use_footer'], $params['groupmode'] == 'date' ? false : true);
    // Restore the $serendipity array after our modifications.
    if (isset($old_var['short_archives'])) {
        $serendipity['short_archives'] = $old_var['short_archives'];
    }
    if (is_array($old_var['GET'])) {
        foreach ($old_var['GET'] as $key => $val) {
            $serendipity['GET'][$key] = $val;
        }
    }
    $out = serendipity_smarty_fetch($params['block'], $params['template']);
    // Reset array list, because we might be in a nested code call.
    if ($params['prevent_reset'] == false) {
        $serendipity['smarty']->assign('entries', array());
    }
    $serendipity['skip_smarty_hook'] = $old_var['skip_smarty_hook'];
    $serendipity['skip_smarty_hooks'] = $old_var['skip_smarty_hooks'];
    return $out;
}
开发者ID:REAP720801,项目名称:Serendipity,代码行数:101,代码来源:functions_smarty.inc.php

示例8: serendipity_drawList

/**
 * Shows the entry panel overview
 *
 * Shows a list of existing entries, with pagination and cookie-remember settings.
 *
 * @access public
 * @return null
 */
function serendipity_drawList()
{
    global $serendipity, $sort_order, $per_page;
    $filter_import = array('author', 'category', 'isdraft');
    $sort_import = array('perPage', 'ordermode', 'order');
    foreach ($filter_import as $f_import) {
        serendipity_restoreVar($serendipity['COOKIE']['entrylist_filter_' . $f_import], $serendipity['GET']['filter'][$f_import]);
        serendipity_JSsetCookie('entrylist_filter_' . $f_import, $serendipity['GET']['filter'][$f_import]);
    }
    foreach ($sort_import as $s_import) {
        serendipity_restoreVar($serendipity['COOKIE']['entrylist_sort_' . $s_import], $serendipity['GET']['sort'][$s_import]);
        serendipity_JSsetCookie('entrylist_sort_' . $s_import, $serendipity['GET']['sort'][$s_import]);
    }
    $perPage = !empty($serendipity['GET']['sort']['perPage']) ? $serendipity['GET']['sort']['perPage'] : $per_page[0];
    $page = (int) $serendipity['GET']['page'];
    $offSet = $perPage * $page;
    if (empty($serendipity['GET']['sort']['ordermode']) || $serendipity['GET']['sort']['ordermode'] != 'ASC') {
        $serendipity['GET']['sort']['ordermode'] = 'DESC';
    }
    if (!empty($serendipity['GET']['sort']['order']) && !empty($sort_order[$serendipity['GET']['sort']['order']])) {
        $orderby = serendipity_db_escape_string($serendipity['GET']['sort']['order'] . ' ' . $serendipity['GET']['sort']['ordermode']);
    } else {
        $orderby = 'timestamp ' . serendipity_db_escape_string($serendipity['GET']['sort']['ordermode']);
    }
    $filter = array();
    if (!empty($serendipity['GET']['filter']['author'])) {
        $filter[] = "e.authorid = '" . serendipity_db_escape_string($serendipity['GET']['filter']['author']) . "'";
    }
    if (!empty($serendipity['GET']['filter']['category'])) {
        $filter[] = "ec.categoryid = '" . serendipity_db_escape_string($serendipity['GET']['filter']['category']) . "'";
    }
    if (!empty($serendipity['GET']['filter']['isdraft'])) {
        if ($serendipity['GET']['filter']['isdraft'] == 'draft') {
            $filter[] = "e.isdraft = 'true'";
        } elseif ($serendipity['GET']['filter']['isdraft'] == 'publish') {
            $filter[] = "e.isdraft = 'false'";
        }
    }
    if (!empty($serendipity['GET']['filter']['body'])) {
        if ($serendipity['dbType'] == 'mysql') {
            $filter[] = "MATCH (title,body,extended) AGAINST ('" . serendipity_db_escape_string($serendipity['GET']['filter']['body']) . "')";
            $full = true;
        }
    }
    $filter_sql = implode(' AND ', $filter);
    // Fetch the entries
    $entries = serendipity_fetchEntries(false, false, serendipity_db_limit($offSet, $perPage + 1), true, false, $orderby, $filter_sql);
    ?>
<div class="serendipity_admin_list">
<form action="?" method="get">
    <input type="hidden" name="serendipity[action]"      value="admin"      />
    <input type="hidden" name="serendipity[adminModule]" value="entries"    />
    <input type="hidden" name="serendipity[adminAction]" value="editSelect" />
    <table width="100%" class="serendipity_admin_filters">
        <tr>
            <td class="serendipity_admin_filters_headline" colspan="6"><strong><?php 
    echo FILTERS;
    ?>
</strong> - <?php 
    echo FIND_ENTRIES;
    ?>
</td>
        </tr>
        <tr>
            <td valign="top" width="80"><?php 
    echo AUTHOR;
    ?>
</td>
            <td valign="top">
                <select name="serendipity[filter][author]">
                    <option value="">--</option>
<?php 
    $users = serendipity_fetchUsers('', null, true);
    if (is_array($users)) {
        foreach ($users as $user) {
            if (isset($user['artcount']) && $user['artcount'] < 1) {
                continue;
            }
            echo '<option value="' . $user['authorid'] . '" ' . (isset($serendipity['GET']['filter']['author']) && $serendipity['GET']['filter']['author'] == $user['authorid'] ? 'selected="selected"' : '') . '>' . htmlspecialchars($user['realname']) . '</option>' . "\n";
        }
    }
    ?>
              </select> <select name="serendipity[filter][isdraft]">
                    <option value="all"><?php 
    echo COMMENTS_FILTER_ALL;
    ?>
</option>
                    <option value="draft"   <?php 
    echo isset($serendipity['GET']['filter']['isdraft']) && $serendipity['GET']['filter']['isdraft'] == 'draft' ? 'selected="selected"' : '';
    ?>
><?php 
    echo DRAFT;
//.........这里部分代码省略.........
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:101,代码来源:entries.inc.php

示例9: str_replace

         $term = str_replace('*', '%', $term);
         $term = serendipity_mb('strtolower', $term);
         $filter[] = "(lower(title) LIKE '%{$term}%' OR lower(body) LIKE '%{$term}%' OR lower(extended) LIKE '%{$term}%')";
         $full = true;
     } else {
         if (preg_match('@["\\+\\-\\*~<>\\(\\)]+@', $term)) {
             $filter[] = "MATCH (title,body,extended) AGAINST ('" . $term . "' IN BOOLEAN MODE)";
         } else {
             $filter[] = "MATCH (title,body,extended) AGAINST ('" . $term . "')";
         }
         $full = true;
     }
 }
 $filter_sql = implode(' AND ', $filter);
 // Fetch the entries
 $entries = serendipity_fetchEntries(false, false, serendipity_db_limit($offSet, $perPage + 1), true, false, $orderby, $filter_sql);
 $users = serendipity_fetchUsers('', 'hidden', true);
 $categories = serendipity_fetchCategories();
 $categories = serendipity_walkRecursive($categories, 'categoryid', 'parentid', VIEWMODE_THREADED);
 $data['drawList'] = true;
 $data['sort_order'] = $sort_order;
 $data['perPage'] = $perPage;
 $data['per_page'] = $per_page;
 $data['urltoken'] = serendipity_setFormToken('url');
 $data['formtoken'] = serendipity_setFormToken();
 $data['users'] = $users;
 $data['categories'] = $categories;
 $data['offSet'] = $offSet;
 $data['use_iframe'] = $serendipity['use_iframe'];
 $data['page'] = $page;
 $data['totalEntries'] = serendipity_getTotalEntries();
开发者ID:vonnordmann,项目名称:Serendipity,代码行数:31,代码来源:entries.inc.php

示例10: smarty_customArchive


//.........这里部分代码省略.........
         $values_props['ep_' . $propparts[0]]['from'] = $sfields[0];
         $values_props['ep_' . $propparts[0]]['to'] = $sfields[1];
     }
     $serendipity['smarty']->assign('customarchive_props', $name_props);
     $serendipity['smarty']->assign('customarchive_keyprops', $key_props);
     $serendipity['smarty']->assign('customarchive_infoprops', $add_props);
     $serendipity['smarty']->assign('customarchive_filter', $params['filter']);
     $serendipity['smarty']->assign('customarchive_teaser', 'ep_' . $params['teaser']);
     $serendipity['smarty']->assign('customarchive_subpage', $serendipity['GET']['subpage']);
     $serendipity['smarty']->assign('customarchive_picture', 'ep_' . $params['picture']);
     $serendipity['smarty']->assign('customarchive_nextmode', strtolower($params['mode']) == 'desc' ? 'asc' : 'desc');
     $serendipity['smarty']->assign('customarchive_mode', strtolower($params['mode']));
     $serendipity['smarty']->assign('customarchive_search', $search_props);
     $serendipity['smarty']->assign('customarchive_searchdata', $searchdata);
     $lookup = array();
     foreach ($key_props as $idx => $prop) {
         $and = '';
         $lookup[$prop] = 'ep' . $idx;
         if ($prop == 'ep_' . $params['filter'] && $valid_filter) {
             $filteridx = $idx;
             $params['joinown'] .= "\n JOIN {$serendipity['dbPrefix']}entryproperties\n                                          AS ep" . $idx . "\n                                          ON (ep" . $idx . ".entryid = e.id AND\n                                              ep" . $idx . ".property = '" . serendipity_db_escape_string($prop) . "' {$and}) \n";
         } else {
             $params['joinown'] .= "\n LEFT OUTER JOIN {$serendipity['dbPrefix']}entryproperties\n                                          AS ep" . $idx . "\n                                          ON (ep" . $idx . ".entryid = e.id AND\n                                              ep" . $idx . ".property = '" . serendipity_db_escape_string($prop) . "' {$and}) \n";
         }
     }
     $sql_where = '';
     $sql_where_parts = array();
     $searchdata_from = $searchdata_to = array();
     if (is_array($serendipity['POST']['search'])) {
         foreach ($serendipity['POST']['search'] as $skey => $sdata) {
             if (!is_array($sdata)) {
                 $sdata = trim($sdata);
             }
             if (empty($sdata)) {
                 continue;
             }
             foreach ($search_props as $sdesc => $sdata2) {
                 if ($sdata2['key'] == $skey) {
                     if ($sdata2['type'] == 'text') {
                         $parts = array();
                         foreach ($sdata2['fields'] as $fieldkey => $fieldval) {
                             $parts[] = $lookup[$fieldkey] . '.value LIKE "%' . serendipity_db_escape_string($sdata) . '%"';
                         }
                         $sql_where_parts[] .= "\n(" . implode(' OR ', $parts) . ")\n";
                     } elseif ($sdata2['type'] == 'int') {
                         $parts = array();
                         foreach ($sdata2['fields'] as $fieldkey => $fieldval) {
                             if (!empty($sdata['from'])) {
                                 $parts[] = 'CAST(' . $lookup[$fieldkey] . '.value AS unsigned) >= ' . serendipity_db_escape_string($sdata['from']);
                             }
                             if (!empty($sdata['to'])) {
                                 $parts[] = 'CAST(' . $lookup[$fieldkey] . '.value AS unsigned) <= ' . serendipity_db_escape_string($sdata['to']);
                             }
                             $searchdata_from[$sdata2['key']] = $sdata['from'];
                             $searchdata_to[$sdata2['key']] = $sdata['to'];
                         }
                         if (count($parts) > 0) {
                             $sql_where_parts[] .= "\n(" . implode(' AND ', $parts) . ")\n";
                         }
                     }
                 }
             }
         }
         $sql_where = implode(" AND ", $sql_where_parts);
     } elseif (count($values_props) > 0) {
         $sql_where_parts = array();
         foreach ($values_props as $vfieldname => $vfieldvals) {
             $sql_where_parts[] = '(CAST(' . $lookup[$vfieldname] . '.value AS unsigned) >= ' . $vfieldvals['from'] . ' 
                                    AND CAST(' . $lookup[$vfieldname] . '.value AS unsigned) <= ' . $vfieldvals['to'] . ')' . "\n";
         }
         $sql_where .= implode(" AND ", $sql_where_parts);
     }
     $serendipity['smarty']->assign('customarchive_searchdata_from', $searchdata_from);
     $serendipity['smarty']->assign('customarchive_searchdata_to', $searchdata_to);
     if (empty($filteridx)) {
         $filteridx = 0;
     }
     $cat = $serendipity['GET']['category'];
     unset($serendipity['GET']['category']);
     #if ($sql_where != '') $GLOBALS['Dbdie'] = true;
     $entries = serendipity_fetchEntries(null, true, $params['limit'], false, false, 'CAST(ep' . $filteridx . '.value AS UNSIGNED) ' . $params['mode'], $sql_where, false, false, null, null, 'array', true, true, $params['joinown']);
     $dategroup = array(0 => array('entries' => $entries, 'timestamp' => time()));
     $GLOBALS['DBTEST'] = true;
     $entries = serendipity_printEntries($dategroup, true, false, 'CUSTOMARCHIVE_ENTRIES', 'return', false, false, true);
     if (!empty($cat)) {
         $serendipity['GET']['category'] = $cat;
     }
     $serendipity['smarty']->assign('customarchive_entries', $entries);
     $filename = basename($params['template']);
     $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;
     $content = $serendipity['smarty']->fetch('file:' . $tfile);
     $serendipity['smarty']->security_settings[INCLUDE_ANY] = $inclusion;
     $serendipity['smarty']->assign('ENTRIES', 'xxx');
     return $content;
 }
开发者ID:sqall01,项目名称:additional_plugins,代码行数:101,代码来源:serendipity_event_customarchive.php

示例11: serendipity_fetchComments

        $entries = serendipity_fetchComments(isset($_GET['cid']) ? $_GET['cid'] : null, $serendipity['RSSfetchLimit'], 'desc', false, $_GET['type']);
        $description = $title . ' - ' . $description;
        if (isset($_GET['cid'])) {
            $title = $title . ' - ' . COMMENTS_FROM . ' "' . $latest_entry[0]['title'] . '"';
        } else {
            $title = $title . ' - ' . COMMENTS;
        }
        $comments = TRUE;
        break;
    case 'content':
    default:
        if (isset($_GET['all']) && $_GET['all']) {
            // Fetch all entries in reverse order for later importing. Fetch sticky entries as normal entries.
            $entries = serendipity_fetchEntries(null, true, '', false, false, 'id ASC', '', false, true);
        } else {
            $entries = serendipity_fetchEntries(null, true, $serendipity['RSSfetchLimit'], false, isset($modified_since) ? $modified_since : false, 'timestamp DESC', '', false, true);
        }
        break;
}
if (isset($serendipity['serendipityRealname'])) {
    $title .= ' (' . LOGIN . ': ' . $serendipity['serendipityRealname'] . ')';
}
if (!empty($serendipity['GET']['category'])) {
    $cInfo = serendipity_fetchCategoryInfo((int) $serendipity['GET']['category']);
    $title = serendipity_utf8_encode(htmlspecialchars($title . ' - ' . $cInfo['category_name']));
} elseif (!empty($serendipity['GET']['viewAuthor'])) {
    list($aInfo) = serendipity_fetchAuthor((int) $serendipity['GET']['viewAuthor']);
    $title = serendipity_utf8_encode(htmlspecialchars($aInfo['realname'] . ' - ' . $title));
} else {
    $title = serendipity_utf8_encode(htmlspecialchars($title));
}
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:31,代码来源:rss.php

示例12: displayTagUpdate

    /**
     * Backend Administration Method (7): Rebuild entry auto-keyword tags
     *
     * @see     displayManageTags() case 7
     */
    function displayTagUpdate()
    {
        global $serendipity;
        $limit = 25;
        $page = isset($serendipity['GET']['page']) ? $serendipity['GET']['page'] : 1;
        $from = ($page - 1) * $limit;
        $to = $page * $limit;
        if ($serendipity['version'][0] > 1) {
            echo '<h3>';
        }
        printf(PLUGIN_EVENT_FREETAG_REBUILD_FETCHNO, $from, $to);
        $entries = serendipity_fetchEntries(null, true, $limit, false, false, 'timestamp DESC', '', true);
        $total = serendipity_getTotalEntries();
        if ($serendipity['version'][0] < 2) {
            printf(PLUGIN_EVENT_FREETAG_REBUILD_TOTAL . '<br />', $total);
        } else {
            printf(PLUGIN_EVENT_FREETAG_REBUILD_TOTAL, $total);
            echo '</h3>';
        }
        if (is_array($entries)) {
            if ($serendipity['version'][0] > 1) {
                echo '<ul class="plainList">' . "\n";
            }
            foreach ($entries as $entry) {
                unset($entry['orderkey']);
                unset($entry['loginname']);
                unset($entry['email']);
                if ($serendipity['version'][0] < 2) {
                    printf('%d - "%s"<br />', $entry['id'], self::specialchars_mapper($entry['title']));
                } else {
                    printf('    <li>%d - "%s"', $entry['id'], self::specialchars_mapper($entry['title']));
                }
                $serendipity['POST']['properties']['fake'] = 'fake';
                $current_cat = $entry['categories'];
                $entry['categories'] = array();
                foreach ($current_cat as $categoryidx => $category_data) {
                    $entry['categories'][$category_data['categoryid']] = $category_data['categoryid'];
                }
                $up = serendipity_updertEntry($entry);
                if (is_string($up)) {
                    echo "<div>{$up}</div>\n";
                }
                if ($serendipity['version'][0] < 2) {
                    echo DONE . "<br />\n";
                } else {
                    echo ' ... ' . DONE . "</li>\n";
                }
            }
            if ($serendipity['version'][0] > 1) {
                echo "</ul>\n";
            }
        }
        if ($serendipity['version'][0] < 2) {
            echo '<br />';
        }
        if ($to < $total) {
            ?>

            <script type="text/javascript">
                if (confirm("<?php 
            echo htmlspecialchars(PLUGIN_EVENT_FREETAG_REBUILD_FETCHNEXT, ENT_COMPAT, LANG_CHARSET);
            ?>
")) {
                    location.href = "?serendipity[adminModule]=event_display&serendipity[adminAction]=managetags&serendipity[tagview]=tagupdate&serendipity[page]=<?php 
            echo (int) ($page + 1);
            ?>
";
                } else {
                    alert("<?php 
            echo DONE;
            ?>
");
                }
            </script>

<?php 
        } else {
            if ($serendipity['version'][0] < 2) {
                echo '<div class="serendipity_msg_notice">' . DONE . '</div>';
            } else {
                echo '<span class="msg_notice"><span class="icon-info-circled"></span>' . DONE . "</span>\n";
            }
        }
    }
开发者ID:ophian,项目名称:serendipity_event_freetag,代码行数:89,代码来源:serendipity_event_freetag.php

示例13: event_hook

 function event_hook($event, &$bag, &$eventData, $addData = null)
 {
     global $serendipity;
     $hooks =& $bag->get('event_hooks');
     if (isset($hooks[$event])) {
         switch ($event) {
             case 'external_plugin':
                 $uri_parts = explode('&', str_replace(array('&amp;', '?'), array('&', '&'), $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];
                         }
                     }
                 }
                 $req = trim($uri_parts[0]);
                 switch ($req) {
                     case $this->get_config('backendurl'):
                         if (!headers_sent()) {
                             header('HTTP/1.0 200');
                             header('Status: 200 OK');
                         }
                         if (isset($_REQUEST['category']) && !empty($_REQUEST['category'])) {
                             $category = trim(urldecode($_REQUEST['category']));
                         } else {
                             $category = '';
                         }
                         if (!empty($_REQUEST['authorid'])) {
                             $serendipity['GET']['viewAuthor'] = $_REQUEST['authorid'];
                         }
                         if (!empty($_REQUEST['categoryid'])) {
                             $serendipity['GET']['category'] = $_REQUEST['categoryid'];
                         }
                         if (isset($_REQUEST['num']) && !empty($_REQUEST['num'])) {
                             $num = intval(trim(urldecode($_REQUEST['num'])));
                         } else {
                             $num = 10;
                         }
                         $order = strtolower(trim(urldecode($_REQUEST['order']))) == 'asc' || strtolower(trim(urldecode($_REQUEST['order']))) == 'desc' ? trim(urldecode($_REQUEST['order'])) : "DESC";
                         $showdate = intval(trim(urldecode($_REQUEST['date']))) >= 1 ? 1 : 0;
                         $dateformat = trim(urldecode($_REQUEST['dateformat'])) != '' ? trim(urldecode($_REQUEST['dateformat'])) : "Y-m-d";
                         $showtime = intval(trim(urldecode($_REQUEST['time']))) >= 1 ? 1 : 0;
                         $timeformat = trim(urldecode($_REQUEST['timeformat'])) != '' ? trim(urldecode($_REQUEST['timeformat'])) : "g:ia";
                         $point = trim(urldecode($_REQUEST['point'])) != '' ? trim(urldecode($_REQUEST['point'])) : "";
                         $details = intval(trim(urldecode($_REQUEST['details']))) >= 1 ? 1 : 0;
                         if ($category == "") {
                             $entries = serendipity_fetchEntries(null, true, $num, false, false, 'timestamp ' . $order, '', false, true);
                         } else {
                             $entries = serendipity_fetchEntries(null, true, $num, false, false, 'timestamp ' . $order, 'c.category_name = \'' . serendipity_db_escape_string($category) . '\'', false, true);
                         }
                         for ($a = 0, $maxa = count($entries); $a < $maxa; $a++) {
                             if ($showtime == 1 && $showdate == 1) {
                                 $date = date($dateformat . " " . $timeformat, $entries[$a]['timestamp']);
                             } elseif ($showtime == 1) {
                                 $date = date($timeformat, $entries[$a]['timestamp']);
                             } elseif ($showdate == 1) {
                                 $date = date($dateformat, $entries[$a]['timestamp']);
                             } else {
                                 $date = "";
                             }
                             $entryurl = serendipity_archiveURL($entries[$a]['id'], $entries[$a]['title']);
                             if ($details <= 0) {
                                 if ($date != "") {
                                     $date = "[" . addslashes(function_exists('serendipity_specialchars') ? serendipity_specialchars($date) : htmlspecialchars($date, ENT_COMPAT, LANG_CHARSET)) . "] ";
                                 }
                                 echo "    document.write('<span class=\"blog_point\">" . (trim($point) != "" ? addslashes(function_exists('serendipity_specialchars') ? serendipity_specialchars(trim($point)) : htmlspecialchars(trim($point), ENT_COMPAT, LANG_CHARSET)) . " " : "") . "</span><span class=\"blog_date\">" . $date . "</span><a class=\"blog_link\" href=\"" . $entryurl . "\">" . addslashes($entries[$a]['title']) . "</a><br />');\n";
                             } else {
                                 echo "    document.write('<span class=\"blog_title\">" . addslashes($entries[$a]['title']) . "</span>');\n";
                                 echo "    document.write('<hr class=\"blog_hr\" />');\n";
                                 serendipity_plugin_api::hook_event('frontend_display', $entries[$a]);
                                 $entries[$a]['body'] = preg_replace('@(href|src)=("|\')(' . preg_quote($serendipity['serendipityHTTPPath']) . ')(.*)("|\')(.*)>@imsU', '\\1=\\2' . $serendipity['baseURL'] . '\\4\\2\\6>', $entries[$a]['body']);
                                 $body = str_replace("\n", "", str_replace("\r\n", "", trim($entries[$a]['body'])));
                                 if (substr($body, strlen($body) - 5, strlen($body)) == "<br />") {
                                     $body = substr($body, 0, strlen($body) - 5);
                                 }
                                 if ($date != "") {
                                     $date = ", " . addslashes(function_exists('serendipity_specialchars') ? serendipity_specialchars($date) : htmlspecialchars($date, ENT_COMPAT, LANG_CHARSET));
                                 }
                                 $body = str_replace("'", "\\'", $body);
                                 echo "    document.write('<span class=\"blog_body\">" . $body . "</span>');\n";
                                 echo "    document.write('<hr class=\"blog_hr\" />');\n";
                                 echo "    document.write('<span class=\"blog_author\">" . addslashes($entries[$a]['author']) . "</span><span class=\"blog_date\">" . $date . " <span class=\"blog_link\">[<a class=\"blog_link\" href=\"" . $entryurl . "\">&raquo;</a>]</span><br /><br />');\n";
                             }
                         }
                         break;
                 }
                 return true;
                 break;
         }
     }
     return true;
 }
开发者ID:sqall01,项目名称:additional_plugins,代码行数:95,代码来源:serendipity_event_backend.php

示例14: generate_content

 function generate_content(&$title)
 {
     global $serendipity;
     $title = $this->get_config('title', $this->title);
     $ts = mktime(0, 0, 0, date('m'), 1);
     $add_query = '';
     $category_set = isset($serendipity['GET']['category']);
     if ($category_set) {
         $base_query = 'C' . (int) $serendipity['GET']['category'];
         $add_query = '/' . $base_query;
     }
     $max_x = $this->get_config('count', 3);
     $show_count = serendipity_db_bool($this->get_config('show_count', false));
     $hide_zero_count = serendipity_db_bool($this->get_config('hide_zero_count', false));
     $freq = $this->get_config('frequency', 'months');
     echo '<ul class="plainList">' . "\n";
     if ($serendipity['dbType'] == 'sqlite' || $serendipity['dbType'] == 'sqlite3' || $serendipity['dbType'] == 'sqlite3oo') {
         $dist_sql = 'count(e.id) AS orderkey';
     } else {
         $dist_sql = 'count(DISTINCT e.id) AS orderkey';
     }
     for ($x = 0; $x < $max_x; $x++) {
         $current_ts = $ts;
         switch ($freq) {
             case 'months':
                 switch ($serendipity['calendar']) {
                     default:
                     case 'gregorian':
                         $linkStamp = date('Y/m', $ts);
                         $ts_title = serendipity_formatTime("%B %Y", $ts, false);
                         $ts = mktime(0, 0, 0, date('m', $ts) - 1, 1, date('Y', $ts));
                         // Must be last in 'case' statement
                         break;
                     case 'persian-utf8':
                         require_once S9Y_INCLUDE_PATH . 'include/functions_calendars.inc.php';
                         $linkStamp = persian_date_utf('Y/m', $ts);
                         $ts_title = serendipity_formatTime("%B %Y", $ts, false);
                         $ts = persian_mktime(0, 0, 0, persian_date_utf('m', $ts) - 1, 1, persian_date_utf('Y', $ts));
                         // Must be last in 'case' statement
                         break;
                 }
                 break;
             case 'weeks':
                 switch ($serendipity['calendar']) {
                     default:
                     case 'gregorian':
                         $linkStamp = date('Y/\\WW', $ts);
                         $ts_title = WEEK . ' ' . date('W, Y', $ts);
                         $ts = mktime(0, 0, 0, date('m', $ts), date('d', $ts) - 7, date('Y', $ts));
                         break;
                     case 'persian-utf8':
                         require_once S9Y_INCLUDE_PATH . 'include/functions_calendars.inc.php';
                         $linkStamp = persian_date_utf('Y/\\WW', $ts);
                         $ts_title = WEEK . ' ' . persian_date_utf('W، Y', $ts);
                         $ts = persian_mktime(0, 0, 0, persian_date_utf('m', $ts), persian_date_utf('d', $ts) - 7, persian_date_utf('Y', $ts));
                         break;
                 }
                 break;
             case 'days':
                 switch ($serendipity['calendar']) {
                     default:
                     case 'gregorian':
                         $linkStamp = date('Y/m/d', $ts);
                         $ts_title = serendipity_formatTime("%B %e. %Y", $ts, false);
                         $ts = mktime(0, 0, 0, date('m', $ts), date('d', $ts) - 1, date('Y', $ts));
                         // Must be last in 'case' statement
                         break;
                     case 'persian-utf8':
                         require_once S9Y_INCLUDE_PATH . 'include/functions_calendars.inc.php';
                         $linkStamp = persian_date_utf('Y/m/d', $ts);
                         $ts_title = serendipity_formatTime("%e %B %Y", $ts, false);
                         $ts = persian_mktime(0, 0, 0, persian_date_utf('m', $ts), persian_date_utf('d', $ts) - 1, persian_date_utf('Y', $ts));
                         // Must be last in 'case' statement
                         break;
                 }
                 break;
         }
         $link = serendipity_rewriteURL(PATH_ARCHIVES . '/' . $linkStamp . $add_query . '.html', 'serendipityHTTPPath');
         $html_count = '';
         $hidden_by_zero_count = false;
         if ($show_count) {
             switch ($freq) {
                 case 'months':
                     $end_ts = $current_ts + date('t', $current_ts) * 24 * 60 * 60 - 1;
                     break;
                 case 'weeks':
                     $end_ts = $current_ts + 7 * 24 * 60 * 60 - 1;
                     break;
                 case 'days':
                     $end_ts = $current_ts + 24 * 60 * 60 - 1;
                     break;
             }
             $ec = serendipity_fetchEntries(array($current_ts, $end_ts), false, '', false, false, null, '', false, true, $dist_sql, '', 'single', false, $category_set);
             if (is_array($ec)) {
                 if (empty($ec['orderkey'])) {
                     $ec['orderkey'] = '0';
                 }
                 $hidden_by_zero_count = $hide_zero_count && $ec['orderkey'] == '0';
                 $html_count .= ' (' . $ec['orderkey'] . ')';
             }
//.........这里部分代码省略.........
开发者ID:vonnordmann,项目名称:Serendipity,代码行数:101,代码来源:serendipity_plugin_archives.php

示例15: event_hook

    function event_hook($event, &$bag, &$eventData, $addlData = null)
    {
        global $serendipity;
        $hooks =& $bag->get('event_hooks');
        // I'm not really certain why this is here (since we only get called
        // for the events we hooked), but Garvin uses it, so it must be
        // important.
        if (isset($hooks[$event])) {
            $content_type = $this->get_config('content_type', 'categories');
            $placement = $this->get_config('placement', 'entry top');
            $news_cats = $this->get_config('news_cats');
            switch ($event) {
                case 'genpage':
                    // Is this the frontpage? (Garvin's algorythm; works
                    // for all cases except index.html, on my server)
                    if ($addlData['startpage']) {
                        $this->isFrontPage = true;
                    } else {
                        $this->isFrontPage = false;
                        return true;
                    }
                    // Get this newsbox's entries
                    //
                    // Hidden newsboxes don't need to waste time doing this.
                    if ($placement == 'hidden') {
                        return true;
                    }
                    // If I don't contain categories, I don't generate HTML from categories.
                    if ($content_type != 'categories') {
                        return true;
                    }
                    // If this newsbox is empty, we'd get an SQL error.
                    if (empty($news_cats)) {
                        $this->html = '<div class="newsbox"><i>No ' . $this->get_config('title', PLUGIN_EVENT_NEWSBOX_DEFAULT_TITLE) . ' today.</i></div>';
                        return true;
                    }
                    // Smarty isn't initialized yet.
                    serendipity_smarty_init();
                    // Create the SQL to fetch my entries
                    $sql = "\n" . ' e.id IN ' . "\n" . '(SELECT entryid FROM ' . $serendipity['dbPrefix'] . 'entrycat' . "\n" . ' WHERE categoryid IN (' . $news_cats . ')' . "\n" . ')';
                    // We don't want our exclusion logic to execute on *this*
                    // fetchEntries call!
                    $serendipity['newsbox'] = 'no_exclude';
                    //--JAM: yeah, it looks like a bug to me.  I wonder what else gets accidentally overwritten?
                    $oldLimit = $serendipity['fetchLimit'];
                    // We want the number of entries configurable
                    $max_entries = $this->get_config('max_entries', 5);
                    if (!is_numeric($max_entries)) {
                        $max_entries = 5;
                    }
                    $entries = serendipity_fetchEntries(null, true, $max_entries, false, false, 'timestamp DESC', $sql);
                    $serendipity['fetchLimit'] = $oldLimit;
                    unset($serendipity['newsbox']);
                    // Process our input data with new printEntries:
                    // $entries, no extended, no preview, block NEWSBOX, no smarty fetch, no hooks, footer
                    serendipity_printEntries($entries, 0, false, 'NEWSBOX', false, false, false);
                    $newsbox_data = array();
                    $newsbox_data['title'] = $this->get_config('title', PLUGIN_EVENT_NEWSBOX_DEFAULT_TITLE);
                    $newsbox_data['cats'] = explode(',', $news_cats);
                    $newsbox_data['content_type'] = $content_type;
                    $newsbox_data['isContainer'] = $content_type != 'categories';
                    $newsbox_data['multicat_action'] = $serendipity['baseURL'] . $serendipity['indexFile'];
                    $serendipity['smarty']->assign('newsbox_data', $newsbox_data);
                    $nb = serendipity_getTemplateFile('newsbox.tpl');
                    if ($nb && $nb != 'newsbox.tpl') {
                        // Template is obviously newsbox-aware
                        $this->html = serendipity_smarty_fetch('NEWSBOX', 'newsbox.tpl', false);
                    } else {
                        // Set the newsbox variable for the template, in case it's newsbox-aware
                        $serendipity['smarty']->assign('isNewsbox', true);
                        // Modify the footer link
                        $more = '<form style="display:inline;" action="' . $serendipity['baseURL'] . $serendipity['indexFile'] . '" method="post">';
                        foreach (explode(',', $news_cats) as $cat) {
                            $more .= '<input type="hidden" name="serendipity[multiCat][]" value="' . $cat . '">';
                        }
                        $more .= '<input class="serendipityPrettyButton input_button" type="submit" name="serendipity[isMultiCat]" value="More ' . $this->get_config('title', PLUGIN_EVENT_NEWSBOX_DEFAULT_TITLE) . '"></form>';
                        $serendipity['smarty']->assign('footer_info', $more);
                        // Get the HTML
                        $serendipity['skip_smarty_hooks'] = true;
                        // Don't call entries_header from the template!
                        $this->html = serendipity_smarty_fetch('NEWSBOX', 'entries.tpl', false);
                        unset($serendipity['skip_smarty_hooks']);
                        // Don't leave the newsbox variable set for the regular fetch
                        $serendipity['smarty']->clear_assign('isNewsbox');
                        // Check if the template supports newsboxes
                        // Matches class = "whatever_newsbox_whatever", taking care to allow
                        // whitespace where legal and match quote types (I don't think you
                        // can use a quote in a class name, but hey...)
                        if (preg_match('/class\\s*=\\s*(["\'])[^\\1]*newsbox/', $this->html) == 0) {
                            // Add the div; give it the default class "newsbox" and a title
                            $title = $this->get_config('title');
                            $this->html = "\n<div class=\"newsbox\"><h3 class=\"newsbox_title\">{$title}</h3>\n" . $this->html . "\n</div><!--newsbox-->\n";
                        }
                    }
                    // Done processing the newsbox
                    break;
                case 'frontend_fetchentries':
                    // Only on the frontpage
                    if (!$this->isFrontPage) {
                        return true;
//.........这里部分代码省略.........
开发者ID:sqall01,项目名称:additional_plugins,代码行数:101,代码来源:serendipity_event_newsbox.php


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