Ejemplo n.º 1
0
 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;
     }
 }
Ejemplo n.º 2
0
function SB_reqValInt($name, $mandatory = false, $default = '')
{
    $is = SB_reqChk($name);
    if ($mandatory && !$is) {
        die('Expected field "' . $name . '" was not filled!');
    }
    return $is ? intval($_REQUEST[$name]) : $default;
}
Ejemplo n.º 3
0
 function Messenger()
 {
     $this->ajax = SB_reqChk('ajax');
     $this->um = SB_UserManager::staticInstance();
     SB_Skin::set($this->um->getParam('user', 'skin'));
     $this->db =& $this->um->db;
     if (SB_reqChk('folder')) {
         $this->folder = SB_reqVal('folder');
     }
 }
Ejemplo n.º 4
0
 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;
     }
 }
Ejemplo n.º 5
0
 function buildFolderProperties()
 {
     $node = $this->tree->getNode(SB_reqValInt('nid_acl', true));
     $fields = $this->buildAddFolder();
     if ($node->id_parent && !$node->parentHasRight('update')) {
         foreach ($fields as $name => $param) {
             if ($name[0] != '-') {
                 $fields[$name]['disabled'] = null;
             }
         }
     }
     $fields['Custom Order'] = array('type' => 'addbutton');
     $fields['Delete Folder'] = array('type' => 'addbutton');
     $fields['Import Bookmarks'] = array('type' => 'addbutton');
     $fields['Export Bookmarks'] = array('type' => 'addbutton');
     $fields['Validate Bookmarks'] = array('type' => 'addbutton');
     $fields['Folder Sharing'] = array('type' => 'addbutton');
     if ($node->id_parent == 0 && $this->um->isAdmin()) {
         if ($this->um->useUserFilter() && !SB_reqChk('uregexp')) {
             $fields['Filter User RegExp'] = array('name' => 'uregexp');
             $fields['-hidden-'] = array('name' => 'forward', 'value' => 'Folder Properties');
             $fields['Filter Users'] = array('type' => 'button');
         }
         if (!$this->um->useUserFilter() || SB_reqChk('uregexp')) {
             $fields['Tree Owner'] = array('name' => 'uid', 'type' => 'select', '_options' => '_buildUserList', '_select' => SB_reqVal('uid'));
         }
     }
     return $fields;
 }
Ejemplo n.º 6
0
 function commandAddBookmark()
 {
     $nid = SB_reqValInt('nid_acl', true);
     $node = $this->tree->getNode($nid);
     if (!$node) {
         return;
     }
     if (SB_reqChk('bookmarklet')) {
         if (strlen(SB_reqVal('newfolder')) > 0) {
             $newnode = $this->tree->addNode($nid, SB_reqVal('newfolder'));
             if ($this->hasErrors()) {
                 return;
             }
             $nid = $newnode;
         }
     }
     // Get values entered by the user
     $url = SB_reqVal('url');
     $favicon = SB_reqVal('favicon');
     $name = SB_reqVal('name');
     $is_feed = SB_reqVal('is_feed');
     // If we have bookmarklet we have already received the icon
     if (!SB_reqChk('bookmarklet') && !$favicon && $this->um->getParam('user', 'auto_retrieve_favicon')) {
         $this->ignoreWarnings();
         require_once './inc/pageparser.inc.php';
         $page = new SB_PageParser($url, array('FAVURL'));
         $page->getInformation(array('FAVURL'));
         $this->ignoreWarnings(false);
         if (!$page->isDead && $page->errorCode['FAVURL'] < PP_ERR) {
             $favicon = $page->info['FAVURL'];
             $favurl = 'favicon.php?' . md5($favicon) . '=' . SB_reqValInt('lid_acl');
             $this->message = SB_T('Favicon <img src="%s"> found at url %s.', array($favurl, $url));
         } else {
             $this->message = SB_T('Favicon not found!');
         }
     }
     $insert = array('name' => $name, 'url' => $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);
     $this->tree->addLink($nid, $insert);
     $this->markHasLink();
     if (SB_reqChk('bookmarklet')) {
         if (SB_reqChk('default_folder')) {
             $this->um->setParam('user', 'default_folder', $nid);
         }
         $this->um->saveUserParams();
         $this->bookmarklet = true;
         $this->nobuttons = true;
         $this->message = SB_T("Link has been added.<p>You must reload your SiteBar in order to see added link!");
     }
 }
Ejemplo n.º 7
0
 function commandSendMessagetoAll()
 {
     $to = $this->um->getUsers();
     if (SB_reqChk('gids')) {
         foreach (SB_reqVal('gids') as $gid) {
             foreach ($this->um->getMembers($gid) as $uid => $rec) {
                 if (isset($to[$uid])) {
                     unset($to[$uid]);
                 }
             }
         }
     }
     $this->_commandMessengerCommon($to);
 }
Ejemplo n.º 8
0
 function _commandSendEmail($to, $subject, $group = null)
 {
     // Prefetch to have it in our language
     $okStr = SB_T('%s - ok.');
     $errorStr = SB_T('%s - error!');
     $message = stripslashes(SB_reqVal('message'));
     foreach ($to as $uid => $user) {
         $userparams = $user['params'];
         $this->um->explodeParams($userparams, 'tmp');
         if (SB_reqVal('checkrcpt')) {
             if (SB_reqChk('respect') && !$this->um->getParam('tmp', 'allow_info_mails')) {
                 continue;
             }
             if (SB_reqChk('verified') && !$user['verified']) {
                 continue;
             }
         }
         SB_SetLanguage($this->um->getParam('tmp', 'lang'));
         $body = '';
         if ($group) {
             $body = SB_P('command::contact_group', array($group, $message, SB_Page::absBaseUrl()));
         } else {
             $body = SB_P('command::contact', array($message, SB_Page::absBaseUrl()));
         }
         if (!$this->um->email || !$this->checkEmailCorrectness($this->um->email)) {
             continue;
         }
         $ret = $this->um->sendMail($user, SB_T($subject), $body, $this->um->name, $this->um->email);
         // No translation here
         if ($ret) {
             $this->warn('%s', sprintf($okStr, $user['completenamehtml']));
         } else {
             $this->error('%s', sprintf($errorStr, $user['completenamehtml']));
         }
     }
     SB_SetLanguage($this->um->getParam('user', 'lang'));
 }
Ejemplo n.º 9
0
 function buildShowFeedURL()
 {
     $fields = array();
     $url = $this->_buildExportUrl();
     $fields['Copy'] = array('name' => 'copy', 'value' => str_replace('&amp;', '&', $url));
     $fields['-label1-'] = SB_T('Open in New Window');
     $fields['-raw1-'] = "<a href='{$url}' target='_blank'>{$url}</a>";
     $url .= '&amp;mode=plain';
     $fields['-label2-'] = SB_T('Open as Plain Text');
     $fields['-raw2-'] = "<a href='{$url}' target='_blank'>{$url}</a>";
     if (!SB_reqChk('doall')) {
         $fields['-hidden1-'] = array('name' => 'nid_acl', 'value' => SB_reqValInt('nid_acl'));
     } else {
         $fields['-hidden1-'] = array('name' => 'doall', 'value' => 1);
     }
     $fields['Export Bookmarks'] = array('type' => 'button');
     return $fields;
 }
Ejemplo n.º 10
0
            $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();
}