function SB_Writer_search() { parent::__construct(); $this->switches['flat'] = 1; $this->tree->sortMode = 'hits'; $this->search = SB_safeVal($_COOKIE, 'SB3SEARCH'); if (SB_reqChk('q') != '') { $this->search = SB_reqVal('q'); } $this->type = $this->um->getParam('user', 'default_search'); // Check search pattern if (preg_match("/^(url|desc|name|all):(.*)\$/i", $this->search, $matches)) { $this->type = $matches[1]; // If we have pattern then use it if ($this->type == 'url' || $this->type == 'desc' || $this->type == 'name' || $this->type == 'all') { $this->search = $matches[2]; } } $url = $this->um->getParamB64('user', 'search_engine_url'); $url = str_replace('%SEARCH%', $this->search, $url); $url = str_replace('%BASEURL%', urlencode(SB_Page::absBaseUrlShort()), $url); $url = str_replace('%LOGO%', urlencode(SB_Page::absBaseUrl() . SB_Skin::imgsrc('logo')), $url); $this->engineURL = $url; // We would not get here if no engine is specified if ($this->um->getParam('user', 'hide_xslt') || SB_reqVal("web") == 1) { header('Location: ' . $this->engineURL); exit; } }
function drawHead() { $this->drawXMLPI(); $this->drawTagOpen('rss', array('version' => '2.0', 'xmlns:rss' => 'http://purl.org/rss/2.0/')); $this->drawTagOpen('channel'); $this->drawTag('title', null, $this->quoteText($this->getTitle())); $desc = $this->settingsValue('feed_desc') . ' ' . SB_Page::absBaseUrl(); $this->drawTag('description', null, $this->quoteText($desc)); $this->drawTagOpen('image'); $this->drawTag('title', null, $this->quoteText($this->getTitle())); $this->drawTag('url', null, SB_Page::absBaseUrl() . SB_Skin::imgsrc('root_transparent')); $this->drawTag('link', null, $this->settingsValue('feed_link')); $this->drawTagClose('image'); $this->drawTag('link', null, $this->settingsValue('feed_link')); $this->drawTag('managingEditor', null, $this->quoteText($this->settingsValue('feed_managing_editor'))); $this->drawTag('webMaster', null, $this->quoteText($this->settingsValue('feed_webmaster'))); $this->drawTag('copyright', null, $this->quoteText($this->settingsValue('feed_copyright'))); $this->drawTag('language', null, str_replace('_', '-', $this->um->getParam('user', 'lang'))); $this->drawTag('generator', null, 'SiteBar ' . SB_CURRENT_RELEASE . ' (Bookmark Server; http://sitebar.org/)'); // Time to live in minutes $this->drawTag('ttl', null, '60'); }
static function img($filename, $prefix = '', $id = '', $class = null) { $imgid = ''; if ($prefix) { $imgid = ' id="i' . $prefix . $id . '"'; } return '<img' . ($class ? ' class="' . $class . '"' : '') . $imgid . ' src="' . SB_Skin::imgsrc($filename) . '" alt="">'; }
$urlParts = parse_url(SB_Page::absBaseUrl()); $uniqName = preg_replace("/[^\\w]*/", "", $urlParts['host']); $extra = array('sitebar_client' => array('label' => 'SiteBar Client', 'url' => 'https://addons.mozilla.org/firefox/3605/', 'desc' => SB_P('integrator::hint_sitebar')), 'livebookmarks' => array('label' => 'Live Bookmarks', 'url' => sprintf('%sindex.php?w=firefox&mode=download', SB_Page::absBaseUrl()), 'desc' => SB_P('integrator::hint_livebookmarks')), 'sidebar' => array('label' => 'Sidebar', 'url' => sprintf("javascript:sidebar.addPanel('SiteBar','%sindex.php','')", SB_Page::absBaseUrl()), 'desc' => SB_P('integrator::hint_sidebar')), 'search_engine' => array('label' => 'Add Search Engine', 'url' => sprintf("javascript:void(window.sidebar.addSearchEngine('%s', '%s', '%s', '%s'))", SB_Page::absBaseUrl() . 'integrator.php?lang=' . SB_GetLanguage() . '&search_engine=/sitebar' . $uniqName . '.src', SB_Page::absBaseUrl() . '' . SB_Skin::imgsrc('root_transparent') . '?rename=/sitebar' . $uniqName . '.png', strlen($um->getParamB64('config', 'feed_root_name')) ? $um->getParamB64('config', 'feed_root_name') : 'SiteBar', SB_T("Bookmarks")), 'desc' => SB_P('integrator::hint_search_engine')), 'sidebar_mozilla' => array('label' => 'Sidebar', 'url' => sprintf("javascript:sidebar.addPanel('SiteBar','%sindex.php','')", SB_Page::absBaseUrl()), 'desc' => SB_P('integrator::hint_sidebar_mozilla')), 'sidebar_konqueror' => array('label' => 'Sidebar', 'url' => null, 'desc' => SB_P('integrator::hint_sidebar_konqueror', SB_Page::absBaseUrl())), 'hotlist' => array('label' => 'Add to Panel', 'url' => SB_Page::absBaseUrl() . 'index.php', 'params' => array('title' => 'SiteBar', 'rel' => 'sidebar'), 'desc' => SB_P('integrator::hint_hotlist')), 'install' => array('label' => 'Install', 'url' => 'integrator.php?lang=' . SB_GetLanguage() . '&install=1', 'desc' => SB_P('integrator::hint_install')), 'uninstall' => array('label' => 'Uninstall', 'url' => 'integrator.php?lang=' . SB_GetLanguage() . '&install=0', 'desc' => SB_P('integrator::hint_uninstall')), 'searchbar' => array('label' => 'Show in Search Bar', 'url' => sprintf("javascript:void(_search=open('%sindex.php','_search'))", SB_Page::absBaseUrl()), 'desc' => SB_P('integrator::hint_searchbar')), 'maxthon_sidebar' => array('label' => 'Sidebar Plugin', 'url' => sprintf("http://sitebar.org/plugin/maxthon/?sidebar=%s", SB_Page::absBaseUrlShort()), 'desc' => SB_P('integrator::hint_maxthon_sidebar')), 'maxthon_toolbar' => array('label' => 'Toolbar Plugin', 'url' => sprintf("http://sitebar.org/plugin/maxthon/?toolbar=%s", SB_Page::absBaseUrlShort()), 'desc' => SB_P('integrator::hint_maxthon_toolbar')), 'gentoo' => array('label' => 'Gentoo Ebuild', 'url' => 'http://www.gentoo-portage.com/www-apps/sitebar', 'desc' => SB_P('integrator::hint_gentoo')), 'debian' => array('label' => 'Debian', 'url' => 'http://packages.debian.org/unstable/web/sitebar', 'desc' => SB_P('integrator::hint_debian')), 'phplm' => array('label' => 'PHP Layers Menu', 'url' => 'http://phplayersmenu.sourceforge.net/', 'desc' => SB_P('integrator::hint_phplm', sprintf('%sindex.php?w=phplm', SB_Page::absBaseUrl())))); $general = array('addpage' => array('label' => 'Add Page to SiteBar', 'url' => $bookmarklet, 'desc' => SB_P('integrator::hint_addpage')), 'window' => array('label' => 'SiteBar', 'url' => SB_Page::absBaseUrl() . 'index.php', 'desc' => SB_P('integrator::hint_window')), 'dir' => array('label' => 'SiteBar Directory', 'url' => SB_Page::absBaseUrl() . 'index.php?w=dir', 'desc' => SB_P('integrator::hint_dir')), 'popup' => array('label' => 'SiteBar Pop-up', 'url' => $popup, 'desc' => SB_P('integrator::hint_popup')), 'iframe' => array('label' => 'SiteBar iframe', 'url' => SB_Page::absBaseUrl() . 'iframe.php', 'desc' => str_replace('<IFRAME>', '<IFRAME>', SB_P('integrator::hint_iframe', array(SB_Page::absBaseUrl() . 'iframe.php')))), 'google' => array('label' => 'Google Widget', 'url' => SB_Page::absBaseUrl() . 'google.php', 'desc' => SB_P('integrator::hint_google', array(SB_Page::absBaseUrl() . 'google.php')))); ?> <div id="main"> <div id="launcher"> <div> <div id="home"> <a href="http://sitebar.org/"><img alt="" title="<?php echo SB_T('SiteBar Homepage'); ?> " src="<?php echo SB_Skin::imgsrc('logo'); ?> "></a> <br> [<a href="http://sitebar.org/"><?php echo SB_T('SiteBar Homepage'); ?> </a>] </div> <div id="tip"><?php echo SB_P('integrator::welcome'); ?> </div> </div>
function faviconReturn($favicon_md5, $lid = null, $refresh = false) { $ico = $this->faviconGet($favicon_md5, $lid, $refresh); // 30 days keep cached in browser $age = 60 * 60 * 24 * 30; if (!$ico) { // Sent wrong icon image SB_Skin::set($this->um->getParam('user', 'skin')); $ico = $this->file_get_contents(SB_Skin::imgsrc('link_wrong_favicon')); $age = 60 * 60 * 24; // Try tomorrow } if ($refresh) { $age = -1; } header('Accept-Ranges: bytes'); header('Cache-Control: public, max-age=' . $age); header('Content-Length: ' . strlen($ico)); $type = 'image/x-icon'; if (substr($ico, 0, 3) == 'GIF') { $type = 'image/gif'; } else { if (substr($ico, 6, 4) == 'JFIF') { $type = 'image/jpeg'; } else { if (substr($ico, 1, 3) == 'PNG') { $type = 'image/png'; } } } header('Content-Type: ' . $type); print $ico; }
function buildProperties() { $fields = array(); $link = null; if ($this->command != 'Add Bookmark') { $link = $this->tree->getLink(SB_reqValInt('lid_acl')); if (!$link) { return null; } } else { $link = new SB_Tree_Link(array()); } $fields['-hidden1-'] = array('name' => 'lid_acl', 'value' => $link->id); $fields['URL'] = array('name' => 'url'); if ($this->command != 'Delete Bookmark') { /* Show the 'Retrieve Info' button only in case it has not been yet * performed */ $fields['Get Bookmark Information'] = array('type' => 'addbutton'); $fields['-hidden4-'] = array('name' => 'origin', 'value' => $this->command); } $fields['Bookmark Name'] = array('name' => 'name', 'maxlength' => 255); $size = strlen($link->comment); $MAXSIZETOEDIT = 4096; if ($size <= $MAXSIZETOEDIT) { $fields['Description'] = array('name' => 'comment', 'type' => 'textarea'); } else { $fields['-raw1-'] = SB_T("Description too long for inplace editing, please use export feature!"); } if ($this->um->getParam('user', 'use_favicons')) { $fields['Favicon'] = array('name' => 'favicon', 'maxsize' => 32000); $fields['-raw2-'] = ''; } if (strlen(SB_reqVal('url'))) { $link->url = SB_reqVal('url'); } if ($this->getInfo && strlen(SB_reqVal('url'))) { $link->name = SB_reqVal('name'); $link->comment = SB_reqVal('comment'); $link->favicon = SB_reqVal('favicon'); /* Try to get the title and favicon */ require_once './inc/pageparser.inc.php'; $page = new SB_PageParser($link->url); if ($page->getInformation(array('CHARSET', 'TITLE', 'FAVURL', 'DESC', 'KEYWORDS'))) { $cp = 'iso-8859-1'; if ($page->errorCode['CHARSET'] < PP_ERR) { $cp = $page->info['CHARSET']; } require_once './inc/converter.inc.php'; $c = new SB_Converter($this->um->getParam('config', 'use_conv_engine'), $cp); if (!$link->name && isset($page->info['TITLE'])) { $link->name = $c->utf8RawUrlDecode($page->info['TITLE']); } if (!$link->comment && isset($page->info['DESC'])) { $link->comment = $c->utf8RawUrlDecode($page->info['DESC']); } if ($this->um->getParam('user', 'use_favicons')) { if (!$link->favicon && isset($page->info['FAVURL'])) { $link->favicon = $page->info['FAVURL']; /* Show the retrieved favicon. */ if ($this->command == 'Add Bookmark') { /* Show the retrieved favicon. */ $wrong = SB_Skin::imgsrc('link_wrong_favicon'); $fields['-raw2-'] = "<div><img class='favicon' alt='' src='" . $link->favicon . "' onerror='this.src=\"{$wrong}\"'></div>"; } else { $fields['-raw2-'] = $this->_buildFavicon(SB_reqValInt('lid_acl'), $link->favicon); } } } } } $fields['URL']['value'] = $link->url; $fields['Bookmark Name']['value'] = $link->name; $fields['Description']['value'] = $link->comment; if ($this->um->getParam('user', 'use_favicons')) { if ($this->command != 'Add Bookmark') { $favicon = $link->favicon; if (substr($link->favicon, 0, 7) == 'binary:') { require_once './inc/faviconcache.inc.php'; $fc =& SB_FaviconCache::staticInstance(); $favicon = 'data:image/x-icon;base64,' . base64_encode($fc->faviconGet($link->favicon, null)); } if ($link->favicon) { $fields['-raw2-'] = $this->_buildFavicon($link->id, $link->favicon); } } $fields['Favicon']['value'] = $link->favicon; } $size = strlen($link->comment); $MAXSIZETOEDIT = 4096; if ($size <= $MAXSIZETOEDIT) { $fields['Description'] = array('name' => 'comment', 'type' => 'textarea', 'value' => $link->comment); } else { $fields['-raw1-'] = SB_T("Description too long for inplace editing, please use export feature!"); } $fields['Feed Bookmark'] = array('name' => 'is_feed', 'type' => 'checkbox', 'title' => SB_P('command::tooltip_is_feed')); if ($link->is_feed) { $fields['Feed Bookmark']['checked'] = null; } if ($this->command == 'Add Bookmark' || $this->tree->inMyTree($link->id_parent)) { $fields['Private'] = array('name' => 'private', 'type' => 'checkbox', 'title' => SB_P('command::tooltip_private')); if ($link->private) { $fields['Private']['checked'] = null; } } if ($link->is_dead) { $fields['Dead Bookmark'] = array('name' => 'is_dead_check', 'type' => 'checkbox', 'checked' => null, 'title' => SB_P('command::tooltip_is_dead_check')); $fields['-hidden2-'] = array('name' => 'is_dead', 'type' => 'hidden', 'value' => 1); } if ($this->um->getParam('config', 'use_outbound_connection')) { $fields['Exclude From Validation'] = array('name' => 'novalidate', 'type' => 'checkbox', 'title' => SB_P('command::tooltip_novalidate')); if (!$link->validate) { $fields['Exclude From Validation']['checked'] = null; } } $fields['Target'] = array('name' => 'link_target', 'value' => $link->target); if ($this->command != 'Delete Bookmark') { if ($this->um->getParam('config', 'comment_impex') && strlen($link->comment) > 0 || strlen($link->comment) >= $MAXSIZETOEDIT) { $fields['Export Description'] = array('name' => 'command', 'type' => 'addbutton'); } if ($this->um->getParam('config', 'comment_impex')) { $fields['Import Description'] = array('name' => 'command', 'type' => 'addbutton'); } } if ($this->command == 'Properties') { $fields['Delete Bookmark'] = array('type' => 'addbutton'); } return $fields; }
function drawToolBar() { // There must not be any place between the images, therefore // those funny tag endings. $coloring = 'onmousedown="SB_buttonDown(this);" ' . 'onmouseup="SB_buttonUp(this);" ' . 'onmouseover="SB_buttonOver(this);' . ($this->useToolTips ? 'SB_toolTip(this,event);' : '') . '" ' . 'onmouseout="SB_buttonOut(this);' . ($this->useToolTips ? 'SB_toolTipHide()' : '') . ';"'; $title = $this->useToolTips ? 'x_title' : 'title'; $favicon = ''; if ($this->um->getParam('user', 'use_search_engine')) { $favicon = $this->um->getParamB64('user', 'search_engine_ico'); if ($this->um->getParam('config', 'use_favicon_cache')) { $favicon = SB_Page::cdnBaseUrl() . "favicon.php?" . md5($favicon) . '=' . base64_encode($favicon); } } $usefilter = true; ?> <div id="toolbarPlace" class="hidden"></div> <div id="toolbar" class="cmnSubTitle"> <div id="tlbSearch"><input id="fldSearch" class="siteBarPageBackground" type="text" onkeyup="SB_storeSearch(this); var e=(event?event:window.event); if (e.keyCode==13) SB_defaultSearch('<?php echo SB_Page::targetWindow(); ?> ','<?php echo $this->um->getParam('user', 'default_search_tool'); ?> ');" value="<?php echo SB_safeVal($_COOKIE, 'SB3SEARCH'); ?> "><?php if ($usefilter) { ?> <img id="btnFilter" src="<?php echo SB_Skin::imgsrc('filter'); ?> " <?php echo $title; ?> ="<?php echo SB_T('Filter Loaded Bookmarks'); ?> " onclick="SB_filter(true)" <?php echo $coloring; ?> alt="F" ><?php } if (!$this->um->getParam('user', 'hide_xslt') || $this->um->getParam('user', 'use_search_engine')) { ?> <a href="<?php echo SB_Page::absBaseUrl(); ?> search.php" <?php echo SB_Page::target(); ?> ><img id="btnSearch" src="<?php echo SB_Skin::imgsrc('search'); ?> " <?php echo $title; ?> ="<?php echo SB_T('Backend Bookmark Search'); ?> " <?php echo $coloring; ?> alt="" ></a><?php } if ($this->um->getParam('user', 'use_search_engine')) { ?> <a href="<?php echo SB_Page::absBaseUrl(); ?> search.php?web=1" <?php echo SB_Page::target(); ?> ><img id="btnSearchWeb" src="<?php echo $favicon; ?> " <?php echo $title; ?> ="<?php echo SB_T('Search Web'); ?> " <?php echo $coloring; ?> alt="" ></a><?php } ?> </div> <div id="tlbOther"><img id="btnCollapse" src="<?php echo SB_Skin::imgsrc('collapse'); ?> " <?php echo $title; ?> ="<?php echo SB_T('Collapse/Expand All'); ?> " onclick="SB_collapseAll();" <?php echo $coloring; ?> alt="" ><?php if ($this->um->getParam('user', 'use_hiding')) { ?> <img id="btnReloadAll" src="<?php echo SB_Skin::imgsrc('reload_all'); ?> " <?php echo $title; ?> ="<?php echo SB_T('Reload with Hidden Folders'); ?> " onclick="SB_reloadAll();" <?php echo $coloring; ?> alt="" ><?php } ?> <img id="btnReload" src="<?php echo SB_Skin::imgsrc('reload'); ?> " <?php echo $title; ?> ="<?php echo SB_T('Reload'); ?> " onclick="SB_reloadPage();" <?php echo $coloring; ?> alt="" ></div> </div> <?php $msgFile = "./inc/message.inc.php"; if (is_file($msgFile)) { include $msgFile; } foreach ($this->um->plugins as $plugin) { if (isset($plugin['message']) && $plugin['message']) { include $plugin['dir'] . '/message.inc.php'; } } $messageCountNew = $this->um->messengerGetNewCount(); if ($messageCountNew != 0) { $readurl = SB_Page::relBaseUrl() . 'messenger.php'; $target = SB_Page::target(); $img = SB_Page::relBaseUrl() . 'skins/msg_new.gif'; $message = ''; if ($messageCountNew == 1) { $message = SB_T("You have a new message!"); } else { $message = SB_T("You have %d new messages!", array($messageCountNew)); } echo <<<_DOC <div class="cmnSubTitle" id="messengerInformation"> <a style="width:100%; color:black; text-decoration:none;" href="{$readurl}" {$target}>{$message}<img src="{$img}"></a> </div> _DOC; } $groups = $this->um->getPendingGroups(); if (!$this->um->isAnonymous() && count($groups)) { echo <<<_DOC <div class="cmnSubTitle" id="pendingInvitation"> _DOC; foreach ($groups as $gid => $rec) { $user = $this->um->getUser($rec['invitator']); $message = SB_P('sitebar::invitation', array($user['fullname'], $rec['name'])); $ahref = SB_Page::absBaseUrl() . 'command.php?command=Accept Membership&do=yes&gid=' . $gid; $atext = SB_T('Accept'); $rhref = SB_Page::absBaseUrl() . 'command.php?command=Reject Membership&do=yes&gid=' . $gid; $rtext = SB_T('Reject'); echo <<<_DOC <div> <table> <tr> <td class='pendingInvitationLabel'>{$message}</td> <td class='pendingInvitationButtons'> <span class='accept'><a href='{$ahref}'>{$atext}</a></span><br> <span class='reject'><a href='{$rhref}'>{$rtext}</a></span> </td> </tr> </table> </div> _DOC; } } echo "</div>\n"; }
function _buildFavicon($lid, $favicon) { $wrong = SB_Skin::imgsrc('link_wrong_favicon'); $txt = ''; $binary = substr($favicon, 0, 7) == 'binary:'; if ($this->um->getParam('config', 'use_favicon_cache')) { $link = $this->tree->getLink($lid); if ($link->favicon) { $cached = 'favicon.php?'; if ($binary) { $cached .= $favicon; } else { $cached .= md5($favicon) . '=' . $lid . '&refresh=' . SB_StopWatch::getMicroTime(); } $txt .= SB_T('Cached: ') . '<img class="favicon" alt="" height=16 width=16 src="' . $cached . '" onerror="this.src=\'' . $wrong . '\'">'; $txt .= ' '; } } if (!$binary) { $txt .= SB_T("Original: ") . '<img alt="" src="' . $favicon . '" onerror="this.src=\'' . $wrong . '\'">'; } return '<div>' . $txt . "</div>\n"; }
function validate($lid, $getFavicon) { if (!$this->um->isAuthorized('Validation', false, null, null, $lid)) { echo 'Access denied!'; die; } $link = $this->tree->getLink($lid); $deadCount = $link->is_dead + 1; // Mark as dead $set = array('tested' => array('now' => ''), 'is_dead' => $deadCount < 127 ? $deadCount : 0); $this->tree->updateLink($link->id, $set, false); $page = new SB_PageParser($link->url); $page->getInformation($getFavicon ? array('FAVURL') : null); // Unmark early if not dead if (!intval($page->isDead)) { $set['is_dead'] = 0; $this->tree->updateLink($link->id, $set, false); } $location = SB_Skin::imgsrc('link'); if ($page->isDead) { $location = SB_Skin::imgsrc('link_wrong_favicon'); } else { $set = array(); if (isset($page->info['FAVURL'])) { $favicon = $page->info['FAVURL']; $set['favicon'] = $favicon; if ($this->um->getParam('config', 'use_favicon_cache')) { $location = 'favicon.php?' . md5($favicon) . '=' . $link->id; } else { $location = $favicon; } } else { if ($getFavicon) { $set['favicon'] = ''; } } if (isset($set['favicon'])) { $this->tree->updateLink($link->id, $set, false); } } header('Location: ' . $location); exit; }