Exemplo n.º 1
0
 * 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;
?>
 
Exemplo n.º 2
0
}
$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'];
Exemplo n.º 3
0
 */
// Authentifizierung überprüfen
$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)";
Exemplo n.º 4
0
$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;
Exemplo n.º 5
0
// Subcamp suchen
$query = "SELECT * FROM subcamp WHERE id={$subcamp_change_id} AND camp_id='{$_camp->id}'";
$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;
    }
}
Exemplo n.º 6
0
 * 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/>.
 */
# Search for all camps, the user is working
#
#########################################################
$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) {