Exemplo n.º 1
0
 function __register_template()
 {
     global $conf;
     if (!empty($_REQUEST['q'])) {
         require_once DOKU_INC . 'inc/JSON.php';
         $json = new JSON();
         $tempREQUEST = (array) $json->dec(stripslashes($_REQUEST['q']));
     } else {
         if (!empty($_REQUEST['template'])) {
             $tempREQUEST = $_REQUEST;
         } else {
             if (preg_match("/(js|css)\\.php\$/", $_SERVER['SCRIPT_NAME']) && isset($_SERVER['HTTP_REFERER'])) {
                 // this is a css or script, nothing before matched and we have a referrer.
                 // lets asume we came from the dokuwiki page.
                 // Parse the Referrer URL
                 $url = parse_url($_SERVER['HTTP_REFERER']);
                 parse_str($url['query'], $tempREQUEST);
             } else {
                 return;
             }
         }
     }
     // define Template baseURL
     if (empty($tempREQUEST['template'])) {
         return;
     }
     $tplDir = DOKU_INC . 'lib/tpl/' . $tempREQUEST['template'] . '/';
     if (!file_exists($tplDir)) {
         return;
     }
     // Set hint for Dokuwiki_Started event
     if (!defined('SITEEXPORT_TPL')) {
         define('SITEEXPORT_TPL', $tempREQUEST['template']);
     }
     // define baseURL
     // This should be DEPRECATED - as it is in init.php which suggest tpl_basedir and tpl_incdir
     /* **************************************************************************************** */
     if (!defined('DOKU_REL')) {
         define('DOKU_REL', getBaseURL(false));
     }
     if (!defined('DOKU_URL')) {
         define('DOKU_URL', getBaseURL(true));
     }
     if (!defined('DOKU_BASE')) {
         if (isset($conf['canonical'])) {
             define('DOKU_BASE', DOKU_URL);
         } else {
             define('DOKU_BASE', DOKU_REL);
         }
     }
     // This should be DEPRECATED - as it is in init.php which suggest tpl_basedir and tpl_incdir
     if (!defined('DOKU_TPL')) {
         define('DOKU_TPL', (empty($tempREQUEST['base']) ? DOKU_BASE : $tempREQUEST['base']) . 'lib/tpl/' . $tempREQUEST['template'] . '/');
     }
     if (!defined('DOKU_TPLINC')) {
         define('DOKU_TPLINC', $tplDir);
     }
     /* **************************************************************************************** */
 }
Exemplo n.º 2
0
function collectParameters()
{
    $parameters = new stdClass();
    $parameters->app_id = filter_input(INPUT_GET, "app_id");
    $parameters->account_id = filter_input(INPUT_GET, "account_id");
    $parameters->api_key = filter_input(INPUT_GET, "api_key");
    $parameters->baseURL = getBaseURL(true);
    return $parameters;
}
Exemplo n.º 3
0
function redirectHash($hash)
{
    $hash = assertValidHash($hash);
    $link = getBaseURL() . "#{$hash}";
    header("Location: {$link}");
    echo "Redirecting to <a href=\"{$link}\">{$link}</a>. ";
    echo "Click on that link if you're not redirected.";
    die;
}
Exemplo n.º 4
0
 public static function redirect($name)
 {
     if (!isset($_SESSION[$name])) {
         $config = eval(substr(file_get_contents(SYSC . 'config.php'), 5));
         if (!isset($config["route_defauls"]["login"])) {
             throw new Exception("Please specify route_defauls-login in config file.");
         }
         redirect(getBaseURL($config["route_defauls"]["login"]) . "?redirect=" . urlencode(System::getCurrentURL()));
     }
 }
 /**
  * 
  * @param be_account $account
  */
 private static function sendPWRecoveryEmail($account)
 {
     $recoveryURL = getBaseURL("pvcloud") . "#/passwordrecovery/{$account->account_id}/{$account->confirmation_guid}";
     $message = "Le comunicamos que el proceso de recuperación de contraseña fue completado con éxito.\n\n";
     $to = $account->email;
     $subject = "pvCloud - Recuperación de Contraseña Completada";
     $enter = "\r\n";
     $headers = "From: donotreply@costaricamakers.com {$enter}";
     $headers .= "MIME-Version: 1.0 {$enter}";
     $headers .= "Content-type: text/plain; charset=utf-8 {$enter}";
     $result = mail($to, $subject, $message, $headers);
 }
 /**
  * 
  * @param be_account $account
  */
 private static function sendPWRecoveryEmail($account)
 {
     $recoveryURL = getBaseURL("pvcloud") . "#/passwordrecovery/{$account->account_id}/{$account->confirmation_guid}";
     $message = "Hemos recibido una solicitud de recuperación de contraseña para su cuenta en pvCloud.\n\n";
     $message .= "Para recuperar su contraseña sírvase acceder al siguiente enlace dentro de las próximas 24 horas.\n\n";
     $message .= $recoveryURL . "\n\n";
     $message .= "Si usted no necesita recuperar su contraseña, por favor ignore este mensaje.\n\n";
     $message .= "Si usted no solicitó un cambio de contraseña, puede que alguien esté intentando violentar su cuenta;\n\n";
     $message .= "en cuyo caso por favor reporte el incidente a pvcloud_seguridad@costaricamakers.com\n\n";
     $to = $account->email;
     $subject = "pvCloud - Recuperación de Contraseña";
     $enter = "\r\n";
     $headers = "From: donotreply@costaricamakers.com {$enter}";
     $headers .= "MIME-Version: 1.0 {$enter}";
     $headers .= "Content-type: text/plain; charset=utf-8 {$enter}";
     $result = mail($to, $subject, $message, $headers);
 }
Exemplo n.º 7
0
 /**
  * Caso exista o cookie de autenticação, verifica se o token é válido
  */
 public static function checkUser()
 {
     $user = self::user();
     if ($user == null) {
         \Log::warning('Usuário do cookie inválido. Removendo cookie');
         // remove o cookie
         \Controllers\SessionsController::destroySessionCookie();
     } else {
         $data = \Controllers\SessionsController::extractCookieInfo();
         $cookieToken = isset($data['token']) ? $data['token'] : null;
         $dbToken = $user->getToken();
         if ($data == null || $cookieToken != $dbToken) {
             \Log::warning('Token do cookie inválido. Removendo cookie');
             // remove o cookie
             \Controllers\SessionsController::destroySessionCookie();
             redirect(getBaseURL());
         }
     }
 }
Exemplo n.º 8
0
 /**
  * Removes draft entries from feeds
  *
  * @author Michael Klier <*****@*****.**>
  */
 function handle_feed_item(&$event, $param)
 {
     global $conf;
     $url = parse_url($event->data['item']->link);
     $base_url = getBaseURL();
     // determine page id by rewrite mode
     switch ($conf['userewrite']) {
         case 0:
             preg_match('#id=([^&]*)#', $url['query'], $match);
             if ($base_url != '/') {
                 $id = cleanID(str_replace($base_url, '', $match[1]));
             } else {
                 $id = cleanID($match[1]);
             }
             break;
         case 1:
             if ($base_url != '/') {
                 $id = cleanID(str_replace('/', ':', str_replace($base_url, '', $url['path'])));
             } else {
                 $id = cleanID(str_replace('/', ':', $url['path']));
             }
             break;
         case 2:
             preg_match('#doku.php/([^&]*)#', $url['path'], $match);
             if ($base_url != '/') {
                 $id = cleanID(str_replace($base_url, '', $match[1]));
             } else {
                 $id = cleanID($match[1]);
             }
             break;
     }
     // don't add drafts to the feed
     if (p_get_metadata($id, 'type') == 'draft') {
         $event->preventDefault();
         return;
     }
 }
Exemplo n.º 9
0
 /**
  * Absolute URL with IPv6 domain name.
  * lighttpd, fastcgi
  *
  * data provided by Michael Hamann <*****@*****.**>
  */
 function test12()
 {
     global $conf;
     $conf['basedir'] = '';
     $conf['baseurl'] = '';
     $conf['canonical'] = 0;
     $_SERVER['DOCUMENT_ROOT'] = '/srv/http/';
     $_SERVER['HTTP_HOST'] = '[fd00::6592:39ed:a2ed:2c78]';
     $_SERVER['SCRIPT_FILENAME'] = '/srv/http/~michitux/dokuwiki/doku.php';
     $_SERVER['REQUEST_URI'] = '/~michitux/dokuwiki/doku.php?do=debug';
     $_SERVER['SCRIPT_NAME'] = '/~michitux/dokuwiki/doku.php';
     $_SERVER['PATH_INFO'] = null;
     $_SERVER['PATH_TRANSLATED'] = null;
     $_SERVER['PHP_SELF'] = '/~michitux/dokuwiki/doku.php';
     $_SERVER['SERVER_PORT'] = '80';
     $_SERVER['SERVER_NAME'] = '[fd00';
     $this->assertEquals(getBaseURL(true), 'http://[fd00::6592:39ed:a2ed:2c78]/~michitux/dokuwiki/');
 }
Exemplo n.º 10
0
 /**
  * Get the website of the restaurant
  */
 public function getMainURL()
 {
     return getBaseURL($this->getBaseMenuURL());
 }
Exemplo n.º 11
0
/**
 * Retorna a URL atual
 * @return string URL atual
 */
function getCurrentURL()
{
    return getBaseURL() . $_SERVER['REQUEST_URI'];
}
Exemplo n.º 12
0
<?php

// Raidplaner RSS Feed
// This is a demo implementation of an RSS feed, but it can be used as is, too.
//
// Usage:
// feed.php?token=<private token>&timezone=<timezone>
//
// Timezone is optional and has to be compatible to date_default_timezone_set().
require_once "lib/private/api.php";
require_once "lib/private/out.class.php";
Out::writeHeadersXML();
echo '<rss version="2.0">';
// Build RSS header
$BaseURL = getBaseURL();
$Out = new Out();
$Out->pushValue("title", "Raidplaner RSS feed");
$Out->pushValue("link", $BaseURL . "index.php");
$Out->pushValue("description", "Upcoming raids for the next 2 weeks.");
$Out->pushValue("language", "en-en");
$Out->pushValue("copyright", "packedpixel");
$Out->pushValue("pubDate", date(DATE_RSS));
// Requires private token to be visible
$Token = isset($_REQUEST["token"]) ? $_REQUEST["token"] : null;
if (Api::testPrivateToken($Token)) {
    // Setting the correct timezones
    $Timezone = isset($_REQUEST["timezone"]) ? $_REQUEST["timezone"] : date_default_timezone_get();
    // Query API
    date_default_timezone_set("UTC");
    $Parameters = array("start" => time() - 24 * 60 * 60, "end" => time() + 14 * 24 * 60 * 60, "limit" => 0, "closed" => true, "canceled" => true);
    $Locations = Api::queryLocation(null);
Exemplo n.º 13
0
    $appointmentInfo = mysqli_fetch_assoc($result);
    // delete record
    sendQuery("DELETE FROM Schedules WHERE Timestamp='{$timestamp}'");
    sendEmail('TokBox Demo', '*****@*****.**', $appointmentInfo['Name'], $appointmentInfo['Email'], "Cancelled: Your TokBox appointment on " . $appointmentInfo['Timestring'], "Your appointment on " . $appointmentInfo['Timestring'] . ". has been cancelled. We are sorry for the inconvenience, please reschedule on " . getBaseURL() . "/index.php/");
    header("Content-Type: application/json");
    echo json_encode($appointmentInfo);
});
$app->post('/schedule', function () use($app, $con, $opentok) {
    $name = $app->request->post("name");
    $email = $app->request->post("email");
    $comment = $app->request->post("comment");
    $timestamp = $app->request->post("timestamp");
    $daystring = $app->request->post("daystring");
    $session = $opentok->createSession();
    $sessionId = $session->getSessionId();
    $timestring = $app->request->post("timestring");
    $query = sprintf("INSERT INTO Schedules (Name, Email, Comment, Timestamp, Daystring, Sessionid, Timestring) VALUES ('%s', '%s', '%s', '%d', '%s', '%s', '%s')", mysqli_real_escape_string($con, $name), mysqli_real_escape_string($con, $email), mysqli_real_escape_string($con, $comment), intval($timestamp), mysqli_real_escape_string($con, $daystring), mysqli_real_escape_string($con, $sessionId), mysqli_real_escape_string($con, $timestring));
    sendQuery($query);
    sendEmail('TokBox Demo', '*****@*****.**', $name, $email, "Your TokBox appointment on " . $timestring, "You are confirmed for your appointment on " . $timestring . ". On the day of your appointment, go here: " . getBaseURL() . "/index.php/chat/" . $sessionId);
    $app->render('schedule.php');
});
$app->get('/rep', function () use($app) {
    $app->render('rep.php');
});
$app->get('/chat/:session_id', function ($session_id) use($app, $con, $apiKey, $opentok) {
    $result = sendQuery("SELECT * FROM Schedules WHERE Sessionid='{$session_id}'");
    $appointmentInfo = mysqli_fetch_assoc($result);
    $token = $opentok->generateToken($session_id);
    $app->render('chat.php', array('name' => $appointmentInfo['Name'], 'email' => $appointmentInfo['Email'], 'comment' => $appointmentInfo['Comment'], 'apiKey' => $apiKey, 'session_id' => $session_id, 'token' => $token));
});
$app->run();
 /**
  * Remove uma pergunta
  * @param  int $id ID da pergunta
  */
 public static function delete($id)
 {
     // impede acesso por não administradores
     \Auth::denyNonAdminUser();
     if (\Models\Question::delete((int) $id)) {
         redirect(getBaseURL());
     } else {
         echo "Erro ao remover pergunta";
     }
 }
Exemplo n.º 15
0
 /**
  * pattern: first <a> with class 'wa-but-txt '
  */
 protected function getPDFURL()
 {
     $doc = parent::getDOMDocument();
     $finder = new DomXPath($doc);
     $spaner = $finder->query("//*[contains(@class, 'wa-but-txt ')]");
     // get first <a>
     if ($spaner->length > 0) {
         $pdfLink = $spaner->item(0);
         return getBaseURL($this->getBaseMenuURL()) . $pdfLink->getAttribute('href');
     }
     return null;
 }
 /**
  * Processa o formulário de login
  */
 protected static function processLoginForm()
 {
     // proteção contra CSRF
     \CSRF::Check();
     $email = isset($_POST['email']) ? $_POST['email'] : null;
     $password = isset($_POST['password']) ? $_POST['password'] : null;
     $hashedPassword = \Hash::password($password);
     $errors = [];
     if (empty($email)) {
         $errors[] = 'Informe seu email';
     }
     if (empty($password)) {
         $errors[] = 'Informe sua senha';
     }
     if (count($errors) > 0) {
         return \View::make('login', compact('errors'));
     }
     $DB = new \DB();
     $sql = "SELECT id, password, status FROM users WHERE email = :email";
     $stmt = $DB->prepare($sql);
     $stmt->bindParam(':email', $email);
     $stmt->execute();
     $rows = $stmt->fetchAll(\PDO::FETCH_OBJ);
     if (count($rows) <= 0) {
         $errors[] = 'Usuário não encontrado';
     } else {
         $user = $rows[0];
         if ($hashedPassword != $user->password) {
             $errors[] = 'Senha incorreta';
         } elseif ($user->status != \Models\User::STATUS_ACTIVE) {
             $errors[] = 'Ative sua conta antes de fazer login';
         } else {
             // busca os dados do usuário para criar os dados no cookie
             $objUser = new \Models\User();
             $objUser->find($user->id);
             // gera um token de acesso
             $token = $objUser->generateToken();
             // salva o cookie com os dados do usuário
             self::saveSessionCookieForUser($objUser);
             // redireciona para a página inicial
             redirect(getBaseURL());
         }
     }
     if (count($errors) > 0) {
         return \View::make('login', compact('errors'));
     }
 }
Exemplo n.º 17
0
if (isset($urlGET) && $urlGET != "NONE" && isUrl($urlGET)) {
    $randomData = md5(uniqid(mt_rand(), false));
    $currentHash = md5($urlGET . $randomData, false);
    $currentUrl = $urlGET;
    unset($urlGET);
} else {
    if (isset($urlPOST) && $urlPOST != "NONE" && isUrl($urlPOST)) {
        $randomData = md5(uniqid(mt_rand(), false));
        $currentHash = md5($urlPOST . $randomData, false);
        $currentUrl = $urlPOST;
        unset($urlPOST);
    }
}
header('Content-type: application/json');
if ($currentHash != null && $currentUrl != null) {
    $conection = @mysql_connect("localhost", "user", "pass") or die("error connection");
    @mysql_select_db("pocs", $conection) or die("error select db");
    $sql = "INSERT INTO shortener (hash, url) VALUES ('{$currentHash}','{$currentUrl}')";
    @mysql_query($sql) or die("error query");
    @mysql_close($conection) or die("error close");
    $response["url"] = getBaseURL() . "redirect.php?url={$currentHash}";
    $response["response"] = "Shorting URL Successful";
    $response["code"] = 1;
} else {
    $response["response"] = "Invalid URL";
    $response["code"] = 0;
    $response["url"] = "";
}
echo json_encode($response);
unset($response);
exit;
 /**
  * Registra o usuário
  */
 public static function store()
 {
     \CSRF::Check();
     $nickname = isset($_POST['nickname']) ? $_POST['nickname'] : null;
     $email = isset($_POST['email']) ? $_POST['email'] : null;
     $password = isset($_POST['password']) ? $_POST['password'] : null;
     $passwordConfirmation = isset($_POST['password_confirmation']) ? $_POST['password_confirmation'] : null;
     $hashedPassword = \Hash::password($password);
     $hasErrors = false;
     $errorMessages = [];
     if ($nickname == null) {
         $errorMessages[] = "Informe seu apelido";
         $hasErrors = true;
     }
     if ($email == null) {
         $errorMessages[] = "Informe seu email";
         $hasErrors = true;
     }
     if ($password == null) {
         $errorMessages[] = "Informe uma senha";
         $hasErrors = true;
     }
     if ($passwordConfirmation == null) {
         $errorMessages[] = "Confirme sua senha";
         $hasErrors = true;
     }
     if ($password != $passwordConfirmation) {
         $errorMessages[] = "Senhas não coincidem";
         $hasErrors = true;
     }
     if ($hasErrors) {
         return \View::make('user.create', compact('errorMessages'));
     }
     $sql = "INSERT INTO users(name, nickname, email, password, status, admin, created_at, updated_at) VALUES(:name, :nickname, :email, :password, :status, :admin, :created_at, :updated_at)";
     $DB = new \DB();
     $stmt = $DB->prepare($sql);
     $date = date('Y-m-d H:i:s');
     $stmt->bindParam(':name', $name);
     $stmt->bindParam(':nickname', $nickname);
     $stmt->bindParam(':email', $email);
     $stmt->bindParam(':password', $hashedPassword);
     $stmt->bindValue(':status', \Models\User::STATUS_ACTIVE, \PDO::PARAM_INT);
     $stmt->bindValue(':admin', '0');
     $stmt->bindParam(':created_at', $date);
     $stmt->bindParam(':updated_at', $date);
     if ($stmt->execute()) {
         // em vez de apenas exibir uma mensagem de sucesso, faremos um redirecionamento.
         // isso é melhor pois evita que o usuário atualize a página e crie uma nova conta
         redirect(getBaseURL() . '/cadastro_finalizado');
     } else {
         list($error, $sgbdErrorCode, $sgbdErrorMessage) = $stmt->errorInfo();
         if ($sgbdErrorCode == 1062) {
             // erro 1062 é o código do MySQL de violação de chave única
             // veja mais em: http://dev.mysql.com/doc/refman/5.5/en/error-messages-server.html
             if (preg_match("/for key .?nickname/iu", $sgbdErrorMessage)) {
                 // nickname já em uso
                 $errorMessages[] = "Apelido já está em uso";
             } else {
                 // email já em uso
                 $errorMessages[] = "Email já está em uso";
             }
         }
         return \View::make('user.create', compact('errorMessages'));
     }
 }
Exemplo n.º 19
0
 public function onRaidCreate($aRaidId)
 {
     if ($this->authenticate()) {
         // Query the given raid, make sure we include canceled and closed
         // raids
         $Parameters = array('raid' => $aRaidId, 'canceled' => true, 'closed' => true);
         $RaidResult = Api::queryRaid($Parameters);
         if (count($RaidResult) > 0) {
             // As we specified a specific raid id, we are only
             // interested in the first (and only) raid.
             // Cache and set UTC timezone just to be sure.
             $Raid = $RaidResult[0];
             $LocationName = $this->mLocations[$Raid['LocationId']];
             $Url = getBaseURL() . 'index.php#raid,' . $aRaidId;
             $Timezone = date_default_timezone_get();
             try {
                 date_default_timezone_set('UTC');
                 $Start = new Google_Service_Calendar_EventDateTime();
                 $Start->setDateTime(date($this->mDateFormat, intval($Raid['Start'])));
                 $Start->setTimeZone('UTC');
                 $End = new Google_Service_Calendar_EventDateTime();
                 $End->setDateTime(date($this->mDateFormat, intval($Raid['End'])));
                 $End->setTimeZone('UTC');
                 $Properties = new Google_Service_Calendar_EventExtendedProperties();
                 $Properties->setShared(array('RaidId' => $aRaidId));
                 $Source = new Google_Service_Calendar_EventSource();
                 $Source->setTitle('Raidplaner link');
                 $Source->setUrl($Url);
                 $Event = new Google_Service_Calendar_Event();
                 $Event->setSummary($LocationName . ' (' . $Raid['Size'] . ')');
                 $Event->setLocation($LocationName);
                 $Event->setDescription($Raid['Description']);
                 $Event->setOriginalStartTime($Start);
                 $Event->setStart($Start);
                 $Event->setEnd($End);
                 $Event->setExtendedProperties($Properties);
                 $Event->setSource($Source);
                 $this->mCalService->events->insert(GOOGLE_CAL_ID, $Event);
             } catch (Exception $Ex) {
                 $Out = Out::getInstance();
                 $Out->pushError($Ex->getMessage());
             }
             date_default_timezone_set($Timezone);
         }
     }
 }
Exemplo n.º 20
0
         if (!mkdir($user_settings['frameworklocation'])) {
             echo "<h1>Oh. Shit. Something's wrong.</h1><p>Couldn't create a directory at" . $user_settings['frameworklocation'] . ".</p>";
             break;
         }
     } else {
         if (is_dir($user_settings['frameworklocation'] . '/framework')) {
             rrmdir($user_settings['frameworklocation'] . '/framework');
             //echo 'removed old framework directory at ' . $cash_root_location . '/framework' . '<br />';
         }
     }
 } else {
     echo "<h1>Oh. Shit. Something's wrong.</h1><p>No core location specified.</p>";
     break;
 }
 // modify settings files
 if (!findReplaceInFile('./source/interfaces/php/admin/.htaccess', 'RewriteBase /interfaces/php/admin', 'RewriteBase ' . $admin_dir) || !findReplaceInFile('./source/interfaces/php/admin/constants.php', '$cashmusic_root = $root . "/../../../framework/php/cashmusic.php', '$cashmusic_root = "' . $user_settings['frameworklocation'] . '/framework/cashmusic.php') || !findReplaceInFile('./source/interfaces/php/admin/constants.php', 'define(\'ADMIN_WWW_BASE_PATH\', \'/interfaces/php/admin', 'define(\'ADMIN_WWW_BASE_PATH\', \'' . $admin_dir) || !findReplaceInFile('./source/interfaces/php/api/controller.php', 'dirname(__FILE__).\'/../../../framework/php', '$cashmusic_root = "' . $user_settings['frameworklocation'] . '/framework') || !findReplaceInFile('./source/interfaces/php/demos/index.html', '../../../docs/assets/fonts', 'https://cashmusic.s3.amazonaws.com/permalink/fonts') || !findReplaceInFile('./source/interfaces/php/demos/index.html', '<a href="/interfaces/php/admin/">Admin</a> <a href="/interfaces/php/demos/">Demos</a> <a href="/docs/">Docs</a> <a href="http://github.com/cashmusic/DIY">Github Repo</a>', '<a href="../admin/">Admin</a> <a href="http://cashmusic.github.com/DIY/">Docs</a> <a href="http://github.com/cashmusic/DIY">Github Repo</a>') || !findReplaceInFile('./source/interfaces/php/demos/emailcontestentry/index.php', '../../../../framework/php/cashmusic.php', $user_settings['frameworklocation'] . '/framework/cashmusic.php') || !findReplaceInFile('./source/interfaces/php/demos/emailfordownload/index.php', '../../../../framework/php/cashmusic.php', $user_settings['frameworklocation'] . '/framework/cashmusic.php') || !findReplaceInFile('./source/interfaces/php/demos/filteredsocialfeeds/index.php', '../../../../framework/php/cashmusic.php', $user_settings['frameworklocation'] . '/framework/cashmusic.php') || !findReplaceInFile('./source/interfaces/php/demos/tourdates/index.php', '../../../../framework/php/cashmusic.php', $user_settings['frameworklocation'] . '/framework/cashmusic.php') || !findReplaceInFile('./source/interfaces/php/demos/emailcontestentry/index.php', '../../../../framework/php/settings/debug/cashmusic_debug.php', $user_settings['frameworklocation'] . '/framework/settings/debug/cashmusic_debug.php') || !findReplaceInFile('./source/interfaces/php/demos/emailfordownload/index.php', '../../../../framework/php/settings/debug/cashmusic_debug.php', $user_settings['frameworklocation'] . '/framework/settings/debug/cashmusic_debug.php') || !findReplaceInFile('./source/interfaces/php/demos/filteredsocialfeeds/index.php', '../../../../framework/php/settings/debug/cashmusic_debug.php', $user_settings['frameworklocation'] . '/framework/settings/debug/cashmusic_debug.php') || !findReplaceInFile('./source/interfaces/php/demos/tourdates/index.php', '../../../../framework/php/settings/debug/cashmusic_debug.php', $user_settings['frameworklocation'] . '/framework/settings/debug/cashmusic_debug.php') || !findReplaceInFile('./source/framework/php/settings/cashmusic_template.ini.php', 'driver = "mysql', 'driver = "sqlite') || !findReplaceInFile('./source/framework/php/settings/cashmusic_template.ini.php', 'database = "seed', 'database = "cashmusic.sqlite') || !findReplaceInFile('./source/framework/php/settings/cashmusic_template.ini.php', 'apilocation = "http://*****:*****@cashmusic.org', 'systememail = "system@' . $_SERVER['SERVER_NAME'])) {
     echo "<h1>Oh. Shit. Something's wrong.</h1><p>We had trouble editing a few files. Please try again.</p>";
     break;
 }
 // move source files into place
 if (!rename('./source/framework/php/settings/cashmusic_template.ini.php', './source/framework/php/settings/cashmusic.ini.php') || !rename('./source/framework/php', $user_settings['frameworklocation'] . '/framework') || !rename('./source/interfaces/php/admin', './admin') || !rename('./source/interfaces/php/api', './api') || !rename('./source/interfaces/php/demos', './demos') || !rename('./source/interfaces/php/public', './public')) {
     echo '<h1>Oh. Shit. Something\'s wrong.</h1> <p>We couldn\'t move files into place. Please make sure you have write access in ' . 'the directory you specified for the core.</p>';
     break;
 }
 // set up database, add user / password
 $user_password = substr(md5($user_settings['systemsalt'] . 'password'), 4, 7);
 // if the directory was never created then create it now
 if (!file_exists($user_settings['frameworklocation'] . '/db')) {
     mkdir($user_settings['frameworklocation'] . '/db');
 }
 // connect to the new db...will create if not found
Exemplo n.º 21
0
         if (!mkdir($user_settings['frameworklocation'], 0755, true)) {
             echo "<h1>Oh. Shit. Something's wrong.</h1><p>Couldn't create a directory at" . $user_settings['frameworklocation'] . ".</p>";
             break;
         }
     } else {
         if (is_dir($user_settings['frameworklocation'] . '/framework')) {
             rrmdir($user_settings['frameworklocation'] . '/framework');
             //echo 'removed old framework directory at ' . $cash_root_location . '/framework' . '<br />';
         }
     }
 } else {
     echo "<h1>Oh. Shit. Something's wrong.</h1><p>No core location specified.</p>";
     break;
 }
 // modify settings files
 if (!findReplaceInFile('./source/interfaces/php/admin/.htaccess', 'RewriteBase /interfaces/php/admin', 'RewriteBase ' . $admin_dir) || !findReplaceInFile('./source/interfaces/php/admin/constants.php', '$cashmusic_root = $root . "/../../../framework/php/cashmusic.php', '$cashmusic_root = "' . $user_settings['frameworklocation'] . '/framework/cashmusic.php') || !findReplaceInFile('./source/interfaces/php/admin/constants.php', 'define(\'ADMIN_WWW_BASE_PATH\', \'/interfaces/php/admin', 'define(\'ADMIN_WWW_BASE_PATH\', \'' . $admin_dir) || !findReplaceInFile('./source/interfaces/php/api/controller.php', 'dirname(__FILE__).\'/../../../framework/php', '$cashmusic_root = "' . $user_settings['frameworklocation'] . '/framework') || !findReplaceInFile('./source/framework/php/settings/cashmusic_template.ini.php', 'driver = "mysql', 'driver = "sqlite') || !findReplaceInFile('./source/framework/php/settings/cashmusic_template.ini.php', 'database = "cashmusic', 'database = "cashmusic.sqlite') || !findReplaceInFile('./source/framework/php/settings/cashmusic_template.ini.php', 'apilocation = "http://*****:*****@cashmusic.org', 'systememail = "system@' . $_SERVER['SERVER_NAME'])) {
     echo "<h1>Oh. Shit. Something's wrong.</h1><p>We had trouble editing a few files. Please try again.</p>";
     break;
 }
 // move source files into place
 if (!rename('./source/framework/php/settings/cashmusic_template.ini.php', './source/framework/php/settings/cashmusic.ini.php') || !rename('./source/framework/php', $user_settings['frameworklocation'] . '/framework') || !rename('./source/interfaces/php/admin', './admin') || !rename('./source/interfaces/php/api', './api') || !rename('./source/interfaces/php/public', './public')) {
     echo '<h1>Oh. Shit. Something\'s wrong.</h1> <p>We couldn\'t move files into place. Please make sure you have write access in ' . 'the directory you specified for the core.</p>';
     break;
 }
 // if the directory was never created then create it now
 if (!file_exists($user_settings['frameworklocation'] . '/db')) {
     mkdir($user_settings['frameworklocation'] . '/db', 0755, true);
 } else {
     // blow away the old sqlite file.
     if (file_exists($user_settings['frameworklocation'] . '/db/cashmusic.sqlite')) {
         unlink($user_settings['frameworklocation'] . '/db/cashmusic.sqlite');
Exemplo n.º 22
0
} else {
    echo '<td style="color: #ccc; text-align: right; padding-right: 4px">Next »</td>';
}
echo '</tr></table>';
echo '<div id="tabdiv"><ul class="tabset_tabs">
   <li><a href="#graph">Graph</a></li>
   <li><a href="#table">Summary table</a></li>
   <li><a href="#debug">Time serie</a></li>
</ul>';
echo '

<div id="graph" class="tabset_content">';
echo '<img src="' . htmlspecialchars($this->data['imgurl']) . '" />';
echo '<form style="display: inline">';
echo '<p style="text-align: right">Compare with total from this dataset ';
echo getBaseURL($this, 'post', 'rule2');
echo '<select onChange="submit();" name="rule2">';
echo '	<option value="_">None</option>';
foreach ($this->data['available.rules'] as $key => $rule) {
    if ($key === $this->data['selected.rule2']) {
        echo '<option selected="selected" value="' . $key . '">' . $rule['name'] . '</option>';
    } else {
        echo '<option value="' . $key . '">' . $rule['name'] . '</option>';
    }
}
echo '</select></form>';
echo '</div>';
# end graph content.
/**
 * Handle table view - - - - - - 
 */
Exemplo n.º 23
0
 private static function parseTemplate($aTemplate, $aRaidData, $aLocationData, $aTimezone)
 {
     $Offset = 0;
     $Text = '';
     $TagStart = strpos($aTemplate, '{', $Offset);
     while ($TagStart !== false) {
         $TagEnd = strpos($aTemplate, '}', $TagStart);
         $TagData = explode(':', substr($aTemplate, $TagStart + 1, $TagEnd - $TagStart - 1));
         $Parsed = '';
         switch (strtolower($TagData[0])) {
             case 'url':
                 $Parsed = getBaseURL();
                 break;
             case 'location':
                 $Parsed = isset($aLocationData[$TagData[1]]) ? $aLocationData[$TagData[1]] : 'UNKNOWN LOCATION FIELD';
                 break;
             case 'l':
                 $Parsed = L($TagData[1]);
                 break;
             case 'raid':
                 switch (strtolower($TagData[1])) {
                     case 'end':
                     case 'start':
                         date_default_timezone_set('UTC');
                         $Timestamp = strtotime($aRaidData[$TagData[1]]);
                         date_default_timezone_set($aTimezone);
                         $Parsed = strftime($TagData[2], $Timestamp);
                         break;
                     default:
                         $Parsed = isset($aRaidData[$TagData[1]]) ? $aRaidData[$TagData[1]] : 'UNKNOWN RAID FIELD';
                         break;
                 }
                 break;
         }
         $Text .= substr($aTemplate, $Offset, $TagStart - $Offset) . $Parsed;
         $Offset = $TagEnd + 1;
         $TagStart = strpos($aTemplate, '{', $Offset);
     }
     $Text .= substr($aTemplate, $Offset);
     return $Text;
 }
        ?>
            </li>
        <?php 
    }
    ?>
        </ul>
    </div>
</div>
<?php 
}
?>



<form action="<?php 
getBaseURL();
?>
/enviar-pergunta" method="post" class="form-horizontal">
    
    <div class="form-group">
        <div class="col-md-3">
            <label for="title">Título da Pergunta</label>
        </div>
        <div class="col-md-9">
            <input type="text" name="title" id="title" class="form-control">
        </div>
    </div>

    <div class="form-group">
        <div class="col-md-3">
            <label for="description">Pergunta completa</label>
Exemplo n.º 25
0
/**
 * Ultimate PHPerguntas
 * 
 * Este script faz parte do Projeto Prático do curso Ultimate PHP.
 * O Ultimate PHP é um curso voltado para iniciantes e intermediários em PHP.
 * Conheça o curso Ultimate PHP acessando http://www.ultimatephp.com.br
 *
 * O projeto completo está disponível no Github: https://github.com/beraldo/UltimatePHPerguntas
 *
 * @author: Roberto Beraldo Chaiben
 * @package Ultimate PHPerguntas
 * @link http://www.ultimatephp.com.br
 */
?>

<div class="row">
    <div class="text-center">
        <h1>Conta criada com sucesso!</h1>
    </div>
</div>

<div class="row">
    <p>Parabéns! Sua conta foi criada. Você já pode começar a perguntas e responder no Ultimate PHPerguntas.</p>

    <p><a href="<?php 
echo getBaseURL();
?>
/login">Clique aqui</a> para acessar sua conta e comece a perguntar e responder</p>
</div>

Exemplo n.º 26
0
<?php

require "login/login.php";
include 'monitor.inc';
$jobIds = $_REQUEST['job_id'];
$tests = "";
foreach ($jobIds as $job_id) {
    if (!empty($tests)) {
        $tests .= ",";
    }
    $q = Doctrine_Query::create()->select('r.WPTResultId')->from('WPTResult r')->where('r.WPTJobId = ?', $job_id)->whereIn('r.Status', array('200', '99999'))->orderBy('r.Date DESC')->setHydrationMode(Doctrine_Core::HYDRATE_ARRAY)->limit(1);
    $job = $q->fetchOne();
    $tests .= $job['WPTResultId'] . "-r:1-c:0";
}
$location = getBaseURL() . "/video/compare.php?tests=" . $tests;
header("Location: " . $location);
Exemplo n.º 27
0
        continue;
    }
    foreach ($config_cascade['license'][$config_group] as $config_file) {
        if (@file_exists($config_file)) {
            include $config_file;
        }
    }
}
// set timezone (as in pre 5.3.0 days)
date_default_timezone_set(@date_default_timezone_get());
// define baseURL
if (!defined('DOKU_REL')) {
    define('DOKU_REL', getBaseURL(false));
}
if (!defined('DOKU_URL')) {
    define('DOKU_URL', getBaseURL(true));
}
if (!defined('DOKU_BASE')) {
    if ($conf['canonical']) {
        define('DOKU_BASE', DOKU_URL);
    } else {
        define('DOKU_BASE', DOKU_REL);
    }
}
// define whitespace
if (!defined('DOKU_LF')) {
    define('DOKU_LF', "\n");
}
if (!defined('DOKU_TAB')) {
    define('DOKU_TAB', "\t");
}
Exemplo n.º 28
0
 /**
  *
  */
 public function oauthInfo($opt = array())
 {
     global $lang;
     print '<h1>OAuth - Info</h1>' . NL;
     print '<div class="level1"><p>' . NL;
     print '<a href="http://oauth.net" class="urlextern" alt="http://oauth.net">oauth.net</a>';
     print ' - secure API authorization from desktop and web applications.' . NL;
     print '<br/>';
     print '<a href="http://mir.dnsalias.com/wiki/dokuoauth" class="urlextern" >dokuoauth</a>';
     print ' - dokuwiki oauth plugin website.' . NL;
     print '</p></div>' . NL;
     print '<h2>Actions</h2>' . NL;
     print '<div class="level2"><ul>' . NL;
     print '<li><a href="' . DOKU_BASE . '?do[oauth]=clist">Keys for this site (list Consumer-Keys)</a></li>' . NL;
     print '<li><a href="' . DOKU_BASE . '?do[oauth]=addconsumer">Request/create Consumer-Key and Secret</a></li>' . NL;
     print '<li><a href="' . DOKU_BASE . '?do[oauth]=tlist">Applications using your account (list request/access tokens)</a></li>' . NL;
     print '</ul></div>' . NL;
     print '<h2>Endpoint URLs for this site.</h2>' . NL;
     print '<div class="level2">' . NL;
     print '<dt>Request Token URL:</dt>' . NL;
     # TODO make oauth-base-url configurable !
     print '<dd style="margin-left:2em;"><tt>' . getBaseURL(true) . '?do[oauth]=requesttoken</tt></dd>' . NL;
     print '<dt>User Authorization URL:</dt>' . NL;
     print '<dd style="margin-left:2em;"><tt>' . getBaseURL(true) . '?do[oauth]=authorize</tt></dd>' . NL;
     print '<dt>Access Token URL:</dt>' . NL;
     print '<dd style="margin-left:2em;"><tt>' . getBaseURL(true) . '?do[oauth]=accesstoken</tt></dd>' . NL;
     print '</dl></div>' . NL;
 }
Exemplo n.º 29
0
    //date("y/m/d", strtotime($_REQUEST['startDate']));
} else {
    $reportDateStart = date('Y/m/d');
}
if ($_REQUEST['endDate']) {
    $reportDateEnd = $_REQUEST['endDate'];
    //date("y/m/d", strtotime($_REQUEST['endDate']));
} else {
    $reportDateEnd = $reportDateStart;
}
$results = array();
$infos = getResultIDs($reportDateStart, $reportDateEnd);
foreach ($infos as $info) {
    $id = $info["id"];
    $date = substr($info["date"], 2);
    $resultXml = file_get_contents(getBaseURL() . "/xmlResult/{$id}/");
    if (!$resultXml) {
        continue;
    }
    $ix = strrpos($id, "_") + 1;
    $shortId = substr($id, $ix);
    // If no label file then skip it
    if (!file_exists("/var/www/html/results/" . $date . "/{$shortId}/label.txt")) {
        continue;
    }
    $resultLabel = file_get_contents("/var/www/html/results/" . $date . "/{$shortId}/label.txt");
    $xml = new SimpleXMLElement($resultXml);
    $firstView = $xml->data->average->firstView;
    $url = $xml->data->run->firstView->results->URL;
    print "labe: " . $item['label'] . "<br>";
    print "bytes in: " . $firstView->bytesIn . "<br>";
Exemplo n.º 30
0
function getWhiteHorse()
{
    global $weekEndText, $websiteNotAvailable, $menuFormat, $WhiteHorseBaseMenuURL;
    if (isWeekend()) {
        return $weekEndText;
    }
    $fallback = sprintf($menuFormat, $WhiteHorseBaseMenuURL);
    $html = getHTMLFromURL($WhiteHorseBaseMenuURL . 'crbst_4.html');
    if (empty($html)) {
        return $fallback;
    }
    $doc = new DOMDocument();
    $doc->loadHTML($html);
    $finder = new DomXPath($doc);
    $spaner = $finder->query("//*[contains(@class, 'wa-but-txt ')]");
    // get first <a>
    if ($spaner->length > 0) {
        $pdfLink = $spaner->item(0);
        return sprintf($menuFormat, getBaseURL($WhiteHorseBaseMenuURL) . $pdfLink->getAttribute('href'));
    }
    return $fallback;
}