[ PHPXref.com ] [ Generated: Sun Jul 20 16:32:46 2008 ] [ AWF-CMS 2.1.3 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/admin/ -> forums.php (source)

   1  <?php
   2  /*
   3          Copyright (C) 2000-2006 AWF-CMS.org
   4  
   5          This file is part of the Adaptive Website Framework (AWF) Version 2
   6          It is maintained by Michael Mayer <michael@awf-cms.org>
   7  
   8          License     : GNU General Public License
   9          Last update : 19.01.2006
  10  
  11          Looking for documentation? Want to maintain one of the classes?
  12          Visit www.awf-cms.org!
  13  */
  14  
  15  // Init
  16  include ('inc/awf_admin_init.inc');
  17  include ('inc/header.inc');
  18  
  19  // Import Arguments
  20  lftk_import_argument('page', 'forums');
  21  lftk_import_argument('first_item', 0);
  22  lftk_import_argument('target_id', 0);
  23  lftk_import_argument('sort_order', 'sort_order');
  24  lftk_import_argument('search', '');
  25  
  26  // Config
  27  $rows_per_page = 50;
  28  $my_parameters = array('page' => $page, 'first_item' => $first_item, 'sort_order' => $sort_order);
  29  ?>
  30  
  31  <form action="<?=$_SERVER['PHP_SELF']?>" method="post">
  32  <input type="hidden" name="page" value="<?=htmlspecialchars($page)?>" />
  33  <input type="hidden" name="sort_order" value="<?=htmlspecialchars($sort_order)?>" />
  34  <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr>
  35  <?
  36  lftk_add_tab('forums', LANG_ADMIN_FORUMS);
  37  lftk_add_tab('add_forum', LANG_ADMIN_ADD_FORUM);
  38  lftk_add_tab('permissions', LANG_ADMIN_PERMISSIONS);
  39  ?>
  40  <td bgcolor="#ffffff" width="100%" style="padding: 0; text-align: right;">
  41  <a href="javascript:open_window('<?=MANUAL_SERVER?>Forums')"><img src="img/help.png" border="0" /></a>
  42  </td>
  43  </tr>
  44  </table>
  45  <table bgcolor="<?=$lftk_config['color_3']?>" width="100%" cellpadding="9" cellspacing="0" border="0">
  46  <tr><td>
  47  <?
  48  
  49  /**********************************************************************************************************
  50  Forums
  51  **********************************************************************************************************/
  52  
  53  if($page == 'forums') { 
  54  
  55  if(isset($_REQUEST['change'])) {
  56      AWF_Functions::handle_changes ($_REQUEST['change'], 'AWF_Forum');
  57      }
  58  
  59  if(isset($_REQUEST['search']) && $_REQUEST['search'] != '') {
  60          $_search = 'MATCH (short_name, title, description) AGAINST ('.sql_quote_smart($_REQUEST['search']).' IN BOOLEAN MODE)';
  61          $_where  = ' WHERE ';
  62          
  63      if(defined('SITE_ID') && SITE_ID > 0) {
  64          $_search = '(site_id = 0 || site_id = '.sql_quote_smart(SITE_ID).') AND '.$_search;
  65          }
  66          }
  67  elseif(defined('SITE_ID') && SITE_ID > 0) {
  68          $_where  = ' WHERE ';
  69      $_search = '(site_id = 0 || site_id = '.sql_quote_smart(SITE_ID).')';
  70      }
  71  else {
  72          $_search = '';
  73          $_where  = '';
  74          }
  75  
  76  $row_count = sql_count_rows(TABLE_FORUMS, $_search);
  77  
  78  $rows = sql_query_array('SELECT * FROM '.TABLE_FORUMS.$_where.$_search.' ORDER BY '.$sort_order.' '.sql_limit($rows_per_page, $first_item), 'id');
  79  
  80  lftk_display_search_input ('search');
  81  
  82  lftk_display_page_links ($sort_order, $row_count, $rows_per_page, $first_item);
  83  
  84  lftk_display_table_header(
  85      array(
  86          'id'         => LANG_ADMIN_ID, 
  87          'sort_order'     => LANG_ADMIN_SORT_ORDER,
  88          'short_name'     => LANG_ADMIN_SHORTNAME,
  89          'title'     => LANG_ADMIN_TITLE,
  90          'site_id'     => LANG_ADMIN_SITE,
  91          'template'    => LANG_ADMIN_TEMPLATE,
  92          'lang_code'    => LANG_ADMIN_LANG_CODE,
  93          'published'    => LANG_ADMIN_PUBLISHED,
  94          'visible'    => LANG_ADMIN_VISIBLE,
  95          'views'        => LANG_ADMIN_VIEWS, 
  96          '_delete'    => LANG_ADMIN_DELETE,
  97          '_edit'        => LANG_ADMIN_EDIT), 
  98      array(
  99          'id'        => 'right',
 100          'sort_order'    => 'right',
 101          'published'    => 'center',
 102          'visible'    => 'center',
 103          'views'        => 'right',
 104          '_delete'          => 'center',
 105          '_edit'          => 'center'),
 106      TRUE
 107      );
 108  
 109  while(is_array($rows) && list($key, $row) = each($rows)) {
 110  
 111      $_published     = lftk_get_clickable_checkbox ($row['published'], 'published', $row['id'], $my_parameters);
 112      $_visible     = lftk_get_clickable_checkbox ($row['visible'], 'visible', $row['id'], $my_parameters);
 113  
 114      if($row['site_id'] == 0) {
 115                  $_site = LANG_ADMIN_ALL_SITES;
 116                  }
 117          elseif(isset($awf->sites->sites[$row['site_id']])) {
 118                  $_site = $awf->sites->sites[$row['site_id']]->short_name;
 119                  }
 120      else {
 121          $_site = 'Site does not exist (anymore)';
 122          }
 123  
 124      lftk_display_table_row (    
 125          array(
 126          'id'         => $key, 
 127          'sort_order'    => htmlspecialchars($row['sort_order']), 
 128          'short_name'    => htmlspecialchars($row['short_name']), 
 129          'title'        => htmlspecialchars($row['title']), 
 130          'site_id'     => $_site,
 131          'template'     => htmlspecialchars($row['template']),
 132          'lang_code'     => htmlspecialchars($row['lang_code']),
 133          'published'    => $_published,
 134          'visible'    => $_visible,
 135          'views'        => $row['views'],
 136          '_delete'    =>    
 137              '<a onclick="return confirm(\''.LANG_ARE_YOU_SURE.'\')" href="'.$_SERVER['PHP_SELF'].
 138              "?sort_order=$sort_order&first_item=$first_item&page=$page&change[".$row['id'].'][delete]=true">'.
 139              '<img src="img/lftk_delete.gif" border="0" alt="'.LANG_ADMIN_DELETE.'"></a> ', 
 140          '_edit'        =>    
 141              '<a href="javascript:open_window(\'edit_forum'.PHP_EXT.'?target_id='.$row['id'].'\')">'.
 142              '<img src="img/lftk_edit.gif" border="0" alt="'.LANG_ADMIN_EDIT.'"></a>'), 
 143              
 144          array(
 145          'id'        => 'right',
 146          'sort_order'    => 'right',
 147          'published'    => 'center',
 148          'visible'    => 'center',
 149          'views'        => 'right',
 150          '_delete'          => 'center',
 151          '_edit'           => 'center')
 152          );
 153      }
 154  
 155  lftk_display_table_footer();
 156  
 157  }
 158  
 159  /**********************************************************************************************************
 160  Add Forum
 161  **********************************************************************************************************/
 162  
 163  elseif($page == 'add_forum') { 
 164  
 165  $forum = new AWF_Forum;
 166  
 167  if(isset($_REQUEST['docinput'])) {
 168      $docinput = $_REQUEST['docinput'];
 169      $forum->short_name     = $docinput['short_name'];
 170      $forum->lang_code    = $docinput['lang_code'];
 171      $forum->title        = $docinput['title'];
 172      $forum->description    = $docinput['description'];
 173      $forum->template    = $docinput['template'];
 174      }
 175  
 176  if(isset($docinput) && $docinput['short_name'] != '' && $docinput['title'] != '' && $docinput['lang_code'] != '' && $docinput['template'] != '') {
 177      
 178      $forum->save();
 179  
 180      lftk_display_info(LANG_ADMIN_FORUM_ADDED);
 181  
 182      ?>
 183      <br />
 184      <br />
 185      <p align="right">
 186      <input type="submit" value="<?=LANG_ADMIN_OK?>" />
 187      </p>
 188      <?
 189      }
 190      
 191  else {
 192  
 193  ?>
 194  <?=LANG_ADMIN_SHORTNAME?>
 195  <br />
 196  <?
 197  if(isset($docinput['short_name']) && $docinput['short_name'] == '') {
 198          lftk_display_error (LANG_ADMIN_FIELD_REQUIRED);
 199      }
 200  ?>
 201  <input type="text" size="60" name="docinput[short_name]" value="<?=htmlentities($forum->short_name)?>" />
 202  <br />
 203  <br />
 204  <?=LANG_ADMIN_TITLE?>
 205  <br />
 206  <?
 207  if(isset($docinput['title']) && $docinput['title'] == '') {
 208          lftk_display_error (LANG_ADMIN_FIELD_REQUIRED);
 209      }
 210  ?>
 211  <input type="text" size="60" name="docinput[title]" value="<?=htmlentities($forum->title)?>" />
 212  <br />
 213  <br />
 214  <?=LANG_ADMIN_DESCRIPTION?>
 215  <br />
 216  <input type="text" size="60" name="docinput[description]" value="<?=htmlentities($forum->description)?>" />
 217  <br />
 218  <br />
 219  <?=LANG_ADMIN_LANG_CODE?>
 220  <br />
 221  <?
 222  if(isset($docinput['lang_code']) && $docinput['lang_code'] == '') {
 223          lftk_display_error (LANG_ADMIN_FIELD_REQUIRED);
 224      }
 225  ?>
 226  <input type="text" size="60" name="docinput[lang_code]" value="<?=htmlentities($forum->lang_code)?>" />
 227  <br />
 228  <br />
 229  <?=LANG_ADMIN_TEMPLATE?>
 230  <br />
 231  <?
 232  if(isset($docinput['template']) && $docinput['template'] == '') {
 233          lftk_display_error (LANG_ADMIN_FIELD_REQUIRED);
 234      }
 235  
 236  $files = (AWF_Functions::get_file_list(BASE_PATH.'templates/forums/forum/', '', FALSE));
 237  
 238  foreach($files as $file_key => $file_value) {
 239      $files[$file_key] = strtok($file_value,'.');
 240          }
 241  
 242  $files = array_unique($files);
 243  
 244  sort($files);
 245  
 246  ?>
 247  <select name="docinput[template]">
 248  <?
 249  while(list($key, $value) = each($files)) {
 250  ?>      <option value="<?=$value?>"<? if($value == $forum->template) echo ' selected="selected"'; ?>><?=$value?></option><?
 251      }
 252          ?>
 253  </select>
 254  <br />
 255  <br />
 256  <p align="right">
 257  <input type="submit" value="<?=LANG_ADMIN_ADD_FORUM?>" />
 258  </p>
 259  <?
 260  }
 261  } 
 262  /**********************************************************************************************************
 263  Permissions
 264  **********************************************************************************************************/
 265  
 266  elseif($page == 'permissions') {
 267          $this_content = $awf->cms->forums;
 268          $no_close_button = TRUE;
 269          require ('inc/permissions.inc');
 270          }
 271  ?>
 272  </td></tr>
 273  </table>
 274  </form>
 275  <?php
 276  
 277  // Close page
 278  include ('inc/footer.inc');
 279  
 280  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]