$obj->_message = 'updated'; } else { $obj->_message = 'added'; } $obj->link_date = date('Y-m-d H:i:s'); $obj->link_category = intval(dPgetParam($_POST, 'link_category', 0)); if (!$obj->bind($_POST)) { $AppUI->setMsg($obj->getError(), UI_MSG_ERROR); $AppUI->redirect(); } // prepare (and translate) the module name ready for the suffix $AppUI->setMsg('Link'); // delete the link if ($del) { $obj->load($link_id); if ($msg = $obj->delete()) { $AppUI->setMsg($msg, UI_MSG_ERROR); $AppUI->redirect(); } else { if ($not == '1') { $obj->notify(); } $AppUI->setMsg("deleted", UI_MSG_ALERT, true); $AppUI->redirect("m=links"); } } if (!$link_id) { $obj->link_owner = $AppUI->user_id; } if ($msg = $obj->store()) { $AppUI->setMsg($msg, UI_MSG_ERROR);
<?php /* $Id$ $URL$ */ if (!defined('W2P_BASE_DIR')) { die('You should not access this file directly.'); } $del = (int) w2PgetParam($_POST, 'del', 0); $obj = new CLink(); if (!$obj->bind($_POST)) { $AppUI->setMsg($obj->getError(), UI_MSG_ERROR); $AppUI->redirect(); } $action = $del ? 'deleted' : 'stored'; $result = $del ? $obj->delete($AppUI) : $obj->store($AppUI); if (is_array($result)) { $AppUI->setMsg($result, UI_MSG_ERROR, true); $AppUI->holdObject($obj); $AppUI->redirect('m=links&a=addedit'); } if ($result) { $AppUI->setMsg('Links ' . $action, UI_MSG_OK, true); $AppUI->redirect('m=links'); } else { $AppUI->redirect('m=public&a=access_denied'); }