Source for file configure.php

Documentation is available at configure.php

  1. <?php //-*-php-*-
  2. /* ******************************************************************** **
  3. ** Copyright notice **
  4. ** **
  5. ** (c) 1995-2003 PHPOpenChat Development Team **
  6. ** http://phpopenchat.sourceforge.net/ **
  7. ** **
  8. ** All rights reserved **
  9. ** **
  10. ** This script is part of the PHPOpenChat project. The PHPOpenChat **
  11. ** project is free software; you can redistribute it and/or modify **
  12. ** it under the terms of the GNU General Public License as published by **
  13. ** the Free Software Foundation; either version 2 of the License, or **
  14. ** (at your option) any later version. **
  15. ** **
  16. ** The GNU General Public License can be found at **
  17. ** http://www.gnu.org/copyleft/gpl.html. **
  18. ** A copy is found in the textfile GPL and important notices to the **
  19. ** license from the team is found in the textfile LICENSE distributed **
  20. ** with these scripts. **
  21. ** **
  22. ** This script is distributed in the hope that it will be useful, **
  23. ** but WITHOUT ANY WARRANTY; without even the implied warranty of **
  24. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the **
  25. ** GNU General Public License for more details. **
  26. ** **
  27. ** This copyright notice MUST APPEAR in all copies of the script! **
  28. ** ******************************************************************** */
  29.  
  30. /*
  31. $Author: letreo $
  32. $Date: 2003/08/06 12:19:37 $
  33. $Source: /cvsroot/phpopenchat/chat3/configure.php,v $
  34. $Revision: 1.25 $
  35. */
  36.  
  37. //Get default values
  38. require_once('config.inc.php');
  39.  
  40. require_once(POC_INCLUDE_PATH.'/adodb/adodb.inc.php');
  41. require_once(POC_INCLUDE_PATH.'/class.Chat.inc');
  42. require_once(POC_INCLUDE_PATH.'/class.Chatter.inc');
  43. require_once(POC_INCLUDE_PATH.'/class.Channel_Buffer_'.CHANNEL_BUFFER_TYPE.'.inc');
  44. require_once(POC_INCLUDE_PATH.'/class.Translator.inc');
  45. require_once(POC_INCLUDE_PATH.'/class.Template.inc');
  46.  
  47. session_start();
  48.  
  49. //check if chatter is authorized to get this page
  50. if( !isset($_SESSION['chatter']) )
  51. die('Login first!');
  52. $_SESSION['reload_count'] = 0;//reset chat session expiration time
  53. //if( $_SESSION['chatter']->is_guest() )
  54. // die($_SESSION['translator']->out('DENIED_FOR_GUESTS'));
  55.  
  56.  
  57.  
  58. $TEMPLATE_OUT['lang_switch'] = $_SESSION['chat']->get_lang_switch();
  59.  
  60. $TEMPLATE_OUT['error'] = '';
  61. if( isset($_POST['color']) )
  62. {
  63. if( !$_SESSION['chatter']->set_color($_POST['color']))
  64. $TEMPLATE_OUT['error'] = $_SESSION['translator']->out('ERROR_WRONG_FORMAT');
  65. }
  66.  
  67. if( isset($_POST['advice']) )
  68. {
  69. $_SESSION['chatter']->set_advice($_POST['advice']);
  70. }
  71.  
  72. if( isset($_POST['options']) )
  73. {
  74. $_SESSION['chatter']->set_scrollspeed($_POST['options']);
  75. }
  76.  
  77. if( isset($_POST['theme']) && ALLOW_TEMPLATE_CHANGES)
  78. {
  79. $_SESSION['chatter']->set_theme($_POST['theme']);
  80. $_SESSION['template']->set_theme($_POST['theme']);
  81. setcookie('poc_theme',$_POST['theme'],COOKIE_EXPIRE,COOKIE_PATH,COOKIE_DOMAIN,COOKIE_SECURE);
  82. }
  83.  
  84. if( isset($_POST['line_style'])
  85. && isset($_POST['nickname'])
  86. && $_POST['nickname'] != $_SESSION['chatter']->get_nick() ) {
  87. $_SESSION['chat']->connect();
  88. if( $_SESSION['chat']->is_registered( $_POST['nickname'] ) ) {
  89. $_SESSION['chatter']->set_line_style_for( $_POST['nickname'], $_POST['line_style'] );
  90. }
  91. $_SESSION['chat']->disconnect();
  92. }
  93.  
  94. if( isset($_POST['style_delete']) && $_POST['style_delete'] != '' ) {
  95. $_SESSION['chatter']->delete_line_style_for($_POST['style_delete']);
  96. }
  97.  
  98. $defined_styles = $_SESSION['chatter']->get_line_styles();
  99. $TEMPLATE_OUT['defined_styles'] = '';
  100. foreach ( $defined_styles as $nick => $style ) {
  101. $TEMPLATE_OUT['defined_styles'] .= TAB.TAB.NL.'<tr><td>'.$nick.':</td>';
  102. $TEMPLATE_OUT['defined_styles'] .= TAB.TAB.NL.'<td style="'.$style.'background:#fff">'.$_SESSION['translator']->out('LINE_TO_TEST_STYLES').'</td>';
  103. $TEMPLATE_OUT['defined_styles'] .= TAB.TAB.NL.'<td style="width:14px;vertical-align:middle"><a class="imageLink" style="background:none" href="#" onclick="set_style_delete(\''.$nick.'\');document.forms[\'styles\'].submit()"><img src="'.$_SESSION['template']->get_theme_path().'/images/icons/trash.gif" alt="'.$_SESSION['translator']->out('DELETE').'" title="'.$_SESSION['translator']->out('DELETE').'" border="0" /></a></td></tr>';
  104. }
  105.  
  106. $TEMPLATE_OUT['theme_option_list']=$_SESSION['template']->get_theme_option_list();
  107.  
  108. $TEMPLATE_OUT['color'] = $_SESSION['chatter']->get_color();
  109.  
  110. $TEMPLATE_OUT['advice_quiet_selected'] = '';
  111. $TEMPLATE_OUT['advice_alert_selected'] = '';
  112. $TEMPLATE_OUT['advice_sound_selected'] = '';
  113. $TEMPLATE_OUT['advice_'.$_SESSION['chatter']->get_advice().'_selected'] = 'checked="checked"';
  114.  
  115. $TEMPLATE_OUT['scroll_value_0_selected'] = '';
  116. $TEMPLATE_OUT['scroll_value_1_selected'] = '';
  117. $TEMPLATE_OUT['scroll_value_2_selected'] = '';
  118. $TEMPLATE_OUT['scroll_value_3_selected'] = '';
  119. $TEMPLATE_OUT['scroll_value_'.strval($_SESSION['chatter']->get_scrollspeed()).'_selected'] = 'selected="selected"';
  120.  
  121. if(( isset($_GET['language']) ) || ( isset($_POST['theme']) && ALLOW_TEMPLATE_CHANGES)) {
  122. $TEMPLATE_OUT['js_onload'] = '
  123. opener.parent.labelChatterCount = \''.$_SESSION['translator']->out('CHATTER_COUNT').': \';
  124. opener.document.location.href=\'input.php?'.$_SESSION['session_get'].'\';
  125. window.self.focus();
  126. ';
  127. }
  128.  
  129. $_SESSION['template']->get_template();
  130. ?>

Documentation generated on Tue, 29 Jun 2004 14:42:17 +0200 by phpDocumentor 1.3.0RC3