PageRenderTime 25ms CodeModel.GetById 9ms RepoModel.GetById 0ms app.codeStats 0ms

/root/includes/acp/acp_k_config.php

https://github.com/dravekx/stargate-portal
PHP | 139 lines | 92 code | 31 blank | 16 comment | 7 complexity | 5bbca085aebd7b2b0bb4defc04ded528 MD5 | raw file
  1. <?php
  2. /**
  3. *
  4. * @package acp Stargate Portal
  5. * @version $Id: acp_k_config.php 312 2009-01-02 02:51:12Z Michealo $
  6. * @copyright (c) 2007 Michael O'Toole aka michaelo
  7. * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  8. *
  9. */
  10. /**
  11. * @ignore
  12. */
  13. if (!defined('IN_PHPBB'))
  14. {
  15. exit;
  16. }
  17. /**
  18. * @package acp
  19. */
  20. class acp_k_config
  21. {
  22. var $u_action;
  23. function main($id, $mode)
  24. {
  25. global $db, $user, $auth, $template, $cache;
  26. global $config, $SID, $phpbb_root_path, $phpbb_admin_path, $phpEx;
  27. $message ='';
  28. $user->add_lang('acp/k_config');
  29. $this->tpl_name = 'acp_k_config';
  30. $this->page_title = 'ACP_K_PORTAL_CONFIG';
  31. $form_key = 'acp_k_config';
  32. add_form_key($form_key);
  33. $action = request_var('action', '');
  34. $mode = request_var('mode', '');
  35. $generate = request_var('generate', '');
  36. $submit = (isset($_POST['submit'])) ? true : false;
  37. $forum_id = request_var('f', 0);
  38. $forum_data = $errors = array();
  39. if ($submit && !check_form_key($form_key))
  40. {
  41. $submit = false;
  42. $mode = '';
  43. trigger_error($user->lang['FORM_INVALID']);
  44. }
  45. $sql = 'SELECT * FROM ' . K_BLOCKS_CONFIG_TABLE . '';
  46. if( $result = $db->sql_query($sql) )
  47. {
  48. $row = $db->sql_fetchrow($result);
  49. $blocks_width = $row['blocks_width'];
  50. $blocks_enabled = $row['blocks_enabled'];
  51. $layout_default = $row['layout_default'];
  52. $portal_version = $row['portal_version'];
  53. $id = $row['id'];
  54. }
  55. else
  56. {
  57. trigger_error('Error! Could not query portal config information: ' . basename(dirname(__FILE__)) . '/' . basename(__FILE__) . ', line ' . __LINE__);
  58. }
  59. $template->assign_vars(array(
  60. 'L_PORTAL_MESSAGE' => $message,
  61. 'S_BLOCKS_WIDTH' => $row['blocks_width'],
  62. 'S_BLOCKS_ENABLED' => $row['blocks_enabled'],
  63. 'S_PORTAL_SET_LAYOUT_DEFAULT' => $row['layout_default'],
  64. 'S_PORTAL_VERSION' => $row['portal_version'],
  65. 'S_BLOCK_ID' => $row['id'],
  66. 'U_BACK' => $this->u_action,
  67. // 'U_BACK' => "{$phpbb_root_path}adm/index.$phpEx$SID&amp;i=portal_config&amp;mode=config",
  68. )
  69. );
  70. $template->assign_vars(array('S_OPT' => 'Configure'));
  71. if($submit)
  72. {
  73. $mode = 'save';
  74. }
  75. else
  76. $mode = 'reset';
  77. switch ($mode)
  78. {
  79. case 'save':
  80. {
  81. $blocks_width = request_var('blocks_width', '');
  82. $blocks_enabled = request_var('blocks_enabled', '');
  83. $layout_default = request_var('set_layout_default', '');
  84. $portal_version = request_var('portal_version', '');
  85. $sql = "UPDATE " . K_BLOCKS_CONFIG_TABLE . "
  86. SET
  87. blocks_width = $blocks_width,
  88. blocks_enabled = $blocks_enabled,
  89. layout_default = $layout_default,
  90. portal_version = '$portal_version'
  91. WHERE id = '$id' ";
  92. $db->sql_query($sql);
  93. $mode='reset';
  94. $template->assign_vars(array('S_OPT' => 'Config Data Saved'));
  95. //$message = $user->lang['L_PORTAL_CONFIG_UPDATED'];
  96. meta_refresh(2, "{$phpbb_root_path}adm/index.$phpEx$SID&amp;i=k_config&amp;mode=config");
  97. return;
  98. break;
  99. }
  100. case 'default': break;
  101. }
  102. switch ($action)
  103. {
  104. case 'default': break;
  105. }
  106. }
  107. }
  108. ?>