function getEmoticons() { global $serendipity; /* Avoid multiple runs of serendipity_getTemplateFile(), in other words - if we already have a list of smilies, don't bother looking for another */ if (isset($this->smilies) && sizeof($this->smilies) != 0) { return $this->smilies; } /* Hijack global variable $serendipity['custom_emoticons'] if it exists */ $hijack_file = serendipity_getTemplateFile('emoticons.inc.php', 'serendipityPath', true); if (@file_exists($hijack_file)) { @(include $hijack_file); // This file contains $serendipity['custom_emoticons'] and maybe $serendipity['custom_emoticons_regexp'] if (isset($serendipity['custom_emoticons']) && is_array($serendipity['custom_emoticons'])) { $this->smilies = $serendipity['custom_emoticons']; if (is_array($this->smilies) && (!isset($serendipity['custom_emoticons_regexp']) || !$serendipity['custom_emoticons_regexp'])) { foreach ($this->smilies as $key => $val) { unset($this->smilies[$key]); $this->smilies[preg_quote($key, '/')] = $val; } } } } if (!isset($this->smilies)) { $ext = $this->get_config('extension', 'png'); $this->smilies = array("\\:'\\(" => serendipity_getTemplateFile('img/emoticons/cry.' . $ext, 'serendipityHTTPPath', true), '\\:\\-?\\)' => serendipity_getTemplateFile('img/emoticons/smile.' . $ext, 'serendipityHTTPPath', true), '\\:\\-?\\|' => serendipity_getTemplateFile('img/emoticons/normal.' . $ext, 'serendipityHTTPPath', true), '\\:\\-?O' => serendipity_getTemplateFile('img/emoticons/eek.' . $ext, 'serendipityHTTPPath', true), '\\:\\-?\\(' => serendipity_getTemplateFile('img/emoticons/sad.' . $ext, 'serendipityHTTPPath', true), '8\\-?\\)' => serendipity_getTemplateFile('img/emoticons/cool.' . $ext, 'serendipityHTTPPath', true), '\\:\\-?D' => serendipity_getTemplateFile('img/emoticons/laugh.' . $ext, 'serendipityHTTPPath', true), '\\:\\-?P' => serendipity_getTemplateFile('img/emoticons/tongue.' . $ext, 'serendipityHTTPPath', true), ';\\-?\\)' => serendipity_getTemplateFile('img/emoticons/wink.' . $ext, 'serendipityHTTPPath', true)); } return $this->smilies; }
function event_hook($event, &$bag, &$eventData) { global $serendipity; $hooks =& $bag->get('event_hooks'); if (isset($hooks[$event])) { switch ($event) { case 'css_backend': case 'css': ?> img { behavior: url("<?php echo $serendipity['baseURL'] . ($serendipity['rewrite'] == 'none' ? $serendipity['indexFile'] . '?/' : ''); ?> plugin/pngbehavior.htc"); } <?php return true; break; case 'external_plugin': switch ($eventData) { case 'pngbehavior.htc': header('Content-Type: text/x-component'); echo str_replace('{blanksrc}', serendipity_getTemplateFile('img/blank.gif'), file_get_contents(dirname(__FILE__) . '/pngbehavior.htc')); return true; } return true; break; default: return false; break; } } else { return false; } }
function generate_content(&$title) { global $serendipity; $title = $this->title; ?> <div class="serendipityPlug"> <?php if (serendipity_db_bool($this->get_config('image', 'true'))) { ?> <a title="<?php echo $title; ?> Serendipity" href="http://www.s9y.org/"><img src="<?php echo serendipity_getTemplateFile('img/s9y_banner_small.png'); ?> " alt="Serendipity PHP Weblog" style="border: 0px" /></a> <?php } if (serendipity_db_bool($this->get_config('text', 'false'))) { ?> <div> <a title="<?php echo $title; ?> Serendipity" href="http://www.s9y.org/">Serendipity PHP Weblog</a> </div> <?php } ?> </div> <?php }
static function fetchTemplate($filename, $oembed, $url) { global $serendipity; if (!is_object($serendipity['smarty'])) { serendipity_smarty_init(); } // Declare the oembed to smarty $serendipity['smarty']->assign('oembedurl', $url); $serendipity['smarty']->assign('oembed', (array) $oembed); $tfile = serendipity_getTemplateFile($filename, 'serendipityPath'); if (!$tfile || $filename == $tfile) { $tfile = dirname(__FILE__) . '/' . $filename; } $inclusion = $serendipity['smarty']->security_settings[@INCLUDE_ANY]; $serendipity['smarty']->security_settings[@INCLUDE_ANY] = true; if (version_compare($serendipity['version'], '1.7-alpha1') >= 0) { $serendipity['smarty']->disableSecurity(); } /* in earlier versions this is not needed. else { $serendipity['smarty']->security = false; } */ // be smarty 3 compat including the serendipity_smarty class wrappers ->fetch and ->display methods and remove changed parameter number 4 $content = @$serendipity['smarty']->fetch('file:' . $tfile); //, false $serendipity['smarty']->security_settings[@INCLUDE_ANY] = $inclusion; return $content; }
static function get_file_from_template($filename, $plugin_rel_url) { $filenamebase = basename($filename); $tfile = serendipity_getTemplateFile($filenamebase, 'serendipityPath'); if (!$tfile || $tfile == $filenamebase) { return $plugin_rel_url . '/' . $filename; } else { return $tfile; } }
function showSearch() { global $serendipity; $this->setupDB(); $term = serendipity_db_escape_string($serendipity['GET']['searchTerm']); if ($serendipity['dbType'] == 'postgres') { $group = ''; $distinct = 'DISTINCT'; $find_part = "(c.title ILIKE '%{$term}%' OR c.body ILIKE '%{$term}%')"; } elseif ($serendipity['dbType'] == 'sqlite') { $group = 'GROUP BY id'; $distinct = ''; $term = serendipity_mb('strtolower', $term); $find_part = "(lower(c.title) LIKE '%{$term}%' OR lower(c.body) LIKE '%{$term}%')"; } else { $group = 'GROUP BY id'; $distinct = ''; $term = str_replace('"', '"', $term); if (preg_match('@["\\+\\-\\*~<>\\(\\)]+@', $term)) { $find_part = "MATCH(c.title,c.body) AGAINST('{$term}' IN BOOLEAN MODE)"; } else { $find_part = "MATCH(c.title,c.body) AGAINST('{$term}')"; } } $querystring = "SELECT c.title AS ctitle, c.body, c.author, c.entry_id, c.timestamp AS ctimestamp, c.url, c.type,\n e.id, e.title, e.timestamp\n FROM {$serendipity['dbPrefix']}comments AS c\n LEFT OUTER JOIN {$serendipity['dbPrefix']}entries AS e\n ON e.id = c.entry_id\n WHERE c.status = 'approved'\n AND {$find_part}\n {$group}\n ORDER BY c.timestamp DESC"; $results = serendipity_db_query($querystring, false, 'assoc'); if (!is_array($results)) { if ($results !== 1 && $results !== true) { echo function_exists('serendipity_specialchars') ? serendipity_specialchars($results) : htmlspecialchars($results, ENT_COMPAT, LANG_CHARSET); } $results = array(); } $myAddData = array("from" => "serendipity_plugin_commentsearch:generate_content"); foreach ($results as $idx => $result) { $results[$idx]['permalink'] = serendipity_archiveURL($result['id'], $result['title'], 'baseURL', true, $result); $results[$idx]['comment'] = $result['body']; //(function_exists('serendipity_specialchars') ? serendipity_specialchars(strip_tags($result['body'])) : htmlspecialchars(strip_tags($result['body']), ENT_COMPAT, LANG_CHARSET)); serendipity_plugin_api::hook_event('frontend_display', $results[$idx], $myAddData); // let the template decide, if we want to have tags or not $results[$idx]['commenthtml'] = $results[$idx]['comment']; $results[$idx]['comment'] = strip_tags($results[$idx]['comment']); } $serendipity['smarty']->assign(array('comment_searchresults' => count($results), 'comment_results' => $results)); $filename = 'plugin_commentsearch_searchresults.tpl'; $tfile = serendipity_getTemplateFile($filename, 'serendipityPath'); if (!$tfile) { $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; echo $content; }
function generate_content(&$title) { global $serendipity; $title = $this->get_config('title', $this->title); $sort = $this->get_config('sort_order'); if ($sort == 'none') { $sort = ''; } else { $sort .= ' ' . $this->get_config('sort_method'); } $is_form = serendipity_db_bool($this->get_config('allow_select')); $is_count = serendipity_db_bool($this->get_config('showartcount')); $mincount = (int) $this->get_config('mincount'); $authors = serendipity_fetchUsers(null, 'hidden', $is_count); $html = ''; if ($is_form) { $html .= '<form action="' . $serendipity['baseURL'] . $serendipity['indexFile'] . '?frontpage" method="post">'; } $image = $this->get_config('image', serendipity_getTemplateFile('img/xml.gif')); $image = $image == "'none'" || $image == 'none' ? '' : $image; $html .= '<ul class="plainList">' . "\n"; if (is_array($authors) && count($authors)) { foreach ($authors as $auth) { if ($is_count) { if ($auth['artcount'] < $mincount) { continue; } $entrycount = " ({$auth['artcount']})"; } else { $entrycount = ""; } $html .= '<li>'; if ($is_form) { $html .= '<input style="width: 15px" type="checkbox" name="serendipity[multiAuth][]" value="' . $auth['authorid'] . '" />'; } if (!empty($image)) { $html .= '<a class="serendipity_xml_icon" href="' . serendipity_feedAuthorURL($auth, 'serendipityHTTPPath') . '"><img src="' . $image . '" alt="XML" style="border: 0px" /></a> '; } $html .= '<a href="' . serendipity_authorURL($auth, 'serendipityHTTPPath') . '" title="' . serendipity_specialchars($auth['realname']) . '">' . serendipity_specialchars($auth['realname']) . $entrycount . '</a>'; $html .= '</li>' . "\n"; } } $html .= '</ul>' . "\n"; if ($is_form) { $html .= '<div><input type="submit" name="serendipity[isMultiAuth]" value="' . GO . '" /></div>'; } $html .= sprintf('<div><a href="%s" title="%s">%s</a></div>', $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'], ALL_AUTHORS, ALL_AUTHORS); if ($is_form) { $html .= '</form>'; } print $html; }
/** * @test */ public function test_serendipity_getTemplateFile() { global $serendipity; $serendipity['template'] = 'next'; $serendipity['template_engine'] = '2k11'; $serendipity['defaultTemplate'] = '2k11'; $serendipity['templatePath'] = '/templates/'; $serendipity['template_backend'] = '2k11'; $serendipity['serendipityPath'] = realpath('../'); $serendipity['serendipityHTTPPath'] = realpath('/'); $this->assertContains('next/index.tpl', serendipity_getTemplateFile('index.tpl')); define('IN_serendipity_admin', true); $this->assertContains('2k11/admin/index.tpl', serendipity_getTemplateFile('admin/index.tpl')); $this->assertContains('next/index.tpl', serendipity_getTemplateFile('index.tpl', 'serendipityHTTPPath', true)); }
function generate_content(&$title) { global $serendipity; $title = $this->get_config('title', $this->title); $sort = $this->get_config('sort_order'); if ($sort == 'none') { $sort = ''; } else { $sort .= ' ' . $this->get_config('sort_method'); } $is_count = serendipity_db_bool($this->get_config('showartcount', 'false')); $mincount = (int) $this->get_config('mincount'); $authors = serendipity_fetchUsers(null, 'hidden', $is_count); $html = ''; $image = $this->get_config('image', serendipity_getTemplateFile('img/xml.gif')); $image = $image == "'none'" || $image == 'none' ? '' : $image; $html .= '<ul class="plainList">' . "\n"; if (is_array($authors) && count($authors)) { foreach ($authors as $auth) { if ($is_count) { if ($auth['artcount'] < $mincount) { continue; } $entrycount = " ({$auth['artcount']})"; } else { $entrycount = ""; } $html .= '<li>'; if (!empty($image)) { $html .= ' <a class="serendipity_xml_icon" href="' . serendipity_feedAuthorURL($auth, 'serendipityHTTPPath') . '"><img src="' . $image . '" alt="XML" style="border: 0px" /></a> '; } $html .= ' <a href="' . serendipity_authorURL($auth, 'serendipityHTTPPath') . '" title="' . serendipity_specialchars($auth['realname']) . '">' . serendipity_specialchars($auth['realname']) . $entrycount . '</a>'; $html .= '</li>' . "\n"; } } $html .= '</ul>' . "\n"; $html .= sprintf('<div><a href="%s" title="%s">%s</a></div>' . "\n", $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'], ALL_AUTHORS, ALL_AUTHORS); print $html; }
case 'frontend_footer': echo '<!--PLUGIN API-->'; } return true; } if ($serendipity['GET']['adminModule'] == 'templates' || $serendipity['POST']['adminModule'] == 'templates' || $serendipity['GET']['adminAction'] == 'cattemplate') { $css_files = glob(dirname(__FILE__) . '/*_style.css'); foreach ($css_files as $css_file) { $css_file = str_replace('_style.css', '', basename($css_file)); if (!isset($colorsets[$css_file])) { $colorsets[$css_file] = $css_file; } } } $template_config_groups = array(THEME_COLORSET => array('colorset', 'layouttype', 'jscolumns'), THEME_HEADER => array('custheader', 'headerimage', 'headertype')); $template_config = array(array('var' => 'infobp', 'name' => 'infobp', 'type' => 'custom', 'custom' => USER_STYLESHEET), array('var' => 'colorset', 'name' => THEME_COLORSET, 'type' => 'select', 'default' => 'default', 'select_values' => $colorsets), array('var' => 'layouttype', 'name' => LAYOUT_TYPE, 'type' => 'select', 'default' => '3sbs', 'select_values' => array('3sbs' => LAYOUT_SBS, '3bss' => LAYOUT_BSS, '3ssb' => LAYOUT_SSB, '2sb' => LAYOUT_SB, '2bs' => LAYOUT_BS, '1col' => LAYOUT_SC, '2sbf' => LAYOUT_SBF, '2bsf' => LAYOUT_BSF)), array('var' => 'jscolumns', 'name' => JAVASCRIPT_COLUMNS, 'type' => 'boolean', 'default' => 'false'), array('var' => 'custheader', 'name' => BP_CUSTOM_HEADER, 'type' => 'boolean', 'default' => 'false'), array('var' => 'headerimage', 'name' => BP_HEADER_IMAGE, 'type' => 'media', 'default' => serendipity_getTemplateFile('header.png')), array('var' => 'headertype', 'name' => BP_HEADER_TYPE, 'type' => 'select', 'default' => 'banner', 'select_values' => array('banner' => BP_HEADER_BANNER, 'htiled' => BP_HEADER_HTILED, 'vtiled' => BP_HEADER_VTILED, 'btiled' => BP_HEADER_BTILED)), array('var' => 'headerposhor', 'name' => BP_HEADER_POSHOR, 'type' => 'select', 'default' => 'left', 'select_values' => array('left' => LEFT, 'center' => BP_CENTER, 'right' => RIGHT)), array('var' => 'headerposver', 'name' => BP_HEADER_POSVER, 'type' => 'select', 'default' => 'top', 'select_values' => array('top' => BP_TOP, 'center' => BP_CENTER, 'bottom' => BP_BOTTOM)), array('var' => 'firbtitle', 'name' => FIR_BTITLE, 'type' => 'boolean', 'default' => 'true'), array('var' => 'firbdescr', 'name' => FIR_BDESCR, 'type' => 'boolean', 'default' => 'true'), array('var' => 'date_format', 'name' => GENERAL_PLUGIN_DATEFORMAT . " (http://php.net/strftime)", 'type' => 'select', 'default' => DATE_FORMAT_ENTRY, 'select_values' => array(DATE_FORMAT_ENTRY => DATE_FORMAT_ENTRY, '%a, %e. %B %Y' => '%a, %e. %B %Y', '%d-%m-%y' => '%d-%m-%y', '%m-%d-%y' => '%m-%d-%y', '%a %d-%m-%y' => '%a %d-%m-%y', '%a %m-%d-%y' => '%a %m-%d-%y', '%b %d' => '%b %d', "%b %d '%y" => "%b %d '%y")), array('var' => 'entryfooterpos', 'name' => ENTRY_FOOTER_POS, 'type' => 'select', 'default' => 'belowentry', 'select_values' => array('belowentry' => BELOW_ENTRY, 'belowtitle' => BELOW_TITLE, 'splitfoot' => SPLIT_FOOTER)), array('var' => 'footerauthor', 'name' => FOOTER_AUTHOR, 'type' => 'boolean', 'default' => 'true'), array('var' => 'footercategories', 'name' => FOOTER_CATEGORIES, 'type' => 'boolean', 'default' => 'true'), array('var' => 'footertimestamp', 'name' => FOOTER_TIMESTAMP, 'type' => 'boolean', 'default' => 'true'), array('var' => 'footercomments', 'name' => FOOTER_COMMENTS, 'type' => 'boolean', 'default' => 'true'), array('var' => 'footertrackbacks', 'name' => FOOTER_TRACKBACKS, 'type' => 'boolean', 'default' => 'true'), array('var' => 'altcommtrack', 'name' => ALT_COMMTRACK, 'type' => 'boolean', 'default' => 'false'), array('var' => 'addthiswidget', 'name' => SHOW_ADDTHIS_WIDGET, 'type' => 'boolean', 'default' => 'false'), array('var' => 'addthisaccount', 'name' => ADDTHIS_ACCOUNT, 'type' => 'string', 'default' => ''), array('var' => 'show_sticky_entry_footer', 'name' => SHOW_STICKY_ENTRY_FOOTER, 'type' => 'boolean', 'default' => 'true'), array('var' => 'show_sticky_entry_heading', 'name' => SHOW_STICKY_ENTRY_HEADING, 'type' => 'boolean', 'default' => 'true'), array('var' => 'cocommentactive', 'name' => COCOMMENT_ACTIVE, 'type' => 'boolean', 'default' => 'false'), array('var' => 'prev_next_style', 'name' => PREV_NEXT_STYLE, 'type' => 'select', 'default' => 'text', 'select_values' => array('text' => PREV_NEXT_TEXT, 'texticon' => PREV_NEXT_TEXT_ICON, 'icon' => PREV_NEXT_ICON, 'none' => NONE)), array('var' => 'show_pagination', 'name' => SHOW_PAGINATION, 'type' => 'boolean', 'default' => 'false'), array('var' => 'counter_code', 'name' => COUNTER_CODE, 'type' => 'text', 'default' => ''), array('var' => 'counter_code_toggle', 'name' => USE_COUNTER, 'type' => 'boolean', 'default' => 'false'), array('var' => 'footer_text', 'name' => FOOTER_TEXT, 'type' => 'text', 'default' => ''), array('var' => 'footer_text_toggle', 'name' => USE_FOOTER_TEXT, 'type' => 'boolean', 'default' => 'false'), array('var' => 'sitenavpos', 'name' => SITENAV_POSITION, 'type' => 'select', 'default' => 'none', 'select_values' => array('none' => SITENAV_NONE, 'above' => SITENAV_ABOVE, 'below' => SITENAV_BELOW, 'left' => SITENAV_LEFT, 'right' => SITENAV_RIGHT)), array('var' => 'sitenav_footer', 'name' => SITENAV_FOOTER, 'type' => 'boolean', 'default' => 'true'), array('var' => 'sitenav_quicksearch', 'name' => SITENAV_QUICKSEARCH, 'type' => 'boolean', 'default' => 'true'), array('var' => 'sitenav_sidebar_title', 'name' => SITENAV_TITLE, 'type' => 'string', 'default' => SITENAV_TITLE_TEXT)); $template_global_config = array('navigation' => true); $template_loaded_config = serendipity_loadThemeOptions($template_config, $serendipity['smarty_vars']['template_option']); serendipity_loadGlobalThemeOptions($template_config, $template_loaded_config, $template_global_config); if ($template_loaded_config['headerimage'] != '' && is_dir($_SERVER['DOCUMENT_ROOT'] . '/' . $template_loaded_config['headerimage'])) { $files = array(); if ($d = opendir($_SERVER['DOCUMENT_ROOT'] . '/' . $template_loaded_config['headerimage'])) { while (($file = readdir($d)) !== false) { if (preg_match('@(\\.jpe?g|\\.png|\\.gif)$@i', $file) && !preg_match('@' . preg_quote($serendipity['thumbSuffix']) . '@i', $file)) { $files[] = $file; } } } if (count($files) > 0) { shuffle($files); $serendipity['smarty']->assign('random_headerimage', $template_loaded_config['headerimage'] . '/' . $files[0]);
<?php serendipity_plugin_api::hook_event('backend_plugins_sidebar_header', $serendipity); ?> <?php show_plugins(false, $sidebars); ?> <br /> <br /> <h3><?php echo EVENT_PLUGINS; ?> </h3> <a href="?serendipity[adminModule]=plugins&serendipity[adminAction]=addnew&serendipity[type]=event" class="serendipityIconLink"><img src="<?php echo serendipity_getTemplateFile('admin/img/install.png'); ?> " style="border: 0px none ; vertical-align: middle; display: inline;" alt="" /><?php echo sprintf(CLICK_HERE_TO_INSTALL_PLUGIN, EVENT_PLUGIN); ?> </a> <?php serendipity_plugin_api::hook_event('backend_plugins_event_header', $serendipity); ?> <?php show_plugins(true); ?> <?php if (count($serendipity['memSnaps']) > 0) { ?>
} if ($ajax) { // if that is an ajax request we can stop here, since we by convention don't want to wrap the content in the usual backend code echo $main_content; } elseif (!$use_installer) { $poll_admin_vars = array('main_content', 'no_banner', 'no_sidebar', 'no_footer', 'post_action', 'is_logged_in', 'admin_installed', 'self_info', 'use_installer', 'title'); $admin_vars = array(); foreach ($poll_admin_vars as $poll_admin_var) { $admin_vars[$poll_admin_var] =& ${$poll_admin_var}; } $admin_vars['out'] = array(); $admin_vars['no_create'] = $serendipity['no_create']; $admin_vars['title'] = $admin_section; if ($serendipity['expose_s9y']) { $admin_vars['version_info'] = sprintf(ADMIN_FOOTER_POWERED_BY, $serendipity['versionInstalled'], phpversion()); } else { $admin_vars['version_info'] = sprintf(ADMIN_FOOTER_POWERED_BY, '', ''); } if (!is_object($serendipity['smarty'])) { serendipity_smarty_init(); } $serendipity['smarty']->assignByRef('admin_vars', $admin_vars); $serendipity['smarty']->display(serendipity_getTemplateFile('admin/index.tpl', 'serendipityPath')); } else { if (IS_installed === false) { $file = 'include/admin/installer.inc.php'; } elseif (IS_up2date === false) { $file = 'include/admin/upgrader.inc.php'; } require S9Y_INCLUDE_PATH . $file; }
serendipity_set_config_var($item['var'], $_POST[$item['var']], $serendipity['authorid']); } } $pl_data = array('id' => $serendipity['POST']['authorid'], 'authorid' => $serendipity['POST']['authorid'], 'username' => $_POST['username'], 'realname' => $_POST['realname'], 'email' => $_POST['email']); serendipity_updatePermalink($pl_data, 'author'); serendipity_plugin_api::hook_event('backend_users_edit', $pl_data); } if ($serendipity['authorid'] === $_SESSION['serendipityAuthorid']) { if (is_null($serendipity['detected_lang'])) { $_SESSION['serendipityLanguage'] = $serendipity['lang']; } } $from = $_POST; ?> <div class="serendipityAdminMsgSuccess"><img width="22px" height="22px" style="border: 0px; padding-right: 4px; vertical-align: middle" src="<?php echo serendipity_getTemplateFile('admin/img/admin_msg_success.png'); ?> " alt="" /><?php echo sprintf(MODIFIED_USER, htmlspecialchars($_POST['realname'])); ?> </div> <?php } } ?> <form action="?serendipity[adminModule]=personal&serendipity[adminAction]=save" method="post"> <?php echo serendipity_setFormToken(); $template = serendipity_parseTemplate(S9Y_CONFIG_USERTEMPLATE); $user = serendipity_fetchUsers($serendipity['authorid']);
function event_hook($event, &$bag, &$eventData, $addlData) { global $serendipity; $hooks =& $bag->get('event_hooks'); if (isset($hooks[$event])) { switch ($event) { case 'backend_header': // Output the JavaScript, if we must $getModule = $serendipity['GET']['adminModule']; $postModule = $serendipity['POST']['adminModule']; if ($getModule == 'templates' || $postModule == 'templates' || $getModule == 'plugins' || $postModule == 'plugins') { // Includes copied from include/admin/plugins.inc.php echo '<script src="' . serendipity_getTemplateFile('dragdrop.js') . '" type="text/javascript"></script>'; //echo '<div class="warning js_warning"><em>' . PREFERENCE_USE_JS_WARNING . '</em></div>'; $media_js = serendipity_getTemplateFile('media_input.js'); if ($serendipity['version'][0] < 2) { print <<<EOS <script type="text/javascript" language="JavaScript" src="serendipity_editor.js"></script> EOS; } print <<<EOS <script type="text/javascript"> function change_preview(id) { var text_box = document.getElementById("serendipity[template][" + id + "]"); var image_box = document.getElementById(id + "_preview"); var filename = text_box.value; image_box.style.backgroundImage = "url(" + filename + ")"; } function choose_media(id) { window.open('serendipity_admin_image_selector.php?serendipity[htmltarget]=' + id + '&serendipity[filename_only]=true', 'ImageSel', 'width=800,height=600,toolbar=no,scrollbars=1,scrollbars,resize=1,resizable=1'); } </script> EOS; } break; case 'backend_pluginconfig_media': // Print the HTML to display the popup media selector $postKey = $eventData['postKey']; $var = $eventData['config_item']; $savedValue = $eventData['value']; $cbag = $eventData['cbag']; $cname = $cbag->get('name'); $cdesc = $cbag->get('description'); $preview_width = $cbag->get('preview_width'); if (!$preview_width || $preview_width == "") { $preview_width = '400px'; } $preview_height = $cbag->get('preview_height'); if (!$preview_height || $preview_height == "") { $preview_height = '100px'; } $media_link_text = MEDIA_LIBRARY; print <<<EOS <tr><td colspan="2"> <strong>{$cname}</strong> <br /><span style="color: #5E7A94; font-size: 8pt;">{$cdesc}</span> </td> </tr> <tr> <td style="border-bottom: 1px solid #000000"> <!-- <img id="{$var}_preview" src="{$savedValue}"> --> <div id="{$var}_preview" style="background-image: url({$savedValue}); width:{$preview_width}; height: {$preview_height};"> </div> </td> <td style="border-bottom: 1px solid #000000"> <input class="input_textbox" type="text" id="serendipity[{$postKey}][{$var}]" name="serendipity[{$postKey}][{$var}]" value="{$savedValue}" onchange="change_preview('{$var}')"/> <br /><a href="#" onclick="choose_media('serendipity[{$postKey}][{$var}]')">{$media_link_text}</a> </td> </tr> EOS; return true; break; case 'backend_pluginconfig_sequence': // // Print the HTML to display the [drag-n-drop] orderable list // // For the drag-n-drop to work, the list must be included in // a container (probably an <ol>) that JavaScript can access // (easiest by ID), with <li> children that have unique IDs, // and handles with ids of 'g'.$li_id. // I can't get it to work unless there's a class of // pluginmanager_container on the ol, either. // The drag-n-drop returns the list of IDs in order. // // I want this generic sequence widget to hide the ID, but // display a name or description with an optional picture. // (This would allow users to identify choices by thumbnail.) // Therefore, I need an array with keys 'id', 'display', and // 'imgurl' (or similar) to generate each list item. // Data sent by include/functions_plugins_admin.inc.php // It also passes bag and plugin, but we don't need those $postKey = $eventData['postKey']; $var = $eventData['config_item']; $savedValue = $eventData['value']; $cbag = $eventData['cbag']; // Get the data we need to display the list if (!$savedValue) { $savedValue = $eventData['default']; } $cname = $cbag->get('name'); $cdesc = $cbag->get('description'); /** Unordered array of values */ $items = $cbag->get('values'); if (!is_array($items)) { $items = null; } /** Array specifying order to use values in $items */ $order = null; if ($savedValue) { $order = explode(',', $savedValue); } $uparrow_img = serendipity_getTemplateFile('admin/img/uparrow.png'); $downarrow_img = serendipity_getTemplateFile('admin/img/downarrow.png'); // $items is the list of things to sequence. It's not in // order, and reordering PHP arrays is problematic. So // we keep it unordered, and access its values according // to another array (appropriately named $order). if (is_array($items)) { // Allow simple value for any sequence item foreach ($items as $key => $item) { if (!is_array($item)) { // Replace this item with an empty array unset($items[$key]); $items[$item] = array(); } } // Make sure all the items are in the order list; new items // go on the end (new items could have been added in // introspect_config_items, but not been configured). // Also fill out thumbnails and display names foreach ($items as $id => $junk) { if ($order == null) { $order = array($id); } else { if (!in_array($id, $order)) { $order[] = $id; } } // If there's no defined display name, default to the ID if (!isset($items[$id]['display'])) { $items[$id]['display'] = $id; } // If there's no image, we just won't display anything. } // Make sure all the items to be ordered exist! Otherwise // we could try to sequence nothing. $filtered = array(); foreach ($order as $id) { if (array_key_exists($id, $items)) { $filtered[] = $id; } } $order = $filtered; } else { // If there's nothing to sequence, make the order to use // them in valid, but empty $order = array(); } // Start the row, add one cell for the name and description print <<<EOS <tr> <td style="border-bottom: 1px solid #000000; vertical-align: top"> <strong>{$cname}</strong> <br /><span style="color: #5E7A94; font-size: 8pt;">{$cdesc}</span> </td> EOS; // Now add one cell for the list print <<<EOS <td style="border-bottom: 1px solid #000000; vertical-align: middle"> EOS; // Print the list print <<<EOS <input type="hidden" name="serendipity[{$postKey}][{$var}]" id="{$var}_value" value="{$savedValue}" /> <noscript> <!-- Replace standard submit button when using up/down submits --> <input type="hidden" name="SAVECONF" value="Save" /> </noscript> <ol id="{$var}" class="sequence_container pluginmanager_container"> EOS; $sort_idx == 0; $last = count($order) - 1; foreach ($order as $id) { // Create the variables required to print this item if ($sort_idx > 0) { $swapping = $order; $temp = $swapping[(int) $sort_idx]; $swapping[(int) $sort_idx] = $swapping[(int) ($sort_idx - 1)]; $swapping[(int) ($sort_idx - 1)] = $temp; $oneup = implode(',', $swapping); } if ($sort_idx < $last) { $swapping = $order; $temp = $swapping[(int) $sort_idx]; $swapping[(int) $sort_idx] = $swapping[(int) ($sort_idx + 1)]; $swapping[(int) ($sort_idx + 1)] = $temp; $onedown = implode(',', $swapping); } // Print the HTML // // Set the item and its ID print ' <li id="' . $id . '" class="sequence_item pluginmanager_item_even">' . "\n"; // Make a handle with ID 'g$id' print ' <div id="g' . $id . '" class="pluginmanager_grablet sequence_grablet"><a href="#"></a></div>' . "\n"; // Add the item contents print ' <span>' . $items[$id]['display'] . '</span>' . "\n"; if (isset($items[$id]['img'])) { print ' <img src="' . $items[$id]['img'] . '" />' . "\n"; } // Luddite submit buttons (please, think of the scriptless!) print "<noscript><div>\n"; if ($sort_idx == 0) { // Skip the move-up submit button print " \n"; } else { print <<<EOS <button type="submit" name="serendipity[{$postKey}][{$var}]" value="{$oneup}"> <img src="{$uparrow_img}" alt="Move Up"> </button> EOS; } if ($sort_idx == $last) { // Skip the move-down submit button print " \n"; } else { print <<<EOS <button type="submit" name="serendipity[{$postKey}][{$var}]" value="{$onedown}"> <img src="{$downarrow_img}" alt="Move Down"> </button> EOS; } print "</div></noscript>\n"; // Close the item print ' </li>' . "\n"; // Next, please $sort_idx++; } if (!is_array($items) or empty($order)) { // Print the empty message print PLUGIN_ADVTYPES_NOTHING_TO_SEQUENCE; } // Print the Javascript to drag-n-drop the list print <<<EOS <script type="text/javascript"> function init_{$var}_Sequence() { var lst = document.getElementById("{$var}"); DragDrop.makeListContainer(lst, '{$var}_group'); lst.onDragOut = function() { //var seq = DragDrop.serData('{$var}_group', null); var seq = DragDrop.serData(null, '{$var}'); var start = seq.indexOf("("); var end = seq.indexOf(")"); seq = seq.slice((start + 1), end); var order = document.getElementById("{$var}_value"); order.value = seq; }; } addLoadEvent(init_{$var}_Sequence); </script> EOS; // Finish the row print <<<EOS </td> EOS; return true; break; } } return true; }
$permalinkOld = array($oldConfig['serendipityHTTPPath'], $oldConfig['serendipityPath'], $oldConfig['baseURL'], $oldConfig['indexFile'], $oldConfig['rewrite']); $permalinkNew = array($serendipity['serendipityHTTPPath'], $serendipity['serendipityPath'], $serendipity['baseURL'], $serendipity['indexFile'], $serendipity['rewrite']); // Compare all old permalink section values against new one. A change in any of those // will force to update the .htaccess for rewrite rules. $permconf = serendipity_parseTemplate(S9Y_CONFIG_TEMPLATE); if (is_array($permconf) && is_array($permconf['permalinks']['items'])) { foreach ($permconf['permalinks']['items'] as $permitem) { $permalinkOld[] = $oldConfig[$permitem['var']]; $permalinkNew[] = $serendipity[$permitem['var']]; } } if (serendipity_checkPermission('siteConfiguration') && serialize($permalinkOld) != serialize($permalinkNew)) { printf(ATTEMPT_WRITE_FILE, $serendipity['serendipityPath'] . '.htaccess'); $res = serendipity_installFiles($serendipity['serendipityPath']); if (is_array($res)) { echo implode('<br />', $res); } else { echo DONE . '<br />'; } serendipity_buildPermalinks(); } echo '<br /><div class="serendipityAdminMsgSuccess"><img style="height: 22px; width: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_success.png') . '" alt="" />' . WRITTEN_N_SAVED . '</div>'; } break; default: $from =& $serendipity; $t = serendipity_parseTemplate(S9Y_CONFIG_TEMPLATE); serendipity_printConfigTemplate($t, $from, false, true); break; } /* vim: set sts=4 ts=4 expandtab : */
/** * generate content for empty overview panel * * Show a message instead of static page list if no static pages exist. * * @return null */ function showEmptyList() { ?> <table class="serendipity_admin_list" cellpadding="5" width="100%"> <tr> <td align="center" class="serendipityAdminMsgNote"> <img style="width: 22px; height: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="<?php echo serendipity_getTemplateFile('admin/img/admin_msg_note.png'); ?> " alt="" /> <?php echo NO_ENTRIES_TO_PRINT; ?> </td> </tr> </table> <?php }
function generate_content_custom(&$title) { global $serendipity; $update = true; $rotate_time = $this->get_config('media_rotate_time'); $next_update = $this->get_config('media_next_update', ''); if (@(include_once "Cache/Lite.php")) { $cache_obj = new Cache_Lite(array('cacheDir' => $serendipity['serendipityPath'] . 'templates_c/', 'automaticSerialization' => true)); $cache_output = $cache_obj->get('mediasidebar_cache'); } else { $cache_output = $this->get_config('media_cache_output', ''); } if ($rotate_time != 0) { if ($next_update > time()) { $update = false; } else { $next_update = $this->calc_update_time($rotate_time, $next_update); $this->set_config('media_next_update', $next_update); } } $title = $this->get_config('title', $this->title); if ($update || $cache_output == '') { $output_str = ''; if ($this->get_config('media_image_strict') == 'yes') { $strict = true; } else { $strict = false; } if ($this->get_config('media_hotlinks_only', 'no') == 'yes') { $dir_extension = $this->get_config('media_hotlink_base', ''); if ($dir_extension != '') { $dir_extension = $dir_extension . '%'; } $directory = "http://%" . $dir_extension; $strict = false; } else { $directory = $this->get_config('media_base_directory'); } if (version_compare((double) $serendipity['version'], '1.1', '>=')) { if ($directory == 'gallery') { $directory = ''; } $images_all = serendipity_fetchImagesFromDatabase(0, 0, $total, false, false, $directory, '', '', array(), $strict); } else { $images_all = $this->mediasidebar_getimage($directory, $strict); } $number = $this->get_config('media_number_images'); $total_count = count($images_all); if ($total_count < $number) { $number = $total_count; } $images = array(); $random_check = array(); for ($counter = 0; $counter < $number; $counter += 1) { $checkit = rand(0, $total_count - 1); while (in_array($checkit, $random_check)) { $checkit = rand(0, $total_count); } $random_check[] = $checkit; $images[] = $images_all[$checkit]; } $width_test = $this->get_config('media_fixed_width'); if ($width_test > 0) { $width_str = 'width:' . $width_test . 'px;'; } if (is_array($images)) { $output_str .= $this->get_config('media_intro'); foreach ($images as $image) { if (isset($image['name'])) { if ($image['hotlink'] == 1) { $thumb_path = $image_path = $image['path']; } else { $image_path = $serendipity['serendipityHTTPPath'] . $serendipity['uploadPath'] . $image['path'] . $image['name'] . '.' . $image['extension']; $thumb_path = $serendipity['serendipityHTTPPath'] . $serendipity['uploadPath'] . $image['path'] . $image['name'] . '.' . $image['thumbnail_name'] . '.' . $image['extension']; if (!serendipity_isImage($image)) { $thumb_path = serendipity_getTemplateFile('admin/img/mime_unknown.png'); $width_str = ''; } } $output_str .= '<div style="padding-top: 5px;">'; switch ($this->get_config("media_linkbehavior")) { case 'entry': $e = $this->fetchLinkedEntries($image['id'], $image_path, $thumb_path, true); if (is_array($e)) { $link = serendipity_archiveURL($e[0]['id'], $e[0]['title'], 'serendipityHTTPPath', true, array('timestamp' => $e[0]['timestamp'])); } else { $link = $image_path; } $output_str .= '<a href="' . $link . '" title="' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($e[0]['title']) : htmlspecialchars($e[0]['title'], ENT_COMPAT, LANG_CHARSET)) . '"><img style="border: 0px; ' . $width_str . '" src="' . $thumb_path . '" alt="" /></a>'; break; case 'popup': $output_str .= '<a href="' . $image_path . '" onclick="F1 = window.open(\'' . $image_path . '\',\'Zoom\',\'height=' . $image['dimensions_height'] . ',width=' . $image['dimensions_width'] . ',top=298,left=354,toolbar=no,menubar=no,location=no,resize=1,resizable=1,scrollbars=yes\'); return false;"><img style="border: 0px; ' . $width_str . '" src="' . $thumb_path . '" alt="" /></a>'; break; case 'url': $output_str .= '<a href="' . $this->get_config('media_url') . '"><img style="border: 0px; ' . $width_str . '" src="' . $thumb_path . '" alt="" /></a>'; break; case 'gallery': $gallery_str = $this->get_config('media_gal_permalink'); if (strstr($gallery_str, '?')) { $gallery_str = $gallery_str . '&serendipity[image]=' . $image['id']; } else { $gallery_str = $gallery_str . '?serendipity[image]=' . $image['id']; } $output_str .= '<a href="' . $gallery_str . '"><img style="border: 0px; ' . $width_str . '" src="' . $thumb_path . '" alt="" /></a>'; break; case 'inpage': default: $output_str .= '<a ' . $this->get_config('media_lightbox', '') . ' href="' . $image_path . '"><img style="border: 0px; ' . $width_str . '" src="' . $thumb_path . '" alt="" /></a>'; break; } $output_str .= '</div>'; } } $output_str .= $this->get_config('media_summery'); } else { $output_str = 'Error accessing images.'; } if (class_exists('Cache_Lite') && is_object($cache_obj)) { $cache_obj->save($output_str, 'mediasidebar_cache'); } else { $this->set_config('media_cache_output', $output_str); } } else { $output_str = $cache_output; } echo $output_str; }
function serendipity_emit_htmlarea_code($item, $jsname, $spawnMulti = false) { static $init = false; global $serendipity; if ($init && $spawnMulti) { return true; } if (isset($serendipity['wysiwyg']) && $serendipity['wysiwyg']) { $eventData = array('init' => &$init, 'item' => &$item, 'jsname' => &$jsname, 'skip' => false); serendipity_plugin_api::hook_event('backend_wysiwyg', $eventData); if ($eventData['skip']) { return true; } if (file_exists($serendipity['serendipityPath'] . 'htmlarea/XinhaCore.js')) { $xinha = true; } else { $xinha = false; } $xinha_custom = serendipity_getTemplateFile('my_custom.js', 'serendipityHTTPPath'); if (empty($xinha_custom)) { $xinha_custom = 'htmlarea/my_custom.js'; } if (!$init) { ?> <script type="text/javascript"> _editor_url = "<?php echo $serendipity['serendipityHTTPPath'] . 'htmlarea/'; ?> "; _editor_lang = "<?php echo $xinha ? $serendipity['lang'] : WYSIWYG_LANG; ?> "; _editor_skin = "silva"; var editorref = ''; </script> <?php if ($xinha) { ?> <script type="text/javascript" src="htmlarea/XinhaCore.js"></script> <!-- This file can contain user customizations --> <script type="text/javascript" src="<?php echo $xinha_custom; ?> "></script> <?php } else { ?> <script type="text/javascript" src="htmlarea/htmlarea.js"></script> <?php } } $csscode = str_replace(array("\n", "'", "\r", "{LANG_DIRECTION}"), array('\\n', "\\'", "", defined('LANG_DIRECTION') ? LANG_DIRECTION : 'ltr'), file_get_contents(serendipity_getTemplateFile('style_fallback.css', 'serendipityPath')) . file_get_contents(serendipity_getTemplateFile('htmlarea.css', 'serendipityPath'))); ?> <script type="text/javascript"> // IF you want to enable HTMLArea's spellchecker, download the SpellChecker plugin from the HTMLArea homepage // (http://www.sourceforge.net/projects/itools-htmlarea) and uncomment the lines suffixed with ' // [SPELLCHECK]' // Note that the SpellChecker is a CGI-based application which needs setup in your Apache host ("Options +CGIExec") // Thanks to Randall for pointing this out! // HTMLArea.loadPlugin("SpellChecker"); // [SPELLCHECK] <?php if ($spawnMulti) { ?> // when spawning multiple editors at once, keep track of instances in this array var htmlarea_editors = new Array(); <?php } else { ?> var editor<?php echo $jsname; ?> = null; var config<?php echo $jsname; ?> = null; <?php } // end if ?> <?php if (is_array($eventData['buttons'])) { ?> var btn_callbacks = new Array(); // Serendipity standardized editor functions function serendipity_editor_getSelected(editor_id) { var editor = findXinha(editor_id); if (editor == 'undefined') { editor = findHtmlArea(editor_id); } var html = editor.getSelectedHTML(); return html; } function serendipity_editor_replaceSelected(editor_id, str) { var editor = findXinha(editor_id); if (editor == 'undefined') { editor = findHtmlArea(editor_id); } editor.insertHTML(str); } function serendipity_editor_getAll(editor_id) { var editor = findXinha(editor_id); if (editor == 'undefined') { editor = findHtmlArea(editor_id); } return editor.getEditorContent(); } function serendipity_editor_replaceAll(editor_id, str) { var editor = findXinha(editor_id); if (editor == 'undefined') { editor = findHtmlArea(editor_id); } editor.setEditorContent(str); } // Serendipity standardized editor convenience function function findXinha(editor_id) { if (typeof(xinha_editors) != 'undefined') { for (var editorName in xinha_editors) { if (editor_id == xinha_editors[editorName]._textArea.name) { return xinha_editors[editorName]; } } } return 'undefined'; } function findHtmlArea(editor_id) { if (editor_id == 'serendipity[body]') { return editorbody; } else if (editor_id == 'serendipity[extended]') { return editorextended; } else if (typeof(htmlarea_editors) != 'undefined') { return htmlarea_editors[editor_id]; } return 'undefined'; } <?php } ?> function Spawn<?php echo $jsname; ?> (<?php echo $spawnMulti ? 'id' : ''; ?> ) { editor<?php echo $jsname; ?> = new HTMLArea("<?php echo $item; ?> "<?php echo $spawnMulti ? ' + id' : ''; ?> ); <?php if ($spawnMulti) { ?> htmlarea_editors["<?php echo $item; ?> "<?php echo $spawnMulti ? ' + id' : ''; ?> ] = editor<?php echo $jsname; ?> ; <?php } // end if ?> config<?php echo $jsname; ?> = editor<?php echo $jsname; ?> .config; config<?php echo $jsname; ?> .registerButton('image_selector', '<?php echo MANAGE_IMAGES; ?> ', '<?php echo $serendipity['serendipityHTTPPath']; ?> htmlarea/images/ed_s9yimage.gif', false, function(editor, id) { window.open('<?php echo $serendipity['serendipityHTTPPath']; ?> serendipity_admin_image_selector.php?serendipity[textarea]=<?php echo $jsname . ($spawnMulti ? "' + editor._textArea.id + '" : ''); ?> ', 'ImageSel', 'width=800,height=600,toolbar=no,scrollbars=1,scrollbars,resize=1,resizable=1'); // editorref = editor<?php echo $jsname; ?> ; editorref = editor; } ); config<?php echo $jsname; ?> .toolbar.push([ "image_selector"]); <?php if (is_array($eventData['buttons'])) { foreach ($eventData['buttons'] as $button) { echo "btn_callbacks['{$button['id']}'] = {$button['javascript']};\n"; echo "var cb_{$button['id']} = btn_callbacks['{$button['id']}'];\n"; echo "config{$jsname}.registerButton('{$button['id']}', '{$button['name']}', '{$button['img_url']}', false, function (editor, id) { btn_callbacks['{$button['id']}'](editor._textArea.id, id); });\n"; echo "config{$jsname}.toolbar.push([\"{$button['id']}\"]);\n"; // Sort buttons into toolbar lists for later additions switch ($button['toolbar']) { case S9Y_WYSIWYG_TOOLBAR_FORMATTING: $toolbar[S9Y_WYSIWYG_TOOLBAR_FORMATTING][] = $button; break; case S9Y_WYSIWYG_TOOLBAR_MEDIA: case S9Y_WYSIWYG_TOOLBAR_WEB: $toolbar[S9Y_WYSIWYG_TOOLBAR_WEB][] = $button; break; default: $toolbar['other'][] = $button; break; } } } ?> <?php if ($xinha) { ?> config<?php echo $jsname; ?> .pageStyle = '<?php echo $csscode; ?> '; config<?php echo $jsname; ?> .stripScripts = false; <?php } else { ?> config<?php echo $jsname; ?> .cssFile = '<?php echo $csscode; ?> '; <?php } ?> config<?php echo $jsname; ?> .toolbar = [ [ "fontname", "space", "fontsize", "space", "formatblock", "space", "bold", "italic", "underline", "strikethrough", "separator", "subscript", "superscript", "separator", <?php if (is_array($toolbar[S9Y_WYSIWYG_TOOLBAR_FORMATTING])) { foreach ($toolbar[S9Y_WYSIWYG_TOOLBAR_FORMATTING] as $button) { echo '"' . $button['id'] . '",'; } echo '"separator",' . "\n"; } ?> "copy", "cut", "paste", "space", "undo", "redo" ], [ "justifyleft", "justifycenter", "justifyright", "justifyfull", "separator", "lefttoright", "righttoleft", "separator", "orderedlist", "unorderedlist", "outdent", "indent", "separator", "forecolor", "hilitecolor", "separator", "inserthorizontalrule", "createlink", "insertimage", "image_selector", "inserttable", "htmlmode", "separator", <?php if (is_array($toolbar[S9Y_WYSIWYG_TOOLBAR_WEB])) { foreach ($toolbar[S9Y_WYSIWYG_TOOLBAR_WEB] as $button) { echo '"' . $button['id'] . '",'; } echo '"separator",' . "\n"; } ?> "popupeditor", "separator", "showhelp", "about" ] <?php if (is_array($toolbar['other'])) { echo ",\n [ "; foreach ($toolbar['other'] as $button) { echo '"' . $button['id'] . '", '; } echo '"separator" ]' . "\n"; } ?> ]; if (typeof('s9y_xinha') != 'undefined') { s9y_xinha(editor<?php echo $jsname; ?> ); } // editor<?php echo $jsname; ?> .registerPlugin(SpellChecker); // [SPELLCHECK] editor<?php echo $jsname; ?> .generate(); editor<?php echo $jsname; ?> ._textArea.className = 'serendipity_entry'; } </script> <?php } $init = true; }
return; } serendipity_restoreVar($serendipity['COOKIE']['addmedia_directory'], $serendipity['GET']['only_path']); $folders = serendipity_traversePath($serendipity['serendipityPath'] . $serendipity['uploadPath'], '', true, NULL, 1, NULL, 'write'); usort($folders, 'serendipity_sortPath'); $form_hidden = ''; if (isset($image_selector_addvars) && is_array($image_selector_addvars)) { // These variables may come from serendipity_admin_image_selector.php to show embedded upload form foreach ($image_selector_addvars as $imgsel_key => $imgsel_val) { $form_hidden .= ' <input type="hidden" name="serendipity[' . serendipity_specialchars($imgsel_key) . ']" value="' . serendipity_specialchars($imgsel_val) . '" />' . "\n"; } } $mediaFiles = array('token' => serendipity_setFormToken(), 'form_hidden' => $form_hidden, 'folders' => $folders, 'only_path' => $serendipity['GET']['only_path'], 'max_file_size' => $serendipity['maxFileSize'], 'maxImgHeight' => $serendipity['maxImgHeight'], 'maxImgWidth' => $serendipity['maxImgWidth'], 'extraParems' => serendipity_generateImageSelectorParems(), 'manage' => isset($serendipity['GET']['showMediaToolbar']) ? serendipity_db_bool($serendipity['GET']['showMediaToolbar']) : true); // ToDo later: merge $data and $media $serendipity['smarty']->assign('media', $mediaFiles); $serendipity['smarty']->display(serendipity_getTemplateFile('admin/media_upload.tpl', 'serendipityPath')); return; case 'rotateCW': $file = serendipity_fetchImageFromDatabase($serendipity['GET']['fid']); if (!is_array($file) || !serendipity_checkPermission('adminImagesDelete') || !serendipity_checkPermission('adminImagesMaintainOthers') && $file['authorid'] != '0' && $file['authorid'] != $serendipity['authorid']) { return; } if (empty($serendipity['adminFile_redirect'])) { $serendipity['adminFile_redirect'] = serendipity_specialchars($_SERVER['HTTP_REFERER']); } $data['case_rotateCW'] = true; if (serendipity_rotateImg($serendipity['GET']['fid'], -90)) { $data['rotate_img_done'] = true; $data['adminFile_redirect'] = $serendipity['adminFile_redirect']; } break;
@define('PLUGIN_EVENT_TWITTER_ANNOUNCE_ACCOUNTS', 'Oznamovac� ��ty'); @define('PLUGIN_EVENT_TWITTER_ANNOUNCE_ACCOUNTS_DESC', 'Vyberte ��ty, na kter� se maj� oznamovat nov� p��sp�vky'); // Configuration Tabs: @define('PLUGIN_EVENT_TWITTER_CFGTAB', 'Konfigura�n� z�lo�ky:'); @define('PLUGIN_EVENT_TWITTER_CFGTAB_IDENTITIES', 'Identity'); @define('PLUGIN_EVENT_TWITTER_CFGTAB_ANNOUNCE', 'Oznamov�n� �l�nk�'); @define('PLUGIN_EVENT_TWITTER_CFGTAB_TWEETER', 'Mikroblogovac� klient'); @define('PLUGIN_EVENT_TWITTER_CFGTAB_TWEETBACK', 'Tweetbacky'); @define('PLUGIN_EVENT_TWITTER_CFGTAB_GLOBAL', 'Obecn�'); @define('PLUGIN_EVENT_TWITTER_CFGTAB_ALL', 'V�echno'); @define('PLUGIN_EVENT_TWITTER_TWEETER_REPLY', 'Odpov�d�t pisateli'); @define('PLUGIN_EVENT_TWITTER_TWEETER_RETWEET', 'Retweetovat'); @define('PLUGIN_EVENT_TWITTER_TWEETER_DM', 'P��m� zpr�va (Pracuje pouze pokud V�s u�ivatel sleduje)'); @define('PLUGIN_EVENT_TWITTER_IGNORE_TWEETBACKS_BYNAME', 'Ignorovat tweetbacky z'); @define('PLUGIN_EVENT_TWITTER_IGNORE_TWEETBACKS_BYNAME_DESC', '��rkami odd�len� seznam ��t� twitteru, ze kter�ch nechcete p�ij�mat tweetbacky.'); @define('PLUGIN_TWITTER_EVENT_NOT_INSTALLED', '<p class="serendipityAdminMsgError">' . '<img style="width: 22px; height: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_error.png') . '" alt="" />' . 'VAROV�N�: Plugin ud�lost� pro mikroblogov�n� (twitter/identica) je�t� nebyl nainstalov�n!</p>' . '<p class="serendipityAdminMsgError">Hlavn� ��st funkc� twitter/identica je zabezpe�ov�na pluginem ud�lost� mikroblogov�n�. Pokud chcete plnou funk�nost pluginu, m�li byste ho tak� nainstalovat .</p>'); @define('PLUGIN_EVENT_TWITTER_ANNOUNCE_FORMAT', 'Form�t ozn�men�'); @define('PLUGIN_EVENT_TWITTER_ANNOUNCE_FORMAT_DESC', 'Zadejte vlastn� form�t oznamovac�ch zpr�v. M��ete pou��t n�sleduj�c� prom�nn�. title#: bude nahrazen nadpisem p��sp�vku (a odpov�daj�c�mi tagy); #link#: odkaz na p��sp�vek; #author#: Autor p��sp�vku; #tags#: zb�vaj�c� tagy.'); @define('PLUGIN_EVENT_TWITTER_CFGTAB_TWEETTHIS', 'Twittni to!'); @define('PLUGIN_EVENT_TWITTER_TWEETTHIS_TITLE', 'Twittni to!'); @define('PLUGIN_EVENT_TWITTER_DO_TWEETTHIS', 'Povolit "Twittni to!"'); @define('PLUGIN_EVENT_TWITTER_DO_TWEETTHIS_DESC', 'Zapnut� t�to funkce zobraz� tla��tko "Twittni to!" v pati�ce p��sp�vku.'); @define('PLUGIN_EVENT_TWITTER_DO_IDENTICATHIS', 'Zapnout Identica'); @define('PLUGIN_EVENT_TWITTER_DO_IDENTICATHIS_DESC', 'Zapnut� t�to funkce zobraz� tla��tko "Identica" v pati�ce p��sp�vku.'); @define('PLUGIN_EVENT_TWITTER_TWEETTHIS_FORMAT', 'Form�t "Twittni to!"'); @define('PLUGIN_EVENT_TWITTER_TWEETTHIS_FORMAT_DESC', 'Zadejte form�t pro tweety n�v�t�vn�k�. M�li byste pou��t n�sleduj�c� prom�nn�. title#: bude nahrazen nadpisem p��sp�vku (a odpov�daj�c�mi tagy); #link#: odkaz na p��sp�vek; #author#: Autor p��sp�vku; #tags#: zb�vaj�c� tagy.'); @define('PLUGIN_EVENT_TWITTER_TWEETTHIS_FORMAT_BUTTON', 'Styl tla��tek'); @define('PLUGIN_EVENT_TWITTER_TWEETTHIS_FORMAT_BUTTON_DESC', 'V sou�asnosti je mo�no vybrat mezi dv�ma styly twittovac�ho tla��tka.'); @define('PLUGIN_EVENT_TWITTER_TWEETTHIS_FORMAT_BUTTON_BLACK', '�ern�'); @define('PLUGIN_EVENT_TWITTER_TWEETTHIS_FORMAT_BUTTON_WHITE', 'b�l�');
$comment['parent_id'] = $serendipity['POST']['replyTo']; if (!empty($comment['comment'])) { if (serendipity_saveComment($id, $comment, 'NORMAL')) { $sc_url = $serendipity['baseURL'] . 'comment.php?serendipity[entry_id]=' . $id . '&success=true&url=' . urlencode($_SERVER['HTTP_REFERER']); if (serendipity_isResponseClean($sc_url)) { header('Status: 302 Found'); header('Location: ' . $sc_url); } exit; } else { $serendipity['smarty']->assign(array('is_comment_notadded' => true, 'comment_url' => serendipity_specialchars($_SERVER['HTTP_REFERER']), 'comment_string' => explode('%s', COMMENT_NOT_ADDED_CLICK))); } } else { $serendipity['smarty']->assign(array('is_comment_empty' => true, 'comment_url' => serendipity_specialchars($_SERVER['HTTP_REFERER']), 'comment_string' => explode('%s', EMPTY_COMMENT))); } } } $serendipity['smarty']->display(serendipity_getTemplateFile($serendipity['smarty_file'], 'serendipityPath')); } } // Debug logging for pingback receiving function log_pingback($message) { global $pb_logging; if ($pb_logging) { $fp = fopen('pingback.log', 'a'); fwrite($fp, '[' . date('d.m.Y H:i') . '] ' . $message . "\n"); fclose($fp); } } /* vim: set sts=4 ts=4 expandtab : */
$data['error_publish'] = $success; } break; case 'updateCheckDisable': if (!serendipity_checkFormToken() || !serendipity_checkPermission('blogConfiguration')) { break; } serendipity_set_config_var('updateCheck', false); break; } $user = serendipity_fetchAuthor($serendipity['authorid']); // chrome-compatible, from Oliver Gassner, adapted from TextPattern. Hi guys, keep it up. :-) $bookmarklet = "javascript:var%20d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),f='" . $serendipity['baseURL'] . "',l=d.location,e=encodeURIComponent,p='serendipity_admin.php?serendipity[adminModule]=entries&serendipity[adminAction]=new&serendipity[title]='+e(d.title)+'&serendipity[body]='+e(s)+'&serendipity[url]='+location.href,u=f+p;a=function(){%20%20if(!w.open(u,'t','toolbar=0,resizable=1,scrollbars=1,status=1,width=800,height=800'))%20%20%20%20l.href=u;};if(/Firefox/.test(navigator.userAgent))%20%20setTimeout(a,0);else%20%20a();void(0)"; $data['bookmarklet'] = $bookmarklet; $data['username'] = $user[0]['realname']; $data['js_failure_file'] = serendipity_getTemplateFile('admin/serendipity_editor.js'); $output = array(); serendipity_plugin_api::hook_event('backend_frontpage_display', $output); $data['backend_frontpage_display'] = $output['more']; $data['usedVersion'] = $serendipity['version']; $data['updateCheck'] = $serendipity['updateCheck']; $data['curVersion'] = serendipity_getCurrentVersion(); $data['update'] = version_compare($data['usedVersion'], $data['curVersion'], '<'); serendipity_plugin_api::hook_event('plugin_dashboard_updater', $output, $data['curVersion']); $data['updateButton'] = $output; // Can be set through serendipity_config_local.inc.php if (!isset($serendipity['dashboardCommentsLimit'])) { $serendipity['dashboardCommentsLimit'] = 5; } if (!isset($serendipity['dashboardLimit'])) { $serendipity['dashboardLimit'] = 5;
function event_hook($event, &$bag, &$eventData) { global $serendipity; $license_data = $this->get_license_data(); $license_version = $this->get_config('cc_version', '3.0'); $license_type = $license_data['type']; $license_string = $license_data['string']; $rdf = $license_data['rdf']; if ($license_string == '') { $license_uri = 'http://web.resource.org/cc/PublicDomain'; } else { $license_uri = 'http://creativecommons.org/licenses/' . $license_string . '/' . $license_version . '/'; switch ($serendipity['lang']) { case 'ja': $license_uri .= 'deed.ja'; break; case 'de': $license_uri .= 'deed.de'; break; } } $cc_visibility = 'invisible'; switch ($event) { case 'frontend_display:html_layout': $cc_visibility = 'visible'; case 'frontend_display:html:per_entry': $eventData['display_dat'] .= '<div style="text-align: center;">'; if ($license_string == '') { if ($cc_visibility == 'visible') { $image_titel = 'No Rights Reserved'; $eventData['display_dat'] .= '<a href="http://creativecommons.org/licenses/publicdomain">'; $eventData['display_dat'] .= '<img style="border: 0px" alt="' . $image_titel . '" title="' . $image_titel . '" src="' . serendipity_getTemplateFile('img/norights.png') . '" />'; $eventData['display_dat'] .= '</a>'; if (serendipity_db_bool($this->get_config('txt', true))) { $eventData['display_dat'] .= '<br />' . str_replace('#license_uri#', $license_uri, PLUGIN_CREATIVECOMMONS_CAP_PD); } } } elseif ($cc_visibility == 'visible') { $image_titel = 'Creative Commons License - Some Rights Reserved'; $eventData['display_dat'] .= '<a href="' . $license_uri . '">'; $eventData['display_dat'] .= '<img style="border: 0px" alt="' . $image_titel . '" title="' . $image_titel . '" src="' . serendipity_getTemplateFile('img/somerights20.gif') . '" />'; $eventData['display_dat'] .= '</a>'; if (serendipity_db_bool($this->get_config('txt', true))) { $eventData['display_dat'] .= '<br />' . str_replace('#license_uri#', $license_uri, PLUGIN_CREATIVECOMMONS_CAP); } } $eventData['display_dat'] .= '<!-- <rdf:RDF xmlns="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><Work rdf:about=""><license rdf:resource="' . $license_uri . '"/></Work><License rdf:about="' . $license_uri . '">'; if (is_array($rdf)) { foreach ($rdf as $rdf_t => $rdf_v) { $eventData['display_dat'] .= ' <' . $rdf_v . ' rdf:resource="http://web.resource.org/cc/' . $rdf_t . '" />'; } } $eventData['display_dat'] .= '</License></rdf:RDF> -->'; $eventData['display_dat'] .= '</div>'; return true; break; case 'frontend_display:rss-2.0:per_entry': $eventData['display_dat'] .= '<creativeCommons:license>' . $license_uri . '</creativeCommons:license>'; return true; break; case 'frontend_display:rss-1.0:per_entry': $eventData['display_dat'] .= '<cc:license rdf:resource="' . $license_uri . '" />'; return true; break; case 'frontend_display:rss-1.0:once': $eventData['display_dat'] .= '<cc:License rdf:about="' . $license_uri . '">'; if (is_array($rdf)) { foreach ($rdf as $rdf_t => $rdf_v) { $eventData['display_dat'] .= '<cc:' . $rdf_v . ' rdf:resource="http://web.resource.org/cc/' . $rdf_t . '" />'; } } $eventData['display_dat'] .= '</cc:License>'; return true; break; case 'frontend_display:rss-2.0:namespace': $eventData['display_dat'] .= 'xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"'; return true; break; case 'frontend_display:rss-1.0:namespace': $eventData['display_dat'] .= 'xmlns:cc="http://web.resource.org/cc/"'; return true; break; default: return true; break; } }
/** * 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; ?> </option> <option value="publish" <?php echo isset($serendipity['GET']['filter']['isdraft']) && $serendipity['GET']['filter']['isdraft'] == 'publish' ? 'selected="selected"' : ''; ?> ><?php echo PUBLISH; ?> </option> </select> </td> <td valign="top" width="80"><?php echo CATEGORY; ?> </td> <td valign="top"> <select name="serendipity[filter][category]"> <option value="">--</option> <?php $categories = serendipity_fetchCategories(); $categories = serendipity_walkRecursive($categories, 'categoryid', 'parentid', VIEWMODE_THREADED); foreach ($categories as $cat) { echo '<option value="' . $cat['categoryid'] . '"' . ($serendipity['GET']['filter']['category'] == $cat['categoryid'] ? ' selected="selected"' : '') . '>' . str_repeat(' ', $cat['depth']) . htmlspecialchars($cat['category_name']) . '</option>' . "\n"; } ?> </select> </td> <td valign="top" width="80"><?php echo CONTENT; ?> </td> <td valign="top"><input class="input_textbox" size="10" type="text" name="serendipity[filter][body]" value="<?php echo isset($serendipity['GET']['filter']['body']) ? htmlspecialchars($serendipity['GET']['filter']['body']) : ''; ?> " /></td> </tr> <tr> <td class="serendipity_admin_filters_headline" colspan="6"><strong><?php echo SORT_ORDER; ?> </strong></td> </tr> <tr> <td> <?php echo SORT_BY; ?> </td> <td> <select name="serendipity[sort][order]"> <?php foreach ($sort_order as $so_key => $so_val) { echo '<option value="' . $so_key . '" ' . (isset($serendipity['GET']['sort']['order']) && $serendipity['GET']['sort']['order'] == $so_key ? 'selected="selected"' : '') . '>' . $so_val . '</option>' . "\n"; } ?> </select> </td> <td><?php echo SORT_ORDER; ?> </td> <td> <select name="serendipity[sort][ordermode]"> <option value="DESC" <?php echo isset($serendipity['GET']['sort']['ordermode']) && $serendipity['GET']['sort']['ordermode'] == 'DESC' ? 'selected="selected"' : ''; ?> ><?php echo SORT_ORDER_DESC; ?> </option> <option value="ASC" <?php echo isset($serendipity['GET']['sort']['ordermode']) && $serendipity['GET']['sort']['ordermode'] == 'ASC' ? 'selected="selected"' : ''; ?> ><?php echo SORT_ORDER_ASC; ?> </option> </select> </td> <td><?php echo ENTRIES_PER_PAGE; ?> </td> <td> <select name="serendipity[sort][perPage]"> <?php foreach ($per_page as $per_page_nr) { echo '<option value="' . $per_page_nr . '" ' . (isset($serendipity['GET']['sort']['perPage']) && $serendipity['GET']['sort']['perPage'] == $per_page_nr ? 'selected="selected"' : '') . '>' . $per_page_nr . '</option>' . "\n"; } ?> </select> </td> </tr> <tr> <td align="right" colspan="6"><input type="submit" name="go" value="<?php echo GO; ?> " class="serendipityPrettyButton input_button" /></td> </tr> </table> </form> <table class="serendipity_admin_list" cellpadding="5" width="100%"> <?php if (is_array($entries)) { $count = count($entries); $qString = '?serendipity[adminModule]=entries&serendipity[adminAction]=editSelect'; foreach ((array) $serendipity['GET']['sort'] as $k => $v) { $qString .= '&serendipity[sort][' . $k . ']=' . $v; } foreach ((array) $serendipity['GET']['filter'] as $k => $v) { $qString .= '&serendipity[filter][' . $k . ']=' . $v; } $linkPrevious = $qString . '&serendipity[page]=' . ($page - 1); $linkNext = $qString . '&serendipity[page]=' . ($page + 1); ?> <tr> <td> <?php if ($offSet > 0) { ?> <a href="<?php echo $linkPrevious; ?> " class="serendipityIconLink"><img src="<?php echo serendipity_getTemplateFile('admin/img/previous.png'); ?> " /><?php echo PREVIOUS; ?> </a> <?php } ?> </td> <td align="right"> <?php if ($count > $perPage) { ?> <a href="<?php echo $linkNext; ?> " class="serendipityIconLinkRight"><?php echo NEXT; ?> <img src="<?php echo serendipity_getTemplateFile('admin/img/next.png'); ?> " /></a> <?php } ?> </td> </tr> </table> <script type="text/javascript"> function invertSelection() { var f = document.formMultiDelete; for (var i = 0; i < f.elements.length; i++) { if (f.elements[i].type == 'checkbox') { f.elements[i].checked = !(f.elements[i].checked); } } } </script> <form action="?" method="post" name="formMultiDelete" id="formMultiDelete"> <?php echo serendipity_setFormToken(); ?> <input type="hidden" name="serendipity[action]" value="admin" /> <input type="hidden" name="serendipity[adminModule]" value="entries" /> <input type="hidden" name="serendipity[adminAction]" value="multidelete" /> <?php // Print the entries $rows = 0; foreach ($entries as $entry) { $rows++; if ($rows > $perPage) { continue; } // 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'; ?> "> --> <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&serendipity[adminModule]=entries&serendipity[adminAction]=edit&serendipity[id]=<?php echo $entry['id']; ?> " title="#<?php echo $entry['id']; ?> "><?php echo serendipity_truncateString(htmlspecialchars($entry['title']), 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 . ' ' . htmlspecialchars($entry['author']); if (count($entry['categories'])) { echo ' ' . IN . ' '; $cats = array(); foreach ($entry['categories'] as $cat) { $caturl = serendipity_categoryURL($cat); $cats[] = '<a href="' . $caturl . '">' . htmlspecialchars($cat['category_name']) . '</a>'; } echo implode(', ', $cats); } $entry['link'] = serendipity_archiveURL($entry['id'], $entry['title'], 'serendipityHTTPPath', true, array('timestamp' => $entry['timestamp'])); $entry['preview_link'] = '?serendipity[noBanner]=true&serendipity[noSidebar]=true&serendipity[action]=admin&serendipity[adminModule]=entries&serendipity[adminAction]=preview&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']; ?> " 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> <?php } else { ?> <a target="_blank" href="<?php echo $entry['link']; ?> " title="<?php echo VIEW . ' #' . $entry['id']; ?> " class="serendipityIconLink"><img src="<?php echo serendipity_getTemplateFile('admin/img/zoom.png'); ?> " alt="<?php echo VIEW; ?> " /><?php echo VIEW; ?> </a> <?php } ?> <a href="?serendipity[action]=admin&serendipity[adminModule]=entries&serendipity[adminAction]=edit&serendipity[id]=<?php echo $entry['id']; ?> " title="<?php echo EDIT . ' #' . $entry['id']; ?> " class="serendipityIconLink"><img src="<?php echo serendipity_getTemplateFile('admin/img/edit.png'); ?> " alt="<?php echo EDIT; ?> " /><?php echo EDIT; ?> </a> <a href="?<?php echo serendipity_setFormToken('url'); ?> &serendipity[action]=admin&serendipity[adminModule]=entries&serendipity[adminAction]=delete&serendipity[id]=<?php echo $entry['id']; ?> " title="<?php echo DELETE . ' #' . $entry['id']; ?> " class="serendipityIconLink"><img src="<?php echo serendipity_getTemplateFile('admin/img/delete.png'); ?> " alt="<?php echo DELETE; ?> " /><?php echo DELETE; ?> </a> <input class="input_checkbox" type="checkbox" name="serendipity[multiDelete][]" value="<?php echo $entry['id']; ?> " /> </td> </tr> </table> </div> <?php } // end entries output ?> <table class="serendipity_admin_list" cellpadding="5" width="100%"> <tr> <td> <?php if ($offSet > 0) { ?> <a href="<?php echo $linkPrevious; ?> " class="serendipityIconLink"><img src="<?php echo serendipity_getTemplateFile('admin/img/previous.png'); ?> " /><?php echo PREVIOUS; ?> </a> <?php } ?> </td> <td align="right"> <?php if ($count > $perPage) { ?> <a href="<?php echo $linkNext; ?> " class="serendipityIconLinkRight"><?php echo NEXT; ?> <img src="<?php echo serendipity_getTemplateFile('admin/img/next.png'); ?> " /></a> <?php } ?> </td> </tr> </table> <table class="serendipity_admin_list" cellpadding="0" width="100%"> <tr> <td align="right"> <input type="button" name="toggle" value="<?php echo INVERT_SELECTIONS; ?> " onclick="invertSelection()" class="serendipityPrettyButton input_button" /> <input type="submit" name="toggle" value="<?php echo DELETE_SELECTED_ENTRIES; ?> " class="serendipityPrettyButton input_button" /> </td> </tr> </table> </form> <div class="serendipity_admin_list_item serendipity_admin_list_item_<?php echo ($rows + 1) % 2 ? 'even' : 'uneven'; ?> "> <table width="100%" cellspacing="0" cellpadding="3"> <tr> <td> <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" /> <?php echo EDIT_ENTRY; ?> : #<input class="input_textbox" type="text" size="3" name="serendipity[id]" /> <input type="submit" name="serendipity[editSubmit]" value="<?php echo GO; ?> " class="serendipityPrettyButton input_button" /> </form> </td> </tr> </table> </div> <?php } else { // We've got nothing ?> <tr> <td align="center" class="serendipityAdminMsgNote"> <img style="width: 22px; height: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="<?php echo serendipity_getTemplateFile('admin/img/admin_msg_note.png'); ?> " alt="" /> <?php echo NO_ENTRIES_TO_PRINT; ?> </td> </tr> </table> <?php } ?> </div> <?php }
/** * 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; }
function event_hook($event, &$bag, &$eventData, $addData = null) { $hooks =& $bag->get('event_hooks'); if (isset($hooks[$event])) { switch ($event) { case 'backend_frontpage_display': $elements = explode(',', $this->get_config('sequence')); ob_start(); ?> <div class="dashboard_start"> </div> <script type="text/javascript"> function FT_toggle(id) { if ( document.getElementById(id + '_full').style.display == '' ) { document.getElementById(id + '_full').style.display='none'; document.getElementById(id + '_summary').style.display=''; document.getElementById(id + '_text').innerHTML = '<?php echo VIEW_FULL; ?> '; } else { document.getElementById(id + '_full').style.display=''; document.getElementById(id + '_summary').style.display='none'; document.getElementById(id + '_text').innerHTML = '<?php echo HIDE; ?> '; } return false; } function invertSelection() { var f = document.formMultiDelete; for (var i = 0; i < f.elements.length; i++) { if( f.elements[i].type == 'checkbox' ) { f.elements[i].checked = !(f.elements[i].checked); f.elements[i].onclick(); } } } </script> <?php foreach ($elements as $element) { $this->showElement($element); } $dashboard = ob_get_contents(); ob_end_clean(); $eventData['more'] = $dashboard; break; case 'css_backend': $filename = 'dashboard.css'; $tfile = serendipity_getTemplateFile($filename, 'serendipityPath'); if (!$tfile || $tfile == $filename) { $tfile = dirname(__FILE__) . '/' . $filename; } echo file_get_contents($tfile); break; } } return true; }
function event_hook($event, &$bag, &$eventData, $addData = null) { global $serendipity; static $login_url = null; if ($login_url === null) { $login_url = $serendipity['baseURL'] . $serendipity['indexFile'] . '?/plugin/loginbox'; } $hooks =& $bag->get('event_hooks'); if (isset($hooks[$event])) { switch ($event) { case 'frontend_saveComment': if (!isset($serendipity['csuccess'])) { $serendipity['csuccess'] = 'true'; } if (serendipity_db_bool($this->get_config('registered_only')) && !serendipity_userLoggedIn() && $addData['source2'] != 'adduser') { $eventData = array('allow_comments' => false); $serendipity['messagestack']['comments'][] = PLUGIN_ADDUSER_REGISTERED_ONLY_REASON; return false; } if (serendipity_db_bool($this->get_config('registered_only')) && !$this->inGroup() && $addData['source2'] != 'adduser') { $eventData = array('allow_comments' => false); $serendipity['messagestack']['comments'][] = PLUGIN_ADDUSER_REGISTERED_ONLY_REASON; return false; } if (serendipity_db_bool($this->get_config('true_identities')) && !serendipity_userLoggedIn()) { $user = str_replace(" b", '', $addData['name']); $user = serendipity_db_escape_string(preg_replace('@\\s+@', ' ', trim($user))); $user = trim($user); $authors = serendipity_db_query("SELECT authorid FROM {$serendipity['dbPrefix']}authors WHERE realname = '" . $user . "'"); if (is_array($authors) && isset($authors[0]['authorid'])) { $eventData = array('allow_comments' => false); $serendipity['messagestack']['comments'][] = sprintf(PLUGIN_ADDUSER_REGISTERED_CHECK_REASON, $login_url, 'onclick="javascript:loginbox = window.open(this.href, \'loginbox\', \'width=300,height=300,locationbar=no,menubar=no,personalbar=no,statusbar=yes,status=yes,toolbar=no\'); return false;"'); } } break; case 'external_plugin': if ($eventData != 'loginbox') { return true; } $out = array(); serendipity_plugin_api::hook_event('backend_login_page', $out); serendipity_smarty_init(); $serendipity['smarty']->assign(array('loginform_add' => $out, 'loginform_url' => $login_url, 'loginform_user' => $_SESSION['serendipityUser'], 'loginform_mail' => $_SESSION['serendipityEmail'], 'close_window' => defined('LOGIN_ACTION'), 'is_logged_in' => serendipity_userLoggedIn(), 'is_error' => defined('LOGIN_ERROR'))); $filename = 'loginbox.tpl'; $tfile = serendipity_getTemplateFile($filename, 'serendipityPath'); if (!$tfile || $tfile == $filename) { $tfile = dirname(__FILE__) . '/' . $filename; } $inclusion = $serendipity['smarty']->security_settings[INCLUDE_ANY]; $serendipity['smarty']->security_settings[INCLUDE_ANY] = true; $serendipity['smarty']->display($tfile); break; case 'frontend_display': if (serendipity_db_bool($this->get_config('registered_only')) && !serendipity_userLoggedIn()) { $serendipity['messagestack']['comments'][] = sprintf(PLUGIN_ADDUSER_REGISTERED_ONLY_REASON, $serendipity['baseURL'] . $serendipity['indexFile'] . '?serendipity[subpage]=adduser', $serendipity['baseURL'] . 'serendipity_admin.php'); $eventData['allow_comments'] = false; } break; case 'frontend_configure': if (isset($serendipity['POST']['action']) && isset($serendipity['POST']['user']) && isset($serendipity['POST']['pass'])) { serendipity_login(); if (serendipity_userLoggedIn()) { define('LOGIN_ACTION', 'login'); header('X-s9y-auth: Login'); } else { define('LOGIN_ERROR', true); } } elseif (isset($serendipity['POST']['action']) && isset($serendipity['POST']['logout'])) { serendipity_logout(); if (!serendipity_userLoggedIn()) { header('X-s9y-auth: Logout'); define('LOGIN_ACTION', 'logout'); } } if ((serendipity_db_bool($this->get_config('registered_only')) || serendipity_db_bool($this->get_config('true_identities'))) && $_SESSION['serendipityAuthedUser']) { if (defined('IN_serendipity_admin') && $serendipity['GET']['adminAction'] == 'doEdit') { // void } else { $serendipity['COOKIE']['name'] = isset($_SESSION['serendipityRealname']) ? $_SESSION['serendipityRealname'] : $_SESSION['serendipityUser']; $serendipity['COOKIE']['email'] = $_SESSION['serendipityEmail']; if ($serendipity['POST']['comment']) { $serendipity['POST']['name'] = $serendipity['COOKIE']['name']; $serendipity['POST']['email'] = $serendipity['COOKIE']['email']; } } } return true; break; case 'entry_display': if ($serendipity['GET']['subpage'] == 'adduser' || $serendipity['POST']['subpage'] == 'adduser' || !empty($serendipity['GET']['adduser_activation']) || !empty($this->clean_page)) { if (is_array($eventData)) { $eventData['clean_page'] = true; } } break; case 'entries_header': if ($serendipity['GET']['subpage'] == 'adduser' || $serendipity['POST']['subpage'] == 'adduser' || !empty($serendipity['GET']['adduser_activation'])) { $this->clean_page = true; $url = $serendipity['baseURL'] . $serendipity['indexFile']; $hidden['subpage'] = 'adduser'; $username = substr($serendipity['POST']['adduser_user'], 0, 40); $password = substr($serendipity['POST']['adduser_pass'], 0, 32); $email = $serendipity['POST']['adduser_email']; echo '<div id="adduser_form" style="padding-left: 4px; padding-right: 10px"><a id="adduser"></a>'; // Get the config from the sidebar plugin $pair_config = array('userlevel' => USERLEVEL_EDITOR, 'no_create' => false, 'right_publish' => false, 'instructions' => $this->get_config('instructions', ''), 'usergroups' => array(), 'straight_insert' => false, 'approve' => false, 'use_captcha' => false); $config = serendipity_db_query("SELECT name, value FROM {$serendipity['dbPrefix']}config WHERE name LIKE 'serendipity_plugin_adduser:%'"); if (is_array($config)) { foreach ($config as $conf) { $names = explode('/', $conf['name']); if ($names[1] == 'instructions' && !empty($pair_config['instructions'])) { continue; } if ($names[1] == 'usergroups') { $ug = (array) explode(',', $conf['value']); foreach ($ug as $cid) { if ($cid === false || empty($cid)) { continue; } $pair_config[$names[1]][$cid] = $cid; } } else { $pair_config[$names[1]] = serendipity_get_bool($conf['value']); } } } if (!serendipity_common_adduser::adduser($username, $password, $email, $pair_config['userlevel'], $pair_config['usergroups'], $pair_config['no_create'], $pair_config['right_publish'], $pair_config['straight_insert'], $pair_config['approve'], $pair_config['use_captcha'])) { serendipity_common_adduser::loginform($url, $hidden, $pair_config['instructions'], $username, $password, $email, $pair_config['use_captcha']); } echo '</div>'; } return true; break; default: return false; } } else { return false; } }
function event_hook($event, &$bag, &$eventData, $addData = null) { global $serendipity; $hooks =& $bag->get('event_hooks'); if (isset($hooks[$event])) { switch ($event) { case 'backend_image_addform': if ($serendipity['version'][0] < 2) { if (class_exists('ZipArchive')) { $checkedY = ""; $checkedN = ""; $this->get_config('unzipping') ? $checkedY = ' checked="checked"' : ($checkedN = ' checked="checked"'); ?> <br /> <div> <strong><?php echo PLUGIN_EVENT_IMAGESELECTORPLUS_UNZIP_FILES; ?> </strong><br /> <?php echo PLUGIN_EVENT_IMAGESELECTORPLUS_UNZIP_FILES_DESC; ?> <div> <input type="radio" class="input_radio" id="unzip_yes" name="serendipity[unzip_archives]" value="<?php echo YES; ?> "<?php echo $checkedY; ?> ><label for="unzip_yes"><?php echo YES; ?> </label> <input type="radio" class="input_radio" id="unzip_no" name="serendipity[unzip_archives]" value="<?php echo NO; ?> "<?php echo $checkedN; ?> ><label for="unzip_no"><?php echo NO; ?> </label> </div> </div> <?php } ?> <br /> <strong><?php echo PLUGIN_EVENT_IMAGESELECTORPLUS_QUICKBLOG; ?> :</strong><br /> <em><?php echo PLUGIN_EVENT_IMAGESELECTORPLUS_QUICKBLOG_DESC; ?> </em> <table id="quickblog_table" style="width: 50%"> <tr> <td nowrap="nowrap"><?php echo TITLE; ?> </td> <td><input class="input_textbox" name="serendipity[quickblog][title]" type="text" style="width: 90%" /></td> </tr> <tr> <td nowrap="nowrap"><?php echo ENTRY_BODY; ?> </td> <td><textarea name="serendipity[quickblog][body]" style="width: 90%; height: 200px"></textarea></td> </tr> <tr> <td nowrap="nowrap"><?php echo CATEGORY; ?> </td> <td><select name="serendipity[quickblog][category]"> <option value=""><?php echo NO_CATEGORY; ?> </option> <?php if (is_array($cats = serendipity_fetchCategories())) { $cats = serendipity_walkRecursive($cats, 'categoryid', 'parentid', VIEWMODE_THREADED); foreach ($cats as $cat) { echo '<option value="' . $cat['categoryid'] . '">' . str_repeat(' ', $cat['depth']) . $cat['category_name'] . '</option>' . "\n"; } } ?> </select></td> </tr> <tr> <td nowrap="nowrap"><?php echo PLUGIN_EVENT_IMAGESELECTORPLUS_TARGET; ?> </td> <td><select id="select_image_target" name="serendipity[quickblog][target]"> <option value="none"<?php echo serendipity_ifRemember('target', 'none', false, 'selected'); ?> ><?php echo NONE; ?> </option> <option value="js"<?php echo serendipity_ifRemember('target', 'js', false, 'selected'); ?> ><?php echo PLUGIN_EVENT_IMAGESELECTORPLUS_TARGET_JS; ?> </option> <option value="plugin"<?php echo serendipity_ifRemember('target', 'plugin', false, 'selected'); ?> ><?php echo PLUGIN_EVENT_IMAGESELECTORPLUS_TARGET_ENTRY; ?> </option> <option value="_blank"<?php echo serendipity_ifRemember('target', '_blank', false, 'selected'); ?> ><?php echo PLUGIN_EVENT_IMAGESELECTORPLUS_TARGET_BLANK; ?> </option> </select></td> </tr> <tr> <td nowrap="nowrap"><?php echo PLUGIN_EVENT_IMAGESELECTORPLUS_ASOBJECT; ?> </td> <td> <input type="radio" class="input_radio" id="image_yes" name="serendipity[quickblog][isobject]" value="<?php echo YES; ?> "><label for="image_yes"><?php echo YES; ?> </label> <input type="radio" class="input_radio" id="image_no" name="serendipity[quickblog][isobject]" value="<?php echo NO; ?> " checked="checked"><label for="image_no"><?php echo NO; ?> </label> </td> </tr> <tr> <td nowrap="nowrap"><?php echo IMAGE_SIZE; ?> </td> <td><input class="input_textbox" name="serendipity[quickblog][size]" value="<?php echo $serendipity['thumbSize']; ?> " type="text" style="width: 50px" /></td> </tr> <tr> <td align="center" colspan="2"><br /></td> </tr> </table> <div> <em><?php echo PLUGIN_EVENT_IMAGESELECTORPLUS_IMAGE_SIZE_DESC; ?> </em> </div> <?php } else { ?> <div id="imageselectorplus"> <?php if (class_exists('ZipArchive')) { $checkedY = ""; $checkedN = ""; $this->get_config('unzipping') ? $checkedY = ' checked="checked"' : ($checkedN = ' checked="checked"'); ?> <div class="clearfix radio_field"> <h4><?php echo PLUGIN_EVENT_IMAGESELECTORPLUS_UNZIP_FILES; ?> </h4> <?php echo PLUGIN_EVENT_IMAGESELECTORPLUS_UNZIP_FILES_DESC; ?> <div> <input type="radio" class="input_radio" id="unzip_yes" name="serendipity[unzip_archives]" value="<?php echo YES; ?> "<?php echo $checkedY; ?> ><label for="unzip_yes"><?php echo YES; ?> </label> <input type="radio" class="input_radio" id="unzip_no" name="serendipity[unzip_archives]" value="<?php echo NO; ?> "<?php echo $checkedN; ?> ><label for="unzip_no"><?php echo NO; ?> </label> </div> </div> <?php } ?> <h4><?php echo PLUGIN_EVENT_IMAGESELECTORPLUS_QUICKBLOG; ?> :</h4> <em><?php echo PLUGIN_EVENT_IMAGESELECTORPLUS_QUICKBLOG_DESC; ?> </em> <div id="quickblog_tablefield" class="clearfix"> <div class="quickblog_form_field"> <label for="quickblog_titel"><?php echo TITLE; ?> </label> <input id="quickblog_title" class="input_textbox" name="serendipity[quickblog][title]" type="text"> </div> <div class="quickblog_textarea_field"> <label for="nuggets2"><?php echo ENTRY_BODY; ?> </label> <textarea id="nuggets2" class="quickblog_nugget" data-tarea="nuggets2" name="serendipity[quickblog][body]" rows="10" cols="80"></textarea> <?php if ($serendipity['wysiwyg']) { $plugins = serendipity_plugin_api::enum_plugins('*', false, 'serendipity_event_nl2br'); ?> <input name="serendipity[properties][disable_markups][]" type="hidden" value="<?php echo $plugins[0]['name']; ?> "> <?php if (!class_exists('serendipity_event_ckeditor')) { ?> <script src="<?php echo $serendipity['serendipityHTTPPath']; ?> htmlarea/ckeditor/ckeditor/ckeditor.js"></script> <?php } // just add a simple basic toolbar, since we cannot use embedded plugins here ?> <script> CKEDITOR.replace( 'nuggets2', { toolbar : [['Format'],['Bold','Italic','Underline','Superscript','-','NumberedList','BulletedList','Outdent','Blockquote'],['JustifyBlock','JustifyCenter','JustifyRight'],['Link','Unlink'],['Source']], toolbarGroups: null }); </script> <?php } ?> </div> <div class="quickblog_form_field"> <label for="quickblog_select"><?php echo CATEGORY; ?> </label> <select id="quickblog_select" name="serendipity[quickblog][category]"> <option value=""><?php echo NO_CATEGORY; ?> </option> <?php if (is_array($cats = serendipity_fetchCategories())) { $cats = serendipity_walkRecursive($cats, 'categoryid', 'parentid', VIEWMODE_THREADED); foreach ($cats as $cat) { echo '<option value="' . $cat['categoryid'] . '">' . str_repeat(' ', $cat['depth']) . $cat['category_name'] . '</option>' . "\n"; } } ?> </select> </div> <div class="quickblog_form_select"> <label for="select_image_target"><?php echo PLUGIN_EVENT_IMAGESELECTORPLUS_TARGET; ?> </label> <select id="select_image_target" name="serendipity[quickblog][target]"> <option value="none"<?php echo serendipity_ifRemember('target', 'none', false, 'selected'); ?> ><?php echo NONE; ?> </option> <option value="js"<?php echo serendipity_ifRemember('target', 'js', false, 'selected'); ?> ><?php echo MEDIA_TARGET_JS; ?> </option> <option value="plugin"<?php echo serendipity_ifRemember('target', 'plugin', false, 'selected'); ?> ><?php echo MEDIA_ENTRY; ?> </option> <option value="_blank"<?php echo serendipity_ifRemember('target', '_blank', false, 'selected'); ?> ><?php echo MEDIA_TARGET_BLANK; ?> </option> </select> </div> <div class="clearfix radio_field quickblog_radio_field"> <label><?php echo PLUGIN_EVENT_IMAGESELECTORPLUS_ASOBJECT; ?> </label> <div> <input type="radio" class="input_radio" id="image_yes" name="serendipity[quickblog][isobject]" value="<?php echo YES; ?> "><label for="image_yes"><?php echo YES; ?> </label> <input type="radio" class="input_radio" id="image_no" name="serendipity[quickblog][isobject]" value="<?php echo NO; ?> " checked="checked"><label for="image_no"><?php echo NO; ?> </label> </div> </div> <div class="quickblog_form_field"> <label for="quickblog_isize"><?php echo IMAGE_SIZE; ?> </label> <input id="quickblog_isize" class="input_textbox" name="serendipity[quickblog][size]" value="<?php echo $serendipity['thumbSize']; ?> " type="text"> </div> </div> <em><?php echo PLUGIN_EVENT_IMAGESELECTORPLUS_IMAGE_SIZE_DESC; ?> </em> </div> <?php } break; case 'backend_image_add': global $new_media; // if file is zip archive and unzipping enabled // unzip file and add all images to database // retrieve file type $target_zip = $eventData; preg_match('@(^.*/)+(.*)\\.+(\\w*)@', $target_zip, $matches); $target_dir = $matches[1]; $basename = $matches[2]; $extension = $matches[3]; $authorid = isset($serendipity['POST']['all_authors']) && $serendipity['POST']['all_authors'] == 'true' ? '0' : $serendipity['authorid']; // only if unzipping function exists, we have archive file and unzipping set to yes if (class_exists('ZipArchive') && $extension == 'zip' && $serendipity['POST']['unzip_archives'] == YES) { // now unzip $zip = new ZipArchive(); $res = $zip->open($target_zip); if ($res === TRUE) { $files_to_unzip = array(); $extracted_images = array(); for ($i = 0; $i < $zip->numFiles; $i++) { $file_to_extract = $zip->getNameIndex($i); if (file_exists($target_dir . $file_to_extract)) { echo '(' . $file_to_extract . ') ' . ERROR_FILE_EXISTS_ALREADY . '<br />'; } else { $files_to_unzip[] = $file_to_extract; $extracted_images[] = $target_dir . $file_to_extract; } } $zip->extractTo($target_dir, $files_to_unzip); $zip->close(); echo PLUGIN_EVENT_IMAGESELECTORPLUS_UNZIP_OK; } else { echo PLUGIN_EVENT_IMAGESELECTORPLUS_UNZIP_FAILED; } // now proceed all unzipped images foreach ($extracted_images as $target) { preg_match('@(^.*/)+(.*)\\.+(\\w*)@', $target, $matches); $real_dir = $matches[1]; $basename = $matches[2]; $extension = $matches[3]; $tfile = $basename . "." . $extension; preg_match('@' . $serendipity['uploadPath'] . '(.*/)@', $target, $matches); $image_directory = $matches[1]; // make thumbnails for new images $thumbs = array(array('thumbSize' => $serendipity['thumbSize'], 'thumb' => $serendipity['thumbSuffix'])); serendipity_plugin_api::hook_event('backend_media_makethumb', $thumbs); foreach ($thumbs as $thumb) { // Create thumbnail if ($created_thumbnail = serendipity_makeThumbnail($tfile, $image_directory, $thumb['thumbSize'], $thumb['thumb'])) { echo PLUGIN_EVENT_IMAGESELECTORPLUS_UNZIP_IMAGE_FROM_ARCHIVE . " - " . THUMB_CREATED_DONE . '<br />'; } } // Insert into database $image_id = serendipity_insertImageInDatabase($tfile, $image_directory, $authorid, null, $realname); echo PLUGIN_EVENT_IMAGESELECTORPLUS_UNZIP_IMAGE_FROM_ARCHIVE . " ({$tfile}) " . PLUGIN_EVENT_IMAGESELECTORPLUS_UNZIP_ADD_TO_DB . "<br />"; $new_media[] = array('image_id' => $image_id, 'target' => $target, 'created_thumbnail' => $created_thumbnail); } } case 'backend_image_addHotlink': // Re-Scale thumbnails? $max_scale = array('width' => (int) $this->get_config('thumb_max_width'), 'height' => (int) $this->get_config('thumb_max_height')); if ($max_scale['width'] > 0 || $max_scale['height'] > 0) { $this->resizeThumb($max_scale, $eventData); } if (empty($serendipity['POST']['quickblog']['title'])) { break; } $file = basename($eventData); $directory = str_replace($serendipity['serendipityPath'] . $serendipity['uploadPath'], '', dirname($eventData) . '/'); $size = (int) $serendipity['POST']['quickblog']['size']; // check default Serendipity thumbSize, to make this happen like standard image uploads, and to get one "fullsize" image instance only, // else create another quickblog image "resized" instance, to use as entries thumbnail image if ($serendipity['thumbSize'] != $size) { $oldSuffix = $serendipity['thumbSuffix']; $serendipity['thumbSuffix'] = 'quickblog'; serendipity_makeThumbnail($file, $directory, $size); $serendipity['thumbSuffix'] = $oldSuffix; } // Non-image object link generation if ($serendipity['POST']['quickblog']['isobject'] == YES) { $objfile = serendipity_parseFileName($file); $filename = $objfile[0]; $suffix = $objfile[1]; $obj_mime = serendipity_guessMime($suffix); $objpath = $serendipity['serendipityHTTPPath'] . $serendipity['uploadPath'] . $directory . $filename . '.' . $suffix; // try to know about a working environment for imagemagicks pdf preview generation if ($serendipity['magick'] === true && strtolower($suffix) == 'pdf' && $serendipity['thumbSize'] == $size) { $objpreview = $serendipity['serendipityHTTPPath'] . $serendipity['uploadPath'] . $directory . $filename . '.' . $serendipity['thumbSuffix'] . '.' . $suffix . '.png'; } else { $objpreview = serendipity_getTemplateFile('admin/img/mime_' . preg_replace('@[^0-9a-z_\\-]@i', '-', $obj_mime) . '.png'); } if (!$objpreview || empty($objpreview)) { $objpreview = serendipity_getTemplateFile('admin/img/mime_unknown.png'); } } // New draft post $entry = array(); $entry['isdraft'] = 'false'; $entry['title'] = function_exists('serendipity_specialchars') ? serendipity_specialchars($serendipity['POST']['quickblog']['title']) : htmlspecialchars($serendipity['POST']['quickblog']['title'], ENT_COMPAT, LANG_CHARSET); if (isset($objpath) && !empty($objpath)) { $entry['body'] = '<a href="' . $objpath . '"><img alt="" class="serendipity_image_left serendipity_quickblog_image" src="' . $objpreview . '">' . $filename . '</a> (-' . $obj_mime . '-)<p>' . $serendipity['POST']['quickblog']['body'] . '</p>'; } else { $entry['body'] = '<!--quickblog:' . $serendipity['POST']['quickblog']['target'] . '|' . $eventData . '-->' . $serendipity['POST']['quickblog']['body']; } $entry['authorid'] = $serendipity['authorid']; $entry['exflag'] = false; $entry['categories'][0] = function_exists('serendipity_specialchars') ? serendipity_specialchars($serendipity['POST']['quickblog']['category']) : htmlspecialchars($serendipity['POST']['quickblog']['category'], ENT_COMPAT, LANG_CHARSET); #$entry['allow_comments'] = 'true'; // both disabled #$entry['moderate_comments'] = 'false'; // to take default values $serendipity['POST']['properties']['fake'] = 'fake'; $id = serendipity_updertEntry($entry); break; case 'frontend_display': // auto resizing images based on width and/or height attributes in img tag if (serendipity_db_bool($this->get_config('autoresize'))) { if (!empty($eventData['body'])) { $eventData['body'] = $this->substituteImages($eventData['body']); } if (!empty($eventData['extended'])) { $eventData['extended'] = $this->substituteImages($eventData['extended']); } } if (empty($eventData['body'])) { return; } // displaying quickblog posts if (is_object($serendipity['smarty']) && preg_match('@<!--quickblog:(.+)-->@imsU', $eventData['body'], $filematch)) { $eventData['body'] = $this->parse_quickblog_post($filematch[1], $eventData['body']); } // displaying galleries introduced by markup foreach ($this->markup_elements as $temp) { if (serendipity_db_bool($this->get_config($temp['name'], true)) && isset($eventData[$temp['element']]) && !$eventData['properties']['ep_disable_markup_' . $this->instance] && !isset($serendipity['POST']['properties']['disable_markup_' . $this->instance])) { $element = $temp['element']; $eventData[$element] = $this->media_insert($eventData[$element], $eventData); } } return true; break; case 'backend_entry_presave': if (is_numeric($eventData['id'])) { $eventData['body'] = str_replace('{{s9yisp_entryid}}', $eventData['id'], $eventData['body']); $eventData['extended'] = str_replace('{{s9yisp_entryid}}', $eventData['id'], $eventData['extended']); $this->gotMilk = true; } else { $this->cache['body'] = $eventData['body']; $this->cache['extended'] = $eventData['extended']; } break; case 'backend_publish': case 'backend_save': if ($this->gotMilk === false) { $old = md5($this->cache['body']) . md5($this->cache['extended']); $this->cache['body'] = str_replace('{{s9yisp_entryid}}', $eventData['id'], $this->cache['body']); $this->cache['extended'] = str_replace('{{s9yisp_entryid}}', $eventData['id'], $this->cache['extended']); $new = md5($this->cache['body']) . md5($this->cache['extended']); if ($old != $new) { serendipity_db_query("UPDATE {$serendipity['dbPrefix']}entries\n SET body = '" . serendipity_db_escape_string($this->cache['body']) . "',\n extended = '" . serendipity_db_escape_string($this->cache['extended']) . "'\n WHERE id = " . (int) $eventData['id']); } } break; case 'entry_display': if ($this->selected()) { if (is_array($eventData)) { $eventData['clean_page'] = true; // This is important to not display an entry list! } else { $eventData = array('clean_page' => true); } } break; case 'entries_header': if (!$this->selected()) { return true; } if ($serendipity['version'][0] > 1) { return true; } if (!headers_sent()) { header('HTTP/1.0 200'); header('Status: 200 OK'); } $entry = serendipity_fetchEntry('id', $serendipity['GET']['id']); $imageid = $serendipity['GET']['image']; $imgsrc = ''; if (preg_match('@<a title="([^"]+)" id="s9yisp' . $imageid . '"></a>@imsU', $entry['body'], $imgmatch)) { $imgsrc = $imgmatch[1]; } elseif (preg_match('@<a title="([^"]+)" id="s9yisp' . $imageid . '"></a>@imsU', $entry['extended'], $imgmatch)) { $imgsrc = $imgmatch[1]; } else { return; } $link = '<a href="' . serendipity_archiveURL($serendipity['GET']['id'], $entry['title'], 'baseURL', true, array('timestamp' => $entry['timestamp'])) . '#s9yisp' . $imageid . '">'; echo '<div class="serendipity_Entry_Date"> <h3 class="serendipity_date">' . serendipity_formatTime(DATE_FORMAT_ENTRY, $entry['timestamp']) . '</h3>'; echo '<h4 class="serendipity_title"><a href="#">' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($entry['title']) : htmlspecialchars($entry['title'], ENT_COMPAT, LANG_CHARSET)) . '</a></h4>'; echo '<div class="serendipity_entry"><div class="serendipity_entry_body">'; echo '<div class="serendipity_center">' . $link . '<!-- s9ymdb:' . $entry['id'] . ' --><img src="' . $imgsrc . '" /></a></div>'; echo '<br />'; echo $link . '<< ' . BACK . '</a>'; echo "</div>\n</div>\n</div>\n"; return true; break; case 'frontend_image_add_unknown': case 'frontend_image_add_filenameonly': case 'frontend_image_selector_submit': case 'frontend_image_selector_more': case 'frontend_image_selector_imagecomment': case 'frontend_image_selector_imagealign': case 'frontend_image_selector_imagesize': case 'frontend_image_selector_hiddenfields': case 'frontend_image_selector_imagelink': return true; break; case 'css_backend': if ($serendipity['version'][0] > 1) { ?> #imageselectorplus .radio_field input { margin: 0 0.5em; } #quickblog_tablefield { display: table-cell; } #uploadform .quickblog_nugget { margin-left: 0; padding: 0; } #quickblog_tablefield .quickblog_form_field { margin: .375em 0; } #quickblog_tablefield .quickblog_radio_field div label, #quickblog_tablefield .radio_field label { padding-left: .5em; } #quickblog_tablefield .quickblog_form_select { margin-top: 0.75em; margin-bottom: 0.75em; } #quickblog_tablefield .quickblog_radio_field label { padding-left: 0; } #quickblog_tablefield .quickblog_radio_field div { display: inline; } #quickblog_tablefield .quickblog_radio_field input { margin-left: 0.5em; } <?php } break; case 'css': ?> #content .serendipity_quickblog_image { border: medium none transparent; } .serendipity_mediainsert_gallery { border: 1px solid #C0C0C0; margin: 0px; overflow: auto; padding: 0.4em; } <?php break; case 'frontend_image_selector': if ($serendipity['version'][0] < 2) { $eventData['finishJSFunction'] = 'serendipity_imageSelectorPlus_done(\'' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($serendipity['GET']['textarea']) : htmlspecialchars($serendipity['GET']['textarea'], ENT_COMPAT, LANG_CHARSET)) . '\')'; } else { $eventData['finishJSFunction'] = 'serendipity.serendipity_imageSelector_done(\'' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($serendipity['GET']['textarea']) : htmlspecialchars($serendipity['GET']['textarea'], ENT_COMPAT, LANG_CHARSET)) . '\')'; } return true; break; default: return false; } } else { return false; } }
serendipity_addDefaultGroup('USERLEVEL_EDITOR_DESC', USERLEVEL_EDITOR); serendipity_addDefaultGroup('USERLEVEL_CHIEF_DESC', USERLEVEL_CHIEF); serendipity_addDefaultGroup('USERLEVEL_ADMIN_DESC', USERLEVEL_ADMIN); echo ' <strong>' . DONE . '</strong><br />'; echo SETTING_DEFAULT_TEMPLATE . '... '; serendipity_set_config_var('template', $serendipity['defaultTemplate']); echo ' <strong>' . DONE . '</strong><br />'; echo INSTALLING_DEFAULT_PLUGINS . '... '; include_once S9Y_INCLUDE_PATH . 'include/plugin_api.inc.php'; serendipity_plugin_api::register_default_plugins(); echo ' <strong>' . DONE . '</strong><br />'; } echo sprintf(ATTEMPT_WRITE_FILE, '.htaccess') . '... '; $errors = serendipity_installFiles($basedir); if ($errors === true) { echo ' <strong>' . DONE . '</strong><br />'; } else { echo ' <strong>' . FAILED . '</strong><br />'; foreach ($errors as $error) { echo '<div class="serendipityAdminMsgError"><img style="width: 22px; height: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_error.png') . '" alt="" />' . $error . '</div>'; } } if (serendipity_updateConfiguration()) { echo '<div class="serendipityAdminMsgSuccess"><img style="height: 22px; width: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_success.png') . '" alt="" />' . SERENDIPITY_INSTALLED . '</div>'; echo '<div align="center" style="font-size: large"><a href="' . $_POST['serendipityHTTPPath'] . '">' . VISIT_BLOG_HERE . '</a></div>'; echo '<div align="center">' . THANK_YOU_FOR_CHOOSING . '</div>'; } else { echo '<div class="serendipityAdminMsgError"><img style="height: 22px; width: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_error.png') . '" alt="" />' . ERROR_DETECTED_IN_INSTALL . '</div>'; } } /* vim: set sts=4 ts=4 expandtab : */
/** * Parses a smarty template file (which can be stored in either the plugin directory, the user template directory * or the default template directory, and return the parsed output. * * @access public * @param string template filename (no directory!) * @return string Parsed Smarty return */ function &parseTemplate($filename) { global $serendipity; $filename = basename($filename); $tfile = serendipity_getTemplateFile($filename, 'serendipityPath'); if (!$tfile || $tfile == $filename) { $tfile = dirname($this->pluginFile) . '/' . $filename; } $inclusion = $serendipity['smarty']->security_settings[INCLUDE_ANY]; $serendipity['smarty']->security_settings[INCLUDE_ANY] = true; $content = $serendipity['smarty']->fetch('file:' . $tfile, null, null, false); $serendipity['smarty']->security_settings[INCLUDE_ANY] = $inclusion; return $content; }