Ejemplo n.º 1
0
 public function __construct($card_id, $card_number, $pin)
 {
     $this->card = GiftCard::find($card_id);
     Log::notice("card_id:" . $this->card->id);
     $this->card_number = $card_number;
     $this->pin = $pin;
 }
Ejemplo n.º 2
0
 protected function doesNotContainSomeSay($row)
 {
     $contains = str_contains($row['quote'], 'Some say');
     if (!$contains) {
         Log::notice('Quote does not contain Some say.', ['quote' => $row['quote']]);
         return true;
     }
     return false;
 }
 public function getDelete($incident_id, Request $request)
 {
     $incident = ServerIncident::findOrFail($incident_id);
     if (!$this->can_edit($incident->char_id, $request->user())) {
         abort('403', 'You do not have the required permission');
     }
     $char_id = $incident->char_id;
     Log::notice('perm.incidents.delete - Incident has been deleted', ['user_id' => $request->user()->user_id, 'incident_id' => $incident->id]);
     $incident->delete();
     return redirect()->route('server.chars.show.get', ['char_id' => $char_id]);
 }
Ejemplo n.º 4
0
 private function resetPin()
 {
     $sv = new StoredValue();
     $resetResponse = $sv->changePin($this->card_number);
     if ($resetResponse->getErrorCode() != 0) {
         Log::error('unable to reset pin');
         //discard or retry
     }
     Log::notice('pin after reset while sending purchase mail ' . $resetResponse->getCardPin());
     return $resetResponse->getCardPin();
 }
Ejemplo n.º 5
0
 public function updateMatches()
 {
     Log::notice("Matches updated at " . date("Y-m-d H:i:s", time()));
     $this->updateResultType(10);
     /*
      * Iterates over all matches, creates them if not present, updates if still open
      */
     foreach ($this->matches as $key => $match_json) {
         $teams = $this->findOrCreateTeams($match_json);
         $match = Match::findOrNew($match_json['match']);
         // If match doesn't exist, or is not closed yet
         if (!$match || !$match['closed']) {
             $this->populateMatch($match, $match_json, $teams);
         }
     }
 }
 public function index()
 {
     if (Request::input('l')) {
         LaravelLogViewer::setFile(base64_decode(Request::input('l')));
     }
     if (Request::input('dl')) {
         Log::notice('perm.log.site.download - SiteLog downloaded', ['user_id' => Request::user()->user_id]);
         return Response::download(LaravelLogViewer::pathToLogFile(base64_decode(Request::input('dl'))));
     } elseif (Request::has('del')) {
         File::delete(LaravelLogViewer::pathToLogFile(base64_decode(Request::input('del'))));
         Log::notice('perm.log.site.delete - SiteLog deleted', ['user_id' => Request::user()->user_id]);
         return Redirect::to(Request::url());
     }
     $logs = LaravelLogViewer::all();
     Log::notice('perm.log.site.view - SiteLog opened', ['user_id' => Request::user()->user_id]);
     return View::make('laravel-log-viewer::log', ['logs' => $logs, 'files' => LaravelLogViewer::getFiles(true), 'current_file' => LaravelLogViewer::getFileName()]);
 }
Ejemplo n.º 7
0
 /**
  * Set value to a single node
  */
 protected function setNode($path, $nodeTree)
 {
     // make sure we have the given node on tree
     if (!TraverseArray::has($nodeTree, $path)) {
         throw new MyceliumException("Inconsistent data with set-paths.");
     }
     // get the value
     $value = TraverseArray::get($nodeTree, $path);
     // set the value
     try {
         // try without forcing first
         try {
             $this->mycelium->set($path, $value);
         } catch (ExtendingPrimitiveNodeException $e) {
             // ok, let's force it
             $this->mycelium->set($path, $value, true);
             // log that we had to force
             Log::notice("When saving mycelium node, force was needed.", ["path" => $path]);
         }
     } catch (Exception $e) {
         throw new MyceliumException("An exception has been raised during node setting.");
     }
 }
 public function removeWhitelist($player_id, $whitelist, Request $request)
 {
     if ($request->user()->cannot('server_players_whitelists_edit')) {
         abort('403', 'You do not have the required permission');
     }
     //Get Server Player
     $player = ServerPlayer::findOrFail($player_id);
     $player->strip_player_whitelist_flag($whitelist, $request->user()->username_clean);
     Log::notice('perm.whitelist.remove - Whitelist has been removed', ['user_id' => $request->user()->user_id, 'whitelist' => $whitelist, 'player_ckey' => $player->ckey]);
     return redirect()->route('server.players.show', ['player_id' => $player_id]);
 }
Ejemplo n.º 9
0
 public function removeUser(Request $request, $role_id)
 {
     if ($request->user()->cannot('site_roles_edit')) {
         abort('403', 'You do not have the required permission');
     }
     $role = SiteRole::findOrFail($role_id);
     $user = ForumUserModel::findOrFail($request->input('user'));
     $user->roles()->detach($role);
     Log::notice('perm.site_role.remove_user - Site Role User removed', ['user_id' => $request->user()->user_id, 'role_id' => $role->id, 'role_name' => $role->name, 'target_user_id' => $user->user_id, 'target_user_name' => $user->username_clean]);
     return redirect()->route('site.roles.edit.get', ['role_id' => $role_id]);
 }
Ejemplo n.º 10
0
 /**
  * Normal but significant events.
  *
  * @param string $message
  * @param array $context
  *
  * @return bool
  */
 public function notice($message, array $context = [])
 {
     return Log::notice($message, $context);
 }
Ejemplo n.º 11
0
 /**
  * Report the notice but prevent the (Laravel) error_handler to throw an exception.
  */
 private static function hint($message, $information = null)
 {
     $handler = set_error_handler('error_log');
     restore_error_handler();
     if ($handler !== null) {
         if (is_array($handler) && is_object($handler[0]) && $handler[0] instanceof \Illuminate\Foundation\Bootstrap\HandleExceptions) {
             \Illuminate\Support\Facades\Log::notice($message);
         } else {
             \Sledgehammer\notice($message, $information);
         }
     }
 }
 public function unsubscribe($contract, Request $request)
 {
     $SyndieContract = SyndieContract::findOrfail($contract);
     $SyndieContract->remove_subscribers($request->user()->user_id);
     Log::notice('perm.contracts.unsubscribe - User Unsubscribed from Contract', ['user_id' => $request->user()->user_id, 'contract_id' => $SyndieContract->contract_id]);
     return redirect()->route('syndie.contracts.show', ['contract' => $contract]);
 }
Ejemplo n.º 13
0
 public static function grab_image($url, $saveto)
 {
     $ch = curl_init($url);
     curl_setopt($ch, CURLOPT_HEADER, 0);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
     $raw = curl_exec($ch);
     curl_close($ch);
     try {
         if (file_exists($saveto)) {
             unlink($saveto);
         }
         $fp = fopen($saveto, 'x');
         fwrite($fp, $raw);
     } catch (\Exception $e) {
         Log::notice("Failed to download the logo at " . $url);
         Log::notice($e);
     }
     fclose($fp);
 }
Ejemplo n.º 14
0
 /**
  * Remove all items from the cache.
  *
  * @return void
  */
 public function flush()
 {
     if ($this->log_enabled) {
         Log::notice("Dumber:flush");
     }
     // do nothing
 }
Ejemplo n.º 15
0
 /**
  * @param        $data
  * @param array  $contextualData
  * @param array  $location
  */
 public static function notice($data, array $location = [], array $contextualData = [])
 {
     $msg = self::renderMessage($data, $location);
     /** @noinspection PhpUndefinedMethodInspection */
     BaseLog::notice($msg, $contextualData);
 }
 public function delete(Request $request, $objective)
 {
     $objective = SyndieContractObjective::findOrFail($objective);
     $contract = $objective->contract()->get();
     if ($request->user()->cannot('syndie_contract_moderate') && $contract->contractee_id != $request->user()->id) {
         abort('403', 'You do not have the required permission');
     }
     $objective->status = "deleted";
     $objective->save();
     $objective->delete();
     Log::notice('perm.syndie.objective.delete - Contract Objective has been deleted', ['user_id' => $request->user()->user_id, 'objective_id' => $objective->objective_id]);
     return redirect()->route('syndie.contracts.show', ['contract' => $objective->contract_id]);
 }
 public function delete(Request $request, $action_id)
 {
     if ($request->user()->cannot('ccia_action_edit')) {
         abort('403', 'You do not have permission to edit CCIA Actions.');
     }
     $action = CCIAAction::findOrFail($action_id);
     Log::notice('perm.cciaaction.delete - CCIA Action has been deleted', ['user_id' => $request->user()->user_id, 'action_id' => $action->id]);
     $action->delete();
     return redirect()->route('ccia.actions.index');
 }
 public function delete(Request $request, $generalnotice_id)
 {
     if ($request->user()->cannot('ccia_general_notice_edit')) {
         abort('403', 'You do not have permission to edit CCIA General Notices.');
     }
     $notice = CCIAGeneralNotice::findOrFail($generalnotice_id);
     Log::notice('perm.cciageneralnotice.delete - CCIA General Notice has been deleted', ['user_id' => $request->user()->user_id, 'notice_id' => $notice->id]);
     $notice->delete();
     return redirect()->route('ccia.generalnotice.index');
 }
Ejemplo n.º 19
0
 /**
  * Set the description
  *
  * @param string $description
  *
  * @return SEOElement
  */
 public function setDescription($description)
 {
     if ($this->logging) {
         if (strlen($description) > 160) {
             Log::notice('Meta Description too long - ' . strlen($description) . ' characters - use less than 160 characters');
         }
         if (strlen($description) < 120) {
             Log::notice('Meta Description too short - ' . strlen($description) . ' characters - try to use between 150-160 characters');
         }
     }
     return $this->addProperty('description', strip_tags($description));
 }
 public function postAdd(Request $request)
 {
     $this->validate($request, ['author' => 'required|max:50', 'title' => 'required|max:50', 'content' => 'required', 'category' => 'required|in:Reference,Non-Fiction,Fiction,Religion,Adult']);
     $config = \HTMLPurifier_Config::createDefault();
     $purifier = new HTMLPurifier($config);
     $book = new ServerLibrary();
     $book->author = $request->input('author');
     $book->title = $purifier->purify($request->input('title'));
     $book->content = $purifier->purify($request->input('content'));
     $book->category = $request->input('category');
     $book->uploader = $request->user()->user_byond;
     $book->save();
     Log::notice('perm.library.add - Book has been added', ['user_id' => $request->user()->user_id, 'book_id' => $book->id]);
     return redirect()->route('server.library.show.get', ['book_id' => $book->id]);
 }
Ejemplo n.º 21
0
 public function postAdd(Request $request)
 {
     if ($request->user()->cannot('server_forms_edit')) {
         abort('403', 'You do not have the required permission');
     }
     $this->validate($request, ['id' => 'required|max:9999|numeric', 'name' => 'required|max:50', 'department' => 'required|max:32', 'data' => 'required', 'info' => 'required']);
     $form = new ServerForm();
     $form->id = $request->input('id');
     $form->name = $request->input('name');
     $form->department = $request->input('department');
     $form->data = $request->input('data');
     $form->info = $request->input('info');
     $form->save();
     Log::notice('perm.forms.add - Form has been added', ['user_id' => $request->user()->user_id, 'form_id' => $form->form_id]);
     return redirect()->route('admin.forms.index');
 }
Ejemplo n.º 22
0
 public function delete(Request $request, $comment)
 {
     $comment = SyndieContractComment::findOrFail($comment);
     if ($request->user()->cannot('syndie_contract_moderate')) {
         abort('403', 'You do not have the required permission');
     }
     $comment->delete();
     Log::notice('perm.syndie.contractcomment.delete - Contract Comment has been deleted', ['user_id' => $request->user()->user_id, 'comment_id' => $comment->comment_id]);
     return redirect()->route('syndie.contracts.show', ['contract' => $comment->contract_id]);
 }