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/edit.php | 121 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 www/edit.php (limited to 'www/edit.php') diff --git a/www/edit.php b/www/edit.php new file mode 100644 index 0000000..005493d --- /dev/null +++ b/www/edit.php @@ -0,0 +1,121 @@ +getBookmark(intval($bookmark), true))) { + $tplVars['error'] = sprintf(T_('Bookmark with id %s not was not found'), $bookmark); + $templateservice->loadTemplate('error.404.tpl', $tplVars); + exit(); +} else { + + if (!$bookmarkservice->editAllowed($row)) { + $tplVars['error'] = T_('You are not allowed to edit this bookmark'); + $templateservice->loadTemplate('error.500.tpl', $tplVars); + exit(); + } else if (POST_SUBMITTED != '') { + + + + if (!POST_TITLE || !POST_ADDRESS) { + $tplVars['error'] = T_('Your bookmark must have a title and an address'); + } else { + // Update bookmark + $bId = intval($bookmark); + $address = trim(POST_ADDRESS); + $title = trim(POST_TITLE); + $description = trim(POST_DESCRIPTION); + $privateNote = trim(POST_PRIVATENOTE); + $status = intval(POST_STATUS); + $tags = trim(POST_TAGS); + + if (!$bookmarkservice->updateBookmark($bId, $address, $title, $description, $privateNote, $status, $tags)) { + $tplvars['error'] = T_('Error while saving your bookmark'); + } else { + if (POST_POPUP != '') { + //$tplVars['msg'] = (POST_POPUP != '') ? '' : T_('Bookmark saved'); + $tplVars['msg'] = ''; + } elseif (POST_REFERRER != '') { + $tplVars['msg'] = T_('Bookmark saved'); + header('Location: '. POST_REFERRER); + } else { + $tplVars['msg'] = T_('Bookmark saved'); + header('Location: '. createURL('bookmarks', $currentUser->getUsername())); + } + } + } + } else { + if (POST_DELETE != '') { + // Delete bookmark + if ($bookmarkservice->deleteBookmark($bookmark)) { + if (POST_POPUP != '') { + $tplVars['msg'] = ''; + } elseif (POST_REFERRER != '') { + header('Location: '. POST_REFERRER); + } else { + header('Location: '. createURL('bookmarks', $currentUser->getUsername())); + } + } else { + $tplVars['error'] = T_('Failed to delete bookmark'); + $templateservice->loadTemplate('error.500.tpl', $tplVars); + exit(); + } + } + } + + $tplVars['popup'] = (GET_POPUP) ? GET_POPUP : null; + $tplVars['row'] =& $row; + $tplVars['formaction'] = createURL('edit', $bookmark); + $tplVars['btnsubmit'] = T_('Save Changes'); + $tplVars['showdelete'] = true; + $tplVars['referrer'] = ''; + if (isset($_SERVER['HTTP_REFERER'])) { + $tplVars['referrer'] = $_SERVER['HTTP_REFERER']; + } + $templateservice->loadTemplate('editbookmark.tpl', $tplVars); +} +?> -- cgit v1.2.3-54-g00ecf