示例#1
0
    $bookmark_id = (int) $request->get('bookmark_id');
}
$vUrl = new Valid_String('bookmark_url');
$vUrl->setErrorMessage('Url is required');
$vUrl->required();
$vTitle = new Valid_String('bookmark_title');
$vTitle->setErrorMessage('Title is required');
$vTitle->required();
$bookmark_url_id = '/my/bookmark_edit.php?bookmark_id=' . $bookmark_id;
$csrf_token = new CSRFSynchronizerToken($bookmark_url_id);
if ($request->isPost() && $request->valid($vUrl) && $request->valid($vTitle)) {
    $csrf_token->check();
    $bookmark_url = $request->get('bookmark_url');
    $bookmark_title = $request->get('bookmark_title');
    my_check_bookmark_URL($bookmark_url, $bookmark_url_id);
    bookmark_edit($bookmark_id, $bookmark_url, $bookmark_title);
    $GLOBALS['Response']->redirect('/my');
}
$purifier = Codendi_HTMLPurifier::instance();
$HTML->header(array("title" => $Language->getText('bookmark_edit', 'title')));
print "<H3>" . $Language->getText('bookmark_edit', 'title') . "</H3>\n";
$result = db_query("SELECT * from user_bookmarks where " . "bookmark_id=" . db_ei($bookmark_id) . " and user_id=" . db_ei(user_getid()));
if ($result) {
    $bookmark_url = db_result($result, 0, 'bookmark_url');
    $bookmark_title = db_result($result, 0, 'bookmark_title');
}
?>
<FORM METHOD="POST">
<?php 
echo $Language->getText('bookmark_add', 'bkm_url');
?>
示例#2
0
 *
 * You should have received a copy of the GNU General Public License
 * along with GForge; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
require_once '../env.inc.php';
require_once $gfwww . 'include/pre.php';
require_once $gfwww . 'include/bookmarks.php';
$bookmark_id = getIntFromRequest('bookmark_id');
if (!$bookmark_id) {
    exit_missing_param();
}
if (getStringFromRequest('submit')) {
    $bookmark_url = getStringFromRequest('bookmark_url');
    $bookmark_title = getStringFromRequest('bookmark_title');
    if ($bookmark_url && $bookmark_title && bookmark_edit($bookmark_id, $bookmark_url, $bookmark_title)) {
        $feedback = _('Bookmark Updated');
    } else {
        $feedback = _('Failed to update bookmark.');
    }
}
site_user_header(array('title' => _('Edit Bookmark')));
$result = db_query("SELECT * from user_bookmarks where " . "bookmark_id='" . $bookmark_id . "' and user_id='" . user_getid() . "'");
if ($result) {
    $bookmark_url = db_result($result, 0, 'bookmark_url');
    $bookmark_title = db_result($result, 0, 'bookmark_title');
}
?>
<form action="<?php 
echo getStringFromServer('PHP_SELF');
?>