Просмотр файла includes/usercp_editstyle.php

Размер файла: 2.14Kb
  1. <?php
  2. /***************************************************************************
  3. * mides.ru
  4. * -------------------
  5. ***************************************************************************/
  6. if ( !defined('IN_PHPBB') )
  7. {
  8. die("Hacking attempt");
  9. exit;
  10. }
  11.  
  12. include($phpbb_root_path . 'includes/functions_selects.'.$phpEx);
  13.  
  14. $style = htmlspecialchars(stripslashes($HTTP_GET_VARS['style']));
  15.  
  16. if ( (!empty($HTTP_POST_VARS['add']) && !empty($HTTP_POST_VARS['style_text'])) || (!empty($HTTP_POST_VARS['style_id'])) )
  17. {
  18. if (!empty($HTTP_POST_VARS['style_id']) && empty($HTTP_POST_VARS['add']))
  19. {
  20. $style_id = intval($HTTP_POST_VARS['style_id']);
  21.  
  22. $sql = "SELECT style_text
  23. FROM " . STYLES_CSS . "
  24. WHERE style_id = $style_id";
  25. if(!$result = $db->sql_query($sql))
  26. {
  27. message_die(GENERAL_ERROR, "Could not get data from styles table", "", __LINE__, __FILE__, $sql);
  28. }
  29. $row = $db->sql_fetchrow($result);
  30. $style_text = $row['style_text'];
  31. } else {
  32. $style_text = htmlspecialchars(trim($HTTP_POST_VARS['style_text']));
  33. }
  34.  
  35. $sql = "UPDATE " . USERS_TABLE . "
  36. SET style_text = '" . str_replace("\'", "''", $style_text) . "'
  37. WHERE user_id = ".$userdata['user_id'];
  38. if ( !($result = $db->sql_query($sql)) )
  39. {
  40. message_die(GENERAL_ERROR, 'Could not update users table', '', __LINE__, __FILE__, $sql);
  41. }
  42. $message = 'Стиль установлен';
  43. $template->assign_vars(array(
  44. "META" => '<meta http-equiv="refresh" content="2;url=' . append_sid("../") . '">')
  45. );
  46. message_die(GENERAL_MESSAGE, $message);
  47. } else {
  48.  
  49. $style_select = style_select($board_config['default_style'], 'style_id');
  50. include($phpbb_root_path . 'includes/page_header.'.$phpEx);
  51.  
  52. $template->set_filenames(array(
  53. 'body' => 'profile_style_edit.tpl')
  54. );
  55.  
  56. $template->assign_vars(array(
  57. 'STYLE_TEXT' => $userdata['style_text'],
  58. 'STYLE_SELECT' => $style_select,
  59. 'L_SUBMIT' => $lang['Submit'],
  60. 'S_PROFILE_ACTION' => append_sid("profile.$phpEx?mode=editstyle"))
  61. );
  62.  
  63. $template->pparse('body');
  64. include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
  65. }
  66. ?>