public static function getInstance() { if (null == self::$instance) { self::$instance = new WatermarkUtils(); } return self::$instance; }
public function __construct() { $this->session = Session::getInstance(); $this->user = User::getInstance(); $this->webDBUtils = WebDBUtils::getInstance(); $this->procUtils = ProcUtils::getInstance(); $this->wmUtils = WatermarkUtils::getInstance(); $this->log = Log::getInstance(); }
function readDetectProcLog($app) { // sets up utils $utils = Utils::getInstance(); $wmUtils = WatermarkUtils::getInstance(); $session = Session::getInstance(); $user = User::getInstance(); // reads incoming $uid = $utils->iStr($app->request()->post('uid'), 64); if (false == $uid) { $uid = $user->getId(); } if (-1 == $uid) { $uid = $user->getId(); } // $pid = $utils->iStr($app->request()->post('pid'), 64); // $path = $utils->iStr($app->request()->post('path'), 128); // sets up a new user $targetUser = new User(intval($uid)); $path = Settings::storage . $targetUser->getBucket() . '/marked/' . $path; // reads log file of current detect proc $res = $wmUtils->readDetectProcLog($path); $err = false == $res ? $session->flushError() : ''; $res = false == $res ? 'false' : $res; // evaluates whether or not proc (pid) is running $proc = $wmUtils->isProcRunning($pid); $proc = false == $proc ? 'false' : 'true'; // sets up result $res = array('req' => 'readDetectProcLog', 'res' => $res, 'err' => $err, 'proc' => $proc); return $res; }
<?php $wmUtils = WatermarkUtils::getInstance(); $type = $wmUtils->settings->type; $mid = $wmUtils->settings->mid; $midLen = $wmUtils->settings->midLen; $multi = 'multi' == $type ? 'checked' : ''; $uni = 'uni' == $type ? 'checked' : ''; $l_save = L::__('Save Settings'); $l_writeMessage = L::__('Watermark all Files'); $l_uniMessageSel = L::__('Messages of type UNI'); $l_multiMessageSel = L::__('Messages of type MULTI (periodic)'); $l_messageAsString = L::__('Message as String (depr.)'); $l_messageAsID = L::__('MessageID'); $l_len = L::__('of length'); $l_message = L::__('Message'); print <<<EOD <div id="messageinput"> \t<div class="input-group input-group-lg"> \t\t<span class="input-group-addon">{$l_messageAsID}<br>{$l_len}</span> \t\t<input type="number" id="mid" class="form-control" value="{$mid}" placeholder="{$mid}"> \t\t<input type="number" id="midLen" class="form-control" value="{$midLen}" placeholder="{$midLen}"> \t</div> \t<div class="radio"> \t\t<form id="types"> \t\t<label> \t\t\t<input type="radio" name="type" id="uni" value="uni" {$uni}> \t\t\t{$l_uniMessageSel}\t \t\t</label>
public function __construct() { $this->watermarkUtils = WatermarkUtils::getInstance(); }