|
From: Lo?c C. <lo...@us...> - 2001-04-30 19:41:21
|
Update of /cvsroot/phpmychat/phpMyChat-0.15/chat
In directory usw-pr-cvs1:/tmp/cvs-serv26994/chat
Modified Files:
input.php3 handle_input.php3
Log Message:
Put the php work before the HTML instructions
Index: input.php3
===================================================================
RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/input.php3,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -r1.28 -r1.29
*** input.php3 2001/04/29 11:06:27 1.28
--- input.php3 2001/04/30 19:41:19 1.29
***************
*** 134,138 ****
{
include('./lib/commands.lib.' . C_EXTENSION);
! } // end of handdling commands
// Tests for 'true' messages
--- 134,138 ----
{
include('./lib/commands.lib.' . C_EXTENSION);
! } // end of handling commands
// Tests for 'true' messages
***************
*** 185,219 ****
/**
! * Displays the frame
*
! * Uses the 'pmcUrlForStyleSheet()' and the 'pmcSlashSingleQuotes()' functions
! * from the 'chat/lib/common.lib.php3' library
*/
! // The url for the style sheet
! $cssUrl = pmcUrlForStyleSheet('style', L_CHARSET, (defined('L_FONT_NAME')) ? L_FONT_NAME : '', L_FONT_SIZE);
! ?>
! <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
! <html dir="<?php echo((L_CHARSET == 'windows-1256') ? 'rtl' : 'ltr'); ?>">
- <head>
- <title>Input frame</title>
- <link rel="stylesheet" href="<?php echo($cssUrl); ?>" type="text/css" />
- <script type="text/javascript" language="javascript1.2">
- <!--
- // Get the position for the help popup
- if (window.parent.jsIsNS4)
- document.captureEvents(Event.MOUSEDOWN);
- document.onmousedown = window.parent.pmcDisplayLocation;
- // -->
- </script>
- </head>
-
- <body class="frame"<?php if (!$isPopup) echo(' onload="window.parent.pmcSetMsgBoxFocus()"'); ?>>
- <table border="0" cellpadding="0" cellspacing="0">
- <tr>
-
- <!-- Input form -->
- <td>
- <?php
// Define the way posted values will be handled according to the javascript
// abilities of the browser
--- 185,197 ----
/**
! * Prepare the frame: define some variables
*
! * Uses the 'pmcUrlForStyleSheet()' function and the '$pmcQueryArgSeparator'
! * variable defined inside the 'chat/lib/common.lib.php3' library
*/
! // The url for the style sheet and the cell alignement
! $cssUrl = pmcUrlForStyleSheet('style', L_CHARSET, (defined('L_FONT_NAME')) ? L_FONT_NAME : '', L_FONT_SIZE);
! $cellAlign = (L_CHARSET == 'windows-1256') ? 'right' : 'left';
// Define the way posted values will be handled according to the javascript
// abilities of the browser
***************
*** 222,235 ****
: 'input';
$action = $target . '.' . C_EXTENSION;
- ?>
- <form name="inputForm" action="<?php echo($action); ?>" method="post" autocomplete="off" target="<?php echo($target); ?>" onsubmit="return window.parent.pmcValidateInputForm()">
- <?php
- // Put the session id in an hidden field
- echo("\t" . dbSessionSID('POST') . "\n");
- ?>
- <!-- Whether a message has been sent or not (used to avoid multiple submission) -->
- <input type="hidden" name="sent" value="0" />
- <?php
// Get the last submission to be retained:
// - nothing at first load;
--- 200,204 ----
***************
*** 244,297 ****
$newPrevMessage = str_replace('"', '"', (($displayMessage) ? $prevMessage : $message));
}
- ?>
- <!-- Last sent message or command (used for the '/!' command) -->
- <input type="hidden" name="prevMessage" value="<?php echo($newPrevMessage); ?>" />
! <!-- Addressee that will be filled when the user click on a nick at the users frame -->
! <input type="hidden" name="msgTo" value="" />
!
! <?php
! // Url for the help popup
! $helpUrl = 'help_popup.' . C_EXTENSION
! . '?lang=' . $dbSessionVars['lang']
! . $pmcQueryArgSeparator . 'jsVersion=' . $dbSessionVars['jsVersion'];
! ?>
! <!-- Help popup link -->
! <a href="<?php echo($helpUrl); ?>" target="help_popup" onclick="window.parent.pmcHelpPopup(<?php echo((L_CHARSET == 'windows-1256') ? 610 : 10); ?>); return false" onmouseover="document.images['helpImg'].src = window.parent.jsImgHelpOn.src" onmouseout="document.images['helpImg'].src = window.parent.jsImgHelpOff.src"><img name="helpImg" src="images/help_off.gif" width="15" height="15" border="0" alt="<?php echo(L_HLP); ?>" onclick="window.parent.pmcSetMsgBoxFocus()" /></a>
!
! <?php
! // Get the value to put in the message box :
// - previous message value for '/!' command;
! // - last submission if it was an erroneous command (prefixed by the error
! // message if the browser does not know JavaScript);
! // - a success message if a command defined one and the browser does not know
! // JavaScript (this message is also set in the $error variable);
! // message if the bowser does not know JavaScript);
// - else nothing.
! $msgValue = ($displayMessage) ? str_replace('"', '"', $prevMessage) : '';
! if (isset($error))
{
! if (!$isCommand)
! {
! $msgValue = ($dbSessionVars['jsVersion'] == 'noJs')
! ? str_replace('"', '"', '< ' . $error . ' > ' . $message)
! : str_replace('"', '"', $message);
! }
! else if ($dbSessionVars['jsVersion'] == 'noJs')
! {
! $msgValue = str_replace('"', '"', $error);
! }
}
! ?>
! <!-- Message box -->
! <input type="text" name="message" size="50" maxlength="299" value="<?php echo($msgValue); ?>" />
! <!-- Message color -->
! <?php
! // Color of the message
! if ($dbSessionVars['jsVersion'] == 'low' || $dbSessionVars['jsVersion'] == 'noJs')
{
! // Drop down list of colors for non-enabled JavaScript1.1+ browsers
! echo("\t\t" . '<select name="color">' . "\n");
while (list($colorName, $colorCode) = each($textColors))
{
--- 213,251 ----
$newPrevMessage = str_replace('"', '"', (($displayMessage) ? $prevMessage : $message));
}
! // Define the 'value' of the message box:
// - previous message value for '/!' command;
! // - last submission if it was an erroneous command;
// - else nothing.
! if ($displayMessage)
{
! $msgValue = str_replace('"', '"', $prevMessage);
}
! else if (isset($error) && !$isCommand)
! {
! $msgValue = str_replace('"', '"', $message);
! }
! else
! {
! $msgValue = '';
! }
! // Define the message box size
! $msgBoxSize = 70 - ((L_FONT_SIZE - 10) * 3.5);
! // The urls for the help and the smilies popups
! $helpUrl = 'help_popup.' . C_EXTENSION
! . '?lang=' . $dbSessionVars['lang']
! . $pmcQueryArgSeparator . 'jsVersion=' . $dbSessionVars['jsVersion'];
! if (C_USE_SMILIES)
{
! $smiliesUrl = 'smilies_popup.' . C_EXTENSION
! . '?lang=' . $dbSessionVars['lang']
! . $pmcQueryArgSeparator . 'jsVersion=' . $dbSessionVars['jsVersion'];
! }
!
! // Buffer the color list for browsers that do not support JavaScript1.1+
! if ($dbSessionVars['jsVersion'] == 'noJs'
! || $dbSessionVars['jsVersion'] == 'low')
! {
while (list($colorName, $colorCode) = each($textColors))
{
***************
*** 299,318 ****
if ($colorCode == '#FF0000'
&& !($dbSessionVars['status'] == 'a' || $dbSessionVars['status'] == 'm'))
continue;
! echo("\t\t\t" . '<option value="' . $colorCode . '"');
! if ($color == $colorCode || $colorCode == '#000000')
! echo(' selected="selected"');
! echo('>' . $colorName . '</option>' . "\n");
}
! echo("\t\t" . '</select> ' ."\n");
}
! else
{
! echo("\t\t" . '<input type="hidden" name="color" value="' . $color . '" />' ."\n");
! } // end of color
?>
<input type="submit" name="submitType" value="<?php echo(L_OK); ?>" />
</td>
<?php
--- 253,362 ----
if ($colorCode == '#FF0000'
&& !($dbSessionVars['status'] == 'a' || $dbSessionVars['status'] == 'm'))
+ {
continue;
! }
! $colorsList[] = '<option value="' . $colorCode . '"'
! . (($color == $colorCode || $colorCode == '#000000') ? ' selected="selected"' : '')
! . '>' . $colorName . '</option>';
}
! unset($textColors);
! $colorsListCnt = count($colorsList);
}
!
! // Define the popup link or the error or success message set by commands
! // that will be displayed for browsers that do not support JavaScript
! $lowMessage = ' ';
! if ($dbSessionVars['jsVersion'] == 'noJs')
{
! // Error message defined by a command
! if (isset($error) && !$isCommand)
! {
! $lowMessage = '<span class="error">'
! . str_replace('\\n', '<br />', str_replace('"', '"', $error))
! . '</span>';
! }
! // Success message defined by a command
! else if (isset($error))
! {
! $lowMessage = '<span class="success">'
! . str_replace('\\n', '<br />', str_replace('"', '"', $error))
! . '</span>';
! }
! // Popup link
! else if (isset($htmlPopupLink))
! {
! $lowMessage = $htmlPopupLink;
! }
! }
!
!
! /**
! * Display the frame
! */
?>
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
+ <html dir="<?php echo((L_CHARSET == 'windows-1256') ? 'rtl' : 'ltr'); ?>">
+ <head>
+ <title>Input frame</title>
+ <link rel="stylesheet" href="<?php echo($cssUrl); ?>" type="text/css" />
+ <script type="text/javascript" language="javascript1.2">
+ <!--
+ // Get the position for the help popup
+ if (window.parent.jsIsNS4)
+ document.captureEvents(Event.MOUSEDOWN);
+ document.onmousedown = window.parent.pmcDisplayLocation;
+ // -->
+ </script>
+ </head>
+
+ <body class="frame"<?php if (!$isPopup) echo(' onload="window.parent.pmcSetMsgBoxFocus()"'); ?>>
+ <form name="inputForm" action="<?php echo($action); ?>" method="post" autocomplete="off" target="<?php echo($target); ?>" onsubmit="return window.parent.pmcValidateInputForm()">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td align="<?php echo($cellAlign); ?>" colspan="3">
+ <?php
+ // Put the session id in an hidden field
+ echo("\t\t" . dbSessionSID('POST') . "\n");
+ ?>
+ <!-- Whether a message has been sent or not (used to avoid multiple submission) -->
+ <input type="hidden" name="sent" value="0" />
+
+ <!-- Last sent message or command (used for the '/!' command) -->
+ <input type="hidden" name="prevMessage" value="<?php echo($newPrevMessage); ?>" />
+
+ <!-- Addressee that will be filled when the user click on a nick at the users frame -->
+ <input type="hidden" name="msgTo" value="" />
+
+ <!-- Message box -->
+ <input type="text" name="message" size="<?php echo($msgBoxSize); ?>" maxlength="299" value="<?php echo($msgValue); ?>" />
+
+
<input type="submit" name="submitType" value="<?php echo(L_OK); ?>" />
</td>
+ </tr>
+
+ <tr>
+ <td height="5" colspan="3"></td>
+ </tr>
+
+ <tr>
+ <td align="<?php echo($cellAlign); ?>" valign="middle">
+ <!-- Help popup link -->
+ <a href="<?php echo($helpUrl); ?>" target="help_popup" onclick="window.parent.pmcHelpPopup(<?php echo((L_CHARSET == 'windows-1256') ? 610 : 10); ?>); return false" onmouseover="document.images['helpImg'].src = window.parent.jsImgHelpOn.src" onmouseout="document.images['helpImg'].src = window.parent.jsImgHelpOff.src"><img name="helpImg" src="images/help_off.gif" width="15" height="15" border="0" alt="<?php echo(L_HLP); ?>" onclick="window.parent.pmcSetMsgBoxFocus()" /></a>
+
+ <?php
+ if (C_USE_SMILIES)
+ {
+ ?>
+
+ <!-- Smilies popup link -->
+ <a href="<?php echo($smiliesUrl); ?>" target="smilies_popup" onclick="window.parent.pmcSmiliesPopup(<?php echo(((L_CHARSET == 'windows-1256') ? 610 : 10) . ', \'' . $dbSessionVars['lang'] . '\''); ?>); return false" onmouseover="document.images['smiliesImg'].src = window.parent.jsImgSmiliesOn.src" onmouseout="document.images['smiliesImg'].src = window.parent.jsImgSmiliesOff.src"><img name="smiliesImg" src="images/smilies_off.gif" width="15" height="15" border="0" alt="<?php echo(L_SMIL_TIT); ?>" onclick="window.parent.pmcSetMsgBoxFocus()" /></a>
+
+ <?php
+ }
+ echo("\n");
+ ?>
+ </td>
<?php
***************
*** 321,328 ****
{
?>
! <td> </td>
!
! <!-- The color picker -->
! <td>
<script type="text/javascript" language="javascript1.1">
<!--
--- 365,370 ----
{
?>
! <td align="<?php echo($cellAlign); ?>" valign="middle">
! <!-- The color picker -->
<script type="text/javascript" language="javascript1.1">
<!--
***************
*** 332,358 ****
// Diplay the color picker
! for (k = 0; k < window.parent.jsColorPicker.length; k++)
document.writeln(window.parent.jsColorPicker[k]);
window.parent.jsColorPicker = null;
// -->
</script>
</td>
<?php
}
! echo("\n");
! ?>
! <td>
! </form>
</td>
</tr>
</table>
<?php
/**
! * Stop parsing the script if the browser do not support javascript
*/
! if ($dbSessionVars['jsVersion'] == 'noJs')
{
?>
--- 374,429 ----
// Diplay the color picker
! var colorCnt = window.parent.jsColorPicker.length;
! for (k = 0; k < colorCnt; k++)
document.writeln(window.parent.jsColorPicker[k]);
window.parent.jsColorPicker = null;
// -->
</script>
+ <input type="hidden" name="color" value="<?php echo($color); ?>" />
</td>
<?php
}
! // Drop down list of colors for non-enabled JavaScript1.1+ browsers
! else
! {
! ?>
! <td align="<?php echo($cellAlign); ?>" valign="middle">
! <!-- Message colors -->
! <select name="color">
! <?php
! // '$colorsList' contains the list of '<option>' selectors
! reset($colorsList);
! for ($i = 0; $i < $colorsListCnt; $i++)
! {
! echo(($i > 0) ? "\t\t" : "\t\t\t");
! echo($colorsList[$i] . "\n");
! }
! unset($colorsList);
! ?>
! </select>
</td>
+ <?php
+ } // end of color
+ echo("\n");
+ ?>
+ <!-- Messages for browsers that do not support javascript -->
+ <td width="200" align="bottom">
+ <?php echo($lowMessage . "\n"); ?>
+ </td>
</tr>
+
</table>
+ </form>
<?php
/**
! * Stop parsing the script if the browser do not support javascript or if it
! * support DHTML (all stuff below are handled by the 'handle_input' frame in
! * the second case)
*/
! if ($dbSessionVars['jsVersion'] == 'noJs'
! || $dbSessionVars['jsVersion'] == 'high')
{
?>
***************
*** 366,369 ****
--- 437,441 ----
echo("\n");
+
/**
* Refresh the messages frame if necessary
***************
*** 371,407 ****
if ($doRefreshMessages)
{
?>
<script type="text/javascript" language="javascript">
<!--
// Refresh the messages frame if necessary
! <?php
! echo("\n");
! if ($dbSessionVars['jsVersion'] == 'high')
! {
! if ($enforceFirstLoad)
! {
! ?>
! window.parent.frames['messages'].window.document.close();
! window.parent.jsIsInitLoad = true;
! window.parent.jsLastLoadedMsgTime = 0;
! window.parent.jsLastCheckedUserTime = 0;
! window.parent.jsConnect = 0;
! <?php
! }
! echo("\n");
! ?>
! if (window.parent.jsConnect == 0)
! window.parent.pmcDoRefreshLoader();
! <?php
! }
! else
! {
! $messagesLowUrl = 'messages_low.' . C_EXTENSION . '?' . dbSessionSID();
! ?>
! window.parent.frames['messages'].window.location = '<?php echo($messagesLowUrl); ?>';
! <?php
! }
! echo("\n");
! ?>
// -->
</script>
--- 443,457 ----
if ($doRefreshMessages)
{
+ $messagesLowUrl = 'messages_low.' . C_EXTENSION . '?' . dbSessionSID();
?>
<script type="text/javascript" language="javascript">
<!--
// Refresh the messages frame if necessary
!
! // Emulates replace method for non-js1.1 compliant browsers
! if (typeof(location.replace) == 'undefined')
! location.replace = location.assign;
!
! window.parent.frames['messages'].window.location.replace('<?php echo($messagesLowUrl); ?>');
// -->
</script>
***************
*** 412,415 ****
--- 462,468 ----
/**
* Display a JavaScript alert box with the error message if necessary
+ *
+ * Uses the the 'pmcSlashSingleQuotes()' function from the
+ * 'chat/lib/common.lib.php3' library
*/
if (isset($error))
Index: handle_input.php3
===================================================================
RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/handle_input.php3,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -r1.21 -r1.22
*** handle_input.php3 2001/04/27 18:28:53 1.21
--- handle_input.php3 2001/04/30 19:41:19 1.22
***************
*** 133,137 ****
{
include('./lib/commands.lib.' . C_EXTENSION);
! } // end of handdling commands
// Tests for 'true' messages
--- 133,137 ----
{
include('./lib/commands.lib.' . C_EXTENSION);
! } // end of handling commands
// Tests for 'true' messages
***************
*** 184,192 ****
/**
! * "Displays" the frame
! *
! * The 'pmcSlashSingleQuotes()' function is defined in the
! * 'chat/lib/common.lib.php3' script
*/
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
--- 184,201 ----
/**
! * Prepare the frame: define some variables
*/
+ // Get the value to put in the message box :
+ // - previous message value for '/!' command;
+ // - last submission if it was an erroneous command;
+ // - else nothing.
+ $msgValue = ($displayMessage) ? addslashes($prevMessage) : '';
+ if (isset($error) && !($isCommand))
+ $msgValue = addslashes($message);
+
+
+ /**
+ * "Display" the frame
+ */
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
***************
*** 203,222 ****
with (window.parent.frames['input'].window.document.forms['inputForm'])
{
elements['prevMessage'].value = '<?php echo(isset($message) ? addslashes($message) : ''); ?>';
-
- <?php
- // Get the value to put in the message box :
- // - previous message value for '/!' command;
- // - last submission if it was an erroneous command;
- // - else nothing.
- $msgValue = ($displayMessage) ? addslashes($prevMessage) : '';
- if (isset($error) && !($isCommand))
- $msgValue = addslashes($message);
- ?>
- elements['message'].value = '<?php echo($msgValue); ?>';
-
elements['msgTo'].value = '';
elements['color'].value = '<?php echo($color); ?>';
- elements['sent'].value = '0';
if (typeof(elements['submitType'].disabled) != 'undefined')
--- 212,220 ----
with (window.parent.frames['input'].window.document.forms['inputForm'])
{
+ elements['sent'].value = '0';
elements['prevMessage'].value = '<?php echo(isset($message) ? addslashes($message) : ''); ?>';
elements['msgTo'].value = '';
+ elements['message'].value = '<?php echo($msgValue); ?>';
elements['color'].value = '<?php echo($color); ?>';
if (typeof(elements['submitType'].disabled) != 'undefined')
***************
*** 253,256 ****
--- 251,257 ----
/**
* Display a JavaScript alert box with the error message if necessary
+ *
+ * The 'pmcSlashSingleQuotes()' function is defined in the
+ * 'chat/lib/common.lib.php3' script
*/
if (isset($error))
***************
*** 267,278 ****
* Enforce reloading of the input frame if the user's status has changed
*/
! echo("\n");
if ($dbSessionVars['status'] == 'm')
{
?>
// Add the red colors when the user has just been promoted to moderator
if (!window.parent.jsIsModerator)
{
! window.parent.frames['input'].window.location.replace('input.<?php echo(C_EXTENSION . '?dummy=' . uniqid('')); ?>');
window.parent.jsIsModerator = 1;
}
--- 268,282 ----
* Enforce reloading of the input frame if the user's status has changed
*/
! $inputUrl = 'input.' . C_EXTENSION
! . '?' . dbSessionSID()
! . $pmcQueryArgSeparator . 'dummy=' . uniqid('');
if ($dbSessionVars['status'] == 'm')
{
+ echo("\n");
?>
// Add the red colors when the user has just been promoted to moderator
if (!window.parent.jsIsModerator)
{
! window.parent.frames['input'].window.location.replace('<?php echo($inputUrl); ?>');
window.parent.jsIsModerator = 1;
}
***************
*** 286,290 ****
if (window.parent.jsIsModerator)
{
! window.parent.frames['input'].window.location.replace('input.<?php echo(C_EXTENSION . '?dummy=' . uniqid('')); ?>');
window.parent.jsIsModerator = 0;
}
--- 290,294 ----
if (window.parent.jsIsModerator)
{
! window.parent.frames['input'].window.location.replace('<?php echo($inputUrl); ?>');
window.parent.jsIsModerator = 0;
}
|