News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

SimplePortal

Started by SimplePortal Team, March 10, 2008, 11:16:07 PM

Previous topic - Next topic

dodos26

#5660
Installing another clean forum without any modifications right after clean installation and simple portal installation 2.3.7. After uninstalling simple portal 2.3.7 without removing the database and installing simple portal 2.3.8 beta, it gets a forum clone in the php block.

<?php
{

    global 
$smcFunc$scripturl$modSettings$user_info$txt$context$color_profile$settings$db_prefix;

    
$list_limit 10;
    
$category_id_array_list = array(2);

    
$request $smcFunc['db_query']('''
        SELECT
            m.poster_time, ms.subject, m.id_topic, m.id_member, m.id_msg, b.id_board, b.id_parent, b.name AS board_name, t.num_replies, t.num_views, c.id_cat,
            ' 
. ($user_info['is_guest'] ? '1 AS is_read, 0 AS new_from' '
            IFNULL(lt.id_msg, IFNULL(lmr.id_msg, 0)) >= m.id_msg_modified AS is_read,
            IFNULL(lt.id_msg, IFNULL(lmr.id_msg, -1)) + 1 AS new_from'
) . '
        FROM {db_prefix}topics AS t
            INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
            INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
            INNER JOIN {db_prefix}messages AS ms ON (ms.id_msg = t.id_first_msg)
            LEFT JOIN {db_prefix}categories AS c ON (c.id_cat = b.id_cat)
            LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)' 
. (!$user_info['is_guest'] ? '
            LEFT JOIN {db_prefix}log_topics AS lt ON (lt.id_topic = t.id_topic AND lt.id_member = {int:current_member})
            LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = b.id_board AND lmr.id_member = {int:current_member})' 
'') . '
        WHERE t.id_board != 0 AND c.id_cat = {array_int:category_id_array}' 
. ($modSettings['postmod_active'] ? '
            AND t.approved = {int:approved}
            AND m.approved = {int:approved}' 
'') . '
        ORDER BY t.id_topic DESC
        LIMIT {int:limit}'
,
        array(
            
'approved' => 1,
            
'limit' => $list_limit,
            
'category_id_array' => $category_id_array_list,
            
'current_member' => $user_info['id'],
        )
    );

    
$topics = array();
    while (
$row $smcFunc['db_fetch_assoc']($request))
    {
        
censorText($row['subject']);
        
$topics[] = $row;
    }
    
$smcFunc['db_free_result']($request);

    if (empty(
$topics))
    {
        echo 
$txt['error_sp_no_posts_found'];
        return;
    }
    else
        
$topics[count($topics) - 1]['is_last'] = true;

    
$colorids = array();
    foreach (
$topics as $item)
        
$colorids[] = $item['id_member'];
    
sp_loadColors($colorids);

    echo 
'<table class="sp_fullwidth">';
    
    foreach (
$topics as $item)
    {
        
$allOfParents = array();
        
$allOfParents array_reverse(getBoardParents($item['id_parent']));
        echo 
'
            <tr>
                <td class="sp_recent_icon sp_center">
                    '
sp_embed_image('topic'), '
                </td>
                <td class="sp_recent_subject">
                    <a href="'
$scripturl '?topic=' $item['id_topic'] . '.msg' $item['id_msg'] . ';topicseen#new''">'$item['subject'], '</a> 
                    '
, !empty($item['is_read']) ? '' '<a href="' $scripturl '?topic=' $item['id_topic'] . '.msg' $item['new_from'] . ';topicseen#new"><img src="' $settings['images_url'] . '/' $context['user']['language'] . '/new.gif" alt="' $txt['new'] . '" border="0" /></a>',
                    
'<br />';
                    foreach (
$allOfParents as $Parents_Data)
                    {
                        echo isset(
$Parents_Data['url']) ? '[<a href="' $Parents_Data['url'] . '">' $Parents_Data['name'] . '</a>]' '[' $Parents_Data['name'] . ']';
                        echo 
' » ';
                    }
                    echo 
'[''<a href="' $scripturl '?board=' $item['id_board'] . '.0">' $item['board_name'] . '</a>'']
                </td>
                <td class="sp_recent_info sp_right">
                    '
$color_profile[$item['id_member']]['link'], ' | '$txt['sp-articlesViews'], ': '$item['num_views'], ' | '$txt['sp-articlesComments'], ': '$item['num_replies'], '<br />'timeformat($item['poster_time']), '
                </td>
            </tr>'
;
    }
    echo 
'</table>';

}
?>

Clear install 2.0.19
You cannot view this attachment.


Loook here when patching from 2.0.17 to 2.0.19 work good :)
The problem must be in the clean install itself, there is somewhere a function that is not closed properly.
You cannot view this attachment.


I try also now 2.0.18 clear install and work good.
I try also 2.0.18 and patch to 2.0.19 and work good.

dodos26

Testing further and found that installing smf 2.0.18 and installing a simple portal 2.3.7
The php block will work fine, will also work fine after patching to smf 2.0.19
It will work even after uninstalling and reinstalling simpleportal 2.3.7
But if, when uninstalling simple portal, you select to remove entries in the database, after reinstalling, adding a block will bring up a window in a window.

dodos26

#5662
Yeah i found error before updating smf to 2.0.19 block in the database looks like this:

&lt;?php
{

    global $smcFunc, $scripturl, $modSettings, $user_info, $txt, $context, $color_profile, $settings, $db_prefix;

    $list_limit = 10;
    $category_id_array_list = array(2);

    $request = $smcFunc[&#039;db_query&#039;](&#039;&#039;, &#039;
        SELECT
            m.poster_time, ms.subject, m.id_topic, m.id_member, m.id_msg, b.id_board, b.id_parent, b.name AS board_name, t.num_replies, t.num_views, c.id_cat,
            &#039; . ($user_info[&#039;is_guest&#039;] ? &#039;1 AS is_read, 0 AS new_from&#039; : &#039;
            IFNULL(lt.id_msg, IFNULL(lmr.id_msg, 0)) &gt;= m.id_msg_modified AS is_read,
            IFNULL(lt.id_msg, IFNULL(lmr.id_msg, -1)) + 1 AS new_from&#039;) . &#039;
        FROM {db_prefix}topics AS t
            INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
            INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
            INNER JOIN {db_prefix}messages AS ms ON (ms.id_msg = t.id_first_msg)
            LEFT JOIN {db_prefix}categories AS c ON (c.id_cat = b.id_cat)
            LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)&#039; . (!$user_info[&#039;is_guest&#039;] ? &#039;
            LEFT JOIN {db_prefix}log_topics AS lt ON (lt.id_topic = t.id_topic AND lt.id_member = {int:current_member})
            LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = b.id_board AND lmr.id_member = {int:current_member})&#039; : &#039;&#039;) . &#039;
        WHERE t.id_board != 0 AND c.id_cat = {array_int:category_id_array}&#039; . ($modSettings[&#039;postmod_active&#039;] ? &#039;
            AND t.approved = {int:approved}
            AND m.approved = {int:approved}&#039; : &#039;&#039;) . &#039;
        ORDER BY t.id_topic DESC
        LIMIT {int:limit}&#039;,
        array(
            &#039;approved&#039; =&gt; 1,
            &#039;limit&#039; =&gt; $list_limit,
            &#039;category_id_array&#039; =&gt; $category_id_array_list,
            &#039;current_member&#039; =&gt; $user_info[&#039;id&#039;],
        )
    );

    $topics = array();
    while ($row = $smcFunc[&#039;db_fetch_assoc&#039;]($request))
    {
        censorText($row[&#039;subject&#039;]);
        $topics[] = $row;
    }
    $smcFunc[&#039;db_free_result&#039;]($request);

    if (empty($topics))
    {
        echo $txt[&#039;error_sp_no_posts_found&#039;];
        return;
    }
    else
        $topics[count($topics) - 1][&#039;is_last&#039;] = true;

    $colorids = array();
    foreach ($topics as $item)
        $colorids[] = $item[&#039;id_member&#039;];
    sp_loadColors($colorids);

    echo &#039;&lt;table class=&quot;sp_fullwidth&quot;&gt;&#039;;
   
    foreach ($topics as $item)
    {
        $allOfParents = array();
        $allOfParents = array_reverse(getBoardParents($item[&#039;id_parent&#039;]));
        echo &#039;
            &lt;tr&gt;
                &lt;td class=&quot;sp_recent_icon sp_center&quot;&gt;
                    &#039;, sp_embed_image(&#039;topic&#039;), &#039;
                &lt;/td&gt;
                &lt;td class=&quot;sp_recent_subject&quot;&gt;
                    &lt;a href=&quot;&#039;, $scripturl . &#039;?topic=&#039; . $item[&#039;id_topic&#039;] . &#039;.msg&#039; . $item[&#039;id_msg&#039;] . &#039;;topicseen#new&#039;, &#039;&quot;&gt;&#039;, $item[&#039;subject&#039;], &#039;&lt;/a&gt;
                    &#039;, !empty($item[&#039;is_read&#039;]) ? &#039;&#039; : &#039;&lt;a href=&quot;&#039; . $scripturl . &#039;?topic=&#039; . $item[&#039;id_topic&#039;] . &#039;.msg&#039; . $item[&#039;new_from&#039;] . &#039;;topicseen#new&quot;&gt;&lt;img src=&quot;&#039; . $settings[&#039;images_url&#039;] . &#039;/&#039; . $context[&#039;user&#039;][&#039;language&#039;] . &#039;/new.gif&quot; alt=&quot;&#039; . $txt[&#039;new&#039;] . &#039;&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&#039;,
                    &#039;&lt;br /&gt;&#039;;
                    foreach ($allOfParents as $Parents_Data)
                    {
                        echo isset($Parents_Data[&#039;url&#039;]) ? &#039;[&lt;a href=&quot;&#039; . $Parents_Data[&#039;url&#039;] . &#039;&quot;&gt;&#039; . $Parents_Data[&#039;name&#039;] . &#039;&lt;/a&gt;]&#039; : &#039;[&#039; . $Parents_Data[&#039;name&#039;] . &#039;]&#039;;
                        echo &#039; » &#039;;
                    }
                    echo &#039;[&#039;, &#039;&lt;a href=&quot;&#039; . $scripturl . &#039;?board=&#039; . $item[&#039;id_board&#039;] . &#039;.0&quot;&gt;&#039; . $item[&#039;board_name&#039;] . &#039;&lt;/a&gt;&#039;, &#039;]
                &lt;/td&gt;
                &lt;td class=&quot;sp_recent_info sp_right&quot;&gt;
                    &#039;, $color_profile[$item[&#039;id_member&#039;]][&#039;link&#039;], &#039; | &#039;, $txt[&#039;sp-articlesViews&#039;], &#039;: &#039;, $item[&#039;num_views&#039;], &#039; | &#039;, $txt[&#039;sp-articlesComments&#039;], &#039;: &#039;, $item[&#039;num_replies&#039;], &#039;&lt;br /&gt;&#039;, timeformat($item[&#039;poster_time&#039;]), &#039;
                &lt;/td&gt;
            &lt;/tr&gt;&#039;;
    }
    echo &#039;&lt;/table&gt;&#039;;

}
?&gt;

After update to 2.0.19 block in database look like this:
&lt;?php
{

    global $smcFunc, $scripturl, $modSettings, $user_info, $txt, $context, $color_profile, $settings, $db_prefix;

    $list_limit = 10;
    $category_id_array_list = array(2);

    $request = $smcFunc[&#39;db_query&#39;](&#39;&#39;, &#39;
        SELECT
            m.poster_time, ms.subject, m.id_topic, m.id_member, m.id_msg, b.id_board, b.id_parent, b.name AS board_name, t.num_replies, t.num_views, c.id_cat,
            &#39; . ($user_info[&#39;is_guest&#39;] ? &#39;1 AS is_read, 0 AS new_from&#39; : &#39;
            IFNULL(lt.id_msg, IFNULL(lmr.id_msg, 0)) &gt;= m.id_msg_modified AS is_read,
            IFNULL(lt.id_msg, IFNULL(lmr.id_msg, -1)) + 1 AS new_from&#39;) . &#39;
        FROM {db_prefix}topics AS t
            INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
            INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
            INNER JOIN {db_prefix}messages AS ms ON (ms.id_msg = t.id_first_msg)
            LEFT JOIN {db_prefix}categories AS c ON (c.id_cat = b.id_cat)
            LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)&#39; . (!$user_info[&#39;is_guest&#39;] ? &#39;
            LEFT JOIN {db_prefix}log_topics AS lt ON (lt.id_topic = t.id_topic AND lt.id_member = {int:current_member})
            LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = b.id_board AND lmr.id_member = {int:current_member})&#39; : &#39;&#39;) . &#39;
        WHERE t.id_board != 0 AND c.id_cat = {array_int:category_id_array}&#39; . ($modSettings[&#39;postmod_active&#39;] ? &#39;
            AND t.approved = {int:approved}
            AND m.approved = {int:approved}&#39; : &#39;&#39;) . &#39;
        ORDER BY t.id_topic DESC
        LIMIT {int:limit}&#39;,
        array(
            &#39;approved&#39; =&gt; 1,
            &#39;limit&#39; =&gt; $list_limit,
            &#39;category_id_array&#39; =&gt; $category_id_array_list,
            &#39;current_member&#39; =&gt; $user_info[&#39;id&#39;],
        )
    );

    $topics = array();
    while ($row = $smcFunc[&#39;db_fetch_assoc&#39;]($request))
    {
        censorText($row[&#39;subject&#39;]);
        $topics[] = $row;
    }
    $smcFunc[&#39;db_free_result&#39;]($request);

    if (empty($topics))
    {
        echo $txt[&#39;error_sp_no_posts_found&#39;];
        return;
    }
    else
        $topics[count($topics) - 1][&#39;is_last&#39;] = true;

    $colorids = array();
    foreach ($topics as $item)
        $colorids[] = $item[&#39;id_member&#39;];
    sp_loadColors($colorids);

    echo &#39;&lt;table class=&quot;sp_fullwidth&quot;&gt;&#39;;
   
    foreach ($topics as $item)
    {
        $allOfParents = array();
        $allOfParents = array_reverse(getBoardParents($item[&#39;id_parent&#39;]));
        echo &#39;
            &lt;tr&gt;
                &lt;td class=&quot;sp_recent_icon sp_center&quot;&gt;
                    &#39;, sp_embed_image(&#39;topic&#39;), &#39;
                &lt;/td&gt;
                &lt;td class=&quot;sp_recent_subject&quot;&gt;
                    &lt;a href=&quot;&#39;, $scripturl . &#39;?topic=&#39; . $item[&#39;id_topic&#39;] . &#39;.msg&#39; . $item[&#39;id_msg&#39;] . &#39;;topicseen#new&#39;, &#39;&quot;&gt;&#39;, $item[&#39;subject&#39;], &#39;&lt;/a&gt;
                    &#39;, !empty($item[&#39;is_read&#39;]) ? &#39;&#39; : &#39;&lt;a href=&quot;&#39; . $scripturl . &#39;?topic=&#39; . $item[&#39;id_topic&#39;] . &#39;.msg&#39; . $item[&#39;new_from&#39;] . &#39;;topicseen#new&quot;&gt;&lt;img src=&quot;&#39; . $settings[&#39;images_url&#39;] . &#39;/&#39; . $context[&#39;user&#39;][&#39;language&#39;] . &#39;/new.gif&quot; alt=&quot;&#39; . $txt[&#39;new&#39;] . &#39;&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&#39;,
                    &#39;&lt;br /&gt;&#39;;
                    foreach ($allOfParents as $Parents_Data)
                    {
                        echo isset($Parents_Data[&#39;url&#39;]) ? &#39;[&lt;a href=&quot;&#39; . $Parents_Data[&#39;url&#39;] . &#39;&quot;&gt;&#39; . $Parents_Data[&#39;name&#39;] . &#39;&lt;/a&gt;]&#39; : &#39;[&#39; . $Parents_Data[&#39;name&#39;] . &#39;]&#39;;
                        echo &#39; » &#39;;
                    }
                    echo &#39;[&#39;, &#39;&lt;a href=&quot;&#39; . $scripturl . &#39;?board=&#39; . $item[&#39;id_board&#39;] . &#39;.0&quot;&gt;&#39; . $item[&#39;board_name&#39;] . &#39;&lt;/a&gt;&#39;, &#39;]
                &lt;/td&gt;
                &lt;td class=&quot;sp_recent_info sp_right&quot;&gt;
                    &#39;, $color_profile[$item[&#39;id_member&#39;]][&#39;link&#39;], &#39; | &#39;, $txt[&#39;sp-articlesViews&#39;], &#39;: &#39;, $item[&#39;num_views&#39;], &#39; | &#39;, $txt[&#39;sp-articlesComments&#39;], &#39;: &#39;, $item[&#39;num_replies&#39;], &#39;&lt;br /&gt;&#39;, timeformat($item[&#39;poster_time&#39;]), &#39;
                &lt;/td&gt;
            &lt;/tr&gt;&#39;;
    }
    echo &#39;&lt;/table&gt;&#39;;

}
?&gt;

The difference is that old is all &#039; after update is &#39;
You cannot view this attachment.


After changing the code to the old one in the database, it works fine.
Now how fix it where fix it in code.
Or you can insert regular code without replacing " ' " to " &#039 ".

Code ("/Soucres/PortalAdminBlocks.php (608)") Select
        if (!isset($_POST['block_name']) || $smcFunc['htmltrim']($smcFunc['htmlspecialchars']($_POST['block_name']), ENT_QUOTES) === '')
Code ("/Soucres/PortalBlocks.php (3587)") Select
    $content = trim(un_htmlspecialchars($content));

<!--  2.0.19 updates for Load.php  -->
<file name="$sourcedir/Load.php">
<operation>
<search position="replace">
<![CDATA[ return $fix_utf8mb4($ent_check(htmlspecialchars($string, $quote_style, $utf8 ? 'UTF-8' : $charset))); ]]>
</search>
<add>
<![CDATA[ return $fix_utf8mb4($ent_check(htmlspecialchars($string, $quote_style, $utf8 ? 'UTF-8' : $charset), true)); ]]>
</add>
</operation>
</file>

dodos26

Fix the problem with custom blocks:
Found:
Code ("/Soucres/PortalBlocks.php (3587)") Select
$content = trim(un_htmlspecialchars($content));Replace:
$content = trim(htmlspecialchars_decode($content, ENT_QUOTES));

Oldiesmann

What exactly is a "huge flop" about 2.1? It has numerous improvements over 2.0.
Michael Eshom
Christian Metal Fans

Steve

Don't you just love it when people who don't know what they're talking about make generalized criticisms like that?  ::)
Please do not PM me for support. 

Advertisement: