$clientObj->setVar('id', isset($_POST['id']) ? intval($_POST['id']) : 0); $clientObj->setVar('status', isset($_POST['status']) ? intval($_POST['status']) : 0); $clientObj->setVar('title', $_POST['title']); $clientObj->setVar('summary', $_POST['summary']); $clientObj->setVar('image_url', $_POST['image_url']); $clientObj->setVar('description', $_POST['description']); $clientObj->setVar('contact_name', $_POST['contact_name']); $clientObj->setVar('contact_email', $_POST['contact_email']); $clientObj->setVar('contact_phone', $_POST['contact_phone']); $clientObj->setVar('adress', $_POST['adress']); $clientObj->setVar('url', $_POST['url']); $clientObj->setVar('weight', isset($_POST['weight']) ? intval($_POST['weight']) : 0); $redirect_msgs = $clientObj->getRedirectMsg($_POST['original_status'], $_POST['status']); // Storing the client if (!$clientObj->store()) { redirect_header("javascript:history.go(-1)", 3, $redirect_msgs['error'] . smartclient_formatErrors($clientObj->getErrors())); exit; } if ($_POST['original_status'] == _SCLIENT_STATUS_SUBMITTED || $_POST['status'] == _SCLIENT_STATUS_ACTIVE) { $clientObj->sendNotifications(array(_SCLIENT_NOT_CLIENT_APPROVED)); } redirect_header("client.php", 2, $redirect_msgs['success']); exit; break; case "del": global $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $_GET; $module_id = $xoopsModule->getVar('mid'); $gperm_handler =& xoops_gethandler('groupperm'); $id = isset($_POST['id']) ? intval($_POST['id']) : 0; $id = isset($_GET['id']) ? intval($_GET['id']) : $id; $clientObj = new SmartclientClient($id);
$clientObj->setVar('description', $_POST['description']); $clientObj->setVar('contact_name', $_POST['contact_name']); $clientObj->setVar('contact_email', $_POST['contact_email']); $clientObj->setVar('contact_phone', $_POST['contact_phone']); $clientObj->setVar('adress', $_POST['adress']); $clientObj->setVar('url', $_POST['url']); $clientObj->setVar('weight', isset($_POST['weight']) ? intval($_POST['weight']) : 0); $clientObj->setVar('status', _SCLIENT_STATUS_SUBMITTED); if ($xoopsModuleConfig['autoapprove_submitted']) { $clientObj->setVar('status', _SCLIENT_STATUS_ACTIVE); } else { $clientObj->setVar('status', _SCLIENT_STATUS_SUBMITTED); } // Storing the client if (!$clientObj->store()) { redirect_header("javascript:history.go(-1)", 3, _MD_SCLIENT_SUBMIT_ERROR . smartclient_formatErrors($clientObj->getErrors())); exit; } if (isset($_POST['notifypub']) && $_POST['notifypub'] == 1) { include_once XOOPS_ROOT_PATH . '/include/notification_constants.php'; $notification_handler =& xoops_gethandler('notification'); $notification_handler->subscribe('client', $clientObj->id(), 'approved', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE); } $clientObj->sendNotifications(array(_SCLIENT_NOT_CLIENT_SUBMITTED)); redirect_header("index.php", 3, _MD_SCLIENT_SUBMIT_SUCCESS); exit; break; case "form": if ($xoopsModuleConfig['allowsubmit'] != 1 || !$xoopsUser && $xoopsModuleConfig['anonpost'] != 1) { redirect_header("index.php", 2, _NOPERM); }