[ Index ]

Source Code Reference for V1.00

title

Body

[close]

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

   1  <?php /* $Id: do_post_aed.php 168 2008-05-20 11:22:15Z pedroix $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/trunk/modules/forums/do_post_aed.php $ */
   2  if (!defined('W2P_BASE_DIR')) {
   3      die('You should not access this file directly.');
   4  }
   5  
   6  $del = isset($_POST['del']) ? $_POST['del'] : 0;
   7  
   8  $isNotNew = $_POST['message_id'];
   9  $perms = &$AppUI->acl();
  10  if ($del) {
  11      if (!($perms->checkModule('forums', 'delete')) && (!($AppUI->user_id == $_POST['message_author']) || !($perms->checkModule('admin', 'edit')))) {
  12          $AppUI->redirect('m=public&a=access_denied');
  13      }
  14  } elseif ($isNotNew) {
  15      if (!($perms->checkModule('forums', 'edit')) && (!($AppUI->user_id == $_POST['message_author']) || !($perms->checkModule('admin', 'edit')))) {
  16          $AppUI->redirect('m=public&a=access_denied');
  17      }
  18  } else {
  19      if (!($perms->checkModule('forums', 'add')) && (!($AppUI->user_id == $_POST['message_author']) || !($perms->checkModule('admin', 'edit')))) {
  20          $AppUI->redirect('m=public&a=access_denied');
  21      }
  22  }
  23  
  24  $obj = new CForumMessage();
  25  
  26  if (($msg = $obj->bind($_POST))) {
  27      $AppUI->setMsg($msg, UI_MSG_ERROR);
  28      $AppUI->redirect();
  29  }
  30  
  31  // prepare (and translate) the module name ready for the suffix
  32  $AppUI->setMsg('Message');
  33  if ($del) {
  34      if (($msg = $obj->delete())) {
  35          $AppUI->setMsg($msg, UI_MSG_ERROR);
  36          $AppUI->redirect();
  37      } else {
  38          $AppUI->setMsg('deleted', UI_MSG_ALERT, true);
  39          $AppUI->redirect();
  40      }
  41  } else {
  42      if (($msg = $obj->store())) {
  43          $AppUI->setMsg($msg, UI_MSG_ERROR);
  44      } else {
  45          $AppUI->setMsg($isNotNew ? 'updated' : 'added', UI_MSG_OK, true);
  46      }
  47      $parent = ($obj->message_parent == -1) ? $obj->message_id : $obj->message_parent;
  48      $AppUI->redirect('m=forums&a=viewer&forum_id=' . $obj->message_forum . '&message_id=' . $parent);
  49  }
  50  ?>


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