From 29422fa55379aa61a61019b832c83dab6d450264 Mon Sep 17 00:00:00 2001 From: cweiske Date: Sat, 3 Oct 2009 14:00:33 +0000 Subject: move files to new locations git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@386 b3834d28-1941-0410-a4f8-b48e95affb8f --- www/api/export_csv.php | 47 +++++++++++++++++++++++++ www/api/export_gcs.php | 66 +++++++++++++++++++++++++++++++++++ www/api/export_html.php | 54 +++++++++++++++++++++++++++++ www/api/export_sioc.php | 90 ++++++++++++++++++++++++++++++++++++++++++++++++ www/api/httpauth.inc.php | 33 ++++++++++++++++++ www/api/opensearch.php | 18 ++++++++++ www/api/posts_add.php | 83 ++++++++++++++++++++++++++++++++++++++++++++ www/api/posts_all.php | 48 ++++++++++++++++++++++++++ www/api/posts_dates.php | 40 +++++++++++++++++++++ www/api/posts_delete.php | 34 ++++++++++++++++++ www/api/posts_get.php | 61 ++++++++++++++++++++++++++++++++ www/api/posts_public.php | 48 ++++++++++++++++++++++++++ www/api/posts_recent.php | 62 +++++++++++++++++++++++++++++++++ www/api/posts_update.php | 25 ++++++++++++++ www/api/tags_get.php | 26 ++++++++++++++ www/api/tags_rename.php | 37 ++++++++++++++++++++ 16 files changed, 772 insertions(+) create mode 100644 www/api/export_csv.php create mode 100644 www/api/export_gcs.php create mode 100644 www/api/export_html.php create mode 100644 www/api/export_sioc.php create mode 100644 www/api/httpauth.inc.php create mode 100644 www/api/opensearch.php create mode 100644 www/api/posts_add.php create mode 100644 www/api/posts_all.php create mode 100644 www/api/posts_dates.php create mode 100644 www/api/posts_delete.php create mode 100644 www/api/posts_get.php create mode 100644 www/api/posts_public.php create mode 100644 www/api/posts_recent.php create mode 100644 www/api/posts_update.php create mode 100644 www/api/tags_get.php create mode 100644 www/api/tags_rename.php (limited to 'www/api') diff --git a/www/api/export_csv.php b/www/api/export_csv.php new file mode 100644 index 0000000..2389642 --- /dev/null +++ b/www/api/export_csv.php @@ -0,0 +1,47 @@ +getBookmarks(0, NULL, $userservice->getCurrentUserId(), $tag, NULL, getSortOrder()); + +header("Content-Type: application/csv-tab-delimited-table;charset=UTF-8"); +header("Content-disposition: filename=exportBookmarks.csv"); + +//columns titles +echo 'url;title;tags;description'; +echo "\n"; + +foreach($bookmarks['bookmarks'] as $row) { + if (is_null($row['bDescription']) || (trim($row['bDescription']) == '')) + $description = ''; + else + $description = filter(str_replace(array("\r\n", "\n", "\r"),"", $row['bDescription']), 'xml'); + + $taglist = ''; + if (count($row['tags']) > 0) { + foreach($row['tags'] as $tag) + $taglist .= convertTag($tag) .','; + $taglist = substr($taglist, 0, -1); + } else { + $taglist = 'system:unfiled'; + } + + echo '"'.filter($row['bAddress'], 'xml') .'";"'. filter($row['bTitle'], 'xml') .'";"'. filter($taglist, 'xml') .'";"'. $description .'"'; + echo "\n"; +} + + +?> diff --git a/www/api/export_gcs.php b/www/api/export_gcs.php new file mode 100644 index 0000000..6f1f4c2 --- /dev/null +++ b/www/api/export_gcs.php @@ -0,0 +1,66 @@ +isAdmin($userservice->getCurrentUserId())) { + die(T_('You are not allowed to do this action (admin access)')); + }*/ + +// Check if queried format is xml +if (isset($_REQUEST['xml']) && (trim($_REQUEST['xml']) == 1)) +$xml = true; +else +$xml = false; + +// Check to see if a tag was specified. +if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != '')) +$tag = trim($_REQUEST['tag']); +else +$tag = NULL; + +// Get the posts relevant to the passed-in variables. +$bookmarks =& $bookmarkservice->getBookmarks(0, NULL, NULL, $tag, NULL, getSortOrder()); + + +// Set up the plain file and output all the posts. +header('Content-Type: text/plain'); +if(!$xml) { + header('Content-Type: text/plain'); + foreach($bookmarks['bookmarks'] as $row) { + if(checkUrl($row['bAddress'], false)) { + echo $row['bAddress']."\n"; + } + } +} else { + header('Content-Type: application/xml'); + echo ''."\n"; + echo ' '."\n"; + foreach($bookmarks['bookmarks'] as $row) { + //if(substr($row['bAddress'], 0, 7) == "http://") { + if(checkUrl($row['bAddress'], false)) { + echo ' '."\n"; + echo ' '."\n"; + } + } + echo ' '."\n"; + echo ''."\n"; +} + +?> diff --git a/www/api/export_html.php b/www/api/export_html.php new file mode 100644 index 0000000..55553c2 --- /dev/null +++ b/www/api/export_html.php @@ -0,0 +1,54 @@ +getBookmarks(0, NULL, $userservice->getCurrentUserId(), $tag, NULL, getSortOrder()); + + +// Set up the XML file and output all the posts. +echo ''."\r\n"; +echo ''; +echo ''."\r\n"; +echo 'Bookmarks'."\r\n"; +echo '

Bookmarks for '. htmlspecialchars($currentUser->getUsername()) .''. (is_null($tag) ? '' : ' tag="'. htmlspecialchars($tag) .'"') ." from " . $sitename ."

\r\n"; +echo '

'."\r\n"; + + + +foreach($bookmarks['bookmarks'] as $row) { + if (is_null($row['bDescription']) || (trim($row['bDescription']) == '')) + $description = ''; + else + $description = 'description="'. filter($row['bDescription'], 'xml') .'" '; + + $taglist = ''; + if (count($row['tags']) > 0) { + foreach($row['tags'] as $tag) + $taglist .= convertTag($tag) .','; + $taglist = substr($taglist, 0, -1); + } else { + $taglist = 'system:unfiled'; + } + + echo "\t

" . filter($row['bTitle'], 'xml') ."\r\n"; +} + + +echo '

'; +?> diff --git a/www/api/export_sioc.php b/www/api/export_sioc.php new file mode 100644 index 0000000..746d0ea --- /dev/null +++ b/www/api/export_sioc.php @@ -0,0 +1,90 @@ + +"; ?> + + + + + + + +?> + +getObjectUsers(); + +$usersArray = array(); // useful for bookmarks display +foreach($users as $user) { + $usersArray[$user->getId()] = $user->getUserName(); +} +?> + + + + getUserName() ?> + + + + + + Authors at PlanetRDF.com + + +*/ +?> + +getBookmarks(0, NULL, NULL, NULL); +?> + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/api/httpauth.inc.php b/www/api/httpauth.inc.php new file mode 100644 index 0000000..5dd7444 --- /dev/null +++ b/www/api/httpauth.inc.php @@ -0,0 +1,33 @@ +isLoggedOn()) { + /* Maybe we have caught authentication data in $_SERVER['REMOTE_USER'] + ( Inspired by http://www.yetanothercommunitysystem.com/article-321-regle-comment-utiliser-l-authentification-http-en-php-chez-ovh ) */ + if((!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW'])) + && preg_match('/Basic\s+(.*)$/i', $_SERVER['REMOTE_USER'], $matches)) { + list($name, $password) = explode(':', base64_decode($matches[1])); + $_SERVER['PHP_AUTH_USER'] = strip_tags($name); + $_SERVER['PHP_AUTH_PW'] = strip_tags($password); + } + + if (!isset($_SERVER['PHP_AUTH_USER'])) { + authenticate(); + } else { + $login = $userservice->login($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']); + if (!$login) { + authenticate(); + } + } +} +?> diff --git a/www/api/opensearch.php b/www/api/opensearch.php new file mode 100644 index 0000000..a6f79f8 --- /dev/null +++ b/www/api/opensearch.php @@ -0,0 +1,18 @@ + + + + + + + UTF-8 + + Jan Seifert "jan.seifert@uid.com" + semanticscuttle bookmark web + data:image/gif;base64,R0lGODlhEAAQAMZ9ANaPE9mREteTHtSXLdmXIdiXJtaYKdiYJ9iYKNeaLtKdP9CdRd2dLNWfQuWiFMqjX9+hNMykXt6jPOCkPM2oaM+paeCpQuGoR+OqOeKpR+GqS9+uWeSwU+ayS+uzOeWxVeWxWOSyWOu0POazXOS0YOm8Zee8cOy+WOm9a/jBLum+bPbCNurAbe7BYuvBc/LDV/LEV+zEdv/KKf/KLP/KLf/LLuzHe//MNP/NN/nMTv/OOf/OPP/OP/jNW//PPvnOVv/QQv7QRv/QRP/RR/HOhP/SSf/STPnRav/TT//TUPfScf/UUvzUXP/UVP/VV/bTfv/WWf/WW//WXP7XYf/XX//XYP/YZPPVmf/ZZv/ZZ/vYeP/aaf/aa//abP/abf/abvvaef/bb//bcfzbfP/ccv/cc//cdP/cdf/dd//deP/def3egP/ee//efP/efv/ffv/ggf/gg//ghP/ghfrfmv/hif/ii//ijP/jkfzjm//kkv7klv/lmP///////////yH5BAEKAH8ALAAAAAAQABAAAAergH+Cg38hhIeHIFcmiIgDLnt0Go2EE1pyd0QbjQMQDC9bZGprKBcjA4IfAQMrQUhOVFlhaGNPMRl/Aw4yMzc7QkZNUlZdZmASqAJKcW1WPDpARUtQUx0RgyR5fHpzUTU4PkMiqIMVNnh2c25lSTQpAIgqdXJvaWReXz0JiCxwbWhiuGCp8uMAohJszhw5AYMJlBwFEHFoYQHBAwUEMHgwgKjBA0QLKFAaKSgQADs= + + + diff --git a/www/api/posts_add.php b/www/api/posts_add.php new file mode 100644 index 0000000..ba3e02c --- /dev/null +++ b/www/api/posts_add.php @@ -0,0 +1,83 @@ + 2) { + $status = 0; + } + } else { + switch ($status_str) { + case 'private': + $status = 2; + break; + case 'shared': + $status = 1; + break; + default: + $status = 0; + break; + } + } +} + +// Error out if there's no address or description +if (is_null($url) || is_null($description)) { + $added = false; +} else { +// We're good with info; now insert it! + if ($bookmarkservice->bookmarkExists($url, $userservice->getCurrentUserId())) + $added = false; + else + $added = $bookmarkservice->addBookmark($url, $description, $extended, '', $status, $tags, $dt, true); +} + +// Set up the XML file and output the result. +header('Content-Type: text/xml'); +echo '\r\n"; +echo ''; +?> \ No newline at end of file diff --git a/www/api/posts_all.php b/www/api/posts_all.php new file mode 100644 index 0000000..4ecbd7e --- /dev/null +++ b/www/api/posts_all.php @@ -0,0 +1,48 @@ +getBookmarks(0, NULL, $userservice->getCurrentUserId(), $tag); + +// Set up the XML file and output all the posts. +header('Content-Type: text/xml'); +echo '\r\n"; +echo '\r\n"; + +foreach($bookmarks['bookmarks'] as $row) { + if (is_null($row['bDescription']) || (trim($row['bDescription']) == '')) + $description = ''; + else + $description = 'extended="'. filter($row['bDescription'], 'xml') .'" '; + + $taglist = ''; + if (count($row['tags']) > 0) { + foreach($row['tags'] as $tag) + $taglist .= convertTag($tag) .' '; + $taglist = substr($taglist, 0, -1); + } else { + $taglist = 'system:unfiled'; + } + + echo "\t\r\n"; +} + +echo ''; +?> \ No newline at end of file diff --git a/www/api/posts_dates.php b/www/api/posts_dates.php new file mode 100644 index 0000000..d4962ff --- /dev/null +++ b/www/api/posts_dates.php @@ -0,0 +1,40 @@ +getBookmarks(0, NULL, $userservice->getCurrentUserId(), $tag); + +// Set up the XML file and output all the tags. +header('Content-Type: text/xml'); +echo '\r\n"; +echo '\r\n"; + +$lastdate = NULL; +foreach($bookmarks['bookmarks'] as $row) { + $thisdate = gmdate('Y-m-d', strtotime($row['bDatetime'])); + if ($thisdate != $lastdate && $lastdate != NULL) { + echo "\t\r\n"; + $count = 1; + } else { + $count = $count + 1; + } + $lastdate = $thisdate; +} + +echo ""; +?> \ No newline at end of file diff --git a/www/api/posts_delete.php b/www/api/posts_delete.php new file mode 100644 index 0000000..d24ba59 --- /dev/null +++ b/www/api/posts_delete.php @@ -0,0 +1,34 @@ +getBookmarkByAddress($_REQUEST['url']); + $bid = $bookmark['bId']; + $delete = $bookmarkservice->deleteBookmark($bid); + $deleted = true; +} + +// Set up the XML file and output the result. +header('Content-Type: text/xml'); +echo '\r\n"; +echo ''; +?> \ No newline at end of file diff --git a/www/api/posts_get.php b/www/api/posts_get.php new file mode 100644 index 0000000..34d192e --- /dev/null +++ b/www/api/posts_get.php @@ -0,0 +1,61 @@ +getBookmarks(0, NULL, $userservice->getCurrentUserId(), $tag, NULL, NULL, NULL, $dtstart, $dtend); + + +// Set up the XML file and output all the tags. +header('Content-Type: text/xml'); +echo '\r\n"; +echo '\r\n"; + +foreach($bookmarks['bookmarks'] as $row) { + if (is_null($row['bDescription']) || (trim($row['bDescription']) == '')) + $description = ''; + else + $description = 'extended="'. filter($row['bDescription'], 'xml') .'" '; + + $taglist = ''; + if (count($row['tags']) > 0) { + foreach($row['tags'] as $tag) + $taglist .= convertTag($tag) .' '; + $taglist = substr($taglist, 0, -1); + } else { + $taglist = 'system:unfiled'; + } + + echo "\t\r\n"; +} + +echo ''; +?> \ No newline at end of file diff --git a/www/api/posts_public.php b/www/api/posts_public.php new file mode 100644 index 0000000..f7aa955 --- /dev/null +++ b/www/api/posts_public.php @@ -0,0 +1,48 @@ +getBookmarks(0, NULL, NULL, $tag); + +// Set up the XML file and output all the posts. +header('Content-Type: text/xml'); +echo '\r\n"; +echo '\r\n"; + +foreach($bookmarks['bookmarks'] as $row) { + if (is_null($row['bDescription']) || (trim($row['bDescription']) == '')) + $description = ''; + else + $description = 'extended="'. filter($row['bDescription'], 'xml') .'" '; + + $taglist = ''; + if (count($row['tags']) > 0) { + foreach($row['tags'] as $tag) + $taglist .= convertTag($tag) .' '; + $taglist = substr($taglist, 0, -1); + } else { + $taglist = 'system:unfiled'; + } + + echo "\t\r\n"; +} + +echo ''; +?> diff --git a/www/api/posts_recent.php b/www/api/posts_recent.php new file mode 100644 index 0000000..daa9d39 --- /dev/null +++ b/www/api/posts_recent.php @@ -0,0 +1,62 @@ + $countMax) + $count = $countMax; + elseif ($count < 0) + $count = 0; +} else { + $count = $countDefault; +} + +// Get the posts relevant to the passed-in variables. +$bookmarks =& $bookmarkservice->getBookmarks(0, $count, $userservice->getCurrentUserId(), $tag); + + +// Set up the XML file and output all the tags. +header('Content-Type: text/xml'); +echo '\r\n"; +echo '\r\n"; + +foreach($bookmarks['bookmarks'] as $row) { + if (is_null($row['bDescription']) || (trim($row['bDescription']) == '')) + $description = ''; + else + $description = 'extended="'. filter($row['bDescription'], 'xml') .'" '; + + $taglist = ''; + if (count($row['tags']) > 0) { + foreach($row['tags'] as $tag) + $taglist .= convertTag($tag) .' '; + $taglist = substr($taglist, 0, -1); + } else { + $taglist = 'system:unfiled'; + } + + echo "\t\r\n"; +} + +echo ''; +?> \ No newline at end of file diff --git a/www/api/posts_update.php b/www/api/posts_update.php new file mode 100644 index 0000000..6ea50e2 --- /dev/null +++ b/www/api/posts_update.php @@ -0,0 +1,25 @@ +getBookmarks(0, 1, $userservice->getCurrentUserId()); + + +// Set up the XML file and output all the tags. +header('Content-Type: text/xml'); +echo '\r\n"; +foreach($bookmarks['bookmarks'] as $row) { + echo ''; +} +?> \ No newline at end of file diff --git a/www/api/tags_get.php b/www/api/tags_get.php new file mode 100644 index 0000000..cee36ee --- /dev/null +++ b/www/api/tags_get.php @@ -0,0 +1,26 @@ +getTags($userservice->getCurrentUserId()); + +// Set up the XML file and output all the tags. +header('Content-Type: text/xml'); +echo '\r\n"; +echo "\r\n"; +foreach($tags as $row) { + echo "\t\r\n"; +} +echo ""; +?> diff --git a/www/api/tags_rename.php b/www/api/tags_rename.php new file mode 100644 index 0000000..dd16339 --- /dev/null +++ b/www/api/tags_rename.php @@ -0,0 +1,37 @@ +) than the other API calls. + +// Force HTTP authentication first! +require_once('httpauth.inc.php'); +require_once('../header.inc.php'); + +/* Service creation: only useful services are created */ +$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService'); + +// Get the tag info. +if (isset($_REQUEST['old']) && (trim($_REQUEST['old']) != '')) + $old = trim($_REQUEST['old']); +else + $old = NULL; + +if (isset($_REQUEST['new']) && (trim($_REQUEST['new']) != '')) + $new = trim($_REQUEST['new']); +else + $new = NULL; + +if (is_null($old) || is_null($new)) { + $renamed = false; +} else { + // Rename the tag. + $result = $b2tservice->renameTag($userservice->getCurrentUserId(), $old, $new, true); + $renamed = $result; +} + +// Set up the XML file and output the result. +header('Content-Type: text/xml'); +echo '\r\n"; +echo ''. ($renamed ? 'done' : 'something went wrong') .''; +?> -- cgit v1.2.3-54-g00ecf