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 writeMenuItem($id, &$itemArray) { static $expertMode = null; if ($expertMode === null) { $expertMode = $this->um->getParam('user', 'expert_mode'); } $command = SB_safeVal($itemArray, 'name'); $link = SB_safeVal($itemArray, 'href'); $callback = SB_safeVal($itemArray, 'callback'); $acl = SB_safeVal($itemArray, 'acl'); $optional = SB_safeVal($itemArray, 'optional', false); $more = SB_safeVal($itemArray, 'more', false); $class = 'item'; if (!$command) { $class .= ' separator'; } else { if ($optional && !$expertMode) { $class .= ' optional'; } } $div = "\t" . '<div id="' . $id . '" class="' . $class . '"'; if ($command) { $div .= ' onmouseover="SB_itemOn(this);"' . ' onmouseout="SB_itemOff(this);"'; } if ($command && !$link) { $div .= ' x_acl="' . $acl . '"' . ' x_cmd="' . $command . '"'; } echo $div . '>'; if ($link) { static $target; if ($target == null) { $target = SB_Page::target(); } if (strstr($link, 'http') !== 0) { $link = SB_Page::absBaseUrl() . $link; } echo '<a class="menuLink" href="' . $link . '"' . $target . '>'; } else { echo '<a href="javascript:SB_itemDoAlt(\'' . $id . '\'' . ($callback ? ',\'' . $callback . '\'' : '') . ')">'; } echo SB_T($command); if ($command == 'Log Out') { echo ' (' . $this->um->username . ')'; } if ($link) { echo '</a>'; } echo "</div>\r"; }
function Configuration() { $this->file = './adm/' . $this->base; if (file_exists($this->file)) { $this->checkStructure(); return; } if (isset($_REQUEST['command'])) { $this->command = $_REQUEST['command']; $this->host = SB_safeVal($_REQUEST, 'host'); $this->name = SB_safeVal($_REQUEST, 'name'); $this->user = SB_safeVal($_REQUEST, 'username'); $this->pass = SB_safeVal($_REQUEST, 'password'); $this->pass2 = SB_safeVal($_REQUEST, 'repeat'); $config = <<<__END \$SITEBAR = array ( 'db' => array ( 'host' => '{$this->host}', 'username' => '{$this->user}', 'password' => '{$this->pass}', 'name' => '{$this->name}', ), 'baseurl' => null, 'login_as' => null, ); __END; $this->config = '<' . "?php\n" . $config . "\n?" . ">\n"; } if ($this->command) { if ($this->checkParams() && $this->command != 'Check Settings') { $shortname = str_replace(' ', '', $this->command); $execute = 'command' . $shortname; $this->{$execute}(); } } $this->writeConfig(); }
function loadNodes(&$parent, $loadLinks = true, $right = 'select', $includeHidden = false) { // If we are deleted then do not load child nodes if ($parent->deleted_by) { return; } $rset = $this->db->select(null, 'sitebar_node', array('nid_parent' => $parent->id, '^1' => 'AND', 'deleted_by' => null), 'name'); // COLLATE utf8_general_ci while ($rnode = $this->db->fetchRecord($rset)) { $node = new SB_Tree_Node($rnode); if ($node->deleted_by) { continue; } $node->setParent($parent); if (($this->expandedNodes == null || SB_safeVal($this->expandedNodes, $node->id) == 'Y') && ($this->maxLevel == -1 || $parent->level < $this->maxLevel) || !$node->hasRight($right)) { // Must be twice inside this function: occurence 1 // - here it limits the depth $this->loadNodes($node, $loadLinks, $right, $includeHidden); } // If we have direct right or visible children if (($node->hasRight($right) || $node->childrenCount()) && ($includeHidden || !isset($this->um->hiddenFolders[$node->id]))) { // Must be twice inside this function: occurence 2 // - here it ensures it is properly stored for frontend $node->setParent($parent); $parent->addNode($node); } } if ($loadLinks) { $this->loadLinks($parent); } }
static function isGECKO() { static $isGECKO = null; if ($isGECKO === null) { $isGECKO = strstr(SB_safeVal($_SERVER, 'HTTP_USER_AGENT'), 'Gecko'); } return $isGECKO; }
function initUser(&$rec) { $this->user = $rec; $this->uid = $rec['uid']; $this->username = $rec['username']; $this->email = $rec['email']; $this->name = SB_safeVal($rec, 'name'); $this->comment = SB_safeVal($rec, 'comment'); $this->verified = $rec['verified']; $this->approved = $rec['approved']; $this->demo = $rec['demo']; $this->explodeParams($rec['params'], 'user'); if ($this->getParam('user', 'use_hiding') && $this->getParam('user', 'hidden_folders')) { $ids = explode(':', $this->getParam('user', 'hidden_folders')); $this->hiddenFolders = array(); foreach ($ids as $id) { $this->hiddenFolders[$id] = 1; } } }
function handleUnknownTag($xmlTag) { if ($xmlTag['tag'] == "metadata" && isset($xmlTag['attributes']) && isset($xmlTag['attributes']['SyncPlaces'])) { $attr = $xmlTag['attributes']; $this->bookmarksToolbarFolder = SB_safeVal($attr, 'BookmarksToolbarFolder'); $this->unfiledBookmarksFolder = SB_safeVal($attr, 'UnfiledBookmarksFolder'); } return; }
* * * 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/tree.inc.php'; require_once './inc/usermanager.inc.php'; $tree = SB_Tree::staticInstance(); $link = $tree->getLink($_GET['id']); // We allow redirect only as long as the original link exists if ($link) { $node = $tree->getNode($link->id_parent); $acl =& $node->getACL(); $url = isset($_GET['url']) ? $_GET['url'] : ''; // But if it has been changed, we only let authorized users to see the new value if ($acl && $acl['allow_select']) { $url = $link->getUrl(); } if (strlen($url)) { $url = str_replace('%SEARCH%', SB_safeVal($_COOKIE, 'SB3SEARCH'), $url); $tree->countVisit($link); header('Location: ' . $url); exit; } } header('Content-type: text/plain; charset=utf-8'); print SB_T('Access denied!');
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 writeForm() { $customButton = false; if ($this->useToolTips) { ?> <div id='toolTip'></div> <?php } ?> <form method="POST" enctype="multipart/form-data" action="<?php echo FORM_ACTION_EXECUTOR; ?> "> <input type="hidden" name="command" value="<?php echo $this->command; ?> "> <input type="hidden" name="button" value=""> <input type="hidden" name="referer" value="<?php echo $this->getReferer(); ?> "> <?php foreach ($this->persistentParams as $param) { $value = SB_safeVal($_REQUEST, $param); if ($value) { ?> <input type="hidden" name="<?php echo $param; ?> " value="<?php echo $value; ?> "> <?php } } $enabled = false; // Add missing propeties $hasOptional = $this->enrichFields() && !$this->um->getParam('user', 'expert_mode'); $this->writeFields($optional = false, $customButton, $enabled); if ($hasOptional) { ?> <div id="showMore" onclick='SB_toggleMore(true);'><?php echo SB_T('Show Advanced Controls'); ?> </div> <div id="showLess" onclick='SB_toggleMore(false);'><?php echo SB_T('Hide Advanced Controls'); ?> </div> <div id="optionalFields"> <?php } $this->writeFields($optional = true, $customButton, $enabled); if ($hasOptional) { ?> </div> <?php } if (!$customButton) { ?> <div class="buttons"> <input class="button" type="submit" name="do" value="<?php echo SB_T('Submit'); ?> "> <?php if ($enabled) { ?> <input class="button" type="reset" value="<?php echo SB_T('Reset'); ?> "> <?php } ?> </div> <?php } ?> </form> <?php }
function buildExportBookmarks() { $fields = array(); $writers = array(); $dirName = './inc/writers'; $dir = opendir($dirName); require_once './inc/writer.inc.php'; while (($fileName = readdir($dir)) !== false) { if (preg_match('/(\\w+)\\.inc\\.php$/i', $fileName, $reg)) { $name = $reg[1]; require_once $dirName . '/' . $fileName; if (!SB_safeVal($SB_writer_hidden, $name)) { $writers[$name] = array(SB_safeVal($SB_writer_title, $name), SB_safeVal($SB_writer_default, $name)); } } } closedir($dir); asort($writers); $fields['Select Output Format'] = array('name' => 'writer', 'type' => 'callback', 'function' => '_buildFeedBuildList', 'params' => array('name' => 'w', 'title' => SB_T('Select Output Format'), 'values' => $writers)); if (SB_Page::isMSIE()) { $fields['-raw1-'] = SB_P('command::export_bk_ie_hint') . '<br>'; } $fields['Codepage'] = array('type' => 'callback', 'function' => '_buildCodepage'); $fields['Sort Mode'] = array('name' => 'sort', 'type' => 'select', '_options' => '_buildFolderSortMode', '_select' => 'custom'); $fields['Order of Folders v. Bookmarks'] = array('name' => 'mix', 'type' => 'select', '_options' => '_buildMixMode', '_select' => $this->um->getParam('user', 'mix_mode')); $fields['Limit Number of Bookmarks'] = array('name' => 'max'); $fields['Limit Description Length'] = array('name' => 'len'); if ($this->um->getParam('config', 'use_hit_counter')) { $fields['Use Hit Counter'] = array('name' => 'hits', 'type' => 'checkbox', 'title' => SB_P('command::tooltip_hits')); } $fields['Exclude Root Folder'] = array('name' => 'exr', 'type' => 'checkbox', 'title' => SB_P('command::tooltip_exclude_root')); $fields['Ignore Private Bookmarks'] = array('name' => 'igp', 'type' => 'checkbox', 'title' => SB_P('command::tooltip_private')); $fields['Include Subfolders'] = array('name' => 'sd', 'type' => 'checkbox', 'checked' => null, 'title' => SB_P('command::tooltip_subdir')); $fields['Flatten the Hierarchy'] = array('name' => 'flat', 'type' => 'checkbox', 'title' => SB_P('command::tooltip_flat')); if (!SB_reqChk('doall')) { $fields['-hidden1-'] = array('name' => 'nid_acl', 'value' => SB_reqValInt('nid_acl')); } else { $fields['-hidden1-'] = array('name' => 'doall', 'value' => 1); } $fields['Add SiteBar Commands'] = array('name' => 'cmd', 'type' => 'checkbox', 'title' => SB_P('command::tooltip_cmd')); $fields['Download Bookmarks'] = array('type' => 'button'); $fields['Username'] = array('name' => 'username'); $fields['Password (visible to others)'] = array('name' => 'pass'); $fields['Show Feed URL'] = array('type' => 'button'); if (!count($writers)) { $this->error("No feed available!"); } return $fields; }
exit; } require_once './inc/writer.inc.php'; $writer = 'sitebar'; if (SB_reqChk('w')) { $writer = SB_reqVal('w'); } else { if (!SB_reqChk('uniq')) { require_once './inc/usermanager.inc.php'; $um =& SB_UserManager::staticInstance(); $ua = $um->getParamB64('config', 'web_search_user_agents'); if (strlen($ua)) { if ($ua[0] != '/') { $ua = '/' . $ua . '/i'; } if (preg_match($ua, SB_safeVal($_SERVER, 'HTTP_USER_AGENT'))) { $writer = 'sitebar_plain'; } } } } if (strstr($writer, 'xbel2')) { $writer = 'dir'; } if ($writer && !strstr($writer, '.')) { $writerFile = './inc/writers/' . $writer . '.inc.php'; if (is_file($writerFile)) { require_once $writerFile; eval('$writerObj = new SB_Writer_' . $writer . '();'); if (SB_reqChk('sort')) { $sortMode = SB_reqVal('sort');