Exemple #1
0
 function SB_SanityCheck()
 {
     $this->um =& SB_UserManager::staticInstance();
     $this->tree =& SB_Tree::staticInstance();
     $this->db =& SB_Database::staticInstance();
     if (!$this->um->isLogged() || !$this->um->isAdmin()) {
         die("Access denied!");
     }
 }
 function SB_Validator()
 {
     $this->um =& SB_UserManager::staticInstance();
     $this->tree =& SB_Tree::staticInstance();
     $this->db =& SB_Database::staticInstance();
     $this->fc =& SB_FaviconCache::staticInstance();
     if (!$this->um->setupDone || !$this->um->isLogged()) {
         echo 'Access denied!';
         die;
     }
 }
Exemple #3
0
 function SB_WriterInterface()
 {
     $this->um =& SB_UserManager::staticInstance();
     $this->SB_Converter($this->um->getParam('config', 'use_conv_engine'));
     $this->tree =& SB_Tree::staticInstance();
     // Set the default value accordingly
     $this->switches['hits'] = $this->um->getParam('config', 'use_hit_counter');
     if (!isset($_SERVER['HTTPS']) && $this->um->getParam('user', 'private_over_ssl_only')) {
         $this->tree->skipPrivate = true;
     }
     SB_Skin::set($this->um->getParam('user', 'skin'));
     $this->sw = new SB_StopWatch();
     $this->sw->start();
 }
Exemple #4
0
 function SB_CommandWindowBase()
 {
     $this->command = SB_reqVal('command');
     if (!$this->command) {
         $this->error('Missing command!');
     }
     if (strlen(SB_reqVal('button'))) {
         $this->command = SB_reqVal('button');
     }
     if (SB_reqChk('weblinks')) {
         $this->bookmarklet = true;
     }
     $this->um =& SB_UserManager::staticInstance();
     $this->tree =& SB_Tree::staticInstance();
     $this->useToolTips = $this->um->getParam('user', 'use_tooltips');
     $this->handleCommand();
 }
Exemple #5
0
 function SB_Tree_Node($rnode = null, $special = null)
 {
     $this->db =& SB_Database::staticInstance();
     $this->um =& SB_UserManager::staticInstance();
     $this->tree =& SB_Tree::staticInstance();
     $this->special = $special;
     if ($rnode) {
         // Map DB fields to class member variables
         static $map = array('nid' => 'id', 'nid_parent' => 'id_parent', 'name' => 'name', 'comment' => 'comment', 'deleted_by' => 'deleted_by', 'custom_order' => 'custom_order', 'order' => 'order', 'sort_mode' => 'sort_mode', 'type' => 'type');
         foreach ($rnode as $col => $value) {
             if (isset($map[$col])) {
                 $member = $map[$col];
                 $this->{$member} = $value;
             }
         }
     }
 }
Exemple #6
0
 function install()
 {
     $this->loadSQL('./sql/install.sql');
     if (!$this->hasErrors()) {
         require_once './inc/loader.inc.php';
         require_once './inc/tree.inc.php';
         $bm = new SB_Loader(false);
         $bm->loadFile('./sql/bookmarks_sitebar.xbel', 'xbel');
         if ($bm->success) {
             $tree =& SB_Tree::staticInstance();
             $tree->importTree(2, $bm->root, false, 'SB_cleanUpLink');
         }
         $bm = new SB_Loader(false);
         $bm->loadFile('./sql/bookmarks_websearch.xbel', 'xbel');
         if ($bm->success) {
             $tree =& SB_Tree::staticInstance();
             $tree->importTree(2, $bm->root, false, 'SB_cleanUpLink');
         }
     }
 }
Exemple #7
0
 function removeUser($uid)
 {
     $tree =& SB_Tree::staticInstance();
     $this->db->clearUserData($uid);
     $this->ignoreWarnings(true);
     $tree->deleteUsersTrees($uid);
     $this->ignoreWarnings(false);
     $groups = $this->getUserGroups($uid);
     foreach ($groups as $gid => $group) {
         $this->removeGroup($gid);
     }
     $this->db->delete('sitebar_user', array('uid' => $uid));
     return true;
 }
Exemple #8
0
 *  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/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;