Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: (Andreas09) {MESSAGE_BLOCK} and {JAVASCRIPT} show up as text.  (Read 4799 times)

0 Members and 1 Guest are viewing this topic.

Schryvers

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 30
(Andreas09) {MESSAGE_BLOCK} and {JAVASCRIPT} show up as text.
« on: November 14, 2012, 11:50:42 am »

Why are they on my site shown as text?

Anyone can helping fix this? Where i need too search voor this bug?

link on Schryvers.nl on top {JAVASCRIPT} and where the message block belong {MESSAGE_BLOCK}
Logged

phill104

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4885
    • Windsurf.me
Re: (Andreas09) {MESSAGE_BLOCK} and {JAVASCRIPT} show up as text.
« Reply #1 on: November 14, 2012, 12:22:41 pm »

Please attach you theme as a zip file and we can take a look. Looks like you may have either modified your files incorrectly or have some corrupt files in your install
Logged
It is a mistake to think you can solve any major problems just with potatoes.

Schryvers

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 30
Re: (Andreas09) {MESSAGE_BLOCK} and {JAVASCRIPT} show up as text.
« Reply #2 on: November 14, 2012, 12:32:24 pm »

I added the theme.php in a txt file... i added something what was usally for 1.4 thats the custom loginbox..

Custom login box works perfectly as you can see on schryvers.nl only thing is the 2 errors. Displays images not anymore in javascript, cant vote anymore, nothing is workin now :(
Logged

Schryvers

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 30
Re: (Andreas09) {MESSAGE_BLOCK} and {JAVASCRIPT} show up as text.
« Reply #3 on: November 14, 2012, 01:06:38 pm »

i added this code to my theme.php for the custom loginbox

before i added this everything worked fine.

Code: [Select]
// ------------------------------------------------------------------------- //
// BEGIN Mod for Custom login box + statistics                                          //
// ------------------------------------------------------------------------- //
  $query = "SELECT COUNT(OWNER_ID) FROM {$CONFIG['TABLE_PICTURES']} WHERE owner_id = ".USER_ID;
$result = mysql_query($query);
$total_upload = mysql_fetch_assoc($result);
mysql_free_result($result);
 
$query = "SELECT COUNT(author_id) FROM {$CONFIG['TABLE_COMMENTS']} WHERE author_id = ".USER_ID;
$result = mysql_query($query);
$total_comments = mysql_fetch_assoc($result);
mysql_free_result($result);

$query = "SELECT user_regdate FROM {$CONFIG['TABLE_USERS']} WHERE user_id = ".USER_ID;
$result = mysql_query($query);
$regdate = mysql_fetch_assoc($result);
mysql_free_result($result);

$custom_login_box = <<<EOT
<form action="login.php?referer=index.php" method="post" name="loginbox" style="margin:0px;">
      <P STYLE="font-size: 8pt;"><b><font color="ab3921" face="Verdana">Gebruikersnaam:</font></b><br>
      <input type="text" class="textinput" size=17 name="username" tabindex="1" style="font-family: Verdana; font-size: 10px; color: #000000" /><br>
<font face="Verdana">&nbsp;</font><br>
<font face="Verdana" color="ab3921"><span style="font-size: 8pt; font-weight: 700">Wachtwoord:</span></font><br>
      <input type="password" class="textinput" maxlength=16 size=17 name="password" tabindex="2" style="font-family: Verdana; font-size: 10px; color: #000000" />
<br>
<input name="remember_me" type="checkbox" value="1" tabindex="3" style="height:13px;width:13px;"/>
<font face="Verdana" size="1">Onthoud mij!</font><br>
<input name="submitted" type="submit" class="button" value="login" tabindex="4">
</form>
EOT;
// ------------------------------------------------------------------------- //
// End Mod for Custom login box + statistics                                            //
// ------------------------------------------------------------------------- //

function pageheader($section, $meta = '')
{
    global $CONFIG, $THEME_DIR;
    global $template_header, $lang_charset, $lang_text_dir, $custom_login_box;
global $total_upload, $total_comments, $regdate; // Mod for Custom statistics

    $custom_header = cpg_get_custom_include($CONFIG['custom_header_path']);

    header('P3P: CP="CAO DSP COR CURa ADMa DEVa OUR IND PHY ONL UNI COM NAV INT DEM PRE"');
    user_save_profile();
// ------------------------------------------------------------------------- //
// BEGIN Mod for Custom login box + statistics                                         //
// ------------------------------------------------------------------------- //
$custom_username = stripslashes(USER_NAME);
if(USER_ID)
$custom_login_box = <<<EOT
<b><font size="8pt" face="Verdana" color="#000000"><span style="font-size: 8pt">Welkom</span></font></b> <font face="Verdana" color="#ab3921"><b><span style="font-size: 8pt">{$custom_username}</span></b> !<br>
</font><br>
<b><font face="verdana" size="1">Geregistreerd:</font></b><br><font face="verdana" size="1"> {$regdate['user_regdate']}</font><br><br>
<font face="Verdana">
<b><font face="verdana" size="1">Reacties gegeven:</font></b><br><font face="verdana" size="1"> {$total_comments['COUNT(author_id)']}</font></font>
EOT;
// ------------------------------------------------------------------------- //
// End Mod for Custom login box + statistics                                            //
// ------------------------------------------------------------------------- //
$template_vars = array('{LANG_DIR}' => $lang_text_dir,
        '{TITLE}' => $CONFIG['gallery_name'] . ' - ' . strip_tags(bb_decode($section)),
        '{CHARSET}' => $CONFIG['charset'] == 'language file' ? $lang_charset : $CONFIG['charset'],
        '{META}' => $meta,
        '{GAL_NAME}' => $CONFIG['gallery_name'],
        '{GAL_DESCRIPTION}' => $CONFIG['gallery_description'],
        '{SYS_MENU}' => theme_main_menu('sys_menu'),
        '{SUB_MENU}' => theme_main_menu('sub_menu'),
        '{ADMIN_MENU}' => theme_admin_mode_menu(),
        '{CUSTOM_HEADER}' => $custom_header,
'{CUSTOM_LOGINBOX}'  => $custom_login_box, // Mod for Custom login box + statistics
        );

    echo template_eval($template_header, $template_vars);
}

/******************************************************************************
** Section <<<theme_html_picture>>> - END
******************************************************************************/
/******************************************************************************
** Section <<<theme_display_album_list_cat>>> - START
******************************************************************************/
// Function to display first level Albums of a category
function theme_display_album_list_cat(&$alb_list, $nbAlb, $cat, $page, $total_pages)
{
    global $CONFIG, $STATS_IN_ALB_LIST, $statistics, $template_tab_display, $template_album_list_cat, $lang_album_list;
    if (!$CONFIG['first_level']) {
        return;
    }

    $theme_alb_list_tab_tmpl = $template_tab_display;

    $theme_alb_list_tab_tmpl['left_text'] = strtr($theme_alb_list_tab_tmpl['left_text'], array('{LEFT_TEXT}' => $lang_album_list['album_on_page']));
    $theme_alb_list_tab_tmpl['page_link'] = strtr($theme_alb_list_tab_tmpl['page_link'], array('{LINK}' => 'index.php?cat=' . $cat . '&amp;page=%d'));

    $tabs = create_tabs($nbAlb, $page, $total_pages, $theme_alb_list_tab_tmpl);
    // echo $template_album_list_cat;
    $template_album_list_cat1 = $template_album_list_cat;
    $album_cell = template_extract_block($template_album_list_cat1, 'c_album_cell');
    $empty_cell = template_extract_block($template_album_list_cat1, 'c_empty_cell');
    $tabs_row = template_extract_block($template_album_list_cat1, 'c_tabs');
    $stat_row = template_extract_block($template_album_list_cat1, 'c_stat_row');
    $spacer = template_extract_block($template_album_list_cat1, 'c_spacer');
    $header = template_extract_block($template_album_list_cat1, 'c_header');
    $footer = template_extract_block($template_album_list_cat1, 'c_footer');
    $rows_separator = template_extract_block($template_album_list_cat1, 'c_row_separator');

    $count = 0;

    $columns = $CONFIG['album_list_cols'];
    $column_width = ceil(100 / $columns);
    $thumb_cell_width = $CONFIG['alb_list_thumb_size'] + 2;

    starttable('99%'); // '100%' destroys the layout if $CONFIG['main_table_width'] is a pixel value

    if ($STATS_IN_ALB_LIST) {
        $params = array('{STATISTICS}' => $statistics,
            '{COLUMNS}' => $columns,
            );
        echo template_eval($stat_row, $params);
    }

    echo $header;

    if (is_array($alb_list)) {
        foreach($alb_list as $album) {
            $count ++;

            $params = array('{COL_WIDTH}' => $column_width,
                '{ALBUM_TITLE}' => $album['album_title'],
                '{THUMB_CELL_WIDTH}' => $thumb_cell_width,
                '{ALB_LINK_TGT}' => "thumbnails.php?album={$album['aid']}",
                '{ALB_LINK_PIC}' => $album['thumb_pic'],
                '{ADMIN_MENU}' => $album['album_adm_menu'],
                '{ALB_DESC}' => $album['album_desc'],
                '{ALB_INFOS}' => '',
                '{ALB_HITS}' => $album['alb_hits'],
                );

            echo template_eval($album_cell, $params);

            if ($count % $columns == 0 && $count < count($alb_list)) {
                echo $rows_separator;
            }
        }
    }

    $params = array('{COL_WIDTH}' => $column_width,
          '{SPACER}' => $thumb_cell_width
          );
    $empty_cell = template_eval($empty_cell, $params);

    while ($count++ % $columns != 0) {
        echo $empty_cell;
    }

    echo $footer;
    // Tab display
    $params = array('{COLUMNS}' => $columns,
        '{TABS}' => $tabs,
        );
    echo template_eval($tabs_row, $params);

    endtable();

    echo $spacer;
}
Logged

Schryvers

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 30
Re: (Andreas09) {MESSAGE_BLOCK} and {JAVASCRIPT} show up as text.
« Reply #4 on: November 14, 2012, 01:57:46 pm »

Anyone who can write that code over for 1.5?

After searching this forum i think the code from the custom login form overwrite 1.5 functions... is that right? And how to solve the problem? I want to "launch" my site and say to everyone that i have one but not with this stupid error :(

Is it possible?
Logged

Schryvers

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 30
Re: (Andreas09) {MESSAGE_BLOCK} and {JAVASCRIPT} show up as text.
« Reply #5 on: November 14, 2012, 08:59:06 pm »

Allright, i fixed it by my self when i open themes.inc.php i saw message_block and javascript so i added this to the code:
Code: [Select]
'{JAVASCRIPT}' => theme_javascript_head(),
 '{MESSAGE_BLOCK}' => theme_display_message_block(),

So here is the code everyone can use, its working very nice. I made the box small so its fitted almost everywhere.

Okay if you want a CUSTOM login box on your template.html for 1.5.x

ADD THESE TO YOUR YOURTHEME/THEME.php
Code: [Select]
// BEGIN Mod for Custom login box + statistics                                          //
// ------------------------------------------------------------------------- //
  $query = "SELECT COUNT(OWNER_ID) FROM {$CONFIG['TABLE_PICTURES']} WHERE owner_id = ".USER_ID;
$result = mysql_query($query);
$total_upload = mysql_fetch_assoc($result);
mysql_free_result($result);
 
$query = "SELECT COUNT(author_id) FROM {$CONFIG['TABLE_COMMENTS']} WHERE author_id = ".USER_ID;
$result = mysql_query($query);
$total_comments = mysql_fetch_assoc($result);
mysql_free_result($result);

$query = "SELECT user_regdate FROM {$CONFIG['TABLE_USERS']} WHERE user_id = ".USER_ID;
$result = mysql_query($query);
$regdate = mysql_fetch_assoc($result);
mysql_free_result($result);

$custom_login_box = <<<EOT
<form action="login.php?referer=index.php" method="post" name="loginbox" style="margin:0px;">
      <P STYLE="font-size: 8pt;"><b><font color="ab3921" face="Verdana">Gebruikersnaam:</font></b><br>
      <input type="text" class="textinput" size=17 name="username" tabindex="1" style="font-family: Verdana; font-size: 10px; color: #000000" /><br>
<font face="Verdana">&nbsp;</font><br>
<font face="Verdana" color="ab3921"><span style="font-size: 8pt; font-weight: 700">Wachtwoord:</span></font><br>
      <input type="password" class="textinput" maxlength=16 size=17 name="password" tabindex="2" style="font-family: Verdana; font-size: 10px; color: #000000" />
<br>
<input name="remember_me" type="checkbox" value="1" tabindex="3" style="height:13px;width:13px;"/>
<font face="Verdana" size="1">Onthoud mij!</font><br>
<input name="submitted" type="submit" class="button" value="login" tabindex="4">
</form>
EOT;
// ------------------------------------------------------------------------- //
// End Mod for Custom login box + statistics                                            //
// ------------------------------------------------------------------------- //

function pageheader($section, $meta = '')
{
    global $CONFIG, $THEME_DIR;
    global $template_header, $lang_charset, $lang_text_dir, $custom_login_box;
global $total_upload, $total_comments, $regdate; // Mod for Custom statistics

    $custom_header = cpg_get_custom_include($CONFIG['custom_header_path']);

    header('P3P: CP="CAO DSP COR CURa ADMa DEVa OUR IND PHY ONL UNI COM NAV INT DEM PRE"');
    user_save_profile();
// ------------------------------------------------------------------------- //
// BEGIN Mod for Custom login box + statistics                                         //
// ------------------------------------------------------------------------- //
$custom_username = stripslashes(USER_NAME);
if(USER_ID)
$custom_login_box = <<<EOT
<b><font size="8pt" face="Verdana" color="#000000"><span style="font-size: 8pt">Welkom</span></font></b> <font face="Verdana" color="#ab3921"><b><span style="font-size: 8pt">{$custom_username}</span></b> !<br>
</font><br>
<b><font face="verdana" size="1">Geregistreerd:</font></b><br><font face="verdana" size="1"> {$regdate['user_regdate']}</font><br><br>
<font face="Verdana">
<b><font face="verdana" size="1">Reacties gegeven:</font></b><br><font face="verdana" size="1"> {$total_comments['COUNT(author_id)']}</font></font>
EOT;
// ------------------------------------------------------------------------- //
// End Mod for Custom login box + statistics                                            //
// ------------------------------------------------------------------------- //

$template_vars = array('{LANG_DIR}' => $lang_text_dir,
        '{TITLE}' => $CONFIG['gallery_name'] . ' - ' . strip_tags(bb_decode($section)),
        '{CHARSET}' => $CONFIG['charset'] == 'language file' ? $lang_charset : $CONFIG['charset'],
        '{META}' => $meta,
        '{GAL_NAME}' => $CONFIG['gallery_name'],
        '{GAL_DESCRIPTION}' => $CONFIG['gallery_description'],
        '{SYS_MENU}' => theme_main_menu('sys_menu'),
        '{SUB_MENU}' => theme_main_menu('sub_menu'),
        '{ADMIN_MENU}' => theme_admin_mode_menu(),
        '{CUSTOM_HEADER}' => $custom_header,
        '{JAVASCRIPT}' => theme_javascript_head(),
        '{MESSAGE_BLOCK}' => theme_display_message_block(),
'{CUSTOM_LOGINBOX}'  => $custom_login_box, // Mod for Custom login box + statistics
        );

    echo template_eval($template_header, $template_vars);
}
/******************************************************************************
** Section <<<theme_html_picture>>> - END
******************************************************************************/
/******************************************************************************
** Section <<<theme_display_album_list_cat>>> - START
******************************************************************************/
// Function to display first level Albums of a category
function theme_display_album_list_cat(&$alb_list, $nbAlb, $cat, $page, $total_pages)
{
    global $CONFIG, $STATS_IN_ALB_LIST, $statistics, $template_tab_display, $template_album_list_cat, $lang_album_list;
    if (!$CONFIG['first_level']) {
        return;
    }

    $theme_alb_list_tab_tmpl = $template_tab_display;

    $theme_alb_list_tab_tmpl['left_text'] = strtr($theme_alb_list_tab_tmpl['left_text'], array('{LEFT_TEXT}' => $lang_album_list['album_on_page']));
    $theme_alb_list_tab_tmpl['page_link'] = strtr($theme_alb_list_tab_tmpl['page_link'], array('{LINK}' => 'index.php?cat=' . $cat . '&amp;page=%d'));

    $tabs = create_tabs($nbAlb, $page, $total_pages, $theme_alb_list_tab_tmpl);
    // echo $template_album_list_cat;
    $template_album_list_cat1 = $template_album_list_cat;
    $album_cell = template_extract_block($template_album_list_cat1, 'c_album_cell');
    $empty_cell = template_extract_block($template_album_list_cat1, 'c_empty_cell');
    $tabs_row = template_extract_block($template_album_list_cat1, 'c_tabs');
    $stat_row = template_extract_block($template_album_list_cat1, 'c_stat_row');
    $spacer = template_extract_block($template_album_list_cat1, 'c_spacer');
    $header = template_extract_block($template_album_list_cat1, 'c_header');
    $footer = template_extract_block($template_album_list_cat1, 'c_footer');
    $rows_separator = template_extract_block($template_album_list_cat1, 'c_row_separator');

    $count = 0;

    $columns = $CONFIG['album_list_cols'];
    $column_width = ceil(100 / $columns);
    $thumb_cell_width = $CONFIG['alb_list_thumb_size'] + 2;

    starttable('99%'); // '100%' destroys the layout if $CONFIG['main_table_width'] is a pixel value

    if ($STATS_IN_ALB_LIST) {
        $params = array('{STATISTICS}' => $statistics,
            '{COLUMNS}' => $columns,
            );
        echo template_eval($stat_row, $params);

    }
    echo $header;

    if (is_array($alb_list)) {
        foreach($alb_list as $album) {
            $count ++;

            $params = array('{COL_WIDTH}' => $column_width,
                '{ALBUM_TITLE}' => $album['album_title'],
                '{THUMB_CELL_WIDTH}' => $thumb_cell_width,
                '{ALB_LINK_TGT}' => "thumbnails.php?album={$album['aid']}",
                '{ALB_LINK_PIC}' => $album['thumb_pic'],
                '{ADMIN_MENU}' => $album['album_adm_menu'],
                '{ALB_DESC}' => $album['album_desc'],
                '{ALB_INFOS}' => '',
                '{ALB_HITS}' => $album['alb_hits'],
                );

            echo template_eval($album_cell, $params);

            if ($count % $columns == 0 && $count < count($alb_list)) {
                echo $rows_separator;
            }
        }
    }

    $params = array('{COL_WIDTH}' => $column_width,
          '{SPACER}' => $thumb_cell_width
          );
    $empty_cell = template_eval($empty_cell, $params);

    while ($count++ % $columns != 0) {
        echo $empty_cell;
    }

    echo $footer;
    // Tab display
    $params = array('{COLUMNS}' => $columns,
        '{TABS}' => $tabs,
        );
    echo template_eval($tabs_row, $params);

    endtable();

    echo $spacer;
}


AND ADD THIS WHEREVER YOU WANT THE LOGINBOX SHOULD COME
Code: [Select]
{CUSTOM_LOGINBOX}

I think alot of people like this one. Its workin 100% ENJOY IT@!

SOLVED
Logged

Schryvers

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 30
Re: (Andreas09) {MESSAGE_BLOCK} and {JAVASCRIPT} show up as text.
« Reply #6 on: November 14, 2012, 09:06:45 pm »

Pictures:
Logged
Pages: [1]   Go Up
 

Page created in 0.044 seconds with 20 queries.