home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 April / CMCD0404.ISO / Software / Freeware / Programare / dotproject / modules / forums / configure.php < prev    next >
Encoding:
PHP Script  |  2003-12-21  |  1.9 KB  |  64 lines

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