当前位置: 首页>>代码示例>>PHP>>正文


PHP xajaxResponse::redirect方法代码示例

本文整理汇总了PHP中xajaxResponse::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP xajaxResponse::redirect方法的具体用法?PHP xajaxResponse::redirect怎么用?PHP xajaxResponse::redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xajaxResponse的用法示例。


在下文中一共展示了xajaxResponse::redirect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: BlockPlayer

function BlockPlayer($check, $sid, $num, $type, $length)
{
    $objResponse = new xajaxResponse();
    global $userbank, $username;
    $sid = (int) $sid;
    $length = (int) $length;
    if (!$userbank->HasAccess(ADMIN_OWNER | ADMIN_ADD_BAN)) {
        $objResponse->redirect("index.php?p=login&m=no_access", 0);
        $log = new CSystemLog("w", "Hacking Attempt", $username . " tried to process a playerblock, but doesnt have access.");
        return $objResponse;
    }
    //get the server data
    $sdata = $GLOBALS['db']->GetRow("SELECT ip, port, rcon FROM " . DB_PREFIX . "_servers WHERE sid = '" . $sid . "';");
    //test if server is online
    if ($test = @fsockopen($sdata['ip'], $sdata['port'], $errno, $errstr, 2)) {
        @fclose($test);
        require_once INCLUDES_PATH . "/CServerRcon.php";
        $r = new CServerRcon($sdata['ip'], $sdata['port'], $sdata['rcon']);
        if (!$r->Auth()) {
            $GLOBALS['db']->Execute("UPDATE " . DB_PREFIX . "_servers SET rcon = '' WHERE sid = '" . $sid . "' LIMIT 1;");
            $objResponse->addAssign("srv_{$num}", "innerHTML", "<font color='red' size='1'>Wrong RCON Password, please change!</font>");
            $objResponse->addScript('set_counter(1);');
            return $objResponse;
        }
        $ret = $r->rconCommand("status");
        // show hostname instead of the ip, but leave the ip in the title
        require_once "../includes/system-functions.php";
        $hostsearch = preg_match_all('/hostname:[ ]*(.+)/', $ret, $hostname, PREG_PATTERN_ORDER);
        $hostname = trunc(htmlspecialchars($hostname[1][0]), 25, false);
        if (!empty($hostname)) {
            $objResponse->addAssign("srvip_{$num}", "innerHTML", "<font size='1'><span title='" . $sdata['ip'] . ":" . $sdata['port'] . "'>" . $hostname . "</span></font>");
        }
        $gothim = false;
        $search = preg_match_all(STATUS_PARSE, $ret, $matches, PREG_PATTERN_ORDER);
        //search for the steamid on the server
        foreach ($matches[3] as $match) {
            if (substr($match, 8) == substr($check, 8)) {
                // gotcha!!! kick him!
                $gothim = true;
                $GLOBALS['db']->Execute("UPDATE `" . DB_PREFIX . "_comms` SET sid = '" . $sid . "' WHERE authid = '" . $check . "' AND RemovedBy IS NULL;");
                $requri = substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], "pages/admin.blockit.php"));
                $kick = $r->sendCommand("sc_fw_block " . $type . " " . $length . " " . $match);
                $objResponse->addAssign("srv_{$num}", "innerHTML", "<font color='green' size='1'><b><u>Player Found & blocked!!!</u></b></font>");
                $objResponse->addScript("set_counter('-1');");
                return $objResponse;
            }
        }
        if (!$gothim) {
            $objResponse->addAssign("srv_{$num}", "innerHTML", "<font size='1'>Player not found.</font>");
            $objResponse->addScript('set_counter(1);');
            return $objResponse;
        }
    } else {
        $objResponse->addAssign("srv_{$num}", "innerHTML", "<font color='red' size='1'><i>Can't connect to server.</i></font>");
        $objResponse->addScript('set_counter(1);');
        return $objResponse;
    }
}
开发者ID:CodingDK,项目名称:SourceBans-Fork,代码行数:58,代码来源:admin.blockit.php

示例2: login

function login($data)
{
    //global $tpl;
    $objResponse = new xajaxResponse();
    include 'settings/tables.php';
    /* Crypt Password with MD5 Method */
    $pw_crypted = MD5(mysql_real_escape_string($data['password']));
    //encrypt password with MD5
    $email = mysql_real_escape_string($data['email']);
    /******************************************/
    /* Create Object :: EXIST */
    $logon = new CheckExist();
    /******************************************/
    /* Check :: EXIST */
    $logon->tableE = $tbl_users;
    $logon->conditionE = " UserEmail = '" . $email . "' && UserPass = '" . $pw_crypted . "' && activation_code = '' ";
    $CheckData = $logon->exist();
    /******************************************/
    /* Change Status :: Login successful or failed */
    if ($CheckData == 1) {
        $logon->email = $email;
        $logon->pw = $pw_crypted;
        $logon->tbl_users = $tbl_users;
        //setcookie
        if (isset($data['autologon'])) {
            $logon->cookie_duration = 1;
        } else {
            $logon->cookie_duration = 0;
        }
        $logon->cookieset('ly');
        $objResponse->Script("document.getElementById('submit_login').onclick()");
        $objResponse->redirect(ROOT_DIR);
        //return true;
    } else {
        $logon->email = '';
        $logon->pw = '';
        //$logon->cookieset('l');
        $objResponse->assign("p_logon_failure", "style.display", 'block');
        $objResponse->assign("p_logon_failure", "innerHTML", "Login information could not be verified.<br> Please try it again.");
        //TODO move string to language file
        //$tpl->display("logon/login.tpl");
        //return false;
    }
    unset($logon);
    /******************************************/
    return $objResponse;
}
开发者ID:nbgmaster,项目名称:happify,代码行数:47,代码来源:login.php

示例3: reguser

function reguser($form)
{
    global $db, $tablepre, $onlineip;
    $obj = new xajaxResponse();
    $usernamereg = '/^\\s*$|^c:\\con\\con$|[%,\\*\\"\\s\\t\\<\\>\\&]|\\xA1\\xA1|\\xAC\\xA3|^guest|^\\xD3\\xCE\\xBF\\xCD|\\xB9\\x43\\xAB\\xC8/i';
    $emailreg = '/^(([^<>()[\\]\\.,;:\\s@"\']+(\\.[^<>()[\\]\\.,;:\\s@"\']+)*)|("[^"\']+"))@((\\[\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\])|(([a-zA-Z\\d\\-]+\\.)+[a-zA-Z]{2,}))$/';
    $username = addslashes(trim($form['username']));
    $password = trim($form['password']);
    $email = trim($form['email']);
    if (empty($username) || preg_match($usernamereg, $username) || strlen($username) < 3 || strlen($username) > 15 || preg_match("~/|\\|\\'|\"~", $password) || strlen($password) < 6 || strlen($password) > 20 || !preg_match($emailreg, $email)) {
        return $obj->redirect(WEB_URL);
    }
    $sql = "SELECT * FROM `{$tablepre}members` where username='{$name}' or (regip='{$onlineip}' AND DATE(regdate)=CURDATE())";
    $query = $db->query($sql) or error('Unable to fetch member.', __FILE__, __LINE__, $db->error());
    if ($db->num_rows($query)) {
        return $obj->script("\$('chk_stat').className = d_err;\$('chk_stat').setHTML('此ID已被注册或者您今天已经注册过会员,请勿多次提交申请。');\$('regbotton').disabled = 'disabled';");
    }
    $sql = "INSERT INTO `{$tablepre}members` (username,password,email,regdate,regip) VALUES ('{$username}',MD5('{$password}'),'{$email}',now(),'{$onlineip}')";
    $db->query($sql) or error('Unable to insert into member.', __FILE__, __LINE__, $db->error());
    $uid = $db->insert_id();
    $db->query("INSERT INTO `{$tablepre}box` (uid,time) VALUES ('{$uid}',now())") or error('Unable to insert into box.', __FILE__, __LINE__, $db->error());
    $db->query("INSERT INTO `{$tablepre}memberdata` (uid,username,lastloginip,lastvisit) VALUES ('{$uid}','{$username}','{$onlineip}',UNIX_TIMESTAMP())");
    $obj->script("\$('regbotton').disabled = 'disabled';alert('注册成功!');");
    return $obj;
}
开发者ID:haseok86,项目名称:millkencode,代码行数:25,代码来源:mod_register.php

示例4: AddOpinion

/**
 * @deprecated #0015627
 */
function AddOpinion($source_uid, $dest_uid, $message, $rating, $counter, $from = 'frl')
{
    return false;
    $source_uid = get_uid(false);
    $objResponse = new xajaxResponse();
    $message = trim($message);
    if (!in_array($rating, array(-1, 0, 1))) {
        $objResponse->assign('rating_error', 'innerHTML', 'Вы не выбрали категорию отзыва');
    } elseif (opinions::CheckUserCanPost($source_uid, $dest_uid) != 0) {
        // левый пользователь
    } elseif ($message == '') {
        $objResponse->script("opinionFormError('error_msg');");
    } elseif (strlen($message) > opinions::$opinion_max_length) {
        $objResponse->script("opinionMaxLengthError('msg', " . opinions::$opinion_max_length . ');');
    } else {
        $message = str_replace('&', '&amp;', $message);
        $message = stripslashes($message);
        $message = change_q_x($message, FALSE, TRUE, '', false, false);
        $error = opinions::NewMsg($source_uid, $dest_uid, $message, $rating, getRemoteIP(), $new_id);
        if (!$error) {
            $msg = opinions::GetLastMessage($source_uid, $dest_uid);
            if ($msg) {
                $user = new users();
                $user->GetUserByUID($dest_uid);
                $objResponse->remove('form_container');
                if (is_emp() && $from == 'frl' || !is_emp() && $from == 'emp') {
                    $from = $from == 'frl' ? 'emp' : 'frl';
                    $objResponse->redirect("/users/{$user->login}/opinions/?from={$from}#o_{$new_id}");
                    return $objResponse;
                }
                $objResponse->prepend('messages_container', 'innerHTML', opinions::printTheme($msg, $from, $counter, $user));
                $objResponse->prepend('messages_container', 'innerHTML', opinions::printAddForm($source_uid, $dest_uid, $from));
                $nt = $rating == 1 ? 'plus' : ($rating == -1 ? 'minus' : 'neitral');
                $objResponse->call('opinionChConuters', NULL, 'ops-' . $from . $nt);
                $objResponse->script("opinionCheckMaxLengthStop('msg');");
                $objResponse->assign('no_messages', 'innerHTML', '');
            } else {
                $objResponse->script("alert('" . serialize($msg) . "')");
            }
        } else {
            $objResponse->script("alert('" . $error . "')");
        }
    }
    return $objResponse;
}
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:48,代码来源:opinions.server.php

示例5: addV

function addV($vF)
{
    global $db;
    $resp = new xajaxResponse();
    $title = $vF['name'];
    if (!$title) {
        return $resp->alert('标题为空');
    }
    $query = $db->query("INSERT INTO `vote` SET `title` = '{$title}'") or error('Unable to insert vote data', __FILE__, __LINE__, $db->error());
    $insert_id = $db->get_insert_id();
    foreach ($vF['add'] as $v) {
        $db->query("INSERT INTO `vote` values (null,'{$v}',0,0,{$insert_id})") or error('Unable to insert vote data', __FILE__, __LINE__, $db->error());
    }
    $resp->alert("添加成功!");
    $resp->redirect('vote_manager.php');
    //$resp->alert(print_r($vF['add'],true));
    return $resp->getXML();
}
开发者ID:haseok86,项目名称:millkencode,代码行数:18,代码来源:vote_manager.php

示例6: loginAjax

 public function loginAjax($aData)
 {
     $oResp = new xajaxResponse();
     // walidacja danych
     $oValidator = new Module_Validator();
     $oValidator->field('type_id', $iTypeId)->rules('required|toint|not[0]');
     $oValidator->field('type_name', $sValue)->rules('required|hsc');
     if ($oValidator->validate()) {
     } else {
     }
     $oUser = Model_User::tryCreate($aData['login']);
     $sPassHash = md5($aData['password'] . 'fibonacci98765434567');
     if ($oUser !== null && $this->oAuth->login($oUser, $sPassHash)) {
         $oResp->redirect($this->getPageUrl('/'));
     } else {
         $oResp->assign('error_msg', 'innerHTML', 'Incorrect name or password');
     }
     return $oResp;
 }
开发者ID:maxwroc,项目名称:PHP,代码行数:19,代码来源:Login.php

示例7: myFunction

function myFunction($post)
{
    $usuario = htmlentities($post['login']);
    $clave = htmlentities($post['password']);
    $db = new MySQL();
    $resultado = $db->consulta("Select vUsuClave,TipoUsuario_iTiUsuarioIdTipoUsuario from usuarios where vUsuUsuario='" . $usuario . "'");
    $filas = $db->num_rows($resultado);
    $respuesta = new xajaxResponse();
    if ($filas > 0) {
        $row = mysql_fetch_assoc($resultado);
        if ($row['vUsuClave'] == hash_hmac('md5', $clave, 'tesis')) {
            $resultado2 = $db->consulta("Select vUrl from tipousuario where iTiUsuarioIdTipoUsuario='" . $row['TipoUsuario_iTiUsuarioIdTipoUsuario'] . "' and Estado='A'");
            $row2 = mysql_fetch_assoc($resultado2);
            $respuesta->redirect($_configuration['root_web'] . $row2['vUrl']);
        } else {
            $respuesta->assign("mensaje", "innerHTML", "<div id='login_fail'>Contrase&ntilde;a Incorrecta</div>");
        }
    } else {
        $respuesta->assign("mensaje", "innerHTML", "<div id='login_fail'>Usuario Incorrecto</div>");
    }
    return $respuesta;
}
开发者ID:renzot23,项目名称:Los-Pinos-Virtual,代码行数:22,代码来源:validar.php

示例8: SendMessage

function SendMessage($sid, $name, $message)
{
    $objResponse = new xajaxResponse();
    global $userbank, $username;
    if (!$userbank->is_admin()) {
        $objResponse->redirect("index.php?p=login&m=no_access", 0);
        $log = new CSystemLog("w", "Ошибка доступ", $username . " пытался отправить для '" . addslashes(htmlspecialchars($name)) . "' сообщение (\"" . RemoveCode($message) . "\"), не имея на это прав.");
        return $objResponse;
    }
    $sid = (int) $sid;
    require INCLUDES_PATH . '/CServerRcon.php';
    //get the server data
    $data = $GLOBALS['db']->GetRow("SELECT ip, port, rcon FROM " . DB_PREFIX . "_servers WHERE sid = '" . $sid . "';");
    if (empty($data['rcon'])) {
        $objResponse->addScript("ShowBox('Ошибка', 'Невозможно отправить сообщение для " . addslashes(htmlspecialchars($name)) . ". Не задан РКОН пароль!', 'red', '', true);");
        return $objResponse;
    }
    $r = new CServerRcon($data['ip'], $data['port'], $data['rcon']);
    if (!$r->Auth()) {
        $GLOBALS['db']->Execute("UPDATE " . DB_PREFIX . "_servers SET rcon = '' WHERE sid = '" . $sid . "';");
        $objResponse->addScript("ShowBox('Ошибка', 'Невозможно отправить сообщение для " . addslashes(htmlspecialchars($name)) . ". Неверноый РКОН пароль!', 'red', '', true);");
        return $objResponse;
    }
    $ret = $r->sendCommand('sm_psay "' . $name . '" "' . addslashes($message) . '"');
    new CSystemLog("m", "Сообщение отправлено", "Следующее сообщение было отправлено " . addslashes(htmlspecialchars($name)) . " на сервер " . $data['ip'] . ":" . $data['port'] . ": " . RemoveCode($message));
    $objResponse->addScript("ShowBox('Сообщение отправлено', 'Сообщение для \\'" . addslashes(htmlspecialchars($name)) . "\\' успешно отправлено!', 'green', '', true);\$('dialog-control').setStyle('display', 'block');");
    return $objResponse;
}
开发者ID:BGCX261,项目名称:zion-downloads-css-svn-to-git,代码行数:28,代码来源:sb-callback.php

示例9: closePopup

function closePopup()
{
    $objResponse = new xajaxResponse();
    $objResponse->remove("popup");
    $objResponse->removeCSS('includes/layout/overlay.css');
    if ($_SESSION['popup_close_redirect'] == 'yes') {
        $project7 = new editsee_App();
        $_SESSION['popup_close_redirect'] = '';
        $_SESSION['temp_theme'] = '';
        $objResponse->redirect($project7->get_config('es_main_url'));
    }
    return $objResponse;
}
开发者ID:apexad,项目名称:editsee,代码行数:13,代码来源:xajax.php

示例10: LiveMessage

function LiveMessage($a) {
    global $db;
    $sessionid = $_SESSION['sessionid'];
    $name = htmlspecialchars($a['name']);
    $email = htmlspecialchars($a['email']);
    $country = htmlspecialchars($a['country']);
    $phone = htmlspecialchars($a['phone']);
    $departmentid = htmlspecialchars($a['departmentid']);
    $message = htmlspecialchars($a['message']);
    $timestamp = time();
    $ip = $_SERVER['REMOTE_ADDR'];
    $sql = "INSERT INTO `chat` (`sessionid`,`name`,`email`,`phone`,`departmentid`,`message`,`timestamp`,`ip`,`status`) VALUES('" . $sessionid . "','" . $name . "','" . $email . "','" . $phone . "','" . $departmentid . "','" . $message . "','" . $timestamp . "','" . $ip . "','2')";
    $db->query($sql);
    $sql = "DELETE FROM `sessions` WHERE `id`='" . $sessionid . "'";
    $db->query($sql);
    $text = "<?php echo $lang[shout_success]?>\n";
    $objResponse = new xajaxResponse('utf-8');
    $objResponse->addAssign('content', 'innerHTML', $text);
    $objResponse->redirect('../', 5);
    return $objResponse;
}
开发者ID:jiangsuei8,项目名称:public_php_shl,代码行数:21,代码来源:xajax.inc.php

示例11: deleteDirection

function deleteDirection($id)
{
    session_start();
    if (!hasPermissions('seo')) {
        return false;
    }
    $objResponse = new xajaxResponse();
    $id = intval($id);
    if (!$id) {
        $objResponse->alert('Идентификатор направления не указан');
        return $objResponse;
    }
    $seo = new seo();
    if (!$seo->deleteDirection($id)) {
        $objResponse->alert('Ошибка удаления');
        return $objResponse;
    }
    $objResponse->redirect('/catalog/admin/?direction=-1');
    return $objResponse;
}
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:20,代码来源:seo.server.php

示例12: redirect

function redirect()
{
    $objResponse = new xajaxResponse();
    $objResponse->redirect("http://www.xajaxproject.org");
    return $objResponse;
}
开发者ID:silvia-valdez,项目名称:SignalsViewer,代码行数:6,代码来源:redirectTest.php

示例13: rate

function rate($site, $id, $rating)
{
    global $memcache;
    global $duration;
    global $_COOKIE;
    global $tpl;
    include 'settings/tables.php';
    $objResponse = new xajaxResponse();
    if (!isset($_COOKIE["l"])) {
        $objResponse->redirect(ROOT_DIR);
        return $objResponse;
    }
    $l["token"] = substr($_COOKIE["l"], 3, -35);
    $mem_key1 = "user_data_" . $l["token"];
    $user_data = $memcache->get($mem_key1);
    $mem_key2 = "trigger_f_" . $l["token"];
    $trigger_f = $memcache->get($mem_key2);
    include 'modules/logon/get_userdata.php';
    $mem_key3 = "ay_flashes_voted_" . $l["token"];
    $mem_key4 = "ay_flashes_rated_" . $l["token"];
    $ay_flashes_voted = $memcache->get($mem_key3);
    $ay_flashes_rated = $memcache->get($mem_key4);
    $ay_flash_cats = $memcache->get('ay_flash_cats');
    include 'modules/flash/flashfeed_add.php';
    if ($site == 'flash') {
        $likes_str = 'p_likes_' . $id;
        $dislikes_str = 'p_dislikes_' . $id;
        $rate_str = 'p_rate_' . $id;
        $upd_data = new ModifyEntry();
        $upd_data->table = $tbl_flashes;
        $upd_data->condition = " ID = '{$id}' ";
        if ($rating == "like") {
            $upd_data->changes = " likes = likes+1, rating = rating+1 ";
        }
        if ($rating == "dislike") {
            $upd_data->changes = " dislikes = dislikes+1, rating = rating-1 ";
        }
        $upd_data->update();
        unset($upd_data);
        $ins_data = new ModifyEntry();
        $ins_data->table = $tbl_flash_ratings;
        $ins_data->cols = 'flashID, userID, rating';
        $ins_data->values = " '{$id}', '" . $user_data['ID'] . "', '{$rating}' ";
        $ins_data->insert();
        unset($ins_data);
        $flash_result = new SelectEntrys();
        $flash_result->cols = 'likes, dislikes';
        $flash_result->table = $tbl_flashes;
        $flash_result->condition = " ID = '{$id}' ";
        $flash_result->multiSelect = 1;
        $ay_flash_result = $flash_result->row();
        unset($flash_result);
        $ay_flashes_rated[] = $id;
        sort($ay_flashes_rated);
        $mem_key4 = "ay_flashes_rated_" . $l["token"];
        $memcache->replace($mem_key4, $ay_flashes_rated, false);
        $objResponse->assign($rate_str, "style.display", 'none');
        $objResponse->assign($likes_str, "innerHTML", $ay_flash_result[0]['likes']);
        $objResponse->assign($dislikes_str, "innerHTML", $ay_flash_result[0]['dislikes']);
    }
    return $objResponse;
}
开发者ID:nbgmaster,项目名称:wiflash,代码行数:62,代码来源:ajax_functions.php

示例14: SendMessage

function SendMessage($sid, $name, $message)
{
    $objResponse = new xajaxResponse();
    global $userbank, $username;
    if (!$userbank->is_admin()) {
        $objResponse->redirect("index.php?p=login&m=no_access", 0);
        $log = new CSystemLog("w", "Hacking Attempt", $username . " tried to send ingame message to '" . addslashes(htmlspecialchars($name)) . "' (\"" . RemoveCode($message) . "\"), but doesnt have access.");
        return $objResponse;
    }
    $sid = (int) $sid;
    require INCLUDES_PATH . '/CServerRcon.php';
    //get the server data
    $data = $GLOBALS['db']->GetRow("SELECT ip, port, rcon FROM " . DB_PREFIX . "_servers WHERE sid = '" . $sid . "';");
    if (empty($data['rcon'])) {
        $objResponse->addScript("ShowBox('Error', 'Can\\'t send message to " . addslashes(htmlspecialchars($name)) . ". No RCON password!', 'red', '', true);");
        return $objResponse;
    }
    $r = new CServerRcon($data['ip'], $data['port'], $data['rcon']);
    if (!$r->Auth()) {
        $GLOBALS['db']->Execute("UPDATE " . DB_PREFIX . "_servers SET rcon = '' WHERE sid = '" . $sid . "';");
        $objResponse->addScript("ShowBox('Error', 'Can\\'t send message to " . addslashes(htmlspecialchars($name)) . ". Wrong RCON password!', 'red', '', true);");
        return $objResponse;
    }
    $ret = $r->sendCommand('sm_psay "' . $name . '" "' . addslashes($message) . '"');
    new CSystemLog("m", "Message sent to player", "The following message was sent to " . addslashes(htmlspecialchars($name)) . " on server " . $data['ip'] . ":" . $data['port'] . ": " . RemoveCode($message));
    $objResponse->addScript("ShowBox('Message Sent', 'The message has been sent to player \\'" . addslashes(htmlspecialchars($name)) . "\\' successfully!', 'green', '', true);\$('dialog-control').setStyle('display', 'block');");
    return $objResponse;
}
开发者ID:urichalex,项目名称:sourcebansv1,代码行数:28,代码来源:sb-callback.php

示例15: takeGroupMail

/**
 * @param string $destDiv
 * @param int $msgId
 * @return xajaxResponse
 */
function takeGroupMail($destDiv = 'mod-webmail_inbox', $msgId = 1)
{
    global $prefs, $user, $webmaillib, $module_params;
    include_once 'lib/webmail/webmaillib.php';
    $contactlib = TikiLib::lib('contact');
    $categlib = TikiLib::lib('categ');
    $tikilib = TikiLib::lib('tiki');
    $trklib = TikiLib::lib('trk');
    if (isset($_SESSION['webmailinbox'][$destDiv]['module_params'])) {
        $module_params = $_SESSION['webmailinbox'][$destDiv]['module_params'];
    } else {
        $module_params = array();
        // TODO error?
    }
    $accountid = isset($module_params["accountid"]) ? $module_params['accountid'] : 0;
    $ls = $webmaillib->refresh_mailbox($user, $accountid, false);
    $cont = $webmaillib->get_mail_content($user, $accountid, $msgId);
    $acc = $webmaillib->get_webmail_account($user, $accountid);
    // make tracker item
    $m = $ls[$msgId - 1];
    $from = $m['from'];
    $subject = $m['subject'];
    $realmsgid = $m['realmsgid'];
    $maildate = $m['date'];
    $maildate = strtotime($maildate);
    $objResponse = new xajaxResponse();
    // check if already taken
    $itemid = $trklib->get_item_id($module_params['trackerId'], $module_params['messageFId'], $realmsgid);
    if ($itemid > 0) {
        $objResponse->script('doRefreshWebmail();alert("Sorry, that mail has been taken by another operator. Refreshing list...");');
    } else {
        $charset = $prefs['default_mail_charset'];
        if (empty($charset)) {
            $charset = 'UTF-8';
        }
        $items['data'][0]['fieldId'] = $module_params['fromFId'];
        $items['data'][0]['type'] = 't';
        $items['data'][0]['value'] = $from;
        $items['data'][1]['fieldId'] = $module_params['operatorFId'];
        $items['data'][1]['type'] = 'u';
        $items['data'][1]['value'] = $user;
        $items['data'][2]['fieldId'] = $module_params['subjectFId'];
        $items['data'][2]['type'] = 't';
        $items['data'][2]['value'] = $subject;
        $items['data'][3]['fieldId'] = $module_params['messageFId'];
        $items['data'][3]['type'] = 't';
        $items['data'][3]['value'] = $realmsgid;
        $items['data'][4]['fieldId'] = $module_params['contentFId'];
        $items['data'][4]['type'] = 'a';
        $items['data'][4]['value'] = htmlentities($cont['body'], ENT_QUOTES, $charset);
        $items['data'][5]['fieldId'] = $module_params['accountFId'];
        $items['data'][5]['type'] = 't';
        $items['data'][5]['value'] = $acc['account'];
        $items['data'][6]['fieldId'] = $module_params['datetimeFId'];
        $items['data'][6]['type'] = 'f';
        // f?
        $items['data'][6]['value'] = $maildate;
        $trklib->replace_item($module_params['trackerId'], 0, $items);
    }
    // make name for wiki page
    $pageName = str_replace('@', '_AT_', $m['sender']['email']);
    $contId = $contactlib->get_contactId_email($m['sender']['email'], $user);
    // add or update (?) contact
    $ext = $contactlib->get_ext_by_name($user, tra('Wiki Page'), $contId);
    if (!$ext) {
        $contactlib->add_ext($user, tra('Wiki Page'), true);
        // a public field
        $ext = $contactlib->get_ext_by_name($user, tra('Wiki Page'), $contId);
    }
    $arr = explode(" ", trim(html_entity_decode($m['sender']['name']), '"\' '), 2);
    if (count($arr) < 2) {
        $arr[] = '';
    }
    $contactlib->replace_contact($contId, $arr[0], $arr[1], $m['sender']['email'], '', $user, array($module_params['group']), array($ext['fieldId'] => $pageName), true);
    if (!$contId) {
        $contId = $contactlib->get_contactId_email($m['sender']['email'], $user);
    }
    // make or update wiki page
    $wikilib = TikiLib::lib('wiki');
    if (!$wikilib->page_exists($pageName)) {
        $comment = 'Generated by GroupMail on ' . date(DATE_RFC822);
        $description = "Page {$comment} for " . $m['sender']['email'];
        $data = '!GroupMail case with ' . $m['sender']['email'] . "\n";
        $data .= "''{$comment}''\n\n";
        $data .= "!!Info\n";
        $data .= "Contact info: [tiki-contacts.php?contactId={$contId}|" . $m['sender']['name'] . "]\n\n";
        $data .= "!!Logs\n";
        $data .= '{trackerlist trackerId="' . $module_params['trackerId'] . '" ' . 'fields="' . $module_params['fromFId'] . ':' . $module_params['operatorFId'] . ':' . $module_params['subjectFId'] . ':' . $module_params['datetimeFId'] . '" ' . 'popup="' . $module_params['fromFId'] . ':' . $module_params['contentFId'] . '" stickypopup="n" showlinks="y" shownbitems="n" showinitials="n"' . 'showstatus="n" showcreated="n" showlastmodif="n" filterfield="' . $module_params['fromFId'] . '" filtervalue="' . $m['sender']['email'] . '"}';
        $data .= "\n\n";
        $tikilib->create_page($pageName, 0, $data, $tikilib->now, $comment, $user, $tikilib->get_ip_address(), $description);
        $categlib->update_object_categories(array($categlib->get_category_id('Help Team Pages')), $pageName, 'wiki page');
        // TODO remove hard-coded cat name
    }
    $objResponse->redirect($wikilib->sefurl($pageName));
    return $objResponse;
//.........这里部分代码省略.........
开发者ID:rjsmelo,项目名称:tiki,代码行数:101,代码来源:tiki-webmail_ajax.php


注:本文中的xajaxResponse::redirect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。