function installPlugin($pluginName) { $aErrors = array(); $aResult = array('name' => $pluginName, 'status' => '', 'errors' => &$aErrors); // make sure this is a legitimate bundled plugin request if ($aPlugin = getPlugin($pluginName)) { require_once MAX_PATH . '/lib/OA.php'; //OA::logMem('start deliveryLog/installPlugin'); require_once LIB_PATH . '/Plugin/PluginManager.php'; $oPluginManager = new OX_PluginManager(); if (!array_key_exists($aPlugin['name'], $GLOBALS['_MAX']['CONF']['plugins'])) { $filename = $aPlugin['name'] . '.' . $aPlugin['ext']; $filepath = $aPlugin['path'] . $filename; // TODO: refactor for remote paths? $oPluginManager->installPackage(array('tmp_name' => $filepath, 'name' => $filename)); if ($oPluginManager->countErrors()) { $aResult['status'] = 'Failed'; foreach ($oPluginManager->aErrors as $errmsg) { $aErrors[] = $errmsg; } } else { $aResult['status'] = 'OK'; } } else { $aResult['status'] = 'Already Installed'; $aErrors[] = 'Could not be installed because previous installation (whole or partial) was found'; } unset($oPluginManager); //OA::logMem('stop deliveryLog/installPlugin'); } else { $aResult['status'] = 'Invalid'; $aErrors[] = 'Not a valid default plugin'; } return $aResult; }
function tinymceConfigJS($editorconfig, $mode) { if (empty($editorconfig)) { // only if we get here first! $locale = 'en'; $loc = str_replace('_', '-', strtolower(getOption("locale"))); if ($loc) { if (file_exists(SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/tiny_mce/langs/' . $loc . '.js')) { $locale = $loc; } else { $loc = substr($loc, 0, 2); if (file_exists(SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/tiny_mce/langs/' . $loc . '.js')) { $locale = $loc; } } } $editorconfig = getOption('tinymce_' . $mode); if (!empty($editorconfig)) { $editorconfig = getPlugin('/tiny_mce/config/' . $editorconfig); if (!empty($editorconfig)) { require_once $editorconfig; } } } return $editorconfig; }
function tinymceConfigJS($mode) { global $_editorconfig, $MCEskin, $MCEdirection, $MCEcss, $MCEspecial, $MCEimage_advtab, $MCEtoolbars; $MCEskin = $MCEdirection = $MCEcss = $MCEspecial = $MCEimage_advtab = $MCEtoolbars = NULL; if (empty($_editorconfig)) { // only if we get here first! $locale = 'en'; $loc = str_replace('_', '-', getOption("locale")); if ($loc) { if (file_exists(SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/tinymce/langs/' . $loc . '.js')) { $locale = $loc; } else { $loc = substr($loc, 0, 2); if (file_exists(SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/tinymce/langs/' . $loc . '.js')) { $locale = $loc; } } } $_editorconfig = getOption('tinymce_' . $mode); if (!empty($_editorconfig)) { $_editorconfig = getPlugin('tinymce/config/' . $_editorconfig, true); if (!empty($_editorconfig)) { require_once $_editorconfig; } } } return $mode; }
function tinymce4ConfigJS($mode) { global $_editorconfig; if (empty($_editorconfig)) { // only if we get here first! $locale = 'en'; $loc = str_replace('_', '-', getOption("locale")); if ($loc) { if (file_exists(SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/tinymce4/langs/' . $loc . '.js')) { $locale = $loc; } else { $loc = substr($loc, 0, 2); if (file_exists(SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/tinymce4/langs/' . $loc . '.js')) { $locale = $loc; } } } $_editorconfig = getOption('tinymce4_' . $mode); if (!empty($_editorconfig)) { $_editorconfig = getPlugin('/tinymce4/config/' . $_editorconfig, true); if (!empty($_editorconfig)) { require_once $_editorconfig; } } } return $mode; }
function ratingJS() { $ME = substr(basename(__FILE__), 0, -4); ?> <script type="text/javascript" src="<?php echo WEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/' . $ME; ?> /jquery.MetaData.js"></script> <script type="text/javascript" src="<?php echo WEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/' . $ME; ?> /jquery.rating.js"></script> <?php $css = getPlugin('rating/jquery.rating.css', true, true); ?> <link rel="stylesheet" href="<?php echo pathurlencode($css); ?> " type="text/css" /> <script type="text/javascript"> // <!-- <![CDATA[ $.fn.rating.options = { cancel: '<?php echo gettext('retract'); ?> ' }; // ]]> --> </script> <?php }
public function testServices() { $ins = getAuth(); $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Auth\IAuth::class, $ins); $ins = getView(); $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\View\IView::class, $ins); $ins = getLog(); $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Log\ILog::class, $ins); // $ins = getDB(); // $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Database\MedooDB::class, $ins); // $ins = getRedis(); // $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Database\PRedis::class, $ins); // $ins = getDataPool(); // $this->assertInstanceOf(\Wwtg99\DataPool\Common\IDataPool::class, $ins); $ins = getCache(); $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Storage\Cache::class, $ins); $ins = getSession(); $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Storage\SessionUtil::class, $ins); $ins = getCookie(); $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Storage\CookieUtil::class, $ins); $ins = getOValue(); $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Storage\OldValue::class, $ins); $ins = getAssets(); $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\View\AssetsManager::class, $ins); $ins = getMailer(); $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Utils\Mail::class, $ins); $ins = Flight::Express(); $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Utils\Express::class, $ins); $ins = getPlugin('php'); $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Plugin\IPlugin::class, $ins); }
function do_pull($formatter, $params = array()) { global $Config; $pagename = $formatter->page->name; if ($formatter->refresh) { $params['refresh'] = 1; } $ret = array(); $params['retval'] =& $ret; $params['call'] = true; if (!empty($Config['pull_ignore_re']) and preg_match('/' . $Config['pull_ignore_re'] . '/i', $pagename)) { $ret['error'] = 'protected from pull'; $ret['status'] = 404; // fake } else { macro_Pull($formatter, $pagename, $params); } if (!empty($params['check'])) { echo $params['retval']['status']; return; } if (!empty($ret['error'])) { if (!empty($Config['pull_fallback']) && ($plugin = getPlugin($Config['pull_fallback']))) { // FIXME if (!function_exists('do_' . $plugin)) { include_once "plugin/{$plugin}.php"; } if (function_exists('do_' . $plugin)) { call_user_func('do_' . $plugin, $formatter, $params); } return; } echo $ret['error']; } }
function do_pull($formatter, $params = array()) { global $Config; $pagename = $formatter->page->name; if ($formatter->refresh) { $params['refresh'] = 1; } $ret = array(); $params['retval'] =& $ret; $params['call'] = true; if (!empty($Config['pull_ignore_re']) and preg_match('/' . $Config['pull_ignore_re'] . '/i', $pagename)) { $ret['error'] = 'protected from pull'; $ret['status'] = 404; // fake } else { macro_Pull($formatter, $pagename, $params); } if (!empty($params['check'])) { $status = $params['retval']['status']; if (isset($status) && $status != 304) { header('Cache-Control: public, max-age=5, s-maxage=5'); #header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); #header("Pragma: no-cache"); #header('Cache-Control: no-store, no-cache, must-revalidate', false); } else { header('Cache-Control: public, max-age=60, s-maxage=60'); } header('Content-Type: text/plain'); if (in_array($status, array(200, 404, 304))) { header('Status: ' . $status); } echo $status; return; } if (!empty($ret['error'])) { if (!empty($Config['pull_fallback']) && ($plugin = getPlugin($Config['pull_fallback']))) { // FIXME if (!function_exists('do_' . $plugin)) { include_once "plugin/{$plugin}.php"; } if (function_exists('do_' . $plugin)) { call_user_func('do_' . $plugin, $formatter, $params); } return; } $status = $ret['status']; if (isset($status) && $status != 304) { header('Cache-Control: public, max-age=5, s-maxage=5'); #header("Pragma: no-cache"); #header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); #header('Cache-Control: no-store, no-cache, must-revalidate', false); } else { header('Cache-Control: public, max-age=60, s-maxage=60'); } header('Content-Type: text/plain'); echo $ret['error']; } }
public function __construct($params = null) { parent::__construct(); $this->pluginName = preg_replace('/Plugin$/', '', get_class($this)); if (isset($params['plugin'])) { $this->plugin = $params['plugin']; } else { $this->plugin = getPlugin(); } }
protected static function image($html, $which, $where) { $img = getPlugin($which); $size = zp_imageDims($img); $wide = $size['width']; $high = $size['height']; $img = str_replace(SERVERPATH, WEBPATH, $img); $html .= '<img src="' . $img . '" class="imageasflag" width="' . $wide . 'px" height="' . $high . 'px" alt="" style="max-width:' . $wide . 'px; position: ' . $where . '" />' . "\n"; return $html; }
public function __construct() { // requires the FacebookConnect plugin to be enabled $this->isActive = getPlugin()->isActive('FacebookConnect'); if ($this->isActive) { $conf = getPlugin()->loadConf('FacebookConnect'); $this->id = $conf['id']; $this->secret = $conf['secret']; $this->fb = new Facebook(array('appId' => $this->id, 'secret' => $this->secret)); } }
public function __construct() { $this->api = getApi(); $this->config = getConfig()->get(); $this->plugin = getPlugin(); $this->route = getRoute(); $this->session = getSession(); $this->template = getTemplate(); $this->utility = new Utility(); $this->url = new Url(); $this->apiVersion = Request::getApiVersion(); }
static function JS() { // the scripts needed ?> <script type="text/javascript" src="<?php echo WEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER; ?> /tag_suggest/encoder.js"></script> <script type="text/javascript" src="<?php echo WEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER; ?> /tag_suggest/tag.js"></script> <?php $css = getPlugin('tag_suggest/tag.css', true, true); ?> <link type="text/css" rel="stylesheet" href="<?php echo pathurlencode($css); ?> " /> <?php $taglist = getAllTagsUnique(OFFSET_PATH ? false : NULL, OFFSET_PATH ? 0 : getOption('tag_suggest_threshold')); $tags = array(); foreach ($taglist as $tag) { $tags[] = addslashes($tag); } if (OFFSET_PATH || getOption('search_space_is') == 'OR') { $tagseparator = ' '; } else { $tagseparator = ','; } ?> <script type="text/javascript"> // <!-- <![CDATA[ var _tagList = ["<?php echo implode($tags, '","'); ?> "]; $(function () { $('#search_input, #edit-editable_4, .tagsuggest').tagSuggest({separator: '<?php echo $tagseparator; ?> ', tags: _tagList, quoteSpecial: <?php echo OFFSET_PATH ? 'false' : 'true'; ?> }) }); // ]]> --> </script> <?php }
/** * Load the CSS for the logon buttons */ function federated_logon_css() { global $_zp_gallery; if (OFFSET_PATH) { $inTheme = false; } else { $inTheme = $_zp_gallery->getCurrentTheme(); } $css = getPlugin('federated_logon/federated_logon_buttons.css', $inTheme, true); ?> <link rel="stylesheet" href="<?php echo $css; ?> " type="text/css" /> <?php }
function tagSuggestJS() { // the scripts needed ?> <script type="text/javascript" src="<?php echo WEBPATH . '/' . ZENFOLDER; ?> /js/encoder.js"></script> <script type="text/javascript" src="<?php echo WEBPATH . '/' . ZENFOLDER; ?> /js/tag.js"></script> <?php $css = getPlugin('tag_suggest/tag.css', true, true); ?> <link type="text/css" rel="stylesheet" href="<?php echo pathurlencode($css); ?> " /> <?php $taglist = getAllTagsUnique(); $c = 0; $list = ''; foreach ($taglist as $tag) { if ($c > 0) { $list .= ','; } $c++; $list .= '"' . addslashes(sanitize($tag, 3)) . '"'; } ?> <script type="text/javascript"> // <!-- <![CDATA[ var _tagList = [<?php echo $list; ?> ]; $(function () { $('#search_input, #edit-editable_4').tagSuggest({ separator:'<?php echo getOption('search_space_is') == 'OR' ? ' ' : ','; ?> ', tags: _tagList }) }); // ]]> --> </script> <?php }
function tinymceConfigJS($editorconfig, $mode) { if (empty($editorconfig)) { // only if we get here first! $locale = getLocaleForTinyMCEandAFM(); switch ($mode) { case 'zenphoto': $editorconfig = getOption('tinymce_zenphoto'); break; case 'zenpage': $editorconfig = getOption('tinymce_zenpage'); break; } if (!empty($editorconfig)) { $editorconfig = getPlugin('/tiny_mce/config/' . $editorconfig); require_once $editorconfig; } } return $editorconfig; }
public function __construct() { $this->api = getApi(); $this->config = getConfig()->get(); $this->plugin = getPlugin(); $this->route = getRoute(); $this->session = getSession(); $this->template = getTemplate(); $this->theme = getTheme(); $this->utility = new Utility(); $this->url = new Url(); $this->template->template = $this->template; $this->template->config = $this->config; $this->template->plugin = $this->plugin; $this->template->session = $this->session; $this->template->theme = $this->theme; $this->template->utility = $this->utility; $this->template->url = $this->url; $this->template->user = new User(); }
public function update($plugin) { getAuthentication()->requireAuthentication(); $params = $_POST; $pluginObj = getPlugin(); $conf = $pluginObj->loadConf($plugin); if (!$conf) { return $this->error('Cannot update settings for a deactivated plugin, try activating first.', false); } foreach ($conf as $name => $value) { if (isset($_POST[$name])) { $conf[$name] = $_POST[$name]; } } $status = $pluginObj->writeConf($plugin, $this->utility->generateIniString($conf)); if ($status) { return $this->success('Plugin updated successfully', $conf); } else { return $this->error('Could not update plugin', false); } }
function colorbox_css() { global $_zp_gallery; if (OFFSET_PATH) { $inTheme = false; } else { $inTheme = $_zp_gallery->getCurrentTheme(); } $css = getPlugin('colorbox/colorbox.css', $inTheme, true); ?> <script type="text/javascript" src="<?php echo FULLWEBPATH . "/" . ZENFOLDER . '/' . PLUGIN_FOLDER; ?> /colorbox/jquery.colorbox-min.js"></script> <link rel="stylesheet" href="<?php echo $css; ?> " type="text/css" /> <?php $navigator_user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? strtolower($_SERVER['HTTP_USER_AGENT']) : ''; if (stristr($navigator_user_agent, "msie") && !stristr($navigator_user_agent, '9')) { include dirname(__FILE__) . '/colorbox/colorbox_ie.css.php'; } }
?> <tr> <th style="text-align:left"> </th> <th style="text-align:right; padding-right: 10px;"> <?php printPageSelector($subpage, $rangeset, 'admin-options.php', array('page' => 'options', 'tab' => 'plugin')); ?> </th> <th></th> </tr> <?php } foreach ($plugins as $extension) { $option_interface = NULL; $path = getPlugin($extension . '.php'); $pluginStream = file_get_contents($path); if ($str = isolate('$plugin_description', $pluginStream)) { if (false === eval($str)) { $plugin_description = ''; } } else { $plugin_description = ''; } $str = isolate('$option_interface', $pluginStream); if (false !== $str) { require_once $path; if (preg_match('/\\s*=\\s*new\\s(.*)\\(/i', $str)) { eval($str); $warn = gettext('<strong>Note:</strong> Instantiating the option interface within the plugin may cause performance issues. You should instead set <code>$option_interface</code> to the name of the class as a string.'); } else {
function processor_blog($formatter, $value = "", $options) { static $date_anchor = ''; global $DBInfo; #static $tackback_list=array(); if ($value[0] == '#' and $value[1] == '!') { list($line, $value) = explode("\n", $value, 2); } $datetag = ''; if ($date_anchor == '' and $DBInfo->use_trackback) { #read trackbacks and set entry counter $cache = new Cache_text('trackback'); if ($cache->exists($formatter->page->name)) { $trackback_raw = $cache->fetch($formatter->page->name); $trackbacks = explode("\n", $trackback_raw); foreach ($trackbacks as $trackback) { list($dummy, $entry, $extra) = explode("\t", $trackback); if ($entry) { if ($formatter->trackback_list[$entry]) { $formatter->trackback_list[$entry]++; } else { $formatter->trackback_list[$entry] = 1; } } } } } #print($date_anchor);print_r($trackback_list); if ($line) { # get parameters list($tag, $user, $date, $title) = explode(" ", $line, 4); if (preg_match('/^[\\d\\.]+$/', $user)) { if (!$DBInfo->mask_hostname and $DBInfo->interwiki['Whois']) { #$user=_("Anonymous")."[<a href='".$DBInfo->interwiki['Whois']."$user'>$user</a>]"; $user = "******" . $DBInfo->interwiki['Whois'] . "{$user}'>" . _("Anonymous") . "</a>"; } else { $user = _("Anonymous"); } } else { if ($DBInfo->hasPage($user)) { $user = $formatter->link_tag($user); } } if ($date && $date[10] == 'T') { $date[10] = ' '; $time = strtotime($date . " GMT"); $date = gmdate("m-d [h:i a]", $time + $formatter->tz_offset); $pagename = $formatter->page->name; $p = strrpos($pagename, '/'); if ($p and preg_match('/(\\d{4})(-\\d{1,2})?(-\\d{1,2})?/', substr($pagename, $p), $match)) { if ($match[3]) { $anchor = ''; } else { if ($match[2]) { $anchor = gmdate("d", $time); } else { if ($match[1]) { $anchor = gmdate("md", $time); } } } } else { $anchor = gmdate("Ymd", $time); } if ($date_anchor != $anchor) { $anchor_date_fmt = $DBInfo->date_fmt_blog; $datetag = "<div class='blog-date'>" . date($anchor_date_fmt, $time) . " <a name='{$anchor}'></a><a class='perma' href='#{$anchor}'>{$formatter->perma_icon}</a></div>"; $date_anchor = $anchor; } } $md5sum = md5(substr($line, 7)); } $src = rtrim($value); if (!empty($src)) { $options['nosisters'] = 1; $options['nojavascript'] = 1; $tmp = explode("----\n", $src, 2); $src = $tmp[0]; if (!empty($tmp[1])) { $comments = $tmp[1]; } $add_button = _("Add comment"); if (!empty($comments)) { $count = sizeof(explode("----\n", $comments)); if (!empty($options['noaction']) or !empty($DBInfo->blog_comments)) { $comments = preg_replace("/----\n/", "[[HTML(</div></div><div class='separator'><hr /></div><div class='blog-comment'><div>)]]", $comments); } else { $comments = ''; $add_button = $count == 1 ? _("%s comment") : _("%s comments"); $count_tag = '<span class="count">' . $count . '</span>'; $add_button = sprintf($add_button, $count_tag); } } if (!empty($formatter->trackback_list[$md5sum])) { $counter = ' (' . $formatter->trackback_list[$md5sum] . ')'; } else { $counter = ''; } if (empty($options['noaction']) and $md5sum) { $action = $formatter->link_tag($formatter->page->urlname, "?action=blog&value={$md5sum}#BlogComment", $add_button); if (getPlugin('SendPing')) { $action .= ' | ' . $formatter->link_tag($formatter->page->urlname, "?action=trackback&value={$md5sum}", _("track back") . $counter); } if (!empty($DBInfo->use_rawblog)) { $action .= ' | ' . $formatter->link_tag($formatter->page->urlname, "?action=rawblog&value={$md5sum}", _("raw")); } } if (!empty($action)) { $action = "<div class='blog-action'><span class='bullet'>»</span> " . $action . "</div>\n"; } else { $action = ''; } $save = !empty($formatter->preview) ? $formatter->preview : ''; $formatter->preview = 1; ob_start(); $formatter->send_page($src, $options); $msg = ob_get_contents(); ob_end_clean(); if (!empty($comments)) { ob_start(); $formatter->send_page($comments, $options); $comments = "<div class='blog-comments'><div class='blog-comment'>" . ob_get_contents() . "</div></div>"; ob_end_clean(); } else { $comments = ""; } !empty($save) ? $formatter->preview = $save : null; } $out = "{$datetag}<div class='blog'>"; if (!empty($title)) { #$tag=normalize($title); $tag = $md5sum; if ($tag[0] == '%') { $tag = "n" . $tag; } $perma = "<a class='perma' href='#{$tag}'>{$formatter->perma_icon}</a>"; $title = preg_replace_callback("/(" . $formatter->wordrule . ")/", array(&$formatter, 'link_repl'), $title); $out .= "<div class='blog-title'><a name='{$tag}'></a>{$title} {$perma}</div>\n"; } $info = sprintf(_("Submitted by %s @ %s"), $user, $date); $out .= "<div class='blog-user'>{$info}</div>\n" . "<div class='blog-content'>{$msg}</div>{$comments}{$action}\n" . "</div>\n"; return $out; }
/** * Prints a form for posting comments * * @param bool $showcomments defaults to true for showing list of comments * @param string $addcommenttext alternate text for "Add a comment:" * @param bool $addheader set true to display comment count header * @param string $comment_commententry_mod use to add styles, classes to the comment form div * @param bool $desc_order default false, set to true to change the comment order to descending ( = newest to oldest) */ function printCommentForm($showcomments = true, $addcommenttext = NULL, $addheader = true, $comment_commententry_mod = '', $desc_order = false) { global $_zp_gallery_page, $_zp_current_admin_obj, $_zp_current_comment, $_zp_captcha, $_zp_authority, $_zp_HTML_cache, $_zp_current_image, $_zp_current_album, $_zp_current_page, $_zp_current_article; if (getOption('email_new_comments')) { $email_list = $_zp_authority->getAdminEmail(); if (empty($email_list)) { setOption('email_new_comments', 0); } } if (is_null($addcommenttext)) { $addcommenttext = '<h3>' . gettext('Add a comment:') . '</h3>'; } switch ($_zp_gallery_page) { case 'album.php': if (!getOption('comment_form_albums')) { return; } $obj = $_zp_current_album; break; case 'image.php': if (!getOption('comment_form_images')) { return; } $obj = $_zp_current_image; break; case 'pages.php': if (!getOption('comment_form_pages')) { return; } $obj = $_zp_current_page; break; case 'news.php': if (!getOption('comment_form_articles') || !is_NewsArticle()) { return; } $obj = $_zp_current_article; break; default: return; break; } $comments_open = $obj->getCommentsAllowed(); ?> <!-- printCommentForm --> <div id="commentcontent"> <?php $num = getCommentCount(); if ($showcomments) { if ($num == 0) { if ($addheader) { echo '<h3 class="empty">' . gettext('No Comments') . '</h3>'; } $display = ''; } else { if ($addheader) { echo '<h3>' . sprintf(ngettext('%u Comment', '%u Comments', $num), $num) . '</h3>'; } if (getOption('comment_form_toggle')) { ?> <div id="comment_toggle"><!-- place holder for toggle button --></div> <script type="text/javascript"> // <!-- <![CDATA[ function toggleComments(hide) { if (hide) { $('div.comment').hide(); $('.Pagination').hide(); $('#comment_toggle').html('<button class="button buttons" onclick="toggleComments(false);"><?php echo gettext('show comments'); ?> </button>'); } else { $('div.comment').show(); $('.Pagination').show(); $('#comment_toggle').html('<button class="button buttons" onclick="toggleComments(true);"><?php echo gettext('hide comments'); ?> </button>'); } } $(document).ready(function () { toggleComments(window.location.hash.search(/#zp_comment_id_/)); }); // ]]> --> </script> <?php $display = ' style="display:none"'; } else { $display = ''; } } $hideoriginalcomments = ''; if (getOption('comment_form_pagination') && COMMENTS_PER_PAGE < $num) { $hideoriginalcomments = ' style="display:none"'; // hide original comment display to be replaced by jQuery pagination } if (getOption('comment_form_pagination') && COMMENTS_PER_PAGE < $num) { ?> <div class="Pagination"></div><!-- this is the jquery pagination nav placeholder --> <div id="Commentresult"></div> <?php } ?> <div id="comments"<?php echo $hideoriginalcomments; ?> > <?php while (next_comment($desc_order)) { if (!getOption('comment_form_showURL')) { $_zp_current_comment['website'] = ''; } ?> <div class="comment" <?php echo $display; ?> > <div class="commentinfo"> <h4 id="zp_comment_id_<?php echo $_zp_current_comment['id']; ?> "><?php printCommentAuthorLink(); ?> : <?php echo gettext('on'); ?> <?php echo getCommentDateTime(); printEditCommentLink(gettext('Edit'), ', ', ''); ?> </h4> </div><!-- class "commentinfo" --> <div class="commenttext"><?php echo html_encodeTagged(getCommentBody(), false); ?> </div><!-- class "commenttext" --> </div><!-- class "comment" --> <?php } ?> </div><!-- id "comments" --> <?php } if (getOption('comment_form_pagination') && COMMENTS_PER_PAGE < $num) { ?> <div class="Pagination"></div><!-- this is the jquery pagination nav placeholder --> <?php } ?> <!-- Comment Box --> <?php if ($comments_open) { if (MEMBERS_ONLY_COMMENTS && !zp_loggedin(POST_COMMENT_RIGHTS)) { echo gettext('Only registered users may post comments.'); } else { $disabled = array('name' => '', 'website' => '', 'anon' => '', 'private' => '', 'comment' => '', 'street' => '', 'city' => '', 'state' => '', 'country' => '', 'postal' => ''); $stored = array_merge(array('email' => '', 'custom' => ''), $disabled, getCommentStored()); $custom = getSerializedArray($stored['custom']); foreach ($custom as $key => $value) { if (!empty($value)) { $stored[$key] = $value; } } foreach ($stored as $key => $value) { $disabled[$key] = false; } if (zp_loggedin()) { if (extensionEnabled('userAddressFields')) { $address = userAddressFields::getCustomData($_zp_current_admin_obj); foreach ($address as $key => $value) { if (!empty($value)) { $disabled[$key] = true; $stored[$key] = $value; } } } $name = $_zp_current_admin_obj->getName(); if (!empty($name)) { $stored['name'] = $name; $disabled['name'] = ' disabled="disabled"'; } else { $user = $_zp_current_admin_obj->getUser(); if (!empty($user)) { $stored['name'] = $user; $disabled['name'] = ' disabled="disabled"'; } } $email = $_zp_current_admin_obj->getEmail(); if (!empty($email)) { $stored['email'] = $email; $disabled['email'] = ' disabled="disabled"'; } if (!empty($address['website'])) { $stored['website'] = $address['website']; $disabled['website'] = ' disabled="disabled"'; } } $data = zp_apply_filter('comment_form_data', array('data' => $stored, 'disabled' => $disabled)); $disabled = $data['disabled']; $stored = $data['data']; foreach ($data as $check) { foreach ($check as $v) { if ($v) { $_zp_HTML_cache->disable(); // shouldn't cache partially filled in pages break 2; } } } if (!empty($addcommenttext)) { echo $addcommenttext; } ?> <div id="commententry" <?php echo $comment_commententry_mod; ?> > <?php $theme = getCurrentTheme(); $form = getPlugin('comment_form/comment_form.php', $theme); require $form; ?> </div><!-- id="commententry" --> <?php } } else { ?> <div id="commententry"> <h3><?php echo gettext('Closed for comments.'); ?> </h3> </div><!-- id="commententry" --> <?php } ?> </div><!-- id="commentcontent" --> <?php if (getOption('comment_form_rss') && getOption('RSS_comments')) { ?> <br clear="all" /> <?php if (class_exists('RSS')) { switch ($_zp_gallery_page) { case "image.php": printRSSLink("Comments-image", "", gettext("Subscribe to comments"), ""); break; case "album.php": printRSSLink("Comments-album", "", gettext("Subscribe to comments"), ""); break; case "news.php": printRSSLink("Comments-news", "", gettext("Subscribe to comments"), ""); break; case "pages.php": printRSSLink("Comments-page", "", gettext("Subscribe to comments"), ""); break; } } } ?> <!-- end printCommentForm --> <?php }
/** * Get pagelinks from the wiki text * * @author Won-Kyu Park <*****@*****.**> */ function get_pagelinks($formatter, $text) { // split into chunks $chunk = preg_split("/({{{\n (?:(?:[^{}]+|\n {[^{}]+}(?!})|\n (?<!{){{1,2}(?!{)|\n (?<!})}{1,2}(?!}))|(?1)\n )++}}})/x", $text, -1, PREG_SPLIT_DELIM_CAPTURE); $inline = array(); // save inline nowikis if (count($chunk) > 1) { // protect inline nowikis $nc = ''; $k = 1; $idx = 1; foreach ($chunk as $c) { if ($k % 2) { $nc .= $c . ' '; } $k++; } $text = $nc; } // check wordrule if (empty($formatter->wordrule)) { $formatter->set_wordrule(); } preg_match_all("/(" . $formatter->wordrule . ")/", $text, $match); $words = array(); foreach ($match[0] as $k => $v) { if (preg_match('/^\\!/', $v)) { continue; } if (preg_match('/^\\?/', $v)) { $words[] = substr($v, 1); } else { if (preg_match('/^\\[?wiki:[^`\'\\{\\]\\^\\*\\(]/', $v) || !preg_match('/^\\[?' . $formatter->urls . ':/', $v)) { $extended = false; $creole = false; $word = rtrim($v, '`'); // XXX if (preg_match('/^\\[\\[(.*)\\]\\]$/', $word, $m)) { // MediaWiki/WikiCreole like links $creole = true; $word = $m[1]; } else { if (preg_match('/^\\[(.*)\\]$/', $word, $m)) { $word = $m[1]; } } if (preg_match('/^(wiki:)?/', $word, $m)) { if (!empty($m[1])) { $word = substr($word, 5); } $word = ltrim($word); // ltrim wikiwords if (preg_match("/^\"([^\"]*)\"\\s?/", $word, $m1)) { $extended = true; $word = $m1[1]; } else { if (!empty($m[1]) and ($p = strpos($word, " ")) !== false) { $word = substr($word, 0, $p); } } } else { if ($creole and ($p = strpos($word, '|')) !== false) { $word = substr($word, 0, $p); } } if (!$extended and empty($formatter->mediawiki_style) and strpos($word, " ") !== false) { $word = normalize($word); } if (preg_match("/^([^\\(:]+)(\\((.*)\\))?\$/", $word, $m)) { if (isset($m[1])) { $name = $m[1]; } else { $name = $word; } // check macro $myname = getPlugin($name); if (!empty($myname)) { // this is macro continue; } } $word = strtok($word, '#?'); // trim anchor tag $words[] = $word; } } } return array_values(array_unique($words)); }
<?php printTabs(); ?> <div id="content"> <div id="container"> <?php printSubtabs(); ?> <div class="tabbox"> <?php $owners = array(); $sql = 'SELECT `name` FROM ' . prefix('options') . ' WHERE `name` LIKE "zp_plugin_%"'; $result = query_full_array($sql); foreach ($result as $plugin) { $plugin = str_replace('zp_plugin_', '', $plugin['name']) . '.php'; $file = str_replace(SERVERPATH, '', getPlugin($plugin, false)); if (strpos($file, PLUGIN_FOLDER) === false) { $owners[USER_PLUGIN_FOLDER][$plugin] = $plugin; } else { $owners[ZENFOLDER . '/' . PLUGIN_FOLDER][$plugin] = $plugin; } } $sql = 'SELECT DISTINCT `creator` FROM ' . prefix('options'); $result = query_full_array($sql); foreach ($result as $owner) { $structure = explode('/', $owner['creator']); switch (count($structure)) { case 1: break; case 2: $owners[$structure[0]][] = $structure[1];
if (file_exists($custom)) { require_once $custom; } else { $custom = false; } if (DEBUG_PLUGINS) { debugLog('Loading the "theme" plugins.'); } $_zp_loaded_plugins = array(); foreach (getEnabledPlugins() as $extension => $loadtype) { if ($loadtype & THEME_PLUGIN) { if (DEBUG_PLUGINS) { list($usec, $sec) = explode(" ", microtime()); $start = (double) $usec + (double) $sec; } require_once getPlugin($extension . '.php'); if (DEBUG_PLUGINS) { list($usec, $sec) = explode(" ", microtime()); $end = (double) $usec + (double) $sec; debugLog(sprintf(' ' . $extension . '(' . ($priority & PLUGIN_PRIORITY) . ')=>%.4fs', $end - $start)); } // $_zp_script_timer['load '.$extension] = microtime(); } $_zp_loaded_plugins[] = $extension; } if ($zp_request) { $_zp_obj = zp_apply_filter('load_theme_script', $_zp_obj); } //$_zp_script_timer['theme scripts'] = microtime(); if ($zp_request && file_exists(SERVERPATH . "/" . internalToFilesystem($_zp_obj))) { $hint = $show = false;
<?php use pg\classes\Command; include_once "pgFx.php"; if (!isInitialized()) { header("Location: pg.php"); return; } if (!isset($_POST["name"], $_POST["desc"], $_POST["usage"])) { header("Location: addCommand.php"); return; } if (!Command::isValidName($name = trim($_POST["name"]))) { header("Location: addCommand.php?notice=" . urlencode("Command names must not include spaces or colons!")); return; } $cmd = new Command(getPlugin(), $name, $_POST["desc"], $_POST["usage"]); getPlugin()->cmds[$name] = $cmd; header("Location: editCommand.php?name=" . urlencode($cmd->name));
/** * Returns the theme folder * If there is an album theme, loads the theme options. * * @param object $album album object if override desired * * @return string */ function setupTheme($album = NULL) { global $_zp_gallery, $_zp_current_album, $_zp_current_search, $_zp_themeroot; $albumtheme = ''; if (is_null($album)) { if (in_context(ZP_SEARCH_LINKED)) { if (!($album = $_zp_current_search->getDynamicAlbum())) { $album = $_zp_current_album; } } else { $album = $_zp_current_album; } } $theme = $_zp_gallery->getCurrentTheme(); $id = 0; if (!is_null($album)) { $parent = getUrAlbum($album); $albumtheme = $parent->getAlbumTheme(); if (!empty($albumtheme)) { $theme = $albumtheme; $id = $parent->getID(); } } $theme = zp_apply_filter('setupTheme', $theme); $_zp_gallery->setCurrentTheme($theme); $themeindex = getPlugin('index.php', $theme); if (empty($theme) || empty($themeindex)) { header('Last-Modified: ' . ZP_LAST_MODIFIED); header('Content-Type: text/html; charset=' . LOCAL_CHARSET); ?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> </head> <body> <strong><?php printf(gettext('Zenphoto found no theme scripts. Please check the <em>%s</em> folder of your installation.'), THEMEFOLDER); ?> </strong> </body> </html> <?php exitZP(); } else { loadLocalOptions($id, $theme); $_zp_themeroot = WEBPATH . "/" . THEMEFOLDER . "/{$theme}"; } return $theme; }
function flag_thumbnail_insert_class($html) { global $_zp_current_album, $_zp_current_image; if (getOption('flag_thumbnail_flag_new')) { if (isset($_zp_current_image)) { $obj = $_zp_current_image; } else { $obj = $_zp_current_album; } $html = '<span class="flag_thumbnail" style="position:relative; display:block;">' . "\n" . $html . "\n"; switch (getOption('flag_thumbnail_date')) { case "date": $imagedatestamp = strtotime($obj->getDateTime()); break; case "mtime": $imagedatestamp = $obj->get('mtime'); break; } $not_older_as = 60 * 60 * 24 * getOption('flag_thumbnail_range'); $age = time() - $imagedatestamp; if ($age <= $not_older_as) { if (getOption('flag_thumbnail_use_text')) { $text = getOption('flag_thumbnail_new_text'); $html .= '<span class="textasnewflag" style="position: absolute;top: 10px;right: 6px;">' . $text . "</span>\n"; } else { $img = getPlugin('flag_thumbnail/' . getOption('flag_thumbnail_new_icon'), false, true); $html .= '<img src="' . $img . '" alt="" style="position: absolute;top: 4px;right: 4px;"/>' . "\n"; } } } if (getOption('flag_thumbnail_flag_geodata')) { if (get_class($obj) == 'Album') { $obj = $obj->getAlbumThumbImage(); } if (is_object($obj) && get_class($obj) == '_Image') { $exif = $obj->getMetaData(); if (!empty($exif['EXIFGPSLatitude']) && !empty($exif['EXIFGPSLongitude'])) { if (getOption('flag_thumbnail_use_text')) { $text = getOption('flag_thumbnail_geodata_text'); $html .= '<span class="textasnewflag" style="position: absolute;bottom: 10px;right: 6px;">' . $text . "</span>\n"; } else { $img = getPlugin('flag_thumbnail/' . getOption('flag_thumbnail_geodata_icon'), false, true); $html .= '<img src="' . $img . '" alt="" style="position: absolute;bottom: 4px;right: 4px;"/>' . "\n"; } } } } $i = strpos($html, 'class='); if ($i !== false) { $locked = strpos($html, 'password_protected', $i + 7) !== false; $unpublished = strpos($html, 'not_visible', $i + 7) !== false; if ($locked && getOption('flag_thumbnail_flag_locked')) { if (getOption('flag_thumbnail_use_text')) { $text = getOption('flag_thumbnail_locked_text'); $html .= '<span class="textasnewflag" style="position: absolute;bottom: 10px;left: 4px;">' . $text . "</span>\n"; } else { $img = getPlugin('flag_thumbnail/' . getOption('flag_thumbnail_locked_icon'), false, true); $html .= '<img src="' . $img . '" alt="" style="position: absolute;bottom: 4px;left: 4px;"/>' . "\n"; } } if ($unpublished && getOption('flag_thumbnail_flag_unpublished')) { if (getOption('flag_thumbnail_use_text')) { $text = getOption('flag_thumbnail_unpublished_text'); $html .= '<span class="textasnewflag" style="position: absolute;top: 10px;left: 4px;">' . $text . "</span>\n"; } else { $img = getPlugin('flag_thumbnail/' . getOption('flag_thumbnail_unpublished_icon'), false, true); $html .= '<img src="' . $img . '" alt="" style="position: absolute;top: 4px;left: 4px;"/>' . "\n"; } } } $html .= "</span>\n"; return $html; }
/** * generates a simple captcha for comments * * Thanks to gregb34 who posted the original code * * Returns the captcha code string and image URL (via the $image parameter). * * @return string; */ function getCaptcha($prompt = NULL) { $theme = getOption('reCaptcha_theme'); $publicKey = getOption('reCaptcha_public_key'); $lang = strtolower(substr(ZENPHOTO_LOCALE, 0, 2)); if (!getOption('reCaptcha_public_key')) { return array('input' => '', 'html' => '<p class="errorbox">' . gettext('reCAPTCHA is not properly configured.') . '</p>', 'hidden' => ''); } else { $source = getPlugin('reCaptcha/' . $theme . '/reCaptcha.html'); if ($source) { $webpath = dirname(getplugin('reCaptcha/' . $theme . '/reCaptcha.html', false, true)); $tr = array('__GETHELP__' => gettext("Help"), '__GETIMAGE__' => gettext("Get a visual challenge"), '__GETAUDIO__' => gettext("Get an audio challenge"), '__RELOAD__' => gettext("Get another challenge"), '__WORDS__' => gettext("Type the two words"), '__NUMBERS__' => gettext("Type what you hear"), '__ERROR__' => gettext("Incorrect please try again"), '__SOURCEWEBPATH__' => $webpath); $html = strtr(file_get_contents($source), $tr); $theme = 'custom'; // to tell google to use the above } else { $html = ''; } $themejs = '<script type="text/javascript">' . "\n" . " var RecaptchaOptions = {\n"; if (!in_array($lang, array('de', 'en', 'es', 'fr', 'nl', 'ru', 'pt', 'tr'))) { // google's list as of June 2013 $themejs .= " custom_translations : {\n" . " instructions_visual : 'Type the two words',\n" . " instructions_audio : 'Type what you hear',\n" . " play_again : 'Play sound again',\n" . " cant_hear_this : 'Download the sound as MP3',\n" . " visual_challenge : 'Get a visual challenge',\n" . " audio_challenge : 'Get an audio challenge',\n" . " refresh_btn : 'Get another challenge',\n" . " help_btn : 'Help',\n" . " incorrect_try_again : 'Incorrect please try again',\n" . " },\n"; } $themejs .= " lang : '{$lang}',\n" . "\t\t\t\ttheme : '{$theme}'\n" . "\t\t\t\t};\n" . "</script>\n"; $html .= recaptcha_get_html($publicKey, NULL, secureServer()); return array('html' => '<label class="captcha_label">' . $prompt . '</label>', 'input' => $themejs . $html); } }
function processCustomOptionSave($returntab, $themename = NULL, $themealbum = NULL) { $customHandlers = array(); foreach ($_POST as $posted => $value) { if (preg_match('/^' . CUSTOM_OPTION_PREFIX . '/', $posted)) { // custom option! $key = $postkey = substr($posted, strpos($posted, '-') + 1); $l = strlen($postkey); if (!($l % 2) && preg_match('/[0-9a-f]{' . strlen($postkey) . '}/i', $postkey)) { $key = postIndexDecode($postkey); } $switch = explode('-', $posted); $switch = substr($switch[0], strlen(CUSTOM_OPTION_PREFIX)); switch ($switch) { case 'text': $value = process_language_string_save($postkey, 1); break; case 'numerictext': if (isset($_POST[$postkey])) { if (is_numeric($_POST[$postkey])) { $value = $_POST[$postkey]; } else { $value = 0; } } break; case 'cleartext': if (isset($_POST[$postkey])) { $value = sanitize($_POST[$postkey], 0); } else { $value = ''; } break; case 'chkbox': $value = (int) isset($_POST[$postkey]); break; case 'save': $customHandlers[] = array('whom' => $key, 'extension' => sanitize($_POST[$posted])); continue 2; default: if (isset($_POST[$postkey])) { $value = sanitize($_POST[$postkey], 1); } else { if (isset($_POST[$key])) { $value = sanitize($_POST[$key], 1); } else { $value = NULL; } } if (is_string($value)) { break; } continue 2; } if ($themename) { setThemeOption($key, $value, $themealbum, $themename); } else { setOption($key, $value); } } else { if (strpos($posted, 'show-') === 0) { if ($value) { $returntab .= '&' . $posted; } } } } foreach ($customHandlers as $custom) { if ($extension = $custom['extension']) { require_once getPlugin($extension . '.php'); } $whom = new $custom['whom'](); $returntab = $whom->handleOptionSave($themename, $themealbum) . $returntab; } return $returntab; }