Page 1 of 1

PHP Fatal error on CGExtensions v1.64.x -> v1.63.x works

Posted: Wed Aug 07, 2019 9:29 am
by creopard
Hello,
I using the most recent versions of CGBlog (1.15.12) and CGExtensions (1.64.5) with CMSMS 2.2.10

When I edit an existing blog post and klick on "Submit", the following error appears (this does not happen when clicking on "Apply"):
Fatal error: Uncaught Error: Call to undefined method cge_setup::create_uplaoder() in /home/public_html/modules/CGExtensions/lib/class.cge_setup.php:143 Stack trace: #0 /home/public_html/modules/CGBlog/lib/class.cgblog_utils.php(96): cge_setup::get_uploader('', '/home/...') #1 /home/public_html/modules/CGBlog/action.admin_editarticle.php(228): cgblog_utils::handle_uploaded_image('m1_', 17, '2', Array, '') #2 /home/public_html/lib/classes/class.CMSModule.php(1403): include('/home/...') #3 /home/public_html/modules/CGExtensions/CGExtensions.module.php(609): CMSModule->DoAction('admin_editartic...', 'm1_', Array, '') #4 /home/public_html/lib/classes/class.CMSModule.php(1479): CGExtensions->DoAction('admin_editartic...', 'm1_', Array, '') #5 /home/public_html/admin/moduleinterface.php(74): CMSModule->DoActionBase('admin_editartic...', 'm1_', Array, '', Object(Smarty_CMS)) #6 {main} thrown in /home/public_html/modules/CGExtensions/lib/class.cge_setup.php on line 143
However, renaming "cge_setup::create_uplaoder" to "cge_setup::create_uploader" in the file "class.cge_setup.php" just gives futher errors about using "$this"...
Using $this when not in object context ...
Help!

Edit: It works again, if I use the coding from CGExtensions 1.63.3 for the "static public function create_uploader":
static public function create_uploader(string $prefix = '',string $destdir = '') : cge_uploader
{
$watermarker = null;
if( self::$_instance->settings->allow_watermarking ) $watermarker = $this->create_watermarker();

$mod = cge_utils::get_cge();
$obj = new cge_uploader($prefix, $destdir, $watermarker);
$obj->set_accepted_filetypes($mod->GetPreference('alloweduploadfiles'));
$obj->set_accepted_imagetypes($mod->GetPreference('imageextensions'));
$obj->set_preview($mod->GetPreference('allow_resizing',0));
$obj->set_preview_size($mod->GetPreference('resizeimage',0));
$obj->set_watermark($mod->GetPreference('allow_watermarking',0));
$obj->set_thumbnail($mod->GetPreference('allow_thumbnailing',0));
$obj->set_thumbnail_size($mod->GetPreference('thumbnailsize'));
$obj->set_delete_orig($mod->GetPreference('delete_orig_image'));

return $obj;
}

Re: PHP Fatal error on CGExtensions v1.64.x -> v1.63.x works

Posted: Wed Aug 07, 2019 8:02 pm
by rotezecke
there's a newer version of both CGExtensions and CGBlog available. I tested edit, create and delete, all works as expected. CGExtension settings are now in config file.

Re: PHP Fatal error on CGExtensions v1.64.x -> v1.63.x works

Posted: Thu Aug 08, 2019 7:12 am
by creopard
Thank you for the fixes!

But it almost gave me a heart attack, after the CGBlog-module vanished from the admin "content" section, only to find it now under section "extensions".

Re: PHP Fatal error on CGExtensions v1.64.x -> v1.63.x works

Posted: Thu Aug 08, 2019 12:25 pm
by calguy1000
For most of my modules you can now specify the 'admin section' from the config.php.

i.e:
$config['cgblog_adminsection'] = 'content';

then just clear the cache.