[ Index ]

PHP Cross Reference of MyBB

title

Body

[close]

/admin/modules/home/ -> preferences.php (source)

   1  <?php
   2  /**
   3   * MyBB 1.6
   4   * Copyright 2010 MyBB Group, All Rights Reserved
   5   *
   6   * Website: http://mybb.com
   7   * License: http://mybb.com/about/license
   8   *
   9   * $Id$
  10   */
  11  
  12  // Disallow direct access to this file for security reasons
  13  if(!defined("IN_MYBB"))
  14  {
  15      die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
  16  }
  17  
  18  $page->add_breadcrumb_item($lang->preferences_and_personal_notes, "index.php?module=home-preferences");
  19  
  20  $plugins->run_hooks("admin_home_preferences_begin");
  21  
  22  if(!$mybb->input['action'])
  23  {
  24      $plugins->run_hooks("admin_home_preferences_start");
  25      
  26      if($mybb->request_method == "post")
  27      {
  28          $query = $db->simple_select("adminoptions", "permissions, defaultviews", "uid='{$mybb->user['uid']}'");
  29          $adminopts = $db->fetch_array($query);
  30          
  31          $sqlarray = array(
  32              "notes" => $db->escape_string($mybb->input['notes']),
  33              "cpstyle" => $db->escape_string($mybb->input['cpstyle']),
  34              "permissions" => $db->escape_string($adminopts['permissions']),
  35              "defaultviews" => $db->escape_string($adminopts['defaultviews']),
  36              "uid" => $mybb->user['uid'],
  37              "codepress" => intval($mybb->input['codepress']),
  38          );
  39  
  40          $db->replace_query("adminoptions", $sqlarray, "uid");
  41          
  42          $plugins->run_hooks("admin_home_preferences_start_commit");
  43      
  44          flash_message($lang->success_preferences_updated, 'success');
  45          admin_redirect("index.php?module=home-preferences");
  46      }
  47      
  48      $page->output_header($lang->preferences_and_personal_notes);
  49      
  50      $sub_tabs['preferences'] = array(
  51          'title' => $lang->preferences_and_personal_notes,
  52          'link' => "index.php?module=home-preferences",
  53          'description' => $lang->prefs_and_personal_notes_description
  54      );
  55  
  56      $page->output_nav_tabs($sub_tabs, 'preferences');    
  57      
  58      $query = $db->simple_select("adminoptions", "notes, cpstyle, codepress", "uid='".$mybb->user['uid']."'", array('limit' => 1));
  59      $admin_options = $db->fetch_array($query);
  60      
  61      $form = new Form("index.php?module=home-preferences", "post");
  62      $dir = @opendir(MYBB_ADMIN_DIR."/styles");
  63      while($folder = readdir($dir))
  64      {
  65          if($folder != "." && $folder != ".." && @file_exists(MYBB_ADMIN_DIR."/styles/$folder/main.css"))
  66          {
  67              $folders[$folder] = ucfirst($folder);
  68          }
  69      }
  70      closedir($dir);
  71      ksort($folders);
  72      $setting_code = $form->generate_select_box("cpstyle", $folders, $admin_options['cpstyle']);
  73      
  74      $table = new Table;
  75      $table->construct_header($lang->global_preferences);
  76      
  77      $table->construct_cell("<strong>{$lang->acp_theme}</strong><br /><small>{$lang->select_acp_theme}</small><br /><br />{$setting_code}");
  78      $table->construct_row();
  79      
  80      $table->construct_cell("<strong>{$lang->codepress}</strong><br /><small>{$lang->use_codepress_desc}</small><br /><br />".$form->generate_on_off_radio('codepress', $admin_options['codepress']));
  81      $table->construct_row();
  82      
  83      $table->output($lang->preferences);
  84      
  85      $table->construct_header($lang->notes_not_shared);
  86      
  87      $table->construct_cell($form->generate_text_area("notes", $admin_options['notes'], array('style' => 'width: 99%; height: 300px;')));
  88      $table->construct_row();
  89      
  90      $table->output($lang->personal_notes);    
  91      
  92      $buttons[] = $form->generate_submit_button($lang->save_notes_and_prefs);
  93      $form->output_submit_wrapper($buttons);
  94      
  95      $form->end();
  96      
  97      $page->output_footer();
  98  }
  99  
 100  ?>


Generated: Tue Oct 8 19:19:50 2013 Cross-referenced by PHPXref 0.7.1