home *** CD-ROM | disk | FTP | other *** search
- <?php
- /*
- Copyright Intermesh 2003
- Author: Merijn Schering <mschering@intermesh.nl>
- Version: 1.0 Release date: 08 July 2003
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 2 of the License, or (at your
- option) any later version.
- */
-
- require("../../Group-Office.php");
- $GO_SECURITY->authenticate();
- require($GO_LANGUAGE->get_language_file('bookmarks'));
-
- $GO_MODULES->authenticate('bookmarks');
-
- require($GO_CONFIG->class_path."bookmarks.class.inc");
- $bookmarks = new bookmarks();
-
-
- if ($_SERVER['REQUEST_METHOD'] == "POST")
- {
-
- $URL = trim($_REQUEST['URL']);
- $name = trim($_REQUEST['name']);
- $invalid[] = "\"";
- $invalid[] = "&";
- $invalid[] = "?";
-
- if (!validate_input($name,$invalid))
- {
- $feedback = "<p class=\"Error\">".$invalid_chars.": \" & ?</p>";
- }else
- {
- if ($URL != "" && $name != "")
- {
- if (!eregi('(^http[s]*:[/]+)(.*)', $URL))
- {
- $URL= "http://".$URL;
- }
-
- $new_window = isset($_REQUEST['new_window']) ? $_REQUEST['new_window'] : 0;
-
- if (isset($_REQUEST['bookmark_id']))
- {
- if(!$bookmarks->update_bookmark($_REQUEST['bookmark_id'], $URL, $name, $new_window))
- {
- $feedback = "<p class=\"Error\">".$strSaveError."</p>";
- }else
- {
- header('Location: '.$GO_MODULES->url);
- exit();
- }
- }else
- {
- if(!$bookmarks->add_bookmark($GO_SECURITY->user_id, $URL, $name, $new_window))
- {
- $feedback = "<p class=\"Error\">".$strSaveError."</p>";
- }else
- {
- header('Location: '.$GO_MODULES->url);
- exit();
- }
- }
- }else
- {
- $feedback = "<p class=\"Error\">".$error_missing_field."</p>";
- }
- }
- }
- require($GO_THEME->theme_path."header.inc");
- ?>
- <form name="add" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
- <?php
- if (isset($_REQUEST['bookmark_id']))
- {
- echo '<input type="hidden" value="'.$_REQUEST['bookmark_id'].'" name="bookmark_id" />';
-
- $bookmark = $bookmarks->get_bookmark($_REQUEST['bookmark_id']);
- $name = $bookmark['name'];
- $URL = $bookmark['URL'];
- $check = $bookmark['new_window'] == '1' ? true : false;
- }else
- {
- $name = isset($_POST['name']) ? $_POST['name'] : '';
- $URL = isset($_POST['URL']) ? $_POST['URL'] : 'http://';
- $check = isset($_POST['new_window']) ? true : false;
- }
- $tabtable = new tabtable('bookmarks_tab', $lang_modules['bookmarks'], '300', '120', '120', '', true);
- $tabtable->print_head();
-
- if (isset($feedback)) echo $feedback;
- ?>
- <table border="0" cellpadding="0" cellspacing="3">
- <tr>
- <td><?php echo $strName; ?>:</td>
- <td><input type="text" class="textbox" size="50" name="name" maxlength="50" value="<?php echo $name; ?>" /></td>
- </tr>
- <tr>
- <td>URL:</td>
- <td><input type="text" class="textbox" size="50" name="URL" maxlength="200" value="<?php echo $URL; ?>" /></td>
- </tr>
- <tr>
- <td colspan="2">
- <?php
- $checkbox = new checkbox('new_window', 'true', $bm_new_window, $check);
- ?>
- </td>
- </tr>
- <tr>
- <td colspan="2" align="center" height="20" valign="bottom">
- <?php
- $button = new button($cmdOk, 'javascript:document.forms[0].submit()');
- echo ' ';
- $button = new button($cmdClose, "javascript:document.location='".$GO_MODULES->url."index.php'");
- ?>
- </td>
- </tr>
- </table>
-
- </form>
- <?php
- $tabtable->print_foot();
- require($GO_THEME->theme_path."footer.inc");
- ?>
-
-