| [ Index ] |
|
Code source de XOOPS 2.0.17.1 |
1 <?php 2 // $Id: pmlite.php 889 2007-07-28 09:18:01Z phppp $ 3 // ------------------------------------------------------------------------ // 4 // XOOPS - PHP Content Management System // 5 // Copyright (c) 2000 XOOPS.org // 6 // <http://www.xoops.org/> // 7 // ------------------------------------------------------------------------ // 8 // This program is free software; you can redistribute it and/or modify // 9 // it under the terms of the GNU General Public License as published by // 10 // the Free Software Foundation; either version 2 of the License, or // 11 // (at your option) any later version. // 12 // // 13 // You may not change or alter any portion of this comment or credits // 14 // of supporting developers from this source code or any supporting // 15 // source code which is considered copyrighted (c) material of the // 16 // original comment or credit authors. // 17 // // 18 // This program is distributed in the hope that it will be useful, // 19 // but WITHOUT ANY WARRANTY; without even the implied warranty of // 20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // 21 // GNU General Public License for more details. // 22 // // 23 // You should have received a copy of the GNU General Public License // 24 // along with this program; if not, write to the Free Software // 25 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // 26 // ------------------------------------------------------------------------ // 27 28 $xoopsOption['pagetype'] = "pmsg"; 29 30 include "mainfile.php"; 31 $reply = !empty($_GET['reply']) ? 1 : 0; 32 $send = !empty($_GET['send']) ? 1 : 0; 33 $send2 = !empty($_GET['send2']) ? 1 : 0; 34 $to_userid = !empty($_GET['to_userid']) ? intval($_GET['to_userid']) : 0; 35 $msg_id = !empty($_GET['msg_id']) ? intval($_GET['msg_id']) : 0; 36 if ( empty($_GET['refresh'] ) && isset($_POST['op']) && $_POST['op'] != "submit" ) { 37 $jump = "pmlite.php?refresh=".time().""; 38 if ( $send == 1 ) { 39 $jump .= "&send=".$send.""; 40 } elseif ( $send2 == 1 ) { 41 $jump .= "&send2=".$send2."&to_userid=".$to_userid.""; 42 } elseif ( $reply == 1 ) { 43 $jump .= "&reply=".$reply."&msg_id=".$msg_id.""; 44 } else { 45 } 46 echo "<html><head><meta http-equiv='Refresh' content='0; url=".$jump."' /></head><body></body></html>"; 47 exit(); 48 } 49 xoops_header(); 50 if ($xoopsUser) { 51 $myts =& MyTextSanitizer::getInstance(); 52 if (isset($_POST['op']) && $_POST['op'] == "submit") { 53 if (!$GLOBALS['xoopsSecurity']->check()) { 54 $security_error = true; 55 } 56 $res = $xoopsDB->query("SELECT COUNT(*) FROM ".$xoopsDB->prefix("users")." WHERE uid=".intval($_POST['to_userid']).""); 57 list($count) = $xoopsDB->fetchRow($res); 58 if ($count != 1) { 59 echo "<br /><br /><div><h4>"._PM_USERNOEXIST."<br />"; 60 echo _PM_PLZTRYAGAIN."</h4><br />"; 61 if (isset($security_error) && $security_error == true) { 62 echo implode('<br />', $GLOBALS['xoopsSecurity']->getErrors()); 63 } 64 echo "[ <a href='javascript:history.go(-1)'>"._PM_GOBACK."</a> ]</div>"; 65 } else { 66 $pm_handler =& xoops_gethandler('privmessage'); 67 $pm =& $pm_handler->create(); 68 $pm->setVar("subject", $_POST['subject']); 69 $pm->setVar("msg_text", $_POST['message']); 70 $pm->setVar("to_userid", $_POST['to_userid']); 71 $pm->setVar("from_userid", $xoopsUser->getVar("uid")); 72 if (!$pm_handler->insert($pm)) { 73 echo $pm->getHtmlErrors(); 74 echo "<br /><a href='javascript:history.go(-1)'>"._PM_GOBACK."</a>"; 75 } else { 76 echo "<br /><br /><div style='text-align:center;'><h4>"._PM_MESSAGEPOSTED."</h4><br /><a href=\"javascript:window.opener.location='".XOOPS_URL."/viewpmsg.php';window.close();\">"._PM_CLICKHERE."</a><br /><br /><a href=\"javascript:window.close();\">"._PM_ORCLOSEWINDOW."</a></div>"; 77 } 78 } 79 } elseif ($reply == 1 || $send == 1 || $send2 == 1) { 80 include_once XOOPS_ROOT_PATH."/include/xoopscodes.php"; 81 if ($reply == 1) { 82 $pm_handler =& xoops_gethandler('privmessage'); 83 $pm =& $pm_handler->get($msg_id); 84 if ($pm->getVar("to_userid") == $xoopsUser->getVar('uid')) { 85 $pm_uname = XoopsUser::getUnameFromId($pm->getVar("from_userid")); 86 $message = "[quote]\n"; 87 $message .= sprintf(_PM_USERWROTE,$pm_uname); 88 $message .= "\n".$pm->getVar("msg_text", "E")."\n[/quote]"; 89 } else { 90 unset($pm); 91 $reply = $send2 = 0; 92 } 93 } 94 echo "<form action='pmlite.php' method='post' name='coolsus'>\n"; 95 echo "<table width='300' align='center' class='outer'><tr><td class='head' width='25%'>"._PM_TO."</td>"; 96 if ( $reply == 1 ) { 97 echo "<td class='even'><input type='hidden' name='to_userid' value='".$pm->getVar("from_userid")."' />".$pm_uname."</td>"; 98 } elseif ( $send2 == 1 ) { 99 $to_username = XoopsUser::getUnameFromId($to_userid); 100 echo "<td class='even'><input type='hidden' name='to_userid' value='".$to_userid."' />".$to_username."</td>"; 101 } else { 102 require_once XOOPS_ROOT_PATH."/class/xoopsform/formelement.php"; 103 require_once XOOPS_ROOT_PATH."/class/xoopsform/formselect.php"; 104 require_once XOOPS_ROOT_PATH."/class/xoopsform/formlabel.php"; 105 require_once XOOPS_ROOT_PATH."/class/xoopsform/formselectuser.php"; 106 $user_sel = new XoopsFormSelectUser("", "to_userid"); 107 echo "<td class='even'>".$user_sel->render(); 108 echo "</td>"; 109 } 110 echo "</tr>"; 111 echo "<tr><td class='head' width='25%'>"._PM_SUBJECTC."</td>"; 112 if ( $reply == 1 ) { 113 $subject = $pm->getVar('subject', 'E'); 114 if (!preg_match("/^Re:/i",$subject)) { 115 $subject = 'Re: '.$subject; 116 } 117 echo "<td class='even'><input type='text' name='subject' value='".$subject."' size='30' maxlength='100' /></td>"; 118 } else { 119 echo "<td class='even'><input type='text' name='subject' size='30' maxlength='100' /></td>"; 120 } 121 echo "</tr>"; 122 echo "<tr valign='top'><td class='head' width='25%'>"._PM_MESSAGEC."</td>"; 123 echo "<td class='even'>"; 124 xoopsCodeTarea("message",37,8); 125 xoopsSmilies("message"); 126 echo "</td>"; 127 echo "</tr>"; 128 echo "<tr><td class='head'> </td><td class='even'> 129 <input type='hidden' name='op' value='submit' />".$GLOBALS['xoopsSecurity']->getTokenHTML()." 130 <input type='submit' class='formButton' name='submit' value='"._PM_SUBMIT."' /> 131 <input type='reset' class='formButton' value='"._PM_CLEAR."' /> 132 <input type='button' class='formButton' name='cancel' value='"._PM_CANCELSEND."' onclick='javascript:window.close();' /> 133 </td></tr></table>\n"; 134 echo "</form>\n"; 135 } 136 } else { 137 echo _PM_SORRY."<br /><br /><a href='".XOOPS_URL."/register.php'>"._PM_REGISTERNOW."</a>."; 138 } 139 140 xoops_footer(); 141 142 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Sun Nov 25 11:44:32 2007 | par Balluche grâce à PHPXref 0.7 |
|