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


PHP serendipity_smarty_fetch函数代码示例

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


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

示例1: serendipity_printCommentsByAuthor

/**
 * Fetches and prints a listing of comments by author
 */
function serendipity_printCommentsByAuthor()
{
    global $serendipity;
    $type = serendipity_db_escape_string($serendipity['GET']['commentMode']);
    if ($type == 'comments' || empty($type)) {
        $type = 'NORMAL';
    } elseif ($type == 'trackbacks') {
        $type = 'TRACKBACK';
    } elseif ($type == 'comments_and_trackbacks') {
        $type = '%';
    }
    if (!empty($serendipity['GET']['viewCommentAuthor'])) {
        $sql_where = " AND co.author = '" . serendipity_db_escape_string($serendipity['GET']['viewCommentAuthor']) . "'";
        $group_by = "GROUP BY co.author";
    } else {
        $sql_where = " AND 1";
        // Required fake 'where' condition
        $group_by = "";
    }
    if (!empty($serendipity['GET']['commentStartTime'])) {
        $sql_where .= " AND co.timestamp >= " . (int) $serendipity['GET']['commentStartTime'];
    }
    if (!empty($serendipity['GET']['commentEndTime'])) {
        $sql_where .= " AND co.timestamp <= " . (int) $serendipity['GET']['commentEndTime'];
    }
    if (empty($serendipity['GET']['page'])) {
        $serendipity['GET']['page'] = 1;
    }
    $sql_limit = $serendipity['fetchLimit'] * ($serendipity['GET']['page'] - 1) . ',' . $serendipity['fetchLimit'];
    $c = serendipity_fetchComments(null, $sql_limit, 'co.entry_id DESC, co.id ASC', false, $type, $sql_where);
    $entry_comments = array();
    foreach ($c as $i => $comment) {
        if (!isset($entry_comments[$comment['entry_id']])) {
            $comment['link'] = serendipity_archiveURL($comment['entry_id'], $comment['title'], 'serendipityHTTPPath', true, array('timestamp' => $comment['entrytimestamp']));
            $entry_comments[$comment['entry_id']] = $comment;
        }
        $entry_comments[$comment['entry_id']]['comments'][] = $comment;
    }
    foreach ($entry_comments as $entry_id => $_data) {
        $entry_comments[$entry_id]['tpl_comments'] =& serendipity_printComments($_data['comments'], VIEWMODE_LINEAR, 0, null, 'COMMENTS', 'comments.tpl');
    }
    $serendipity['smarty']->assign_by_ref('comments_by_authors', $entry_comments);
    if (!empty($id)) {
        $and .= " AND co.entry_id = '" . (int) $id . "'";
    }
    if (!$showAll) {
        $and .= ' AND co.status = \'approved\'';
    }
    $fc = "SELECT count(co.id) AS counter\n                                  FROM {$serendipity['dbPrefix']}comments AS co\n                                 WHERE co.entry_id > 0\n                                   AND co.type LIKE '" . $type . "'\n                                   AND co.status = 'approved' " . $sql_where . " " . $group_by;
    $cc = serendipity_db_query($fc, true, 'assoc');
    if (!isset($cc['counter'])) {
        $totalComments = 0;
    } else {
        $totalComments = $cc['counter'];
    }
    serendipity_printEntryFooter('', $totalComments);
    serendipity_smarty_fetch('ENTRIES', 'comments_by_author.tpl');
    return true;
}
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:62,代码来源:functions_comments.inc.php

示例2: generate_plugins

 /**
  * Get a list of Sidebar plugins and pass them to Smarty
  *
  * @access public
  * @param   string      The side of plugins to show (left/right/hide/event/eventh)
  * @param   string      deprecated: Indicated which wrapping HTML element to use for plugins
  * @param   boolean     Indicates whether only all plugins should be shown that are not in the $side list
  * @param   string      Only show plugins of this plugin class
  * @param   string      Only show a plugin with this instance ID
  * @return  string      Smarty HTML output
  */
 function generate_plugins($side, $tag = '', $negate = false, $class = null, $id = null, $tpl = 'sidebar.tpl')
 {
     global $serendipity;
     /* $tag parameter is deprecated and used in Smarty templates instead. Only use it in function
      * header for layout.php BC.
      */
     $plugins = serendipity_plugin_api::enum_plugins($side, $negate, $class, $id);
     if (!is_array($plugins)) {
         return;
     }
     if (!isset($serendipity['smarty'])) {
         $serendipity['smarty_raw_mode'] = true;
         serendipity_smarty_init();
     }
     $pluginData = array();
     $addData = func_get_args();
     serendipity_plugin_api::hook_event('frontend_generate_plugins', $plugins, $addData);
     if (count($plugins) == 0) {
         $serendipity['prevent_sidebar_plugins_' . $side] = true;
     }
     $loggedin = false;
     if (serendipity_userLoggedIn() && serendipity_checkPermission('adminPlugins')) {
         $loggedin = true;
     }
     foreach ($plugins as $plugin_data) {
         $plugin =& serendipity_plugin_api::load_plugin($plugin_data['name'], $plugin_data['authorid'], $plugin_data['path']);
         if (is_object($plugin)) {
             $class = get_class($plugin);
             $title = '';
             /* TODO: make generate_content NOT echo its output */
             ob_start();
             $show_plugin = $plugin->generate_content($title);
             $content = ob_get_contents();
             ob_end_clean();
             if ($loggedin) {
                 $content .= '<div class="serendipity_edit_nugget"><a href="' . $serendipity['serendipityHTTPPath'] . 'serendipity_admin.php?serendipity[adminModule]=plugins&amp;serendipity[plugin_to_conf]=' . htmlentities($plugin->instance) . '">' . EDIT . '</a></div>';
             }
             if ($show_plugin !== false) {
                 $pluginData[] = array('side' => $side, 'class' => $class, 'title' => $title, 'content' => $content, 'id' => $plugin->instance);
             }
         } else {
             $pluginData[] = array('side' => $side, 'title' => ERROR, 'class' => $class, 'content' => sprintf(INCLUDE_ERROR, $plugin_data['name']));
         }
     }
     serendipity_plugin_api::hook_event('frontend_sidebar_plugins', $pluginData, $addData);
     $serendipity['smarty']->assign_by_ref('plugindata', $pluginData);
     $serendipity['smarty']->assign('pluginside', ucfirst($side));
     return serendipity_smarty_fetch('sidebar_' . $side, $tpl, true);
 }
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:60,代码来源:plugin_api.inc.php

示例3: serendipity_showMedia

/**
 * Prints a media item
 *
 * @param  array    Array of image metadata
 * @param  string   URL for maintenance tasks
 * @param  boolean  Whether to show maintenance task items
 * @param  int      how many media items to display per row
 * @param  boolean  Enclose within a table cell?
 * @param  array    Additional Smarty variables
 * @param  boolean  If TRUE, will echo Smarty output.
 * @return string   Smarty block name
 *
 */
function serendipity_showMedia(&$file, &$paths, $url = '', $manage = false, $lineBreak = 3, $enclose = true, $smarty_vars = array(), $smarty_display = true)
{
    global $serendipity;
    $form_hidden = '';
    foreach ($serendipity['GET'] as $g_key => $g_val) {
        if (!is_array($g_val) && $g_key != 'page') {
            $form_hidden .= '<input type="hidden" name="serendipity[' . $g_key . ']" value="' . htmlspecialchars($g_val) . '" />';
        }
    }
    serendipity_smarty_init();
    $media = array('manage' => $manage, 'lineBreak' => $lineBreak, 'lineBreakP' => round(1 / $lineBreak * 100), 'url' => $url, 'enclose' => $enclose, 'zoomIMG' => serendipity_getTemplateFile('admin/img/big_zoom.png'), 'renameIMG' => serendipity_getTemplateFile('admin/img/big_rename.png'), 'resizeIMG' => serendipity_getTemplateFile('admin/img/big_resize.png'), 'rotatecwIMG' => serendipity_getTemplateFile('admin/img/big_rotate_cw.png'), 'rotateccwIMG' => serendipity_getTemplateFile('admin/img/big_rotate_ccw.png'), 'configureIMG' => serendipity_getTemplateFile('admin/img/configure.png'), 'deleteIMG' => serendipity_getTemplateFile('admin/img/big_delete.png'), 'prevIMG' => serendipity_getTemplateFile('admin/img/previous.png'), 'nextIMG' => serendipity_getTemplateFile('admin/img/next.png'), 'token' => serendipity_setFormToken(), 'form_hidden' => $form_hidden, 'blimit_path' => basename($limit_path), 'only_path' => $serendipity['GET']['only_path'], 'only_filename' => $serendipity['GET']['only_filename'], 'sortorder' => $serendipity['GET']['sortorder'], 'keywords_selected' => $serendipity['GET']['keywords'], 'filter' => $serendipity['GET']['filter'], 'sort_order' => serendipity_getImageFields(), 'authors' => serendipity_fetchUsers(), 'sort_row_interval' => array(8, 16, 50, 100), 'nr_files' => count($file), 'keywords' => explode(';', $serendipity['mediaKeywords']));
    $media = array_merge($media, $smarty_vars);
    $media['files'] =& $file;
    if (count($paths) > 0) {
        $media['paths'] =& $paths;
    } else {
        $media['paths'] =& serendipity_getMediaPaths();
    }
    $serendipity['smarty']->assign_by_ref('media', $media);
    if ($enclose) {
        serendipity_smarty_fetch('MEDIA_ITEMS', 'admin/media_items.tpl');
        $block = 'admin/media_pane.tpl';
        if ($smarty_display) {
            $serendipity['smarty']->display(serendipity_getTemplateFile('admin/media_pane.tpl', 'serendipityPath'));
        }
    } else {
        serendipity_smarty_fetch('MEDIA_ITEMS', 'admin/media_items.tpl');
        $block = 'admin/media_properties.tpl';
        if ($smarty_display) {
            $serendipity['smarty']->display(serendipity_getTemplateFile('admin/media_properties.tpl', 'serendipityPath'));
        }
    }
    return $block;
}
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:47,代码来源:functions_images.inc.php

示例4: event_hook


//.........这里部分代码省略.........
                        $serendipity['GET']['subpage'] = $this->get404Errorpage();
                    }
                    // Set static page with is_startpage flag set as startpage
                    if ((empty($args) || preg_match('@' . $serendipity['indexFile'] . '\\??$@', trim($args))) && empty($serendipity['GET']['subpage'])) {
                        $serendipity['GET']['subpage'] = $this->getStartpage();
                    }
                    // Set static page according to requested URL
                    if (empty($serendipity['GET']['subpage'])) {
                        $serendipity['GET']['subpage'] = $nice_url;
                    }
                    if ($this->selected()) {
                        $te = $this->get_static('title_element');
                        if (!empty($te)) {
                            $serendipity['head_title'] = function_exists('serendipity_specialchars') ? serendipity_specialchars($te) : htmlspecialchars($te, ENT_COMPAT, LANG_CHARSET);
                            $serendipity['head_subtitle'] = '';
                        } else {
                            $serendipity['head_title'] = $this->get_static('headline');
                            $serendipity['head_subtitle'] = $serendipity['blogTitle'];
                        }
                    }
                    break;
                case 'frontend_header':
                    $md = function_exists('serendipity_specialchars') ? serendipity_specialchars($this->get_static('meta_description')) : htmlspecialchars($this->get_static('meta_description'), ENT_COMPAT, LANG_CHARSET);
                    $mk = function_exists('serendipity_specialchars') ? serendipity_specialchars($this->get_static('meta_keywords')) : htmlspecialchars($this->get_static('meta_keywords'), ENT_COMPAT, LANG_CHARSET);
                    if (!empty($md)) {
                        echo '        <meta name="description" content="' . $md . '" />' . "\n";
                    }
                    if (!empty($mk)) {
                        echo '        <meta name="keywords" content="' . $mk . '" />' . "\n";
                    }
                    break;
                case 'frontend_fetchentries':
                    if ($serendipity['GET']['action'] == 'search') {
                        serendipity_smarty_fetch('ENTRIES', 'entries.tpl', true);
                    }
                    break;
                case 'entry_display':
                    $this->smarty_init();
                    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);
                        }
                    }
                    break;
                case 'backend_sidebar_entries':
                    $this->setupDB();
                    echo '<li class="serendipitySideBarMenuLink serendipitySideBarMenuEntryLinks"><a href="?serendipity[adminModule]=event_display&amp;serendipity[adminAction]=staticpages">' . STATICPAGE_TITLE . '</a></li>';
                    break;
                case 'backend_sidebar_entries_event_display_staticpages':
                    $this->showBackend();
                    break;
                case 'backend_media_rename':
                    // Only MySQL supported, since I don't know how to use REGEXPs differently.
                    if ($serendipity['dbType'] != 'mysql' && $serendipity['dbType'] != 'mysqli') {
                        echo STATICPAGE_MEDIA_DIRECTORY_MOVE_ENTRY . '<br />';
                        break;
                    }
                    if (!isset($eventData[0]['oldDir'])) {
                        return true;
                    }
                    if ($eventData[0]['type'] == 'dir') {
                    } elseif ($eventData[0]['type'] == 'filedir') {
                        $eventData[0]['oldDir'] .= $eventData[0]['name'];
开发者ID:sqall01,项目名称:additional_plugins,代码行数:67,代码来源:serendipity_event_staticpage.php

示例5: serendipity_printArchives

/**
 * Gather an archive listing of older entries and passes it to Smarty
 *
 * The archives are created according to the current timestamp and show the current year.
 * $serendipity['GET']['category'] is honoured like in serendipity_fetchEntries()
 * $serendipity['GET']['viewAuthor'] is honoured like in serendipity_fetchEntries()
 *
 * @access public
 * @return null
 */
function serendipity_printArchives()
{
    global $serendipity;
    $f = serendipity_db_query("SELECT timestamp FROM {$serendipity['dbPrefix']}entries ORDER BY timestamp ASC LIMIT 1");
    switch ($serendipity['calendar']) {
        case 'gregorian':
        default:
            $lastYear = date('Y', serendipity_serverOffsetHour($f[0][0]));
            $lastMonth = date('m', serendipity_serverOffsetHour($f[0][0]));
            $thisYear = date('Y', serendipity_serverOffsetHour());
            $thisMonth = date('m', serendipity_serverOffsetHour());
            break;
        case 'persian-utf8':
            require_once S9Y_INCLUDE_PATH . 'include/functions_calendars.inc.php';
            $lastYear = persian_date_utf('Y', serendipity_serverOffsetHour($f[0][0]));
            $lastMonth = persian_date_utf('m', serendipity_serverOffsetHour($f[0][0]));
            $thisYear = persian_date_utf('Y', serendipity_serverOffsetHour());
            $thisMonth = persian_date_utf('m', serendipity_serverOffsetHour());
            break;
    }
    $max = 1;
    if (isset($serendipity['GET']['category'])) {
        $cat_sql = serendipity_getMultiCategoriesSQL($serendipity['GET']['category']);
        $cat_get = '/C' . (int) $serendipity['GET']['category'];
    } else {
        $cat_sql = '';
        $cat_get = '';
    }
    if (isset($serendipity['GET']['viewAuthor'])) {
        $author_get = '/A' . (int) $serendipity['GET']['viewAuthor'];
    } else {
        $author_get = '';
    }
    if ($serendipity['dbType'] == 'postgres' || $serendipity['dbType'] == 'pdo-postgres') {
        $distinct = 'DISTINCT e.id,';
    } else {
        $distinct = '';
    }
    $q = "SELECT {$distinct} e.timestamp\n            FROM {$serendipity['dbPrefix']}entries e\n            " . (!empty($cat_sql) ? "\n       LEFT JOIN {$serendipity['dbPrefix']}entrycat ec\n              ON e.id = ec.entryid\n       LEFT JOIN {$serendipity['dbPrefix']}category c\n              ON ec.categoryid = c.categoryid" : "") . "\n           WHERE isdraft = 'false'" . (!serendipity_db_bool($serendipity['showFutureEntries']) ? " AND timestamp <= " . serendipity_db_time() : '') . (!empty($cat_sql) ? ' AND ' . $cat_sql : '') . (!empty($serendipity['GET']['viewAuthor']) ? ' AND e.authorid = ' . (int) $serendipity['GET']['viewAuthor'] : '') . (!empty($cat_sql) ? " GROUP BY e.id, e.timestamp" : '');
    $entries =& serendipity_db_query($q, false, 'assoc');
    $group = array();
    if (is_array($entries)) {
        foreach ($entries as $entry) {
            $group[date('Ym', $entry['timestamp'])]++;
        }
    }
    $output = array();
    for ($y = $thisYear; $y >= $lastYear; $y--) {
        $output[$y]['year'] = $y;
        for ($m = 12; $m >= 1; $m--) {
            /* If the month we are checking are in the future, we drop it */
            if ($m > $thisMonth && $y == $thisYear) {
                continue;
            }
            /* If the month is lower than the lowest month containing entries, we're done */
            if ($m < $lastMonth && $y <= $lastYear) {
                break;
            }
            switch ($serendipity['calendar']) {
                case 'gregorian':
                default:
                    $s = serendipity_serverOffsetHour(mktime(0, 0, 0, $m, 1, $y), true);
                    $e = serendipity_serverOffsetHour(mktime(23, 59, 59, $m, date('t', $s), $y), true);
                    break;
                case 'persian-utf8':
                    require_once S9Y_INCLUDE_PATH . 'include/functions_calendars.inc.php';
                    $s = serendipity_serverOffsetHour(persian_mktime(0, 0, 0, $m, 1, $y), true);
                    $e = serendipity_serverOffsetHour(persian_mktime(23, 59, 59, $m, date('t', $s), $y), true);
                    break;
            }
            $entry_count = (int) $group[$y . (strlen($m) == 1 ? '0' : '') . $m];
            /* A silly hack to get the maximum amount of entries per month */
            if ($entry_count > $max) {
                $max = $entry_count;
            }
            $data = array();
            $data['entry_count'] = $entry_count;
            $data['link'] = serendipity_archiveDateUrl($y . '/' . sprintf('%02s', $m) . $cat_get . $author_get);
            $data['link_summary'] = serendipity_archiveDateUrl($y . '/' . sprintf('%02s', $m) . $cat_get . $author_get, true);
            $data['date'] = $s;
            $output[$y]['months'][] = $data;
        }
    }
    $serendipity['smarty']->assign_by_ref('archives', $output);
    $serendipity['smarty']->assign_by_ref('max_entries', $max);
    serendipity_smarty_fetch('ARCHIVES', 'entries_archives.tpl', true);
}
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:97,代码来源:functions_entries.inc.php

示例6: getHTML

 function getHTML()
 {
     global $serendipity;
     $content_type = $this->get_config('content_type', 'categories');
     if ($content_type == 'newsboxes') {
         // Wrap content from my contained newsboxes.
         $contents = array();
         serendipity_plugin_api::hook_event('newsbox:get_content', $contents, array('id' => $this->instance));
         $nb = serendipity_getTemplateFile('newsbox.tpl');
         if ($nb && $nb != 'newsbox.tpl') {
             // The template should be able to handle this
             $serendipity['smarty']->assign('NEWSBOX', $contents);
             $newsbox_data = array();
             $newsbox_data['title'] = $this->get_config('title', PLUGIN_EVENT_NEWSBOX_DEFAULT_TITLE);
             $newsbox_data['cats'] = '';
             $newsbox_data['content_type'] = $content_type;
             $newsbox_data['isContainer'] = true;
             $newsbox_data['multicat_action'] = '';
             $serendipity['smarty']->assign('newsbox_data', $newsbox_data);
             $this->html = serendipity_smarty_fetch('NEWSBOX', 'newsbox.tpl', false);
         } else {
             $this->html = "\n<div class=\"newsbox_container\"><h3 class=\"newsbox_title\">" . $this->get_config('title') . "</h3>\n";
             foreach ($contents as $box) {
                 $this->html .= $box . "\n";
             }
             $this->html .= '<div style="clear:both;"><br /></div>' . "\n";
             $this->html .= "\n</div><!--newsbox_container-->\n";
         }
     }
     return $this->html;
 }
开发者ID:sqall01,项目名称:additional_plugins,代码行数:31,代码来源:serendipity_event_newsbox.php

示例7: serendipity_showMedia

/**
 * Prints a media item
 *
 * @param  array    Array of image metadata
 * @param  string   URL for maintenance tasks
 * @param  boolean  Whether to show maintenance task items
 * @param  int      how many media items to display per row
 * @param  boolean  Enclose within a table cell?
 * @param  array    Additional Smarty variables
 * @return string   Generated HTML
 *
 */
function serendipity_showMedia(&$file, &$paths, $url = '', $manage = false, $lineBreak = 3, $enclose = true, $smarty_vars = array())
{
    global $serendipity;
    $form_hidden = '';
    // do not add, if not for the default media list form
    if (($serendipity['GET']['adminAction'] == 'default' || empty($serendipity['GET']['adminAction'])) && !$serendipity['GET']['fid']) {
        foreach ($serendipity['GET'] as $g_key => $g_val) {
            // do not add token, since this is assigned separately to properties and list forms
            if (!is_array($g_val) && $g_key != 'page' && $g_key != 'token') {
                $form_hidden .= '        <input type="hidden" name="serendipity[' . $g_key . ']" value="' . serendipity_specialchars($g_val) . '">' . "\n";
            }
        }
    }
    if (!is_object($serendipity['smarty'])) {
        serendipity_smarty_init();
    }
    $order_fields = serendipity_getImageFields();
    // reset filename for building template filters, since this is hardcoded as 'only_filename'
    unset($order_fields['i.name']);
    $media = array('manage' => $manage, 'multiperm' => serendipity_checkPermission('adminImagesDirectories'), 'lineBreak' => $lineBreak, 'lineBreakP' => round(1 / $lineBreak * 100), 'url' => $url, 'enclose' => $enclose, 'token' => serendipity_setFormToken(), 'form_hidden' => $form_hidden, 'blimit_path' => empty($smarty_vars['limit_path']) ? '' : basename($smarty_vars['limit_path']), 'only_path' => $serendipity['GET']['only_path'], 'only_filename' => $serendipity['GET']['only_filename'], 'sortorder' => $serendipity['GET']['sortorder'], 'keywords_selected' => $serendipity['GET']['keywords'], 'filter' => $serendipity['GET']['filter'], 'sort_order' => $order_fields, 'simpleFilters' => $serendipity['simpleFilters'], 'hideSubdirFiles' => $serendipity['GET']['hideSubdirFiles'], 'authors' => serendipity_fetchUsers(), 'sort_row_interval' => array(8, 16, 50, 100), 'nr_files' => count($file), 'keywords' => explode(';', $serendipity['mediaKeywords']), 'thumbSize' => $serendipity['thumbSize'], 'sortParams' => array('perpage', 'order', 'ordermode'));
    $media = array_merge($media, $smarty_vars);
    $media['files'] =& $file;
    if (count($paths) > 0) {
        $media['paths'] =& $paths;
    } else {
        $media['paths'] =& serendipity_getMediaPaths();
    }
    $serendipity['smarty']->assignByRef('media', $media);
    if ($enclose) {
        serendipity_smarty_fetch('MEDIA_ITEMS', 'admin/media_items.tpl');
        return serendipity_smarty_show('admin/media_pane.tpl');
    } else {
        serendipity_smarty_fetch('MEDIA_ITEMS', 'admin/media_items.tpl');
        return serendipity_smarty_show('admin/media_properties.tpl');
    }
}
开发者ID:jimjag,项目名称:Serendipity,代码行数:48,代码来源:functions_images.inc.php

示例8: serendipity_getTemplateFile

     $media['css_imgedit'] = serendipity_getTemplateFile('admin/imgedit.css');
     if (isset($serendipity['GET']['fid'])) {
         $file = serendipity_fetchImageFromDatabase($serendipity['GET']['fid']);
         if (!is_array($file) || !serendipity_checkPermission('adminImagesDelete') || !serendipity_checkPermission('adminImagesMaintainOthers') && $file['authorid'] != '0' && $file['authorid'] != $serendipity['authorid']) {
             return;
         }
         $fullfile = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $file['path'] . $file['name'] . '.' . $file['extension'];
         $httpfile = $serendipity['serendipityHTTPPath'] . $serendipity['uploadHTTPPath'] . $file['path'] . $file['name'] . '.' . $file['extension'];
         $img = new imgedit($fullfile, $httpfile);
         // Set the filenames used for the cropping areas. Width/Height are automagically detected. Orientation is either horizontal or vertical.
         $img->setArea('imgedit_area.gif', 'h');
         $img->setArea('imgedit_varea.gif', 'v');
         // Let the IMGEditor do its magic. It will parse its results straightly into a template variable array.
         $img->main();
         $serendipity['smarty']->assign('imgedit', $img->imgedit_smarty);
         serendipity_smarty_fetch('IMGEDIT', $img->output_template);
     }
     break;
 case 'sync':
     if (!serendipity_checkPermission('adminImagesSync')) {
         echo '<div class="warning"><em>' . PERM_DENIED . '</em></div>';
         break;
     }
     // Make the form to actually do sync with deleting or not
     $n = "\n";
     $warning = preg_replace('#\\\\n#', '<br />', WARNING_THIS_BLAHBLAH);
     echo '<div class="serendipityAdminMsgNote">' . $warning . '</div>';
     echo '  <form method="POST" action="serendipity_admin.php?serendipity[adminModule]=media&amp;serendipity[adminAction]=doSync">' . $n;
     echo '  <p>' . $n . '  <fieldset>' . $n;
     echo '  <legend>' . SYNC_OPTION_LEGEND . '</legend>' . $n;
     echo '    <input type="radio" name="serendipity[deleteThumbs]" value="no" checked="checked" id="keepthumbs" />' . $n;
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:31,代码来源:images.inc.php

示例9: serendipity_smarty_shutdown

/**
 * Shut down the Smarty Framework, output all parsed data
 *
 * This function is meant to be used in embedded installations, like in Gallery.
 * Function can be called from foreign applications. ob_start() needs to
 * have been called before, and will be parsed into Smarty here
 *
 * @access public
 * @param   string  The path to Serendipity
 * @return null
 */
function serendipity_smarty_shutdown($serendipity_directory = '')
{
    global $serendipity;
    #$cwd = getcwd();
    chdir($serendipity_directory);
    $raw_data = ob_get_contents();
    ob_end_clean();
    $serendipity['smarty']->assignByRef('content_message', $raw_data);
    serendipity_smarty_fetch('CONTENT', 'content.tpl');
    $serendipity['smarty']->assign('ENTRIES', '');
    if (empty($serendipity['smarty_file'])) {
        $serendipity['smarty_file'] = '404.tpl';
    }
    $serendipity['smarty']->display(serendipity_getTemplateFile($serendipity['smarty_file'], 'serendipityPath'));
}
开发者ID:REAP720801,项目名称:Serendipity,代码行数:26,代码来源:functions_smarty.inc.php

示例10: generate_content


//.........这里部分代码省略.........
                 $cat_count[$cat['categoryid']] = $cat['postings'];
             }
         }
     }
     $html = '';
     if (!$smarty && $is_form) {
         $html .= '<form action="' . $serendipity['baseURL'] . $serendipity['indexFile'] . '?frontpage" method="post">
           <div id="serendipity_category_form_content">';
     }
     if (!$smarty) {
         $html .= '<ul id="serendipity_categories_list" style="list-style: none; margin: 0px; padding: 0px">';
     }
     $image = $this->get_config('image', serendipity_getTemplateFile('img/xml.gif'));
     $image = $image == "'none'" || $image == 'none' ? '' : $image;
     $use_parent = $this->get_config('parent_base');
     $hide_parent = serendipity_db_bool($this->get_config('hide_parent'));
     $parentdepth = 0;
     $hide_parallel = serendipity_db_bool($this->get_config('hide_parallel'));
     $hidedepth = 0;
     if (is_array($categories) && count($categories)) {
         $categories = serendipity_walkRecursive($categories, 'categoryid', 'parentid', VIEWMODE_THREADED);
         foreach ($categories as $cid => $cat) {
             // Hide parents not wanted
             if ($use_parent && $use_parent != 'all') {
                 if ($parentdepth == 0 && $cat['parentid'] != $use_parent && $cat['categoryid'] != $use_parent) {
                     unset($categories[$cid]);
                     continue;
                 } else {
                     if ($hide_parent && $cat['categoryid'] == $use_parent) {
                         unset($categories[$cid]);
                         continue;
                     }
                     if ($cat['depth'] < $parentdepth) {
                         $parentdepth = 0;
                         unset($categories[$cid]);
                         continue;
                     }
                     if ($parentdepth == 0) {
                         $parentdepth = $cat['depth'];
                     }
                 }
             }
             // Hide parents outside of our tree
             if ($hide_parallel && $serendipity['GET']['category']) {
                 if ($hidedepth == 0 && $cat['parentid'] != $serendipity['GET']['category'] && $cat['categoryid'] != $serendipity['GET']['category']) {
                     unset($categories[$cid]);
                     continue;
                 } else {
                     if ($cat['depth'] < $hidedepth) {
                         $hidedepth = 0;
                         unset($categories[$cid]);
                         continue;
                     }
                     if ($hidedepth == 0) {
                         $hidedepth = $cat['depth'];
                     }
                 }
             }
             $categories[$cid]['feedCategoryURL'] = serendipity_feedCategoryURL($cat, 'serendipityHTTPPath');
             $categories[$cid]['categoryURL'] = serendipity_categoryURL($cat, 'serendipityHTTPPath');
             $categories[$cid]['paddingPx'] = $cat['depth'] * 6;
             $categories[$cid]['catdepth'] = $cat['depth'];
             if (!empty($cat_count[$cat['categoryid']])) {
                 $categories[$cid]['true_category_name'] = $cat['category_name'];
                 $categories[$cid]['category_name'] .= ' (' . $cat_count[$cat['categoryid']] . ')';
                 $categories[$cid]['article_count'] = $cat_count[$cat['categoryid']];
             }
             if (!$smarty) {
                 $html .= '<li class="category_depth' . $cat['depth'] . ' category_' . $cat['categoryid'] . '" style="display: block;">';
                 if ($is_form) {
                     $html .= '<input style="width: 15px" type="checkbox" name="serendipity[multiCat][]" value="' . $cat['categoryid'] . '" />';
                 }
                 if (!empty($image)) {
                     $html .= '<a class="serendipity_xml_icon" href="' . $categories[$cid]['feedCategoryURL'] . '"><img src="' . $image . '" alt="XML" style="border: 0px" /></a> ';
                 }
                 $html .= '<a href="' . $categories[$cid]['categoryURL'] . '" title="' . htmlspecialchars($cat['category_description']) . '" style="padding-left: ' . $categories[$cid]['paddingPx'] . 'px">' . htmlspecialchars($categories[$cid]['category_name']) . '</a>';
                 $html .= '</li>' . "\n";
             }
         }
     }
     if (!$smarty) {
         $html .= '</ul>';
     }
     if (!$smarty && $is_form) {
         $html .= '<div class="category_submit"><br /><input type="submit" name="serendipity[isMultiCat]" value="' . GO . '" /></div>';
     }
     if (!$smarty) {
         $html .= sprintf('<div class="category_link_all"><br /><a href="%s" title="%s">%s</a></div>', $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'] . '?frontpage', ALL_CATEGORIES, ALL_CATEGORIES);
     }
     if (!$smarty && $is_form) {
         $html .= '</div></form>';
     }
     if (!$smarty) {
         echo $html;
     } else {
         $plugin_categories_data = array('is_form' => $is_form, 'category_image' => $image, 'form_url' => $serendipity['baseURL'] . $serendipity['indexFile'] . '?frontpage', 'categories' => is_array($categories) ? $categories : array());
         $serendipity['smarty']->assign($plugin_categories_data);
         echo serendipity_smarty_fetch('CATEGORIES', 'plugin_categories.tpl');
     }
 }
开发者ID:rustyx,项目名称:Serendipity,代码行数:101,代码来源:plugin_internal.inc.php

示例11: serendipity_printArchives

        break;
        // Show the archive
    // Show the archive
    case 'archives':
        $serendipity['head_subtitle'] = ARCHIVES;
        $serendipity['smarty']->assign('head_subtitle', $serendipity['head_subtitle']);
        serendipity_printArchives();
        break;
    case 'custom':
        if ($serendipity['smarty_custom_vars']) {
            $serendipity['smarty']->assign($serendipity['smarty_custom_vars']);
        }
        break;
    case 'empty':
        break;
        // Welcome screen or whatever
    // Welcome screen or whatever
    default:
        if ($serendipity['use_internal_cache']) {
            $entries = serendipity_fetchEntries(null, true, $serendipity['fetchLimit']);
            if (!serendipity_printEntriesCached($entries)) {
                serendipity_printEntries($entries);
            }
        } else {
            serendipity_printEntries(serendipity_fetchEntries(null, true, $serendipity['fetchLimit']));
        }
        break;
}
serendipity_smarty_fetch('CONTENT', 'content.tpl');
$serendipity['smarty']->assign('ENTRIES', '');
/* vim: set sts=4 ts=4 expandtab : */
开发者ID:vonnordmann,项目名称:Serendipity,代码行数:31,代码来源:genpage.inc.php

示例12: ob_start

        if (!empty($serendipity['GET']['adminAction']) && $serendipity['GET']['adminModule'] == 'images' && $serendipity['GET']['adminAction'] != 'default') {
            // Might need to set $serendipity['adminFile_redirect'] here.
            $serendipity['adminFile'] = 'serendipity_admin_image_selector.php';
            ob_start();
            include S9Y_INCLUDE_PATH . 'include/admin/images.inc.php';
            $media['external'] = ob_get_contents();
            $media['case'] = 'external';
            ob_end_clean();
            break;
        }
        $media['case'] = 'default';
        $add_url = '';
        if (!empty($serendipity['GET']['htmltarget'])) {
            $add_url .= '&amp;serendipity[htmltarget]=' . htmlspecialchars($serendipity['GET']['htmltarget']);
        }
        if (!empty($serendipity['GET']['filename_only'])) {
            $add_url .= '&amp;serendipity[filename_only]=' . htmlspecialchars($serendipity['GET']['filename_only']);
        }
        if (!isset($serendipity['thumbPerPage2'])) {
            $serendipity['thumbPerPage2'] = 3;
        }
        ob_start();
        $block = serendipity_displayImageList(isset($serendipity['GET']['page']) ? $serendipity['GET']['page'] : 1, $serendipity['thumbPerPage2'], $serendipity['showMediaToolbar'] ? true : false, '?serendipity[step]=1' . $add_url . '&amp;serendipity[textarea]=' . $serendipity['GET']['textarea'], true, null, false);
        $media['external'] = ob_get_contents();
        ob_end_clean();
        serendipity_smarty_fetch('MEDIA_LIST', $block);
}
$media = array_merge($serendipity['GET'], $media);
$serendipity['smarty']->assign_by_ref('media', $media);
$serendipity['smarty']->display(serendipity_getTemplateFile($showFile, 'serendipityPath'));
/* vim: set sts=4 ts=4 expandtab : */
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:31,代码来源:serendipity_admin_image_selector.php

示例13: generate_content


//.........这里部分代码省略.........
         $querystring = "SELECT id, timestamp\n                              FROM {$serendipity['dbPrefix']}entries e\n                              {$cond['joins']}\n                              {$cond['and']}";
     }
     $rows = serendipity_db_query($querystring);
     switch ($serendipity['calendar']) {
         default:
         case 'gregorian':
             $activeDays = array();
             if (is_array($rows)) {
                 foreach ($rows as $row) {
                     $row['timestamp'] = serendipity_serverOffsetHour($row['timestamp']);
                     $activeDays[date('j', $row['timestamp'])] = $row['timestamp'];
                 }
             }
             $today_day = date('j', $now);
             $today_month = date('m', $now);
             $today_year = date('Y', $now);
             break;
         case 'persian-utf8':
             $activeDays = array();
             if (is_array($rows)) {
                 foreach ($rows as $row) {
                     $row['timestamp'] = serendipity_serverOffsetHour($row['timestamp']);
                     $activeDays[(int) persian_date_utf('j', $row['timestamp'])] = $row['timestamp'];
                 }
             }
             $today_day = persian_date_utf('j', $now);
             $today_month = persian_date_utf('m', $now);
             $today_year = persian_date_utf('Y', $now);
             break;
     }
     // end switch
     $externalevents = array();
     if (serendipity_db_bool($this->get_config('enableExtEvents', 'false'))) {
         serendipity_plugin_api::hook_event('frontend_calendar', $externalevents, array('Month' => $month, 'Year' => $year, 'TS' => $ts, 'EndTS' => $endts));
     }
     // Print the calendar
     $currDay = 1;
     $nrOfRows = ceil(($nrOfDays + $firstDayWeekDay) / 7);
     for ($x = 0; $x < 6; $x++) {
         // Break out if we are out of days
         if ($currDay > $nrOfDays) {
             break;
         }
         // Prepare row
         for ($y = 0; $y < 7; $y++) {
             $cellProps = array();
             $printDay = '';
             $link = '';
             if ($x == 0) {
                 $cellProps['FirstRow'] = 1;
             }
             if ($y == 0) {
                 $cellProps['FirstInRow'] = 1;
             }
             if ($y == 6) {
                 $cellProps['LastInRow'] = 1;
             }
             if ($x == $nrOfRows - 1) {
                 $cellProps['LastRow'] = 1;
             }
             // If it's not a blank day, we print the day
             if (($x > 0 || $y >= $firstDayWeekDay) && $currDay <= $nrOfDays) {
                 $printDay = $currDay;
                 if ($today_day == $currDay && $today_month == $month && $today_year == $year) {
                     $cellProps['Today'] = 1;
                 }
                 if (isset($externalevents[$currDay])) {
                     if (isset($externalevents[$currDay]['Class'])) {
                         $cellProps[$externalevents[$currDay]['Class']] = 1;
                     }
                     if (isset($externalevents[$currDay]['Title'])) {
                         $cellProps['Title'] = serendipity_specialchars($externalevents[$currDay]['Title']);
                     }
                     if (isset($externalevents[$currDay]['Extended'])) {
                         foreach ($externalevents[$currDay]['Extended'] as $ext_key => $ext_val) {
                             $cellProps[$ext_key] = $ext_val;
                         }
                     }
                 }
                 if (isset($activeDays[$currDay]) && $activeDays[$currDay] > 1) {
                     $cellProps['Active'] = 1;
                     $cellProps['Link'] = serendipity_archiveDateUrl(sprintf('%4d/%02d/%02d', $year, $month, $currDay) . $add_query);
                 }
                 $currDay++;
             }
             $smartyRows[$x]['days'][] = array('name' => $printDay, 'properties' => $cellProps, 'classes' => implode(' ', array_keys($cellProps)));
         }
         // end for
     }
     // end for
     $serendipity['smarty']->assignByRef('plugin_calendar_weeks', $smartyRows);
     $dow = array();
     for ($i = 1; $i <= 7; $i++) {
         $dow[] = array('date' => mktime(0, 0, 0, 3, $bow + $i - 1, 2004));
     }
     $serendipity['smarty']->assignByRef('plugin_calendar_dow', $dow);
     $plugin_calendar_data = array('month_date' => $ts, 'uri_previous' => serendipity_archiveDateUrl(sprintf('%04d/%02d', $previousYear, $previousMonth) . $add_query), 'uri_month' => serendipity_archiveDateUrl(sprintf('%04d/%02d', $year, $month) . $add_query), 'uri_next' => serendipity_archiveDateUrl(sprintf('%04d/%02d', $nextYear, $nextMonth) . $add_query), 'minScroll' => $minmax[0]['min'], 'maxScroll' => $minmax[0]['max']);
     $serendipity['smarty']->assignByRef('plugin_calendar_head', $plugin_calendar_data);
     echo serendipity_smarty_fetch('CALENDAR', 'plugin_calendar.tpl');
 }
开发者ID:amirchrist,项目名称:Serendipity,代码行数:101,代码来源:serendipity_plugin_calendar.php

示例14: event_hook

 function event_hook($event, &$bag, &$eventData, $addData = null)
 {
     global $serendipity;
     $hooks =& $bag->get('event_hooks');
     if (isset($hooks[$event])) {
         switch ($event) {
             case 'frontend_fetchentries':
                 if ($serendipity['GET']['action'] == 'search') {
                     serendipity_smarty_fetch('ENTRIES', 'entries.tpl', true);
                 }
                 break;
             case 'entries_footer':
                 if ($serendipity['GET']['action'] == 'search') {
                     $this->showSearch();
                 }
                 break;
             default:
                 return false;
         }
         return true;
     }
     return false;
 }
开发者ID:sqall01,项目名称:additional_plugins,代码行数:23,代码来源:serendipity_event_commentsearch.php


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