The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bug in admin.php in 4.4
#1
In admin.php, you have this function:

 function usView($file){
   global $abs_us_root;
   global $us_url_root;
   if(file_exists($abs_us_root.$us_url_root.'usersc/includes/admin/'.$file)){
     $path = $abs_us_root.$us_url_root.'usersc/admin/'.$file;
   }else{
     $path = $abs_us_root.$us_url_root.'users/views/'.$file;
   }
   return $path;
 }


It's looking for the override file in the wrong place.  The line where $path is set seems like it should be:

$path = $abs_us_root.$us_url_root.'usersc/includes/admin/'.$file;

Also, if you fix the aforementioned bug and manage to load a custom view, the admin dashboard also displays on the same screen due to this default code at the end of the switch in admin.php:

   default:
   if($view != ''){
   logger($user->data()->id,"Errors","Tried to visit unsupported view ($view) in admin.php");
   }
   include($abs_us_root.$us_url_root.'users/views/_admin_dashboard.php');



There needs to be some way to not show the dashboard if a custom view has been instantiated earlier. Also, there's no need to log an error in this situation.
  Reply
#2
Thanks for the report, Hayden. We'll look into this.
  Reply
#3
(02-02-2019, 12:36 AM)haydentech Wrote: In admin.php, you have this function:

 function usView($file){
   global $abs_us_root;
   global $us_url_root;
   if(file_exists($abs_us_root.$us_url_root.'usersc/includes/admin/'.$file)){
     $path = $abs_us_root.$us_url_root.'usersc/admin/'.$file;
   }else{
     $path = $abs_us_root.$us_url_root.'users/views/'.$file;
   }
   return $path;
 }


It's looking for the override file in the wrong place.  The line where $path is set seems like it should be:

$path = $abs_us_root.$us_url_root.'usersc/includes/admin/'.$file;

Also, if you fix the aforementioned bug and manage to load a custom view, the admin dashboard also displays on the same screen due to this default code at the end of the switch in admin.php:

   default:
   if($view != ''){
   logger($user->data()->id,"Errors","Tried to visit unsupported view ($view) in admin.php");
   }
   include($abs_us_root.$us_url_root.'users/views/_admin_dashboard.php');



There needs to be some way to not show the dashboard if a custom view has been instantiated earlier.  Also, there's no need to log an error in this situation.

Hi Hayden. Thanks so much for the report. I think I got it.  This replaces users/admin.php
https://pastebin.com/iqP2b1Uu

The way this works is if you take that view called users/views/_aaaa_master_view_template.php and copy it to usersc/includes/admin/whatever.php you can call
admin.php?view=whatever and your view will load.  If you call admin.php?view=whatever2 and that file doesn't exist, you'll just get the dashboard.

Let me know if that works for you. It's slated to go out in 4.4.02
Thanks for your help.
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)