Log.class.php 623 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /**
  3. * Log selected action in database with ip, datetime and optional logged user
  4. * @author valentin carruesco
  5. * @category Core
  6. * @license copyright
  7. */
  8. class Log extends Entity{
  9. public $id,$label,$user,$date,$ip;
  10. protected $fields =
  11. array(
  12. 'id'=>'key',
  13. 'label'=>'longstring',
  14. 'user'=>'string',
  15. 'date'=>'string',
  16. 'ip'=>'string',
  17. );
  18. public static function put($label){
  19. global $myUser;
  20. $log = new Log();
  21. $log->label = $label;
  22. if(is_object($myUser) && $myUser->getLogin() !='') $log->user = $myUser->getLogin();
  23. $log->date = time();
  24. $log->ip = Functions::getIP();
  25. $log->save();
  26. }
  27. }
  28. ?>