HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

One of Custom Pages not showing

jackmaessenjackmaessen ✭✭✭
edited April 2015 in General Banter

I have several pages made with Custom pages plugin. Unfortunately, one of them is not displayed anymore after i did upgrade server configuration php from 5.3 to 5.6.
The page is about an uploadmanagement system with folders and files
This is the page:

<?php if (!defined('APPLICATION')) exit(); ?>

<?php
 /*---------------- show upload page only for administrators ----------------------- */
$AllowedUsers = Gdn::Session()->CheckPermission('Garden.Moderation.Manage');
if(!$AllowedUsers) return;
/*--------------------------- ------------------------- */

 $params = array(
    'path'          =>  "demo/",                //relative path to script
    'rows_per_page' =>  10,                 //rows (items) in folder to display per page
    'max_file_size' =>  2 * 1048576,        //2Mb, this depends on you server setting's 'post_max_size', usually 2Mb on shared servers
    'quota'         =>  5000 * 1048576,     //5Gb user storage quota
    'user_id'       =>  1,                  //usually you'll have S_SESSION['user_id'] here
);

require_once($params['path'] . "jFile.php");
$app = new jFile($params);
?>
<div class="headercontent">
<h3>Upload Area (Mods only)</h3>

   <div class="innercontent">

 test content

 <?php
 $app->display();
 ?>

This gives me a "Something has gone wrong page".
I tried to find out what the proglem exactly is and i noticed when disabling this line:

$app = new jFile($params);
he shows me the "test content" but not the folders.
When testing the same page out of vanilla framework on the webserver, everything works fine.
What could be wrong with this line: $app = new jFile($params);

It should look like this: http://webprofis.nl/modsuploadtest.php

Comments

  • R_JR_J Ex-Fanboy Munich Moderator

    I would suspect the search path is wrong. But you can try to find out what went wrong by adding $Configuration['Debug'] = TRUE; to your /conf/config.php


    jackmaessen
  • jackmaessenjackmaessen ✭✭✭
    edited April 2015

    oke get some more info:

    Notice: Undefined variable: app in /home/vhosts/webprofis.nl/httpdocs/plugins/CustomPages/pages/mods-upload.php on line 33
    
    Fatal error: Call to a member function display() on null in /home/vhosts/webprofis.nl/httpdocs/plugins/CustomPages/pages/mods-upload.php on line 33
    

    Do not understand the "undefined variable": on line 18 in script above, he is defined

  • jackmaessenjackmaessen ✭✭✭
    edited April 2015

    I fixed the undefined index (stupid failure) but now i got this error:

    Still do not uderstand why the script is working standalone outside vanilla.
    Also with other Custom Pages i have no problem.
    And when disabling this line: $app = new jFile($params); ; the page shows me the html on the page
    When this line is enabled: "Something went wrong" page

  • hgtonighthgtonight ∞ · New Moderator

    This means some call passed an object by reference (using the & operator). This is a no-no in new PHP versions.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

    jackmaessen
  • jackmaessenjackmaessen ✭✭✭
    edited April 2015

    @hgtonight
    I opened the file class.thememanager.php. There a lots of this operator: &
    I can replace the double && with and, but i do not know how to handle with the single ones:

    $CacheThemeInfo = &$SearchPathCache['ThemeInfo'];
                if (!is_array($CacheThemeInfo))
                   $CacheThemeInfo = array();
                   // ...
    
    public function IndexSearchPath($SearchPath, &$ThemeInfo, $PathListing = NULL) {
          if (is_null($PathListing) || !is_array($PathListing)) {
             $PathListing = scandir($SearchPath, 0);
             sort($PathListing);
          }
           //...
      // Update the theme info for a format consumable by views.
          if (is_array($ThemeInfo) & isset($ThemeInfo['Options'])) {
             $Options =& $ThemeInfo['Options'];
    
  • R_JR_J Ex-Fanboy Munich Moderator

    You only have to replace "&$variablename" with "$variablename" leave the rest of & where they are


    jackmaessen
  • hgtonighthgtonight ∞ · New Moderator

    @R_J said:
    You only have to replace "&$variablename" with "$variablename" leave the rest of & where they are

    And only on object pointers.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • hmmm... but that still doenst solve my problem with the custom page

Sign In or Register to comment.