public function setHandlers() { $theSettings = rTorrentSettings::get(); $pathToXmpp = dirname(__FILE__); $req = new rXMLRPCRequest(); if ($this->message !== '' && isset($this->jabberServer) && isset($this->jabberLogin) && isset($this->jabberPasswd) && isset($this->jabberFor)) { $cmd = $theSettings->getOnFinishedCommand(array('xmpp' . getUser(), getCmd('execute.nothrow.bg') . '={' . getPHP() . ',' . $pathToXmpp . '/notify.php,"$' . getCmd('d.name') . '=","' . getUser() . '"}')); } else { $cmd = $theSettings->getOnFinishedCommand(array('xmpp' . getUser(), getCmd('cat='))); } $req->addCommand($cmd); return $req->success(); }
<?php require_once "../../php/util.php"; if (!isset($HTTP_RAW_POST_DATA)) { $HTTP_RAW_POST_DATA = file_get_contents("php://input"); } $ret = array(); if (isset($HTTP_RAW_POST_DATA)) { $vars = explode('&', $HTTP_RAW_POST_DATA); foreach ($vars as $var) { $parts = explode("=", $var); if ($parts[0] == "hash") { $ret[] = $parts[1]; } } if (count($ret)) { $fname = getTempDirectory() . 'rutorrent-prm-' . getUser() . time(); file_put_contents($fname, serialize($ret)); shell_exec(getPHP() . " -f " . escapeshellarg(dirname(__FILE__) . "/batch_check.php") . " " . escapeshellarg($fname) . " " . getUser() . " > /dev/null 2>&1 &"); // shell_exec( getPHP()." -f ".escapeshellarg(dirname( __FILE__)."/batch_check.php")." ".escapeshellarg($fname)." ".getUser()." > /tmp/1 2>/tmp/2 &" ); } } cachedEcho('{}', "application/json");
public function setHandlers() { global $rootPath; if ($this->enabled) { $cmd = rTorrentSettings::get()->getOnFinishedCommand(array('unpack' . getUser(), getCmd('execute') . '={' . getPHP() . ',' . $rootPath . '/plugins/unpack/update.php,$' . getCmd('d.get_directory') . '=,$' . getCmd('d.get_base_filename') . '=,$' . getCmd('d.is_multi_file') . '=,$' . getCmd('d.get_custom1') . '=,$' . getCmd('d.get_name') . '=,' . getCmd('d.get_hash') . '=,' . getUser() . '}')); } else { $cmd = rTorrentSettings::get()->getOnFinishedCommand(array('unpack' . getUser(), getCmd('cat='))); } $req = new rXMLRPCRequest($cmd); return $req->success(); }
public function setHandlers() { global $rootPath; $throttleRulesExist = false; $ratioRulesExist = false; foreach ($this->lst as $item) { if ($item->ratio != '') { $ratioRulesExist = true; } if ($item->channel != '') { $throttleRulesExist = true; } } if ($ratioRulesExist) { eval(getPluginConf('ratio')); $insCmd = ''; for ($i = 0; $i < MAX_RATIO; $i++) { $insCmd .= getCmd('d.views.has=') . 'rat_' . $i . ',,'; } $ratCmd = getCmd('d.set_custom') . '=x-extratio1,"$' . getCmd('execute_capture') . '={' . getPHP() . ',' . $rootPath . '/plugins/extratio/update.php,\\"$' . getCmd('t.multicall') . '=$' . getCmd('d.get_hash') . '=,' . getCmd('t.get_url') . '=,' . getCmd('cat') . '=#\\",$' . getCmd('d.get_custom1') . '=,ratio,' . getUser() . '}" ; ' . getCmd('branch') . '=$' . getCmd('not') . '=$' . getCmd('d.get_custom') . '=x-extratio1,,' . $insCmd . getCmd('view.set_visible') . '=$' . getCmd('d.get_custom') . '=x-extratio1'; } else { $ratCmd = getCmd('cat='); } if ($throttleRulesExist) { $thrCmd = getCmd('d.set_custom') . '=x-extratio2,"$' . getCmd('execute_capture') . '={' . getPHP() . ',' . $rootPath . '/plugins/extratio/update.php,\\"$' . getCmd('t.multicall') . '=$' . getCmd('d.get_hash') . '=,' . getCmd('t.get_url') . '=,' . getCmd('cat') . '=#\\",$' . getCmd('d.get_custom1') . '=,channel,' . getUser() . '}" ; ' . getCmd('branch') . '=$' . getCmd('not') . '=$' . getCmd('d.get_custom') . '=x-extratio2,,' . getCmd('d.set_throttle_name') . '=$' . getCmd('d.get_custom') . '=x-extratio2'; } else { $thrCmd = getCmd('cat='); } $req = new rXMLRPCRequest(array(rTorrentSettings::get()->getOnInsertCommand(array('_exratio1' . getUser(), $ratCmd)), rTorrentSettings::get()->getOnInsertCommand(array('_exratio2' . getUser(), $thrCmd)))); return $req->success(); }
if (isset($_REQUEST['piece_size'])) { $piece_size = $_REQUEST['piece_size'] * 1024; } if (!$pathToCreatetorrent || $pathToCreatetorrent == "") { $pathToCreatetorrent = $useExternal; } if ($useExternal == "mktorrent") { $piece_size = log($piece_size, 2); } else { if ($useExternal === false) { $useExternal = "inner"; } } $task = new rTask(array('arg' => call_user_func('getFileName', $path_edit), 'requester' => 'create', 'name' => 'create', 'path_edit' => $_REQUEST['path_edit'], 'trackers' => $_REQUEST['trackers'], 'comment' => $_REQUEST['comment'], 'start_seeding' => $_REQUEST['start_seeding'], 'piece_size' => $_REQUEST['piece_size'], 'private' => $_REQUEST['private'])); $commands = array(); $commands[] = escapeshellarg($rootPath . '/plugins/create/' . $useExternal . '.sh') . " " . $task->id . " " . escapeshellarg(getPHP()) . " " . escapeshellarg($pathToCreatetorrent) . " " . escapeshellarg($path_edit) . " " . $piece_size . " " . escapeshellarg(getUser()) . " " . escapeshellarg(rTask::formatPath($task->id)); $commands[] = '{'; $commands[] = 'chmod a+r "${dir}"/result.torrent'; $commands[] = '}'; $ret = $task->start($commands, 0); break; } else { $error = 'Incorrect directory (' . mb_substr($path_edit, mb_strlen($topDirectory) - 1) . ')'; } } $ret = array("no" => -1, "pid" => 0, "status" => 255, "log" => array(), "errors" => array($error)); break; case "getfile": $dir = rTask::formatPath($_REQUEST['no']); $torrent = new Torrent($dir . "/result.torrent"); if (!$torrent->errors()) {
if (!chdir(dirname(__FILE__))) { exit; } if (count($argv) > 1) { $usr = $argv[1] == '--daemon' ? 3 : 2; if (count($argv) > $usr) { $_SERVER['REMOTE_USER'] = $argv[$usr]; } } require_once "./util_rt.php"; require_once "./autotools.php"; eval(getPluginConf('autotools')); // If we are not in background, run this script in background array_shift($argv); if (!rtIsDaemon($argv)) { rtDaemon(getPHP(), basename(__FILE__), $argv); // script was exited at the line above } // arguments array was shifted and "--daemon" param was added, so: // 0: --daemon // 1: hash // 2: username $AutoLabel_Sem = rtSemGet(fileinode(__FILE__)); rtSemLock($AutoLabel_Sem); function Debug($str) { global $autodebug_enabled; if ($autodebug_enabled) { rtDbg("AutoLabel", $str); } }
<?php eval(getPluginConf($plugin["name"])); require_once '../plugins/trafic/ratios.php'; $st = getSettingsPath(); makeDirectory(array($st . '/trafic', $st . '/trafic/trackers', $st . '/trafic/torrents')); $req = new rXMLRPCRequest($theSettings->getScheduleCommand("trafic", $updateInterval, getCmd('execute') . '={sh,-c,' . escapeshellarg(getPHP()) . ' ' . escapeshellarg($rootPath . '/plugins/trafic/update.php') . ' ' . escapeshellarg(getUser()) . ' & exit 0}')); if ($req->run() && !$req->fault) { $theSettings->registerPlugin($plugin["name"], $pInfo["perms"]); } else { $jResult .= "plugin.disable(); noty('trafic: '+theUILang.pluginCantStart,'error');"; } $jResult .= "plugin.collectStatForTorrents = " . ($collectStatForTorrents ? "true;" : "false;"); $jResult .= "plugin.updateInterval = " . $updateInterval . ";"; $jResult .= "plugin.disableClearButton = " . ($disableClearButton ? "true" : "false") . ";";
public function setHandlers() { $startAt = 0; $req = new rXMLRPCRequest(rTorrentSettings::get()->getScheduleCommand("rss", $this->data->interval, getCmd('execute') . '={sh,-c,' . escapeshellarg(getPHP()) . ' ' . escapeshellarg(dirname(__FILE__) . '/update.php') . ' ' . escapeshellarg(getUser()) . ' & exit 0}', $startAt)); if ($req->success()) { $this->setStartTime($startAt); return true; } return false; }
<?php require_once "xmlrpc.php"; eval(getPluginConf($plugin["name"])); $session = rTorrentSettings::get()->session; if (!strlen($session) || !@file_exists(addslash(rTorrentSettings::get()->session) . '.')) { $jResult .= "plugin.disable(); noty('" . $plugin["name"] . ": '+theUILang.webBadSessionError+' (" . $session . ").','error');"; } else { if ($updateInterval) { $req = new rXMLRPCRequest($theSettings->getScheduleCommand('rutracker_check', $updateInterval, getCmd('execute') . '={sh,-c,' . escapeshellarg(getPHP()) . ' ' . escapeshellarg(dirname(__FILE__) . '/update.php') . ' ' . escapeshellarg(getUser()) . ' &}')); if ($req->success()) { $theSettings->registerPlugin($plugin["name"], $pInfo["perms"]); } else { $jResult .= "plugin.disable(); noty('rutracker_check: '+theUILang.pluginCantStart, 'error');"; } } else { require 'done.php'; $theSettings->registerPlugin($plugin["name"], $pInfo["perms"]); } }
public function setHandlers() { global $checkTimesInterval; $req = new rXMLRPCRequest($this->hasTimes() ? rTorrentSettings::get()->getScheduleCommand("ratio", $checkTimesInterval, getCmd('execute') . '={sh,-c,' . escapeshellarg(getPHP()) . ' ' . escapeshellarg(dirname(__FILE__) . '/update.php') . ' ' . escapeshellarg(getUser()) . ' & exit 0}') : rTorrentSettings::get()->getRemoveScheduleCommand("ratio")); return $req->success(); }
public function setHandlers() { if (rTorrentSettings::get()->linkExist) { $req = new rXMLRPCRequest($this->hasAuto() ? rTorrentSettings::get()->getScheduleCommand("loginmgr", 1440, getCmd('execute') . '={sh,-c,' . escapeshellarg(getPHP()) . ' ' . escapeshellarg(dirname(__FILE__) . '/update.php') . ' ' . escapeshellarg(getUser()) . ' & exit 0}') : rTorrentSettings::get()->getRemoveScheduleCommand("loginmgr")); $req->success(); } }
public function setHandlers() { global $autowatch_interval; $theSettings = rTorrentSettings::get(); $req = new rXMLRPCRequest($theSettings->getOnInsertCommand(array('autolabel' . getUser(), getCmd('cat=')))); $pathToAutoTools = dirname(__FILE__); if ($this->enable_label) { $cmd = $theSettings->getOnInsertCommand(array('_autolabel' . getUser(), getCmd('branch') . '=$' . getCmd('not') . '=$' . getCmd("d.get_custom1") . '=,"' . getCmd('execute') . '={' . getPHP() . ',' . $pathToAutoTools . '/label.php,$' . getCmd("d.get_hash") . '=,' . getUser() . '}"')); } else { $cmd = $theSettings->getOnInsertCommand(array('_autolabel' . getUser(), getCmd('cat='))); } $req->addCommand($cmd); if ($this->enable_move && trim($this->path_to_finished) != '') { if ($theSettings->iVersion < 0x808) { $cmd = $theSettings->getOnFinishedCommand(array('automove' . getUser(), getCmd('d.set_custom') . '=x-dest,"$' . getCmd('execute_capture') . '={' . getPHP() . ',' . $pathToAutoTools . '/move.php,$' . getCmd('d.get_hash') . '=,$' . getCmd('d.get_base_path') . '=,$' . getCmd('d.get_base_filename') . '=,$' . getCmd('d.is_multi_file') . '=,' . getUser() . '}" ; ' . getCmd('branch') . '=$' . getCmd('not') . '=$' . getCmd('d.get_custom') . '=x-dest,,' . getCmd('d.set_directory_base') . '=$' . getCmd('d.get_custom') . '=x-dest')); } else { if ($this->fileop_type == "Move") { $cmd = $theSettings->getOnFinishedCommand(array('automove' . getUser(), getCmd('d.set_directory_base') . '="$' . getCmd('execute_capture') . '={' . getPHP() . ',' . $pathToAutoTools . '/check.php,$' . getCmd('d.get_base_path') . '=,$' . getCmd('d.get_base_filename') . '=,$' . getCmd('d.is_multi_file') . '=,' . getUser() . '}" ; ' . getCmd('execute') . '={' . getPHP() . ',' . $pathToAutoTools . '/move.php,$' . getCmd('d.get_hash') . '=,$' . getCmd('d.get_base_path') . '=,$' . getCmd('d.get_base_filename') . '=,$' . getCmd('d.is_multi_file') . '=,' . getUser() . '}')); } else { $cmd = $theSettings->getOnFinishedCommand(array('automove' . getUser(), getCmd('execute') . '={' . getPHP() . ',' . $pathToAutoTools . '/move.php,$' . getCmd('d.get_hash') . '=,$' . getCmd('d.get_base_path') . '=,$' . getCmd('d.get_base_filename') . '=,$' . getCmd('d.is_multi_file') . '=,' . getUser() . '}')); } } } else { $cmd = $theSettings->getOnFinishedCommand(array('automove' . getUser(), getCmd('cat='))); } $req->addCommand($cmd); if ($this->enable_watch && trim($this->path_to_watch) != '') { $cmd = $theSettings->getAbsScheduleCommand('autowatch', $autowatch_interval, getCmd('execute') . '={sh,-c,' . escapeshellarg(getPHP()) . ' ' . escapeshellarg($pathToAutoTools . '/watch.php') . ' ' . escapeshellarg(getUser()) . ' &}'); } else { $cmd = $theSettings->getRemoveScheduleCommand('autowatch'); } $req->addCommand($cmd); return $req->success(); }
<?php require_once '../plugins/retrackers/retrackers.php'; $req = new rXMLRPCRequest(array($theSettings->getOnInsertCommand(array('tadd_trackers1' . getUser(), getCmd('d.set_custom4') . '=$' . getCmd('cat') . '=$' . getCmd('d.get_state='))), $theSettings->getOnInsertCommand(array('tadd_trackers2' . getUser(), getCmd('branch') . '=$' . getCmd('not') . '=$' . getCmd('d.get_custom3') . '=,"' . getCmd('cat') . '=$' . getCmd('d.stop') . '=,\\"$' . getCmd('execute') . '={sh,' . $rootPath . '/plugins/retrackers/run.sh' . ',' . getPHP() . ',$' . getCmd('d.get_hash') . '=,' . getUser() . '}\\"" ; ' . getCmd('d.set_custom3='))))); if ($req->run() && !$req->fault) { $theSettings->registerPlugin($plugin["name"], $pInfo["perms"]); $trks = rRetrackers::load(); $jResult .= $trks->get(); } else { $jResult .= "plugin.disable(); noty('retrackers: '+theUILang.pluginCantStart,'error');"; }
chmod($randName, 0644); $piece_size = 262144; if (isset($_REQUEST['piece_size'])) { $piece_size = $_REQUEST['piece_size'] * 1024; } if (!$pathToCreatetorrent || $pathToCreatetorrent == "") { $pathToCreatetorrent = $useExternal; } if ($useExternal == "mktorrent") { $piece_size = log($piece_size, 2); } else { if ($useExternal === false) { $useExternal = "inner"; } } $req = new rXMLRPCRequest(new rXMLRPCCommand("execute", array("sh", "-c", escapeshellarg($rootPath . '/plugins/create/' . $useExternal . '.sh') . " " . $taskNo . " " . escapeshellarg(getPHP()) . " " . escapeshellarg($pathToCreatetorrent) . " " . escapeshellarg($path_edit) . " " . $piece_size . " " . escapeshellarg(getUser()) . " " . escapeshellarg(getTempDirectory()) . " &"))); if ($req->success()) { $ret = array("no" => intval($taskNo), "errors" => array(), "status" => -1, "out" => ""); } } else { $error = 'theUILang.incorrectDirectory'; } } break; case "check": if (isset($_REQUEST['no'])) { $taskNo = $_REQUEST['no']; $dir = getTempDirectory() . getUser() . $taskNo; if (is_file($dir . '/pid') && is_readable($dir . '/pid')) { $pid = trim(file_get_contents($dir . '/pid')); $status = -1;
<?php require_once 'xmlrpc.php'; eval(getPluginConf($plugin["name"])); $listPath = getSettingsPath() . "/erasedata"; @makeDirectory($listPath); $thisDir = dirname(__FILE__); $req = new rXMLRPCRequest(array($theSettings->getOnEraseCommand(array('erasedata0' . getUser(), getCmd('d.open') . '= ; ' . getCmd('branch=') . getCmd('d.get_custom5') . '=,"' . getCmd('f.multicall') . '=,\\"' . getCmd('execute') . '={' . $thisDir . '/cat.sh,' . $listPath . ',$system.pid=,$' . getCmd('f.get_frozen_path') . '=}\\""')), $theSettings->getOnEraseCommand(array('erasedata1' . getUser(), getCmd('branch=') . getCmd('d.get_custom5') . '=,"' . getCmd('execute') . '={' . $thisDir . '/fin.sh,' . $listPath . ',$' . getCmd('system.pid') . '=,$' . getCmd('d.get_hash') . '=,$' . getCmd('d.get_base_path') . '=,$' . getCmd('d.is_multi_file') . '=,$' . getCmd('d.get_custom5') . '=}"')), $theSettings->getAbsScheduleCommand("erasedata", $garbageCheckInterval, getCmd('execute') . '={sh,-c,' . escapeshellarg(getPHP()) . ' ' . escapeshellarg($thisDir . '/update.php') . ' ' . escapeshellarg(getUser()) . ' &}'))); if ($req->success()) { $theSettings->registerPlugin($plugin["name"], $pInfo["perms"]); } else { $jResult .= "plugin.disable(); noty('erasedata: '+theUILang.pluginCantStart,'error');"; }
public function setHandlers() { global $rootPath; if ($this->log["addition"] || $this->log["pushbullet_enabled"] && $this->log["pushbullet_addition"]) { $addCmd = getCmd('execute') . '={' . getPHP() . ',' . $rootPath . '/plugins/history/update.php' . ',1,$' . getCmd('d.get_name') . '=,$' . getCmd('d.get_size_bytes') . '=,$' . getCmd('d.get_bytes_done') . '=,$' . getCmd('d.get_up_total') . '=,$' . getCmd('d.get_ratio') . '=,$' . getCmd('d.get_creation_date') . '=,$' . getCmd('d.get_custom') . '=addtime,$' . getCmd('d.get_custom') . '=seedingtime' . ',"$' . getCmd('t.multicall') . '=$' . getCmd('d.get_hash') . '=,' . getCmd('t.get_url') . '=,' . getCmd('cat') . '=#",$' . getCmd('d.get_custom1') . "=,\$" . getCmd('d.get_custom') . "=x-pushbullet," . getUser() . '}'; } else { $addCmd = getCmd('cat='); } if ($this->log["finish"] || $this->log["pushbullet_enabled"] && $this->log["pushbullet_finish"]) { $finCmd = getCmd('execute') . '={' . getPHP() . ',' . $rootPath . '/plugins/history/update.php' . ',2,$' . getCmd('d.get_name') . '=,$' . getCmd('d.get_size_bytes') . '=,$' . getCmd('d.get_bytes_done') . '=,$' . getCmd('d.get_up_total') . '=,$' . getCmd('d.get_ratio') . '=,$' . getCmd('d.get_creation_date') . '=,$' . getCmd('d.get_custom') . '=addtime,$' . getCmd('d.get_custom') . '=seedingtime' . ',"$' . getCmd('t.multicall') . '=$' . getCmd('d.get_hash') . '=,' . getCmd('t.get_url') . '=,' . getCmd('cat') . '=#",$' . getCmd('d.get_custom1') . "=,\$" . getCmd('d.get_custom') . "=x-pushbullet," . getUser() . '}'; } else { $finCmd = getCmd('cat='); } if ($this->log["deletion"] || $this->log["pushbullet_enabled"] && $this->log["pushbullet_deletion"]) { $delCmd = getCmd('execute') . '={' . getPHP() . ',' . $rootPath . '/plugins/history/update.php' . ',3,$' . getCmd('d.get_name') . '=,$' . getCmd('d.get_size_bytes') . '=,$' . getCmd('d.get_bytes_done') . '=,$' . getCmd('d.get_up_total') . '=,$' . getCmd('d.get_ratio') . '=,$' . getCmd('d.get_creation_date') . '=,$' . getCmd('d.get_custom') . '=addtime,$' . getCmd('d.get_custom') . '=seedingtime' . ',"$' . getCmd('t.multicall') . '=$' . getCmd('d.get_hash') . '=,' . getCmd('t.get_url') . '=,' . getCmd('cat') . '=#",$' . getCmd('d.get_custom1') . "=,\$" . getCmd('d.get_custom') . "=x-pushbullet," . getUser() . '}'; } else { $delCmd = getCmd('cat='); } $req = new rXMLRPCRequest(array(rTorrentSettings::get()->getOnInsertCommand(array('thistory' . getUser(), $addCmd)), rTorrentSettings::get()->getOnFinishedCommand(array('thistory' . getUser(), $finCmd)), rTorrentSettings::get()->getOnEraseCommand(array('thistory' . getUser(), $delCmd)))); return $req->success(); }
<?php require_once 'rquota.php'; $qt = rQuota::load(); $qt->update(); $tm = getdate(); $startAt = mktime($tm["hours"], (int) ($tm["minutes"] / $quotaUpdateInterval) * $quotaUpdateInterval + $quotaUpdateInterval, 0, $tm["mon"], $tm["mday"], $tm["year"]) - $tm[0]; if ($startAt < 0) { $startAt = 0; } $interval = $quotaUpdateInterval * 60; $req = new rXMLRPCRequest(array(new rXMLRPCCommand("schedule", array('quotaspace' . getUser(), $startAt . "", $interval . "", getCmd('execute') . '={sh,-c,' . escapeshellarg(getPHP()) . ' ' . escapeshellarg($rootPath . '/plugins/quotaspace/update.php') . ' ' . escapeshellarg(getUser()) . ' & exit 0}')), $theSettings->getOnResumedCommand(array('quotapauser' . getUser(), getCmd('execute') . '={sh,' . $rootPath . '/plugins/quotaspace/run.sh' . ',' . getPHP() . ',$' . getCmd("d.get_hash") . '=,$' . getCmd("d.get_complete") . '=,' . getUser() . '}')))); if ($req->success()) { $theSettings->registerPlugin($plugin["name"], $pInfo["perms"]); } else { $jResult .= "plugin.disable(); log('quotaspace: '+theUILang.pluginCantStart);"; }
} else { if ($parts[0] == "move_fastresume") { $move_fastresume = trim($parts[1]); } } } } } } Debug(""); Debug("--- begin ---"); Debug($datadir); Debug("\"" . ($move_addpath == '0' ? "don't " : "") . "add path\"" . ", \"" . ($move_datafiles == '0' ? "don't " : "") . "move files\"" . ", \"" . ($move_fastresume == '0' ? "don't " : "") . "fast resume\""); if ($hash && strlen($datadir) > 0) { $script_dir = rtAddTailSlash(dirname(__FILE__)); $php = getPHP(); Debug("script dir : " . $script_dir); Debug("path to php : " . $php); Debug("hash : " . $hash); Debug("data dir : " . $datadir); Debug("add path : " . $move_addpath); Debug("move files : " . $move_datafiles); Debug("fast resume : " . $move_fastresume); $res = rtExec("execute", array("sh", "-c", escapeshellarg($php) . " " . escapeshellarg($script_dir . "setdir.php") . " " . $hash . " " . escapeshellarg($datadir) . " " . $move_addpath . " " . $move_datafiles . " " . $move_fastresume . " " . escapeshellarg(getUser()) . " & exit 0"), $datadir_debug_enabled); if (!$res) { $errors[] = array('desc' => "theUILang.datadirSetDirFail", 'prm' => $datadir); } } } Debug("--- end ---"); cachedEcho(safe_json_encode(array("errors" => $errors)), "application/json");