Пример #1
0
function sendRoutes($nr, $email, $pw)
{
    $sms_key = getBestSMSKeyForEmail($email);
    list($default_location_id, $company_id) = getDefaultLocationAndCompanyFromEmail($email);
    $location = c2r_locations_get($default_location_id);
    $phone = $location->phone;
    $sql = "select key, origin, destination from routes where status='enabled' and user_id=0 and location_id={$default_location_id} order by id";
    $result = query($sql);
    while ($row = pg_fetch_row($result)) {
        $routes[] = $row[0] . ': ' . $row[1];
    }
    $message = t("Available routes at your location are: \n") . implode("\n", $routes);
    $message2 = urlencode($message);
    $subject = t("Open CarPool: You have been registered successfully");
    $msg = t("Thank you for registering at Open CarPool. You can now protect your environment, reduce costs, share ideas and extend your network via carpooling at your company.\n\n");
    $msg .= t("To offer or request a lift, log in via your computer or smart phone at https://web.opencarpool.org using with your email address {$email} and your temporary password '{$pw}'. You can also offer or request lifts via any cell phone at {$phone} or enter recurring lifts in your Outlook calendar by inviting outlook@opencarpool.org.\n\n");
    $msg .= $message;
    $msg .= t("\n\n For a detailed description please visit http://www.opencarpool.org.\n");
    $msg .= t("\n For support or feedback please send a mail to support@opencarpool.org.\n");
    mail($email, $subject, $msg, "From:Open CarPool <*****@*****.**>", "-f support@opencarpool.org");
    $url = 'https://gateway.smstrade.de?key=' . $sms_key . '&to=' . $nr;
    $url .= '&route=gold';
    $url .= '&ref=OpenCarPool';
    $url .= '&from=' . urlencode('OpenCarPool');
    $url .= '&concat_sms=1';
    $url .= '&message=' . $message2;
    $content = file_get_contents($url);
}
Пример #2
0
<?php

require_once '../functions/functions.php';
$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];
Пример #3
0
            }
        }
    }
    if (!$has_errors) {
        c2r_userinfo_insert($_POST['name'], $_POST['email'], $_POST['cid'], $_POST['dlid'], $_POST['gid'], $_POST['is_active'], $_POST['number']);
        unset($_POST);
    } else {
        if ($duplicate_email) {
            $e_msg = 'Duplicate Email: ' . $_POST['email'];
            addErrorMessage($e_msg);
            c2r_log_error('Add User', $e_msg);
        }
        if ($duplicate_number) {
            $e_msg = 'Duplicate Numbers: ' . $_POST['number'];
            addErrorMessage($e_msg);
            c2r_log_error('Add User', $e_msg);
        }
    }
}
$users = c2r_users_get($user->group_id < 3 ? $user->company_id : 0);
foreach ($users as $uid => $u) {
    $ui = c2r_get_user_info_object($uid);
    $users[$uid]->ui = $ui;
}
$locations = c2r_locations_get(0, $user->group_id < 3 ? $user->company_id : 0);
$companies = c2r_companies_get();
$smarty->assign('companies', $companies);
$smarty->assign('locations', $locations);
$smarty->assign('has_errors', $has_errors);
$smarty->assign('users', $users);
smarty_display('users');
Пример #4
0
    if ($user_id == 'user_id') {
        $user_id = $user->id;
    }
    $status = $_POST['status'];
    c2r_routes_update($rid, $origin, $destination, $status, $key, $lid, $user_id);
}
/* Delete Route */
if (isset($_GET['do']) && $_GET['do'] == 'delete') {
    $rid = $_GET['rid'];
    c2r_routes_delete($rid);
}
/* Edit company */
if (isset($_GET['do']) && $_GET['do'] == 'edit') {
    $edit_rid = $_GET['rid'];
}
$cid_for_loc = 0;
if ($user->group_id < 3) {
    $cid_for_loc = $user->company_id;
}
$locations = c2r_locations_get(0, $cid_for_loc);
$cid_for_routes = 0;
if ($user->group_id < 3) {
    $cid_for_routes = $user->company_id;
}
$routes = c2r_routes_get(0, 0, $myroutes ? $user->id : 0, false, $cid_for_routes);
$smarty->assign('myroutes', $myroutes);
$smarty->assign('edit_rid', $edit_rid);
$smarty->assign('user_id', $user_id);
$smarty->assign('locations', $locations);
$smarty->assign('routes', $routes);
smarty_display('routes');
Пример #5
0
require_once '../functions/functions.php';
/* Check User rights */
checkMinGroup(2);
/* Edit */
$edit_suffix = null;
if (isset($_GET['do']) && $_GET['do'] == 'edit' && ($id = $_GET['id'])) {
    $edit_suffix = c2r_get_emailsuffix($id);
}
/* Update */
if (isset($_POST['do']) && $_POST['do'] == 'update') {
    c2r_update_emailsuffix($_POST['id'], $_POST['suffix'], $_POST['location_id']);
    addInfoMessage($_POST['suffix'] . ' updated!');
}
/* Delete */
if (isset($_GET['do']) && $_GET['do'] == 'delete' && ($id = $_GET['id'])) {
    c2r_delete_emailsuffix($id);
    addInfoMessage('Email suffix deleted!');
}
/* Insert */
if (isset($_POST['do']) && $_POST['do'] == 'insert') {
    c2r_insert_emailsuffix($_POST['suffix'], $_POST['location_id']);
    addInfoMessage('New email suffix inserted!');
}
$company_id = $user->group_id == 3 ? 0 : $user->company_id;
$emailsuffixes = c2r_get_emailsuffixes($company_id);
$locations = c2r_locations_get(0, $company_id);
#print_r($locations);
$smarty->assign('edit_suffix', $edit_suffix);
$smarty->assign('emailsuffixes', $emailsuffixes);
$smarty->assign('locations', $locations);
smarty_display('emailsuffix');