当前位置: 首页>>代码示例>>PHP>>正文


PHP Helper::searchfield方法代码示例

本文整理汇总了PHP中Helper::searchfield方法的典型用法代码示例。如果您正苦于以下问题:PHP Helper::searchfield方法的具体用法?PHP Helper::searchfield怎么用?PHP Helper::searchfield使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Helper的用法示例。


在下文中一共展示了Helper::searchfield方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: create

 public function create($text)
 {
     $searchText = Helper::searchfield($text);
     $sth = $this->db->prepare('INSERT INTO adminlog (added, txt, userid, search_text) VALUES (NOW(), ?, ?, ?)');
     $sth->bindParam(1, $text, PDO::PARAM_STR);
     $sth->bindValue(2, $this->user->getId(), PDO::PARAM_INT);
     $sth->bindParam(3, $searchText, PDO::PARAM_STR);
     $sth->execute();
 }
开发者ID:swetorrentking,项目名称:rartracker,代码行数:9,代码来源:AdminLogs.php

示例2: log

 public function log($type, $txt, $userid, $anonym = 0)
 {
     $searchText = Helper::searchfield($txt);
     $sth = $this->db->prepare('INSERT INTO sitelog (typ, added, txt, search_text, userid, anonymous) VALUES (?, NOW(), ?, ?, ?, ?)');
     $sth->bindParam(1, $type, PDO::PARAM_INT);
     $sth->bindParam(2, $txt, PDO::PARAM_STR);
     $sth->bindParam(3, $searchText, PDO::PARAM_STR);
     $sth->bindParam(4, $userid, PDO::PARAM_INT);
     $sth->bindParam(5, $anonym, PDO::PARAM_INT);
     $sth->execute();
 }
开发者ID:lordgabber,项目名称:rartracker,代码行数:11,代码来源:Logs.php

示例3: searchTextToWordParams

 public static function searchTextToWordParams($searchText)
 {
     $search = Helper::searchfield($searchText);
     $arr = explode(" ", $search);
     $searchWords = '';
     foreach ($arr as $word) {
         if (strlen($word) > 1) {
             $searchWords .= "+" . $word . "* ";
         } else {
             if (strlen($word) == 1) {
                 $searchWords .= "+" . $word . " ";
             }
         }
     }
     return $searchWords;
 }
开发者ID:swetorrentking,项目名称:rartracker,代码行数:16,代码来源:Helper.php

示例4: guessChannelAndProgram

 public function guessChannelAndProgram($name)
 {
     if (($pos = stripos($name, ".SWE")) > 4) {
         $name = substr($name, 0, $pos);
     }
     $name = Helper::searchfield($name);
     preg_match("/E([0-9]+)/i", $name, $match);
     $releaseEpisodeNumber = $match[1];
     $hits = array();
     $sth = $this->db->prepare("SELECT tv_program.id AS programid, priority, kanalid, episod, FROM_UNIXTIME(datum), MATCH(program_search) AGAINST(?) AS relevance FROM `tv_program` LEFT JOIN tv_kanaler ON tv_program.kanalid = tv_kanaler.id  WHERE MATCH(program_search) AGAINST(?) AND FROM_UNIXTIME(datum) > (NOW() - INTERVAL 4 DAY) ORDER BY relevance DESC, datum DESC, tv_kanaler.priority ASC LIMIT 10");
     $sth->bindParam(1, $name, PDO::PARAM_STR);
     $sth->bindParam(2, $name, PDO::PARAM_STR);
     $sth->execute();
     $relevance = -1;
     while ($r = $sth->fetch(PDO::FETCH_ASSOC)) {
         if ($relevance == -1) {
             $relevance = $r["relevance"];
         }
         if ($relevance !== $r["relevance"]) {
             break;
         }
         preg_match("/Del ([0-9]+) /i", $r["episod"], $match);
         $r["episodeNumber"] = $match[1];
         $hits[] = $r;
     }
     if (count($hits) == 0) {
         return false;
     }
     $hits = array_reverse($hits);
     $chosenEpisode = $hits[0];
     if (is_numeric($releaseEpisodeNumber)) {
         foreach ($hits as $h) {
             if ($h["episodeNumber"] == $releaseEpisodeNumber) {
                 $chosenEpisode = $h;
                 break;
             }
         }
     }
     return array($chosenEpisode["kanalid"], $chosenEpisode["programid"]);
 }
开发者ID:lordgabber,项目名称:rartracker,代码行数:40,代码来源:SweTv.php

示例5: run

 public function run($params)
 {
     if ($_SERVER['SERVER_ADDR'] != $_SERVER["REMOTE_ADDR"]) {
         throw new Exception(L::get("MUST_BE_RUN_BY_SERVER_ERROR"), 401);
     }
     /* Fetch todays guide data */
     $res = $this->db->query('SELECT * FROM tv_kanaler WHERE visible = 1');
     $days = 86400 * (int) $params["days"];
     $dagensdatum = date('Y-m-d', time() + $days);
     while ($r = $res->fetch(PDO::FETCH_ASSOC)) {
         $data = json_decode(file_get_contents('http://json.xmltv.se/' . $r["xmlid"] . '_' . $dagensdatum . '.js.gz'), true);
         if (!$data) {
             continue;
         }
         $data = $data["jsontv"];
         foreach ($data["programme"] as $dat) {
             $titel = $dat["title"]["sv"];
             if (strlen($titel) < 2) {
                 $titel = $dat["title"]["en"];
             }
             $titel = trim($titel);
             $tid = $dat["start"];
             $episod = '';
             if ($dat["episodeNum"]) {
                 $episod = $dat["episodeNum"]["onscreen"];
             }
             $desc = $dat["desc"]["sv"];
             if (strlen($desc) < 2) {
                 $desc = $dat["desc"]["en"];
             }
             $this->db->query('INSERT INTO tv_program (datum, kanalid, program, program_search, episod, info) VALUES(' . $tid . ', ' . $r["id"] . ', ' . $this->db->quote($titel) . ', ' . $this->db->quote(Helper::searchfield($titel)) . ', ' . $this->db->quote($episod) . ', ' . $this->db->quote($desc) . ')');
         }
     }
     /* Erase old tv-data to clear up space in database */
     $dag = 86400 * 7;
     // Erase 7 days old
     $time = time() - $dag;
     $this->db->query('DELETE FROM tv_program WHERE datum < ' . $time);
 }
开发者ID:swetorrentking,项目名称:rartracker,代码行数:39,代码来源:TvData.php

示例6: run

 public function run()
 {
     if ($_SERVER['SERVER_ADDR'] != $_SERVER["REMOTE_ADDR"]) {
         throw new Exception("Must be run by server.", 401);
     }
     /* Spara ner dagens tablåer */
     $res = $this->db->query('SELECT * FROM tv_kanaler WHERE visible = 1');
     $dagensdatum = date('Y-m-d', time());
     // hämta dagens tablåer
     while ($r = $res->fetch(PDO::FETCH_ASSOC)) {
         $data = json_decode(gzdecode(file_get_contents('http://xmltv.tvtab.la/json/' . $r["xmlid"] . '_' . $dagensdatum . '.js.gz')), true);
         $data = $data["jsontv"];
         foreach ($data["programme"] as $dat) {
             $titel = $dat["title"]["sv"];
             if (strlen($titel) < 2) {
                 $titel = $dat["title"]["en"];
             }
             $titel = trim($titel);
             $tid = $dat["start"];
             $episod = '';
             if ($dat["episodeNum"]) {
                 $episod = $dat["episodeNum"]["onscreen"];
             }
             $desc = $dat["desc"]["sv"];
             if (strlen($desc) < 2) {
                 $desc = $dat["desc"]["en"];
             }
             $this->db->query('INSERT INTO tv_program (datum, kanalid, program, program_search, episod, info) VALUES(' . $tid . ', ' . $r["id"] . ', ' . $this->db->quote($titel) . ', ' . $this->db->quote(Helper::searchfield($titel)) . ', ' . $this->db->quote($episod) . ', ' . $this->db->quote($desc) . ')');
         }
     }
     /* Radera gamla tv-data så det inte blir för mycket i databasen */
     $dag = 86400 * 7;
     // Radera 7 dagar gamla
     $veckagammal = time() - $dag;
     $this->db->query('DELETE FROM tv_program WHERE datum < ' . $veckagammal);
 }
开发者ID:nonconforme,项目名称:rartracker,代码行数:36,代码来源:TvData.php

示例7: upload


//.........这里部分代码省略.........
             $p2p = 1;
         }
     }
     /* Torrents sized 15GB+ should be free leech */
     if ($totallen > 16106127360) {
         $freeleech = 1;
     }
     /* Detect if torrent is a "pack" with releases inside */
     $packFolders = array();
     foreach ($filelist as $file) {
         preg_match('/^(.*?)\\//', $file[0], $match);
         if (strlen($match[1]) > 6) {
             array_push($packFolders, $match[1]);
         }
     }
     $packFolders = array_unique($packFolders);
     if (count($packFolders) > 1) {
         $pack = 1;
     } else {
         $pack = 0;
     }
     if ($imdbId) {
         $imdbInfo = $this->movieData->getData($imdbId);
         if ($imdbInfo["releaseNameStart"] == "") {
             $this->movieData->updateReleaseNameStart($name, $imdbId);
         }
     } else {
         $imdbInfo = $this->movieData->findImdbInfoByReleaseName($name);
         if ($imdbInfo) {
             $imdbId = $imdbInfo["id"];
         }
     }
     $fname = $name . ".torrent";
     $searchText = Helper::searchfield("{$name} {$imdbInfo['genres']} {$imdbInfo['imdbid']} " . implode(" ", $packFolders));
     $searchText2 = Helper::searchfield("{$imdbInfo['director']} {$imdbInfo['writer']} {$imdbInfo['cast']}");
     $sth = $this->db->prepare("INSERT INTO torrents (name, filename, search_text, search_text2, owner, visible, info_hash, size, numfiles, type, ano_owner, descr, category, added, last_action,  frileech, tv_kanalid, tv_program, tv_episode, tv_info, imdbid, tv_klockslag, tv_programid, reqid, pre, p2p, 3d, pack, swesub) VALUES (:name, :filename, :searchText, :searchText2, :owner, 'no', :infoHash, :size, :numfiles, :type, :anoymous, :descr, :category, NOW(), NOW(), :freeLeech, :tvChannel, :tvProgram, :tvEpisode, :tvInfo, :imdbid, :tvTime, :tvProgramId, :reqid, :pre, :p2p, :3d, :pack, :swesub)");
     $sth->bindParam(":name", $name, PDO::PARAM_STR);
     $sth->bindParam(":filename", $fname, PDO::PARAM_STR);
     $sth->bindParam(":searchText", $searchText, PDO::PARAM_STR);
     $sth->bindParam(":searchText2", $searchText2, PDO::PARAM_STR);
     $sth->bindParam(":owner", $this->user->getId(), PDO::PARAM_INT);
     $sth->bindParam(":infoHash", $infohash, PDO::PARAM_STR);
     $sth->bindParam(":size", $totallen, PDO::PARAM_INT);
     $sth->bindParam(":numfiles", count($filelist), PDO::PARAM_INT);
     $sth->bindParam(":type", $type, PDO::PARAM_STR);
     $sth->bindParam(":anoymous", $anonymousUpload, PDO::PARAM_INT);
     $sth->bindParam(":descr", $nfo, PDO::PARAM_STR);
     $sth->bindParam(":category", $category, PDO::PARAM_INT);
     $sth->bindParam(":freeLeech", $freeleech, PDO::PARAM_INT);
     $sth->bindParam(":tvChannel", $tvChannel, PDO::PARAM_INT);
     $sth->bindParam(":tvProgram", $tvProgram, PDO::PARAM_STR);
     $sth->bindParam(":tvEpisode", $tvEpisode, PDO::PARAM_STR);
     $sth->bindParam(":tvInfo", $tvInfo, PDO::PARAM_STR);
     $sth->bindParam(":tvTime", $tvTime, PDO::PARAM_INT);
     $sth->bindParam(":tvProgramId", $tvProgramId, PDO::PARAM_INT);
     $sth->bindParam(":imdbid", $imdbId, PDO::PARAM_INT);
     $sth->bindParam(":reqid", $reqid, PDO::PARAM_INT);
     $sth->bindParam(":pre", $pre, PDO::PARAM_INT);
     $sth->bindParam(":p2p", $p2p, PDO::PARAM_INT);
     $sth->bindParam(":3d", $stereoscopic, PDO::PARAM_INT);
     $sth->bindParam(":pack", $pack, PDO::PARAM_INT);
     $sth->bindParam(":swesub", $swesub, PDO::PARAM_INT);
     $sth->execute();
     $insertId = $this->db->lastInsertId();
     $sth = $this->db->prepare("INSERT INTO files (torrent, filename, size) VALUES (?, ?, ?)");
     foreach ($filelist as $file) {
开发者ID:lordgabber,项目名称:rartracker,代码行数:67,代码来源:Torrent.php

示例8: upload


//.........这里部分代码省略.........
     if ($res) {
         if ($res["whitelist"] == 0) {
             throw new Exception(L::get("TORRENT_RELEASE_GROUP_BANNED", [$res["comment"]]), 401);
         } else {
             $p2p = 1;
         }
     }
     /* Torrents sized 15GB+ should be free leech */
     if ($totallen > 16106127360 && $category != Config::$categories["BLURAY"]["id"] && $category != Config::$categories["MOVIE_4K"]["id"]) {
         $freeleech = 1;
     }
     /* Detect if torrent is a "pack" with releases inside */
     $packFolders = array();
     foreach ($filelist as $file) {
         preg_match('/^(.*?)\\//', $file[0], $match);
         if (strlen($match[1]) > 6) {
             array_push($packFolders, $match[1]);
         }
     }
     $packFolders = array_unique($packFolders);
     if (count($packFolders) > 1) {
         $pack = 1;
     } else {
         $pack = 0;
     }
     if ($imdbId) {
         $imdbInfo = $this->movieData->getData($imdbId);
         /* Always replace the release name start when empty or tv-show to keep it up to date for auto-matching */
         if ($imdbInfo["releaseNameStart"] == "" || in_array($category, [Config::$categories["TV_720P"]["id"], Config::$categories["TV_1080P"]["id"]])) {
             $this->movieData->updateReleaseNameStart($name, $imdbId);
         }
     }
     $fname = $name . ".torrent";
     $searchText = Helper::searchfield("{$name} {$imdbInfo['genres']} {$imdbInfo['imdbid']} " . implode(" ", $packFolders));
     $searchText2 = Helper::searchfield("{$imdbInfo['director']} {$imdbInfo['writer']} {$imdbInfo['cast']}");
     $sth = $this->db->prepare("INSERT INTO torrents (name, filename, search_text, search_text2, owner, visible, info_hash, size, numfiles, type, ano_owner, descr, category, added, last_action,  frileech, tv_kanalid, tv_program, tv_episode, tv_info, imdbid, tv_klockslag, tv_programid, reqid, section, pre, p2p, 3d, pack, swesub, sweaudio) VALUES (:name, :filename, :searchText, :searchText2, :owner, 'no', :infoHash, :size, :numfiles, :type, :anoymous, :descr, :category, NOW(), NOW(), :freeLeech, :tvChannel, :tvProgram, :tvEpisode, :tvInfo, :imdbid, :tvTime, :tvProgramId, :reqid, :section, :pre, :p2p, :3d, :pack, :swesub, :sweaudio)");
     $sth->bindParam(":name", $name, PDO::PARAM_STR);
     $sth->bindParam(":filename", $fname, PDO::PARAM_STR);
     $sth->bindParam(":searchText", $searchText, PDO::PARAM_STR);
     $sth->bindParam(":searchText2", $searchText2, PDO::PARAM_STR);
     $sth->bindValue(":owner", $this->user->getId(), PDO::PARAM_INT);
     $sth->bindParam(":infoHash", $infohash, PDO::PARAM_STR);
     $sth->bindParam(":size", $totallen, PDO::PARAM_INT);
     $sth->bindValue(":numfiles", count($filelist), PDO::PARAM_INT);
     $sth->bindParam(":type", $type, PDO::PARAM_STR);
     $sth->bindParam(":anoymous", $anonymousUpload, PDO::PARAM_INT);
     $sth->bindParam(":descr", $nfo, PDO::PARAM_STR);
     $sth->bindParam(":category", $category, PDO::PARAM_INT);
     $sth->bindParam(":freeLeech", $freeleech, PDO::PARAM_INT);
     $sth->bindParam(":tvChannel", $tvChannel, PDO::PARAM_INT);
     $sth->bindParam(":tvProgram", $tvProgram, PDO::PARAM_STR);
     $sth->bindParam(":tvEpisode", $tvEpisode, PDO::PARAM_STR);
     $sth->bindParam(":tvInfo", $tvInfo, PDO::PARAM_STR);
     $sth->bindParam(":tvTime", $tvTime, PDO::PARAM_INT);
     $sth->bindParam(":tvProgramId", $tvProgramId, PDO::PARAM_INT);
     $sth->bindParam(":imdbid", $imdbId, PDO::PARAM_INT);
     $sth->bindParam(":reqid", $reqid, PDO::PARAM_INT);
     $sth->bindParam(":section", $section, PDO::PARAM_STR);
     $sth->bindParam(":pre", $pre, PDO::PARAM_INT);
     $sth->bindParam(":p2p", $p2p, PDO::PARAM_INT);
     $sth->bindParam(":3d", $stereoscopic, PDO::PARAM_INT);
     $sth->bindParam(":pack", $pack, PDO::PARAM_INT);
     $sth->bindParam(":swesub", $swesub, PDO::PARAM_INT);
     $sth->bindParam(":sweaudio", $sweaudio, PDO::PARAM_INT);
     $sth->execute();
     $insertId = $this->db->lastInsertId();
开发者ID:swetorrentking,项目名称:rartracker,代码行数:67,代码来源:Torrent.php

示例9: createOrUpdate

 public function createOrUpdate($postData, $reqId = null)
 {
     if ($this->user->getClass() < User::CLASS_ACTOR) {
         throw new Exception(L::get("PERMISSION_DENIED"), 401);
     }
     if ($reqId) {
         $request = $this->get($reqId);
         if ($request["user"]["id"] != $this->user->getId() && $this->user->getClass() < User::CLASS_ADMIN) {
             throw new Exception(L::get("PERMISSION_DENIED"));
         }
     } else {
         if ($this->user->getRequestSlots() <= count($this->myRequests())) {
             throw new Exception(L::get("REQUEST_SLOTS_EXCEEDED"), 401);
         }
     }
     if ($postData["category"] < Config::$categories["DVDR_PAL"]["id"] || $postData["category"] > Config::$categories["SUBPACK"]["id"]) {
         throw new Exception(L::get("REQUEST_INVALID_CATEGORY"));
     }
     if (in_array($postData["category"], array(1, 2, 3, 4, 5, 6, 7)) && strlen($postData["imdbInfo"]) < 2) {
         throw new Exception(L::get("REQUEST_NO_IMDB_URL"));
     }
     if (in_array($postData["category"], array(8, 9, 10, 11, 12)) && strlen($postData["customName"]) < 2) {
         throw new Exception(L::get("REQUEST_NAME_TOO_SHORT"));
     }
     $requestName = $postData["imdbInfo"];
     if (in_array($postData["category"], array(8, 9, 10, 11, 12))) {
         $requestName = $postData["customName"];
     }
     $slug = Helper::slugify($requestName);
     $searchText = Helper::searchfield($requestName);
     $userid = $this->user->getId();
     if ($reqId) {
         $sth = $this->db->prepare("UPDATE requests SET userid = ?, request = ?, comment = ?, search_text = ?, season = ?, imdbid = ?, typ = ?, slug = ? WHERE id = " . $request["id"]);
         $userid = $request["user"]["id"];
     } else {
         $sth = $this->db->prepare("INSERT INTO requests(userid, request, added, comment, search_text, season, imdbid, typ, slug) VALUES(?, ?, NOW(), ?, ?, ?, ?, ?, ?)");
     }
     $sth->bindParam(1, $userid, PDO::PARAM_INT);
     $sth->bindParam(2, $requestName, PDO::PARAM_STR);
     $sth->bindParam(3, $postData["comment"], PDO::PARAM_STR);
     $sth->bindParam(4, $searchText, PDO::PARAM_STR);
     $sth->bindParam(5, $postData["season"], PDO::PARAM_INT);
     $sth->bindParam(6, $postData["imdbId"], PDO::PARAM_INT);
     $sth->bindParam(7, $postData["category"], PDO::PARAM_INT);
     $sth->bindParam(8, $slug, PDO::PARAM_STR);
     $sth->execute();
     if ($reqId) {
         return array("id" => $request["id"], "slug" => $slug);
     } else {
         $insertId = $this->db->lastInsertId();
         $this->log->log(1, L::get("REQUEST_SITE_LOG", [$insertId, $slug, $requestName], Config::DEFAULT_LANGUAGE), $this->user->getId(), false);
         $this->vote($insertId, 0);
         return array("id" => $insertId, "name" => $requestName);
     }
 }
开发者ID:swetorrentking,项目名称:rartracker,代码行数:55,代码来源:Requests.php

示例10: createOrUpdate

 public function createOrUpdate($postData, $reqId = null)
 {
     if ($this->user->getClass() < User::CLASS_SKADIS) {
         throw new Exception('Du har inte rättigheter.', 401);
     }
     if ($reqId) {
         $request = $this->get($reqId);
         if ($request["user"]["id"] != $this->user->getId() && $this->user->getClass() < User::CLASS_ADMIN) {
             throw new Exception('Du saknar rättigheter att redigera denna request.');
         }
     } else {
         if ($this->user->getRequestSlots() <= count($this->myRequests())) {
             throw new Exception('Du har utnyttjat alla dina maximalt antal aktiva requests.');
         }
     }
     if ($postData["category"] < 1 || $postData["category"] > 12) {
         throw new Exception('Ogiltig kategori.');
     }
     if (in_array($postData["category"], array(1, 2, 3, 4, 5, 6, 7)) && strlen($postData["imdbInfo"]) < 2) {
         throw new Exception('Ingen IMDB-länk vald.');
     }
     if (in_array($postData["category"], array(8, 9, 10, 11, 12)) && strlen($postData["customName"]) < 2) {
         throw new Exception('Namnet är för kort.');
     }
     if ($postData["receiver"] == $this->user->getId()) {
         throw new Exception('Skicka inte meddelande till dig själv.');
     }
     $requestName = $postData["imdbInfo"];
     if (in_array($postData["category"], array(8, 9, 10, 11, 12))) {
         $requestName = $postData["customName"];
     }
     $searchText = Helper::searchfield($requestName);
     $userid = $this->user->getId();
     if ($reqId) {
         $sth = $this->db->prepare("UPDATE requests SET userid = ?, request = ?, comment = ?, search_text = ?, season = ?, imdbid = ?, typ = ? WHERE id = " . $request["id"]);
         $userid = $request["user"]["id"];
     } else {
         $sth = $this->db->prepare("INSERT INTO requests(userid, request, added, comment, search_text, season, imdbid, typ) VALUES(?, ?, NOW(), ?, ?, ?, ?, ?)");
     }
     $sth->bindParam(1, $userid, PDO::PARAM_INT);
     $sth->bindParam(2, $requestName, PDO::PARAM_STR);
     $sth->bindParam(3, $postData["comment"], PDO::PARAM_STR);
     $sth->bindParam(4, $searchText, PDO::PARAM_STR);
     $sth->bindParam(5, $postData["season"], PDO::PARAM_INT);
     $sth->bindParam(6, $postData["imdbId"], PDO::PARAM_INT);
     $sth->bindParam(7, $postData["category"], PDO::PARAM_INT);
     $sth->execute();
     if ($reqId) {
         return array("id" => $request["id"], "name" => $requestName);
     } else {
         $insertId = $this->db->lastInsertId();
         $this->log->log(1, "Request ([url=/archive/request/" . $insertId . "/][b]" . $requestName . "[/b][/url]) inlagd utav {{username}}", $this->user->getId(), false);
         $this->vote($insertId, 0);
         return array("id" => $insertId, "name" => $requestName);
     }
 }
开发者ID:lordgabber,项目名称:rartracker,代码行数:56,代码来源:Requests.php


注:本文中的Helper::searchfield方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。