MyBB Community Forums

Full Version: MyBB-PageManager
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6
Hi there SvePu! Big Grin

I'm trying to load 'ElFinder' into MyBB Page-Manager but I get a parse error. It's nothing to do with Elfinder itself since it loads perfectly on an XenForo page with the exact same elfinder code.

Parse error: syntax error, unexpected 'url' (T_STRING) in E:\XAMPP\htdocs\mybb\inc\plugins\pagemanager.php(989) : eval()'d code on line 27

The plugin doesn't seem to like the 'url' part of the elfinder code, this url loads the connector for elfinder.
<?php
global $headerinclude, $header, $theme, $footer, $templates, $lang, $user;
$template = '<html>
<head>
<title>' . $pages['name'] . '</title>
{$headerinclude}
</head>
<body>
{$header}
{$errors}
<div class="forumthreadtitleleft"></div><div class="forumthreadtitle"><span class="cl6">Clearance</span> - File Manager</div><div class="forumthreadtitleright"></div>

<link rel="stylesheet" type="text/css" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css" />
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>

<link rel="stylesheet" type="text/css" media="screen" href="http://localhost/filemanager/css/elfinder.min.css">
<script type="text/javascript" src="http://localhost/filemanager/js/elfinder.min.js"></script>

<!-- Mac OS X Finder style for jQuery UI smoothness theme (OPTIONAL) -->
<link rel="stylesheet" type="text/css" media="screen" href="localhost/filemanager/css/theme.css">

<script type="text/javascript" charset="utf-8">
    $().ready(function() {
        var elf = $('#elfinder').elfinder({
        // lang: 'ru',             // language (OPTIONAL)
		url : 'http://localhost/filemanager/php/connector.minimal.php'  // connector URL (REQUIRED)
       }).elfinder('instance');            
    });
</script>

<!-- Element where elFinder will be created (REQUIRED) -->
<div id="elfinder"></div>

{$footer}
</body>
</html>';

$template = str_replace("\'", "'", addslashes($template));

add_breadcrumb($pages['name']);

eval("\$page = \"" . $template . "\";");

output_page($page);

?>

If you would like to test this out yourself you can download ElFinder here - https://github.com/Studio-42/elFinder

Just tried it on OUGC Pages (Loving the categories that it has by the way) and it spits out the same error.. XenForo handles it fine. I'm lost.
Mask all single quotes into $template with a \ (backslash) 😉
(2017-02-27, 09:19 AM)SvePu Wrote: [ -> ]Mask all single quotes into $template with a \ (backslash) 😉

Agh! How did I miss that. Sad

I wonder why XF was fine with it.
<?php
global $headerinclude, $header, $theme, $footer, $templates, $lang, $user;
$template = '<html>
<head>
<title>' . $pages['name'] . '</title>
{$headerinclude}
</head>
<body>
{$header}
{$errors}
<div class="forumthreadtitleleft"></div><div class="forumthreadtitle"><span class="cl6">Clearance</span> - File Manager</div><div class="forumthreadtitleright"></div>

<link rel="stylesheet" type="text/css" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css" />
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>

<link rel="stylesheet" type="text/css" media="screen" href="http://localhost/filemanager/css/elfinder.min.css">
<script type="text/javascript" src="http://localhost/filemanager/js/elfinder.min.js"></script>
<link rel="stylesheet" type="text/css" media="screen" href="localhost/filemanager/css/theme.css">

<script type="text/javascript" charset="utf-8">
    $().ready(function() {
        var elf = $(\'#elfinder\').elfinder({
 url : \'http://localhost/filemanager/php/connector.minimal.php\'
       }).elfinder(\'instance\');            
    });
</script>
<div id="elfinder"></div>

{$footer}
</body>
</html>';

$template = str_replace("\'", "'", addslashes($template));

add_breadcrumb($pages['name']);

eval("\$page = \"" . $template . "\";");

output_page($page);

?>
SvePu,

Have you ever thought about changing the usergroup selection method in PageManager? The dropdown is quite small and it's kind of irritating to use with a lot of usergroups.

Do you think it would be possible to add a setting or something that switches it to checkboxes?
Version 2.1.2 online! - I've updated first post with more infos.

@BritishKitten: This new version has a bigger groupselect box Wink

[Image: pm_2-1-2_changes_1.PNG]
If MyBB templated is switched off, PHP works.
But vice versa not.
Version 2.1.3 online! - I've updated first post for more infos.

[attachment=40408]
I noticed that when you add content to the text area it tends to stretch everything out wide. This does make editing things a little more difficult than usual. 

It looks fine without text, but then anything longer than the basic width makes everything stretch out. See attachment of what I mean.
Hello, initially thank you very much SvePu for developing this excellent plugin. I would like to suggest that pages created with MyBB-PageManager be integrated into the MyBB search engine.

Detailing: When we use the forum's search system, pages created with the PageManager do not appear in the results. So, it would be great if the MyBB search system finds words from the pages created with MyBB-PageManager.

Thank you for your attention and success always!

PS: English is not the language of my country, if my suggestion is not clear, just let me know.
Pages: 1 2 3 4 5 6