Example #1
0
$rid = $_GET['rid'];
if (!$rid) {
    $rid = $_POST['rid'];
}
$route = c2r_routes_get($rid);
$locations = c2r_locations_get();
$location = $locations[$route->lid];
#$company = c2r_companies_get($location->cid);
if ($route->user_id == $user->id) {
    checkMinGroup(1);
    $myroutes = true;
} else {
    if ($location->cid == $user->company_id) {
        checkMinGroup(2);
    } else {
        checkMinGroup(3);
    }
}
// Submit
if (!$_GET['rid']) {
    $rid = $_POST['rid'];
    c2r_routepoints_delete($rid);
    $pos = 0;
    for ($i = 0; $i < 10; $i++) {
        if (!$_POST['delete_' . $i]) {
            $pos++;
            $pid = $_POST['point'][$i];
            $st = $_POST['steptime'][$i];
            c2r_routepoints_insert($rid, $pid, $st, $pos);
        }
    }
Example #2
0
<?php

require_once '../functions/functions.php';
$uid = isset($_GET['uid']) ? $_GET['uid'] : null;
if (!$uid) {
    $uid = isset($_POST['uid']) ? $_POST['uid'] : null;
}
$admin_view = false;
if ($uid) {
    $admin_view = true;
    checkMinGroup(2);
} else {
    $uid = $user->id;
    checkMinGroup(1);
}
if (isset($_POST['new_password'])) {
    $new_password = $_POST['new_password'];
    $retype = $_POST['retype'];
    if ($new_password && $new_password == $retype) {
        c2r_change_password($new_password, $uid);
        addInfoMessage('Password changed!');
    } else {
        addErrorMessage('Passwords do not match!');
    }
}
if (isset($_GET['user_delete']) && ($delid = $_GET['user_delete'])) {
    c2r_user_delete($delid);
    killSession();
    header("Location: " . OCP_BASE_URL . "users.php");
    /* Redirect browser */
    addInfoMessage(t('Profile deleted'));
Example #3
0
<?php

require_once '../functions/functions.php';
$myroutes = false;
if ($_GET['my'] == 1 || $_POST['my'] == 1) {
    checkMinGroup(1);
    $myroutes = true;
} else {
    checkMinGroup(2);
}
/* Insert new company */
if (isset($_POST['do']) && $_POST['do'] == 'insert') {
    $origin = $_POST['origin'];
    $destination = $_POST['destination'];
    $lid = $_POST['lid'];
    $key = $_POST['key'];
    $user_id = $_POST['user_id'];
    if ($user_id == 'user_id') {
        $user_id = $user->id;
    }
    if ($user_id == '') {
        $user_id = 0;
    }
    $status = $_POST['status'];
    $new_id = c2r_routes_insert($origin, $destination, $status, $key, $lid, $user_id);
    header("Location: " . OCP_BASE_URL . "route_points.php?rid=" . $new_id . ($myroutes ? '&my=1' : ''));
    /* Redirect browser */
    exit;
}
/* Update company */
if (isset($_POST['do']) && $_POST['do'] == 'update') {
Example #4
0
    }
    $name = $_POST['name'];
    $smskey = $_POST['smskey'];
    $zendeskid = $_POST['zendeskid'];
    $logourl = $_POST['logourl'];
    $email = $_POST['email'];
    $cid = $_POST['cid'];
    $edit_cid = $cid;
    c2r_companies_update($cid, $name, $smskey, $zendeskid, $logourl, $email);
    addInfoMessage("Company {$name} updated");
}
/* Delete company */
if (isset($_GET['do']) && $_GET['do'] == 'delete') {
    $cid = $_GET['cid'];
    c2r_companies_delete($cid);
    addInfoMessage("Company deleted");
}
/* Edit company */
if (isset($_GET['do']) && $_GET['do'] == 'edit') {
    $edit_cid = $_GET['cid'];
    // just edit own if not an (super?) admin
    if ($bycompany && $companies[$edit_cid]->id != $user->company_id) {
        checkMinGroup(0);
    }
}
/* Reload */
$companies = c2r_companies_get();
$smarty->assign('bycompany', $bycompany);
$smarty->assign('edit_cid', $edit_cid);
$smarty->assign('companies', $companies);
smarty_display('companies');