Example #1
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]++;
}
Example #2
0
You should have received a copy of the GNU General Public License
along with GetBoo; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
***************************************************************************/
// Based on Scuttle API classes
// Force HTTP authentication first!
require_once 'httpauth.inc.php';
include "../config.inc.php";
include "../includes/bookmarks.php";
$user = new User();
$userName = $user->getUsername();
// Note that del.icio.us only errors out if no URL was passed in; there's no error on attempting
// to delete a bookmark you don't have.
// Error out if there's no address
if (is_null($_REQUEST['url'])) {
    $deleted = false;
} else {
    $result = b_url_exist($_REQUEST['url'], $userName);
    if ($result['exists']) {
        $bid = $result['bId'];
        delete_bookmark($bid, "../");
        $deleted = true;
    } else {
        $deleted = false;
    }
}
// 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="' . ($deleted ? 'done' : 'something went wrong') . '" />';
Example #3
0
     } else {
         $newPublic = false;
     }
     $tags = $_POST["tags"];
 }
 $folderid = $_POST["folderid"];
 //New folder vars
 $newfoldertitle = $_POST["newfoldertitle"];
 $newfolderdesc = $_POST["newfolderdesc"];
 if ($folderid != null && $title != null && $url != null) {
     //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;
     }
     include "includes/bookmarks.php";
     $result = b_url_exist($url, $username);
     if (!$result['exists']) {
         include 'conn.php';
         include 'includes/protection.php';
         //Check if we need to add a folder and that the parent folder is not a group folder
         if ($newfoldertitle != null && !isGroupFolder($folderid)) {
             $newfoldertitle = filter($newfoldertitle);
             $newfolderdesc = filter($newfolderdesc);
             // Cut data to respect maximum length
             $newfoldertitle = substr($newfoldertitle, 0, 30);
             $newfolderdesc = substr($newfolderdesc, 0, 150);
             $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');
         }
Example #4
0
 $success = false;
 if ($_POST['submitted']) {
     if (TAGS) {
         if (!empty($_POST['publicChk'])) {
             $newPublic = true;
         } else {
             $newPublic = false;
         }
         $tags = $_POST["tags"];
     }
     if ($id != null && $url != null) {
         //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;
         }
         $result = b_url_exist($url, $username, $id);
         if (!$result['exists']) {
             //strip out html
             $title = filter($title);
             $description = filter($description);
             $url = filter($url);
             // Cut data to respect maximum length
             if (!empty($title)) {
                 $title = substr($title, 0, 100);
             }
             if (!empty($description)) {
                 $description = substr($description, 0, 150);
             }
             if (TAGS) {
                 include 'includes/tags_functions.php';
                 $tags = trim($tags);