# General Public License as published by the Free # Software Foundation; either version 2 of the # License, or (at your option) any later version. # # GPL: http://www.gnu.org/licenses/gpl.txt # ################################################## if (!defined('EXPONENT')) { exit(''); } $contact = null; $iloc = null; if (isset($_GET['id'])) { $contact = $db->selectObject('addressbook_contact', 'id=' . intval($_GET['id'])); if ($contact) { $loc = unserialize($contact->location_data); $iloc = exponent_core_makeLocation($loc->mod, $loc->src, $contact->id); } } // FIXME: Replace with better use of getLocationHierarchy if ($contact == null && exponent_permissions_check('post', $loc) || $contact != null && exponent_permissions_check('edit', $loc) || $iloc != null && exponent_permissions_check('edit', $iloc)) { $form = addressbook_contact::form($contact); $form->location($loc); $form->meta('action', 'save'); $template = new template('addressbookmodule', '_form_edit', $loc); $template->assign('form_html', $form->toHTML()); $template->assign('is_edit', $contact == null ? 0 : 1); $template->output(); } else { echo SITE_403_HTML; }
# not, write to: # # Free Software Foundation, Inc., # 59 Temple Place, # Suite 330, # Boston, MA 02111-1307 USA # # $Id: save.php,v 1.4 2005/02/19 00:32:27 filetreefrog Exp $ ################################################## if (!defined("PATHOS")) { exit(""); } $contact = null; $iloc = null; if (isset($_POST['id'])) { $contact = $db->selectObject("addressbook_contact", "id=" . $_POST['id']); $loc = unserialize($contact->location_data); $iloc = pathos_core_makeLocation($loc->mod, $loc->src, $contact->id); } if ($contact == null && pathos_permissions_check("post", $loc) || $contact != null && pathos_permissions_check("edit", $loc) || $iloc != null && pathos_permissions_check("edit", $iloc)) { $contact = addressbook_contact::update($_POST, $contact); $contact->location_data = serialize($loc); if (isset($contact->id)) { $db->updateObject($contact, "addressbook_contact"); } else { $db->insertObject($contact, "addressbook_contact"); } pathos_flow_redirect(); } else { echo SITE_403_HTML; }