[ Index ]

Source Code Reference for V1.00

title

Body

[close]

/modules/forums/ -> configure.php (source)

   1  <?php
   2  if (!defined('W2P_BASE_DIR')) {
   3      die('You should not access this file directly.');
   4  }
   5  
   6  // deny all but system admins
   7  $canEdit = !getDenyEdit('system');
   8  if (!$canEdit) {
   9      $AppUI->redirect('m=public&a=access_denied');
  10  }
  11  
  12  $AppUI->savePlace();
  13  $q = new DBQuery;
  14  
  15  if (isset($_POST['forcewatch']) && isset($_POST['forcesubmit'])) { // insert row into forum_watch for forcing Watch
  16      $q->addTable('forum_watch');
  17      $q->addInsert('watch_user', 0);
  18      $q->addInsert('watch_forum', 0);
  19      $q->addInsert('watch_topic', 0);
  20      if (!$q->exec()) {
  21          $AppUI->setMsg(db_error(), UI_MSG_ERROR);
  22      } else {
  23          $AppUI->setMsg('Watch Forced', UI_MSG_OK);
  24      }
  25      $q->clear();
  26      $AppUI->redirect('m=forums&a=configure');
  27  } elseif (isset($_POST['forcesubmit']) && !isset($_POST['forcewatch'])) { // delete row from forum_watch for unorcing Watch
  28      $q->setDelete('forum_watch');
  29      $q->addWhere('watch_user = 0');
  30      $q->addWhere('watch_forum = 0');
  31      $q->addWhere('watch_topic = 0');
  32      if (!$q->exec()) {
  33          $AppUI->setMsg(db_error(), UI_MSG_ERROR);
  34      } else {
  35          $AppUI->setMsg('Watch Unforced', UI_MSG_OK);
  36      }
  37      $q->clear();
  38      $AppUI->redirect('m=forums&a=configure');
  39  
  40  }
  41  
  42  // SQL-Query to check if the message should be delivered to all users (forced) (checkbox)
  43  $q->addTable('forum_watch');
  44  $q->addQuery('*');
  45  $q->addWhere('watch_user = 0');
  46  $q->addWhere('watch_forum = 0');
  47  $q->addWhere('watch_topic = 0');
  48  $resAll = $q->exec();
  49  
  50  if (db_num_rows($resAll) >= 1) { // message has to be sent to all users    
  51      $watchAll = true;
  52  }
  53  $q->clear();
  54  
  55  // setup the title block
  56  $titleBlock = new CTitleBlock('Configure Forums Module', 'support.png', $m, $m . '.' . $a);
  57  $titleBlock->addCrumb('?m=system', 'system admin');
  58  $titleBlock->addCrumb('?m=system&a=viewmods', 'modules list');
  59  $titleBlock->show();
  60  ?>
  61  
  62  <script language="javascript">
  63  function submitFrm( frmName ) {
  64  
  65      eval('document.'+frmName+'.submit();');
  66  
  67  }
  68  </script>
  69  <form name="frmForceWatch" method="post" action="?m=forums&a=configure">
  70  <input type="hidden" name="forcesubmit" value="true" />
  71  <input type="checkbox" name="forcewatch" id="forcewatch" value="dod" <?php echo $watchAll ? 'checked="checked"' : ''; ?> onclick="javascript:submitFrm('frmForceWatch');" />
  72  <label for="forcewatch"><?php echo $AppUI->_('forumForceWatch'); ?></label>
  73  </form>


Generated: Fri Jan 9 03:00:02 2009 Cross-referenced by PHPXref 0.7