function addHandler($sId, $sHandler) { $objResponse = new xajaxResponse(); $objResponse->addHandler($sId, "click", $sHandler); $objResponse->append('log', 'innerHTML', '<div id="handler' . $sHandler . '">*-- ' . $sHandler . ' (attached)</div>'); return $objResponse; }
public function ajax_refreshCart() { $objResponse = new xajaxResponse(); $objResponse->clear("cart-contents", "innerHTML"); $objResponse->append("cart-contents", "innerHTML", $this->getCartTemplate()); return $objResponse; }
function removeHandler($sId, $sHandler) { $objResponse = new xajaxResponse(); $objResponse->removeHandler($sId, "click", $sHandler); $objResponse->append('log', 'innerHTML', "{$sHandler} disabled.<br />"); return $objResponse; }
function create_file($tipo, $fileName, $formNum) { $objResponse = new xajaxResponse(); global $user, $smarty, $tikilib; $class = $tipo == "Imagem" ? "Image" : ($tipo == "Texto" ? "Text" : ($tipo == "Outro" ? "Other" : $tipo)); $publicationClass = $class . "Publication"; require_once "FileReference.php"; require_once $publicationClass . ".php"; if ($error = FileReference::isForbiddenExtension($fileName)) { // Estranho ficar aqui, mas onde colocar? $error .= ' Veja a <a href="tiki-index.php?page=Formatos+de+arquivos+do+Acervo+Livre">lista de formatos suportados</a>'; $objResponse->script("setUploadErrorMsg('{$error}')"); return $objResponse; } $fields = array("user" => $user); if ($licencaId = $tikilib->get_user_preference($user, 'licencaPadrao')) { $fields["licenseId"] = $licencaId; } $arquivo = new $publicationClass($fields); $objResponse->call("setPublication", $arquivo->id); $objResponse->script("newUpload({$formNum});"); if (in_array($tipo, array('Audio', 'Video', 'Imagem'))) { $templateName = 'el-gallery_metadata_' . $tipo . '.tpl'; $smarty->assign('permission', true); $content = $smarty->fetch($templateName); $objResponse->append('ajax-gUpMoreOptionsContent', 'innerHTML', $content); $objResponse->script(_extractScripts($content)); } return $objResponse; }
function eventHandlerThree() { $objResponse = new xajaxResponse(); $objResponse->append('log', 'innerHTML', 'Message from event handler three.<br />'); $objResponse->setReturnValue('return value from event handler three.'); return $objResponse; }
function confirm($seconds) { sleep($seconds); $objResponse = new xajaxResponse(); $objResponse->append('outputDIV', 'innerHTML', '<br />confirmation from theFrame.php call'); return $objResponse; }
function append($sTarget, $sAttribute, $sData, $highlight = false) { $randomid = rand(); parent::append($sTarget, $sAttribute, '<span id="' . $randomid . '"></span>'); parent::append($randomid, $sAttribute, $sData); if ($highlight) { $this->highlight($randomid); } }
function argumentDecode($nTimes, $aArgs) { global $timer; global $trips; $objResponse = new xajaxResponse(); if ($nTimes < $trips) { $nTimes += 1; $objResponse->script('xajax_argumentDecode(' . $nTimes . ', jsArray);'); $objResponse->assign('submittedDiv', 'innerHTML', 'Working...'); $objResponse->append('submittedDiv', 'innerHTML', print_r($aArgs, true)); } else { $objResponse->assign('submittedDiv', 'innerHTML', 'Done'); ob_start(); $objResponse->append('submittedDiv', 'innerHTML', ob_get_clean()); } $timer->stop(); $objResponse->call('accumulateTime', $timer->timeElapsed()); $objResponse->call('printTime'); return $objResponse; }
function streamStream($url, $size) { global $smarty; $objResponse = new xajaxResponse(); preg_match('/(\\d+)\\sx\\s(\\d+)/', $size, $matches); $width = (int) $matches[1]; $height = (int) $matches[1]; $objResponse->remove('ajax-gPlayer'); $objResponse->append('ajax-contentBubble', 'innerHTML', $smarty->fetch('el-player.tpl')); $objResponse->script("loadFile('{$url}', {$width}, {$height}, 'true')"); return $objResponse; }
function comment($comment) { global $arquivoId, $arquivo, $user, $smarty; require_once "Comment.php"; $c = new Comment(array('publicationId' => $arquivoId, 'user' => $user, 'date' => time(), 'comment' => $comment)); $smarty->assign('user', $user); $smarty->assign('comment', $c); $objResponse = new xajaxResponse(); $objResponse->append("ajax-aCommentsItemsCont", "innerHTML", $smarty->fetch("el-publication_comment.tpl")); $objResponse->assign("ajax-commentCount", "innerHTML", count($arquivo->comments) + 1); return $objResponse; }
function uploader($aFormValues = array()) { $objResponse = new xajaxResponse(); $html = ""; foreach ($_FILES as $key => $file) { $html .= "\n\t\t\t\t<div style=\"border:1px solid #f0f0f0;background:#fff;padding:4px;margin-bottom:4px;\">\n\t\t\t\t\t<div style=\"float:left;width:100px;\">Filename:</div>\n\t\t\t\t\t<div style=\"float:left;\">" . $_FILES[$key]['name'] . "</div>\n\t\t\t\t\t<br style=\"clear:both;\" />\n\t\t\t\t\t<div style=\"float:left;width:100px;\">Size:</div>\n\t\t\t\t\t<div style=\"float:left;\">" . $_FILES[$key]['size'] . "</div>\n\t\t\t\t\t<br style=\"clear:both;\" />\n\t\t\t\t\t<div style=\"float:left;\">\$_SESSION request counter: " . $_SESSION['foo'] . "</div>\n\t\t\t\t\t<br style=\"clear:both;\" />\n\t\t\t\t</div>\n\t\t\t\t"; } if ("" == $html) { $html = "empty queue"; } $objResponse->append("results", "innerHTML", $html); return $objResponse; }
function get_more_tags($offset, $maxRecords) { global $freetaglib, $smarty; $objResponse = new xajaxResponse(); $last_tag = array_pop($freetaglib->get_distinct_tag_suggestion('', $offset - $maxRecords, $maxRecords)); $smarty->assign('tag_suggestion', $freetaglib->get_distinct_tag_suggestion('', $offset, $maxRecords)); $objResponse->script("document.getElementById('{$last_tag}-v').style.display='inline'"); $objResponse->append("ajax-gUpTagListItem", "innerHTML", $smarty->fetch("el-tag_suggest_list.tpl")); if ($offset + $maxRecords > $freetaglib->count_distinct_tags()) { $objResponse->assign("ajax-gUpTagSuggestMore", "style.display", "none"); } return $objResponse; }
/** * Alle eingetragenen realms laden * * @access private * @author prodigy * @since 01.01.2009 * @version 0.1a */ private function DBLoadAll() { if (!$this->DBc->DB_Connect('mdm')) { $this->objR->assign('SOVerror', 'innerHTML', 'Datenbank zur Zeit nicht verfügbar.<br />' . mysqli_connect_error()); return; } $res = $this->DBc->DB_Connection['mdm']->query("\n SELECT *\n FROM `realmdbs`;"); $this->DBc->DB_Close('mdm'); $this->objR->assign('SOVerror', 'innerHTML', "<pre>\n"); $this->objR->append('SOVerror', 'innerHTML', $res->num_rows . "\n"); foreach ($res as $db) { $this->objR->append('SOVerror', 'innerHTML', print_r($db, true) . "\n"); } $this->objR->append('SOVerror', 'innerHTML', '</pre>'); }
function add_test_words($form) { $ch = strtolower($form['word_select']); if ($ch == 'all') { for ($i = 1; $i <= 24; $i++) { $form['word_select'] = $i; $html .= do_add_test_words($form); } } else { $html = do_add_test_words($form); } $response = new xajaxResponse(); $response->append("word_browser", "innerHTML", $html); $response->assign("start_button", "style.display", "block"); $response->assign("word_browser", "style.display", "block"); $response->assign("result", "style.display", "none"); return $response; }
function addInput($aInputData) { $sId = $aInputData['inputId']; $sName = $aInputData['inputName']; $sType = $aInputData['inputType']; $sValue = $aInputData['inputValue']; $objResponse = new xajaxResponse(); $sParentId = "testForm1"; if (isset($aInputData['inputWrapper'])) { $sDivId = $sId . '_div'; $objResponse->append($sParentId, "innerHTML", '<div id="' . $sDivId . '"></div>'); $sParentId = $sDivId; } $objResponse->alert("inputData: " . print_r($aInputData, true)); $objResponse->createInput($sParentId, $sType, $sName, $sId); $objResponse->assign($sId, "value", $sValue); return $objResponse; }
/** * Возвращает диалог при чтении переписки в потоке лички * * @param string $stream_id идентификатор потока * @param int $nFromId uid отправиля (то есть одного) * @param int $nToId uid получателя (то есть другого) * @param int $nMsgId id сообщения из которого смотрят переписку * @param int $nCurpage номер страницы * @return object xajaxResponse */ function getLetters($stream_id = '', $nFromId = 0, $nToId = 0, $nMsgId = 0, $nCurpage = 1) { global $user_content, $stop_words, $sTeam; $objResponse = new xajaxResponse(); $objResponse->script('user_content.spinner.hide(true);'); if ($user_content->hasContentPermissions(1)) { $aStream = array(); $checkStream = $user_content->checkStream(1, $stream_id, $_SESSION['uid'], $aStream); if ($checkStream) { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php'; $aDialog = array(); $sDialog = ''; $oFromUser = new users(); $oFromUser->GetUserByUID($nFromId); $oToUser = new users(); $oToUser->GetUserByUID($nToId); if ($oFromUser->login && $oToUser->login) { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/messages.php'; $oMsgs = new messages(); $aDialog = $oMsgs->GetMessagesForModers($nFromId, $oToUser->login, $nCurpage, 20); if ($aDialog) { $sProF = $oFromUser->is_pro == 't' ? (is_emp($oFromUser->role) ? view_pro_emp() : view_pro2($oFromUser->is_pro_test == 't' ? true : false)) . ' ' : ''; $sProT = $oToUser->is_pro == 't' ? (is_emp($oToUser->role) ? view_pro_emp() : view_pro2($oToUser->is_pro_test == 't' ? true : false)) . ' ' : ''; $sProF = $oFromUser->is_team == 't' ? $sTeam : $sProF; $sProT = $oToUser->is_team == 't' ? $sTeam : $sProT; foreach ($aDialog as $aOne) { $sClass = $aOne['from_id'] == $nFromId ? 'b-post__txt_color_a7a7a6' : ''; $sLogin = $aOne['from_id'] == $nFromId ? $oFromUser->login : $oToUser->login; $sName = $aOne['from_id'] == $nFromId ? $oFromUser->uname : $oToUser->uname; $sSurname = $aOne['from_id'] == $nFromId ? $oFromUser->usurname : $oToUser->usurname; $sIsChuck = $aOne['from_id'] == $nFromId ? $oFromUser->is_chuck : $oToUser->is_chuck; $sPro = $aOne['from_id'] == $nFromId ? $sProF : $sProT; $sAttach = ''; //$sClickD = 'user_content.delLetter('. $aOne['from_id'] .', \''. $aOne['id'] .'_'. ($aOne['id'] == $nMsgId ? '1' : '2') .'\')'; $sJSParams = "{'content_id': 1, 'stream_id': '{$stream_id}'}"; $sClickD = 'parent.banned.delReason(\'' . 1 . '_' . $aOne['id'] . '_0\', ' . $aOne['from_id'] . ', \'delLetter\', ' . $sJSParams . ')'; if ($aOne['files']) { $nn = 1; foreach ($aOne['files'] as $attach) { $aData = getAttachDisplayData($sLogin, $attach['fname'], 'contacts', 1000, 300, 307200, 0); if ($aData && $aData['success']) { if ($aData['file_mode'] || $aData['virus_flag'] || $att_ext == "swf") { $sAttach .= _parseAttach($aData); } else { $sAttach .= "<div class=\"b-fon__body b-fon__body_pad_5 b-fon__body_bg_ffebbf b-fon__body_margbot_1\"><img src=\"" . WDCPREFIX . '/users/' . $sLogin . '/contacts/' . $aData['file_name'] . "\" alt=\"{$aData['file_name']}\" title=\"{$aData['file_name']}\" width=\"{$aData['img_width']}\" height=\"{$aData['img_height']}\" /></div>"; } $nn++; } } $sAttach = _wrapAttach($sAttach); } $msg_text = $aOne['moderator_status'] === '0' ? $stop_words->replace($aOne['msg_text']) : $aOne['msg_text']; $msg_text = reformat($msg_text, 50, 0, -($sIsChuck == 't'), 1); $sDeleted = $aOne['deleted'] ? ' [Сообщение удалено модератором]' : ''; $sDialog .= ' <div class="b-post b-post_bordtop_dfe3e4 b-post_padtop_15 b-post_marg_20_10" id="my_div_content_' . $aOne['id'] . '_' . ($aOne['id'] == $nMsgId ? '1' : '2') . '"> ' . (!$aOne['deleted'] && ($aOne['moderator_status'] !== '0' || $aOne['moderator_status'] === '0' && $aOne['id'] == $nMsgId) ? '<a id="my_del_link_' . $aOne['id'] . '" onclick="' . $sClickD . '" class="b-button b-button_float_right b-button_mini" href="javascript:void(0);"><span class="b-button__icon b-button__icon_del"></span></a>' : '') . ' <div class="b-post__txt ' . $sClass . ' b-post__txt_fontsize_15">' . $sPro . '<span class="b-post__txt b-post__txt_bold ' . $sClass . '">' . $sName . ' ' . $sSurname . ' [' . $sLogin . ']</span> ' . date("d.m.y в H:i", strtotimeEx($aOne['post_time'])) . '<span id="my_deleted_' . $aOne['id'] . '" style="color:red;">' . $sDeleted . '</span>' . ':</div> <div class="b-post__txt ' . $sClass . ' b-post__txt_fontsize_15"> ' . $msg_text . ' </div> ' . $sAttach . ' </div> '; } $objResponse->append('my_div_contents', 'innerHTML', $sDialog); $objResponse->script("user_content.afterScroll();"); $objResponse->script("user_content.getLettersPage++;"); } } $objResponse->script('$("my_div_wait").destroy();'); } else { _loseStream($objResponse, $stream_id); } } else { _parsePermissionsDenied($objResponse); } $objResponse->script('user_content.spinner.resize();'); return $objResponse; }
function open_folder($folder, $home, $name = '') { $objResponse = new xajaxResponse(); //$objResponse->alert($folder); if (!is_readable($folder)) { $objResponse->alert("The folder is not readable!"); return $objResponse; } $out = jdGetDirectoryList($folder); $id = md5($folder); if ($name != '') { $objResponse->assign($name, "innerHTML", "<a href='#' onClick =\"xajax_close_folder('{$folder}','{$home}', '{$name}', '{$id}')\" ><img src = 'components/com_jdefender/images/icons/folder.png' border='0'> </a>"); } $objResponse->append($id, "innerHTML", $out); return $objResponse; }
function customSection($section, $label, $data) { $objResponse = new xajaxResponse(); $project7 = new editsee_App(); if ($project7->loggedIn() && $project7->isAdmin()) { $project7->db->_insert_custom_section($section, $label, $data); $objResponse->append('footer', 'innerHTML', $data); $objResponse->remove("popup"); $objResponse->removeCSS('includes/layout/overlay.css'); } else { $objResponse->alert($project7->notLoggedIn(true)); } return $objResponse; }
function AdminPostdata($a) { global $db; $chatid = htmlspecialchars($a['chatid']); $a['detail'] = htmlspecialchars($a['detail']); if (!get_magic_quotes_gpc()) { $a['detail'] = addslashes($a['detail']); } $detail = $a['detail'] . ' (' . date('Y-m-d H:i:s', time()) . ')'; $sql = "INSERT INTO `detail` (`chatid`,`detail`,`who_witter`) VALUES('" . $chatid . "','" . $detail . "','1')"; $db->query($sql); $name = ''; $input = "<span class=\"vschat\"><b>" . $name . ":</b> " . $detail . "</span><br />\n"; $objResponse = new xajaxResponse('utf-8'); $objResponse->append('ChatHistory', 'innerHTML', $input); return $objResponse; }
function expandFile($i) { global $smarty, $arquivo; $file =& $arquivo->filereferences[$i]; $objResponse = new xajaxResponse(); if ($file->actualClass == "ZipFile") { $files = $file->expand(); foreach ($files as $newFile) { $smarty->assign('file', $newFile); $smarty->assign('permission', true); $objResponse->append('ajax-pubFilesCont', 'innerHTML', $smarty->fetch("fileBox.tpl")); } $delete = true; $pubHasFiles = count($arquivo->filereferences) > 1; if (!$arquivo->allFile && !$pubHasFiles) { $arquivo->update(array('allFile' => $file->fullPath())); $delete = false; } $file->delete($delete); $objResponse->remove("ajax-file{$i}"); } return $objResponse; }
function set_mount_point($mountPoint, $pass) { global $tikilib, $user, $smarty; $objResponse = new xajaxResponse(); if (!preg_match('/^[a-zA-Z0-9]+$/', $pass) || !preg_match('/^[a-zA-Z0-9]+$/', $mountPoint)) { $objResponse->assign('ajax-liveError', 'innerHTML', tra('O ponto de montagem e a senha devem ser compostos apenas por letras (sem acento) e números, sem espaços.')); return $objResponse; } if ($tikilib->getOne('select mountPoint from el_ice where user != ? and mountPoint = ?', array($user, $mountPoint))) { $objResponse->assign('ajax-liveError', 'innerHTML', tra('Esse ponto de montagem já existe, por favor escolha outro.')); return $objResponse; } if ($tikilib->getOne('select mountPoint from el_ice where user = ? and mountPoint = ?', array($user, $mountPoint))) { exec(escapeshellcmd("iceWriter.pl update {$mountPoint} {$pass}"), $a, $out); $action = 'modificado'; } else { exec(escapeshellcmd("iceWriter.pl add {$mountPoint} {$pass}"), $a, $out); $action = 'criado'; } // se tiver saida = 0, nao deu erro (herdado de shell, porque die no perl retorna 255) if (!$out) { require_once 'lib/elgal/elIce/IceStats.php'; $objResponse->assign('ajax-liveError', 'innerHTML', ''); $tikilib->query("replace into el_ice values(?, ?, ?)", array($user, $mountPoint, $pass)); $objResponse->script("flip('ajax-elIce');document.getElementById('ajax-livePoint').value='';document.getElementById('ajax-livePass').value='';"); if ($action == 'criado') { $smarty->assign('channel', array('mountPoint' => $mountPoint, 'password' => $pass)); $smarty->assign('permission', true); $objResponse->append('ajax-liveCont', 'innerHTML', $smarty->fetch('el-live_channels.tpl')); } } else { $objResponse->assign('ajax-liveError', 'innerHTML', tra('Esse ponto de montagem já existe, por favor escolha outro.')); } return $objResponse; }
function getNodeStats($nodeid) { global $SMARTY, $DB; $nodeid = intval($nodeid); $result = new xajaxResponse(); $nodestats['hour'] = NodeStats($nodeid, 60 * 60); $nodestats['day'] = NodeStats($nodeid, 60 * 60 * 24); $nodestats['month'] = NodeStats($nodeid, 60 * 60 * 24 * 30); $SMARTY->assign('nodeid', $nodeid); $nodeip = $DB->GetOne('SELECT INET_NTOA(ipaddr) FROM vnodes WHERE id = ?', array($nodeid)); $SMARTY->assign('nodeip', $nodeip); $SMARTY->assign('nodestats', $nodestats); $contents = $SMARTY->fetch('node/nodestats.html'); $result->append('nodeinfo', 'innerHTML', $contents); if (ConfigHelper::getConfig('phpui.live_traffic_helper')) { $script = ' live_traffic_start = function() { xajax.config.waitCursor = false; xajax_getThroughput(\'' . $nodeip . '\'); } live_traffic_finished = function() { xajax.config.waitCursor = true; setTimeout("live_traffic_start()", 3000); } '; $result->script($script); $result->script("live_traffic_start()"); } return $result; }
function AddDialogueMessage($form) { global $session; session_start(); $objResponse = new xajaxResponse(); $offerIsBlocked = projects_offers::isOfferBlocked(false, get_uid(), $form['prj_id']); if ($offerIsBlocked) { $objResponse->alert('Ваше предложение заблокировано, вы не можете отправить это сообщение'); return $objResponse; } $prj = new projects(); $project = $prj->GetPrjCust(intval($form['prj_id'])); $is_pro = is_pro(); if ($project['pro_only'] == 't' && !$is_pro && !is_emp() && !hasPermissions('projects')) { if ($project['kind'] == 7) { if (contest::IsContestOfferExists($project['id'], get_uid(false))) { $is_pro = true; } } else { if (projects_offers::IsPrjOfferExists($project['id'], get_uid(false))) { $is_pro = true; } } } if ($project['pro_only'] == 't' && !$is_pro && $project['user_id'] != get_uid() && !hasPermissions('projects')) { $objResponse->alert('Данная функция доступна только пользователям с аккаунтом PRO.'); $objResponse->script("\$('savebtn').set('disabled', false);"); return $objResponse; } elseif ($project['verify_only'] == 't' && !($_SESSION['is_verify'] == 't') && $project['user_id'] != get_uid() && !hasPermissions('projects')) { $objResponse->alert('Данная функция доступна только верифицированным пользователям.'); $objResponse->script("\$('savebtn').set('disabled', false);"); return $objResponse; } if (!trim($form['po_text'])) { $objResponse->alert('Невозможно отправить пустое сообщение.'); $objResponse->script("\n \$('savebtn').set('disabled', false);\n "); return $objResponse; } if (!is_emp() && $form['from'] == 'emp') { $objResponse->script("\n \$('savebtn').set('disabled', false);\n "); $objResponse->alert('Невозможно отправить сообщение. Вы вышли из аккаунта работодателя.'); return $objResponse; } elseif (is_emp() && $form['from'] == 'frl') { $objResponse->script("\n \$('savebtn').set('disabled', false);\n "); $objResponse->alert('Невозможно отправить сообщение. Вы вышли из аккаунта фрилансера.'); return $objResponse; } //Не позволяем производить действия с заблокированным проектом if (projects::CheckBlocked(intval($form['prj_id']))) { $objResponse->script("document.location.href='/projects/index.php?pid=" . intval($form['prj_id']) . "'"); } elseif (intval($_SESSION['uid'])) { $po_id = intval($form['po_id']); //$po_text = substr(change_q_x($form['po_text'], false), 0, 1000); $po_text = antispam(trim($form['po_text'])); $po_text = preg_replace("/(\r\n|\r|\n){3,100}/i", "\r\n\r\n", $po_text); $po_commentid = intval($form['po_commentid']); $user_id = get_uid(false); $user = new users(); $user_name = $user->GetName($user_id, $error); $pod = new projects_offers_dialogue(); $project_dialogue = $pod->GetDialogueForOffer($po_id); $project = $pod->GetProjectFromDialogue($po_id); if (count($project_dialogue)) { for ($i = count($project_dialogue) - 1; $i >= 0; --$i) { if ($project_dialogue[$i]['user_id'] != $user_id) { $to_user_name = $project_dialogue[$i]['login']; break; } } } if (is_emp()) { $emp_read = true; $frl_read = false; } else { $emp_read = false; $frl_read = true; } if (!$po_commentid) { $error = $pod->AddDialogueMessage($po_id, $user_id, $po_text, $frl_read, $emp_read); $last_comment = $pod->GetLastDialogueMessage($user_id, $po_id); $objResponse->script("last_commentid={$last_comment};"); $objResponse->script("edit_block[{$po_id}] = ' <span><a href=\"javascript:void(null)\" onClick=\"answer({$po_id}, {$last_comment});markRead(\\'{$po_id}\\');\" class=\"internal\">Редактировать</a></span>';"); // $objResponse->script("alert(last_commentid);"); // $objResponse->script("alert(edit_block);"); } else { $error = $pod->SaveDialogueMessage($user_id, $po_text, $po_commentid, $po_id, false); if ($error == 1) { $objResponse->alert('Вы не можете редактировать комментарий, так как на него уже ответили.'); return $objResponse; } } $po_text = rtrim(ltrim($po_text, "\r\n")); $po_text = substr(change_q_x($po_text, false, true, '', false, false), 0, 1000); $po_text = stripslashes($po_text); if ($error == '') { $sPostText = $po_text; if ($project['kind'] != 4) { $sId = $po_commentid ? $po_commentid : $last_comment; $aComment = $pod->getDialogueMessageById($sId); if ($aComment['moderator_status'] === '0') { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stop_words.php'; $stop_words = new stop_words(hasPermissions('projects')); $sPostText = $stop_words->replace($sPostText); } } if (!$po_commentid) { $objResponse->append('po_dialogue_talk_' . $po_id, 'innerHTML', '<div style="margin-bottom:8px;font-size:100%;"><span class="' . (is_emp() ? 'emp' : 'frl') . 'name11"><a href="/users/' . get_login($user_id) . '/" class="' . (is_emp() ? 'emp' : 'frl') . 'name11" title="' . $user_name['uname'] . ' ' . $user_name['usurname'] . '">' . $user_name['uname'] . ' ' . $user_name['usurname'] . '</a> [<a href="/users/' . $user_name['login'] . '/" class="' . (is_emp() ? 'emp' : 'frl') . 'name11" title="' . $user_name['login'] . '">' . $user_name['login'] . '</a>]</span> <span id="po_date_' . $last_comment . '">[' . strftime('%d.%m.%Y | %H:%M', time()) . ']</span><br /><div id="po_comment_' . $last_comment . '">' . reformat($sPostText, 50, 0, 0, 1) . '</div><div id="po_comment_original_' . $last_comment . '" style="display:none;">' . str_replace(' ', ' ', reformat($po_text, 1000, 0, 1)) . '</div></div>'); // $objResponse->call('resetfld', $po_id); $objResponse->script('dialogue_count[' . $po_id . '] = ' . (count($project_dialogue) + 1)); } else { $objResponse->assign('po_comment_' . $po_commentid, 'innerHTML', reformat($sPostText, 50, 0, 0, 1)); $objResponse->assign('po_comment_original_' . $po_commentid, 'innerHTML', str_replace(' ', ' ', reformat($po_text, 1000, 0, 1))); $objResponse->assign('po_date_' . $po_commentid, 'innerHTML', dateFormat('[d.m.Y | H:i]', date('Y-m-d H:i:s'))); } $objResponse->call('answer', $po_id); if ($to_user_name && $project['id'] && $project['name'] && !$po_commentid) { /*require_once($_SERVER['DOCUMENT_ROOT'] . "/classes/smail.php"); $smail = new smail(); if ($project['user_id'] == $user_id) { $error = $smail->NewPrjMessageOnOfferFrl($user_name['login'], $project['id'], $project['name'], $to_user_name, $po_text); } else { $error = $smail->NewPrjMessageOnOfferEmp($user_name['login'], $project['id'], $project['name'], $to_user_name, $po_text); }*/ } } else { $objResponse->alert('Ошибка сохранения.'); } } else { $objResponse->alert('Ошибка сохранения. Авторизируйтесь на сайте.'); } return $objResponse; }
function refresh($params) { global $CONFIG, $SESSION; // xajax response $objResponse = new xajaxResponse(); $iface = $params['interface']; $ipaddr = $params['ipaddr']; $received = $params['received']; $transmitted = $params['transmitted']; $type = $params['type']; switch ($type) { case 2: if (empty($CONFIG['phpui']['arping_helper'])) { $cmd = 'arping %i -c 1 -w 1.0'; } else { $cmd = $CONFIG['phpui']['arping_helper']; } $summary_regexp = '/^sent+[[:blank:]]+[0-9]+[[:blank:]]+probes/i'; $reply_regexp = '/unicast/i'; $reply_detailed_regexp = '/\\ \\[(.*?)\\].+\\ ([0-9\\.]+.+)$/'; break; case 1: default: if (empty($CONFIG['phpui']['ping_helper'])) { $cmd = 'ping %i -c 1 -s 1450 -w 1.0'; } else { $cmd = $CONFIG['phpui']['ping_helper']; } $summary_regexp = '/^[0-9]+[[:blank:]]+packets[[:blank:]]+transmitted/i'; $reply_regexp = '/icmp_[rs]eq/'; $reply_detailed_regexp = '/^([0-9]+).+icmp_[rs]eq=([0-9]+).+ttl=([0-9]+).+time=([0-9\\.]+.+)$/'; break; } $cmd = preg_replace('/%if/', $iface, $cmd); $cmd = preg_replace('/%i/', $ipaddr, $cmd); exec($cmd, $output); $sent = preg_grep($summary_regexp, $output); $replies = preg_grep($reply_regexp, $output); $times = array(); if (count($replies)) { if (count($sent) && preg_match('/^([0-9]+)/', current($sent), $matches)) { $transmitted += $matches[1]; } else { $transmitted++; } $output = ''; $seqs = array(); $oldreceived = $received; foreach ($replies as $reply) { if (preg_match($reply_detailed_regexp, $reply, $matches)) { if (!isset($seqs[$matches[2]])) { $seqs[$matches[2]] = true; $received++; } if ($type == 1) { $output .= trans('$a bytes from $b: icmp_req=$c ttl=$d time=$e', $matches[1], $ipaddr, $oldreceived + $matches[2], $matches[3], $matches[4]) . '<br>'; $times[] = $matches[4]; } elseif ($type == 2) { $output .= trans('Unicast reply from $a [$b]: time=$c', $ipaddr, $matches[1], $matches[2]) . '<br>'; $times[] = $matches[2]; } } } } else { $output = trans('Destination Host Unreachable') . '<br>'; } if (empty($received)) { $received = '0'; } $SESSION->save('ping_type', $type); $SESSION->close(); // force session state save $objResponse->append('data', 'innerHTML', $output); $objResponse->assign('transmitted', 'value', $transmitted); $objResponse->assign('received', 'value', $received); $objResponse->assign('total', 'innerHTML', trans('Total: $a% ($b/$c)', round($received / $transmitted * 100), $received, $transmitted)); $objResponse->assign('times', 'value', json_encode($times)); $objResponse->call('ping_reply'); return $objResponse; }
function EditOpinionComm($op_id, $comm_id, $text, $from = 'frl', $isFeedback = false) { @session_start(); $objResponse = new xajaxResponse(); $text = trim($text); if ($text == '') { $objResponse->script("opinionCommentFormError('{$op_id}');"); } elseif (strlen(stripslashes($text)) > opinions::$comment_max_length) { $objResponse->script("opinionMaxLengthError('edit_comm_{$op_id}', " . opinions::$comment_max_length . ');'); } else { if ($isFeedback) { $msg = sbr_meta::getFeedback($op_id, true); } else { $msg = opinions::GetMessageById($op_id); } $text = str_replace('&', '&', $text); $text = stripslashes($text); $text = change_q_x($text, FALSE, TRUE, '', false, false); $prefix = $isFeedback ? 'feedback_' : ''; if ((int) $comm_id > 0) { // Редактируем if ($isFeedback) { opinions::editCommentFeedback($text, get_uid(false), $comm_id, $msg['fromuser_id']); } else { opinions::editCommentOpinion($text, get_uid(false), $comm_id); } $objResponse->script("\$('" . $prefix . "comment_content_{$op_id}').setStyle('display', '');\n \$('" . $prefix . "opinion_btn_edit_comment_{$op_id}').setProperty('disabled', '');\n \$('" . $prefix . "ed_comm_form_{$op_id}').dispose();"); //$objResponse->assign($prefix . "comment_text_{$op_id}", "innerHTML", $text); $html = opinions::printCommentOpinions($op_id, $isFeedback); $objResponse->script("\$('" . $prefix . "comment_cont_{$op_id}').empty()"); $objResponse->append($prefix . "comment_cont_{$op_id}", 'innerHTML', $html); } else { // Добавляем if ($isFeedback) { opinions::newCommentFeedback($text, get_uid(false), $op_id); } else { opinions::newCommentOpinion($text, get_uid(false), $op_id); } $html = opinions::printCommentOpinions($op_id, $isFeedback); $objResponse->script("\$('" . $prefix . "ed_comm_form_{$op_id}').dispose();"); $objResponse->append($prefix . "comment_cont_{$op_id}", 'innerHTML', $html); } $objResponse->script("opinionCheckMaxLengthStop('" . $prefix . "edit_comm_{$op_id}');"); } return $objResponse; }
/** * end regression testing * this function is registered in xajax * @param int $successful indicates if regression test was successful * @return xajaxResponse every xajax registered function needs to return this object */ function end_regression_test($successful) { global $logging; global $firstthingsfirst_date_string; $logging->info("REGRESSIONTEST: end regression test (successful={$successful})"); # create necessary objects $response = new xajaxResponse(); $html_str = ""; if ($successful == 1) { # create html for text $html_str .= "\n <div id=\"test_end_white_space\"> </div>\n"; $html_str .= " <div id=\"test_end_successful\">"; $html_str .= "Congratulations! Regression test was successful"; $html_str .= "</div> <!-- test_end_successful -->\n\n "; $response->append("test_body", "innerHTML", $html_str); } else { # create html for error text $html_str .= "\n <div id=\"test_end_white_space\"> </div>\n"; $html_str .= "\n <div id=\"test_end_unsuccessful\">"; $html_str .= "Regression test was unsuccessful"; $html_str .= "<div> <!-- test_end_unsuccessful -->\n\n "; $response->append("test_body", "innerHTML", $html_str); } # append end date to footer $html_str = "<strong>" . strftime(DATETIME_FORMAT_EU) . "</strong>"; if ($firstthingsfirst_date_string == DATE_FORMAT_US) { $html_str = "<strong>" . strftime(DATETIME_FORMAT_US) . "</strong>"; } $response->append("footer_text", "innerHTML", $html_str); # highlight footer $response->script("document.getElementById('focus_on_this_input').blur()"); $response->script("document.getElementById('focus_on_this_input').focus()"); $logging->trace("done ending"); return $response; }