예제 #1
0
 function __construct($controller, $model, $module, $uploadpath = "uploads")
 {
     if (!Authentication::is_logged_in()) {
         $r = get_base();
         $_SESSION['bt'] = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER["REQUEST_URI"];
         echo $_SESSION['bt'];
         header("location:{$r}/auth/login/");
     }
     $this->controller = $controller;
     $this->module = $module;
     $this->uploadpath = $uploadpath;
     $this->load = new Load($controller, $module);
     $this->model = isset($model) ? new Model($model) : null;
 }
예제 #2
0
/**
 * A reusable helper that generates the path with the correct parent location
 *
 * @param  string [$path       = ''] Path value to get complete url for
 * @return string Completed url
 */
function path($path = '')
{
    $path = ltrim($path, '/');
    return get_base() . '/' . $path;
}
예제 #3
0
error_reporting(0);
header("Content-Type: text/html;charset=utf-8");
if (!isset($_GET['word'])) {
    header('Location: /');
} elseif ($_GET['word'] == '') {
    header('Location: /');
} else {
    $word = $_GET['word'];
}
if (isset($_GET['page'])) {
    $page = $_GET['page'];
} else {
    $page = 1;
}
include './includes/phpQuery.php';
phpQuery::newDocumentFile(get_base() . 'fetch.php?word=' . urlencode($word) . '&page=' . $page);
$list = pq('.g');
foreach ($list as $li) {
    $data['name'][] = pq($li)->find('.r')->find('a')->html();
    $data['_url'][] = pq($li)->find('.r')->find('a')->attr('href');
    $data['desc'][] = pq($li)->find('.s')->find('.st')->html();
}
$data['num'][0] = pq('#resultStats')->html();
$data['num'][1] = get_number($data['num'][0]);
foreach ($data['_url'] as $key => $value) {
    $data['url'][] = get_true_url($data['_url'][$key]);
}
foreach ($data['url'] as $key => $value) {
    if (substr($value, 0, 1) == '/') {
        unset($data['url'][$key], $data['name'][$key], $data['desc'][$key]);
    }
예제 #4
0
 public function delete($ids)
 {
     $redirect = null;
     if (!is_numeric($ids)) {
         $redirect = ($this->module ? $this->module . "-" : null) . substr($ids, strpos($ids, '_') + 1, strpos($ids, ',') - 3);
         $ids = $this->model->Read_Where(preg_replace('/\\,/', '=', $ids), "id");
         if (empty($ids)) {
             header("location:" . $redirect);
             exit;
         }
     } else {
         $ids = array("id" => $ids);
     }
     if (!is_multidimensional($ids)) {
         $ids = array($ids);
     }
     foreach ($ids as $id) {
         if (get_class($this) == "pessoas") {
             $user_id = Authentication::user_info();
             if ($id['id'] == $user_id['_pessoas__id']) {
                 $_SESSION['flash'] = "1#Ops! Parece que você está tentando deletar seus próprios dados!<br><small>Essa é uma operação impossível. Caso queira continuar, chame o administrador do Sistema.</small>";
                 $redirect = $redirect == null ? ($this->module ? $this->module . "/" : null) . get_class($this) : $redirect;
                 header("location:" . $redirect);
                 exit;
             }
         }
         $v = $this->model->Read($id['id']);
         $ks = array_keys($v);
         foreach ($ks as $k) {
             if ($k == "path") {
                 if (dir_exists("assets/" . $this->uploadpath . "/" . $this->controller . "/" . $v['path'])) {
                     $this->erase_dir("assets/" . $this->uploadpath . "/" . $this->controller . "/" . $v['path']);
                 }
             } elseif (preg_match('/\\_upload/', $k)) {
                 if (file_exists($v[$k])) {
                     unlink($v[$k]);
                 }
             }
         }
     }
     $this->model->Delete($id['id']);
     $_SESSION['flash'] = "3#Dados deletados com sucesso!";
     $redirect = $redirect == null ? ($this->module ? $this->module . "/" : null) . get_class($this) : $redirect;
     header("location:" . get_base() . "/{$redirect}");
 }
예제 #5
0
function build_result($array, $pager)
{
    //define some vars
    $result = $array['search']['results']['subtitle'];
    $base = get_base($array['search']['base']);
    $time = get_results($array['search']['results']);
    //print the content
    if (count($result) == 0) {
        print "<div align=\"center\"><h2>No result found</h2></div>";
    } else {
        ?>
			<table width="55%" style="border-collapse:collapse;" border="1" cellspacing="0" cellpadding="5">
			  <tr>
				<td colspan="9" align="right">Search took&nbsp;<font class="releasename">
				  <?php 
        echo $time["searchtime"];
        ?>
				  s</font>, Items found <font class="releasename">
				  <?php 
        echo $time["itemsfound"];
        ?>
				  </font></td>
			  </tr>
			  <tr>
				<td align="left" colspan="4" width="100%">Movie name</td>
				<td nowrap="nowrap" align="center">Added</td>
				<td nowrap="nowrap" align="center"><img src="imgs/icon-files.gif" width="12" height="12" alt=" " title="CDs" /></td>
				<td nowrap="nowrap" align="center"><img src="imgs/icon-format.gif" width="12" height="13" alt=" " title="Format" /></td>
				<td nowrap="nowrap" align="center"><img src="imgs/icon-upper.gif" width="15" height="17" alt=" " title="Uploader" /></td>
			  </tr>
			  <?php 
        $count = $time["itemsfound"] == 1 ? 1 : count($result);
        for ($i = 0; $i < $count; $i++) {
            $movie = $count == 1 ? get_details($result) : get_details($result[$i]);
            ?>
			  <tr>
				<td align="center" nowrap="nowrap"><img src="flag/<?php 
            echo $movie["iso639"];
            ?>
.gif" width="18" height="12" border="0" alt="<?php 
            echo $movie["language"];
            ?>
" title="<?php 
            echo $movie["language"];
            ?>
" /></td>
				<td align="left" colspan="2" width="100%"><a href="<?php 
            echo $base . $movie["detail"];
            ?>
" target="_blank">
				  <?php 
            echo $movie["movie"];
            ?>
				  </a>
				  <?php 
            echo $movie["releasename"] ? "<br/><font class=\"releasename\">" . $movie["releasename"] . "</font>" : "";
            ?>
				  </td>
				<td nowrap="nowrap" align="center"><a href="<?php 
            echo $base . $movie["download"];
            ?>
" target="blank"><img src="imgs/icon-download.gif" width="12" height="12" border="0" alt=" " title="download" /></a></td>
				<td nowrap="nowrap" align="center"><?php 
            echo str_replace(" ", "<br/>", $movie["subadddate"]);
            ?>
</td>
				<td nowrap="nowrap" align="center"><?php 
            echo $movie["files"];
            ?>
</td>
				<td nowrap="nowrap" align="center"><?php 
            echo $movie["format"];
            ?>
</td>
				<td nowrap="nowrap" align="center"><?php 
            echo $movie["user"] == "" ? "Unknown" : $movie["user"];
            ?>
</td>
			  </tr>
			  <?php 
        }
        ?>
			</table>
				<?php 
        echo $time["itemsfound"] > 40 ? "<br/><div align=\"center\">" . pager($time["itemsfound"], $pager) . "</div>" : "";
        ?>
			<?php 
    }
}
예제 #6
0
require dirname(__FILE__) . '/functions.php';
require dirname(__FILE__) . '/includes/simple_html_dom.php';
require dirname(__FILE__) . '/includes/page.php';
header("Content-Type: text/html;charset=utf-8");
if (!isset($_GET['word'])) {
    header('Location: ' . get_base());
} elseif ($_GET['word'] == '') {
    header('Location: ' . get_base());
} else {
    $word = $_GET['word'];
}
if (isset($_GET['page'])) {
    $page = $_GET['page'];
} else {
    $page = 1;
}
$html = file_get_html(get_base() . 'fetch.php?word=' . urlencode($word) . '&page=' . $page);
foreach ($html->find('.g') as $i => $li) {
    $data[] = array('title' => $li->find('.r', '0')->find('a', '0')->plaintext, 'original_url' => $li->find('.r', '0')->find('a', '0')->href, 'content' => $li->find('.s', '0')->find('.st', '0')->plaintext);
    $data[$i]['url'] = get_true_url($data[$i]['original_url']);
}
$count['word'] = $html->find('#resultStats', '0')->plaintext;
$count['number'] = get_number($count['word']);
foreach ($data as $key => $value) {
    if (substr($value['url'], 0, 1) == '/') {
        unset($data[$key]);
    }
}
$pager = new Page(10, $count['number'], $page, 10);
$pager_html = $pager->show();
include './templates/results.html';
예제 #7
0
파일: trace.php 프로젝트: Boris-de/videodb
function request($urlonly = false)
{
    global $urlid, $url;
    // get or post?
    $pass = $_POST ? $_POST : $_GET;
    // don't use $_REQUEST or cookies will screw up the query
    foreach ($pass as $key => $value) {
        switch ($key) {
            case $urlid:
                $url = html_entity_decode(urldecode($value));
                break;
            case session_name():
            case 'videodbreload':
            case 'iframe':
                break;
            default:
                if ($request) {
                    $request .= "&";
                }
                $request .= "{$key}={$value}";
        }
    }
    // going directly to trace.php without options?
    if (!$url) {
        $url = 'http://www.imdb.com';
    }
    // remove session identifier before request is sent or caching will not work
    $url = preg_replace("/&" . SID . "\$/", "", $url);
    // workaround for fishy IMDB URLs
    $url = preg_replace("/\\&amp;/", "&", $url);
    // don't fetch, just find target
    if ($urlonly) {
        return $url;
    }
    // append request parameters
    if ($_POST) {
        $post = $request;
    } elseif ($request) {
        $url .= "?" . $request;
    }
    // encode possible spaces, use %20 instead of +
    $url = preg_replace('/ /', '%20', $url);
    $response = httpClient($url, $_GET['videodbreload'] != 'Y', array('post' => $post));
    // url after redirect
    get_base($response['url']);
    if ($response['success'] != true) {
        $page = 'Error: ' . $response['error'];
        if ($response['header']) {
            $page .= '<br/>Header:<br/>' . nl2br($response['header']);
        }
    } else {
        if (!$cache) {
            putHTTPcache($url . $post, $response);
        }
        $page = $response['data'];
    }
    return $page;
}
예제 #8
0
 public static function out()
 {
     session_destroy();
     header("location:" . get_base() . "/adm");
 }
예제 #9
0
파일: main.php 프로젝트: projectesIF/Ateneu
/*
 // Inici per a depuració: recuperació de missatges d'error
 ini_set('display_errors', 1);
 ini_set('log_errors', 1);
 ini_set('error_log', dirname(__FILE__) . '/error_log.txt');
 //error_reporting(E_ALL);
 error_reporting(E_ALL & ~E_NOTICE);
*/
// must be run from within DokuWiki
if (!defined('DOKU_INC')) {
    die;
}
// Afegit per recuperar cami base ( jordi )
// Definim  la base inicial de manera dinàmica
// Això deixa sense utilitat  el 'prepara.php' anterior
$base_inici = get_base($_SERVER["REQUEST_URI"]);
//echo "Base inici: ".$base_inici."<br>";
//echo "DOKU_BASE: ".DOKU_BASE."<br>";
//echo "DOKU_REL: ".DOKU_REL."<br>";
//echo "DOKU_INC: ".DOKU_INC."<br>";
// Llegim títol del curs
// $base = str_replace(':', '/', $conf['template.base']);
$base = str_replace(':', '/', $base_inici);
// Modificat Jordi : canviem adreça absoluta per l'emmagatzemada a la configuració 13/05/2010
$file = $conf['savedir'] . "/pages/" . trim($base) . "/index.txt";
//$file = "/dades/wikiform/data/pages/".trim($base)."/index.txt";
$titolcurs = llegeixtitols($file);
// afegit jordi 13/06/2012
//$conf['titolpag'] = $titolcurs;
// fi afegit
$fileini = $conf['savedir'] . "/pages/" . trim($base) . "/ini.txt";