Example #1
0
<?php

include 'core/init.inc.php';
if (isset($_POST['submit'])) {
    $file = $_FILES['file']['tmp_name'];
    if ($file === "") {
        header('Location: upload.php');
        echo "You did not upload anything.";
        break;
    }
    $handle = fopen($file, "r");
    $fileName = substr($_FILES['file']['name'], 0, strpos($_FILES['file']['name'], "."));
    switch ($fileName) {
        case "user":
            uploadUsers($handle);
            break;
        case "roster":
            uploadRosters($handle);
            break;
        case "class":
            uploadClasses($handle);
            break;
    }
}
?>

<!DOCTYPE html>
<html lang="en">
	<head>
			<meta charset="utf-8">
			<title>Upload</title>
if (posix_getuid() != 0) {
    die("Cannot be used in web server mode\n\n");
}
if (preg_match("#--verbose#", implode(" ", $argv))) {
    $GLOBALS["DEBUG"] = true;
}
if ($argv[1] == '--upload') {
    $_GET["OU"] = $argv[2];
    $_GET["SESSION"] = $argv[3];
    upload();
    exit;
}
if ($argv[1] == "--upload-users") {
    $_GET["OU"] = $argv[2];
    $_GET["SESSION"] = $argv[3];
    uploadUsers();
    exit;
}
$ou = $argv[2];
$newou = $argv[1];
$ldap = new clladp();
$unix = new unix();
$slapcat = $unix->find_program("slapcat");
$ldapadd = $unix->find_program("ldapadd");
if (!is_file($slapcat)) {
    echo "No slapcat !!\n";
    return;
}
if (!is_file($ldapadd)) {
    echo "No ldapadd !!\n";
    return;
     completePayment($_REQUEST);
     break;
 case "pay-return-failure":
 case "pay-callback-failure":
     $_SESSION['message'] = 51;
     $_SESSION['messageval'] = $_REQUEST['ErrorMsg'];
     header("Location: pay");
     break;
 case "Update Settings":
     saveSystemSettings($_REQUEST);
     break;
 case "Add New User":
     addUser($_REQUEST);
     break;
 case "Upload Users":
     uploadUsers($_FILES);
     break;
 case "Update User Details":
     updateUserDetails($_REQUEST);
     break;
 case "Edit Form":
 case "Add Form":
     editAddPaperworkForm($_FILES, $_REQUEST);
     break;
 case "Edit Activity":
 case "Add Activity":
     editAddActivity($_REQUEST);
     break;
 case "Book Now":
 case "Edit Booking":
     editAddBooking($_REQUEST);