// Look for action=logout $logout = false; $action = getGetValue('action'); if (!empty($action) && $action == 'logout') { $logout = true; $return_path = ''; SetCookie('webcalendar_login', '', 0, $cookie_path); SetCookie('webcalendar_last_view', '', 0, $cookie_path); } else { if (empty($return_path)) { // see if a return path was set $return_path = get_last_view(false); } } if (!empty($return_path)) { $return_path = clean_whitespace($return_path); $url = $return_path; } else { $url = 'index.php'; } // If Application Name is set to Title then get translation // If not, use the Admin defined Application Name $appStr = generate_application_name(); $login = getPostValue('login'); $password = getPostValue('password'); $remember = getPostValue('remember'); // calculate path for cookie if (empty($PHP_SELF)) { $PHP_SELF = $_SERVER['PHP_SELF']; } if ($single_user == 'Y') {
function remove_punctuation($input) { $output = preg_replace('/[^a-zA-Z0-9]+/', ' ', $input); $output = clean_whitespace($output); return $output; }
} } if ($single_user == "Y") { $login = $single_user_login; } else { if ($use_http_auth) { // HTTP server did validation for us.... if (empty($PHP_AUTH_USER)) { $session_not_found = true; } else { $login = $PHP_AUTH_USER; } } elseif (substr($user_inc, 0, 9) == 'user-app-') { // Use another application's authentication if (!($login = user_logged_in())) { app_login_screen(clean_whitespace($login_return_path)); } } else { if (!empty($settings['session']) && $settings['session'] == 'php') { session_start(); if (!empty($_SESSION['webcalendar_session'])) { $webcalendar_session = $_SESSION['webcalendar_session']; } } else { if (empty($webcalendar_session) && empty($login)) { $session_not_found = true; } else { // Check for cookie... if (!empty($webcalendar_session)) { $encoded_login = $webcalendar_session; if (empty($encoded_login)) {
if ($single_user == 'Y') { /* No login for single-user mode.*/ die_miserable_death(print_not_auth(22)); } if ($use_http_auth) { /* No web login for HTTP-based authentication.*/ die_miserable_death(print_not_auth(23)); } $login = getValue('login'); if (empty($login)) { die_miserable_death(translate('A login must be specified') . '.'); } $date = getValue('date'); $return_path = getValue('return_path'); // Was a return path set? $url = !empty($return_path) ? clean_whitespace($return_path . (!empty($date) ? '?date=' . $date : '')) : 'index.php'; if ($login == '__public__') { do_redirect($url); } if (!nonuser_load_variables($login, 'temp_')) { die_miserable_death(translate('No such nonuser calendar') . ": {$login}"); } if (empty($temp_is_public) || $temp_is_public != 'Y') { die_miserable_death(print_not_auth(24)); } // calculate path for cookie if (empty($PHP_SELF)) { $PHP_SELF = $_SERVER['PHP_SELF']; } $cookie_path = str_replace('nulogin.php', '', $PHP_SELF); // echo "Cookie path: $cookie_path\n";
#!/usr/bin/php <?php require_once 'locationextractor.php'; require_once 'simple_html_dom.php'; require_once 'geoutils.php'; require_once 'cliargs.php'; $cliargs = array('inputurl' => array('short' => 'i', 'type' => 'required', 'description' => 'The URL to pull the text from')); ini_set('display_errors', true); set_time_limit(0); $result = array('errors' => array(), 'warnings' => array(), 'output_id' => '', 'use_base64' => false); $options = cliargs_get_options($cliargs); $input_url = $options['inputurl']; $input_string = curl_get($input_url); $input_html = str_get_html($input_string); $title_element = $input_html->find('title', 0); if (isset($title_element)) { $title = $title_element->plaintext; } else { $title = ''; } $title = clean_whitespace($title); print "Title: '{$title}'\n"; $body = $input_html->find('body', 0); if (!isset($body)) { fatal_error(0, "Couldn't find a <body> in '{$input_url}'"); } $text = $body->text(); $text = clean_whitespace($text); print "Text: '{$text}'\n"; $places = extract_locations($text); print "Places: " . implode(', ', $places) . "\n";