/** * Add New Instance Request. * @global type $pf_sel_c_instance_total * @param type $phase * @return type */ function addInstanceFlow($id_type, $first_name, $last_name, $e_mail, $phone, $e_date, $e_location, $e_reception, $n_guests) { global $array_label; $result = "-"; $id_instance = getNewIdInstance($id_type); if (strlen($id_instance) > 5) { $step_one = getStepOneFlow($id_type); if (is_numeric($step_one) && $step_one > 0) { if (addNewInstance($id_instance, $id_type, $step_one)) { if (addCustomer($id_instance, $first_name, $last_name, $e_mail, $phone) && addEvent($id_instance, $e_date, $e_location, $e_reception, $n_guests)) { $result = $id_instance; } else { $result .= $array_label['msg_error_insert_ins']; } } else { $result .= $array_label['msg_error_insert_ins']; } } else { $result .= $array_label['msg_error_undefined_f']; } } return $result; }
<?php session_start(); include "variables.php"; include "functions.php"; if (isset($_REQUEST["fname"])) { $message = addCustomer($_REQUEST); if ($message) { $_SESSION["message"] = $message; $_SESSION["formdata"] = $_REQUEST; header("Location: Day13Exercise.php"); } else { print "Customer added to database"; } } else { header("Location: Day13Exercise.php"); }
if (empty($response)) { ipnLog("empty response"); die; } if (isset($response['error'])) { ipnLog("error"); ipnLog(json_encode($response)); die; } $notification = $response['notification']; $customer = $response['customer']; $trasaction = $response['transaction']; //ipnLog("...."); //ipnLog(json_encode($notification)); addNotification($notification); addCustomer($customer); addTransaction($trasaction); } /** * @param String $data */ function ipnLog($data) { //Check log.log file permissions $date = date('Y-m-d H:i'); file_put_contents("log.log", "[" . $date . "]" . $data . " \n", FILE_APPEND); } function addNotification($notification) { $params = array('id' => null, 'txn_id' => $notification->getTxnId(), 'txn_type' => $notification->getTxnType(), 'receiver_email' => $notification->getReceiverEmail(), 'payment_status' => $notification->getPaymentStatus(), 'pending_reason' => $notification->getPendingReason(), 'reason_code' => $notification->getReasonCode(), 'custom' => $notification->getCustom(), 'invoice' => $notification->getInvoice()); insert('notification', $params);
$task = ""; $data = array("success" => false, "message" => "No userid or token"); echo json_encode($data); exit; } } ####################################################################################################################### #########################################################TASKS######################################################### ####################################################################################################################### if ($task == "getCustomers") { echo getCustomers($userid); } //task getCustomers if ($task == "addCustomer") { $customername = $request->customername; echo addCustomer($userid, $customername); } //task addCustomer if ($task == "addService") { $servicename = $request->servicename; $hourlyrate = $request->hourlyrate; echo addService($userid, $servicename, $hourlyrate); } //task addService if ($task == "insertNewTime") { $customerid = $request->customerid; $serviceid = $request->serviceid; $hours = $request->hours; $date = $request->date; $desc = $request->desc; $weeklyid = getNewWeeklyID($userid);
function manejarSesionActiva($module_name, &$smarty, $sDirLocalPlantillas) { $sAction = ''; $sContenido = ''; $sAction = getParameter('action'); if (!in_array($sAction, array('', 'checkStatus', 'agentLogout', 'hangup', 'break', 'unbreak', 'transfer', 'confirm_contact', 'schedule', 'saveforms', 'call2phone', 'addCustomer', 'addNote', 'addDelivery', 'viewDelivery', 'addExternalNote', 'viewNote', 'show_call_history', 'update_customer', 'callOut', 'checkDeliveryPermission', 'viewCustomer', 'disableDelivery', 'enableDelivery', 'changePassword'))) { $sAction = ''; } // Se verifica si el agente sigue logoneado en la cola de Asterisk $sAgente = $_SESSION['callcenter']['agente']; $sExtension = $_SESSION['callcenter']['extension']; $oPaloConsola = new PaloSantoConsola($sAgente); $estado = $oPaloConsola->estadoAgenteLogoneado($sExtension); if ($estado['estadofinal'] != 'logged-in') { // Se marca el final de la sesión del agente en las tablas de auditoría $oPaloConsola->logoutAgente(); $_SESSION['callcenter'] = generarEstadoInicial(); } switch ($sAction) { case 'checkStatus': $sContenido = manejarSesionActiva_checkStatus($module_name, $smarty, $sDirLocalPlantillas, $oPaloConsola, $estado); break; case 'hangup': $sContenido = manejarSesionActiva_hangup($oPaloConsola); break; case 'agentLogout': $sContenido = manejarSesionActiva_agentLogout($oPaloConsola); break; case 'break': $sContenido = manejarSesionActiva_agentBreak($oPaloConsola); break; case 'unbreak': $sContenido = manejarSesionActiva_agentUnBreak($oPaloConsola); break; case 'transfer': //$sContenido = manejarSesionActiva_agentTransfer($oPaloConsola); $sContenido = agentTransfer($oPaloConsola); break; case 'viewDelivery': $sContenido = view_delivery(); break; case 'viewCustomer': $sContenido = view_customer(); break; case 'confirm_contact': $sContenido = manejarSesionActiva_confirmContact($oPaloConsola, $estado); break; case 'schedule': $sContenido = manejarSesionActiva_scheduleCall($oPaloConsola); break; case 'saveforms': $sContenido = manejarSesionActiva_saveForms($oPaloConsola, $estado); break; case 'call2phone': $sContenido = call2phone(); break; case 'addCustomer': $sContenido = addCustomer(); break; case 'addNote': $sContenido = addNote(); break; case 'addExternalNote': $sContenido = addExternalNote(); break; case 'viewNote': $sContenido = viewNote(); break; case 'addDelivery': $sContenido = addDelivery(); break; case 'checkDeliveryPermission': $sContenido = checkDeliveryPermission(); break; case 'disableDelivery': $sContenido = disableDelivery(); break; case 'enableDelivery': $sContenido = enableDelivery(); break; case 'changePassword': $sContenido = changePassword(); break; case 'update_customer': $sContenido = update_customer_HTML($sDirLocalPlantillas); break; case 'callOut': $sContenido = callOut_HTML($sDirLocalPlantillas); break; case 'show_call_history': $sContenido = refreshCallHistory(); break; default: if ($estado['estadofinal'] != 'logged-in') { // Para agente no logoneado, se redirecciona a la página de login Header('Location: ?menu=' . $module_name); $sContenido = ''; } else { $sContenido = manejarSesionActiva_HTML($module_name, $smarty, $sDirLocalPlantillas, $oPaloConsola, $estado); } break; } $oPaloConsola->desconectarTodo(); return $sContenido; }
$email = $customerId = $firstName = $lastName = $firm = $zip = $city = $state = $country = $street1 = $street2 = ''; $phone = $mail = $fax = $domainIp = ''; $gender = 'U'; if (!getPreviousStepData()) { set_page_message(tr('Data were altered. Please try again.'), 'error'); unsetMessages(); redirectTo('user_add1.php'); } $phpini = iMSCP_PHPini::getInstance(); $phpini->loadResellerPermissions($_SESSION['user_id']); // Load reseller PHP permissions $phpini->loadClientPermissions(); // Load client default PHP permissions $phpini->loadDomainIni(); // Load domain default PHP configuration options if (isset($_POST['uaction']) && 'user_add3_nxt' == $_POST['uaction'] && !isset($_SESSION['step_two_data'])) { if (check_ruser_data()) { addCustomer(); } } else { unset($_SESSION['step_two_data']); } $tpl = new iMSCP_pTemplate(); $tpl->define_dynamic(array('layout' => 'shared/layouts/ui.tpl', 'page' => 'reseller/user_add3.tpl', 'page_message' => 'layout', 'ip_entry' => 'page', 'alias_feature' => 'page')); $tpl->assign(array('TR_PAGE_TITLE' => tr('Reseller / Customers / Add Customer - Next Step'), 'TR_ADD_USER' => tr('Add user'), 'TR_CORE_DATA' => tr('Core data'), 'TR_USERNAME' => tr('Username'), 'TR_PASSWORD' => tr('Password'), 'TR_REP_PASSWORD' => tr('Repeat password'), 'TR_DOMAIN_IP' => tr('Domain IP'), 'TR_USREMAIL' => tr('Email'), 'TR_ADDITIONAL_DATA' => tr('Additional data'), 'TR_CUSTOMER_ID' => tr('Customer ID'), 'TR_FIRSTNAME' => tr('First name'), 'TR_LASTNAME' => tr('Last name'), 'TR_GENDER' => tr('Gender'), 'TR_MALE' => tr('Male'), 'TR_FEMALE' => tr('Female'), 'TR_UNKNOWN' => tr('Unknown'), 'TR_COMPANY' => tr('Company'), 'TR_POST_CODE' => tr('Zip'), 'TR_CITY' => tr('City'), 'TR_STATE_PROVINCE' => tr('State/Province'), 'TR_COUNTRY' => tr('Country'), 'TR_STREET1' => tr('Street 1'), 'TR_STREET2' => tr('Street 2'), 'TR_MAIL' => tr('Email'), 'TR_PHONE' => tr('Phone'), 'TR_FAX' => tr('Fax'), 'TR_BTN_ADD_USER' => tr('Add user'))); generateNavigation($tpl); generatePage($tpl); generatePageMessage($tpl); $tpl->parse('LAYOUT_CONTENT', 'page'); iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onResellerScriptEnd, array('templateEngine' => $tpl)); $tpl->prnt();
$contractorSessionId = $cookieParams['cst_session_id']; $customer = getCustomer($contractorSessionId); if (!isset($customer)) { logger($this)->addWarning('No customer found by session id', array('cst_session_id' => $contractorSessionId, 'uri' => $request->getUri()->getPath())); return forbidden($response); } $response->getBody()->write(json_encode($customer)); return $response->withHeader('Content-Type', 'application/json'); } catch (PDOException $e) { return handleError($e, $response); } }); $app->post('/api/customers/register', function (Request $request, Response $response) { // Random secure session id $sessionId = sha1(openssl_random_pseudo_bytes(32)); addCustomer($sessionId); $expires = gmdate('D, d-M-Y H:i:s e', strtotime('7 days')); $response->getBody()->write("api/customers/profile"); return $response->withStatus(201)->withHeader('Set-Cookie', "cst_session_id={$sessionId}; path=/; expires={$expires}"); }); // CONTRACTORS $app->post('/api/contractors/register', function (Request $request, Response $response) { // Generate a secure random id $sessionId = sha1(openssl_random_pseudo_bytes(32)); addContractor($sessionId); $expires = gmdate('D, d-M-Y H:i:s e', strtotime('7 days')); $response->getBody()->write("api/contractors/profile"); return $response->withStatus(201)->withHeader('Set-Cookie', "cnt_session_id={$sessionId}; path=/; expires={$expires}"); }); $app->get('/api/contractors/profile', function (Request $request, Response $response) { try {
return count($result) ? $result[0] : null; } function infoFields() { $c = new Customer(); return $c->getFields(); } /* </functions> */ $action = Functions::get('action'); Functions::checkRights(__FILE__, $action, Functions::get('token')); switch ($action) { case 'fields_info': $data = infoFields(); break; case 'new': $data = addCustomer(); break; case 'update': $data = updateCustomer(Functions::get('id')); break; case 'info': $data = infoCustomer(Functions::get('id')); break; case 'delete': $data = deleteCustomer(Functions::get('id')); break; case 'total_entries': $data = getTotalEntries(Functions::get('id')); break; case 'total_sells': $data = getTotalSells(Functions::get('id'));