Advertisement:

Author Topic: error 500 when requiring a page  (Read 1270 times)

Offline glennmckenna

  • Jr. Member
  • **
  • Posts: 276
error 500 when requiring a page
« on: October 08, 2017, 08:47:01 AM »
hi i'm trying to include Gallery2.php into my page so i can echo the add image function (there for not having to use iframe), but when ever i do it i either get a error 500 or the page stops loding at that line...

here is the code

Code: [Select]
// Check for any suspicious activity
if (!defined('SMF'))
    die('Hacking attempt...');

function ManageMdl(){
    // Load the .template.php file
    loadTemplate('ManageMdl');

    // Load the language files
    if (loadlanguage('Mdl') == false)
        loadLanguage('Mdl','french-utf8');

    // Gallery Actions
    $subActions = array(
        'main' => 'main',
        'homead' => 'homead',
        'genaff' => 'genaff',
    );

    // Follow the sa or just go to main function
    if (isset($_GET['sa']))
        $sa = $_GET['sa'];
    else
        $sa = '';

    if (!empty($subActions[$sa]))
        $subActions[$sa]();
    else
        mainview();
}

function mainview() {

    global $context, $scripturl;

    $context['page_title'] = $context['forum_name'] . ' - genevent'; // Page title

    $context['sub_template']  = 'mainview';
}

Code: [Select]
function template_mainview() {
    global $boardurl, $context, $settings, $options, $txt, $scripturl, $modSettings, $sourcedir;



    $g_gen = allowedTo('genevent');


    if ($g_gen) {
        echo '
        <script src="../../../scripts/jquery-1.12.0.min.js"></script>
        <script src="', $boardurl, '/Themes/Redsy/scripts/mform.js"></script>

            <div class="col-md-12 col-xs-12 form-box">
               
                <form role="form" action="" method="post" class="registration-form">
                   
                    <fieldset>
                        <div class="form-top">
                            <div class="form-top-left">
                                <h3>' ,$txt['Step'], ' 1 / 4</h3>
                                <p>' ,$txt['Add-img'], '</p>
                            </div>
                        </div>
                        <div>';
        require_once($scripturl . '/Gallery2.php');
        echo AddPicture();
        echo '
                        </div>
                        <div class="form-bottom">
                            <button type="button" class="btn btn-next">Next</button>
                        </div>
                    </fieldset>
                   
                    <fieldset>
                        <div class="form-top">
                            <div class="form-top-left">
                                <h3>Step 2 / 4</h3>
                                <p>Set up your account:</p>
                            </div>
                        </div>
                        <div>
                            456
                        </div>
                        <div class="form-bottom">
                            <button type="button" class="btn btn-previous">Previous</button>
                            <button type="button" class="btn btn-next">Next</button>
                        </div>
                    </fieldset>
                   
                   <fieldset>
                        <div class="form-top">
                            <div class="form-top-left">
                                <h3>Step 3 / 4</h3>
                                <p>Set up your account:</p>
                            </div>
                        </div>
                        <div>
                            789
                        </div>
                        <div class="form-bottom">
                            <button type="button" class="btn btn-previous">Previous</button>
                            <button type="button" class="btn btn-next">Next</button>
                        </div>
                    </fieldset>
                   
                    <fieldset>
                        <div class="form-top">
                            <div class="form-top-left">
                                <h3>Step 4 / 4</h3>
                                <p>Social media profiles:</p>
                            </div>
                        </div>
                        <div>
                            159
                        </div>
                        <div class="form-bottom">
                            <button type="button" class="btn btn-previous">Previous</button>
                           <div class="btn">Sign me up</div>
                        </div>
                    </fieldset>
               
                </form>
               
            </div>



        ';
    }elseif (file_exists(dirname(dirname(__FILE__)) . '/Settings.php'))
    {
        // Found it!
        require(dirname(dirname(__FILE__)) . '/Settings.php');
        header('Location: ' . $boardurl);
    }
// Can't find it... just forget it.
    else
        exit;
}

i've tried putting the require in the php file that is in the sources (the first code) but with no luck...

any help would be great cause i know that it cant be any thing to big but i can't figgur out what it is

Online vbgamer45

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,244
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: error 500 when requiring a page
« Reply #1 on: October 09, 2017, 01:20:47 PM »
I am not sure if it is going to work exactly how you want it.

But it looks ike you just want to include the add picture form? If so that code is from themes/default/Gallery2.template.php
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Offline glennmckenna

  • Jr. Member
  • **
  • Posts: 276
Re: error 500 when requiring a page
« Reply #2 on: October 09, 2017, 04:56:07 PM »
I am not sure if it is going to work exactly how you want it.

But it looks ike you just want to include the add picture form? If so that code is from themes/default/Gallery2.template.php
many thanks but won't ialso this part of code for it to work or do i have to copy and paste into my code ?

Code: [Select]
function AddPicture()
{
global $context, $mbname, $txt, $modSettings, $sourcedir, $smcFunc;

isAllowedTo('smfgallery_add');

     if (isset($_REQUEST['cat']))
   $cat = (int) $_REQUEST['cat'];
    else
        $cat = 0;

    $context['gallery_cat_id'] = $cat;

    if (!isset($context['gallery_pic_title']))
        $context['gallery_pic_title'] = '';

    if (!isset($context['gallery_pic_description']))
        $context['gallery_pic_description'] = '';
    if (!isset($context['gallery_pic_keywords']))
        $context['gallery_pic_keywords'] = '';


$context['sub_template']  = 'add_picture';

$context['page_title'] = $mbname . ' - ' . $txt['gallery_text_title'] . ' - ' . $txt['gallery_form_addpicture'];

// Check if spellchecking is both enabled and actually working.
$context['show_spellchecking'] = !empty($modSettings['enableSpellChecking']) && function_exists('pspell_new');

    $context['linktree'][] = array(
'name' => '<em>' . $txt['gallery_form_addpicture'] . '</em>'
);

// Needed for the WYSIWYG editor.
require_once($sourcedir . '/Subs-Editor.php');

// Now create the editor.
$editorOptions = array(
'id' => 'descript',
'value' => $context['gallery_pic_description'],
'width' => '90%',
'form' => 'picform',
'labels' => array(
'post_button' => ''
),
);


create_control_richedit($editorOptions);
$context['post_box_name'] = $editorOptions['id'];

$dbresult = $smcFunc['db_query']('', "
  SELECT
  id_cat, title
  FROM {db_prefix}gallery_cat ORDER BY roworder ASC");
$context['gallery_cat_list'] = array();
while($row = $smcFunc['db_fetch_assoc']($dbresult))
{
$context['gallery_cat_list'][] = $row;
}
$smcFunc['db_free_result']($dbresult);

}

this is bering in mind that the images will only be uploaded to one category lets say the category id is 9