Просмотр файла admin/module_money.php

Размер файла: 3.28Kb
  1. <?php
  2. /***************************************************************************
  3. * admin_money.php
  4. * -------------------
  5. * Модификация: Anvar ( Anv@r.all )
  6. * 2011 год (c) apwa.ru
  7. ***************************************************************************/
  8.  
  9. define('IN_PHPBB', 1);
  10.  
  11. if( !empty($setmodules) )
  12. {
  13. $file = basename(__FILE__);
  14. $module['Points_sys_settings']['Настройка магазина'] = $file;
  15. return;
  16. }
  17.  
  18. $phpbb_root_path = "./../";
  19. require($phpbb_root_path . 'extension.inc');
  20. require('./pagestart.' . $phpEx);
  21. include($phpbb_root_path . 'includes/functions_selects.'.$phpEx);
  22.  
  23. $sql = "SELECT * FROM " . POINTS_CONFIG_TABLE;
  24. if(!$result = $db->sql_query($sql))
  25. {
  26. message_die(CRITICAL_ERROR, "Could not query config information in admin_board", "", __LINE__, __FILE__, $sql);
  27. }
  28. else
  29. {
  30. while( $row = $db->sql_fetchrow($result) )
  31. {
  32. $config_name = $row['config_name'];
  33. $config_value = $row['config_value'];
  34. $default_config[$config_name] = isset($HTTP_POST_VARS['submit']) ? str_replace("'", "\'", $config_value) : $config_value;
  35. $new[$config_name] = ( isset($HTTP_POST_VARS[$config_name]) ) ? abs(intval($HTTP_POST_VARS[$config_name])) : $default_config[$config_name];
  36.  
  37. if ($config_name == 'cookie_name')
  38. {
  39. $new['cookie_name'] = str_replace('.', '_', $new['cookie_name']);
  40. }
  41.  
  42. if ($config_name == 'server_name')
  43. {
  44. $new['server_name'] = str_replace('http://', '', $new['server_name']);
  45. }
  46.  
  47. if ($config_name == 'avatar_path')
  48. {
  49. $new['avatar_path'] = trim($new['avatar_path']);
  50. if (strstr($new['avatar_path'], "\0") || !is_dir($phpbb_root_path . $new['avatar_path']) || !is_writable($phpbb_root_path . $new['avatar_path']))
  51. {
  52. $new['avatar_path'] = $default_config['avatar_path'];
  53. }
  54. }
  55.  
  56. if ($config_name == 'default_icq')
  57. {
  58. if (!preg_match('/^[0-9]+$/', $new['default_icq']))
  59. {
  60. $new['default_icq'] = '';
  61. }
  62. }
  63.  
  64. if( isset($HTTP_POST_VARS['submit']) )
  65. {
  66. $sql = "UPDATE " . POINTS_CONFIG_TABLE . " SET
  67. config_value = '" . str_replace("\'", "''", $new[$config_name]) . "'
  68. WHERE config_name = '$config_name'";
  69. if( !$db->sql_query($sql) )
  70. {
  71. message_die(GENERAL_ERROR, "Failed to update general configuration for $config_name", "", __LINE__, __FILE__, $sql);
  72. }
  73. }
  74. }
  75.  
  76. if( isset($HTTP_POST_VARS['submit']) )
  77. {
  78. $message = $lang['Config_updated'] . "<br /><br />" . sprintf($lang['Click_return_config'], "<a href=\"" . append_sid("module_money.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=module") . "\">", "</a>");
  79.  
  80. message_die(GENERAL_MESSAGE, $message);
  81. }
  82. }
  83.  
  84. $sites_yes = ($new['sites']) ? 'checked="checked"' : '';
  85. $sites_no = (!$new['sites']) ? 'checked="checked"' : '';
  86.  
  87. $template->set_filenames(array(
  88. "body" => "admin/money_config_body.tpl")
  89. );
  90.  
  91. $template->assign_vars(array(
  92. "S_CONFIG_ACTION" => append_sid("module_money.$phpEx"),
  93. "MONEY" => $new['points_topic'],
  94. "COLOR_POINTS" => $new['color_points'],
  95. "STATUS_POINTS" => $new['status_points'],
  96. "RAZBAN_POINTS" => $new['razban_points'],
  97. "PRESENT_POINTS" => $new['present_points'],
  98. "PRESENT_DELETE" => $new['delete_time'])
  99. );
  100.  
  101. $template->pparse("body");
  102.  
  103. include('./page_footer_admin.'.$phpEx);
  104.  
  105. ?>