Advertisement
Guest User

action_logs.php

a guest
Apr 20th, 2018
516
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.88 KB | None | 0 0
  1. <?php
  2.     /********************************
  3.  
  4.     Author: Tymoteusz `Razor Meister` Bartnik
  5.  
  6.     Contact: battnik90@gmail.com
  7.  
  8.     Function: actions_logs()
  9.  
  10.     ********************************/
  11.  
  12. class actions_logs
  13. {
  14.     private static $name;
  15.     private static $cfg;
  16.     private static $enabled_functions=array();
  17.    
  18.     public function construct($event_name)
  19.     {
  20.         global $cfg;
  21.         self::$cfg = $cfg[$event_name];
  22.         self::$name = $event_name;
  23.        
  24.         foreach(self::$cfg['info'] as $func => $enabled)
  25.             if($enabled)
  26.                 self::$enabled_functions[] = $func;
  27.     }  
  28.  
  29.     public function before_clients()
  30.     {
  31.         global $query, $query_sql, $xbot, $language;
  32.        
  33.         $actions = $query_sql->query("SELECT * FROM `actions` ORDER BY `id` DESC");
  34.         while ($row = $actions->fetch_assoc()) if($row != '') $data[] = $row;
  35.        
  36.         $i=0;
  37.         $desc = "[hr][center][size=14][b]".self::$cfg['top_description']."[/b][/size][/center][hr][table][tr]
  38. [th][size=15][/size][size=9]        [B][U]Fecha[/U][/B]         [B][U]Hora[/U][/B]         [B][U]ID[/U][/B]                   [B][U]Evento del servidor[/U][/B]     [/size][/th][/table]\n\n";
  39.        
  40.         foreach($actions as $action)
  41.         {
  42.             if(in_array($action['name'], self::$enabled_functions))
  43.             {
  44.                 $i++;
  45.                 $date_day = date('d-m-Y', $action['date']);
  46.                 $date_hours = date('G:i:s', $action['date']);
  47.                 $id = $action['id'];
  48.                 if (!preg_match("/(\d{2}):(\d{2}):(\d{2})$/", $date_hours))
  49.                 {
  50.                     $date_hours = "0".$date_hours;
  51.                 }
  52.                 $desc .= "[b]• | ".$date_day." | ".$date_hours." |  ".$id." | [/b] - ".$action['text']."\n";
  53.             }
  54.            
  55.             if($i == self::$cfg['records'])
  56.                 break;
  57.         }
  58.        
  59.         $desc .= $language['function']['down_description'];
  60.        
  61.         if($xbot::check_channel_desc(self::$cfg['channel_id'], $desc))
  62.             $xbot::check_error($query->channelEdit(self::$cfg['channel_id'], array('channel_description' => $desc)), self::$name, self::$cfg['channel_id'], true);
  63.     }
  64. }
  65. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement