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

Размер файла: 3.11Kb
  1. <?php
  2. /***************************************************************************
  3. * mides.ru
  4. * -------------------
  5. ***************************************************************************/
  6. define('IN_PHPBB', true);
  7.  
  8. if( !empty($setmodules) )
  9. {
  10. $filename = basename(__FILE__);
  11. $module['Photo_Album']['Personal_Galleries'] = $filename;
  12. return;
  13. }
  14.  
  15. $phpbb_root_path = '../';
  16. require($phpbb_root_path . 'extension.inc');
  17. require('./pagestart.' . $phpEx);
  18. require($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main_album.' . $phpEx);
  19. require($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin_album.' . $phpEx);
  20.  
  21. if( !isset($HTTP_POST_VARS['submit']) )
  22. {
  23. $template->set_filenames(array(
  24. 'body' => 'admin/album_personal_body.tpl')
  25. );
  26.  
  27. $sql = "SELECT group_id, group_name
  28. FROM " . GROUPS_TABLE . "
  29. WHERE group_single_user <> " . TRUE ."
  30. ORDER BY group_name ASC";
  31. if ( !($result = $db->sql_query($sql)) )
  32. {
  33. message_die(GENERAL_ERROR, "Couldn't get group list", "", __LINE__, __FILE__, $sql);
  34. }
  35.  
  36. while( $row = $db->sql_fetchrow($result) )
  37. {
  38. $groupdata[] = $row;
  39. }
  40.  
  41. $sql = "SELECT *
  42. FROM ". ALBUM_CONFIG_TABLE ."
  43. WHERE config_name = 'personal_gallery_private'";
  44. if ( !($result = $db->sql_query($sql)) )
  45. {
  46. message_die(GENERAL_ERROR, "Couldn't get Album info", "", __LINE__, __FILE__, $sql);
  47. }
  48. $row = $db->sql_fetchrow($result);
  49. $private_groups = explode(',', $row['config_value']);
  50.  
  51. for($i = 0; $i < count($groupdata); $i++)
  52. {
  53. $template->assign_block_vars('grouprow', array(
  54. 'GROUP_ID' => $groupdata[$i]['group_id'],
  55. 'GROUP_NAME' => $groupdata[$i]['group_name'],
  56. 'PRIVATE_CHECKED' => (in_array($groupdata[$i]['group_id'], $private_groups)) ? 'checked="checked"' : ''
  57. )
  58. );
  59. }
  60.  
  61. $template->assign_vars(array(
  62. 'L_ALBUM_PERSONAL_TITLE' => $lang['Album_personal_gallery_title'],
  63. 'L_ALBUM_PERSONAL_EXPLAIN' => $lang['Album_personal_gallery_explain'],
  64. 'L_SUBMIT' => $lang['Submit'],
  65. 'L_RESET' => $lang['Reset'],
  66. 'L_GROUP_CONTROL' => $lang['Auth_Control_Group'],
  67. 'L_GROUPS' => $lang['Usergroups'],
  68. 'L_PRIVATE_ACCESS' => $lang['Private_access'],
  69. 'S_ALBUM_ACTION' => append_sid('admin_album_personal.'.$phpEx)
  70. )
  71. );
  72.  
  73. $template->pparse('body');
  74.  
  75. include('./page_footer_admin.'.$phpEx);
  76. }
  77. else
  78. {
  79. $private_groups = @implode(',', $HTTP_POST_VARS['private']);
  80.  
  81. $sql = "UPDATE ". ALBUM_CONFIG_TABLE ."
  82. SET config_value = '$private_groups'
  83. WHERE config_name = 'personal_gallery_private'";
  84. if ( !($result = $db->sql_query($sql)) )
  85. {
  86. message_die(GENERAL_ERROR, 'Could not update Album config table', '', __LINE__, __FILE__, $sql);
  87. }
  88.  
  89. $message = $lang['Album_personal_successfully'] . '<br /><br />' . sprintf($lang['Click_return_album_personal'], '<a href="' . append_sid("admin_album_personal.$phpEx") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . append_sid("index.$phpEx?pane=right") . '">', '</a>');
  90.  
  91. message_die(GENERAL_MESSAGE, $message);
  92. }
  93.  
  94. ?>