├── action.php ├── assets ├── css │ └── style.min.css ├── img │ ├── bg-auth.jpg │ └── sprite.svg └── js │ └── scripts.min.js ├── changelog.txt ├── class ├── Config.class.php ├── Database.class.php ├── Deluge.class.php ├── Errors.class.php ├── Notification.class.php ├── SynologyDS.class.php ├── System.class.php ├── TorrServer.class.php ├── Transmission.class.php ├── TransmissionRPC.class.php ├── Update.class.php ├── Url.class.php └── qBittorrent.class.php ├── config.php.example ├── config.xml ├── db_schema ├── mysql.sql ├── postgresql.sql └── sqlite.sql ├── engine.php ├── img ├── anidub.com.ico ├── animelayer.ru.ico ├── baibako.tv.ico ├── baibako.tv_forum.ico ├── booktracker.org.ico ├── casstudio.tk.ico ├── favicon.svg ├── hamsterstudio.org.ico ├── kinozal.guru.ico ├── kinozal.me.ico ├── kinozal.tv.ico ├── lostfilm-mirror.ico ├── lostfilm.tv.ico ├── newstudio.tv.ico ├── nnmclub.to.ico ├── pornolab.net.ico ├── riperam.org.ico ├── rustorka.com.ico ├── rutor.is.ico ├── rutracker.org.ico └── tfile.cc.ico ├── include ├── check.php ├── credentials.php ├── execution.php ├── help.php ├── news.php ├── settings.php ├── show_table.php ├── show_warnings.php ├── show_watching.php ├── show_watching_themes.php └── update.php ├── index.php ├── pages ├── _modal-add.php ├── _modal-edit.php ├── _navigation.php ├── auth.php ├── footer.php ├── header.php └── main.php ├── readme.md ├── rss └── index.php ├── scripts └── echo.sh ├── torrents └── .gitkeep ├── trackers ├── anidub.com.engine.php ├── animelayer.ru.engine.php ├── baibako.tv.engine.php ├── baibako.tv_forum.engine.php ├── booktracker.org.engine.php ├── booktracker.org.search.php ├── casstudio.tk.engine.php ├── hamsterstudio.org.engine.php ├── kinozal.guru.engine.php ├── kinozal.me.engine.php ├── kinozal.tv.engine.php ├── lostfilm-mirror.engine.php ├── lostfilm.tv.engine.php ├── newstudio.tv.engine.php ├── nnmclub.to.engine.php ├── nnmclub.to.search.php ├── pornolab.net.engine.php ├── pornolab.net.search.php ├── riperam.org.engine.php ├── rustorka.com.engine.php ├── rutor.is.engine.php ├── rutracker.org.engine.php ├── rutracker.org.search.php ├── tfile.cc.engine.php └── tfile.cc.search.php └── version.txt /assets/img/bg-auth.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElizarovEugene/TorrentMonitor/8cb1cb0788ae88b4a1eeab30b102d89e3108ddc7/assets/img/bg-auth.jpg -------------------------------------------------------------------------------- /assets/js/scripts.min.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /*! Author: Dark Preacher */var notyf=new Notyf({duration:5e3,dismissible:!0,ripple:!0,position:{x:"right",y:"top"},types:[{type:"warning",duration:2e3,background:"orange",icon:!1}]});function news(){return{markRead:function(t,e){this.countNews-=1,t.classList.remove("news-item--new"),$.post("action.php",{action:"markNews",id:e})}}}function add(){return{type:"theme",theme:{},series:{},user:{},init:function(){this.reInit()},reInit:function(){this.theme={name:null,url:null,path:null,update_header:1},this.series={tracker:"",name:null,path:null,hd:0},this.user={tracker:"",name:null}},addTheme:function(t,e){this.theme.action=t,$.post(e.action,this.theme,function(t){t.error?notyf.error(t.msg):(notyf.success(t.msg),this.showPage("show_table"),this.closeModalAdd(),this.reInit())}.bind(this),"json")},addSeries:function(t,e){this.series.action=t,$.post(e.action,this.series,function(t){t.error?notyf.error(t.msg):(notyf.success(t.msg),this.showPage("show_table"),this.closeModalAdd(),this.reInit())}.bind(this),"json")},addUser:function(t,e){this.user.action=t,$.post(e.action,this.user,function(t){t.error?notyf.error(t.msg):(notyf.success(t.msg),this.showPage("show_watching"),this.closeModalAdd(),this.reInit())}.bind(this),"json")}}}function warnings(){return{cleared:!1,showAll:!1,clear:function(t,e){notyf.open({type:"warning",message:"Обрабатывается запрос…"}),$.post("action.php",{action:"clear_warnings",tracker:t},function(t){var n=this;t.error?notyf.error(t.msg):setTimeout((function(){n.cleared=!0,n.countErrors-=e,notyf.success(t.msg)}),1e3)}.bind(this),"json")}}}function item(){return{deleted:!1,showInfo:!1,showDelete:!1,deleteItem:function(t){notyf.open({type:"warning",message:"Обрабатывается запрос…"}),$.post("action.php",{action:"del",id:t},function(t){var e=this;t.error?notyf.error(t.msg):setTimeout((function(){e.deleted=!0,notyf.success(t.msg)}),1e3)}.bind(this),"json")}}}function userItem(){return{deleted:!1,showDownload:!1,showMonitor:!1,showDelete:!1,downloadItem:function(t,e){notyf.open({type:"warning",message:"Обрабатывается запрос…"}),$.post("action.php",{action:"threme_add",id:t,user_id:e},function(t){var e=this;t.error?notyf.error("Ошибка передачи данных
Попробуйте ещё раз."):setTimeout((function(){e.deleted=!0,notyf.success(t.msg)}),1e3)}.bind(this),"json")},monitorItem:function(t){notyf.open({type:"warning",message:"Обрабатывается запрос…"}),$.post("action.php",{action:"transfer_from_buffer",id:t},function(t){var e=this;t.error?notyf.error(t.msg):setTimeout((function(){e.deleted=!0,notyf.success(t.msg)}),1e3)}.bind(this),"json")},deleteItem:function(t){notyf.open({type:"warning",message:"Обрабатывается запрос…"}),$.post("action.php",{action:"delete_from_buffer",id:t},function(t){var e=this;t.error?notyf.error(t.msg):setTimeout((function(){e.deleted=!0,notyf.success(t.msg)}),1e3)}.bind(this),"json")}}}function filterThemes(){return{filterValue:"",go:function(){var t=this.filterValue.toUpperCase(),e=document.getElementById("filterable").getElementsByClassName("tm-item");if(""!==this.filterValue)for(var n=0;n-1?e[n].style.display="":e[n].style.display="none"}else for(var s=0;s0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return{pageCurrent:"",pageContents:"",pageLoading:!1,showTopNav:!1,modalAdd:!1,modalEditThemeShow:!1,modalEditSeriesShow:!1,countErrors:t,countNews:e,editData:[],init:function(){this.initTheme(),this.showPage("show_table")},showPage:function(t){var e=this;this.pageLoading=!0,this.pageCurrent=t,fetch("include/".concat(t,".php")).then((function(t){return t.text()})).then((function(t){e.pageContents=t,window.scrollTo(0,0),e.showTopNav=!1,e.pageLoading=!1}))},setSort:function(t,e){this.pageLoading=!0,$.get("action.php",{action:"order",by:t,dir:e},function(t){this.showPage("show_table")}.bind(this),"json")},showModalAdd:function(){this.modalAdd=!0,this.showTopNav=!1,document.body.style.overflowY="hidden"},closeModalAdd:function(){this.modalAdd=!1,document.body.style.overflowY="auto"},modalEditTheme:function(t){this.pageLoading=!0,document.body.style.overflowY="hidden",$.get("action.php",{action:"item_data",id:t},function(t){this.pageLoading=!1,this.editData=t,this.modalEditThemeShow=!0}.bind(this),"json")},closeModalEditTheme:function(){this.modalEditThemeShow=!1,document.body.style.overflowY="auto"},modalEditSeries:function(t){this.pageLoading=!0,document.body.style.overflowY="hidden",$.get("action.php",{action:"item_data",id:t},function(t){this.pageLoading=!1,this.editData=t,this.modalEditSeriesShow=!0}.bind(this),"json")},closeModalEditSeries:function(){this.modalEditSeriesShow=!1,document.body.style.overflowY="auto"},updateItem:function(t,e){this.editData.action="update",this.editData.update=this.editData.auto_update,$.post(t.action,this.editData,function(t){t.error?notyf.error(t.msg):(notyf.success(t.msg),this.showPage("show_table"),this.closeModalEditTheme(),this.closeModalEditSeries())}.bind(this),"json")},initTheme:function(){var t=localStorage.getItem("theme");null!==t&&(document.documentElement.dataset.theme=t)}}}))})); -------------------------------------------------------------------------------- /class/Config.class.php: -------------------------------------------------------------------------------- 1 | $val) 22 | { 23 | Config::write('ext_'.$key, $val); 24 | } 25 | } 26 | } 27 | } 28 | 29 | public static function read($name) 30 | { 31 | return self::$confArray[$name]; 32 | } 33 | 34 | public static function write($name, $value) 35 | { 36 | self::$confArray[$name] = $value; 37 | } 38 | } 39 | ?> -------------------------------------------------------------------------------- /class/Deluge.class.php: -------------------------------------------------------------------------------- 1 | 59 | -------------------------------------------------------------------------------- /class/Errors.class.php: -------------------------------------------------------------------------------- 1 | расширение cURL.'); 10 | Errors::write('missing_files', 'Не хватает файлов для работы системы.'); 11 | Errors::write('credential_miss', 'Не указаны учётные данные для трекера.'); 12 | 13 | Errors::write('not_available', 'Не могу получить доступ к трекеру.'); 14 | Errors::write('credential_wrong', 'Неправильные учётные данные.'); 15 | Errors::write('cant_get_forum_page', 'Не удалось получить страницу трекера.'); 16 | Errors::write('cant_get_auth_page', 'Не удалось получить страницу авторизацию трекера.'); 17 | Errors::write('cant_find_date', 'Не удалось найти время обновления торрента.'); 18 | Errors::write('cant_find_cookie', 'Не удалось найти куки.'); 19 | Errors::write('cant_find_dowload_link', 'Не удалось найти ссылку для скачивания.'); 20 | Errors::write('rss_parse_false', 'Ошибка при чтении XML файла RSS ленты.'); 21 | Errors::write('cant_find_rss', 'Не удалось получить RSS ленту трекера.'); 22 | Errors::write('max_torrent', 'Вы использовали доступное Вам количество торрент-файлов в сутки.'); 23 | Errors::write('torrent_file_fail', 'Не удалось получить данные torrent-файла.'); 24 | Errors::write('save_file_fail', 'Не удалось сохранить torrent-файл в директорию.'); 25 | Errors::write('limit', 'Превышен лимит попыток входа в профиль. Необходимо остановить ТМ на 2-3 часа.'); 26 | Errors::write('captcha', 'При авторизации запрашивается капча. Необходимо остановить ТМ на 2-3 часа.'); 27 | 28 | Errors::write('update', 'Невозможно проверить обновление системы.'); 29 | Errors::write('update_fail', 'Невозможно обновить систему.'); 30 | Errors::write('update_news', 'Невозможно проверить новости.'); 31 | 32 | Errors::write('404', 'Не удалось добавить в torrent-клиент, неверная ссылка на torrent-файл.'); 33 | Errors::write('log_passwd', 'Не удалось подключиться к torrent-клиенту, неправильный логин или пароль.'); 34 | Errors::write('connect_fail', 'Не удалось подключиться к torrent-клиенту. Клиент недоступен по указанному адресу.'); 35 | Errors::write('no_response', 'Не удалось добавить torrent-файл в torrent-клиент. Клиент не может получить доступ к файлу по указанному адресу. Проверьте адрес TorrentMonitor\'а в настройках.'); 36 | Errors::write('unauthorized', 'Не удалось добавить в torrent-клиент, не прошла авторизация в torrent-клиенте.'); 37 | Errors::write('add_fail', 'Не удалось добавить torrent-файл в torrent-клиент.'); 38 | Errors::write('duplicate_torrent', 'Не удалось добавить в torrent-клиент, такая закачка уже запущена.'); 39 | Errors::write('unknown', 'Неизвестная ошибка при добавлении torrent-файла в torrent-клиент. Требуется дополнительная диагностика.'); 40 | } 41 | 42 | public static function getInstance() 43 | { 44 | if ( ! isset(self::$instance)) 45 | { 46 | $object = __CLASS__; 47 | self::$instance = new $object; 48 | } 49 | return self::$instance; 50 | } 51 | 52 | public static function read($name) 53 | { 54 | return self::$errorsArray[$name]; 55 | } 56 | 57 | public static function write($name, $value) 58 | { 59 | self::$errorsArray[$name] = $value; 60 | } 61 | 62 | public static function getWarning($warning) 63 | { 64 | return Errors::getInstance()->read($warning); 65 | } 66 | 67 | public static function setWarnings($tracker, $warning, $id = NULL) 68 | { 69 | $date = date('Y-m-d H:i:s'); 70 | $debug = Database::getSetting('debug'); 71 | Database::setWarnings($date, $tracker, $warning, $id); 72 | if ($debug) 73 | echo '
'."\r\n".$warning.'
'."\r\n"; 74 | if ($id != NULL) 75 | Database::setErrorToThreme($id, 1); 76 | $countErrors = Database::getWarningsCount($tracker); 77 | if ($countErrors[0]['count'] == 1) 78 | Notification::sendNotification('warning', $date, $tracker, Errors::getWarning($warning), 0); 79 | } 80 | } 81 | ?> -------------------------------------------------------------------------------- /class/Notification.class.php: -------------------------------------------------------------------------------- 1 | ".$header_message."\r\n".'Дата: '.$date."\r\n".'Трекер: '.$tracker."\r\n".'Сообщение: '.$message."\r\n"; 27 | else 28 | $msg = $message; 29 | 30 | if ($name != 0) 31 | { 32 | if ($tracker !== 'baibako.tv' && $tracker !== 'hamsterstudio.org' && $tracker !== 'lostfilm.tv' && $tracker !== 'lostfilm-mirror' && $tracker !== 'newstudio.tv') 33 | { 34 | $msg .= 'Ссылка на тему: '; 35 | if ($tracker == 'rutracker.org' || $tracker == 'nnmclub.to' || $tracker == 'pornolab.net' || $tracker == 'rustorka.com') 36 | $msg .= "http://{$tracker}/forum/viewtopic.php?t={$name}"; 37 | elseif ($tracker == 'kinozal.tv' || $tracker == 'kinozal.me' || $tracker == 'kinozal.guru' || $tracker == 'animelayer.ru') 38 | $msg .= "http://{$tracker}/details.php?id={$name}"; 39 | elseif ($tracker == 'rutor.is') 40 | $msg .= "http://rutor.is/torrent/{$name}/"; 41 | elseif ($tracker == 'anidub.com') 42 | $msg .= "http://tr.anidub.com{$name}"; 43 | elseif ($tracker == 'casstudio.tk' || $tracker == 'booktracker.org') 44 | $msg .= "https://{$tracker}/viewtopic.php?t={$name}"; 45 | } 46 | } 47 | return $msg; 48 | } 49 | 50 | public static function sendMail($email, $date, $tracker, $message, $header_message, $name) 51 | { 52 | $headers = 'From: TorrentMonitor'."\r\n"; 53 | $headers .= 'MIME-Version: 1.0'."\r\n"; 54 | $headers .= 'Content-type: text/html; charset=utf-8'."\r\n"; 55 | 56 | $msg = Notification::generateMessage($date, $tracker, $message, $header_message, $name); 57 | 58 | mail($email, '=?UTF-8?B?'.base64_encode("TorrentMonitor: ".$header_message).'?=', $msg, $headers); 59 | } 60 | 61 | public static function sendPushover($pushover, $date, $tracker, $message, $header_message, $name) 62 | { 63 | $msg = Notification::generateMessage($date, $tracker, $message, $header_message, $name); 64 | $msg = strip_tags($msg); 65 | 66 | $pieces = explode(';', $pushover); 67 | $postfields = 'token='.$pieces[1].'&user='.$pieces[0].'&message='.$msg; 68 | $forumPage = Sys::getUrlContent( 69 | array( 70 | 'type' => 'POST', 71 | 'header' => 1, 72 | 'returntransfer' => 1, 73 | 'url' => 'https://api.pushover.net/1/messages.json', 74 | 'ssl_false' => 1, 75 | 'postfields' => $postfields, 76 | ) 77 | ); 78 | } 79 | 80 | public static function sendProwl($prowl, $date, $tracker, $message, $header_message, $name) 81 | { 82 | $msg = Notification::generateMessage($date, $tracker, $message, $header_message, $name); 83 | 84 | $postfields = 'apikey='.$prowl.'&application=TorrentMonitor&event=Notification&description='.$msg; 85 | $forumPage = Sys::getUrlContent( 86 | array( 87 | 'type' => 'POST', 88 | 'header' => 1, 89 | 'returntransfer' => 1, 90 | 'url' => 'https://api.prowlapp.com/publicapi/add', 91 | 'ssl_false' => 1, 92 | 'postfields' => $postfields, 93 | ) 94 | ); 95 | } 96 | 97 | public static function sendPushbullet($pushbullet, $date, $tracker, $message, $header_message, $name) 98 | { 99 | $msg = Notification::generateMessage($date, $tracker, $message, $header_message, $name); 100 | 101 | $postfields = array('type' => 'note', 'title' => $header_message, 'body' => $msg); 102 | $forumPage = Sys::getUrlContent( 103 | array( 104 | 'type' => 'POST', 105 | 'returntransfer' => 1, 106 | 'url' => 'https://api.pushbullet.com/v2/pushes', 107 | 'ssl_false' => 1, 108 | 'userpwd' => $pushbullet, 109 | 'postfields' => $postfields, 110 | ) 111 | ); 112 | } 113 | 114 | public static function sendPushall($pushall, $date, $tracker, $message, $header_message, $name) 115 | { 116 | $msg = Notification::generateMessage($date, $tracker, $message, $header_message, $name); 117 | 118 | $pieces = explode(';', $pushall); 119 | $postfields = array('type' => 'self', 'id' => $pieces[0], 'key' => $pieces[1], 'title' => $header_message, 'text' => $msg); 120 | $forumPage = Sys::getUrlContent( 121 | array( 122 | 'type' => 'POST', 123 | 'returntransfer' => 1, 124 | 'url' => 'https://pushall.ru/api.php', 125 | 'ssl_false' => 1, 126 | 'postfields' => $postfields, 127 | ) 128 | ); 129 | } 130 | 131 | public static function sendTelegram($telegram, $date, $tracker, $message, $header_message, $name) 132 | { 133 | $msg = Notification::generateMessage($date, $tracker, $message, $header_message, $name); 134 | 135 | $pieces = explode(';', $telegram); 136 | $url = "https://api.telegram.org/bot" . $pieces[0] . "/sendMessage"; 137 | 138 | // Modified to support message_thread_id 139 | for ($i = 1; array_key_exists($i, $pieces); $i++) 140 | { 141 | // Check if the piece contains thread ID (format: "chat_id:thread_id") 142 | $chatDetails = explode(':', $pieces[$i]); 143 | $chatId = $chatDetails[0]; 144 | 145 | $postfields = array( 146 | 'chat_id' => $chatId, 147 | 'text' => $msg, 148 | 'disable_web_page_preview' => 1, 149 | 'parse_mode' => 'HTML' 150 | ); 151 | 152 | // Add message_thread_id if provided 153 | if (isset($chatDetails[1])) { 154 | $postfields['message_thread_id'] = $chatDetails[1]; 155 | } 156 | 157 | $forumPage = Sys::getUrlContent( 158 | array( 159 | 'type' => 'POST', 160 | 'header' => 1, 161 | 'returntransfer' => 1, 162 | 'url' => $url, 163 | 'ssl_false' => 1, 164 | 'postfields' => $postfields, 165 | ) 166 | ); 167 | } 168 | } 169 | 170 | public static function sendNotification($type, $date, $tracker, $message, $name=0, $id=0) 171 | { 172 | if ($type == 'warning') 173 | $header_message = 'Предупреждение.'; 174 | if ($type == 'notification') 175 | $header_message = 'Обновление.'; 176 | if ($type == 'news') 177 | $header_message = 'Новость.'; 178 | 179 | $send = Database::getSetting('send'); 180 | if ($send) 181 | { 182 | if ($type == 'warning') 183 | { 184 | $sendWarning = Database::getSetting('sendWarning'); 185 | if ($sendWarning) 186 | { 187 | $service = Database::getService('sendWarningService'); 188 | if ($service['service'] == 'E-mail') 189 | { 190 | $service['service'] = 'Mail'; 191 | $name = $id; 192 | } 193 | if ($service['service'] == 'Telegram') 194 | { 195 | $name = $id; 196 | } 197 | if ( ! empty($service['address'])) 198 | call_user_func('Notification::send'.$service['service'], $service['address'], $date, $tracker, $message, $header_message, $name); 199 | } 200 | } 201 | 202 | if ($type == 'notification' || $type == 'news') 203 | { 204 | $sendUpdate = Database::getSetting('sendUpdate'); 205 | if ($sendUpdate) 206 | { 207 | $service = Database::getService('sendUpdateService'); 208 | if ($service['service'] == 'E-mail') 209 | { 210 | $service['service'] = 'Mail'; 211 | $name = $id; 212 | } 213 | if ($service['service'] == 'Telegram') 214 | { 215 | $name = $id; 216 | } 217 | if ($type == 'news') 218 | { 219 | $message = str_replace('
', "\r\n", $message); 220 | $message = strip_tags($message); 221 | } 222 | if ( ! empty($service['address'])) 223 | call_user_func('Notification::send'.$service['service'], $service['address'], $date, $tracker, $message, $header_message, $name); 224 | } 225 | } 226 | } 227 | } 228 | } 229 | ?> 230 | -------------------------------------------------------------------------------- /class/SynologyDS.class.php: -------------------------------------------------------------------------------- 1 | success) 16 | { 17 | return $response->data->sid; 18 | } 19 | elseif ($response->error) 20 | { 21 | if (self::$debug) 22 | var_dump($response); 23 | return FALSE; 24 | } 25 | } 26 | 27 | private static function _logout() 28 | { 29 | file_get_contents(self::$schema.'://'.self::$torrentAddress.'/webapi/auth.cgi?api=SYNO.API.Auth&version=1&method=logout&session=DownloadStation'); 30 | } 31 | 32 | private static function _list_downloads($sid) 33 | { 34 | return json_decode(file_get_contents(self::$schema.'://'.self::$torrentAddress.'/webapi/DownloadStation/task.cgi?api=SYNO.DownloadStation.Task&version=1&method=list&additional=detail&_sid='.$sid)); 35 | } 36 | 37 | private static function _download_already_exists($sid, $url) 38 | { 39 | $list = SynologyDS::_list_downloads($sid); 40 | if ($list === NULL) 41 | return NULL; 42 | 43 | foreach ($list->data->tasks as $task) 44 | { 45 | if ($task->additional->detail->uri == $url) 46 | return TRUE; 47 | } 48 | return FALSE; 49 | } 50 | 51 | private static function _find_id($sid) 52 | { 53 | $list = SynologyDS::_list_downloads($sid); 54 | if ($list === NULL) 55 | return NULL; 56 | 57 | $id = NULL; 58 | foreach ($list->data->tasks as $task) 59 | { 60 | $id = $task->id; 61 | } 62 | return $id; 63 | } 64 | 65 | #добавляем новую закачку в torrent-клиент, обновляем hash в базе 66 | public static function addNew($id, $file, $hash, $tracker) 67 | { 68 | #получаем настройки из базы 69 | $settings = Database::getAllSetting(); 70 | foreach ($settings as $row) 71 | { 72 | extract($row); 73 | } 74 | 75 | $pieces = explode(':', $torrentAddress); 76 | if ($pieces[1] == 5000) 77 | self::$schema = 'http'; 78 | elseif ($pieces[1] == 5001) 79 | self::$schema = 'https'; 80 | else 81 | self::$schema = 'http'; 82 | 83 | self::$torrentAddress = $torrentAddress; 84 | self::$torrentLogin = $torrentLogin; 85 | self::$torrentPassword = $torrentPassword; 86 | self::$debug = $debug; 87 | 88 | $sid = SynologyDS::_login(); 89 | if ($sid) 90 | { 91 | try 92 | { 93 | if ( ! empty($hash)) 94 | { 95 | if ($deleteDistribution) 96 | { 97 | $response = file_get_contents(self::$schema.'://'.$torrentAddress.'/webapi/DownloadStation/task.cgi?api=SYNO.DownloadStation.Task&version=3&method=delete&id='.$hash.'&_sid='.$sid); 98 | if ($debug) 99 | var_dump($response); 100 | } 101 | } 102 | 103 | if ( ! SynologyDS::_download_already_exists($sid, $file)) 104 | { 105 | $individualPath = Database::getTorrentDownloadPath($id); 106 | if ( ! empty($individualPath)) 107 | $pathToDownload = $individualPath; 108 | 109 | $data = array( 110 | 'api' => 'SYNO.DownloadStation.Task', 111 | 'version' => '3', 112 | 'method' => 'create', 113 | 'session' => 'DownloadStation', 114 | 'uri' => $file, 115 | 'destination' => $pathToDownload, 116 | '_sid' => $sid 117 | ); 118 | $data = http_build_query($data); 119 | 120 | if ($debug) 121 | $param = TRUE; 122 | else 123 | $param = FALSE; 124 | 125 | $ch = curl_init(); 126 | curl_setopt_array($ch, array( 127 | CURLOPT_POST => 1, 128 | CURLOPT_FOLLOWLOCATION => 1, 129 | CURLOPT_URL => self::$schema.'://'.$torrentAddress.'/webapi/DownloadStation/task.cgi', 130 | CURLOPT_POSTFIELDS => $data, 131 | CURLOPT_VERBOSE => $param, 132 | )); 133 | $response = curl_exec($ch); 134 | curl_close($ch); 135 | if ($debug) 136 | var_dump($response); 137 | 138 | if (preg_match('/\"code\":403/i', $response)) 139 | { 140 | $return['status'] = FALSE; 141 | $return['msg'] = 'destination_does_not_exist'; 142 | } 143 | else 144 | { 145 | $hashNew = SynologyDS::_find_id($sid); 146 | if ($hashNew) 147 | { 148 | Database::updateHash($id, $hashNew); 149 | Database::clearWarnings('SynologyDS'); 150 | 151 | $return['status'] = TRUE; 152 | $return['hash'] = $id; 153 | } 154 | else 155 | { 156 | $return['status'] = FALSE; 157 | $return['msg'] = 'add_fail'; 158 | } 159 | SynologyDS::_logout(); 160 | } 161 | } 162 | else 163 | { 164 | $return['status'] = FALSE; 165 | $return['msg'] = 'duplicate_torrent'; 166 | } 167 | } 168 | catch (Exception $e) 169 | { 170 | echo $e->getMessage().PHP_EOL; 171 | } 172 | } 173 | else 174 | { 175 | $return['status'] = FALSE; 176 | $return['msg'] = 'log_passwd'; 177 | } 178 | 179 | return $return; 180 | } 181 | } 182 | ?> -------------------------------------------------------------------------------- /class/TorrServer.class.php: -------------------------------------------------------------------------------- 1 | "rem", 25 | "hash" => $hash 26 | ); 27 | $data = json_encode($data); 28 | 29 | $request_headers[] = "Content-Type: application/json"; 30 | 31 | $ch = curl_init(); 32 | curl_setopt_array($ch, array( 33 | CURLOPT_POST => 1, 34 | CURLOPT_FOLLOWLOCATION => 1, 35 | CURLOPT_URL => 'http://'.$torrentAddress.'/torrents/', 36 | CURLOPT_USERAGENT => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:51.0) Gecko/20100101 Firefox/51.0', 37 | CURLOPT_RETURNTRANSFER => true, 38 | CURLOPT_POST => true, 39 | CURLOPT_USERPWD => $torrentLogin.':'.$torrentPassword, 40 | CURLOPT_HTTPHEADER => $request_headers, 41 | CURLOPT_POSTFIELDS => $data, 42 | )); 43 | $response = curl_exec($ch); 44 | curl_close($ch); 45 | } 46 | } 47 | 48 | $torrent = Database::getTorrent($id); 49 | if ($torrent) 50 | $name = str_replace(' ', '.', $torrent[0]['name']); 51 | else 52 | $name = ''; 53 | 54 | #добавляем торрент в torrent-клиент 55 | $url = 'http://'.$torrentAddress.'/stream/fname?link='.$file.'&save&title='.$name.'&stat'; 56 | $ch = curl_init(); 57 | curl_setopt_array($ch, array( 58 | CURLOPT_FOLLOWLOCATION => 1, 59 | CURLOPT_URL => $url, 60 | CURLOPT_USERAGENT => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:51.0) Gecko/20100101 Firefox/51.0', 61 | CURLOPT_RETURNTRANSFER => true, 62 | CURLOPT_USERPWD => $torrentLogin.':'.$torrentPassword, 63 | )); 64 | $response = curl_exec($ch); 65 | if ($debug) 66 | var_dump($response); 67 | curl_close($ch); 68 | 69 | preg_match_all('/\"hash\":\"(.*)\"/U', $response, $res); 70 | if ($res[1]) 71 | { 72 | $hashNew = $res[1][0]; 73 | 74 | Database::updateHash($id, $hashNew); 75 | Database::clearWarnings('TorrServer'); 76 | 77 | $return['status'] = TRUE; 78 | $return['hash'] = $hashNew; 79 | } 80 | else 81 | { 82 | $return['status'] = FALSE; 83 | $return['msg'] = 'add_fail'; 84 | } 85 | } 86 | catch (Exception $e) 87 | { 88 | echo $e->getMessage().PHP_EOL; 89 | } 90 | 91 | return $return; 92 | } 93 | } 94 | ?> -------------------------------------------------------------------------------- /class/Transmission.class.php: -------------------------------------------------------------------------------- 1 | debug=true; 22 | $result = $rpc->sstats(); 23 | 24 | $individualPath = Database::getTorrentDownloadPath($id); 25 | if ( ! empty($individualPath)) 26 | $pathToDownload = $individualPath; 27 | 28 | if ( ! empty($hash)) 29 | { 30 | $delOpt = 'false'; 31 | if ($tracker == 'lostfilm.tv' || $tracker == 'lostfilm-mirror' || $tracker == 'baibako.tv' || $tracker == 'newstudio.tv') 32 | { 33 | if ($deleteOldFiles) 34 | $delOpt = 'true'; 35 | #удяляем существующую закачку из torrent-клиента 36 | if ($deleteDistribution) 37 | $result = $rpc->remove($hash, $delOpt); 38 | } 39 | else 40 | { 41 | #удяляем существующую закачку из torrent-клиента 42 | $result = $rpc->remove($hash, $delOpt); 43 | } 44 | } 45 | 46 | #добавляем торрент в torrent-клиент 47 | $result = $rpc->add($file, $pathToDownload); 48 | 49 | if (isset($result->arguments->torrent_added)) 50 | { 51 | $hashNew = $result->arguments->torrent_added->hashString; 52 | #обновляем hash в базе 53 | Database::updateHash($id, $hashNew); 54 | 55 | //сбрасываем варнинг 56 | Database::clearWarnings('Transmission'); 57 | $return['status'] = TRUE; 58 | $return['hash'] = $hashNew; 59 | } 60 | elseif (isset($result->arguments->torrent_duplicate)) 61 | { 62 | $hashNew = $result->arguments->torrent_duplicate->hashString; 63 | #обновляем hash в базе 64 | Database::updateHash($id, $hashNew); 65 | 66 | //сбрасываем варнинг 67 | Database::clearWarnings('Transmission'); 68 | $return['status'] = TRUE; 69 | $return['hash'] = $hashNew; 70 | } 71 | elseif (preg_match('/invalid or corrupt torrent file/i', $result->result)) 72 | { 73 | $return['status'] = FALSE; 74 | $return['msg'] = 'torrent_file_fail'; 75 | } 76 | elseif (preg_match('/http error 0: No Response/i', $result->result)) 77 | { 78 | $return['status'] = FALSE; 79 | $return['msg'] = 'no_response'; 80 | } 81 | else 82 | { 83 | $return['status'] = FALSE; 84 | $return['msg'] = 'unknown'; 85 | } 86 | } 87 | catch (Exception $e) 88 | { 89 | if (preg_match('/Invalid username\/password\./', $e->getMessage())) 90 | { 91 | $return['status'] = FALSE; 92 | $return['msg'] = 'log_passwd'; 93 | } 94 | elseif (preg_match('/Unable to connect to/U', $e->getMessage())) 95 | { 96 | $return['status'] = FALSE; 97 | $return['msg'] = 'connect_fail'; 98 | } 99 | else 100 | { 101 | $return['status'] = FALSE; 102 | $return['msg'] = 'unknown'; 103 | echo '[ERROR]'.$e->getMessage().PHP_EOL; 104 | } 105 | } 106 | return $return; 107 | } 108 | } 109 | ?> -------------------------------------------------------------------------------- /class/Url.class.php: -------------------------------------------------------------------------------- 1 | $tracker, 11 | 'name' => $name, 12 | 'id' => $torrent_id, 13 | 'url' => '', 14 | 'quality' => false, 15 | ]; 16 | 17 | if ($torrent_id) { 18 | $data['url'] = '' . $name . ''; 19 | } 20 | elseif (in_array($tracker, self::$strackerslf)) 21 | { 22 | $data['url'] = '' . $name . ''; 23 | if ($hd == 1) { 24 | $data['quality'] = '1080'; 25 | } elseif ($hd == 2) { 26 | $data['quality'] = '720'; 27 | } else { 28 | $data['quality'] = 'sd'; 29 | } 30 | } 31 | elseif (in_array($tracker, self::$strackers)) 32 | { 33 | $data['url'] = $name; 34 | if ($hd == 1) { 35 | $data['quality'] = '720'; 36 | } elseif ($hd == 2) { 37 | $data['quality'] = '1080'; 38 | } else { 39 | $data['quality'] = 'sd'; 40 | } 41 | } 42 | 43 | return $data; 44 | } 45 | 46 | public static function href($tracker, $torrent_id) 47 | { 48 | $url = ''; 49 | if ($tracker == 'rutracker.org' || $tracker == 'nnmclub.to' || $tracker == 'tfile.cc' || $tracker == 'pornolab.net' || $tracker == 'rustorka.com') 50 | { 51 | $url = 'http' . (($tracker == 'nnmclub.to' or $tracker == 'rutracker.org') ? 's' : '') .'://' . $tracker . '/forum/viewtopic.php?t=' . $torrent_id; 52 | } 53 | elseif ($tracker == 'casstudio.tk' || $tracker == 'booktracker.org') 54 | { 55 | $url = 'http://' . $tracker . '/viewtopic.php?t=' . $torrent_id; 56 | } 57 | elseif ($tracker == 'kinozal.me' || $tracker == 'kinozal.tv' || $tracker == 'kinozal.guru') 58 | { 59 | $url = 'http://' . $tracker . '/details.php?id=' . $torrent_id; 60 | } 61 | elseif ($tracker == 'animelayer.ru' || $tracker == 'rutor.is') 62 | { 63 | $url = 'http://' . $tracker . '/torrent/' . $torrent_id; 64 | } 65 | elseif ($tracker == 'anidub.com') 66 | { 67 | $url = 'https://tr.anidub.com/' . $torrent_id; 68 | } 69 | elseif ($tracker == 'riperam.org') 70 | { 71 | $url = 'http://riperam.org' . $torrent_id; 72 | } 73 | elseif ($tracker == 'baibako.tv_forum') 74 | { 75 | $url = 'http://baibako.tv/details.php?id=' . $torrent_id; 76 | } 77 | 78 | 79 | return $url; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /class/qBittorrent.class.php: -------------------------------------------------------------------------------- 1 | $torrentLogin, 'password' => $torrentPassword); 18 | 19 | //Авторизация 20 | $MainCurl = curl_init(); 21 | curl_setopt_array($MainCurl, array( 22 | CURLOPT_URL => $torrentAddress."/api/v2/auth/login", 23 | CURLOPT_USERAGENT => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:51.0) Gecko/20100101 Firefox/51.0", 24 | CURLOPT_RETURNTRANSFER => true, 25 | CURLOPT_POST => true, 26 | CURLOPT_VERBOSE => true, 27 | CURLOPT_HEADER => true, 28 | CURLOPT_POSTFIELDS => http_build_query($data) 29 | )); 30 | 31 | $response=curl_exec($MainCurl); 32 | 33 | preg_match_all("/SID=(.*?);/", $response, $match); 34 | $cookie = "SID=".$match[1][0]; 35 | curl_setopt($MainCurl, CURLOPT_COOKIE, $cookie); 36 | curl_setopt($MainCurl, CURLOPT_HEADER, false); 37 | 38 | if ( ! empty($hash)) 39 | { 40 | $data = array( 41 | 'hashes' => $hash, 42 | 'deleteFiles' => 'false' 43 | ); 44 | curl_setopt($MainCurl, CURLOPT_URL, $torrentAddress."/api/v2/torrents/delete"); 45 | curl_setopt($MainCurl, CURLOPT_POSTFIELDS, http_build_query($data)); 46 | 47 | if ($tracker == 'lostfilm.tv' || $tracker == 'lostfilm-mirror' || $tracker == 'baibako.tv' || $tracker == 'newstudio.tv') 48 | { 49 | if ($deleteOldFiles) 50 | $data['deleteFiles'] = 'true'; 51 | #удяляем существующую закачку из torrent-клиента 52 | if ($deleteDistribution) 53 | curl_exec($MainCurl); 54 | } 55 | else 56 | { 57 | #удяляем существующую закачку из torrent-клиента 58 | curl_exec($MainCurl); 59 | } 60 | } 61 | 62 | //Формируется тело запроса 63 | $data = array( 64 | 'urls' => $file, 65 | 'autoTMM' => true, 66 | 'savepath' => $pathToDownload, 67 | 'root_folder' => true, 68 | ); 69 | 70 | //формируется заголовок запроса 71 | $request_headers = array( 72 | "Cookie: ".$cookie 73 | ); 74 | 75 | $ch = curl_init(); 76 | curl_setopt_array($ch, array( 77 | CURLOPT_URL => $torrentAddress."/api/v2/torrents/add", 78 | CURLOPT_RETURNTRANSFER => true, 79 | CURLOPT_POST => true, 80 | CURLOPT_VERBOSE => true, 81 | CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, 82 | CURLOPT_HTTPHEADER => $request_headers, 83 | CURLOPT_COOKIE => $cookie, 84 | CURLOPT_POSTFIELDS => $data 85 | )); 86 | $response = curl_exec($ch); 87 | curl_close($ch); 88 | 89 | if (preg_match('/Ok/', $response)) { 90 | sleep(3); 91 | 92 | //получение хэша торрента 93 | $data = array( 94 | 'filter' => 'all', 95 | 'limit' => '1', 96 | 'sort' => 'added_on', 97 | 'reverse' => 'true' 98 | ); 99 | curl_setopt($MainCurl, CURLOPT_URL, $torrentAddress."/api/v2/torrents/info"); 100 | curl_setopt($MainCurl, CURLOPT_POSTFIELDS, http_build_query($data)); 101 | $response = curl_exec($MainCurl); 102 | $rdata = json_decode($response)[0]; 103 | $hashNew = $rdata->hash; 104 | 105 | #обновляем hash в базе 106 | Database::updateHash($id, $hashNew); 107 | 108 | //сбрасываем варнинг 109 | Database::clearWarnings('qBittorrent'); 110 | $return['status'] = TRUE; 111 | $return['hash'] = $hashNew; 112 | } else { 113 | $return['status'] = FALSE; 114 | $return['msg'] = 'add_fail'; 115 | } 116 | 117 | //выход 118 | curl_setopt($MainCurl, CURLOPT_URL, $torrentAddress."/api/v2/auth/logout"); 119 | curl_exec($MainCurl); 120 | curl_close($MainCurl); 121 | 122 | return $return; 123 | } 124 | } 125 | ?> 126 | -------------------------------------------------------------------------------- /config.php.example: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | 17 | -------------------------------------------------------------------------------- /db_schema/mysql.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS `buffer`; 2 | 3 | CREATE TABLE `buffer` ( 4 | `id` int(11) unsigned NOT NULL AUTO_INCREMENT, 5 | `user_id` int(11) unsigned NOT NULL, 6 | `section` varchar(60) NOT NULL DEFAULT '', 7 | `threme_id` int(11) unsigned NOT NULL, 8 | `threme` varchar(500) NOT NULL DEFAULT '', 9 | `timestamp` date NOT NULL DEFAULT '2000-01-01', 10 | `accept` tinyint(1) unsigned NOT NULL DEFAULT '0', 11 | `downloaded` tinyint(1) unsigned NOT NULL DEFAULT '0', 12 | `new` tinyint(1) unsigned NOT NULL DEFAULT '1', 13 | `tracker` varchar(20) DEFAULT NULL, 14 | PRIMARY KEY (`id`) 15 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 16 | 17 | 18 | DROP TABLE IF EXISTS `credentials`; 19 | 20 | CREATE TABLE `credentials` ( 21 | `id` int(11) NOT NULL AUTO_INCREMENT, 22 | `tracker` varchar(30) DEFAULT NULL, 23 | `log` varchar(30) DEFAULT NULL, 24 | `pass` varchar(100) DEFAULT NULL, 25 | `cookie` varchar(255) DEFAULT NULL, 26 | `passkey` varchar(32) DEFAULT NULL, 27 | `type` varchar(32) DEFAULT NULL, 28 | `necessarily` tinyint(1) NOT NULL DEFAULT '1', 29 | PRIMARY KEY (`id`) 30 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 31 | 32 | LOCK TABLES `credentials` WRITE; 33 | 34 | INSERT INTO `credentials` (`id`, `tracker`, `log`, `pass`, `cookie`, `passkey`, `type`, `necessarily`) 35 | VALUES 36 | (1,'rutracker.org','','','',NULL,'forum',1), 37 | (2,'nnmclub.to','','','',NULL,'forum',1), 38 | (3,'lostfilm.tv','','','',NULL,'RSS',1), 39 | (5,'rutor.is',' ',' ',NULL,NULL,'forum',0), 40 | (6,'tfile.cc',' ',' ',NULL,NULL,'forum',0), 41 | (7,'kinozal.me','','','',NULL,'forum',1), 42 | (8,'anidub.com','','','',NULL,'forum',1), 43 | (9,'casstudio.tk','','','',NULL,'forum',1), 44 | (10,'baibako.tv','','','',NULL,'RSS',1), 45 | (11,'newstudio.tv','','','',NULL,'RSS',1), 46 | (12,'animelayer.ru','','','',NULL,'forum',1), 47 | (14,'rustorka.com','','','',NULL,'forum',1), 48 | (15,'pornolab.net','','','',NULL,'forum',1), 49 | (16,'lostfilm-mirror',' ',' ',NULL,'','RSS',0), 50 | (17,'hamsterstudio.org','','','',NULL,'RSS',1), 51 | (19,'booktracker.org','','','',NULL,'forum',1), 52 | (20,'baibako.tv_forum','','','',NULL,'forum',1), 53 | (21,'riperam.org','','','',NULL,'forum',1), 54 | (22,'kinozal.tv','','','',NULL,'forum',1), 55 | (23,'kinozal.guru','','','',NULL,'forum',1); 56 | 57 | UNLOCK TABLES; 58 | 59 | 60 | DROP TABLE IF EXISTS `news`; 61 | 62 | CREATE TABLE `news` ( 63 | `id` int(11) unsigned NOT NULL AUTO_INCREMENT, 64 | `text` text, 65 | `new` tinyint(1) unsigned NOT NULL DEFAULT '1', 66 | PRIMARY KEY (`id`) 67 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 68 | 69 | 70 | DROP TABLE IF EXISTS `notifications`; 71 | 72 | CREATE TABLE `notifications` ( 73 | `id` int(3) unsigned NOT NULL AUTO_INCREMENT, 74 | `service` varchar(32) DEFAULT NULL, 75 | `address` varchar(100) DEFAULT NULL, 76 | `type` varchar(13) DEFAULT NULL, 77 | PRIMARY KEY (`id`) 78 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 79 | 80 | 81 | LOCK TABLES `notifications` WRITE; 82 | 83 | INSERT INTO `notifications` (`id`, `service`, `address`, `type`) 84 | VALUES 85 | (1,'E-mail','', 'notification'), 86 | (2,'E-mail','', 'warning'), 87 | (3,'Prowl','', 'notification'), 88 | (4,'Prowl','', 'warning'), 89 | (5,'Pushbullet','', 'notification'), 90 | (6,'Pushbullet','', 'warning'), 91 | (7,'Pushover','', 'notification'), 92 | (8,'Pushover','', 'warning'), 93 | (9,'Pushall','', 'notification'), 94 | (10,'Pushall','', 'warning'), 95 | (11,'Telegram','', 'notification'), 96 | (12,'Telegram','', 'warning'); 97 | 98 | UNLOCK TABLES; 99 | 100 | 101 | DROP TABLE IF EXISTS `settings`; 102 | 103 | CREATE TABLE `settings` ( 104 | `id` int(3) NOT NULL AUTO_INCREMENT, 105 | `key` varchar(32) NOT NULL, 106 | `val` varchar(100) NOT NULL, 107 | PRIMARY KEY (`id`) 108 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 109 | 110 | 111 | LOCK TABLES `settings` WRITE; 112 | 113 | INSERT INTO `settings` (`id`, `key`, `val`) 114 | VALUES 115 | (3,'send','0'), 116 | (4,'sendWarning','0'), 117 | (5,'password','1f10c9fd49952a7055531975c06c5bd8'), 118 | (6,'auth','1'), 119 | (7,'proxy','0'), 120 | (8,'proxyAddress','127.0.0.1:9050'), 121 | (9,'useTorrent','0'), 122 | (10,'torrentClient',''), 123 | (11,'torrentAddress','127.0.0.1:9091'), 124 | (12,'torrentLogin',''), 125 | (13,'torrentPassword',''), 126 | (14,'pathToDownload',''), 127 | (16,'deleteOldFiles','0'), 128 | (19,'serverAddress',''), 129 | (20,'deleteDistribution','0'), 130 | (24,'sendUpdate','0'), 131 | (25,'sendWarning','0'), 132 | (29,'debug','0'), 133 | (30,'rss','1'), 134 | (31,'debugFor',''), 135 | (32,'httpTimeout','15'), 136 | (33,'sendUpdateService',''), 137 | (35,'sendWarningService',''), 138 | (37,'proxyType',''), 139 | (38,'autoUpdate','0'), 140 | (39,'sentUpdateNotification','0'), 141 | (40,'userAgent','Mozilla/5.0 (X11; Linux x86_64; rv:133.0) Gecko/20100101 Firefox/133.0'); 142 | 143 | UNLOCK TABLES; 144 | 145 | 146 | DROP TABLE IF EXISTS `temp`; 147 | 148 | CREATE TABLE `temp` ( 149 | `id` int(11) unsigned NOT NULL, 150 | `name` varchar(200) DEFAULT NULL, 151 | `path` varchar(200) DEFAULT NULL, 152 | `tracker` varchar(30) DEFAULT NULL, 153 | `date` varchar(120) DEFAULT NULL, 154 | UNIQUE KEY `id` (`id`) 155 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 156 | 157 | 158 | DROP TABLE IF EXISTS `torrent`; 159 | 160 | CREATE TABLE `torrent` ( 161 | `id` int(11) NOT NULL AUTO_INCREMENT, 162 | `tracker` varchar(30) NOT NULL, 163 | `name` varchar(500) NOT NULL DEFAULT '', 164 | `hd` tinyint(1) unsigned NOT NULL DEFAULT '0', 165 | `path` varchar(200) DEFAULT NULL, 166 | `torrent_id` varchar(150) DEFAULT NULL, 167 | `ep` varchar(10) DEFAULT '', 168 | `timestamp` datetime NOT NULL DEFAULT '2000-01-01 00:00:00', 169 | `auto_update` tinyint(11) unsigned NOT NULL DEFAULT '0', 170 | `hash` varchar(40) NOT NULL DEFAULT '', 171 | `script` varchar(100) DEFAULT NULL, 172 | `pause` int(1) unsigned NOT NULL DEFAULT '0', 173 | `error` int(1) unsigned NOT NULL DEFAULT '0', 174 | `closed` int(1) unsigned NOT NULL DEFAULT '0', 175 | PRIMARY KEY (`id`) 176 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 177 | 178 | 179 | DROP TABLE IF EXISTS `warning`; 180 | 181 | CREATE TABLE `warning` ( 182 | `id` int(11) NOT NULL AUTO_INCREMENT, 183 | `time` datetime NOT NULL DEFAULT '2000-01-01 00:00:00', 184 | `where` varchar(40) NOT NULL, 185 | `reason` varchar(200) NOT NULL, 186 | `t_id` int(11) DEFAULT NULL, 187 | PRIMARY KEY (`id`) 188 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 189 | 190 | 191 | DROP TABLE IF EXISTS `watch`; 192 | 193 | CREATE TABLE `watch` ( 194 | `id` int(11) unsigned NOT NULL AUTO_INCREMENT, 195 | `tracker` varchar(30) NOT NULL DEFAULT '', 196 | `name` varchar(30) NOT NULL DEFAULT '', 197 | PRIMARY KEY (`id`) 198 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 199 | -------------------------------------------------------------------------------- /db_schema/postgresql.sql: -------------------------------------------------------------------------------- 1 | CREATE SEQUENCE auto_id_buffer; 2 | 3 | CREATE TABLE "buffer" ( 4 | "id" INTEGER PRIMARY KEY NOT NULL DEFAULT nextval('auto_id_buffer'), 5 | "user_id" INTEGER NOT NULL, 6 | "section" varchar(60) NOT NULL DEFAULT '', 7 | "threme_id" INTEGER NOT NULL, 8 | "threme" varchar(250) NOT NULL DEFAULT '', 9 | "timestamp" timestamp, 10 | "accept" INTEGER NOT NULL DEFAULT '0', 11 | "downloaded" INTEGER NOT NULL DEFAULT '0', 12 | "new" INTEGER NOT NULL DEFAULT '1', 13 | "tracker" varchar(20) DEFAULT NULL 14 | ); 15 | 16 | 17 | CREATE SEQUENCE "auto_id_credentials" START 16; 18 | 19 | CREATE TABLE "credentials" ( 20 | "id" INTEGER PRIMARY KEY NOT NULL DEFAULT nextval('auto_id_credentials'), 21 | "tracker" varchar(30) DEFAULT NULL, 22 | "log" varchar(30) DEFAULT NULL, 23 | "pass" varchar(100) DEFAULT NULL, 24 | "cookie" varchar(255) DEFAULT NULL, 25 | "passkey" varchar(255) DEFAULT NULL, 26 | "type" varchar(32) DEFAULT NULL, 27 | "necessarily" INTEGER NOT NULL DEFAULT '1' 28 | ); 29 | 30 | INSERT INTO credentials VALUES (1, 'rutracker.org', '', '', '', '','forum',1); 31 | INSERT INTO credentials VALUES (2, 'nnmclub.to', '', '', '', '','forum',1); 32 | INSERT INTO credentials VALUES (3, 'lostfilm.tv', '', '', '', '','RSS',1); 33 | INSERT INTO credentials VALUES (5, 'rutor.is', ' ', ' ', '', '','forum',0); 34 | INSERT INTO credentials VALUES (6, 'tfile.cc', ' ', ' ', '', '','forum',0); 35 | INSERT INTO credentials VALUES (7, 'kinozal.me', '', '', '', '','forum',1); 36 | INSERT INTO credentials VALUES (8, 'anidub.com', '', '', '', '','forum',1); 37 | INSERT INTO credentials VALUES (9, 'baibako.tv', '', '', '', '','RSS',1); 38 | INSERT INTO credentials VALUES (10,'casstudio.tk', '', '','', '','forum',1); 39 | INSERT INTO credentials VALUES (11,'newstudio.tv', '', '','', '','RSS',1); 40 | INSERT INTO credentials VALUES (12,'animelayer.ru', '', '','', '','forum',1); 41 | INSERT INTO credentials VALUES (14,'rustorka.com','','','', '','forum',1); 42 | INSERT INTO credentials VALUES (15,'pornolab.net','','','', '','forum',1); 43 | INSERT INTO credentials VALUES (16,'lostfilm-mirror',' ',' ','', '','RSS',0); 44 | INSERT INTO credentials VALUES (17,'hamsterstudio.org','','','', '','RSS',1); 45 | INSERT INTO credentials VALUES (19,'booktracker.org','','','', '','forum',1); 46 | INSERT INTO credentials VALUES (20,'baibako.tv_forum','','','', '','forum',1); 47 | INSERT INTO credentials VALUES (21,'riperam.org','','','', '','forum',1); 48 | INSERT INTO credentials VALUES (22,'kinozal.tv','','','', '','forum',1); 49 | INSERT INTO credentials VALUES (23,'kinozal.guru','','','', '','forum',1); 50 | 51 | CREATE SEQUENCE "auto_id_news" START 22; 52 | 53 | CREATE TABLE "news" ( 54 | "id" INTEGER PRIMARY KEY NOT NULL DEFAULT nextval('auto_id_news'), 55 | "text" TEXT NOT NULL, 56 | "new" INTEGER NOT NULL DEFAULT '1' 57 | ); 58 | 59 | 60 | CREATE SEQUENCE "auto_id_notifications" START 1; 61 | 62 | CREATE TABLE "notifications" ( 63 | "id" INTEGER PRIMARY KEY NOT NULL DEFAULT nextval('auto_id_notifications'), 64 | "service" varchar(32) NOT NULL, 65 | "address" varchar(100) NOT NULL, 66 | "type" varchar(13) NOT NULL 67 | ); 68 | 69 | INSERT INTO notifications VALUES (1, 'E-mail', '', 'notification'); 70 | INSERT INTO notifications VALUES (2, 'E-mail', '', 'warning'); 71 | INSERT INTO notifications VALUES (3, 'Prowl', '', 'notification'); 72 | INSERT INTO notifications VALUES (4, 'Prowl', '', 'warning'); 73 | INSERT INTO notifications VALUES (5, 'Pushbullet', '', 'notification'); 74 | INSERT INTO notifications VALUES (6, 'Pushbullet', '', 'warning'); 75 | INSERT INTO notifications VALUES (7, 'Pushover', '', 'notification'); 76 | INSERT INTO notifications VALUES (8, 'Pushover', '', 'warning'); 77 | INSERT INTO notifications VALUES (9, 'Pushall', '', 'notification'); 78 | INSERT INTO notifications VALUES (10, 'Pushall', '', 'warning'); 79 | INSERT INTO notifications VALUES (11, 'Telegram', '', 'notification'); 80 | INSERT INTO notifications VALUES (12, 'Telegram', '', 'warning'); 81 | 82 | CREATE SEQUENCE "auto_id_settings" START 17; 83 | 84 | CREATE TABLE "settings" ( 85 | "id" INTEGER PRIMARY KEY NOT NULL DEFAULT nextval('auto_id_settings'), 86 | "key" varchar(32) NOT NULL, 87 | "val" varchar(100) NOT NULL 88 | ); 89 | 90 | INSERT INTO settings VALUES (3, 'send', '0'); 91 | INSERT INTO settings VALUES (4, 'sendWarning', '0'); 92 | INSERT INTO settings VALUES (5, 'password', '1f10c9fd49952a7055531975c06c5bd8'); 93 | INSERT INTO settings VALUES (6, 'auth', '1'); 94 | INSERT INTO settings VALUES (7, 'proxy', '0'); 95 | INSERT INTO settings VALUES (8, 'proxyAddress', '127.0.0.1:9050'); 96 | INSERT INTO settings VALUES (9, 'useTorrent', '0'); 97 | INSERT INTO settings VALUES (10, 'torrentClient', ''); 98 | INSERT INTO settings VALUES (11, 'torrentAddress', '127.0.0.1:9091'); 99 | INSERT INTO settings VALUES (12, 'torrentLogin', ''); 100 | INSERT INTO settings VALUES (13, 'torrentPassword', ''); 101 | INSERT INTO settings VALUES (14, 'pathToDownload', ''); 102 | INSERT INTO settings VALUES (16, 'deleteOldFiles', '0'); 103 | INSERT INTO settings VALUES (19, 'serverAddress', ''); 104 | INSERT INTO settings VALUES (20, 'deleteDistribution', '0'); 105 | INSERT INTO settings VALUES (24, 'sendUpdate', '0'); 106 | INSERT INTO settings VALUES (25, 'sendWarning', '0'); 107 | INSERT INTO settings VALUES (29, 'debug', '0'); 108 | INSERT INTO settings VALUES (30, 'rss', '1'); 109 | INSERT INTO settings VALUES (31, 'debugFor', ''); 110 | INSERT INTO settings VALUES (32, 'httpTimeout', '15'); 111 | INSERT INTO settings VALUES (33, 'sendUpdateService', ''); 112 | INSERT INTO settings VALUES (35, 'sendWarningService', ''); 113 | INSERT INTO settings VALUES (37, 'proxyType', ''); 114 | INSERT INTO settings VALUES (38, 'autoUpdate', '0'); 115 | INSERT INTO settings VALUES (39, 'sentUpdateNotification', '0'); 116 | INSERT INTO settings VALUES (40, 'userAgent', 'Mozilla/5.0 (X11; Linux x86_64; rv:133.0) Gecko/20100101 Firefox/133.0'); 117 | 118 | CREATE TABLE "temp" ( 119 | "id" INTEGER PRIMARY KEY NOT NULL, 120 | "name" varchar(200) DEFAULT NULL, 121 | "path" varchar(200) DEFAULT NULL, 122 | "tracker" varchar(30) DEFAULT NULL, 123 | "date" varchar(120) DEFAULT NULL, 124 | UNIQUE(id) 125 | ); 126 | 127 | 128 | CREATE SEQUENCE auto_id_torrent; 129 | 130 | CREATE TABLE "torrent" ( 131 | "id" INTEGER PRIMARY KEY NOT NULL DEFAULT nextval('auto_id_torrent'), 132 | "tracker" varchar(30) NOT NULL, 133 | "name" varchar(500) NOT NULL DEFAULT '', 134 | "hd" INTEGER NOT NULL DEFAULT '0', 135 | "path" varchar(200) NOT NULL, 136 | "torrent_id" varchar(150) NOT NULL DEFAULT '', 137 | "ep" varchar(10) DEFAULT '', 138 | "timestamp" timestamp, 139 | "auto_update" INTEGER NOT NULL DEFAULT '0', 140 | "hash" varchar(40) NOT NULL DEFAULT '0', 141 | "script" varchar(100) NOT NULL DEFAULT '0', 142 | "pause" INTEGER NOT NULL DEFAULT '0', 143 | "error" INTEGER NOT NULL DEFAULT '0', 144 | "closed" INTEGER NOT NULL DEFAULT '0' 145 | ); 146 | 147 | 148 | CREATE SEQUENCE auto_id_warning; 149 | 150 | CREATE TABLE "warning" ( 151 | "id" INTEGER PRIMARY KEY NOT NULL DEFAULT nextval('auto_id_warning'), 152 | "time" timestamp, 153 | "where" varchar(40) NOT NULL, 154 | "reason" varchar(200) NOT NULL, 155 | "t_id" INTEGER DEFAULT NULL 156 | ); 157 | 158 | 159 | CREATE SEQUENCE auto_id_watch; 160 | 161 | CREATE TABLE "watch" ( 162 | "id" INTEGER PRIMARY KEY NOT NULL DEFAULT nextval('auto_id_watch'), 163 | "tracker" varchar(30) NOT NULL DEFAULT '', 164 | "name" varchar(30) NOT NULL DEFAULT '' 165 | ); 166 | -------------------------------------------------------------------------------- /db_schema/sqlite.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE `buffer` ( 2 | `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 3 | `user_id` INTEGER NOT NULL, 4 | `section` varchar(60) NOT NULL DEFAULT '', 5 | `threme_id` INTEGER NOT NULL, 6 | `threme` varchar(250) NOT NULL DEFAULT '', 7 | `timestamp` date NOT NULL DEFAULT '0000-00-00', 8 | `accept` INTEGER NOT NULL DEFAULT '0', 9 | `downloaded` INTEGER NOT NULL DEFAULT '0', 10 | `new` INTEGER NOT NULL DEFAULT '1', 11 | `tracker` varchar(20) DEFAULT NULL 12 | ); 13 | 14 | CREATE TABLE `credentials` ( 15 | `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 16 | `tracker` varchar(30) DEFAULT NULL, 17 | `log` varchar(30) DEFAULT NULL, 18 | `pass` varchar(100) DEFAULT NULL, 19 | `cookie` varchar(255) DEFAULT NULL, 20 | `passkey` varchar(255) DEFAULT NULL, 21 | `type` varchar(32) DEFAULT NULL, 22 | `necessarily` INTEGER NOT NULL DEFAULT '1' 23 | ); 24 | 25 | INSERT INTO "credentials" VALUES (1, 'rutracker.org', '', '', '', '','forum',1); 26 | INSERT INTO "credentials" VALUES (2, 'nnmclub.to', '', '', '', '','forum',1); 27 | INSERT INTO "credentials" VALUES (3, 'lostfilm.tv', '', '', '', '','RSS',1); 28 | INSERT INTO "credentials" VALUES (5, 'rutor.is', ' ', ' ', '', '','forum',0); 29 | INSERT INTO "credentials" VALUES (6, 'tfile.cc', ' ', ' ', '', '','forum',0); 30 | INSERT INTO "credentials" VALUES (7, 'kinozal.me', '', '', '', '','forum',1); 31 | INSERT INTO "credentials" VALUES (8, 'anidub.com', '', '', '', '','forum',1); 32 | INSERT INTO "credentials" VALUES (9, 'baibako.tv', '', '', '', '','RSS',1); 33 | INSERT INTO "credentials" VALUES (10,'casstudio.tk', '', '','', '','forum',1); 34 | INSERT INTO "credentials" VALUES (11,'newstudio.tv', '', '','', '','RSS',1); 35 | INSERT INTO "credentials" VALUES (12,'animelayer.ru', '', '','', '','forum',1); 36 | INSERT INTO "credentials" VALUES (14,'rustorka.com','','','', '','forum',1); 37 | INSERT INTO "credentials" VALUES (15,'pornolab.net','','','', '','forum',1); 38 | INSERT INTO "credentials" VALUES (16,'lostfilm-mirror',' ',' ','', '','RSS',0); 39 | INSERT INTO "credentials" VALUES (17,'hamsterstudio.org','','','', '','RSS',1); 40 | INSERT INTO "credentials" VALUES (19,'booktracker.org','','','', '','forum',1); 41 | INSERT INTO "credentials" VALUES (20,'baibako.tv_forum','','','', '','forum',1); 42 | INSERT INTO "credentials" VALUES (21,'riperam.org','','','', '','forum',1); 43 | INSERT INTO "credentials" VALUES (22,'kinozal.tv','','','', '','forum',1); 44 | INSERT INTO "credentials" VALUES (23,'kinozal.guru','','','', '','forum',1); 45 | 46 | CREATE TABLE `news` ( 47 | `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 48 | `text` TEXT, 49 | `new` INTEGER NOT NULL DEFAULT '1' 50 | ); 51 | 52 | CREATE TABLE `notifications` ( 53 | `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 54 | `service` varchar(32) NOT NULL, 55 | `address` varchar(100) NOT NULL, 56 | `type` varchar(13) NOT NULL 57 | ); 58 | 59 | INSERT INTO "notifications" VALUES(1,'E-mail','','notification'); 60 | INSERT INTO "notifications" VALUES(2,'E-mail','','warning'); 61 | INSERT INTO "notifications" VALUES(3,'Prowl','','notification'); 62 | INSERT INTO "notifications" VALUES(4,'Prowl','','warning'); 63 | INSERT INTO "notifications" VALUES(5,'Pushbullet','','notification'); 64 | INSERT INTO "notifications" VALUES(6,'Pushbullet','','warning'); 65 | INSERT INTO "notifications" VALUES(7,'Pushover','','notification'); 66 | INSERT INTO "notifications" VALUES(8,'Pushover','','warning'); 67 | INSERT INTO "notifications" VALUES(9,'Pushall','','notification'); 68 | INSERT INTO "notifications" VALUES(10,'Pushall','','warning'); 69 | INSERT INTO "notifications" VALUES(11,'Telegram','','notification'); 70 | INSERT INTO "notifications" VALUES(12,'Telegram','','warning'); 71 | 72 | CREATE TABLE `settings` ( 73 | `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 74 | `key` varchar(32) NOT NULL, 75 | `val` varchar(100) NOT NULL 76 | ); 77 | 78 | INSERT INTO "settings" VALUES (3, 'send', '0'); 79 | INSERT INTO "settings" VALUES (4, 'sendWarning', '0'); 80 | INSERT INTO "settings" VALUES (5, 'password', '1f10c9fd49952a7055531975c06c5bd8'); 81 | INSERT INTO "settings" VALUES (6, 'auth', '1'); 82 | INSERT INTO "settings" VALUES (7, 'proxy', '0'); 83 | INSERT INTO "settings" VALUES (8, 'proxyAddress', '127.0.0.1:9050'); 84 | INSERT INTO "settings" VALUES (9, 'useTorrent', '0'); 85 | INSERT INTO "settings" VALUES (10, 'torrentClient', ''); 86 | INSERT INTO "settings" VALUES (11, 'torrentAddress', '127.0.0.1:9091'); 87 | INSERT INTO "settings" VALUES (12, 'torrentLogin', ''); 88 | INSERT INTO "settings" VALUES (13, 'torrentPassword', ''); 89 | INSERT INTO "settings" VALUES (14, 'pathToDownload', ''); 90 | INSERT INTO "settings" VALUES (16, 'deleteOldFiles', '0'); 91 | INSERT INTO "settings" VALUES (19, 'serverAddress', ''); 92 | INSERT INTO "settings" VALUES (20, 'deleteDistribution', '0'); 93 | INSERT INTO "settings" VALUES (24, 'sendUpdate', '0'); 94 | INSERT INTO "settings" VALUES (25, 'sendWarning', '0'); 95 | INSERT INTO "settings" VALUES (29, 'debug', '0'); 96 | INSERT INTO "settings" VALUES (30, 'rss', '1'); 97 | INSERT INTO "settings" VALUES (31, 'debugFor', ''); 98 | INSERT INTO "settings" VALUES (32, 'httpTimeout', '15'); 99 | INSERT INTO "settings" VALUES (33, 'sendUpdateService', ''); 100 | INSERT INTO "settings" VALUES (35, 'sendWarningService', ''); 101 | INSERT INTO "settings" VALUES (37, 'proxyType', ''); 102 | INSERT INTO "settings" VALUES (38, 'autoUpdate', '0'); 103 | INSERT INTO "settings" VALUES (39, 'sentUpdateNotification', '0'); 104 | INSERT INTO "settings" VALUES (40, 'userAgent', 'Mozilla/5.0 (X11; Linux x86_64; rv:133.0) Gecko/20100101 Firefox/133.0'); 105 | 106 | CREATE TABLE `temp` ( 107 | `id` INTEGER NOT NULL, 108 | `name` varchar(200) NOT NULL DEFAULT '', 109 | `path` varchar(200) NOT NULL DEFAULT '', 110 | `tracker` varchar(30) NOT NULL DEFAULT '', 111 | `date` varchar(120) NOT NULL DEFAULT '', 112 | unique (id) 113 | ); 114 | 115 | CREATE TABLE `torrent` ( 116 | `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 117 | `tracker` varchar(30) NOT NULL, 118 | `name` varchar(500) NOT NULL DEFAULT '', 119 | `hd` INTEGER NOT NULL DEFAULT '0', 120 | `path` varchar(200) NOT NULL DEFAULT '', 121 | `torrent_id` varchar(150) NOT NULL DEFAULT '', 122 | `ep` varchar(10) DEFAULT '', 123 | `timestamp` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', 124 | `auto_update` INTEGER NOT NULL DEFAULT '0', 125 | `hash` varchar(40) NOT NULL DEFAULT '', 126 | `script` varchar(100) NOT NULL DEFAULT '', 127 | `pause` INTEGER NOT NULL DEFAULT '0', 128 | `error` INTEGER NOT NULL DEFAULT '0', 129 | `closed` INTEGER NOT NULL DEFAULT '0' 130 | ); 131 | 132 | CREATE TABLE `warning` ( 133 | `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 134 | `time` datetime NOT NULL, 135 | `where` varchar(40) NOT NULL, 136 | `reason` varchar(200) NOT NULL, 137 | `t_id` INTEGER DEFAULT NULL 138 | ); 139 | 140 | CREATE TABLE `watch` ( 141 | `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 142 | `tracker` varchar(30) NOT NULL DEFAULT '', 143 | `name` varchar(30) NOT NULL DEFAULT '' 144 | ); 145 | -------------------------------------------------------------------------------- /engine.php: -------------------------------------------------------------------------------- 1 | "; 27 | 28 | $time_start_full = microtime(true); 29 | if (Sys::checkCurl()) 30 | { 31 | $torrentsList = Database::getTorrentsList('name'); 32 | if ($torrentsList != NULL) 33 | $count = count($torrentsList); 34 | else 35 | $count = 0; 36 | 37 | echo getTimestamp(); 38 | echo 'Опрос новых раздач на трекерах:'.$NL; 39 | $time_start_overall = microtime(true); 40 | for ($i=0; $i<$count; $i++) 41 | { 42 | $tracker = $torrentsList[$i]['tracker']; 43 | if (Database::checkTrackersCredentialsExist($tracker)) 44 | { 45 | $engineFile = $dir.'trackers/'.$tracker.'.engine.php'; 46 | if (file_exists($engineFile)) 47 | { 48 | Database::clearWarnings('system'); 49 | 50 | $functionEngine = include_once $engineFile; 51 | $class = explode('.', $tracker); 52 | $class = $class[0]; 53 | $functionClass = str_replace('-', '', $class); 54 | 55 | if ($tracker == 'tracker.0day.kiev.ua') 56 | $functionClass = 'kiev'; 57 | 58 | if ($tracker == 'tv.mekc.info') 59 | $functionClass = 'mekc'; 60 | 61 | if ($tracker == 'baibako.tv_forum') 62 | $functionClass = 'baibako_f'; 63 | 64 | echo getTimestamp(); 65 | echo $torrentsList[$i]['name'].' на трекере '.$tracker.$NL; 66 | if ($torrentsList[$i]['pause']) 67 | { 68 | echo getTimestamp(); 69 | echo 'Наблюдение за данной темой приостановлено.'.$NL; 70 | continue; 71 | } 72 | if ($torrentsList[$i]['type'] == 'RSS') 73 | { 74 | $time_start = microtime(true); 75 | call_user_func($functionClass.'::main', $torrentsList[$i]); 76 | $time_end = microtime(true); 77 | $time = $time_end - $time_start; 78 | if ($debug) 79 | { 80 | echo getTimestamp(); 81 | echo 'Время выполнения: '.$time.$NL; 82 | } 83 | } 84 | if ($torrentsList[$i]['type'] == 'forum') 85 | { 86 | $time_start = microtime(true); 87 | call_user_func($functionClass.'::main', $torrentsList[$i]); 88 | $time_end = microtime(true); 89 | $time = $time_end - $time_start; 90 | if ($debug) 91 | { 92 | echo getTimestamp(); 93 | echo 'Время выполнения: '.$time.$NL; 94 | } 95 | } 96 | $functionClass = NULL; 97 | $functionEngine = NULL; 98 | } 99 | else 100 | Errors::setWarnings('system', 'missing_files'); 101 | } 102 | else 103 | Errors::setWarnings('system', 'credential_miss'); 104 | } 105 | $time_end_overall = microtime(true); 106 | $time = $time_end_overall - $time_start_overall; 107 | if ($debug) 108 | { 109 | echo getTimestamp(); 110 | echo 'Общее время опроса трекеров: '.$time.$NL; 111 | } 112 | 113 | echo getTimestamp(); 114 | echo 'Опрос новых раздач пользователей на трекерах:'.$NL; 115 | $time_start_overall = microtime(true); 116 | $usersList = Database::getUserToWatch(); 117 | if ( ! empty($usersList)) 118 | { 119 | $count = count($usersList); 120 | for ($i=0; $i<$count; $i++) 121 | { 122 | $tracker = $usersList[$i]['tracker']; 123 | if (Database::checkTrackersCredentialsExist($tracker)) 124 | { 125 | $serchFile = $dir.'trackers/'.$tracker.'.search.php'; 126 | if (file_exists($serchFile)) 127 | { 128 | Database::clearWarnings('system'); 129 | 130 | $functionEngine = include_once $serchFile; 131 | $class = explode('.', $tracker); 132 | $class = $class[0]; 133 | $class = str_replace('-', '', $class); 134 | $functionClass = $class.'Search'; 135 | echo getTimestamp(); 136 | echo 'Пользователь '.$usersList[$i]['name'].' на трекере '.$tracker.$NL; 137 | $time_start = microtime(true); 138 | call_user_func($functionClass .'::mainSearch', $usersList[$i]); 139 | $time_end = microtime(true); 140 | $time = $time_end - $time_start; 141 | if ($debug) 142 | { 143 | echo getTimestamp(); 144 | echo 'Время выполнения: '.$time.$NL; 145 | } 146 | 147 | $functionClass = NULL; 148 | $functionEngine = NULL; 149 | } 150 | else 151 | Errors::setWarnings('system', 'missing_files'); 152 | } 153 | else 154 | Errors::setWarnings('system', 'credential_miss'); 155 | } 156 | } 157 | $time_end_overall = microtime(true); 158 | $time = $time_end_overall - $time_start_overall; 159 | if ($debug) 160 | { 161 | echo getTimestamp(); 162 | echo 'Общее время опроса пользователей на трекерах: '.$time.$NL; 163 | } 164 | echo getTimestamp(); 165 | echo '=================='.$NL; 166 | echo getTimestamp(); 167 | echo 'Выполение служебных функций:'.$NL; 168 | echo getTimestamp(); 169 | echo 'Добавляем темы из Temp.'.$NL; 170 | $time_start = microtime(true); 171 | $tempList = Database::getAllFromTemp(); 172 | if ( ! empty($tempList)) 173 | { 174 | if (count($tempList) > 0) 175 | Sys::AddFromTemp($tempList); 176 | } 177 | $time_end = microtime(true); 178 | $time = $time_end - $time_start; 179 | if ($debug) 180 | { 181 | echo getTimestamp(); 182 | echo 'Время выполнения: '.$time.$NL; 183 | } 184 | echo getTimestamp(); 185 | echo 'Обновление новостей.'.$NL; 186 | $time_start = microtime(true); 187 | Sys::getNews(); 188 | $time_end = microtime(true); 189 | $time = $time_end - $time_start; 190 | if ($debug) 191 | { 192 | echo getTimestamp(); 193 | echo 'Время выполнения: '.$time.$NL; 194 | } 195 | echo getTimestamp(); 196 | echo 'Удаление старых torrent-файлов.'.$NL; 197 | Sys::deleteOldTorrents(); 198 | if ($autoUpdate) 199 | { 200 | echo getTimestamp(); 201 | echo 'Установка обновлений.'.$NL; 202 | include_once $dir.'class/Update.class.php'; 203 | Update::main(); 204 | } 205 | else 206 | { 207 | if (Sys::checkUpdate()) 208 | { 209 | if ( ! Database::getUpdateNotification()) 210 | { 211 | $msg = 'Выпущена новая версия ТМ, автоматическое обновление отключено, обновите систему самостоятельно.'; 212 | Notification::sendNotification('news', date('r'), 0, $msg, 0); 213 | Database::setUpdateNotification(1); 214 | } 215 | } 216 | } 217 | echo getTimestamp(); 218 | echo 'Запись времени последнего запуска ТМ.'.$NL; 219 | Sys::lastStart(); 220 | } 221 | else 222 | Errors::setWarnings('system', 'curl'); 223 | 224 | $time_end_full = microtime(true); 225 | $time = $time_end_full - $time_start_full; 226 | if ($debug) 227 | { 228 | echo getTimestamp(); 229 | echo 'Общее время работы скрипта: '.$time.$NL; 230 | } 231 | ?> -------------------------------------------------------------------------------- /img/anidub.com.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElizarovEugene/TorrentMonitor/8cb1cb0788ae88b4a1eeab30b102d89e3108ddc7/img/anidub.com.ico -------------------------------------------------------------------------------- /img/animelayer.ru.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElizarovEugene/TorrentMonitor/8cb1cb0788ae88b4a1eeab30b102d89e3108ddc7/img/animelayer.ru.ico -------------------------------------------------------------------------------- /img/baibako.tv.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElizarovEugene/TorrentMonitor/8cb1cb0788ae88b4a1eeab30b102d89e3108ddc7/img/baibako.tv.ico -------------------------------------------------------------------------------- /img/baibako.tv_forum.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElizarovEugene/TorrentMonitor/8cb1cb0788ae88b4a1eeab30b102d89e3108ddc7/img/baibako.tv_forum.ico -------------------------------------------------------------------------------- /img/booktracker.org.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElizarovEugene/TorrentMonitor/8cb1cb0788ae88b4a1eeab30b102d89e3108ddc7/img/booktracker.org.ico -------------------------------------------------------------------------------- /img/casstudio.tk.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElizarovEugene/TorrentMonitor/8cb1cb0788ae88b4a1eeab30b102d89e3108ddc7/img/casstudio.tk.ico -------------------------------------------------------------------------------- /img/favicon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /img/hamsterstudio.org.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElizarovEugene/TorrentMonitor/8cb1cb0788ae88b4a1eeab30b102d89e3108ddc7/img/hamsterstudio.org.ico -------------------------------------------------------------------------------- /img/kinozal.guru.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElizarovEugene/TorrentMonitor/8cb1cb0788ae88b4a1eeab30b102d89e3108ddc7/img/kinozal.guru.ico -------------------------------------------------------------------------------- /img/kinozal.me.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElizarovEugene/TorrentMonitor/8cb1cb0788ae88b4a1eeab30b102d89e3108ddc7/img/kinozal.me.ico -------------------------------------------------------------------------------- /img/kinozal.tv.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElizarovEugene/TorrentMonitor/8cb1cb0788ae88b4a1eeab30b102d89e3108ddc7/img/kinozal.tv.ico -------------------------------------------------------------------------------- /img/lostfilm-mirror.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElizarovEugene/TorrentMonitor/8cb1cb0788ae88b4a1eeab30b102d89e3108ddc7/img/lostfilm-mirror.ico -------------------------------------------------------------------------------- /img/lostfilm.tv.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElizarovEugene/TorrentMonitor/8cb1cb0788ae88b4a1eeab30b102d89e3108ddc7/img/lostfilm.tv.ico -------------------------------------------------------------------------------- /img/newstudio.tv.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElizarovEugene/TorrentMonitor/8cb1cb0788ae88b4a1eeab30b102d89e3108ddc7/img/newstudio.tv.ico -------------------------------------------------------------------------------- /img/nnmclub.to.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElizarovEugene/TorrentMonitor/8cb1cb0788ae88b4a1eeab30b102d89e3108ddc7/img/nnmclub.to.ico -------------------------------------------------------------------------------- /img/pornolab.net.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElizarovEugene/TorrentMonitor/8cb1cb0788ae88b4a1eeab30b102d89e3108ddc7/img/pornolab.net.ico -------------------------------------------------------------------------------- /img/riperam.org.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElizarovEugene/TorrentMonitor/8cb1cb0788ae88b4a1eeab30b102d89e3108ddc7/img/riperam.org.ico -------------------------------------------------------------------------------- /img/rustorka.com.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElizarovEugene/TorrentMonitor/8cb1cb0788ae88b4a1eeab30b102d89e3108ddc7/img/rustorka.com.ico -------------------------------------------------------------------------------- /img/rutor.is.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElizarovEugene/TorrentMonitor/8cb1cb0788ae88b4a1eeab30b102d89e3108ddc7/img/rutor.is.ico -------------------------------------------------------------------------------- /img/rutracker.org.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElizarovEugene/TorrentMonitor/8cb1cb0788ae88b4a1eeab30b102d89e3108ddc7/img/rutracker.org.ico -------------------------------------------------------------------------------- /img/tfile.cc.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElizarovEugene/TorrentMonitor/8cb1cb0788ae88b4a1eeab30b102d89e3108ddc7/img/tfile.cc.ico -------------------------------------------------------------------------------- /include/check.php: -------------------------------------------------------------------------------- 1 | 10 |
11 |
Тестирование
12 |
13 | 14 |
15 |
Основные настройки
16 | 17 | 18 |
Подключение к интернету установлено.
19 | 20 |
Отсутствует подключение к интернету.
21 | 22 | 23 | 24 |
Конфигурационный файл существует.
25 | 26 |
Для корректной работы необходимо внести изменения в конфигурационный файл.
27 | 28 | 29 | 30 |
Расширение cURL установлено.
31 | 32 |
Для работы системы необходимо включить расширение cURL.
33 | 34 | 35 | 38 |
Запись в директорию для torrent-файлов разрешена.
39 | 40 |
Запись в директорию для torrent-файлов запрещена.
41 | 42 | 43 | 46 |
Запись в системную директорию разрешена.
47 | 48 |
Запись в системную директорию запрещена.
49 | 50 | 51 |
52 |
53 |
Настройки трекеров
54 | 55 | 60 |
61 | 63 |
Основной файл для работы с трекером найден.
64 | 65 |
Основной файл для работы с трекером не найден.
66 | 67 | 68 | 70 |
Дополнительный файл для работы с трекером найден.
71 | 72 |
Дополнительный файл для работы с трекером не найден.
73 | 76 | 77 | 78 |
Учётные данные для работы с трекером не требуются.
79 | 80 |
Учётные данные для работы с трекером найдены.
81 | 82 |
Учётные данные для работы с трекером не найдены.
83 | 84 | 85 | 103 |
Трекер доступен.
104 | 105 |
Трекер не доступен.
106 | 108 | 109 |
110 | -------------------------------------------------------------------------------- /include/credentials.php: -------------------------------------------------------------------------------- 1 | 12 |
13 |
Учётные данные
14 |
15 | 16 |
17 | 18 | 29 | 30 |
31 |
Учётные данные не требуются.
32 |
33 |
34 | 35 | 41 | 47 | 48 | 56 | 57 |
58 |
59 |
60 | 61 |
62 |
63 |
64 |
65 |
66 | 67 |
68 | -------------------------------------------------------------------------------- /include/execution.php: -------------------------------------------------------------------------------- 1 | 9 |
10 |
Запуск
11 |
12 |
13 | 14 |
15 | -------------------------------------------------------------------------------- /include/help.php: -------------------------------------------------------------------------------- 1 | 9 | 10 |
11 |
Справка
12 |
13 | 14 |
15 |
16 | 17 | array( 20 | 'timeout' => 1 21 | ) 22 | )); 23 | $xmlstr = @file_get_contents('http://xml.tormon.ru/help.xml', false, $opts); 24 | $xml = @simplexml_load_string($xmlstr); 25 | if (false !== $xml) 26 | { 27 | ?> 28 |
35 |
36 |
Помощь
37 |
help ?>
38 |
39 |
40 |
О проекте
41 |
about ?>
42 |
43 |
44 |
Разработчики
45 |
developers ?>
46 |
47 |
48 | 53 |
Не удалось загрузить файл help.xml
54 | 57 |
58 | 64 |
65 | -------------------------------------------------------------------------------- /include/news.php: -------------------------------------------------------------------------------- 1 | 9 | 10 |
11 |
Новости
12 |
13 | 14 | 21 |
24 | 25 |
26 | 25 | 26 |
Нет тем для мониторинга
27 | 28 | 29 | 30 |
31 | 32 | 33 | 34 |
35 | 39 |
40 | 44 | 48 |
49 |
50 | 51 |
52 | 59 | 60 | 61 |
69 | 70 |
71 |
72 |
73 | 74 |
75 | 76 |
77 | 78 |
79 | 80 |
81 | 82 |
83 | 84 | 85 |
86 | 87 | 88 |
Есть ошибки
89 | 90 | 91 |
Тема закрыта
92 | 93 |
94 | 95 |
96 | 97 | 98 |
99 |
100 |
101 | 102 | 103 |
104 |
105 | 106 | '.$date_update.''; 114 | else 115 | echo $date_update; 116 | ?> 117 | 118 |
119 | 120 |
121 | 122 |
123 | 124 | 125 | 126 |
127 | 128 | 129 |
130 | 131 |
132 | 133 | 134 |
135 | 136 | 137 |
Есть ошибки
138 | 139 | 140 |
Тема закрыта
141 | 142 |
143 | 144 |
145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 |
153 | 154 | 155 |
160 |
Правда удалить?
161 |
162 | 163 |
164 | 165 |
166 |
167 |
168 | 169 |
170 | 171 | 172 | 173 |
174 | 175 | -------------------------------------------------------------------------------- /include/show_warnings.php: -------------------------------------------------------------------------------- 1 | 12 | 13 |
14 |
Ошибки
15 |
16 | 17 | $tracker) { 22 | $errors = Database::getWarningsList($tracker['where']); 23 | if ($errors != NULL) { 24 | $groups = []; 25 | foreach ($errors as $error) { 26 | $key = $error['reason']; 27 | if (!isset($groups[$key])) { 28 | $groups[$key] = [ 29 | 'errors' => [$error], 30 | 'count' => 1, 31 | ]; 32 | } else { 33 | $groups[$key]['errors'][] = $error; 34 | $groups[$key]['count'] += 1; 35 | } 36 | } 37 | $tracker['errors'] = $groups; 38 | } ?> 39 | 40 |
47 |
48 | Ошибки:  49 | 50 |
51 | 52 | $errors) { ?> 53 |
58 |
59 | () 60 | 61 |
62 |
63 | 66 |
67 |
68 |
69 |
70 |
71 | 72 | 75 |
Раздача: 76 | 77 |
78 |
79 |
80 | 81 |
82 |
83 | 84 |
85 |
86 | 87 | 88 | 89 |
90 | 91 | 11 | 12 |
Нет пользователей для мониторинга
13 | 14 | 15 |
16 |
17 |
18 | 24 |
25 |
26 |
27 | 28 | 29 |
34 |
Пометить темы как просмотренные?
35 |
36 | 37 | 38 |
39 |
40 |
41 | 42 |
43 | 44 | 45 |
50 |
Правда удалить пользователя?
51 |
52 | 53 | 54 |
55 |
56 |
57 |
58 |
59 | 60 |
61 |
Выберите пользователя вверху
62 |
63 | 64 |
65 |
66 | -------------------------------------------------------------------------------- /include/show_watching_themes.php: -------------------------------------------------------------------------------- 1 | 0) { 14 | foreach ($themes as $item) { ?> 15 |
23 | 24 |
25 |
26 |
27 |
28 |
29 | 30 |
31 |
32 | 33 |
34 |
35 | 36 |
37 | 38 |
39 | 44 |
45 | 46 |
47 |
48 | 49 | 50 |
55 |
Скачать тему?
56 |
57 | 58 |
59 | 60 |
61 |
62 | 63 |
64 | 65 | 66 |
71 |
Добавить тему в мониторинг?
72 |
73 | 74 |
75 | 76 |
77 |
78 | 79 |
80 | 81 | 82 |
87 |
Правда удалить?
88 |
89 | 90 |
91 | 92 |
93 |
94 |
95 | 96 |
97 | 98 | 99 | 100 |
Выберите пользователя вверху
101 | 102 |
Все темы просмотрены, или их ещё нет.
103 | 104 | -------------------------------------------------------------------------------- /include/update.php: -------------------------------------------------------------------------------- 1 | 13 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pages/_modal-add.php: -------------------------------------------------------------------------------- 1 | 172 | -------------------------------------------------------------------------------- /pages/_modal-edit.php: -------------------------------------------------------------------------------- 1 | 77 | 78 | 79 | 167 | -------------------------------------------------------------------------------- /pages/_navigation.php: -------------------------------------------------------------------------------- 1 | 31 | -------------------------------------------------------------------------------- /pages/auth.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 7 |
8 | 9 |
10 | 11 |
12 | 13 |
14 | 15 |
16 |
Запомнить? 17 |
18 | 19 |
20 | 21 |
22 |
23 | 24 |
25 | Photo by Luca Bravo on Unsplash 26 |
27 |
28 | 29 | 52 | -------------------------------------------------------------------------------- /pages/footer.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /pages/header.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Мониторинг torrent трекеров 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /pages/main.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 0) { 20 | $errors_count = $errors['count']; 21 | } 22 | } 23 | 24 | $news = Database::getNewsCount(); 25 | $news_count = 0; 26 | if (! empty($news)) { 27 | if ($news['count'] > 0) { 28 | $news_count = $news['count']; 29 | } 30 | } 31 | 32 | $lastStart = @file_get_contents(dirname(__FILE__).'/../laststart.txt'); 33 | if (! empty($lastStart)) { 34 | $date = explode('-', $lastStart); 35 | $lastStartTime = $date[0].' '.Sys::dateNumToString($date[1]).' '.$date[2]; 36 | } else { 37 | $lastStartTime = 'Ещё не производилась.'; 38 | } 39 | ?> 40 | 41 | 42 |
43 | 44 |
45 | 46 |
47 |
48 | 53 | 57 |
58 | 59 |
60 | 61 |
62 |
63 | 64 |
65 | 66 | 79 | 80 | 81 |
82 |
83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 |
91 |
92 |
93 |
94 |
95 | 96 |
97 |
98 | 99 | 100 | 101 | 102 |
103 | 104 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # TorrentMonitor 2 | Приложение мониторит изменения на популярных торрент-трекерах рунета и автоматизирует закачку обновлений (сериалы, раздачи которые ведутся *путем добавления новых серий/новых версий*, перезалитые торрент-файлы и т.д.) 3 | 4 | ### Страница проекта: 5 | http://tormon.ru 6 | 7 | ### Список возможностей приложения: 8 | - Слежение за темами 9 | - anidub.com 10 | - animelayer.ru 11 | - baibako.tv 12 | - booktracker.org 13 | - casstudio.tv 14 | - hamsterstudio.org 15 | - kinozal.me 16 | - lostfilm.tv 17 | - newstudio.tv 18 | - nnmclub.to 19 | - pornolab.net 20 | - riperam.org 21 | - rustorka.com 22 | - rutor.info 23 | - rutracker.org 24 | - tfile.cc 25 | - Слежение за релизерами 26 | - booktracker.org 27 | - nnm-club.ru 28 | - pornolab.net 29 | - rutracker.org 30 | - tfile.me 31 | - Поиск новых серий (SD/HD 720/HD 1080 версии на выбор) 32 | - baibako.tv 33 | - hamsterstudio.org 34 | - lostfilm.tv (+ собственное заркало) 35 | - newstudio.tv 36 | - Работа через proxy (SOCKS5/HTTP) 37 | - Управление торрент-клиентами (добавление/удаление раздач и файлов) 38 | - Transmission (через XML-RPC) 39 | - Deluge (через deluge-console) 40 | - qBittorrent 41 | - Сервисы уведомлений: 42 | - E-mail 43 | - Prowl 44 | - Pushbullet 45 | - Pushover 46 | - Pushall 47 | - Telegram 48 | - RSS-лента 49 | - Выполенение собственных скриптов после обновления раздачи 50 | 51 | ### Требования для установки: 52 | * Веб-сервер (Apache, nginx, lighttpd) 53 | * PHP (5.2 или выше) с поддержкой cURL и PDO 54 | * MySQL, PostgreSQL, SQLite 55 | 56 | ### Docker hub: 57 | https://hub.docker.com/r/alfonder/torrentmonitor 58 | 59 | ### Скриншоты: 60 | ![Screenshot0](https://habrastorage.org/webt/yy/xq/2g/yyxq2gn8o5-b68zr-m_acdv78w8.png "Screenshot0") 61 | ![Screenshot1](https://habrastorage.org/webt/do/fl/cd/doflcdnaxhg4elpis4jyg30tzik.png "Screenshot1") 62 | ![Screenshot2](https://habrastorage.org/webt/ad/m5/tk/adm5tktyrelde8fur565aprrpia.png "Screenshot2") 63 | ![Screenshot3](https://habrastorage.org/webt/5v/9n/ww/5v9nww4n2ahujooewnichz3emoa.png "Screenshot3") 64 | ![Screenshot4](https://habrastorage.org/webt/qs/i7/y5/qsi7y53vb8qnl0y0ifcrxbcvv78.png "Screenshot4") 65 | ![Screenshot5](https://habrastorage.org/webt/nz/n9/zd/nzn9zdlnhje6blm7dsbk7nnzxnk.png "Screenshot5") 66 | ![Screenshot6](https://habrastorage.org/webt/ta/wl/pz/tawlpzlptcv1frusl8lv_tyyc-u.png "Screenshot6") 67 | 68 | 69 | -------------------------------------------------------------------------------- /rss/index.php: -------------------------------------------------------------------------------- 1 | formatOutput = true; // включаем форматирование документа 19 | 20 | // формируем корневой элемент ('rss') 21 | $root = $xml->appendChild($xml->createElement('rss')); 22 | $root->setAttribute('version','0.91'); 23 | 24 | // формируем элемент 'channel' 25 | $channel = $root->appendChild($xml->createElement('channel')); 26 | 27 | //////////////////////////////////// 28 | // Заполняем заголовок документа 29 | 30 | // формируем элемент 'title' 31 | $title = $channel->appendChild($xml->createElement('title')); 32 | $title->appendChild($xml->createTextNode('TorrentMonitor RSS')); 33 | 34 | // формируем элемент 'link' 35 | $link = $channel->appendChild($xml->createElement('link')); 36 | $link->appendChild($xml->createTextNode($url.'rss/')); 37 | 38 | // формируем элемент 'language' 39 | $language = $channel->appendChild($xml->createElement('language')); 40 | $language->appendChild($xml->createTextNode('ru')); 41 | 42 | //////////////////////////////////////////////////////////////////////// 43 | // Подготавливаем список *torrent файлов для заполнения тела докумена 44 | 45 | // формируем ассоциативный массив, где ключем выступает имя файла, а значением время изменения 46 | $torrentsList = array(); 47 | foreach (glob($dir.'torrents/*.torrent') as $torrentFile) 48 | { 49 | $fileName = basename($torrentFile); 50 | $timestam = filemtime($torrentFile); 51 | 52 | $torrentsList[$fileName] = $timestam; 53 | } 54 | 55 | // выполняем сортировку массива в порядке убывания значения 56 | arsort($torrentsList); 57 | 58 | // формируем элемент 'lastBuildDate' 59 | if (count($torrentsList)) { 60 | $first = reset($torrentsList); 61 | 62 | $lastBuildDate = $channel->appendChild($xml->createElement('lastBuildDate')); 63 | $lastBuildDate->appendChild($xml->createTextNode(date("r", $first))); 64 | } 65 | 66 | //////////////////////////////////// 67 | // Заполняем тело документа 68 | 69 | //инициализируем счетчик 70 | $count = 1; 71 | 72 | // делаем обход по элементам массива 73 | foreach ($torrentsList as $fileName => $fileDate) 74 | { 75 | // формируем элемент 'item' 76 | $item = $channel->appendChild($xml->createElement('item')); 77 | 78 | // формируем элемент 'title' 79 | $title = $item->appendChild($xml->createElement('title')); 80 | $title->appendChild($xml->createTextNode(sprintf("%0d. ", $count++).$fileName)); 81 | 82 | // формируем элемент 'pubDate' 83 | $pubDate = $item->appendChild($xml->createElement('pubDate')); 84 | $pubDate->appendChild($xml->createTextNode(date("r", $fileDate))); 85 | 86 | // формируем элемент 'link' 87 | $link = $item->appendChild($xml->createElement('link')); 88 | $link->appendChild($xml->createTextNode($url.'torrents/'.$fileName)); 89 | 90 | if ($count > $maxCount) 91 | break; 92 | } 93 | 94 | // выводим содержимое XML документа 95 | print $xml->saveXML(); 96 | } 97 | else 98 | echo '

RSS disabled

'; 99 | ?> 100 | -------------------------------------------------------------------------------- /scripts/echo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "tracker: $1 " 4 | echo "name/id: $2 " 5 | echo "hash: $3 " 6 | echo "message: $4 " 7 | echo "date_str: $5 " 8 | echo "Количество аргументов: $#" 9 | -------------------------------------------------------------------------------- /torrents/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElizarovEugene/TorrentMonitor/8cb1cb0788ae88b4a1eeab30b102d89e3108ddc7/torrents/.gitkeep -------------------------------------------------------------------------------- /trackers/baibako.tv_forum.engine.php: -------------------------------------------------------------------------------- 1 | 'POST', 14 | 'returntransfer' => 1, 15 | 'url' => 'http://baibako.tv/', 16 | 'cookie' => $sess_cookie, 17 | 'sendHeader' => array('Host' => 'baibako.tv', 'Content-length' => strlen($sess_cookie)), 18 | 'convert' => array('windows-1251', 'utf-8//IGNORE'), 19 | ) 20 | ); 21 | 22 | if (preg_match('/Выход<\/a>/U', $result)) 23 | return TRUE; 24 | else 25 | return FALSE; 26 | } 27 | 28 | //функция проверки введёного URL`а 29 | public static function checkRule($data) 30 | { 31 | if (preg_match('/\D+/', $data)) 32 | return FALSE; 33 | else 34 | return TRUE; 35 | } 36 | 37 | //функция преобразования даты 38 | private static function dateStringToNum($data) 39 | { 40 | $data1 = explode(' ', $data); 41 | if (strlen($data1[0]) == 1) 42 | $data1[0] = '0'.$data1[0]; 43 | $data3 = $data1[2].'-'.Sys::dateStringToNum($data1[1]).'-'.$data1[0]; 44 | $date = $data3.' '.$data1[4]; 45 | 46 | return $date; 47 | } 48 | 49 | //функция преобразования даты 50 | private static function dateNumToString($data) 51 | { 52 | $data = substr($data, 0, -3); 53 | $arr = preg_split('/\s/', $data); 54 | 55 | $month = Sys::dateNumToString($arr[1]); 56 | $date = $arr[0].' '.$month.' '.$arr[2].' '.$arr[4]; 57 | return $date; 58 | } 59 | 60 | //функция получения кук 61 | public static function getCookie($tracker) 62 | { 63 | //проверяем заполнены ли учётные данные 64 | if (Database::checkTrackersCredentialsExist($tracker)) 65 | { 66 | //получаем учётные данные 67 | $credentials = Database::getCredentials($tracker); 68 | $login = iconv('utf-8', 'windows-1251', $credentials['login']); 69 | $password = $credentials['password']; 70 | 71 | $page = Sys::getUrlContent( 72 | array( 73 | 'type' => 'POST', 74 | 'header' => 1, 75 | 'returntransfer' => 1, 76 | 'url' => 'http://baibako.tv/takelogin.php', 77 | 'postfields' => 'username='.$login.'&password='.$password.'&commit=%CF%F3%F1%F2%E8%F2%E5+%EC%E5%ED%FF', 78 | 'convert' => array('windows-1251', 'utf-8//IGNORE'), 79 | ) 80 | ); 81 | 82 | if ( ! empty($page)) 83 | { 84 | //проверяем подходят ли учётные данные 85 | if (preg_match_all('/Set-Cookie: (\w*)=(\S*)/', $page, $array)) 86 | { 87 | if (count($array[0]) > 0) 88 | { 89 | baibako_f::$sess_cookie = ''; 90 | for ($i=0; $i 'POST', 170 | 'header' => 0, 171 | 'returntransfer' => 1, 172 | 'url' => 'http://baibako.tv/details.php?id='.$torrent_id, 173 | 'cookie' => baibako_f::$sess_cookie, 174 | 'sendHeader' => array('Host' => 'baibako.tv', 'Content-length' => strlen(baibako_f::$sess_cookie)), 175 | 'convert' => array('windows-1251', 'utf-8//IGNORE'), 176 | ) 177 | ); 178 | 179 | if ( ! empty($page)) 180 | { 181 | //ищем на странице дату регистрации торрента 182 | if (preg_match('/(.*)<\/b><\/td>/', $page, $array)) 183 | { 184 | //проверяем удалось ли получить дату со страницы 185 | if (isset($array[1])) 186 | { 187 | //если дата не равна ничему 188 | if ( ! empty($array[1])) 189 | { 190 | //сбрасываем варнинг 191 | Database::clearWarnings($tracker); 192 | //приводим дату к общему виду 193 | $date = baibako_f::dateStringToNum($array[1]); 194 | $date_str = baibako_f::dateNumToString($array[1]); 195 | //если даты не совпадают, перекачиваем торрент 196 | if ($date != $timestamp) 197 | { 198 | //сохраняем торрент в файл 199 | $torrent = Sys::getUrlContent( 200 | array( 201 | 'type' => 'POST', 202 | 'returntransfer' => 1, 203 | 'url' => 'http://baibako.tv/download.php?id='.$torrent_id, 204 | 'cookie' => baibako_f::$sess_cookie, 205 | 'sendHeader' => array('Host' => 'baibako.tv', 'Content-length' => strlen(baibako_f::$sess_cookie)), 206 | 'referer' => 'http://baibako.tv/download.php?id='.$torrent_id, 207 | ) 208 | ); 209 | 210 | if (Sys::checkTorrentFile($torrent)) 211 | { 212 | if ($auto_update) 213 | { 214 | $name = Sys::parseHeader($tracker, $page); 215 | //обновляем заголовок торрента в базе 216 | Database::setNewName($id, $name); 217 | } 218 | 219 | $message = $name.' обновлён.'; 220 | $status = Sys::saveTorrent($tracker, $torrent_id, $torrent, $id, $hash, $message, $date_str, $name); 221 | 222 | //обновляем время регистрации торрента в базе 223 | Database::setNewDate($id, $date); 224 | //сбрасываем варнинг 225 | Database::clearWarnings($tracker); 226 | Database::setErrorToThreme($id, 0); 227 | } 228 | else 229 | Errors::setWarnings($tracker, 'torrent_file_fail', $id); 230 | } 231 | Database::setErrorToThreme($id, 0); 232 | } 233 | else 234 | { 235 | //устанавливаем варнинг 236 | if (baibako_f::$warning == NULL) 237 | { 238 | baibako_f::$warning = TRUE; 239 | Errors::setWarnings($tracker, 'cant_find_date', $id); 240 | } 241 | //останавливаем процесс выполнения, т.к. не может работать без кук 242 | baibako_f::$exucution = FALSE; 243 | } 244 | } 245 | else 246 | { 247 | //устанавливаем варнинг 248 | if (baibako_f::$warning == NULL) 249 | { 250 | baibako_f::$warning = TRUE; 251 | Errors::setWarnings($tracker, 'cant_find_date', $id); 252 | } 253 | //останавливаем процесс выполнения, т.к. не может работать без кук 254 | baibako_f::$exucution = FALSE; 255 | } 256 | } 257 | } 258 | else 259 | { 260 | //устанавливаем варнинг 261 | if (baibako_f::$warning == NULL) 262 | { 263 | baibako_f::$warning = TRUE; 264 | Errors::setWarnings($tracker, 'cant_get_forum_page', $id); 265 | } 266 | //останавливаем процесс выполнения, т.к. не может работать без кук 267 | baibako_f::$exucution = FALSE; 268 | } 269 | } 270 | baibako_f::$warning = NULL; 271 | } 272 | } 273 | ?> -------------------------------------------------------------------------------- /trackers/booktracker.org.search.php: -------------------------------------------------------------------------------- 1 | 'POST', 25 | 'header' => 1, 26 | 'returntransfer' => 1, 27 | 'url' => 'https://booktracker.org/search.php', 28 | 'cookie' => booktracker::$sess_cookie, 29 | 'postfields' => 'nm=&to=1&allw=1&pn='.$name.'&f%5B%5D=0&tm=0&dm=0&s=0&o=1&submit=%C2%A0%C2%A0%D0%9F%D0%BE%D0%B8%D1%81%D0%BA%C2%A0%C2%A0', 30 | ) 31 | ); 32 | 33 | if ( ! empty($page)) 34 | { 35 | //сбрасываем варнинг 36 | Database::clearWarnings($tracker); 37 | 38 | preg_match_all('/(.*)<\/a>/', $page, $section); 39 | preg_match_all('/(.*)<\/span><\/a>/', $page, $threme); 40 | preg_match_all('/\n\t\t

(.*)<\/p>/', $page, $dates); 41 | 42 | if (count($section[1]) == count($threme[1]) && count($threme[1]) == count($dates[1])) 43 | { 44 | for ($i=0; $i 0) 58 | { 59 | for ($i=0; $i 'POST', 65 | 'header' => 0, 66 | 'returntransfer' => 1, 67 | 'encoding' => 1, 68 | 'url' => 'https://booktracker.org/viewtopic.php?t='.$torrent_id, 69 | 'cookie' => booktracker::$sess_cookie, 70 | 'sendHeader' => array('Host' => 'booktracker.org', 'Content-length' => strlen(booktracker::$sess_cookie)), 71 | ) 72 | ); 73 | 74 | if ( ! empty($page)) 75 | { 76 | //находим имя торрента для скачивания 77 | if (preg_match('/href=\"download.php\?id=(\d+)\"/', $page, $link)) 78 | { 79 | //сбрасываем варнинг 80 | Database::clearWarnings($tracker); 81 | //сохраняем торрент в файл 82 | $download_id = $link[1]; 83 | 84 | $torrent = Sys::getUrlContent( 85 | array( 86 | 'type' => 'GET', 87 | 'returntransfer' => 1, 88 | 'url' => 'https://booktracker.org/download.php?id='.$download_id, 89 | 'cookie' => booktracker::$sess_cookie, 90 | 'sendHeader' => array('Host' => 'booktracker.org', 'Content-length' => strlen(booktracker::$sess_cookie)), 91 | 'referer' => 'https://booktracker.org/viewtopic.php?t='.$torrent_id, 92 | ) 93 | ); 94 | 95 | if (Sys::checkTorrentFile($torrent)) 96 | { 97 | $message = $toDownload[$i]['threme'].' добавлена для скачивания.'; 98 | $status = Sys::saveTorrent($tracker, $toDownload[$i]['threme_id'], $torrent, $toDownload[$i]['threme_id'], 0, $message, date('d M Y H:i'), $name); 99 | 100 | //обновляем время регистрации торрента в базе 101 | Database::setDownloaded($toDownload[$i]['id']); 102 | } 103 | else 104 | Errors::setWarnings($tracker, 'torrent_file_fail'); 105 | } 106 | } 107 | } 108 | } 109 | } 110 | } 111 | } 112 | } 113 | ?> -------------------------------------------------------------------------------- /trackers/lostfilm-mirror.engine.php: -------------------------------------------------------------------------------- 1 | link, $matches); 39 | if (isset($matches[0])) 40 | { 41 | $episode = $matches[0]; 42 | return array('episode'=>$episode, 'date'=>(string)$item->pubDate, 'link'=>(string)$item->link); 43 | } 44 | } 45 | 46 | //функция анализа xml ленты 47 | private static function analysis($name, $hd, $item) 48 | { 49 | $name = str_replace(' ', '.', $name); 50 | if (preg_match('/'.$name.'/i', $item->title)) 51 | { 52 | if ($hd == 0) 53 | { 54 | if (preg_match_all('/avi|AVI/', $item->link, $matches)) 55 | return lostfilmmirror::analysisEpisode($item); 56 | } 57 | elseif ($hd == 1) 58 | { 59 | if (preg_match_all('/mkv|MKV/', $item->link, $matches)) 60 | return lostfilmmirror::analysisEpisode($item); 61 | } 62 | elseif ($hd == 2) 63 | { 64 | if (preg_match_all('/mp4|MP4/', $item->link, $matches)) 65 | return lostfilmmirror::analysisEpisode($item); 66 | } 67 | } 68 | } 69 | 70 | //основная функция 71 | public static function main($params) 72 | { 73 | extract($params); 74 | //проверяем получена ли уже RSS лента 75 | if ( ! lostfilmmirror::$log_page) 76 | { 77 | //получаем страницу 78 | lostfilmmirror::$page = Sys::getUrlContent( 79 | array( 80 | 'type' => 'GET', 81 | 'returntransfer' => 1, 82 | 'url' => 'https://rss.bzda.ru/rss.xml', 83 | ) 84 | ); 85 | 86 | if ( ! empty(lostfilmmirror::$page)) 87 | { 88 | //читаем xml 89 | lostfilmmirror::$xml_page = @simplexml_load_string(lostfilmmirror::$page); 90 | 91 | //если XML пришёл с ошибками - останавливаем выполнение, иначе - ставим флажок, что получаем страницу 92 | if ( ! lostfilmmirror::$xml_page) 93 | { 94 | //устанавливаем варнинг 95 | if (lostfilmmirror::$warning == NULL) 96 | { 97 | lostfilmmirror::$warning = TRUE; 98 | Errors::setWarnings($tracker, 'rss_parse_false'); 99 | } 100 | //останавливаем выполнение цепочки 101 | lostfilmmirror::$exucution = FALSE; 102 | } 103 | else 104 | { 105 | lostfilmmirror::$log_page = TRUE; 106 | lostfilmmirror::$exucution = TRUE; 107 | } 108 | } 109 | else 110 | { 111 | //устанавливаем варнинг 112 | if (lostfilmmirror::$warning == NULL) 113 | { 114 | lostfilmmirror::$warning = TRUE; 115 | Errors::setWarnings($tracker, 'cant_find_rss'); 116 | } 117 | //останавливаем выполнение цепочки 118 | lostfilmmirror::$exucution = FALSE; 119 | } 120 | } 121 | 122 | //если выполнение цепочки не остановлено 123 | if (lostfilmmirror::$exucution) 124 | { 125 | if ( ! empty(lostfilmmirror::$xml_page)) 126 | { 127 | //сбрасываем варнинг 128 | Database::clearWarnings($tracker); 129 | $nodes = array(); 130 | foreach (lostfilmmirror::$xml_page->channel->item AS $item) 131 | { 132 | array_unshift($nodes, $item); 133 | } 134 | 135 | foreach ($nodes as $item) 136 | { 137 | $serial = lostfilmmirror::analysis($name, $hd, $item); 138 | if ( ! empty($serial)) 139 | { 140 | $episode = substr($serial['episode'], 4, 2); 141 | $season = substr($serial['episode'], 1, 2); 142 | $date_str = lostfilmmirror::dateNumToString($serial['date']); 143 | 144 | if ( ! empty($ep)) 145 | { 146 | if ($season == substr($ep, 1, 2) && $episode > substr($ep, 4, 2)) 147 | $download = TRUE; 148 | elseif ($season > substr($ep, 1, 2) && $episode < substr($ep, 4, 2)) 149 | $download = TRUE; 150 | else 151 | $download = FALSE; 152 | } 153 | elseif ($ep == NULL) 154 | $download = TRUE; 155 | else 156 | $download = FALSE; 157 | 158 | if ($download) 159 | { 160 | if ($hd == 1 || $hd == 3) 161 | $amp = 'HD'; 162 | elseif ($hd == 2) 163 | $amp = 'MP4'; 164 | else 165 | $amp = 'SD'; 166 | //сохраняем торрент в файл 167 | $torrent = Sys::getUrlContent( 168 | array( 169 | 'type' => 'GET', 170 | 'returntransfer' => 1, 171 | 'url' => $serial['link'], 172 | ) 173 | ); 174 | 175 | if (Sys::checkTorrentFile($torrent)) 176 | { 177 | $file = str_replace(' ', '.', $name).'.S'.$season.'E'.$episode.'.'.$amp; 178 | $episode = (substr($episode, 0, 1) == 0) ? substr($episode, 1, 1) : $episode; 179 | $season = (substr($season, 0, 1) == 0) ? substr($season, 1, 1) : $season; 180 | $message = $name.' '.$amp.' обновлён до '.$episode.' серии, '.$season.' сезона.'; 181 | $status = Sys::saveTorrent($tracker, $file, $torrent, $id, $hash, $message, $date_str, $name); 182 | 183 | //обновляем время регистрации торрента в базе 184 | Database::setNewDate($id, lostfilmmirror::dateStringToNum($serial['date'])); 185 | //обновляем сведения о последнем эпизоде 186 | Database::setNewEpisode($id, $serial['episode']); 187 | } 188 | else 189 | Errors::setWarnings($tracker, 'torrent_file_fail', $id); 190 | } 191 | } 192 | } 193 | } 194 | } 195 | } 196 | } 197 | ?> -------------------------------------------------------------------------------- /trackers/nnmclub.to.search.php: -------------------------------------------------------------------------------- 1 | 'POST', 27 | 'header' => 1, 28 | 'returntransfer' => 1, 29 | 'url' => 'https://'.nnmclub::$domain.'/forum/tracker.php', 30 | 'sendHeader' => array('Host' => nnmclub::$domain, 'Content-length' => strlen('prev_sd=0&prev_a=0&prev_my=0&prev_n=0&prev_shc=0&prev_shf=1&prev_sha=1&prev_shs=0&prev_shr=0&prev_sht=0&f%5B%5D=-1&o=1&s=2&tm=-1&shf=1&sha=1&ta=-1&sns=-1&sds=-1&nm=&pn='.$user.'&submit=%CF%EE%E8%F1%EA')), 31 | 'postfields' => 'prev_sd=0&prev_a=0&prev_my=0&prev_n=0&prev_shc=0&prev_shf=1&prev_sha=1&prev_shs=0&prev_shr=0&prev_sht=0&f%5B%5D=-1&o=1&s=2&tm=-1&shf=1&sha=1&ta=-1&sns=-1&sds=-1&nm=&pn='.$user.'&submit=%CF%EE%E8%F1%EA', 32 | 'convert' => array('windows-1251', 'utf-8//IGNORE'), 33 | ) 34 | ); 35 | 36 | if ( ! empty($page)) 37 | { 38 | //сбрасываем варнинг 39 | Database::clearWarnings($tracker); 40 | 41 | preg_match_all('/(.*)<\/a>/', $page, $section); 42 | preg_match_all('/(.*)<\/b><\/a>/', $page, $threme); 43 | preg_match_all('/.*<\/u> (\d{2}-\d{2}-\d{4})
.*<\/td>/', $page, $dates); 44 | 45 | if (count($section[1]) == count($threme[1]) && count($threme[1]) == count($dates[1])) 46 | { 47 | for ($i=0; $i 0) 60 | { 61 | for ($i=0; $i 'POST', 67 | 'header' => 0, 68 | 'returntransfer' => 1, 69 | 'url' => 'https://'.nnmclub::$domain.'/forum/viewtopic.php?t='.$toDownload[$i]['threme_id'], 70 | 'cookie' => nnmclub::$sess_cookie, 71 | 'sendHeader' => array('Host' => nnmclub::$domain, 'Content-length' => strlen(nnmclub::$sess_cookie)), 72 | 'convert' => array('windows-1251', 'utf-8//IGNORE'), 73 | ) 74 | ); 75 | 76 | if ( ! empty($page)) 77 | { 78 | //находим имя торрента для скачивания 79 | if (preg_match('/download\.php\?id=(\d{2,8})/', $page, $link)) 80 | { 81 | //сбрасываем варнинг 82 | Database::clearWarnings($tracker); 83 | //сохраняем торрент в файл 84 | $download_id = $link[1]; 85 | $torrent = Sys::getUrlContent( 86 | array( 87 | 'type' => 'GET', 88 | 'follow' => 1, 89 | 'returntransfer' => 1, 90 | 'url' => 'https://'.nnmclub::$domain.'/forum/download.php?id='.$download_id, 91 | 'cookie' => nnmclub::$sess_cookie, 92 | 'sendHeader' => array('Host' => 'nnmclub.to', 'Content-length' => strlen(nnmclub::$sess_cookie)), 93 | 'referer' => 'http://'.nnmclub::$domain.'/forum/viewtopic.php?t='.$torrent_id, 94 | ) 95 | ); 96 | 97 | if (Sys::checkTorrentFile($torrent)) 98 | { 99 | $message = $toDownload[$i]['threme'].' добавлена для скачивания.'; 100 | $status = Sys::saveTorrent($tracker, $toDownload[$i]['threme_id'], $torrent, $toDownload[$i]['threme_id'], 0, $message, date('d M Y H:i'), $name); 101 | 102 | //обновляем время регистрации торрента в базе 103 | Database::setDownloaded($toDownload[$i]['id']); 104 | } 105 | else 106 | Errors::setWarnings($tracker, 'torrent_file_fail'); 107 | } 108 | } 109 | } 110 | } 111 | } 112 | } 113 | } 114 | } 115 | ?> 116 | -------------------------------------------------------------------------------- /trackers/pornolab.net.engine.php: -------------------------------------------------------------------------------- 1 | 'POST', 14 | 'returntransfer' => 1, 15 | 'url' => 'http://pornolab.net/forum/index.php', 16 | 'cookie' => $sess_cookie, 17 | 'sendHeader' => array('Host' => 'pornolab.net', 'Content-length' => strlen($sess_cookie)), 18 | 'convert' => array('windows-1251', 'utf-8//IGNORE'), 19 | ) 20 | ); 21 | 22 | if (preg_match('/Вы зашли как:  /', $result)) 23 | return TRUE; 24 | else 25 | return FALSE; 26 | } 27 | 28 | //функция проверки введёного URL`а 29 | public static function checkRule($data) 30 | { 31 | if (preg_match('/\D+/', $data)) 32 | return FALSE; 33 | else 34 | return TRUE; 35 | } 36 | 37 | //функция преобразования даты 38 | private static function dateStringToNum($data) 39 | { 40 | $monthes = array('Янв', 'Фев', 'Мар', 'Апр', 'Май', 'Июн', 'Июл', 'Авг', 'Сен', 'Окт', 'Ноя', 'Дек'); 41 | $month = substr($data, 3, 6); 42 | $date = preg_replace('/(\d\d)-(\d\d)-(\d\d)/', '$3-$2-$1', str_replace($month, str_pad(array_search($month, $monthes)+1, 2, 0, STR_PAD_LEFT), $data)); 43 | $date = date('Y-m-d H:i:s', strtotime($date)); 44 | 45 | return $date; 46 | } 47 | 48 | //функция преобразования даты 49 | private static function dateNumToString($data) 50 | { 51 | $data = str_replace('-', ' ', $data); 52 | $arr = preg_split('/\s/', $data); 53 | $date = $arr[0].' '.$arr[1].' 20'.$arr[2].' '.$arr[3]; 54 | 55 | return $date; 56 | } 57 | 58 | //функция получения кук 59 | protected static function getCookie($tracker) 60 | { 61 | //проверяем заполнены ли учётные данные 62 | if (Database::checkTrackersCredentialsExist($tracker)) 63 | { 64 | //получаем учётные данные 65 | $credentials = Database::getCredentials($tracker); 66 | $login = iconv('utf-8', 'windows-1251', $credentials['login']); 67 | $password = $credentials['password']; 68 | 69 | //авторизовываемся на трекере 70 | $page = Sys::getUrlContent( 71 | array( 72 | 'type' => 'POST', 73 | 'header' => 1, 74 | 'returntransfer' => 1, 75 | 'url' => 'http://pornolab.net/forum/login.php', 76 | 'postfields' => 'login_username='.$login.'&login_password='.$password.'&login=%C2%F5%EE%E4', 77 | 'convert' => array('windows-1251', 'utf-8//IGNORE'), 78 | ) 79 | ); 80 | 81 | if ( ! empty($page)) 82 | { 83 | //проверяем подходят ли учётные данные 84 | if (preg_match('/Вы ввели неверное\/неактивное имя пользователя или неверный пароль/', $page, $array)) 85 | { 86 | //устанавливаем варнинг 87 | Errors::setWarnings($tracker, 'credential_wrong'); 88 | //останавливаем процесс выполнения, т.к. не может работать без кук 89 | pornolab::$exucution = FALSE; 90 | } 91 | //если подходят - получаем куки 92 | elseif (preg_match('/bb_data=.+;/U', $page, $array)) 93 | { 94 | pornolab::$sess_cookie = $array[0]; 95 | Database::setCookie($tracker, pornolab::$sess_cookie); 96 | //запускам процесс выполнения, т.к. не может работать без кук 97 | pornolab::$exucution = TRUE; 98 | } 99 | else 100 | { 101 | //устанавливаем варнинг 102 | if (pornolab::$warning == NULL) 103 | { 104 | pornolab::$warning = TRUE; 105 | Errors::setWarnings($tracker, 'cant_find_cookie'); 106 | } 107 | //останавливаем процесс выполнения, т.к. не может работать без кук 108 | pornolab::$exucution = FALSE; 109 | } 110 | } 111 | //если вообще ничего не найдено 112 | else 113 | { 114 | //устанавливаем варнинг 115 | if (pornolab::$warning == NULL) 116 | { 117 | pornolab::$warning = TRUE; 118 | Errors::setWarnings($tracker, 'cant_get_auth_page'); 119 | } 120 | //останавливаем процесс выполнения, т.к. не может работать без кук 121 | pornolab::$exucution = FALSE; 122 | } 123 | } 124 | else 125 | { 126 | //устанавливаем варнинг 127 | if (pornolab::$warning == NULL) 128 | { 129 | pornolab::$warning = TRUE; 130 | Errors::setWarnings($tracker, 'credential_miss'); 131 | } 132 | //останавливаем процесс выполнения, т.к. не может работать без кук 133 | pornolab::$exucution = FALSE; 134 | } 135 | } 136 | 137 | //основная функция 138 | public static function main($params) 139 | { 140 | extract($params); 141 | $cookie = Database::getCookie($tracker); 142 | if (pornolab::checkCookie($cookie)) 143 | { 144 | pornolab::$sess_cookie = $cookie; 145 | //запускам процесс выполнения 146 | pornolab::$exucution = TRUE; 147 | } 148 | else 149 | pornolab::getCookie($tracker); 150 | 151 | if (pornolab::$exucution) 152 | { 153 | //получаем страницу для парсинга 154 | $page = Sys::getUrlContent( 155 | array( 156 | 'type' => 'POST', 157 | 'header' => 0, 158 | 'returntransfer' => 1, 159 | 'url' => 'http://pornolab.net/forum/viewtopic.php?t='.$torrent_id, 160 | 'cookie' => pornolab::$sess_cookie, 161 | 'sendHeader' => array('Host' => 'pornolab.net', 'Content-length' => strlen(pornolab::$sess_cookie)), 162 | 'convert' => array('windows-1251', 'utf-8//IGNORE'), 163 | ) 164 | ); 165 | 166 | if ( ! empty($page)) 167 | { 168 | //ищем на странице дату регистрации торрента 169 | if (preg_match('/\[ (.+) \]<\/span>/', $page, $array)) 170 | { 171 | //проверяем удалось ли получить дату со страницы 172 | if (isset($array[1])) 173 | { 174 | //если дата не равна ничему 175 | if ( ! empty($array[1])) 176 | { 177 | //сбрасываем варнинг 178 | Database::clearWarnings($tracker); 179 | //приводим дату к общему виду 180 | $date = pornolab::dateStringToNum($array[1]); 181 | $date_str = pornolab::dateNumToString($array[1]); 182 | //если даты не совпадают, перекачиваем торрент 183 | if ($date != $timestamp) 184 | { 185 | //сохраняем торрент в файл 186 | $torrent = Sys::getUrlContent( 187 | array( 188 | 'type' => 'POST', 189 | 'returntransfer' => 1, 190 | 'url' => 'http://pornolab.net/forum/dl.php?t='.$torrent_id, 191 | 'cookie' => pornolab::$sess_cookie.'; bb_dl='.$torrent_id, 192 | 'sendHeader' => array('Host' => 'pornolab.net', 'Content-length' => strlen(pornolab::$sess_cookie.' bb_dl='.$torrent_id)), 193 | 'referer' => 'http://pornolab.net/forum/viewtopic.php?t='.$torrent_id, 194 | ) 195 | ); 196 | 197 | if (Sys::checkTorrentFile($torrent)) 198 | { 199 | if ($auto_update) 200 | { 201 | $name = Sys::parseHeader($tracker, $page); 202 | //обновляем заголовок торрента в базе 203 | Database::setNewName($id, $name); 204 | } 205 | 206 | $message = $name.' обновлён.'; 207 | $status = Sys::saveTorrent($tracker, $torrent_id, $torrent, $id, $hash, $message, $date_str, $name); 208 | 209 | //обновляем время регистрации торрента в базе 210 | Database::setNewDate($id, $date); 211 | //сбрасываем варнинг 212 | Database::clearWarnings($tracker); 213 | Database::setErrorToThreme($id, 0); 214 | } 215 | else 216 | Errors::setWarnings($tracker, 'torrent_file_fail', $id); 217 | } 218 | Database::setErrorToThreme($id, 0); 219 | } 220 | else 221 | { 222 | //устанавливаем варнинг 223 | if (pornolab::$warning == NULL) 224 | { 225 | pornolab::$warning = TRUE; 226 | Errors::setWarnings($tracker, 'cant_find_date', $id); 227 | } 228 | //останавливаем процесс выполнения, т.к. не может работать без кук 229 | pornolab::$exucution = FALSE; 230 | } 231 | } 232 | else 233 | { 234 | //устанавливаем варнинг 235 | if (pornolab::$warning == NULL) 236 | { 237 | pornolab::$warning = TRUE; 238 | Errors::setWarnings($tracker, 'cant_find_date', $id); 239 | } 240 | //останавливаем процесс выполнения, т.к. не может работать без кук 241 | pornolab::$exucution = FALSE; 242 | } 243 | } 244 | else 245 | { 246 | //устанавливаем варнинг 247 | if (pornolab::$warning == NULL) 248 | { 249 | pornolab::$warning = TRUE; 250 | Errors::setWarnings($tracker, 'cant_find_date', $id); 251 | } 252 | //останавливаем процесс выполнения, т.к. не может работать без кук 253 | pornolab::$exucution = FALSE; 254 | } 255 | } 256 | else 257 | { 258 | //устанавливаем варнинг 259 | if (pornolab::$warning == NULL) 260 | { 261 | pornolab::$warning = TRUE; 262 | Errors::setWarnings($tracker, 'cant_get_forum_page', $id); 263 | } 264 | //останавливаем процесс выполнения, т.к. не может работать без кук 265 | pornolab::$exucution = FALSE; 266 | } 267 | } 268 | pornolab::$warning = NULL; 269 | } 270 | } 271 | ?> -------------------------------------------------------------------------------- /trackers/pornolab.net.search.php: -------------------------------------------------------------------------------- 1 | 'POST', 26 | 'header' => 1, 27 | 'returntransfer' => 1, 28 | 'url' => 'http://pornolab.net/forum/tracker.php', 29 | 'cookie' => pornolab::$sess_cookie, 30 | 'postfields' => 'prev_my=0&prev_new=0&prev_oop=0&f%5B%5D=-1&o=1&s=2&tm=-1&pn='.$user.'&nm=&submit=%CF%EE%E8%F1%EA', 31 | 'convert' => array('windows-1251', 'utf-8//IGNORE'), 32 | ) 33 | ); 34 | 35 | if ( ! empty($page)) 36 | { 37 | //сбрасываем варнинг 38 | Database::clearWarnings($tracker); 39 | 40 | preg_match_all('/
(.*)<\/a>/', $page, $section); 41 | preg_match_all('/(.*)<\/a>/', $page, $threme); 42 | preg_match_all('/\n\t\t.*<\/u>\n\t\t

.*<\/p>\n\t\t

(.*)<\/p>\n\t<\/td>/', $page, $dates); 43 | 44 | if (count($section[1]) == count($threme[1]) && count($threme[1]) == count($dates[1])) 45 | { 46 | for ($i=0; $i 0) 63 | { 64 | for ($i=0; $i 'POST', 75 | 'returntransfer' => 1, 76 | 'url' => 'http://pornolab.net/forum/dl.php?t='.$torrent_id, 77 | 'cookie' => pornolab::$sess_cookie.'; bb_dl='.$torrent_id, 78 | 'sendHeader' => array('Host' => 'pornolab.net', 'Content-length' => strlen(pornolab::$sess_cookie.'; bb_dl='.$torrent_id)), 79 | 'referer' => 'http://pornolab.net/forum/viewtopic.php?t='.$torrent_id, 80 | ) 81 | ); 82 | 83 | if (Sys::checkTorrentFile($torrent)) 84 | { 85 | $message = $toDownload[$i]['threme'].' добавлена для скачивания.'; 86 | $status = Sys::saveTorrent($tracker, $toDownload[$i]['threme_id'], $torrent, $toDownload[$i]['threme_id'], 0, $message, date('d M Y H:i'), $name); 87 | 88 | //обновляем время регистрации торрента в базе 89 | Database::setDownloaded($toDownload[$i]['id']); 90 | } 91 | else 92 | Errors::setWarnings($tracker, 'torrent_file_fail'); 93 | } 94 | } 95 | } 96 | } 97 | } 98 | } 99 | ?> -------------------------------------------------------------------------------- /trackers/riperam.org.engine.php: -------------------------------------------------------------------------------- 1 | 'POST', 16 | 'returntransfer' => 1, 17 | 'encoding' => 1, 18 | 'url' => riperam::$domain, 19 | 'cookie' => $sess_cookie, 20 | 'sendHeader' => array('Host' => 'riperam.org', 'Content-length' => strlen($sess_cookie)), 21 | ) 22 | ); 23 | 24 | if (preg_match('/ucp\.php\?mode=logout/', $result)) 25 | return TRUE; 26 | else 27 | return FALSE; 28 | } 29 | 30 | 31 | public static function checkRule($data) 32 | { 33 | if (preg_match('/\D\d\/+/', $data)) 34 | return FALSE; 35 | else 36 | return TRUE; 37 | } 38 | 39 | private static function dateStringToNum($data) 40 | { 41 | $date = explode(', ', $data); 42 | $date1 = explode(' ', $date[0]); 43 | $date2 = $date1[2].'-'.Sys::dateStringToNum($date1[1]).'-'.$date1[0]; 44 | $date = $date2.' '.$date[1].':00'; 45 | 46 | return $date; 47 | } 48 | 49 | //функция преобразования даты 50 | private static function dateNumToString($data) 51 | { 52 | $date1 = explode(', ', $data); 53 | $date = $date1[0].' в '.$date1[1]; 54 | 55 | return $date; 56 | } 57 | 58 | //функция получения кук 59 | protected static function getCookie($tracker) 60 | { 61 | //проверяем заполнены ли учётные данные 62 | if (Database::checkTrackersCredentialsExist($tracker)) 63 | { 64 | //получаем учётные данные 65 | $credentials = Database::getCredentials($tracker); 66 | $login = iconv('utf-8', 'windows-1251', $credentials['login']); 67 | $password = $credentials['password']; 68 | 69 | //авторизовываемся на трекере 70 | $page = Sys::getUrlContent( 71 | array( 72 | 'type' => 'POST', 73 | 'header' => 1, 74 | 'returntransfer' => 1, 75 | 'encoding' => 1, 76 | 'url' => riperam::$domain.'ucp.php?mode=login', 77 | 'postfields' => 'username='.$login.'&password='.$password.'&login=%C2%F5%EE%E4', 78 | ) 79 | ); 80 | 81 | if ( ! empty($page)) 82 | { 83 | //проверяем подходят ли учётные данные 84 | if (preg_match('/login\.php\?redirect=/', $page, $array)) 85 | { 86 | //устанавливаем варнинг 87 | if (riperam::$warning == NULL) 88 | { 89 | riperam::$warning = TRUE; 90 | Errors::setWarnings($tracker, 'credential_wrong'); 91 | } 92 | //останавливаем процесс выполнения, т.к. не может работать без кук 93 | riperam::$exucution = FALSE; 94 | } 95 | else 96 | { 97 | //если подходят - получаем куки 98 | if (preg_match_all('/Set-Cookie: (.*);/iU', $page, $array)) 99 | { 100 | riperam::$sess_cookie = implode('; ', $array[1]); 101 | Database::setCookie($tracker, riperam::$sess_cookie); 102 | //запускам процесс выполнения, т.к. не может работать без кук 103 | riperam::$exucution = TRUE; 104 | } 105 | } 106 | } 107 | //если вообще ничего не найдено 108 | else 109 | { 110 | //устанавливаем варнинг 111 | if (riperam::$warning == NULL) 112 | { 113 | riperam::$warning = TRUE; 114 | Errors::setWarnings($tracker, 'cant_get_auth_page'); 115 | } 116 | //останавливаем процесс выполнения, т.к. не может работать без кук 117 | riperam::$exucution = FALSE; 118 | } 119 | } 120 | else 121 | { 122 | //устанавливаем варнинг 123 | if (riperam::$warning == NULL) 124 | { 125 | riperam::$warning = TRUE; 126 | Errors::setWarnings($tracker, 'credential_miss'); 127 | } 128 | //останавливаем процесс выполнения, т.к. не может работать без кук 129 | riperam::$exucution = FALSE; 130 | } 131 | } 132 | 133 | public static function main($params) 134 | { 135 | extract($params); 136 | $cookie = Database::getCookie($tracker); 137 | if (riperam::checkCookie($cookie)) 138 | { 139 | riperam::$sess_cookie = $cookie; 140 | //запускам процесс выполнения 141 | riperam::$exucution = TRUE; 142 | } 143 | else 144 | riperam::getCookie($tracker); 145 | 146 | if (riperam::$exucution) 147 | { 148 | //получаем страницу для парсинга 149 | $page = Sys::getUrlContent( 150 | array( 151 | 'type' => 'POST', 152 | 'header' => 0, 153 | 'returntransfer' => 1, 154 | 'encoding' => 1, 155 | 'url' => riperam::$domain.$torrent_id, 156 | 'cookie' => riperam::$sess_cookie, 157 | 'sendHeader' => array('Host' => 'riperam.org', 'Content-length' => strlen(riperam::$sess_cookie)), 158 | ) 159 | ); 160 | 161 | if ( ! empty($page)) 162 | { 163 | //ищем на странице дату регистрации торрента 164 | if (preg_match('/\[ (\d{2} \D{6} \d{4}\, \d{2}\:\d{2}) \]/', $page, $array)) 165 | { 166 | //проверяем удалось ли получить дату со страницы 167 | if (isset($array[1])) 168 | { 169 | //если дата не равна ничему 170 | if ( ! empty($array[1])) 171 | { 172 | //находим имя торрента для скачивания 173 | if (preg_match('/download\/file\.php\?id=(\d{6,8})/', $page, $link)) 174 | { 175 | //приводим дату к общему виду 176 | $date = riperam::dateStringToNum($array[1]); 177 | $date_str = riperam::dateNumToString($array[1]); 178 | //если даты не совпадают, перекачиваем торрент 179 | if ($date != $timestamp) 180 | { 181 | //сохраняем торрент в файл 182 | $download_id = $link[1]; 183 | $torrent = Sys::getUrlContent( 184 | array( 185 | 'type' => 'GET', 186 | 'follow' => 1, 187 | 'returntransfer' => 1, 188 | 'url' => riperam::$domain.'download/file.php?id='.$download_id, 189 | 'cookie' => riperam::$sess_cookie, 190 | 'sendHeader' => array('Host' => 'riperam.org', 'Content-length' => strlen(riperam::$sess_cookie)), 191 | 'referer' => riperam::$domain.$torrent_id.'.html', 192 | ) 193 | ); 194 | 195 | if (Sys::checkTorrentFile($torrent)) 196 | { 197 | if ($auto_update) 198 | { 199 | $name = Sys::parseHeader($tracker, $page); 200 | //обновляем заголовок торрента в базе 201 | Database::setNewName($id, $name); 202 | } 203 | 204 | $message = $name.' обновлён.'; 205 | $status = Sys::saveTorrent($tracker, $download_id, $torrent, $id, $hash, $message, $date_str, $name); 206 | 207 | //обновляем время регистрации торрента в базе 208 | Database::setNewDate($id, $date); 209 | //сбрасываем варнинг 210 | Database::clearWarnings($tracker); 211 | Database::setErrorToThreme($id, 0); 212 | } 213 | else 214 | Errors::setWarnings($tracker, 'torrent_file_fail', $id); 215 | } 216 | Database::setErrorToThreme($id, 0); 217 | } 218 | else 219 | { 220 | //устанавливаем варнинг 221 | if (riperam::$warning == NULL) 222 | { 223 | riperam::$warning = TRUE; 224 | Errors::setWarnings($tracker, 'cant_find_dowload_link', $id); 225 | } 226 | //останавливаем процесс выполнения, т.к. не может работать без кук 227 | riperam::$exucution = FALSE; 228 | } 229 | } 230 | else 231 | { 232 | //устанавливаем варнинг 233 | if (riperam::$warning == NULL) 234 | { 235 | riperam::$warning = TRUE; 236 | Errors::setWarnings($tracker, 'cant_find_date', $id); 237 | } 238 | //останавливаем процесс выполнения, т.к. не может работать без кук 239 | riperam::$exucution = FALSE; 240 | } 241 | } 242 | else 243 | { 244 | //устанавливаем варнинг 245 | if (riperam::$warning == NULL) 246 | { 247 | riperam::$warning = TRUE; 248 | Errors::setWarnings($tracker, 'cant_find_date', $id); 249 | } 250 | //останавливаем процесс выполнения, т.к. не может работать без кук 251 | riperam::$exucution = FALSE; 252 | } 253 | } 254 | else 255 | { 256 | //устанавливаем варнинг 257 | if (riperam::$warning == NULL) 258 | { 259 | riperam::$warning = TRUE; 260 | Errors::setWarnings($tracker, 'cant_find_date', $id); 261 | } 262 | //останавливаем процесс выполнения, т.к. не может работать без кук 263 | riperam::$exucution = FALSE; 264 | } 265 | } 266 | else 267 | { 268 | //устанавливаем варнинг 269 | if (riperam::$warning == NULL) 270 | { 271 | riperam::$warning = TRUE; 272 | Errors::setWarnings($tracker, 'cant_get_forum_page', $id); 273 | } 274 | //останавливаем процесс выполнения, т.к. не может работать без кук 275 | riperam::$exucution = FALSE; 276 | } 277 | } 278 | riperam::$warning = NULL; 279 | } 280 | } -------------------------------------------------------------------------------- /trackers/rutor.is.engine.php: -------------------------------------------------------------------------------- 1 | 'GET', 47 | 'header' => 0, 48 | 'follow' => 1, 49 | 'returntransfer' => 1, 50 | 'url' => 'http://rutor.is/torrent/'.$torrent_id.'/' 51 | ) 52 | ); 53 | 54 | if ( ! empty($page)) 55 | { 56 | //ищем на странице дату регистрации торрента 57 | if (preg_match('/Добавлен<\/td>(.+) \((.+) назад\)<\/td>/', $page, $array)) 58 | { 59 | //проверяем удалось ли получить дату со страницы 60 | if (isset($array[1])) 61 | { 62 | //если дата не равна ничему 63 | if ( ! empty($array[1])) 64 | { 65 | //сбрасываем варнинг 66 | Database::clearWarnings($tracker); 67 | //приводим дату к общему виду 68 | $date = rutor::dateStringToNum($array[1]); 69 | $date_str = rutor::dateNumToString($array[1]); 70 | //если даты не совпадают, перекачиваем торрент 71 | if ($date != $timestamp) 72 | { 73 | //сохраняем торрент в файл 74 | $torrent = Sys::getUrlContent( 75 | array( 76 | 'type' => 'GET', 77 | 'follow' => 1, 78 | 'returntransfer' => 0, 79 | 'url' => 'http://d.rutor.info/download/'.$torrent_id.'/', 80 | ) 81 | ); 82 | 83 | if (Sys::checkTorrentFile($torrent)) 84 | { 85 | if ($auto_update) 86 | { 87 | $name = Sys::parseHeader($tracker, $page); 88 | //обновляем заголовок торрента в базе 89 | Database::setNewName($id, $name); 90 | } 91 | 92 | $message = $name.' обновлён.'; 93 | $status = Sys::saveTorrent($tracker, $torrent_id, $torrent, $id, $hash, $message, $date_str, $name); 94 | 95 | //обновляем время регистрации торрента в базе 96 | Database::setNewDate($id, $date); 97 | //сбрасываем варнинг 98 | Database::clearWarnings($tracker); 99 | Database::setErrorToThreme($id, 0); 100 | } 101 | else 102 | Errors::setWarnings($tracker, 'torrent_file_fail', $id); 103 | } 104 | Database::setErrorToThreme($id, 0); 105 | } 106 | else 107 | { 108 | //устанавливаем варнинг 109 | if (rutor::$warning == NULL) 110 | { 111 | rutor::$warning = TRUE; 112 | Errors::setWarnings($tracker, 'cant_find_date', $id); 113 | } 114 | //останавливаем процесс выполнения, т.к. не может работать без кук 115 | rutor::$exucution = FALSE; 116 | } 117 | } 118 | else 119 | { 120 | //устанавливаем варнинг 121 | if (rutor::$warning == NULL) 122 | { 123 | rutor::$warning = TRUE; 124 | Errors::setWarnings($tracker, 'cant_find_date', $id); 125 | } 126 | //останавливаем процесс выполнения, т.к. не может работать без кук 127 | rutor::$exucution = FALSE; 128 | } 129 | } 130 | else 131 | { 132 | //устанавливаем варнинг 133 | if (rutor::$warning == NULL) 134 | { 135 | rutor::$warning = TRUE; 136 | Errors::setWarnings($tracker, 'cant_find_date', $id); 137 | } 138 | //останавливаем процесс выполнения, т.к. не может работать без кук 139 | rutor::$exucution = FALSE; 140 | } 141 | } 142 | else 143 | { 144 | //устанавливаем варнинг 145 | if (rutor::$warning == NULL) 146 | { 147 | rutor::$warning = TRUE; 148 | Errors::setWarnings($tracker, 'cant_get_forum_page', $id); 149 | } 150 | //останавливаем процесс выполнения, т.к. не может работать без кук 151 | rutor::$exucution = FALSE; 152 | } 153 | } 154 | rutor::$warning = NULL; 155 | } 156 | } 157 | ?> -------------------------------------------------------------------------------- /trackers/rutracker.org.search.php: -------------------------------------------------------------------------------- 1 | 'POST', 26 | 'header' => 1, 27 | 'returntransfer' => 1, 28 | 'url' => 'https://rutracker.org/forum/tracker.php', 29 | 'cookie' => rutracker::$sess_cookie, 30 | 'sendHeader' => array('Host' => 'rutracker.org', 'Content-length' => strlen('prev_new=0&prev_oop=0&f%5B%5D=-1&o=1&s=2&tm=-1&pn='.$user.'&nm=')), 31 | 'postfields' => 'prev_new=0&prev_oop=0&f%5B%5D=-1&o=1&s=2&tm=-1&pn='.$user.'&nm=', 32 | 'convert' => array('windows-1251', 'utf-8//IGNORE'), 33 | ) 34 | ); 35 | $page = str_replace("\t", '', $page); 36 | 37 | if ( ! empty($page)) 38 | { 39 | //сбрасываем варнинг 40 | Database::clearWarnings($tracker); 41 | 42 | preg_match_all('/(.*)<\/a>/', $page, $section); 43 | preg_match_all('/(.*)<\/a>/', $page, $threme); 44 | preg_match_all('/\n

(.*)<\/p>\n(

(.*)<\/p>)?\s?<\/td>/', $page, $dates); 45 | 46 | if (count($section[1]) == count($threme[1]) && count($threme[1]) == count($dates[1])) 47 | { 48 | for ($i=0; $i 0) 67 | { 68 | for ($i=0; $i 'POST', 79 | 'returntransfer' => 1, 80 | 'url' => 'https://rutracker.org/forum/dl.php?t='.$torrent_id, 81 | 'cookie' => rutracker::$sess_cookie.'; bb_dl='.$torrent_id, 82 | 'sendHeader' => array('Host' => 'rutracker.org', 'Content-length' => strlen(rutracker::$sess_cookie)), 83 | 'referer' => 'https://rutracker.org/forum/dl.php?t='.$torrent_id, 84 | ) 85 | ); 86 | 87 | if (Sys::checkTorrentFile($torrent)) 88 | { 89 | $message = $toDownload[$i]['threme'].' добавлена для скачивания.'; 90 | $status = Sys::saveTorrent($tracker, $toDownload[$i]['threme_id'], $torrent, $toDownload[$i]['threme_id'], 0, $message, date('d M Y H:i'), $name); 91 | 92 | //обновляем время регистрации торрента в базе 93 | Database::setDownloaded($toDownload[$i]['id']); 94 | } 95 | else 96 | Errors::setWarnings($tracker, 'torrent_file_fail'); 97 | } 98 | } 99 | } 100 | } 101 | } 102 | } 103 | ?> 104 | -------------------------------------------------------------------------------- /trackers/tfile.cc.engine.php: -------------------------------------------------------------------------------- 1 | 'GET', 47 | 'header' => 0, 48 | 'returntransfer' => 1, 49 | 'url' => 'http://tfile.cc/forum/viewtopic.php?t='.$torrent_id 50 | ) 51 | ); 52 | 53 | if ( ! empty($page)) 54 | { 55 | //ищем на странице дату регистрации торрента 56 | if (preg_match('/class=\"regDate\">(.+)<\/span>/', $page, $array)) 57 | { 58 | //проверяем удалось ли получить дату со страницы 59 | if (isset($array[1])) 60 | { 61 | //если дата не равна ничему 62 | if ( ! empty($array[1])) 63 | { 64 | //находим имя торрента для скачивания 65 | if (preg_match('/download\.php\?id=(\d+)&ak=(\d+)/', $page, $link)) 66 | { 67 | //сбрасываем варнинг 68 | Database::clearWarnings($tracker); 69 | //приводим дату к общему виду 70 | $date = tfile::dateStringToNum($array[1]); 71 | $date_str = tfile::dateNumToString($array[1]); 72 | //если даты не совпадают, перекачиваем торрент 73 | if ($date != $timestamp) 74 | { 75 | //ищем на странице id торрента 76 | $download_id = $link[1]; 77 | $ak_id = $link[2]; 78 | //сохраняем торрент в файл 79 | $torrent = Sys::getUrlContent( 80 | array( 81 | 'type' => 'GET', 82 | 'returntransfer' => 1, 83 | 'url' => 'http://tfile.cc/forum/download.php?id='.$download_id.'&ak='.$ak_id, 84 | 'sendHeader' => array('Host' => 'tfile.cc'), 85 | 'referer' => 'http://tfile.cc/forum/viewtopic.php?t='.$torrent_id, 86 | ) 87 | ); 88 | 89 | if (Sys::checkTorrentFile($torrent)) 90 | { 91 | if ($auto_update) 92 | { 93 | $name = Sys::parseHeader($tracker, $page); 94 | //обновляем заголовок торрента в базе 95 | Database::setNewName($id, $name); 96 | } 97 | 98 | $message = $name.' обновлён.'; 99 | $status = Sys::saveTorrent($tracker, $torrent_id, $torrent, $id, $hash, $message, $date_str, $name); 100 | 101 | //обновляем время регистрации торрента в базе 102 | Database::setNewDate($id, $date); 103 | //сбрасываем варнинг 104 | Database::clearWarnings($tracker); 105 | Database::setErrorToThreme($id, 0); 106 | } 107 | else 108 | Errors::setWarnings($tracker, 'torrent_file_fail', $id); 109 | } 110 | Database::setErrorToThreme($id, 0); 111 | } 112 | else 113 | { 114 | //устанавливаем варнинг 115 | if (tfile::$warning == NULL) 116 | { 117 | tfile::$warning = TRUE; 118 | Errors::setWarnings($tracker, 'cant_find_dowload_link', $id); 119 | } 120 | //останавливаем процесс выполнения, т.к. не может работать без кук 121 | tfile::$exucution = FALSE; 122 | } 123 | } 124 | else 125 | { 126 | //устанавливаем варнинг 127 | if (tfile::$warning == NULL) 128 | { 129 | tfile::$warning = TRUE; 130 | Errors::setWarnings($tracker, 'cant_find_date', $id); 131 | } 132 | //останавливаем процесс выполнения, т.к. не может работать без кук 133 | tfile::$exucution = FALSE; 134 | } 135 | } 136 | else 137 | { 138 | //устанавливаем варнинг 139 | if (tfile::$warning == NULL) 140 | { 141 | tfile::$warning = TRUE; 142 | Errors::setWarnings($tracker, 'cant_find_date', $id); 143 | } 144 | //останавливаем процесс выполнения, т.к. не может работать без кук 145 | tfile::$exucution = FALSE; 146 | } 147 | } 148 | else 149 | { 150 | //устанавливаем варнинг 151 | if (tfile::$warning == NULL) 152 | { 153 | tfile::$warning = TRUE; 154 | Errors::setWarnings($tracker, 'cant_find_date', $id); 155 | } 156 | //останавливаем процесс выполнения, т.к. не может работать без кук 157 | tfile::$exucution = FALSE; 158 | } 159 | } 160 | else 161 | { 162 | //устанавливаем варнинг 163 | if (tfile::$warning == NULL) 164 | { 165 | tfile::$warning = TRUE; 166 | Errors::setWarnings($tracker, 'cant_get_forum_page', $id); 167 | } 168 | //останавливаем процесс выполнения, т.к. не может работать без кук 169 | tfile::$exucution = FALSE; 170 | } 171 | } 172 | tfile::$warning = NULL; 173 | } 174 | } 175 | ?> -------------------------------------------------------------------------------- /trackers/tfile.cc.search.php: -------------------------------------------------------------------------------- 1 | 'GET', 15 | 'header' => 0, 16 | 'returntransfer' => 1, 17 | 'url' => 'http://search.tfile.cc/?q=&c=0&g=&act=&y=&ql=&a='.$user.'&d=&o=&size_min=0&size_max=0', 18 | 'convert' => array('windows-1251', 'utf-8') 19 | ) 20 | ); 21 | 22 | if ( ! empty($page)) 23 | { 24 | //сбрасываем варнинг 25 | Database::clearWarnings($tracker); 26 | preg_match_all('/\n\t\t\t\t\n\t\t\t\t\t(.*)\n\t\t\t\t<\/td>/', $page, $section); 27 | for ($i=0; $i(.*)<\/a>/U', $section[1][$i], $sections)) 30 | { 31 | $sectionStr = ''; 32 | for ($x=0; $x(.*)<\/a>/U', $page, $threme); 41 | preg_match_all('/\n\t\t\t\t(.*)\s.*\n\t\t\t<\/td>/', $page, $dates); 42 | 43 | if (count($sectionArr) == count($threme[1]) && count($threme[1]) == count($dates[1])) 44 | { 45 | for ($i=0; $i 0) 54 | { 55 | for ($i=0; $i 'GET', 61 | 'header' => 0, 62 | 'returntransfer' => 1, 63 | 'url' => 'http://tfile.cc/forum/viewtopic.php?t='.$toDownload[$i]['threme_id'] 64 | ) 65 | ); 66 | 67 | //находим имя торрента для скачивания 68 | if (preg_match('/download\.php\?id=(\d+)&uk=(\d+)/', $page, $link)) 69 | { 70 | //сбрасываем варнинг 71 | Database::clearWarnings($tracker); 72 | //ищем на странице id торрента 73 | $download_id = $link[1]; 74 | $ak_id = $link[2]; 75 | //сохраняем торрент в файл 76 | $torrent = Sys::getUrlContent( 77 | array( 78 | 'type' => 'GET', 79 | 'returntransfer' => 1, 80 | 'url' => 'http://tfile.cc/forum/download.php?id='.$download_id.'&ak='.$ak_id, 81 | 'sendHeader' => array('Host' => 'tfile.cc'), 82 | 'referer' => 'http://tfile.cc/forum/viewtopic.php?t='.$torrent_id, 83 | ) 84 | ); 85 | 86 | if (Sys::checkTorrentFile($torrent)) 87 | { 88 | $message = $toDownload[$i]['threme'].' добавлена для скачивания.'; 89 | $status = Sys::saveTorrent($toDownload[$i]['tracker'], $toDownload[$i]['threme_id'], $torrent, $toDownload[$i]['threme_id'], 0, $message, date('d M Y H:i'), $name); 90 | 91 | //обновляем время регистрации торрента в базе 92 | Database::setDownloaded($toDownload[$i]['id']); 93 | } 94 | else 95 | Errors::setWarnings($tracker, 'torrent_file_fail'); 96 | } 97 | else 98 | { 99 | //устанавливаем варнинг 100 | if (tfile::$warning == NULL) 101 | { 102 | tfile::$warning = TRUE; 103 | Errors::setWarnings($tracker, 'cant_find_dowload_link'); 104 | } 105 | //останавливаем процесс выполнения, т.к. не может работать без кук 106 | tfile::$exucution = FALSE; 107 | } 108 | } 109 | } 110 | } 111 | } 112 | } -------------------------------------------------------------------------------- /version.txt: -------------------------------------------------------------------------------- 1 | {"system":"2.1.8","database":"2.1.8"} --------------------------------------------------------------------------------