Exemple #1
0
 /**
  * function searchList search for  guide category and returns the matching category
  * @param  $q |string 
  * @return array of category
  **/
 function searchList($q)
 {
     $q = _clean($q);
     $arrWhr = array("title LIKE '%{$q}%'", "guide_group LIKE '%{$q}%'", "FIND_IN_SET('{$q}',tags)", "guide_txt LIKE '%{$q}%'", "author='{$q}'", "type='{$q}'", "id='{$q}'");
     $cols = "*," . getConfig("CATEGORY_GUIDES") . " as category," . getConfig("SUBCATEGORY_GUIDES") . " as subcategory";
     $whr = "blocked='false'";
     $whr .= getAPIListWhere("api");
     $sql = _db()->_selectQ('guides_tbl', $cols, $whr) . " AND (" . implode(" OR ", $arrWhr) . ")";
     $res = _dbQuery($sql);
     $data = _dbData($res);
     return $data;
 }
Exemple #2
0
 /**
  * function searchList search for  api category and returns the matching category
  * @param $q |string
  * @return $data |array
  **/
 function searchList($q)
 {
     $q = _clean($q);
     $arrWhr = array("title LIKE '%{$q}%'", "src_path LIKE '%{$q}%'", "descs_short LIKE '{$q}'", "FIND_IN_SET('{$q}',tags)", "package_id='{$q}'");
     $cols = " *," . getConfig("SUBCATEGORY_API") . " as subcategory," . getConfig("CATEGORY_API") . " as category";
     $whr = "blocked='false'";
     $whr .= getAPIListWhere("api");
     $sql = _db()->_selectQ('api_toc', $cols, $whr) . " AND (" . implode(" OR ", $arrWhr) . ")";
     $res = _dbQuery($sql);
     $data = _dbData($res);
     return $data;
 }
Exemple #3
0
function getCast($tt, &$title = '')
{
    $html = getHTML($tt);
    if (preg_match('#<h3 itemprop="name">[\\s\\S]+?</h3>#i', $html, $match)) {
        $title = _clean($match[0]);
        // var_dump($title);
    }
    if (preg_match('#<table class="cast_list">([\\s\\S]+?)</table>#i', $html, $match)) {
        $table = $match[1];
        // preg_match_all('#itemprop="actor"[^<]+([\s\S]+?)</td>#', $table, $matches);
        // $actors = array_map(
        preg_match_all('#itemprop="actor"[\\s\\S]+?href="/name/(nm\\d+)[^>]+>([\\s\\S]+?)</a>#i', $table, $matches);
        $ids = array_map('_clean', $matches[1]);
        $actors = array_map('_clean', $matches[2]);
        // print_r($ids);
        $actors = array_combine($ids, $actors);
        // print_r($actors);
        preg_match_all('#<td class="character">([\\s\\S]+?)(?:\\(|/ \\.|</td)#i', $table, $matches);
        $characters = array_map('_clean', $matches[1]);
        $characters = array_combine($ids, $characters);
        // print_r($characters);
        return (object) compact('actors', 'characters');
    }
}
function clean_diff($old, $new)
{
    $old = _clean($old);
    $new = _clean($new);
    $r = array_diff($old, $new);
    $a = array_diff($new, $old);
    if (!count($r) && !count($a)) {
        return '';
    }
    $r = join("\n", $r);
    $r = $r ? '<td class="r"><ul>' . $r . '</ul></td>' : '<td>&nbsp;</td>';
    $a = join("\n", $a);
    $a = $a ? '<td class="a"><ul>' . $a . '</ul></td>' : '<td>&nbsp;</td>';
    $diff = '<tr>' . $r . $a . '</tr>';
    $diff = preg_replace('#<item.*?>(.*?)</item>#', '<li>$1</li>', $diff);
    return $diff;
}
Exemple #5
0
function _getTitleFromPath($path)
{
    $path = _clean($path);
    $title = explode('/', $path);
    $title = $title[0];
    return $title;
}
Exemple #6
0
 *********************************************/
error_reporting(0);
session_start();
if (phpversion() >= '4.1.0') {
    //PHP4.1.0以降対応
    $_GET = array_map('_clean', $_GET);
    $_POST = array_map('_clean', $_POST);
    //$_POST = array_map('_clean', $_GET);
    extract($_GET);
    extract($_POST);
    extract($_COOKIE);
    extract($_SERVER);
    $upfile_type = _clean($_FILES['upfile']['type']);
    $upfile_size = $_FILES['upfile']['size'];
    //某所で気づく・・・
    $upfile_name = _clean($_FILES['upfile']['name']);
    $upfile = $_FILES['upfile']['tmp_name'];
}
include_once './settings.php';
if ($act == 'envset') {
    $cookval = @implode(',', array($acte, $user, $come, $sizee, $mimee, $datee, $orige));
    setcookie('upcook', $cookval, time() + 365 * 24 * 3600);
    $act = '';
} elseif ($act == 'logout') {
    unset($_SESSION['upuser']);
    $act = '';
}
function _clean($str)
{
    if (is_array($str)) {
        return $str;