Changeset 1853 in ExiteCMS


Ignore:
Timestamp:
10/16/08 11:37:18 (3 years ago)
Author:
hverton
Message:

fixed session issue in the albums module
blog previous now breaks after a complete paragraph
fixed PHP notice in feeds.php when using PHP5
fixed MySQL error in viewforum.php/viewposts.php when using MySQL v5.x
fixed PHP warning in calls.httpdownload.php when using PHP5
added locale direction (ltr/rtl) to hoteditor
fixed issue with ocassional empty [URL] tags in hoteditor
fixed wrong returncode from sendemail() in sendmail_include.php
fixed issues in session management when behind loadbalanced proxies or ISP links (changing public IP address)
fixed typo in the album gallery edit template
fixed mismatched quotes in pm post causing hoteditor message retrieval to fail
fixed versioning issue in the menu, user info and welcome panel module installers
fixed PHP notice in setuser.php

Location:
trunk
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/albums.php

    r1810 r1853  
    703703                    $variables['album']['photo_count'] = dbfunction("COUNT(*)", "album_photos", "album_id = ".$album_id); 
    704704                    // SWFUpload needs this, Flash doesn't maintain the session 
    705                     $variables['session_id'] = $_COOKIE['site_visited']; 
     705                    $variables['session_id'] = _session_ua(); 
    706706                    $variables['session_name'] = $_COOKIE[$settings['session_name']]; 
    707707                    // to check security when uploading 
  • trunk/blogs.php

    r1425 r1853  
    198198                    ORDER BY blog_datestamp DESC LIMIT ".$settings['blogs_indexsize']); 
    199199        } 
     200        error_reporting(E_ALL); 
    200201        while ($data = dbarray($result)) { 
    201202            // store the blog entry(s) 
    202203            $data['blog_text'] = stripslashes($data['blog_text']); 
     204            $idx = 0; 
     205            while ($next = strpos($data['blog_text'], "<br /><br />", $idx)) { 
     206                if ($next > 500) break; 
     207                $idx = $next + 1; 
     208            } 
     209            if ($next) $idx = $next; 
     210            if ($idx) { 
     211                $data['blog_intro'] = substr($data['blog_text'],0, $idx); 
     212                $data['read_more'] = true; 
     213            } else { 
     214                $data['blog_intro'] = $data['blog_text']; 
     215                $data['read_more'] = false; 
     216            } 
    203217            // count comments for this blog entry 
    204218            $data['comments'] = $data['blog_comments'] ? dbcount("(comment_id)", "comments", "comment_type='B' AND comment_item_id='".$data['blog_id']."'") : 0; 
  • trunk/feeds.php

    r1476 r1853  
    7272            $item['description'] = "<![CDATA[ <b>".$data['user_name']." ".$locale['401']."</b> ".(strlen($data['post_message']) > 500 ? (substr($data['post_message'],0,496)." ...") : $data['post_message'])." ]]>"; 
    7373            // locale must be english for this to work! 
    74             $loc = setlocale("LC_TIME", "en_US"); 
     74            $loc = setlocale(LC_TIME, "en_US"); 
    7575            $item['pubDate'] = strftime("%a, %d %b %G %T %z", $data['post_datestamp']); 
    76             setlocale("LC_TIME", $loc); 
     76            setlocale(LC_TIME, $loc); 
    7777            $item['guid'] = $item['link'];  // make the guid equal to the link, we don't have a need for permalinks 
    7878            $feed[] = $item; 
  • trunk/forum/viewforum.php

    r1715 r1853  
    153153    "SELECT t.*, MAX(p.post_id) AS last_post, COUNT(p.post_id) AS thread_replies, tu1.user_name AS user_author, tu1.user_ip AS user_ip,  
    154154            tu2.user_name AS user_lastuser, tu1.user_cc_code AS user_cc_code FROM ".$db_prefix."threads t 
    155         INNER JOIN ".$db_prefix."posts p USING ( thread_id ) 
     155        INNER JOIN ".$db_prefix."posts p ON t.thread_id = p.thread_id 
    156156        LEFT JOIN ".$db_prefix."users tu1 ON t.thread_author = tu1.user_id 
    157157        LEFT JOIN ".$db_prefix."users tu2 ON t.thread_lastuser = tu2.user_id 
  • trunk/forum/viewposts.php

    r1715 r1853  
    3838    "SELECT tp.*, tf.* FROM ".$db_prefix."posts tp 
    3939    INNER JOIN ".$db_prefix."threads th USING(thread_id) 
    40     INNER JOIN ".$db_prefix."forums tf USING(forum_id) 
     40    INNER JOIN ".$db_prefix."forums tf ON tp.forum_id = tf.forum_id 
    4141    WHERE ".($thread_limit==0?"":" th.thread_lastpost > ".$thread_limit." AND ").groupaccess('forum_access').($forum_id ? " AND tp.forum_id = '$forum_id'" : "") 
    4242); 
     
    5252    "SELECT tp.*, tf.* FROM ".$db_prefix."posts tp 
    5353    INNER JOIN ".$db_prefix."threads th USING(thread_id) 
    54     INNER JOIN ".$db_prefix."forums tf USING(forum_id) 
     54    INNER JOIN ".$db_prefix."forums tf ON tp.forum_id = tf.forum_id 
    5555    WHERE ".($thread_limit==0?"":" th.thread_lastpost > ".$thread_limit." AND ").groupaccess('forum_access').($forum_id ? " AND tp.forum_id = '$forum_id'" : "")." 
    5656    ORDER BY post_datestamp DESC  
  • trunk/includes/class.httpdownload.php

    r863 r1853  
    238238  **/ 
    239239  function _header($var) { 
    240     if ($this->handler['header']) return @call_user_func($this->handler['header'],$var); 
    241     else return header($var); 
     240    if ($this->handler['header']) $ret = @call_user_func($this->handler['header'],$var); 
     241    else $ret = header($var); 
     242    return $ret; 
    242243  } 
    243244 
    244245  function &_fopen($file,$mode) { 
    245     if ($this->handler['fopen']) return @call_user_func($this->handler['fopen'],$file,$mode); 
    246     else return fopen($file,$mode); 
     246    if ($this->handler['fopen']) $ret = @call_user_func($this->handler['fopen'],$file,$mode); 
     247    else $ret = fopen($file,$mode); 
     248    return $ret; 
    247249  } 
    248250 
    249251  function _fclose($res) { 
    250     if ($this->handler['fclose']) return @call_user_func($this->handler['fclose'],$res); 
    251     else return fclose($res); 
     252    if ($this->handler['fclose']) $ret = @call_user_func($this->handler['fclose'],$res); 
     253    else $ret = fclose($res); 
     254    return $ret; 
    252255  } 
    253256 
    254257  function _fseek($res,$len) { 
    255     if ($this->handler['fseek']) return @call_user_func($this->handler['fseek'],$res,$len); 
    256     else return fseek($res,$len); 
     258    if ($this->handler['fseek']) $ret = @call_user_func($this->handler['fseek'],$res,$len); 
     259    else $ret = fseek($res,$len); 
     260    return $ret; 
    257261  } 
    258262 
    259263  function &_fread($file,$size) { 
    260     if ($this->handler['fread']) return @call_user_func($this->handler['fread'],$file,$size); 
    261     else return fread($file,$size); 
     264    if ($this->handler['fread']) $ret = @call_user_func($this->handler['fread'],$file,$size); 
     265    else $ret = fread($file,$size); 
     266    return $ret; 
    262267  } 
    263268 
    264269  function _auth() { 
    265270    if (!isset($_SERVER['PHP_AUTH_USER'])) return false; 
    266     if ($this->handler['auth']) return @call_user_func($this->handler['auth'],$_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']); 
    267     else return true; //you must use a handler 
     271    if ($this->handler['auth']) $ret = @call_user_func($this->handler['auth'],$_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']); 
     272    else $ret = true; //you must use a handler 
     273    return $ret; 
    268274  } 
    269275 
  • trunk/includes/jscripts/hoteditor-4.2/editor.js

    r1802 r1853  
    6161var show_mode_editor = "1"; 
    6262var show_arrow_up_down = 1; 
    63 var mydirection = "ltr";  
    6463var vk_main = ""; 
     64 
     65// Text direction can be set by the template 
     66if (mydirection == null) var mydirection = "ltr";  
    6567 
    6668// Path definitions 
     
    22752277    a = a.replace(/\[url\](.*?)\[\/url\]/gi, "<a href=\"$1\">$1[/url]"); 
    22762278    a = a.replace(/\[\/url\]/gi, "</a>"); 
     2279    a = a.replace(/<a href="(.*?)"><\/a>/gi, "<a href=\"$1\">$1</a>"); 
    22772280    a = a.replace(/\[img\](.*?)\[\/img\]/gi, "<img src=\"$1\">"); 
    22782281    var b = a.match(/\[(list|list=1|list=a)\]/gi); 
     
    24822485                    o = p[0]; 
    24832486                    if (k.style) { 
    2484                         if (n[1] == o) { 
    2485                             m = "[url]" + AnalyzeHTMLBlock(g, k); 
     2487                        m = "[url=" + o + "]"; 
     2488                        var q = AnalyzeHTMLBlock(g, k); 
     2489                        if (q == "") { 
     2490                            m = m + o; 
    24862491                        } else { 
    2487                             m = "[url=" + o + "]" + AnalyzeHTMLBlock(g, k); 
     2492                            m = m + q; 
    24882493                        } 
    24892494                    } else { 
    2490                         if (n[1] == o) { 
    2491                             m = "[url]"; 
     2495                        if (o.indexOf("mailto:") != -1) { 
     2496                            var q = o.replace(/mailto:/i, ""); 
     2497                            if (q == n[1]) { 
     2498                                m = "[mail]"; 
     2499                            } else { 
     2500                                m = "[mail=" + q + "]"; 
     2501                            } 
    24922502                        } else { 
    2493                             if (o.indexOf("mailto:") != -1) { 
    2494                                 var q = o.replace(/mailto:/i, ""); 
    2495                                 if (q == n[1]) { 
    2496                                     m = "[mail]"; 
    2497                                 } else { 
    2498                                     m = "[mail=" + q + "]"; 
    2499                                 } 
    2500                             } else { 
    2501                                 m = "[url=" + o + "]"; 
    2502                             } 
     2503                            m = "[url=" + o + "]"; 
    25032504                        } 
    25042505                    } 
  • trunk/includes/sendmail_include.php

    r1799 r1853  
    6969        $mail->ClearAllRecipients();  
    7070        $mail->ClearReplyTos(); 
    71         return ""; 
     71        return false; 
    7272    } 
    7373 
  • trunk/includes/session_functions.php

    r1802 r1853  
    3636// to stay in the same session when uploading file(s) 
    3737// (session hijacking is mitigated by the session_ua function) 
    38 if (isset($_POST['SWFSESSIONID']) && !empty($_POST['SWFSESSIONID'])) { 
    39     $_COOKIE['site_visited'] = $_POST['SWFSESSIONID']; 
    40 } 
    4138if (isset($_POST[$settings['session_name']]) && !empty($_POST[$settings['session_name']])) { 
    4239    session_id($_POST[$settings['session_name']]); 
     
    207204 
    208205    $session_ua = ""; 
    209 //  $session_ua .= isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ""; 
    210     $session_ua .= isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : ""; 
    211     $session_ua .= isset($_SERVER['HTTP_VIA']) ? $_SERVER['HTTP_VIA'] : ""; 
    212     $session_ua .= isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : ""; 
     206 
     207    // when called from SWFUpload, set the session cookies from the post variable 
     208    // to stay in the same session when uploading file(s) 
     209    // (session hijacking is mitigated by the session_ua function) 
     210    if (isset($_POST['SWFSESSIONID']) && !empty($_POST['SWFSESSIONID']) && strlen($_POST['SWFSESSIONID'])==32) { 
     211        return $_POST['SWFSESSIONID']; 
     212    } 
     213    $session_ua .= isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ""; 
     214//  $session_ua .= isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : ""; 
    213215    $session_ua .= isset($_COOKIE['site_visited']) ? $_COOKIE['site_visited'] : ""; 
    214216 
  • trunk/includes/templates/main.albums.galleryedit.tpl

    r1802 r1853  
    8282                        <option value='-1'{if $gallery.gallery_read == -1} selected='selected'{/if}>{$locale.496}</option> 
    8383                    {section name=id loop=$all_user_groups} 
    84                         <option value='{$all_user_groups[id].0}'{if $user_groups[id].0 == $gallery.gallery_read} selected='selected'{/if}>{$all_user_groups[id].1}</option> 
     84                        <option value='{$all_user_groups[id].0}'{if $all_user_groups[id].0 == $gallery.gallery_read} selected='selected'{/if}>{$all_user_groups[id].1}</option> 
    8585                    {/section} 
    8686                    </select> 
  • trunk/includes/templates/main.blogs.tpl

    r1821 r1853  
    156156                        <tr> 
    157157                            <td style='width:100%;vertical-align:top;'> 
    158                                 {if $blog_id|default:0 == 0} 
    159                                     {assign var="rl" value=" <a href='blogs.php?blog_id="|cat:$bloglist[id].blog_id|cat:"'>...</a>"} 
    160                                     {$bloglist[id].blog_text|truncate:500:$rl}<br /> 
     158                                {if $blog_id|default:0 != 0} 
     159                                    {$bloglist[id].blog_text} 
    161160                                {else} 
    162                                     {$bloglist[id].blog_text}<br /> 
     161                                    {$bloglist[id].blog_intro} 
     162                                    {if $bloglist[id].read_more}&nbsp;<a href='blogs.php?blog_id={$bloglist[id].blog_id} alt='{$locale.422}' title='{$locale.422}''>...</a>{/if} 
    163163                                {/if} 
    164164                            </td> 
     
    170170                                {$bloglist[id].user_name}{if $smarty.const.iMEMBER}</a>{/if} 
    171171                                {$locale.421} {$bloglist[id].blog_datestamp|date_format:"longdate"} 
    172                                 {if !$blog_id}&middot; <a href='blogs.php?blog_id={$bloglist[id].blog_id}'>{$locale.422}</a>{/if} 
     172                                {if $bloglist[id].read_more && $blog_id|default:0 == 0}&middot; <a href='blogs.php?blog_id={$bloglist[id].blog_id}'>{$locale.422}</a>{/if} 
    173173                                <img src='{$smarty.const.THEME}images/bulletb.gif' alt='' /> 
    174174                                <br /> 
  • trunk/includes/templates/main.pm.post.tpl

    r1802 r1853  
    239239                    <input type='submit' name='send_message' value='{$locale.430}' class='button' onclick="return ValidateForm()" /> 
    240240                {else} 
    241                     <input type='submit' name='send_preview' value='{$locale.429}' class='button' onclick="javascript:get_hoteditor_data("message");return ValidateForm()" /> 
    242                     <input type='submit' name='send_message' value='{$locale.430}' class='button' onclick="javascript:get_hoteditor_data("message");return ValidateForm()" /> 
     241                    <input type='submit' name='send_preview' value='{$locale.429}' class='button' onclick='javascript:get_hoteditor_data("message");return ValidateForm()' /> 
     242                    <input type='submit' name='send_message' value='{$locale.430}' class='button' onclick='javascript:get_hoteditor_data("message");return ValidateForm()' /> 
    243243                {/if} 
    244244            </td> 
  • trunk/modules/main_menu_panel/module_installer.php

    r1250 r1853  
    3636 
    3737// check for a minumum version of the ExiteCMS engine 
    38 if (str_replace(".", "", $settings['version']) < 700) { 
    39     $mod_errors .= sprintf($locale['mod001'], '7.00'); 
     38if (str_replace(".", "", $settings['version']) < 720) { 
     39    $mod_errors .= sprintf($locale['mod001'], '7.20'); 
    4040} 
    4141// check for a maximum version of the ExiteCMS engine 
    42 if (str_replace(".", "", $settings['version']) > 710) { 
    43     $mod_errors .= sprintf($locale['mod002'], '7.10'); 
     42if (str_replace(".", "", $settings['version']) > 720) { 
     43    $mod_errors .= sprintf($locale['mod002'], '7.20'); 
    4444} 
    4545// check for a specific revision number range that is supported 
  • trunk/modules/user_info_panel/module_installer.php

    r1250 r1853  
    3636 
    3737// check for a minumum version of the ExiteCMS engine 
    38 if (str_replace(".", "", $settings['version']) < 700) { 
    39     $mod_errors .= sprintf($locale['mod001'], '7.00'); 
     38if (str_replace(".", "", $settings['version']) < 720) { 
     39    $mod_errors .= sprintf($locale['mod001'], '7.20'); 
    4040} 
    4141// check for a maximum version of the ExiteCMS engine 
    42 if (str_replace(".", "", $settings['version']) > 710) { 
    43     $mod_errors .= sprintf($locale['mod002'], '7.10'); 
     42if (str_replace(".", "", $settings['version']) > 720) { 
     43    $mod_errors .= sprintf($locale['mod002'], '7.20'); 
    4444} 
    4545// check for a specific revision number range that is supported 
  • trunk/modules/welcome_message_panel/module_installer.php

    r1250 r1853  
    3636 
    3737// check for a minumum version of the ExiteCMS engine 
    38 if (str_replace(".", "", $settings['version']) < 700) { 
    39     $mod_errors .= sprintf($locale['mod001'], '7.00'); 
     38if (str_replace(".", "", $settings['version']) < 720) { 
     39    $mod_errors .= sprintf($locale['mod001'], '7.20'); 
    4040} 
    4141// check for a maximum version of the ExiteCMS engine 
    42 if (str_replace(".", "", $settings['version']) > 710) { 
    43     $mod_errors .= sprintf($locale['mod002'], '7.10'); 
     42if (str_replace(".", "", $settings['version']) > 720) { 
     43    $mod_errors .= sprintf($locale['mod002'], '7.20'); 
    4444} 
    4545// check for a specific revision number range that is supported 
  • trunk/setuser.php

    r1776 r1853  
    1919 
    2020// set the redirect url (set in theme_cleanup), butnot when in maintenance! 
    21 if (eregi("maintenance.php", $_SERVER['HTTP_REFERER'])) { 
     21if (isset($_SERVER['HTTP_REFERER']) && eregi("maintenance.php", $_SERVER['HTTP_REFERER'])) { 
    2222    $variables['url'] = BASEDIR."index.php"; 
    2323} elseif (isset($_SESSION['last_url'])) { 
     
    9595                $message['line2'] =  "<b>".$locale['196']."</b>"; 
    9696            } 
     97        } else { 
     98            $message['line2'] =  "<b>SESSION ERROR. Please report this to the Webmaster</b>"; 
    9799        } 
    98100    } 
Note: See TracChangeset for help on using the changeset viewer.