Пример #1
0
/**
 * Script to make a bookmark add-form popup.
 */
function bookmarks_script()
{
    require_lang('bookmarks');
    $type = get_param('type');
    switch ($type) {
        case '_ad':
            $title = get_page_title('ADD_BOOKMARK');
            $folder = post_param('folder_new', '');
            if ($folder == '') {
                $folder = post_param('folder');
            }
            if ($folder == '!') {
                $folder = '';
            }
            add_bookmark(get_member(), $folder, post_param('title'), post_param('page_link'));
            $content = inform_screen($title, do_lang_tempcode('SUCCESS'));
            $content->attach('<script type="text/javascript">// <![CDATA[
				if (window.opener) window.close();
			//]]></script>');
            break;
        default:
            $url = find_script('bookmarks') . '?no_redirect=1&type=_ad';
            $keep = symbol_tempcode('KEEP');
            $url .= $keep->evaluate();
            $content = add_bookmark_form($url);
            break;
    }
    $echo = do_template('POPUP_HTML_WRAP', array('TITLE' => do_lang_tempcode('ADD_BOOKMARK'), 'CONTENT' => $content));
    $echo->handle_symbol_preprocessing();
    $echo->evaluate_echo();
}
Пример #2
0
 function setUp()
 {
     parent::setUp();
     require_code('bookmarks');
     $this->bookmark_id = add_bookmark(4, "xyz", "abc", "www.xyz.com");
     // Test the forum was actually created
     $this->assertTrue('abc' == $GLOBALS['SITE_DB']->query_value('bookmarks', 'b_title ', array('id' => $this->bookmark_id)));
 }
Пример #3
0
<?php

header('Content-Type: text/javascript');
include __DIR__ . '/init.php';
echo 'bml.innerHTML=\'<p style="font-family:\\\'Lucida Sans Unicode\\\',\\\'Lucida Grande\\\',\\\'wenquanyi micro hei\\\',\\\'droid sans fallback\\\',FreeSans,Helvetica,Arial,\\\'hiragino sans gb\\\',\\\'stheiti\\\',\\\'microsoft yahei\\\',\\\\5FAE\\\\8F6F\\\\96C5\\\\9ED1,sans-serif !important;float:right !important;margin:0 0 0 10px !important;padding:0 !important;line-height:27px !important;font-size:14px !important;position:inherit !important;"><a style="font-family:\\\'Lucida Sans Unicode\\\',\\\'Lucida Grande\\\',\\\'wenquanyi micro hei\\\',\\\'droid sans fallback\\\',FreeSans,Helvetica,Arial,\\\'hiragino sans gb\\\',\\\'stheiti\\\',\\\'microsoft yahei\\\',\\\\5FAE\\\\8F6F\\\\96C5\\\\9ED1,sans-serif !important;margin:0 !important;padding:0 !important;line-height:27px !important;font-size:14px !important;text-decoration:none !important;color:#00c !important;display:inline-block !important;border:none !important;position:inherit !important;" href="javascript:;" onclick="var bml=document.getElementById(\\\'spbkmk\\\');if(bml.style.maxHeight==\\\'56px\\\'){bml.style.setProperty(\\\'max-height\\\',\\\'none\\\',\\\'important\\\');this.innerHTML=\\\'Collapse\\\';}else{bml.style.setProperty(\\\'max-height\\\',\\\'56px\\\',\\\'important\\\');this.innerHTML=\\\'Expand\\\';}">Expand</a> / <a style="font-family:\\\'Lucida Sans Unicode\\\',\\\'Lucida Grande\\\',\\\'wenquanyi micro hei\\\',\\\'droid sans fallback\\\',FreeSans,Helvetica,Arial,\\\'hiragino sans gb\\\',\\\'stheiti\\\',\\\'microsoft yahei\\\',\\\\5FAE\\\\8F6F\\\\96C5\\\\9ED1,sans-serif !important;margin:0 !important;padding:0 !important;line-height:27px !important;font-size:14px !important;text-decoration:none !important;color:#00c !important;display:inline-block !important;border:none !important;position:inherit !important;" href="javascript:;" onclick="var bml=document.getElementById(\\\'spbkmk\\\');bml.parentNode.removeChild(bml);">Close</a></p>\';';
if (!$auth) {
    echo 'bml.innerHTML=\'<div style="margin:0 10px !important;">\'+bml.innerHTML+\'<p style="margin:0 !important;padding:0 !important;line-height:27px !important;font-size:14px !important;text-align:center !important;">Please <a href="' . $site_url . '" target="_blank">log in</a></p></div>\';';
    exit;
}
if (isset($_GET['entry']) && $_GET['entry']) {
    if (preg_match('/<a (?:[^>]*\\s)*href\\s*=\\s*(?:"|\')([^"\']*)(?:"|\')[^>]*>([^<]+)<\\/a>/i', urldecode($_GET['entry']), $matches)) {
        $entry = add_bookmark($matches[1], isset($_GET['folder']) ? $_GET['folder'] : '_0', 'url', $bookmark_json, isset($matches[2]) ? preg_replace('/<[^>]+>/', '', $matches[2]) : null);
    }
}
$cache_file = $cache_dir . 'bookmarkbar' . (isset($_GET['folder']) ? $_GET['folder'] : '_0') . '.html';
if (file_exists($cache_file) && filemtime($cache_file) >= filemtime($bookmark_json)) {
    echo file_get_contents($cache_file);
    exit;
}
ob_start();
$bookmarks = parse_bookmark_json($bookmark_json);
$bookmarks = $bookmarks[0]['entries'];
if (isset($_GET['folder'])) {
    $levels = explode('_', substr($_GET['folder'], 1));
    foreach ($levels as $level) {
        $bookmarks = $bookmarks['_' . $level]['entries'];
    }
}
// output bookmarks
foreach ($bookmarks as $entry) {
    if ($entry['type'] == 'url') {
Пример #4
0
function startElement($parser, $name, $attrs)
{
    global $depth, $status, $tplVars, $username;
    if ($name == 'POST') {
        while (list($attrTitle, $attrVal) = each($attrs)) {
            switch ($attrTitle) {
                case 'HREF':
                    $bAddress = $attrVal;
                    break;
                case 'DESCRIPTION':
                    $bTitle = $attrVal;
                    break;
                case 'EXTENDED':
                    $bDescription = $attrVal;
                    break;
                case 'TIME':
                    $bDatetime = $attrVal;
                    break;
                case 'TAG':
                    $tags = strtolower($attrVal);
                    break;
            }
        }
        $result = b_url_exist($bAddress, $username);
        if ($result['exists']) {
            $tplVars['error'] = T_('You have already submitted this bookmark.');
        } else {
            // Strangely, PHP can't work out full ISO 8601 dates, so we have to chop off the Z.
            $bDatetime = substr($bDatetime, 0, -1);
            // If bookmark claims to be from the future, set it to be now instead
            if (strtotime($bDatetime) > time()) {
                $bDatetime = date('Y-m-d H:i:s');
            }
            $resultArr = add_bookmark($username, $bTitle, MAIN_FID, $bAddress, $bDescription, $tags, true, $bDatetime);
            if ($resultArr['success']) {
                $tplVars['msg'] = T_('Bookmark imported.');
            } else {
                $tplVars['error'] = T_('There was an error saving your bookmark. Please try again or contact the administrator.');
            }
        }
    }
    $depth[$parser]++;
}
Пример #5
0
     $Query = sprintf("INSERT INTO " . TABLE_PREFIX . "folders (Name , Title , Description , PID) " . "values('" . $username . "', %s, %s, " . $folderid . ") ", quote_smart($newfoldertitle), quote_smart($newfolderdesc));
     //echo($Query . "<br>\n");
     $AffectedRows = $dblink->exec($Query);
     $folderid = $dblink->lastInsertID(TABLE_PREFIX . "folders", 'ID');
 }
 if ($title != null) {
     $title = filter($title);
 }
 if ($description != null) {
     $description = filter($description);
 }
 if ($url != null) {
     $url = filter($url);
 }
 //add bookmark
 $resultArr = add_bookmark($username, $title, $folderid, $url, $description, $tags, $newPublic);
 $success = $resultArr['success'];
 if ($success) {
     if ($easybook) {
         $Query = "\r\n\t\t\t\t\t\t\t\t\t\t\t\tINSERT INTO " . TABLE_PREFIX . "ebhints\r\n\t\t\t\t\t\t\t\t\t\t\t\t( Popup , Name , Time , IP )\r\n\t\t\t\t\t\t\t\t\t\t\t\tVALUES\r\n\t\t\t\t\t\t\t\t\t\t\t\t('{$popup}', '{$username}', NOW(), '" . $_SERVER['REMOTE_ADDR'] . "')\r\n\t\t\t\t\t\t\t\t\t\t\t\t";
         $dbResult = $dblink->query($Query);
         //Clean up session data
         $_SESSION['g_title'] = null;
         $_SESSION['g_url'] = null;
         $_SESSION['g_desc'] = null;
         $_SESSION['popup'] = null;
         if ($popup) {
             echo "<p class=\"success\">" . T_("The bookmark was added") . ".</p>";
             //Insert javascript to close the window
             echo "<script language=\"javascript\"> setTimeout(\"window.close()\", 1500); </script>";
         } else {
Пример #6
0
$mails = getmails($conn);
if ($mails) {
    foreach ($mails as $mail) {
        $header = $mail[0];
        $body = $mail[1]['content'];
        $note = false;
        if (($header['recent'] == 'N' || $header['unseen'] == 'U') && $header['deleted'] !== 'D' && $header['draft'] !== 'X' && isset($header['from'][0]['addr']) && $header['from'][0]['addr'] && $allowed_mail && in_array($header['from'][0]['addr'], $allowed_mail)) {
            if ($body) {
                $folder = '_0';
                if ($header['subject']) {
                    $bookmark = parse_bookmark_json($bookmark_json);
                    $bookmark = $bookmark[0]['entries'];
                    foreach ($bookmark as $entry) {
                        if ($entry['type'] == 'folder' && strtolower($header['subject']) == strtolower($entry['name'])) {
                            $folder = '_' . $entry['id'];
                            break;
                        }
                    }
                }
                if (preg_match('/<a (?:[^>]*\\s)*href\\s*=\\s*(?:"|\')([^"\']*)(?:"|\')[^>]*>([^<]+)<\\/a>/i', $body, $matches)) {
                    $body = $matches[1];
                }
                $entry = add_bookmark($body, $folder, 'url', $bookmark_json);
            }
        }
        imap_delete($conn, $header['msgno']);
    }
}
imap_expunge($conn);
imap_close($conn);
exit;
Пример #7
0
#wrap p{color:#fff !important;font-size:16px !important;text-align:center !important;margin:4px 0 !important;}
#cancel{position:absolute !important;top:0px !important;right:0px !important;background:white !important;color:black !important;font-size:13px !important;font-weight:bold !important;text-align:center !important;line-height:1em !important;margin:0 !important;padding:0 !important;width:13px !important;height:13px !important;border-radius:13px !important;border:2px solid #000 !important;}
#cancel:hover{cursor:pointer !important;}
</style>
</head>
<body>
<div id="wrap">
<div id="cancel" onclick="window.top.postMessage('spb_close', '<?php 
echo urldecode($_GET['href']);
?>
');" title="Cancel">
x
</div>
<?php 
if ($auth && (isset($_GET['d']) && $_GET['d'] !== '_' || isset($_POST['d']))) {
    if (add_bookmark(urldecode($_GET['u']), isset($_POST['d']) ? $_POST['d'] : $_GET['d'], 'url', $bookmark_json, isset($_GET['n']) && $_GET['n'] ? urldecode($_GET['n']) : null)) {
        echo '<p>Bookmark added</p>';
    } else {
        echo '<p>Error</p>';
    }
    echo '<script>
var stoptime=3;
setTimeout("spbclose()",stoptime*1000);
function spbclose(){window.top.postMessage(\'spb_close\', \'' . urldecode($_GET['href']) . '\');}
</script>';
} else {
    $url = 'bookmarklet.php?';
    $i = 0;
    foreach ($_GET as $key => $value) {
        $url .= ($i ? '&' : '') . $key . '=' . urlencode($value);
        $i++;
Пример #8
0
 /**
  * The actualiser to add a bookmark.
  *
  * @return tempcode		The UI
  */
 function _ad()
 {
     $title = get_page_title('ADD_BOOKMARK');
     $folder = post_param('folder_new', '');
     if ($folder == '') {
         $folder = post_param('folder');
     }
     if ($folder == '!') {
         $folder = '';
     }
     add_bookmark(get_member(), $folder, post_param('title'), post_param('page_link'));
     if (get_param_integer('do_redirect') == 1) {
         $url = build_url(array('page' => '_SELF', 'type' => 'misc'), '_SELF');
         return redirect_screen($title, $url, do_lang_tempcode('SUCCESS'));
     } else {
         return inform_screen($title, do_lang_tempcode('SUCCESS'));
     }
 }
Пример #9
0
            case 'sort':
                if (isset($_GET['id']) && $_GET['id']) {
                    $entry = sort_bookmark($_GET['id'], $_GET['sort'], isset($_GET['recursive']) ? $_GET['recursive'] : 0, $bookmark_json);
                    $anchor = $_GET['id'] == '_0' ? '' : $_GET['id'];
                }
                break;
            case 'export':
                header('Content-Type: text/plain');
                readfile($bookmark_json);
                exit;
        }
        header('Location: index.php' . (isset($anchor) && $anchor ? '#entry-' . $anchor : ''));
        exit;
    } elseif (isset($_GET['u'])) {
        $url = addhttp(urldecode(substr($_SERVER['QUERY_STRING'], 2)));
        $entry = add_bookmark($url, '_0', 'url', $sync_json, null, 1);
        echo '<html><body><script>if (window.confirm("URL synced to ' . htmlentities($site_name) . '. Redirect to ' . htmlentities($site_name) . '?")) {window.location="' . $site_url . '";} else {window.location="' . $url . '";}</script></body></html>';
        //header('Location: '.$url);
        exit;
    }
}
?>

<?php 
// Head
?>
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
Пример #10
0
} else {
    $dt = NULL;
}
include "../config.inc.php";
include "../includes/bookmarks.php";
require_once "../includes/protection.php";
$user = new User();
$userName = $user->getUsername();
//Make sure the url starts with http:// in the event the user's browser doesn't support javascript
if (strpos($url, ':') === false) {
    $url = 'http://' . $url;
}
//print_r($GLOBALS);
// Require address and description
if (is_null($url) || is_null($title)) {
    $added = false;
} else {
    // Check that it doesn't exist already
    $result = b_url_exist($url, $userName);
    if ($result['exists']) {
        $added = false;
        // If not, try to add it
    } else {
        $resultArr = add_bookmark($userName, $title, MAIN_FID, $url, $description, $tags, true, $dt);
        $added = $resultArr['success'];
    }
}
// Set up the XML file and output the result.
header('Content-Type: text/xml');
echo '<?xml version="1.0" standalone="yes" ?' . ">\r\n";
echo '<result code="' . ($added ? 'done' : 'something went wrong') . '" />';