Exemplo n.º 1
0
Arquivo: Model.php Projeto: cokita/srp
 /**
  * Método que simula os __get
  *
  * @param object $attr
  * @return atributo
  */
 public function get($attr)
 {
     if ($attr) {
         if (getEncoding($this->{$attr}) == "UTF-8") {
             $resultado = $this->{$attr};
         } else {
             $resultado = mb_convert_encoding($this->{$attr}, "UTF-8");
         }
     }
     return $resultado;
 }
Exemplo n.º 2
0
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
require_once 'geograph/global.inc.php';
header("Content-Type: text/plain");
$q = isset($_GET['query']) ? $_GET['query'] : '';
$q = preg_replace('/ OR /', ' | ', $q);
$q = preg_replace('/[^\\w~\\|-]+/', ' ', trim(strtolower($q)));
if (empty($q)) {
    die('no query');
}
preg_match('/.*?(\\w)/', $q, $m);
$q1 = $m[1];
$q2 = str_replace('~', '_', $q);
$q2 = str_replace('|', '.', $q2);
$cachepath = $CONF['sphinx_cache'] . "place/{$q1}/{$q2}.txt";
$encoding = getEncoding();
if ($encoding) {
    $cachepath .= ".{$encoding}";
    header('Content-Encoding: ' . $encoding);
}
header('Vary: Accept-Encoding');
if (file_exists($cachepath) && empty($_GET['refresh'])) {
    $mtime = @filemtime($cachepath);
    customExpiresHeader(3600 * 24 * 24, true);
    customCacheControl($mtime, $cachepath);
    header('Content-length: ' . filesize($cachepath));
    readfile($cachepath);
    exit;
}
if (!@is_dir($CONF['sphinx_cache'] . "place/{$q1}")) {
    mkdir($CONF['sphinx_cache'] . "place/{$q1}");
Exemplo n.º 3
0
function customGZipHandlerStart()
{
    global $encoding;
    if ($encoding = getEncoding()) {
        ob_start();
        register_shutdown_function('customGZipHandlerEnd');
    }
}
Exemplo n.º 4
0
    $get = [];
    if ($_GET) {
        $get = $_GET;
    }
    $path = explode("/", trim(strtok($url, '?'), "/"));
    if (!empty($path)) {
        for ($i = 0, $lim = sizeof($path); $i < $lim; $i += 2) {
            $get[$path[$i]] = isset($path[$i + 1]) ? $path[$i + 1] : "";
        }
        foreach (["", "index", "test"] as $key) {
            unset($get[$key]);
        }
    }
    return $get;
}
list($GLOBALS['url'], $GLOBALS['filetype']) = getEncoding();
$GLOBALS['get'] = splitURL($GLOBALS['url']);
function checkURL()
{
    foreach ($GLOBALS['typedata'] as $plural => $data) {
        if (($term = getQuery([$plural, $data[0]])) !== null) {
            $plural($plural, $term);
        }
    }
}
if (!empty($GLOBALS['get'])) {
    if (($term = getQuery(['search'])) !== null) {
        if (!$term) {
            if ($GLOBALS['filetype'] == 'html') {
                printheader('ASA Search');
                print '<form class="pull-right"><input type="text" name="search"><input type="submit" value="Search"></form>';