<?php
  /**
   * Copyright 2011 Zazavi - http://www.zazavi.com
   * Zazavi is free software released under the terms of the GNU General Public License.
   * You should have received a copy of the license.  If not, see <http://www.gnu.org/licenses/>.
   */
  define("_VALID_PHP", true);
  
  require_once("../../init.php");
  if (!$user->is_Admin())
      redirect_to("../../login.php");
  
$filename = $_SERVER['DOCUMENT_ROOT'] . "/admin/modules/events/lang/" . $core->language . ".lang.php";
  
  if (file_exists($filename)) {
  require_once("lang/" . $core->language . ".lang.php");
  } else {
  require_once("lang/en.lang.php");
  }
  
  require_once("admin_class.php");
  
  $event = new eventManager();
?>
<?php
  /* Process Events*/
  if (isset($_POST['processEvent'])):
  $event->eventid = (isset($_POST['eventid'])) ? $_POST['eventid'] : 0; 
  $event->processEvent();
  endif;
?>
<?php
  /* Delete events*/
  if (isset($_POST['deleteEvent'])):
  $id = sanitize($_POST['deleteEvent']);
  $db->delete("mod_events", "id='" . (int)$id . "'");
  
  $title = sanitize($_POST['eventtitle']);
  print ($db->affected()) ? $zazavisec->writeLog(MOD_EM_EVENT .' <strong>'.$title.'</strong> '._DELETED, "", "no", "module") . $core->msgOk(MOD_EM_EVENT .' <strong>'.$title.'</strong> '._DELETED) : $core->msgAlert(_SYSTEM_PROCCESS); 
  endif;
?>