/*************************************************************************** Jupiter Content System @ Jupiterportal.com Copyright (C) 2005 Cosmin Flavius (highstrike@gmail.com) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. More Info About The Licence At http://www.gnu.org/copyleft/gpl.html ****************************************************************************/ //----------------------------------------------------------------- // Start action switch //----------------------------------------------------------------- switch($a) { //----------------------------------------------------------------- // Add events case //----------------------------------------------------------------- case 1: //----------------------------------------------------------------- // Check if he has acces //----------------------------------------------------------------- if(isset($is_loged_in)) { //----------------------------------------------------------------- // BBcode check //----------------------------------------------------------------- for ($i = 1; $i <= 5; $i++) if(check_tag_order($sendmessage) == $i) { header("location: $PHP_SELF?n=modules/events&a=4&d=$eventdaya&m=$eventmontha&i=9$i"); exit; } //----------------------------------------------------------------- // Make time for start and end //----------------------------------------------------------------- if($eventstartah == 0 || $eventstartam == 0 || $eventendah == 0 || $eventendam == 0) { $eventstarta = 0; $eventenda = 0; } else { if($eventstartam == 1) $eventstartam = 0; if($eventstartam == 2) $eventstartam = 15; if($eventstartam == 3) $eventstartam = 30; if($eventstartam == 4) $eventstartam = 45; if($eventendam == 1) $eventendam = 0; if($eventendam == 2) $eventendam = 15; if($eventendam == 3) $eventendam = 30; if($eventendam == 4) $eventendam = 45; $eventstarta = mktime($eventstartah, $eventstartam, 0, $eventmontha, $eventdaya, $eventyeara); $eventenda = mktime($eventendah, $eventendam, 0, $eventmontha, $eventdaya, $eventyeara); } //----------------------------------------------------------------- // Take care of some things //----------------------------------------------------------------- $sendmessage = jcm_htmlspecialchars(jcm_linebreaks(trim(jcm_stripslashes($sendmessage)))); if($overflow = check_tag_order($sendmessage)) $sendmessage = substr($sendmessage, 0, $overflow[0]).substr($sendmessage, $overflow[1], (strlen($sendmessage) - $overflow[0])); //----------------------------------------------------------------- // Add in database //----------------------------------------------------------------- $db->insertRow("events",array('user_id' => ''.$_SESSION['id'].'','user_user' => ''.$_SESSION['username'].'','day' => ''.$eventdaya.'','month' => ''.$eventmontha.'','year' => ''.$eventyeara.'','start' => ''.$eventstarta.'','end' => ''.$eventenda.'','message' => ''.$sendmessage.'')); //----------------------------------------------------------------- // Redirect when finished //----------------------------------------------------------------- header("location: $PHP_SELF?n=modules/events&d=$eventdaya&m=$eventmontha&i=44"); } break; //----------------------------------------------------------------- // Edit events case //----------------------------------------------------------------- case 2: //----------------------------------------------------------------- // Check if he has acces //----------------------------------------------------------------- if(isset($is_moderator) || isset($is_administrator) || isset($is_webmaster)) { //----------------------------------------------------------------- // BBcode check //----------------------------------------------------------------- for ($i = 1; $i <= 5; $i++) if(check_tag_order($sendmessage) == $i) { header("location: $PHP_SELF?n=modules/events&a=5&d=$eventdaye&m=$eventmonthe&o=$o&i=9$i"); exit; } //----------------------------------------------------------------- // Make time for start and end //----------------------------------------------------------------- if($eventstarteh == 0 || $eventstartem == 0 || $eventendeh == 0 || $eventendem == 0) { $eventstarte = 0; $eventende = 0; } else { if($eventstartem == 1) $eventstartem = 0; if($eventstartem == 2) $eventstartem = 15; if($eventstartem == 3) $eventstartem = 30; if($eventstartem == 4) $eventstartem = 45; if($eventendem == 1) $eventendem = 0; if($eventendem == 2) $eventendem = 15; if($eventendem == 3) $eventendem = 30; if($eventendem == 4) $eventendem = 45; $eventstarte = mktime($eventstarteh, $eventstartem, 0, $eventmonthe, $eventdaye, $eventyeare); $eventende = mktime($eventendeh, $eventendem, 0, $eventmonthe, $eventdaye, $eventyeare); } //----------------------------------------------------------------- // Take care of some things //----------------------------------------------------------------- $sendmessage = jcm_linebreaks(trim(jcm_stripslashes($sendmessage))); if($overflow = check_tag_order($sendmessage)) $sendmessage = substr($sendmessage, 0, $overflow[0]).substr($sendmessage, $overflow[1], (strlen($sendmessage) - $overflow[0])); //----------------------------------------------------------------- // Update the database //----------------------------------------------------------------- $db->updateRow("events",array('day' => ''.$eventdaye.'','month' => ''.$eventmonthe.'','year' => ''.$eventyeare.'','start' => ''.$eventstarte.'','end' => ''.$eventende.'','message' => ''.$sendmessage.''),"id = $o"); //----------------------------------------------------------------- // Redirect when finished //----------------------------------------------------------------- header("location: $PHP_SELF?n=modules/events&d=$eventdaye&m=$eventmonthe&i=45"); } break; //----------------------------------------------------------------- // Delete events case //----------------------------------------------------------------- case 3: //----------------------------------------------------------------- // Check if he has acces //----------------------------------------------------------------- if(isset($is_moderator) || isset($is_administrator) || isset($is_webmaster)) { //----------------------------------------------------------------- // Delete from the database //----------------------------------------------------------------- $db->deleteRow("events","id = '$o'"); //----------------------------------------------------------------- // Redirect when finished //----------------------------------------------------------------- header("location: $PHP_SELF?n=modules/events&d=$d&m=$m&i=46"); } break; //----------------------------------------------------------------- // View Form for adding events case //----------------------------------------------------------------- case 4: //----------------------------------------------------------------- // Check if he has acces //----------------------------------------------------------------- if(isset($is_loged_in)) { ?>
} break; //----------------------------------------------------------------- // View Form for editing events case //----------------------------------------------------------------- case 5: //----------------------------------------------------------------- // Check if he has acces //----------------------------------------------------------------- if(isset($is_loged_in)) { //----------------------------------------------------------------- // Look into da database for da event //----------------------------------------------------------------- $event_info = $db->getLine("SELECT * FROM events WHERE id = '$o'") ?> } break; //----------------------------------------------------------------- // View events default case //----------------------------------------------------------------- default: //----------------------------------------------------------------- // Load the events row //----------------------------------------------------------------- $events_db = $db->getTable("SELECT e.id, e.type, e.user_id, e.user_user, e.start, e.day, e.month, e.year, e.end, e.message, u.age FROM events AS e LEFT JOIN users AS u ON e.user_id = u.id WHERE day = '$d' AND month = '$m' ORDER BY start ASC,type DESC"); foreach($events_db as $idx=>$event) { //----------------------------------------------------------------- // Figure out the start and end //----------------------------------------------------------------- if($event['type'] == "normal") { if($event['year'] == date('Y')) { //----------------------------------------------------------------- // Code Layout //----------------------------------------------------------------- if($event['start'] != 0 || $event['end'] != 0) $layout .= "= $language['Events view title'] ?> | |||
= $language['Events view title2'] ?> | = $language['Events view title3'] ?> | if(isset($is_moderator) || isset($is_administrator) || isset($is_webmaster)){ echo ""; } ?> |