Not allowed extension

Current Version: 2.0.2
Released: 2013-10-27
Forum rules
Before creating a new support thread, please take a look at the board3 Portal FAQ and use the search!
Many questions have already been answered.
Locked

Topic author
KillBill
Active Member
Posts: 3
Joined: 31. October 2011 22:38
phpBB.com User: KillBill.

Not allowed extension

Post by KillBill »

Code: Select all

[phpBB Debug] PHP Notice: in file /portal/includes/functions_upload.php on line 159: Undefined variable: mod_dir
Otherwise, congratulations on this portal engine, very nice work.

Topic author
KillBill
Active Member
Posts: 3
Joined: 31. October 2011 22:38
phpBB.com User: KillBill.

Upload new module

Post by KillBill »

Acp/mods/portal/Upload module

The field is empty then an error occurs.

Code: Select all

[phpBB Debug] PHP Notice: in file /portal/includes/functions_upload.php on line 58: Undefined index: NO_UPLOAD_FILE
-----------------------------------------------------------------------------------------------

Other:

A default mod directory structure is as follows.
  • contrib
    • ...
  • root
    • ...
  • install.xml
  • license.txt
  • modx.prosilver.en.xsl
In this case, the module will upload error add. (Module corrupted)
So I propose the following change.

portal/includes/functions_upload.php

find

Code: Select all

                    // make sure we set $mod_dir to the correct folder after the above step
                    $mod_dir = (isset($new_mod_dir)) ? $new_mod_dir : $mod_dir; 
after add

Code: Select all

                    // check root folder
                    $relative_mod_dir = (file_exists("$mod_dir/root")) ? "$mod_dir/root" : $mod_dir; 
find

Code: Select all

                    $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($mod_dir)); // requires PHP 5  
replace

Code: Select all

                    $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($relative_mod_dir)); // requires PHP 5  
find

Code: Select all

                    foreach($iterator as $cur_file)
                    { 
after add

Code: Select all

                        if (in_array($cur_file->getFilename(), array('.', '..', 'license.txt')))
                        {
                            continue;
                        } 
find

Code: Select all

                        $cur_path = str_replace($mod_dir . '/', '', $cur_path);
                        $cut_pos = strpos($cur_path, '/');
                        
                        // Only allow files in adm, language, portal and styles folder
                        if(!in_array(substr($cur_path, 0, $cut_pos), array('adm', 'language', 'portal', 'styles')) && $cur_file->getFilename() != 'license.txt') 
replace

Code: Select all

                        $cur_path = str_replace($relative_mod_dir . '/', '', $cur_path);
                        $cut_pos = strpos($cur_path, '/');

                        // Only allow files in adm, language, portal and styles folder
                        if (!in_array(substr($cur_path, 0, $cut_pos), array('adm', 'language', 'portal', 'styles'))) 
find

Code: Select all

                            $actions['NEW_FILES'][$mod_dir . '/' . $cur_path] = $phpbb_root_path . $cur_path; 
replace

Code: Select all

                            $actions['NEW_FILES'][$relative_mod_dir . '/' . $cur_path] = $phpbb_root_path . $cur_path; 
So the upload modul is successful.

------------------------------------------------
Other:

Code: Select all

        @chmod($to, octdec(0644)); 
deleted

//@chmod($to, octdec(0644));

or changed

@chmod($to, 0644);

The files attribute is too small, so the portal can not display icon image.
Files attributes after uploading = 420
User avatar

MyLady
Sponsor
Posts: 134
Joined: 30. November 2009 16:11
phpBB.de User: Scanialady
phpBB.com User: Scanialady
Contact:

Re: Not allowed extension

Post by MyLady »

Files attributes after uploading = 420
I've noticed that too
sorry for my bad english - I'm german and google is my friend :D

Topic author
KillBill
Active Member
Posts: 3
Joined: 31. October 2011 22:38
phpBB.com User: KillBill.

Re: Not allowed extension

Post by KillBill »

If no new module and click add module

Code: Select all

[phpBB Debug] PHP Warning: in file [ROOT]/includes/acp/acp_portal.php on line 845: array_multisort() [function.array-multisort]: Argument #1 is expected to be an array or a sort flag
Locked

Return to “Board3 Portal 2.0.x - English Support”