function tsms_RealnamesTranslit($realnames) { $result = array(); if (!empty($realnames)) { foreach ($realnames as $login => $realname) { $result[$login] = ucwords(zb_TranslitString($realname)); } } return $result; }
/** * Stores message in telegram sending queue. Use this method in your modules. * * @param int $chatid * @param string $message * @param bool $translit * @param string $module * * @return bool */ public function sendMessage($chatid, $message, $translit = false, $module = '') { $result = false; $chatid = trim($chatid); $module = !empty($module) ? ' MODULE ' . $module : ''; if (!empty($chatid)) { $message = str_replace(array("\n\r", "\n", "\r"), ' ', $message); if ($translit) { $message = zb_TranslitString($message); } $message = trim($message); $filename = self::QUEUE_PATH . 'tlg_' . zb_rand_string(8); $storedata = 'CHATID="' . $chatid . '"' . "\n"; $storedata .= 'MESSAGE="' . $message . '"' . "\n"; file_put_contents($filename, $storedata); log_register('UTLG SEND MESSAGE `' . $chatid . '`' . $module); $result = true; } return $result; }
/** * Stores SMS in sending queue * * @param string $number Mobile number in international format. Eg: +380506666666 * @param string $message Text message for sending * @param bool $translit force message transliteration * @param string $module module that inits SMS sending * * @return bool */ public function sendSMS($number, $message, $translit = true, $module = '') { $result = false; $number = trim($number); $module = !empty($module) ? ' MODULE ' . $module : ''; if (!empty($number)) { if (ispos($number, '+')) { $message = str_replace(array("\n\r", "\n", "\r"), ' ', $message); if ($translit) { $message = zb_TranslitString($message); } $message = trim($message); $filename = self::QUEUE_PATH . 'us_' . zb_rand_string(8); $storedata = 'NUMBER="' . $number . '"' . "\n"; $storedata .= 'MESSAGE="' . $message . '"' . "\n"; file_put_contents($filename, $storedata); log_register('USMS SEND SMS `' . $number . '`' . $module); $result = true; } } return $result; }
/** * Stores SMS in sending queue * * @param string $number Mobile number in international format. Eg: +380506666666 * @param string $message Text message for sending * @param bool $translit force message transliteration * @return bool */ public function sendSMS($number, $message, $translit = true) { $result = false; $number = trim($number); if (!empty($number)) { if (ispos($number, '+')) { $message = str_replace('\\r\\n', ' ', $message); if ($translit) { $message = zb_TranslitString($message); } $message = trim($message); $filename = self::QUEUE_PATH . 'us_' . zb_rand_string(8); $storedata = 'NUMBER="' . $number . '"' . "\n"; $storedata .= 'MESSAGE="' . $message . '"' . "\n"; $result['number'] = $number; $result['message'] = $message; file_put_contents($filename, $storedata); log_register("USMS SEND SMS `" . $number . "`"); $result = true; } } return $result; }
/** * Shows task editing/management form * * @global object $ubillingConfig * @param int $taskid * * @return void */ function ts_TaskChangeForm($taskid) { global $ubillingConfig; $altercfg = $ubillingConfig->getAlter(); $taskid = vf($taskid, 3); $taskdata = ts_GetTaskData($taskid); $result = ''; $allemployee = ts_GetAllEmployee(); $activeemployee = ts_GetActiveEmployee(); $alljobtypes = ts_GetAllJobtypes(); $messages = new UbillingMessageHelper(); $smsData = ''; if (!empty($taskdata)) { //not done task if (empty($taskdata['login'])) { $login_detected = ts_DetectUserByAddress($taskdata['address']); if ($login_detected) { $addresslink = wf_Link("?module=userprofile&username="******"?module=userprofile&username="******"H:i", strtotime($taskdata['starttime'])) : ''; $smsJobNote = mysql_real_escape_string($taskdata['jobnote']); $smsEmployee = vf($taskdata['employee']); $newSmsText = $smsAddress . ' ' . $smsPhone . ' ' . $smsJobNote . $smsJobTime; $smsDataCells = wf_TableCell(__('Employee'), '', 'row2'); $smsDataCells .= wf_TableCell(@$allemployee[$taskdata['employee']]); $smsDataRows = wf_TableRow($smsDataCells, 'row3'); $smsDataCells = wf_TableCell(__('Message'), '', 'row2'); $smsDataCells .= wf_TableCell(zb_TranslitString($newSmsText)); $smsDataRows .= wf_TableRow($smsDataCells, 'row3'); $smsDataTable = wf_TableBody($smsDataRows, '100%', '0', 'glamour'); $smsInputs = $smsDataTable; $smsInputs .= wf_HiddenInput('postsendemployee', $smsEmployee); $smsInputs .= wf_HiddenInput('postsendsmstext', $newSmsText); $smsInputs .= wf_Submit(__('Send SMS')); $smsForm = wf_Form('', 'POST', $smsInputs, ''); $smsData = wf_modal(wf_img_sized('skins/icon_mobile.gif', __('Send SMS'), '10'), __('Send SMS'), $smsForm, '', '400', '200'); } } $tablecells = wf_TableCell(__('ID'), '30%'); $tablecells .= wf_TableCell($taskdata['id']); $tablerows = wf_TableRow($tablecells, 'row3'); $tablecells = wf_TableCell(__('Task creation date') . ' / ' . __('Administrator')); $tablecells .= wf_TableCell($taskdata['date'] . ' / ' . $taskdata['admin']); $tablerows .= wf_TableRow($tablecells, 'row3'); $tablecells = wf_TableCell(__('Target date')); $tablecells .= wf_TableCell(wf_tag('strong') . $taskdata['startdate'] . ' ' . $taskdata['starttime'] . wf_tag('strong', true)); $tablerows .= wf_TableRow($tablecells, 'row3'); $tablecells = wf_TableCell(__('Task address')); $tablecells .= wf_TableCell($addresslink); $tablerows .= wf_TableRow($tablecells, 'row3'); $tablecells = wf_TableCell(__('Login')); $tablecells .= wf_TableCell($taskLogin . $loginType); $tablerows .= wf_TableRow($tablecells, 'row3'); $tablecells = wf_TableCell(__('Phone')); $tablecells .= wf_TableCell($taskdata['phone']); $tablerows .= wf_TableRow($tablecells, 'row3'); $tablecells = wf_TableCell(__('Job type')); $tablecells .= wf_TableCell(@$alljobtypes[$taskdata['jobtype']]); $tablerows .= wf_TableRow($tablecells, 'row3'); $tablecells = wf_TableCell(__('Who should do')); $tablecells .= wf_TableCell(@$allemployee[$taskdata['employee']] . ' ' . $smsData); $tablerows .= wf_TableRow($tablecells, 'row3'); $tablecells = wf_TableCell(__('Job note')); $tablecells .= wf_TableCell(nl2br($taskdata['jobnote'])); $tablerows .= wf_TableRow($tablecells, 'row3'); $result .= wf_TableBody($tablerows, '100%', '0', 'glamour'); $result .= wf_tag('div', false, '', 'style="clear:both;"') . wf_tag('div', true); // show task preview show_window(__('View task') . ' ' . $modform, $result); //Salary accounting if ($altercfg['SALARY_ENABLED']) { if (cfr('SALARYTASKSVIEW')) { $salary = new Salary(); show_window(__('Additional jobs done'), $salary->taskJobCreateForm($_GET['edittask'])); } } //warehouse integration if ($altercfg['WAREHOUSE_ENABLED']) { if (cfr('WAREHOUSE')) { $warehouse = new Warehouse(); show_window(__('Additionally spent materials'), $warehouse->taskMaterialsReport($_GET['edittask'])); } } //if task undone if ($taskdata['status'] == 0) { $sup = wf_tag('sup') . '*' . wf_tag('sup', false); $inputs = wf_HiddenInput('changetask', $taskid); $inputs .= wf_DatePicker('editenddate') . wf_tag('label', false) . __('Finish date') . $sup . wf_tag('label', true) . wf_tag('br'); $inputs .= wf_tag('br'); $inputs .= wf_Selector('editemployeedone', $activeemployee, __('Worker done'), $taskdata['employee'], true); $inputs .= wf_tag('br'); $inputs .= wf_tag('label', false) . __('Finish note') . wf_tag('label', true) . wf_tag('br'); $inputs .= wf_TextArea('editdonenote', '', '', true, '35x3'); $inputs .= wf_tag('br'); $inputs .= $jobgencheckbox; $inputs .= wf_Submit(__('This task is done')); $form = wf_Form("", 'POST', $inputs, 'glamour'); if (cfr('TASKMANDELETE')) { show_window('', wf_JSAlertStyled('?module=taskman&deletetask=' . $taskid, web_delete_icon() . ' ' . __('Remove this task - it is an mistake'), $messages->getDeleteAlert(), 'ubButton')); } //show editing form if (cfr('TASKMANDONE')) { show_window(__('If task is done'), $form); } } else { $donecells = wf_TableCell(__('Finish date'), '30%'); $donecells .= wf_TableCell($taskdata['enddate']); $donerows = wf_TableRow($donecells, 'row3'); $donecells = wf_TableCell(__('Worker done')); $donecells .= wf_TableCell($allemployee[$taskdata['employeedone']]); $donerows .= wf_TableRow($donecells, 'row3'); $donecells = wf_TableCell(__('Finish note')); $donecells .= wf_TableCell($taskdata['donenote']); $donerows .= wf_TableRow($donecells, 'row3'); $doneresult = wf_TableBody($donerows, '100%', '0', 'glamour'); if (cfr('TASKMANDELETE')) { $doneresult .= wf_JSAlertStyled('?module=taskman&deletetask=' . $taskid, web_delete_icon() . ' ' . __('Remove this task - it is an mistake'), $messages->getDeleteAlert(), 'ubButton'); } if (cfr('TASKMANDONE')) { $doneresult .= ' '; $doneresult .= wf_JSAlertStyled('?module=taskman&setundone=' . $taskid, wf_img('skins/icon_key.gif') . ' ' . __('No work was done'), $messages->getEditAlert(), 'ubButton'); } show_window(__('Task is done'), $doneresult); } } }
/** * Returns register last step form * * @param array $newuser_data * @return string */ function web_UserRegFormNetData($newuser_data) { $alterconf = rcms_parse_ini_file(CONFIG_PATH . "alter.ini"); $safe_mode = $alterconf['SAFE_REGMODE']; $citydata = zb_AddressGetCityData($newuser_data['city']); $cityalias = zb_TranslitString($citydata['cityalias']); $streetdata = zb_AddressGetStreetData($newuser_data['street']); $streetalias = zb_TranslitString($streetdata['streetalias']); $buildata = zb_AddressGetBuildData($newuser_data['build']); $buildnum = zb_TranslitString($buildata['buildnum']); if (empty($newuser_data['apt'])) { $newuser_data['apt'] = 0; } $apt = zb_TranslitString($newuser_data['apt']); //assign some agent from previously selected form if (isset($alterconf['LOGIN_GENERATION'])) { if ($alterconf['LOGIN_GENERATION'] == 'DEREBAN') { $agentPrefixID = $newuser_data['contrahent']; } else { $agentPrefixID = ''; } } else { $agentPrefixID = ''; } $ip_proposal = multinet_get_next_freeip('nethosts', 'ip', multinet_get_service_networkid($newuser_data['service'])); $login_proposal = zb_RegLoginProposal($cityalias, $streetalias, $buildnum, $apt, $ip_proposal, $agentPrefixID); $password_proposal = zb_RegPasswordProposal(); if (empty($ip_proposal)) { $alert = wf_tag('script', false, '', 'type="text/javascript"'); $alert .= 'alert("' . __('Error') . ': ' . __('No free IP available in selected pool') . '");'; $alert .= wf_tag('script', true); print $alert; rcms_redirect("?module=multinet"); die; } //protect important options if ($safe_mode) { $modifier = 'READONLY'; } else { $modifier = ''; } $form = wf_tag('table', false, 'glamour', 'width="100%" border="0"'); $form .= wf_tag('form', false, '', ' action="" method="POST"'); $form .= wf_tag('tr', false, 'row3'); $form .= wf_tag('td', false, '', 'width="50%"'); $form .= wf_tag('input', false, '', 'type="text" name="login" value="' . $login_proposal . '" ' . $modifier); $form .= wf_tag('td', true); $form .= wf_tag('td', false); $form .= __('Login') . ' ' . zb_CheckLoginRscriptdCompat($login_proposal); $form .= wf_tag('td', true); $form .= wf_tag('tr', true); $form .= wf_tag('tr', false, 'row3'); $form .= wf_tag('td', false); $form .= wf_tag('input', false, '', 'type="text" name="password" value="' . $password_proposal . '" ' . $modifier); $form .= wf_tag('td', true); $form .= wf_tag('td', false); $form .= __('Password'); $form .= wf_tag('td', true); $form .= wf_tag('tr', true); $form .= wf_tag('tr', false, 'row3'); $form .= wf_tag('td', false); $form .= wf_tag('input', false, '', 'type="text" name="IP" value="' . $ip_proposal . '" ' . $modifier); $form .= wf_tag('td', true); $form .= wf_tag('td', false); $form .= __('IP'); $form .= wf_tag('td', true); $form .= wf_tag('tr', true); $form .= wf_tag('table', true); $form .= wf_HiddenInput('repostdata', base64_encode(serialize($newuser_data))); $form .= wf_Submit(__('Let register that user')); $form .= wf_tag('form', true); $form .= wf_tag('div', false, '', 'style="clear:both;"') . wf_tag('div', true); return $form; }