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 drawLink(&$node, &$link, $last = false) { static $aclstrSet = false; if (!$this->arrFilled) { $this->fillArray($node); } if (!$aclstrSet) { $node->aclstr = SB_reqVal('acl'); $aclstrSet = true; } parent::drawLink($node, $link, $last); }
function commandLogIn() { if (!$this->checkCookie()) { $this->goBack(); return; } $expires = min(SB_reqVal('expires'), $this->um->getParam('config', 'max_session_time')); if (!$this->um->login(SB_reqVal('username'), SB_reqVal('pass'), $expires)) { $this->goBack(); return; } // This should handle login from translator.php, we should avoid external redirect if (SB_reqChk('forward') && strpos(SB_reqVal('forward'), '/') === false) { header('Location: ' . SB_reqVal('forward')); exit; } if (SB_reqChk('bookmarklet')) { $this->command = 'Add Bookmark'; $this->fields = $this->buildAddBookmark(); } else { $this->reload = true; $this->close = true; } }
function commandPaste() { $targetID = SB_reqValInt('nid_acl'); $sourceId = SB_reqVal('sid', true); $sourceIsNode = SB_reqVal('stype', true); $move = SB_reqVal('mode', true) == 'Move'; $this->executePaste($targetID, $sourceId, $sourceIsNode, $move, SB_reqVal('content')); }
function drawBody() { $where = array('ms.uid' => $this->um->uid, '^1' => "AND m.mid=ms.mid AND flag<>'deleted' AND", 'folder' => $this->folder); $res = $this->db->select('*, m.uid sender, ms.uid recipient', 'sitebar_message m, sitebar_message_folder ms', $where); $midRecs = $this->db->fetchRecords($res); $command = SB_reqVal('command'); $webMids = SB_reqVal('mid'); $seenMid = array(); foreach ($midRecs as $rec) { $mid = $rec['mid']; $uid = $rec['sender']; $fromuser = $this->um->getUser($uid); $role = $rec['role']; $to = $rec['to_label']; $date = $rec['sent']; $expires = $rec['expires']; $from = ''; $subject = $rec['subject']; $message = $rec['message']; $format = $rec['format']; $folder = $rec['folder']; $flag = $rec['flag']; if (isset($seenMid[$mid])) { continue; } $seenMid[$mid] = 1; if (isset($webMids[$mid])) { if ($this->folder == 'outbox') { if (isset($command['back'])) { $this->db->delete('sitebar_message', array('mid' => $mid)); $this->db->delete('sitebar_message_folder', array('mid' => $mid)); continue; } if (isset($command['expire'])) { $this->db->update('sitebar_message_folder', array('flag' => 'expired'), array('mid' => $mid)); } if (isset($command['delete'])) { $this->update($mid, 'outbox', 'deleted'); continue; } } else { if (isset($command['mark'])) { $flag = 'read'; $this->update($mid, 'inbox', 'read'); if ($this->ajax) { echo $mid . ';read'; } } if (isset($command['unmark'])) { $flag = 'seen'; $this->update($mid, 'inbox', 'seen'); if ($this->ajax) { echo $mid . ';new'; } } if (isset($command['save'])) { $this->update($mid, 'saved'); continue; } if (isset($command['delete'])) { $this->update($mid, null, 'deleted'); continue; } } } switch ($as) { case 'admins': $from = SB_T('Administrators') . ' (' . $fromuser['fullname'] . ')'; break; case 'moderator': $gid = intval($this->db->getData('messenger', $mid . '_gid')); if (!$this->um->isModerator($gid)) { continue; } $group = $this->um->getGroup($gid); $from = SB_T('Moderator of %s Group', $group['name']) . ' (' . $fromuser['fullname'] . ')'; break; default: $from = $fromuser['fullname']; break; } if ($this->folder == 'inbox' || $this->folder == 'saved') { $from = "<a title='" . SB_T('Reply') . "' href='command.php?command=Send Message to User&uid={$uid}&inre={$mid}'>" . $from . "</a>"; } if ($format == 'html') { $message = stripslashes($message); } else { $message = "<pre>" . $message . "</pre>"; } $highlight = ''; $isnew = false; if ($folder == 'inbox' && ($flag == 'new' || $flag == 'seen')) { $this->displayedNew++; $highlight = ' highlight'; $isnew = true; if ($flag == 'new') { $this->update($mid, 'inbox', 'seen'); } } $img = SB_Page::relBaseUrl() . sprintf('skins/msg_%s.gif', $isnew ? 'new' : 'read'); $checkbox = "<input class='checkBox' type='checkbox' name='mid[{$mid}]'>"; if (!$this->ajax) { ?> <div id='message<?php echo $mid; ?> ' class='message'> <table class='cmnMenu'> <tr> <td class='icon'><img id="img<?php echo $mid; ?> " src="<?php echo $img; ?> " <?php if ($this->folder == 'inbox') { ?> onclick='SB_messengerToggleItem(this,<?php echo $mid; ?> )'<?php } ?> ></td> <td class='cmnMenuItem<?php echo $highlight; ?> '><?php echo SB_T('From'); ?> </td> <td><?php echo $from; ?> </td> </tr> <?php if ($this->folder == 'outbox' && $to) { ?> <tr> <td class='check'><?php echo $checkbox; $checkbox = ' '; ?> </td> <td class='cmnMenuItem<?php echo $highlight; ?> '><?php echo SB_T('To'); ?> </td> <td><?php echo $to; ?> </td> </tr> <?php } ?> <tr> <td class='check'><?php echo $checkbox; ?> </td> <td class='cmnMenuItem<?php echo $highlight; ?> '><?php echo SB_T('Date'); ?> </td> <td><?php echo $date; ?> </td> </tr> <tr> <td class='status'> </td> <td class='cmnMenuItem<?php echo $highlight; ?> '><?php echo SB_T('Subject'); ?> </td> <td> <?php echo stripslashes($subject); ?> </td> </tr> <?php if ($this->folder == 'outbox') { if ($expires != '0000-00-00 00:00:00') { ?> <tr> <td class='check'> </td> <td class='cmnMenuItem'><?php echo SB_T('Expiration'); ?> </td> <td><?php echo $expires; ?> </td> </tr> <?php } $states = array('inbox_new' => 'messenger::state_unread', 'inbox_seen' => 'messenger::state_seen', 'inbox_read' => 'messenger::state_read', 'saved' => 'messenger::state_saved', 'deleted' => 'messenger::state_deleted', 'expired' => 'messenger::state_expired'); $statesWhere = array('inbox_new' => "folder='inbox' AND flag='new'", 'inbox_seen' => "folder='inbox' AND flag='seen'", 'inbox_read' => "folder='inbox' AND flag='read'", 'saved' => "folder='saved'", 'deleted' => "folder='trash'", 'expired' => "folder='expired'"); $breakdown = ''; foreach ($states as $status => $label) { $res = $this->db->select('count(*) count', 'sitebar_message_folder', "mid={$mid} AND " . $statesWhere[$status]); $countRec = $this->db->fetchRecord($res); if ($countRec['count'] > 0) { if (SB_reqVal('drill') == $status && is_string($webMids) && $mid == $webMids) { if ($breakdown != '') { $breakdown .= '<br>'; } $breakdown .= SB_P($label) . ": "; $res = $this->db->select('uid', 'sitebar_message_folder', "mid={$mid} AND " . $statesWhere[$status]); foreach ($this->db->fetchRecords($res) as $uidRec) { $user = $this->um->getUser($uidRec['uid']); if ($this->um->isAdmin()) { $breakdown .= '<a href="command.php?command=Modify%20User&uid=' . $uidRec['uid'] . '">' . $user['username'] . '</a> '; } else { $breakdown .= $user['username'] . ' '; } } $breakdown .= "<br>"; } else { $breakdown .= '<a class="states" href="' . $this->getUrl(array('folder' => $this->folder, 'mid' => $mid, 'drill' => $status)) . '">' . SB_P($label) . '</a> [' . $countRec['count'] . '] '; } } } ?> <tr> <td class='status'> </td> <td class='cmnMenuItem'><?php echo SB_T("Status"); ?> </td> <td><?php echo $breakdown; ?> </td> </tr> <?php } ?> <tr> <td class='message' colspan='3'><?php echo $message; ?> </td> </tr> </table> </div> <?php } } if ($this->folder == 'inbox' && is_array($command)) { $this->db->lock($tables = array('sitebar_data' => 'WRITE', 'sitebar_user_data' => 'WRITE')); $this->db->setUserData('messenger', $this->um->uid, 'new', $this->displayedNew); $this->db->unlock(); } }
$meta = '<meta http-equiv="refresh" content="0;url=integrator.php?lang=' . SB_GetLanguage() . '">'; } SB_Page::head('Integrator', 'siteBarIndex', null, null, $meta); if (isset($_GET['url'])) { exit; } // Include skin hook file include_once SB_Skin::path() . '/hook.inc.php'; $hook = new SB_Hook(); $sponsor = new SB_SponsorInterface($hook); $file = './inc/sponsor.inc.php'; if (is_file($file)) { include_once $file; $sponsor = new SB_Sponsor($hook); } $browser = SB_reqVal('browser'); $browsers = array('firefox' => array('label' => 'Mozilla Firefox', 'homepage' => 'http://www.mozilla.org/products/firefox/', 'platforms' => '9.0/All', 'usage' => '', 'exclude' => array(), 'extra' => array('sitebar_client', 'sitebar', 'sidebar', 'livebookmarks', 'search_engine', 'iframe', 'google')), 'konqueror' => array('label' => 'Konqueror', 'homepage' => 'http://www.konqueror.org/', 'platforms' => '3.x/Linux', 'usage' => '', 'exclude' => array(), 'extra' => array('sidebar_konqueror', 'iframe', 'google')), 'opera' => array('label' => 'Opera Web Browser', 'homepage' => 'http://www.opera.com/', 'platforms' => '9.5/WinXP', 'usage' => SB_P('integrator::usage_opera'), 'exclude' => array('dir'), 'extra' => array('hotlist', 'iframe', 'google')), 'msie' => array('label' => 'Microsoft Internet Explorer', 'homepage' => 'http://www.microsoft.com/windows/ie/default.mspx', 'platforms' => '8.0/Windows', 'usage' => '', 'exclude' => array(), 'extra' => array('install', 'uninstall', 'searchbar', 'iframe', 'google')), 'maxthon' => array('label' => 'Maxthon Tabbed Browser', 'homepage' => 'http://www.maxthon.com/', 'platforms' => '1.1.120/WinXP', 'usage' => '', 'exclude' => array(), 'extra' => array('maxthon_sidebar', 'maxthon_toolbar', 'iframe', 'google')), 'other' => array('label' => 'Linux Distro/Other Tools', 'homepage' => '', 'platforms' => 'Gentoo,Debian/PHP Layers Menu', 'usage' => '', 'exclude' => array('dir', 'window', 'popup', 'addpage'), 'extra' => array('gentoo', 'debian', 'phplm'))); $bookmarklet = "javascript:var w=window;var d=w.document;var cp=d.characterSet?d.characterSet:d.charset;" . "w.open('" . SB_Page::absBaseUrl() . "command.php?command=Add%20Bookmark" . "&url='+escape(w.location.href)+'" . "&name='+escape(d.title)+" . "(cp?'&cp='+cp:''),'sbBmkWin','" . $um->getParamB64('user', 'popup_params') . "');void(0)"; $popup = "javascript:window.open('" . SB_Page::absBaseUrl() . "index.php" . "?target=_blank','sbPopWin'," . "'directories=no,width=220,height=600,left=0,top=0,scrollbars=yes,location=no,menubar=no, status=no, toolbar=no');void(0)"; $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
<?php /****************************************************************************** * SiteBar 3 - The Bookmark Server for Personal and Team Use. * * Copyright (C) 2005-2008 Ondrej Brablc <http://brablc.com/mailto?o> * * * * This program is free software: you can redistribute it and/or modify * * it under the terms of the GNU Affero General Public License as published * * by the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU Affero General Public License for more details. * * * * You should have received a copy of the GNU Affero General Public License * * along with this program. If not, see <http://www.gnu.org/licenses/>. * ******************************************************************************/ require_once './inc/errorhandler.inc.php'; require_once './inc/page.inc.php'; $pluginDir = SB_reqVal('name', true); SB_safePath($pluginDir); require './plugins/' . $pluginDir . '/index.inc.php';
function commandProperties() { if (SB_reqVal('private')) { $link = $this->tree->getLink(SB_reqValInt('lid_acl')); if (!$link) { return; } if (!$this->tree->inMyTree($link->id_parent)) { $this->um->accessDenied(); return; } } $limit = $this->um->getParam('config', 'comment_limit'); if ($limit && $limit < strlen(SB_reqVal('comment'))) { $this->error('The description length exceeds maximum length of %s bytes!', array($limit)); return; } $favicon = SB_reqVal('favicon'); if ($this->um->getParam('config', 'use_favicon_cache')) { require_once './inc/faviconcache.inc.php'; $fc =& SB_FaviconCache::staticInstance(); if (preg_match("/^data:image\\/(.*?);base64,(.*)\$/", $favicon, $reg)) { $favicon = $fc->saveFaviconBase64($reg[2]); } else { // Delete old URL favicon from cache on update to allow new version $fc->purge(SB_reqValInt('lid_acl')); } } $update = array('name' => SB_reqVal('name'), 'url' => SB_reqVal('url'), 'favicon' => $favicon, 'target' => SB_reqVal('link_target'), 'private' => SB_reqVal('private') ? 1 : 0, 'is_feed' => SB_reqVal('is_feed') ? 1 : 0, 'comment' => SB_reqVal('comment'), 'validate' => SB_reqVal('novalidate') ? 0 : 1); if (SB_reqVal('is_dead') && !SB_reqVal('is_dead_check')) { $update['is_dead'] = 0; } $this->tree->updateLink(SB_reqValInt('lid_acl', true), $update); }
function commandSendMessagetoModerators() { $to = $this->um->getMembers(SB_reqVal('command_gid', true), true); $this->_commandMessengerCommon($to, true); }
function checkMandatoryFields($fields) { $ok = true; foreach ($fields as $field) { if (!SB_reqVal($field)) { $ok = false; } } if (!$ok) { $this->error('Please fill mandatory fields!'); $this->goBack(); } return $ok; }
function _buildExportUrl() { $url = SB_Page::absBaseUrl() . 'index.php'; $params = array(); if (!SB_reqChk('sd')) { $params[] = 'sd=0'; } if (!SB_reqChk('hits') && $this->um->getParam('config', 'use_hit_counter')) { $params[] = 'hits=0'; } // Add value foreach (array('w', 'sort', 'username', 'pass', 'max', 'len', 'cmd', 'exr', 'igp', 'flat', 'cp', 'mix') as $check) { if (SB_reqChk($check) && strlen(SB_reqVal($check))) { if ($check == 'w' && SB_reqVal($check) == 'sitebar') { continue; } if ($check == 'sort' && SB_reqVal($check) == 'custom') { continue; } if ($check == 'cp' && SB_reqVal($check) == 'utf-8') { continue; } $params[] = $check . '=' . SB_reqVal($check); } } if (SB_reqChk('nid_acl') && SB_reqValInt('nid_acl') > 0) { $params[] = 'root=' . SB_reqValInt('nid_acl'); } if (count($params)) { $url .= '?' . implode('&', $params); } return $url; }
$writerObj->tree->maxLevel = 0; } foreach ($writerObj->switches as $key => $value) { if (SB_reqChk($key) && strlen(SB_reqVal($key))) { $writerObj->switches[$key] = SB_reqVal($key); } } if (SB_reqChk('user')) { $user = $writerObj->switches['user']; if (strlen($user)) { $writerObj->um->setCookie('SB3USER', $user, 0); } else { $writerObj->um->setCookie('SB3USER'); } } else { if (isset($_COOKIE['SB3USER'])) { $writerObj->switches['user'] = $_COOKIE['SB3USER']; } } if (SB_reqChk('cp')) { $writerObj->setCharset(SB_reqVal('cp')); } $writerObj->run(); exit; } } header('Content-Type: text/html'); echo "Unknown SiteBar writer was selected!"; if (SB_ErrorHandler::hasErrors()) { SB_ErrorHandler::writeErrors(); }