function detectMessage($app) { // sets up utils $utils = Utils::getInstance(); $wmUtils = WatermarkUtils::getInstance(); $adminUtils = AdminUtils::getInstance(); $session = Session::getInstance(); $user = User::getInstance(); // reads incoming $type = $utils->iStr($app->request()->post('type'), 64); // $mid = $wmUtils->getStoredMid(); $midLen = $wmUtils->getStoredMidLen(); // evals message $message = $utils->getDecBinFromInt($mid, $midLen); // reads incoming song-id and user-id $sid = $utils->iStr($app->request()->post('sid'), 64); $uid = $utils->iStr($app->request()->post('uid'), 64); if (-1 == $uid) { $uid = $user->getId(); } // evals user by given user-id $targetUser = new User($uid); $bucket = $targetUser->getBucket(); // evals song record by the given user and song ids $exc = $adminUtils->loadSong($uid, $sid); // evals *real path of the song $path = ''; if (false != $exc) { $path = $exc[0]['path']; } // starts detect proc $res = $wmUtils->detectMark($bucket, $path, $message); // sets up a result $err = false == $res ? $session->flushError() : ''; $res = false == $res ? 'false' : $res; // $pid = 0; if (false != $res) { $pid = $res[0]; } // $path = $wmUtils->getDetectProcLogpath(); $path = false == $path ? 'false' : $path; // $res = array('req' => 'detectMessage', 'uid' => $uid, 'sid' => $sid, 'pid' => $pid, 'res' => $res, 'err' => $err, 'path' => $path); return $res; }
public function __construct() { $this->session = Session::getInstance(); $this->adminUtils = AdminUtils::getInstance(); $this->webDBUtils = WebDBUtils::getInstance(); }