$active_camp_list = array(); $request_camp_list = array(); $query = "\tSELECT \r\n\t\t\t\t\tcamp.*,\r\n\t\t\t\t\tuser_camp.function_id,\r\n\t\t\t\t\tuser_c.scoutname AS scoutname_c,\r\n\t\t\t\t\tuser_c.surname AS surname_c,\r\n\t\t\t\t\tuser_c.firstname AS firstname_c,\r\n\t\t\t\t\tuser_camp.id AS user_camp_id\r\n\t\t\t\tFROM\r\n\t\t\t\t\tuser,\r\n\t\t\t\t\tuser_camp,\r\n\t\t\t\t\tcamp\r\n\t\t\t\t\tLEFT JOIN (user AS user_c) ON user_c.id=camp.creator_user_id\r\n\t\t\t\tWHERE\r\n\t\t\t\t\tuser_camp.user_id = '{$_user->id}' AND\r\n\t\t\t\t\tuser_camp.camp_id = camp.id AND\r\n\t\t\t\t\tuser_camp.active = 1 AND\r\n\t\t\t\t\tuser_camp.user_id = user.id\r\n\t\t\t\tORDER BY camp.id DESC"; $result = mysql_query($query); while ($camp_detail = mysql_fetch_assoc($result)) { $subquery = "SELECT \r\n\t\t\t\t\t\tMIN( subcamp.start ) AS start , \r\n\t\t\t\t\t\tMAX( subcamp.start + subcamp.length - 1 ) AS end\r\n\t\t\t\t\tFROM \r\n\t\t\t\t\t\tcamp, \r\n\t\t\t\t\t\tsubcamp \r\n\t\t\t\t\tWHERE \r\n\t\t\t\t\t\tsubcamp.camp_id = camp.id AND\r\n\t\t\t\t\t\tcamp.id = {$camp_detail['id']}"; $subresult = mysql_query($subquery); $camp_time = mysql_fetch_assoc($subresult); $c_start = new c_date(); $c_end = new c_date(); $c_today = new c_date(); $camp_detail['sort'] = $camp_time['start']; $c_start->setDay2000($camp_time['start']); $c_end->setDay2000($camp_time['end']); $c_today->setUnix(time()); $camp_detail['past'] = $c_end->getValue() < $c_today->getValue(); $camp_detail['start'] = date("d.m.Y", $c_start->getUnix()); $camp_detail['end'] = date("d.m.Y", $c_end->getUnix()); $camp_detail['creator'] = $camp_detail[scoutname_c] . " / " . $camp_detail[firstname_c] . " " . $camp_detail[surname_c]; $camp_detail['function'] = $function_list[$camp_detail['function_id']]; if ($camp_detail[creator_user_id] == $_user->id) { $camp_detail['delete'] = true; $camp_detail['exit'] = false; } else { $camp_detail['delete'] = false; $camp_detail['exit'] = true; } $camp_detail['change_camp'] = "index.php?app=camp&cmd=action_change_camp&camp=" . $camp_detail[id]; $active_camp_list[] = $camp_detail; $active_camp_sort[] = $camp_detail['sort']; }
* This file is part of eCamp. * * eCamp is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * eCamp is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with eCamp. If not, see <http://www.gnu.org/licenses/>. */ $title = mysql_escape_string($_REQUEST['title']); $text = mysql_escape_string($_REQUEST['text']); $date = mysql_escape_string($_REQUEST['date']); if ($title == "" || $date == "") { header("Location: index.php?app=todo"); } $date = ereg("([0-9]{1,2})[\\/\\. -]+([0-9]{1,2})[\\/\\. -]+([0-9]{1,4})", $date, $regs); $date = gmmktime(0, 0, 0, $regs[2], $regs[1], $regs[3]); $todo_date = new c_date(); $todo_date->setUnix($date); $query = "INSERT INTO todo \t(camp_id, title, short, date, done) VALUES \n\t\t\t\t\t\t\t\t({$_camp->id}, '{$title}', '{$text}', " . $todo_date->getValue() . ", 0)"; mysql_query($query); header("Location: index.php?app=todo"); die; ?>
$start = mysql_real_escape_string($_REQUEST['subcamp_start']); $end = mysql_real_escape_string($_REQUEST['subcamp_end']); $start = ereg("([0-9]{1,2})[\\/\\. -]+([0-9]{1,2})[\\/\\. -]+([0-9]{1,4})", $start, $regs); $start = gmmktime(0, 0, 0, $regs[2], $regs[1], $regs[3]); //$start = preg_replace("/^\s*([0-9]{1,2})[\/\. -]+([0-9]{1,2})[\/\. -]+([0-9]{1,4})/", "\\2/\\1/\\3", $start); //$start = strtotime($start); $end = ereg("([0-9]{1,2})[\\/\\. -]+([0-9]{1,2})[\\/\\. -]+([0-9]{1,4})", $end, $regs); $end = gmmktime(0, 0, 0, $regs[2], $regs[1], $regs[3]); //$end = preg_replace("/^\s*([0-9]{1,2})[\/\. -]+([0-9]{1,2})[\/\. -]+([0-9]{1,4})/", "\\2/\\1/\\3", $end); //$end = strtotime($end); $c_start = new c_date(); $c_end = new c_date(); $c_start->setUnix($start); $c_end->setUnix($end); $start = $c_start->getValue(); $length = $c_end->getValue() - $c_start->getValue() + 1; if ($length <= 0) { $ans = array("error" => true, "msg" => "Das Enddatum darf nicht vor dem Startdatum liegen!"); echo json_encode($ans); die; } else { if ($length > 40) { $ans = array("error" => true, "msg" => "Die maximale Länge eines Lagerabschnitts beträgt 40 Tage. Verwende bitte mehrere Lagerabschnitt für überlange Lager!"); echo json_encode($ans); die; } } // Überschneidungen prüfen $query = "SELECT * FROM `subcamp` WHERE camp_id=" . $_camp->id . " AND (`start` BETWEEN -10000 AND " . $c_end->getValue() . ") AND ((`start`+`length`-1) BETWEEN " . $c_start->getValue() . " AND 32000)"; $result = mysql_query($query); if (mysql_num_rows($result) >= 1) {
* * eCamp is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with eCamp. If not, see <http://www.gnu.org/licenses/>. */ $valid_fields = array("scoutname", "firstname", "surname", "street", "zipcode", "city", "homenr", "mobilnr", "birthday", "ahv", "sex", "jspersnr", "jsedu", "pbsedu"); $field = mysql_real_escape_string($_REQUEST[field]); $value = $_REQUEST[value]; $value_save = mysql_real_escape_string($value); if (!in_array($field, $valid_fields)) { die; } if ($field == "birthday") { $birthday = new c_date(); $birthday->setString($value_save); $value_save = $birthday->getValue(); } $query = "UPDATE user SET {$field} = '{$value_save}' WHERE id = '{$_user->id}'"; mysql_query($query); if ($field == "birthday") { $value_save = $birthday->getString("d.m.Y"); } // XML-Response senden header("Content-type: application/json"); $ans_array = array("field" => $field, "value" => $value); echo json_encode($ans_array); die;
$move_to = ereg("([0-9]{1,2})[\\/\\. -]+([0-9]{1,2})[\\/\\. -]+([0-9]{1,4})", $move_to, $regs); $move_to = gmmktime(0, 0, 0, $regs[2], $regs[1], $regs[3]); $_camp->subcamp($subcamp_move_id) || die("error"); // Subcamp suchen $query = "SELECT * FROM subcamp WHERE id={$subcamp_move_id} AND camp_id={$_camp->id}"; $result = mysql_query($query); $subcamp = mysql_fetch_assoc($result); if (!$subcamp) { //header( "Location: index.php?app=camp" ); $ans = array("error" => true, "msg" => "Fehler"); echo json_encode($ans); die; } // Überschneidungen prüfen $start = new c_date(); $start->setUnix($move_to); $end = new c_date(); $end->setDay2000($start->getValue() + $subcamp[length] - 1); $query = "SELECT * FROM `subcamp` WHERE camp_id=" . $_camp->id . " AND NOT id=" . $subcamp[id] . " AND(`start` BETWEEN -10000 AND " . ($start->getValue() + $subcamp[length] - 1) . ") AND ((`start`+`length`-1) BETWEEN " . $start->getValue() . " AND 32000)"; $result = mysql_query($query); if (mysql_num_rows($result) >= 1) { $ans = array("error" => true, "msg" => "Der ausgewählte Zeitabschnitt überschneidet sich mit einem anderen Lagerabschnitt. Wähle einen freien Lagerabschnitt aus!"); echo json_encode($ans); die; } // Verschiebung durchführen $query = "UPDATE subcamp SET start=" . $start->getValue() . " WHERE id=" . $subcamp[id]; mysql_query($query); $ans = array("error" => false, "subcamp_start" => $start->getString("d.m.Y"), "subcamp_end" => $end->getString("d.m.Y")); echo json_encode($ans); die;
$jstype = mysql_real_escape_string($_REQUEST['jstype']); $is_course = mysql_real_escape_string($_REQUEST['is_course']); $camp_type = mysql_real_escape_string($_REQUEST['camp_type']); $course_type = mysql_real_escape_string($_REQUEST['course_type']); $course_type_text = mysql_real_escape_string($_REQUEST['course_type_text']); $start = mysql_real_escape_string($_REQUEST['camp_start']); $end = mysql_real_escape_string($_REQUEST['camp_end']); $start = ereg("([0-9]{1,2})[\\/\\. -]+([0-9]{1,2})[\\/\\. -]+([0-9]{1,4})", $start, $regs); $start = gmmktime(0, 0, 0, $regs[2], $regs[1], $regs[3]); $end = ereg("([0-9]{1,2})[\\/\\. -]+([0-9]{1,2})[\\/\\. -]+([0-9]{1,4})", $end, $regs); $end = gmmktime(0, 0, 0, $regs[2], $regs[1], $regs[3]); $c_start = new c_date(); $c_end = new c_date(); $c_start->setUnix($start); $c_end->setUnix($end); $length = $c_end->getValue() - $c_start->getValue() + 1; $start = $c_start->getValue(); $ende = $c_end->getValue(); $is_course = (bool) $is_course; if (!$is_course) { $type = 0; } else { $type = $course_type; } if ($length <= 0) { echo "Das Enddatum darf nicht vor dem Startdatum liegen!"; echo "<br /><a href='javascript:history.back()'>Zurück</a>"; die; } else { if ($length > 40) { echo "Die maximale Länge eines Lagers beträgt 40 Tage.";
* eCamp is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * eCamp is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with eCamp. If not, see <http://www.gnu.org/licenses/>. */ $title = mysql_escape_string($_REQUEST['title']); $text = mysql_escape_string($_REQUEST['text']); $date = mysql_escape_string($_REQUEST['date']); $id = mysql_escape_string($_REQUEST['id']); $_camp->todo($id) || die("error"); if ($title == "" || $date == "") { header("Location: index.php?app=todo"); } $date = ereg("([0-9]{1,2})[\\/\\. -]+([0-9]{1,2})[\\/\\. -]+([0-9]{1,4})", $date, $regs); $date = gmmktime(0, 0, 0, $regs[2], $regs[1], $regs[3]); $todo_date = new c_date(); $todo_date->setUnix($date); $query = "UPDATE todo SET title='{$title}', short='{$text}', date='" . $todo_date->getValue() . "' WHERE id = {$id}"; mysql_query($query); header("Location: index.php?app=todo"); die; ?>
$result = mysql_query($query); if (mysql_num_rows($result) == 0) { //header( "Location: index.php?app=camp" ); $ans = array("error" => true, "msg" => "Fehler"); echo json_encode($ans); die; } $subcamp = mysql_fetch_assoc($result); $subcamp[end] = $subcamp[start] + $subcamp[length] - 1; // Datum auslesen $c_start = new c_date(); $c_end = new c_date(); $c_start->setUnix($change_start); $c_end->setUnix($change_end); $start = $c_start->getValue(); $end = $c_end->getValue(); $length = $end - $start + 1; // Verkehrt rum if ($length <= 0) { $ans = array("error" => true, "msg" => "Das Enddatum darf nicht vor dem Startdatum liegen!"); echo json_encode($ans); die; } else { if ($length > 40) { $ans = array("error" => true, "msg" => "Die maximale Länge eines Lagerabschnitts beträgt 40 Tage. Verwende bitte mehrere Lagerabschnitt für überlange Lager!"); echo json_encode($ans); die; } } // Überschneidungen prüfen $query = "SELECT * FROM `subcamp` WHERE camp_id=" . $_camp->id . " AND NOT id=" . $subcamp[id] . " AND(`start` BETWEEN -10000 AND " . $end . ") AND ((`start`+`length`-1) BETWEEN " . $start . " AND 32000)";
$c_date = new c_date(); $c_date->setUnix(time()); $dropdown = array(); $query = "\tSELECT\n\t\t\t\t\tcamp.*,\n\t\t\t\t\tgroups.id as groups_id,\n\t\t\t\t\tgroups.short_prefix,\n\t\t\t\t\tgroups.name as groups_name\n\t\t\t\tFROM\n\t\t\t\t\tuser_camp,\n\t\t\t\t\tcamp\n\t\t\t\tLEFT JOIN\n\t\t\t\t\tgroups\n\t\t\t\tON\n\t\t\t\t\tgroups.id = camp.group_id\n\t\t\t\tWHERE\n\t\t\t\t\tuser_camp.active = 1 AND\n\t\t\t\t\tuser_camp.camp_id = camp.id AND\n\t\t\t\t\tuser_camp.user_id = {$_user->id}"; $result = mysql_query($query); while ($camp = mysql_fetch_assoc($result)) { $subquery = "\tSELECT\tMAX( subcamp.start + subcamp.length - 1 ) as camp_end\n\t\t\t\t\t\tFROM\tsubcamp\n\t\t\t\t\t\tWHERE\tsubcamp.camp_id = " . $camp['id']; $subresult = mysql_query($subquery); $camp_end = mysql_result($subresult, 0, 'camp_end'); //$dropdown[$camp[groups_id]] = array(); $dropdown[$camp[groups_id]][group_name] = $camp[short_prefix] . " " . $camp[groups_name]; //$dropdown[$camp[groups_id]][camp_list] = array(); //$dropdown[$camp[groups_id]][camp_list][$camp[id]] = array(); $dropdown[$camp[groups_id]][camp_list][$camp[id]][short_name] = $camp[short_name]; $dropdown[$camp[groups_id]][camp_list][$camp[id]][id] = $camp[id]; $dropdown[$camp[groups_id]][camp_list][$camp[id]][past] = $camp_end < $c_date->getValue(); if ($camp[id] == $_camp->id) { $dropdown[$camp[groups_id]][camp_list][$camp[id]][selected] = true; } else { $dropdown[$camp[groups_id]][camp_list][$camp[id]][selected] = false; } if (!$dropdown[$camp[groups_id]][child_num]) { $dropdown[$camp[groups_id]][child_num] = false; } $dropdown[$camp[groups_id]][child_num] = $dropdown[$camp[groups_id]][child_num] || !$dropdown[$camp[groups_id]][camp_list][$camp[id]][past] || $dropdown[$camp[groups_id]][camp_list][$camp[id]][selected]; } /* if($_user_camp->auth_level == 100) { $query = "SELECT * FROM dropdown WHERE list = 'function'"; } else { $query = "SELECT * FROM dropdown WHERE list = 'function' AND value > 0"; }