/** * @return Smarty Locally-usable Smarty instance. */ function get_smarty_instance() { $s = new Smarty(); $s->compile_dir = join(DIRECTORY_SEPARATOR, array(dirname(__FILE__), '..', 'templates', 'cache')); $s->cache_dir = join(DIRECTORY_SEPARATOR, array(dirname(__FILE__), '..', 'templates', 'cache')); $s->template_dir = join(DIRECTORY_SEPARATOR, array(dirname(__FILE__), '..', 'templates')); $s->config_dir = join(DIRECTORY_SEPARATOR, array(dirname(__FILE__), '..', 'templates')); $s->assign('domain', get_domain_name()); $s->assign('base_dir', get_base_dir()); $s->assign('base_href', get_base_href()); $s->assign('constants', get_defined_constants()); $s->assign('request', array('get' => $_GET)); return $s; }
/** * @return Smarty Locally-usable Smarty instance. */ function get_smarty_instance() { $s = new Smarty(); $s->compile_dir = join(DIRECTORY_SEPARATOR, array(dirname(__FILE__), '..', 'templates', 'cache')); $s->cache_dir = join(DIRECTORY_SEPARATOR, array(dirname(__FILE__), '..', 'templates', 'cache')); $s->template_dir = join(DIRECTORY_SEPARATOR, array(dirname(__FILE__), '..', 'templates')); $s->config_dir = join(DIRECTORY_SEPARATOR, array(dirname(__FILE__), '..', 'templates')); $s->register_modifier('url_domain', 'get_url_domain'); $s->register_modifier('nice_relative_time', 'get_relative_time'); $s->assign('domain', get_domain_name()); $s->assign('base_dir', get_base_dir()); $s->assign('base_href', get_base_href()); $s->assign('logo', '<img src="' . LOGO . '" />'); $s->assign('site_title', SITE_TITLE); // $s->clear_all_cache(); return $s; }
/** * @return Smarty Locally-usable Smarty instance. */ function get_smarty_instance($user) { $s = new Smarty(); $s->compile_dir = join(DIRECTORY_SEPARATOR, array(dirname(__FILE__), '..', 'templates', 'cache')); $s->cache_dir = join(DIRECTORY_SEPARATOR, array(dirname(__FILE__), '..', 'templates', 'cache')); $s->template_dir = join(DIRECTORY_SEPARATOR, array(dirname(__FILE__), '..', 'templates')); $s->config_dir = join(DIRECTORY_SEPARATOR, array(dirname(__FILE__), '..', 'templates')); $s->assign('domain', get_domain_name()); $s->assign('base_dir', get_base_dir()); $s->assign('base_href', get_base_href()); $s->assign('constants', get_defined_constants()); $s->assign('providers', get_map_providers()); $s->assign('request', array('get' => $_GET, 'post' => $_POST, 'uri' => $_SERVER['REQUEST_URI'], 'query' => $_SERVER['QUERY_STRING'], 'authenticated' => isset($user), 'user' => $user)); $s->register_modifier('nice_placename', 'nice_placename'); $s->register_modifier('nice_domainname', 'nice_domainname'); $s->register_modifier('nice_relativetime', 'nice_relativetime'); $s->register_modifier('nice_datetime', 'nice_datetime'); $s->register_modifier('nice_degree', 'nice_degree'); $s->register_modifier('decode_utf8', 'decode_utf8'); return $s; }
function print_to_csv_row($print) { $row = array('type' => 'atlas', 'href' => 'http://' . get_domain_name() . get_base_dir() . '/atlas.php?id=' . urlencode($print['id']), 'created' => '"' . date('r', $print['created']) . '"', 'person_href' => '', 'geometry' => '', 'atlas_page_href' => '', 'snapshot_href' => '', 'note' => ''); if ($print['user_name']) { $row['person_href'] = 'http://' . get_domain_name() . get_base_dir() . '/atlases.php?user='******'user_id']); } $polys = array(); foreach ($print['pages'] as $page) { $north = floatval($page['north']); $south = floatval($page['south']); $east = floatval($page['east']); $west = floatval($page['west']); $polys[] = sprintf('((%.6f %.6f,%.6f %.6f,%.6f %.6f,%.6f %.6f,%.6f %.6f))', $west, $south, $west, $north, $east, $north, $east, $south, $west, $south); } $row['geometry'] = sprintf('"MULTIPOLYGON(%s)"', join(', ', $polys)); return join(',', array_values($row)); }
<?php require_once '../lib/lib.everything.php'; enforce_master_on_off_switch($_SERVER['HTTP_ACCEPT_LANGUAGE']); $context = default_context(True); /**** ... ****/ $context->db->query('START TRANSACTION'); $scan = add_scan($context->db, $context->user['id']); flush_scans($context->db, 3600); $context->db->query('COMMIT'); $dirname = "scans/{$scan['id']}"; $redirect = 'http://' . get_domain_name() . get_base_dir() . '/uploaded.php?scan=' . rawurlencode($scan['id']); $s3post = AWS_ACCESS_KEY && AWS_SECRET_KEY && S3_BUCKET_ID ? s3_get_post_details(time() + 600, $dirname, $redirect) : null; $localpost = AWS_ACCESS_KEY && AWS_SECRET_KEY && S3_BUCKET_ID ? null : local_get_post_details(time() + 600, $dirname, $redirect); $context->sm->assign('s3post', $s3post); $context->sm->assign('localpost', $localpost); header("Content-Type: text/html; charset=UTF-8"); print $context->sm->fetch("upload.html.tpl");
function local_get_post_baseurl($dirname) { return 'http://' . get_domain_name() . get_base_dir() . '/files/' . trim($dirname, '/') . '/'; }
ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . '../lib'); require_once 'init.php'; require_once 'data.php'; $C = new Context(DB_DSN, GUARDIAN_API_KEY, FLICKR_API_KEY, $_COOKIE['visitor']); $C->setCookie(); list($response_format, $response_mime_type) = parse_format($_GET['format'], 'html'); $woe_id = is_numeric($_GET['woe']) ? intval($_GET['woe']) : null; $woe_ids = isset($_GET['woes']) ? intvals($_GET['woes']) : null; $article_id = is_numeric($_GET['article']) ? intval($_GET['article']) : null; $article_ids = isset($_GET['articles']) ? intvals($_GET['articles']) : null; $count = is_numeric($_GET['count']) ? intval($_GET['count']) : null; $offset = is_numeric($_GET['offset']) ? intval($_GET['offset']) : 0; $js_callback = $response_mime_type == 'text/javascript' && $_GET['callback'] ? sanitize_js_callback($_GET['callback']) : null; if ($woe_id && $article_id) { $url = new Net_URL('http://' . get_domain_name() . get_base_dir() . '/point.php'); $url->addQueryString('article', $article_id); $url->addQueryString('woe', $woe_id); $url->addQueryString('format', $response_format); header('Location: ' . $url->getURL()); exit; } elseif (($article_ids || $woe_ids) && ($article_id || $woe_id)) { header('Content-Type: text/plain'); die_with_code(400, "It's not possible to specify both singular and plural article/WOE ID's.\n"); } else { $points = get_points($C, compact('article_id', 'woe_id', 'article_ids', 'woe_ids', 'count', 'offset')); $total = get_points_total($C, compact('article_id', 'woe_id', 'article_ids', 'woe_ids')); $count = count($points); } $C->close(); header("Content-Type: {$response_mime_type}; charset=UTF-8");
private function test_utility_helper() { $this->unit->use_strict(true); $this->unit->run(get_github_url(), 'is_string', 'get_github_url()'); $this->unit->run(get_facebook_url(), 'is_string', 'get_facebook_url()'); $this->unit->run(get_twitter_url(), 'is_string', 'get_twitter_url()'); $this->unit->run(get_google_map_key(), 'is_string', 'get_google_map_key()'); $this->unit->run(get_ga_code(), 'is_string', 'get_ga_code()'); $this->unit->run(is_null_or_empty_string(''), 'is_true', 'is_null_or_empty_string()'); $this->unit->run(is_null_or_empty_string('test'), 'is_false', 'is_null_or_empty_string()'); $this->unit->run(is_null_or_empty_string(1), 'is_false', 'is_null_or_empty_string()'); $this->unit->run(start_with('abcdef', 'ab'), 'is_true', 'start_with()'); $this->unit->run(start_with('abcdef', 'cd'), 'is_false', 'start_with()'); $this->unit->run(start_with('abcdef', 'ef'), 'is_false', 'start_with()'); $this->unit->run(start_with('abcdef', ''), 'is_true', 'start_with()'); $this->unit->run(start_with('', 'abcdef'), 'is_false', 'start_with()'); $this->unit->run(end_with("abcdef", "ab"), 'is_false', 'end_with()'); $this->unit->run(end_with("abcdef", "cd"), 'is_false', 'end_with()'); $this->unit->run(end_with("abcdef", "ef"), 'is_true', 'end_with()'); $this->unit->run(end_with("abcdef", ""), 'is_true', 'end_with()'); $this->unit->run(end_with("", "abcdef"), 'is_false', 'end_with()'); $this->unit->run(get_domain_name('http://somedomain.co.uk'), 'somedomain.co.uk', 'get_domain_name()'); $this->unit->run(get_domain_name('http://www2.manager.co.th'), 'manager.co.th', 'get_domain_name()'); $this->unit->run(get_domain_name('http://test.manager.co.th'), 'manager.co.th', 'get_domain_name()'); $this->unit->run(get_domain_name('http://manager.co.th'), 'manager.co.th', 'get_domain_name()'); $this->unit->run(get_domain_name('http://thaiware.com'), 'thaiware.com', 'get_domain_name()'); $this->unit->run(get_domain_name('http://www.thaiware.com'), 'thaiware.com', 'get_domain_name()'); $this->unit->run(get_domain_name('http://test.thaiware.com'), 'thaiware.com', 'get_domain_name()'); $this->unit->run(get_domain_name('http://www.studentloan.ktb.co.th/'), 'ktb.co.th', 'get_domain_name()'); $this->unit->run(get_domain_name('http://www.studentloan.ktb.co.th/dasdasdasd.html'), 'ktb.co.th', 'get_domain_name()'); $this->unit->run(get_domain_name('http://www.studentloan.ktb.co.th?quewadsas=2faddasdas'), 'ktb.co.th', 'get_domain_name()'); $this->unit->run(get_domain_name('http://www.studentloan.ktb.co.th/2011/20/01?=asdasdasdasd'), 'ktb.co.th', 'get_domain_name()'); $this->unit->run(get_domain_name('http://pantip.com/forum/siam'), 'pantip.com', 'get_domain_name()'); $this->unit->run(get_domain_name('http://www.wegointer.com/category/variety/'), 'wegointer.com', 'get_domain_name()'); $this->unit->run(get_domain_name(), 'lab.jojoee.com', 'get_domain_name()'); $this->unit->run(get_full_domain_name('http://www.wegointer.com/category/variety/'), 'www.wegointer.com', 'get_domain_name()'); $this->unit->run(get_full_domain_name('http://somedomain.co.uk'), 'somedomain.co.uk', 'get_full_domain_name()'); $this->unit->run(get_full_domain_name('http://www2.manager.co.th'), 'www2.manager.co.th', 'get_full_domain_name()'); $this->unit->run(get_full_domain_name('http://test.manager.co.th'), 'test.manager.co.th', 'get_full_domain_name()'); $this->unit->run(get_full_domain_name('http://manager.co.th'), 'manager.co.th', 'get_full_domain_name()'); $this->unit->run(get_full_domain_name('http://thaiware.com'), 'thaiware.com', 'get_full_domain_name()'); $this->unit->run(get_full_domain_name('http://www.thaiware.com'), 'www.thaiware.com', 'get_full_domain_name()'); $this->unit->run(get_full_domain_name('http://test.thaiware.com'), 'test.thaiware.com', 'get_full_domain_name()'); $this->unit->run(get_full_domain_name('http://www.studentloan.ktb.co.th/'), 'www.studentloan.ktb.co.th', 'get_full_domain_name()'); $this->unit->run(get_full_domain_name('http://www.studentloan.ktb.co.th/dasdasdasd.html'), 'www.studentloan.ktb.co.th', 'get_full_domain_name()'); $this->unit->run(get_full_domain_name('http://www.studentloan.ktb.co.th?quewadsas=2faddasdas'), 'www.studentloan.ktb.co.th', 'get_full_domain_name()'); $this->unit->run(get_full_domain_name('http://www.studentloan.ktb.co.th/2011/20/01?=asdasdasdasd'), 'www.studentloan.ktb.co.th', 'get_full_domain_name()'); $this->unit->run(get_full_domain_name('http://pantip.com/forum/siam'), 'pantip.com', 'get_full_domain_name()'); $this->unit->run(get_full_domain_name('http://www.wegointer.com/category/variety/'), 'www.wegointer.com', 'get_full_domain_name()'); $this->unit->run(get_full_domain_name(), 'lab.jojoee.com', 'get_full_domain_name()'); $url = 'http://sub.wegointer.com/category/variety/'; $this->unit->run(get_request_url($url, get_full_domain_name($url)), '/category/variety', 'get_request_url()'); $url = 'http://www.wegointer.com/category/variety/'; $this->unit->run(get_request_url($url, get_full_domain_name($url)), '/category/variety', 'get_request_url()'); $this->unit->run(get_full_url(), 'http://lab.jojoee.com/nn/test', 'get_full_url()'); // 404, 301 // $this->unit->run(is_url_exists('http://jojoee.com/404'), 'is_true', 'is_url_exists()'); // $this->unit->run(is_url_exists('http://fashion.spokedark.tv/2015/04/24/dichan-magazine/'), 'is_true', 'is_url_exists()'); // $this->unit->run(is_url_exists('http://www.jojoee.com/'), 'is_true', 'is_url_exists()'); // $this->unit->run(is_url_exists('http://test4041.com/'), 'is_false', 'is_url_exists()'); // $this->unit->run(is_url_exists('http://test4041.com/'), 'is_false', 'is_url_exists()'); // $this->unit->run(is_url_redirects('http://www.jojoee.com/'), 'is_true', 'is_url_exists()'); // $this->unit->run(is_404('http://jojoee.com/404'), 'is_true', 'is_404()'); // $url = 'http://fashion.spokedark.tv/?p=6600'; // $this->unit->run(is_url_exists($url), 'is_true', 'is_url_exists()'); // $this->unit->run(is_url_redirects($url), 'is_true', 'is_url_redirects()'); // don't know why it doesn't work // $url = 'http://movies.spokedark.tv?p=10054/'; // $this->unit->run(is_url_exists($url), 'is_true', 'is_url_exists()'); // $this->unit->run(is_url_redirects($url), 'is_true', 'is_url_redirects()'); $this->unit->run(get_extension('file.jpeg'), 'jpeg', 'get_extension()'); $this->unit->run(get_extension('file.bk.zip'), 'zip', 'get_extension()'); $this->unit->run(remove_trailing_slash('/category/product/'), '/category/product', 'remove_trailing_slash()'); $this->unit->run(remove_trailing_slash('/category/product'), '/category/product', 'remove_trailing_slash()'); $this->unit->run(remove_trailing_slash('category/product/'), 'category/product', 'remove_trailing_slash()'); for ($i = 0; $i < 20; $i++) { $urls = $this->get_posts(); foreach ($urls as $url) { $this->unit->run($url['is_publish'], '0', 'get_posts()'); } } }
function scan_note_to_csv_row($note) { preg_match('/^(\\w+)\\b/', $note['geometry'], $p); $row = array('type' => 'note ' . strtolower($p[1]), 'href' => '', 'created' => '"' . date('r', $note['created']) . '"', 'person_href' => '', 'geometry' => '"' . $note['geometry'] . '"', 'atlas_page_href' => '', 'snapshot_href' => 'http://' . get_domain_name() . get_base_dir() . '/snapshot.php?id=' . urlencode($note['scan_id']), 'note' => '"' . $note['note'] . '"'); if ($scan['user_name']) { $row['person_href'] = 'http://' . get_domain_name() . get_base_dir() . '/snapshots.php?user='******'user_id']); } return join(',', array_values($row)); }
// new transport maps are enabled by default $enabled = 1; // domain is free, lets add it! if (add_transport_map($mail_host, $mail_port, $enabled, $address_id, $mysqli)) { echo "\n\t\t\t\t\t\t<!-- Begin Content Division -->\n\t\t\t\t\t\t<div id='content'>\t\t\t\t\t\n\t\t\t\t\t\t\t<legend>Create Transport Map</legend>\n\t\t\t\t\t\t\t" . quickalert("success", "New transport map has been created for '" . $domain_name . "'.") . "\t\t\t\t\n\t\t\t\t\t\t<!-- End Content Division -->\n\t\t\t\t\t\t</div>\n\t\t\t\t\t"; } else { errormsg("Failed to insert new record into the database"); } } } else { errormsg("transport map already exists"); } } elseif (!$_POST) { // for this, id = address_id if (isset($_GET['id'])) { if (get_domain_name($_GET['id'], $mysqli)) { $selected_address_id = $_GET['id']; } } echo "\n\t\t<!-- Begin Content Division -->\n\t\t<div id='content'>\n\t\t\t<form class='form-horizontal' action='" . SITE_URL . "/?do=create&object=transmap' method='post' name='create_transmap'>\n\t\t\t\t<fieldset>\n\t\t\t\t\n\t\t\t\t<legend>Create Transport Map</legend>\n\t\t\t\t" . quickalert("info", "Transport maps can only be created for a domain without one. i.e. each domain as one transport map only") . "\n\t\t\t\t<div class='form-group'>\n\t\t\t\t\t<label class='col-md-4 control-label' for='selectbasic'>Domain</label>\n\t\t\t\t\t<div class='col-md-4'>\n\t\t\t\t\t<select id='address_id' name='address_id' class='form-control'>\n\t\t\t\t"; $query = "\n\t\t\t\t\tSELECT addresses.address_id,addresses.domain \n\t\t\t\t\tFROM addresses \n\t\t\t\t\tLEFT JOIN transports \n\t\t\t\t\tON addresses.address_id=transports.address_id \n\t\t\t\t\tWHERE transports.transport_id IS NULL\n\t\t\t\t\t"; if ($stmt = $mysqli->prepare($query)) { $stmt->execute(); $stmt->store_result(); if ($stmt->num_rows > 0) { $stmt->bind_result($address_id, $domain); while ($row = $stmt->fetch()) { if (isset($selected_address_id) && $selected_address_id == $address_id) { echo "<option selected value=" . $address_id . ">" . $domain . "</option>"; } else { echo "<option value=" . $address_id . ">" . $domain . "</option>";
$attempted_upload = true; $acceptable_upload = preg_match('#^http://#', $url); } if ($attempted_upload && !$acceptable_upload) { die_with_code(400, 'Sorry, something about your file was bad'); } if ($acceptable_upload && $scan && !$scan['decoded']) { queue_task("tasks.decodeScan", array("http://" . SERVER_NAME, API_PASSWORD), array("action" => "decode", "scan_id" => $scan["id"], "url" => $url)); $context->db->query('START TRANSACTION'); $scan = get_scan($context->db, $scan['id']); $parsed_url = parse_url($url); $scan['base_url'] = "http://{$parsed_url['host']}" . dirname($parsed_url['path']); $scan['progress'] = 0.1; // the first 10% is just getting the thing uploaded set_scan($context->db, $scan); $context->db->query('COMMIT'); } if ($attempted_upload) { header('Location: http://' . get_domain_name() . get_base_dir() . '/snapshot.php?id=' . urlencode($scan['id'])); } exit; // // Old form stuff down here. // if ($attempted_upload) { header('Location: http://' . get_domain_name() . get_base_dir() . '/uploaded.php?scan=' . urlencode($scan['id'])); } $context->sm->assign('scan', $scan); $context->sm->assign('language', $language); header("Content-Type: text/html; charset=UTF-8"); print $context->sm->fetch("uploaded.html.tpl");
<?php require_once '../lib/lib.everything.php'; $context = default_context(True); //// // Path //// $mbtiles_filename = basename($_FILES['uploaded_mbtiles']['name']); $target_mbtiles_folder = "mbtiles/"; $target_mbtiles_path = $target_mbtiles_folder . $mbtiles_filename; //// // Content //// $mbtiles_content_bytes = file_get_contents($_FILES['uploaded_mbtiles']['tmp_name']); $mime_type = 'application/octet-stream'; // Post the file post_file($target_mbtiles_path, $mbtiles_content_bytes, $mime_type); $filename = explode('.', basename($_FILES['uploaded_mbtiles']['name'])); $slug = $filename[0]; $mbtiles_url = 'http://' . get_domain_name() . get_base_dir() . '/mbtiles.php/' . $slug . '/{Z}/{X}/{Y}.png'; $mbtiles = add_mbtiles($context->db, $context->user['id'], $mbtiles_url, $mbtiles_filename, 'files/' . $target_mbtiles_path); $display_mbtiles_url = 'http://' . get_domain_name() . get_base_dir() . '/display_mbtiles.php?id=' . urlencode($mbtiles['id']) . '&filename=' . urlencode($slug); header("Location: {$display_mbtiles_url}");
function setCookie() { setcookie('visitor', $this->visitor_id, time() + 86400 * 30, get_base_dir(), get_domain_name()); }
$print = compose_from_geojson($context->db, $json_content); } else { $atlas_postvars = $_POST; if (!empty($_POST['form_url'])) { $added_form = add_form($context->db, $context->user['id']); $added_form['form_url'] = $_POST['form_url']; if (!empty($_POST['form_title'])) { $added_form['title'] = $_POST['form_title']; } set_form($context->db, $added_form); // // A new form was requested. // postvars will now have form_id in addition to form_url. // $atlas_postvars['form_id'] = $added_form['id']; } if ($clone_job && $clone_id) { $print = compose_clone($context->db, $atlas_postvars, $context->user['id'], $clone_id, false); } elseif ($refresh_job && $refresh_id) { $print = compose_clone($context->db, $atlas_postvars, $context->user['id'], $refresh_id, true); } else { $print = compose_from_postvars($context->db, $atlas_postvars, $context->user['id']); } } $context->db->query('COMMIT'); if (is_null($print)) { die_with_code(400, "Missing... Something."); } $print_url = 'http://' . get_domain_name() . get_base_dir() . '/atlas.php?id=' . urlencode($print['id']); header("Location: {$print_url}"); }
function get_transport_domain($transport_id, $mysqli) { if ($stmt = $mysqli->prepare("SELECT address_id FROM `transports` WHERE transport_id= ? ")) { $stmt->bind_param('i', $transport_id); $stmt->execute(); $stmt->store_result(); if ($stmt->num_rows == 1) { // get variables from result. $stmt->bind_result($address_id); $stmt->fetch(); $domain_name = get_domain_name($address_id, $mysqli); return $domain_name; } else { return false; } } }
$error = ''; if (isset($_POST['form_url'])) { if (empty($_POST['form_url'])) { $error = "Empty or missing form_url."; } if (empty($error)) { $added_form = add_form($context->db, $context->user['id']); $added_form['form_url'] = $_POST['form_url']; if (!empty($_POST['form_title'])) { $added_form['title'] = $_POST['form_title']; } set_form($context->db, $added_form); $message = array('action' => 'import form', 'url' => $_POST['form_url'], 'form_id' => $added_form['id']); // queue the task queue_task("tasks.parseForm", array("http://" . SERVER_NAME, API_PASSWORD), $message); $form_url = 'http://' . get_domain_name() . get_base_dir() . '/form.php?id=' . urlencode($added_form['id']); header("Location: {$form_url}"); exit; } } if ($context->type == 'text/html') { if (!empty($error)) { $context->sm->assign('error', $error); } header("Content-Type: text/html; charset=UTF-8"); print $context->sm->fetch("add-form.html.tpl"); } else { header('HTTP/1.1 400'); $error = "Unknown type."; $context->sm->assign('error', $error); header("Content-Type: text/html; charset=UTF-8");
$error = 'Someone has already registered with that email address.'; break; } $new_user = add_user($context->db); $new_user['name'] = $_POST['username']; $new_user['email'] = $_POST['email']; $new_user['password'] = $_POST['password1']; $registered_user = set_user($context->db, $new_user); if ($registered_user === false) { $error = 'User name exists.'; break; } $hash = md5(rand(0, 1000)); $q = 'UPDATE users SET hash=? WHERE name=?'; $res = $context->db->query($q, $hash, $_POST['username']); login_user_by_id($context->db, $registered_user['id']); $to = $_POST['email']; $subject = 'Field Papers Verification'; $url = sprintf('http://%s%s/verify.php?email=%s&hash=%s', get_domain_name(), get_base_dir(), urlencode($_POST['email']), urlencode($hash)); $message = "Thanks for signing up for Field Papers!\n \n Please verify your account: {$url}\n \n "; $headers = 'From:noreply@fieldpapers.org' . "\r\n"; mail($to, $subject, $message, $headers); // redirect header('Location: ' . $_POST['redirect']); break; } if (!empty($error)) { $context->sm->assign('error', $error); } header("Content-Type: text/html; charset=UTF-8"); print $context->sm->fetch("registration.html.tpl");
exit; } $latlon = array($latlonzoom[0], $latlonzoom[1]); $zoom = $latlonzoom[2]; } $context->sm->assign('center', join(',', $latlon)); $context->sm->assign('zoom', $zoom); $redirect_href = sprintf('http://%s%s/make-step2-geography.php?zoom=%s&lat=%s&lon=%s', get_domain_name(), get_base_dir(), $zoom, $latlon[0], $latlon[1]); header('HTTP/1.1 303'); header("Location: {$redirect_href}"); } if (isset($_GET) && !empty($_GET)) { if ($_GET['mbtiles_id']) { $mbtiles = get_mbtiles_by_id($context->db, $_GET['mbtiles_id']); $mbtiles_data = array("provider" => $mbtiles['url'], "uploaded_file" => $mbtiles['uploaded_file'], "center_x" => $mbtiles['center_x_coord'], "center_y" => $mbtiles['center_y_coord'], "zoom" => $mbtiles['center_zoom'], 'min_zoom' => $mbtiles['min_zoom'], 'max_zoom' => $mbtiles['max_zoom']); $context->sm->assign('mbtiles_data', $mbtiles_data); } elseif ($_GET['lat'] && $_GET['lon'] && $_GET['zoom']) { $center = array($_GET['lat'], $_GET['lon']); $zoom = $_GET['zoom']; $context->sm->assign('center', join(',', $center)); $context->sm->assign('zoom', $zoom); } else { $redirect_href = sprintf('http://%s%s/make-step1-search.php?error=no_response', get_domain_name(), get_base_dir()); header('HTTP/1.1 303'); header("Location: {$redirect_href}"); exit; } } $context->sm->assign('providers', get_map_providers()); header("Content-Type: text/html; charset=UTF-8"); print $context->sm->fetch("make-step2-geography.html.tpl");
public function resetpass($id, $key) { $u = User::factory()->where('id', (int) $id)->where("key", $key)->get(); if ($u->exists()) { $u->key = ''; $u->active = 1; $u->salt = ''; $p = random_string(); $u->password = $p; $u->save(); //set variables for template $vars = array('name' => $u->name, 'email' => $u->email, 'password' => $p, 'website_title' => Setting::value('website_title', CS_PRODUCT_NAME), 'site_url' => site_url()); //get email template $template = file_get_contents(APPPATH . "templates/new_password.html"); $template = __($template, null, 'email'); $template .= "<br />\n<br />\n<br />\n" . __(file_get_contents(APPPATH . "templates/signature.html"), null, 'email'); $template = parse_template($template, $vars); //send email $this->email->to("{$u->name} <{$u->email}>"); $this->email->subject(__("%s password reset", Setting::value('website_title', CS_PRODUCT_NAME), 'email')); $this->email->message($template); $this->email->set_alt_message(strip_tags($template)); $from = Setting::value("default_email", false); if (empty($from)) { $from = "noreply@" . get_domain_name(true); } $this->email->from($from); $sent = $this->email->send(); if ($sent) { $this->templatemanager->notify_next(__("New password is set. Please check your e-mail."), "success", __("Success")); } else { $this->templatemanager->notify_next(__("E-mail could not be sent!"), "error", __("Error")); } } else { $this->templatemanager->notify_next(__("Invalid key or password already reset."), "error", __("Error")); } redirect("administration/auth/login"); }
<?php require_once '../lib/lib.everything.php'; require_once '../lib/lib.qrcode.php'; enforce_master_on_off_switch($_SERVER['HTTP_ACCEPT_LANGUAGE']); /**** ... ****/ $url = 'http://' . get_domain_name() . get_base_dir() . '/atlas.php?id=' . urlencode($_GET['print']); $qrc = QRCode::getMinimumQRCode($url, QR_ERROR_CORRECT_LEVEL_Q); $img = $qrc->createImage(16, 0); header('Content-type: image/png'); header("X-Content: {$url}"); imagepng($img); imagedestroy($img);
function get_ref() { $ref = $_SERVER['HTTP_REFERER']; if (!empty($ref)) { $domain = get_domain_name($ref); return $domain; } else { return ''; } }