Viewing 15 posts - 16 through 30 (of 57 total)
  • Author
    Posts
  • bossep Friend
    #266477

    gaygiorgia and hainn,

    It seems that by removing

    $row->introtext = str_replace('<br />','!@#!@#',$row->text);
    $row->introtext = str_replace('<br/>','!@#!@#',$row->introtext);
    $row->introtext = str_replace('<br>','!@#!@#',$row->introtext);

    And

    $row->introtext1 = str_replace('!@#!@#','<br />',$row->introtext1);
    $row->introtext = str_replace('!@#!@#','<br />',$row->introtext);

    What this does is to replace one string the br one with another and then puts it back after processing the rest of the string. Probably to avoid the <>.

    The smarttrim class is not to smart after all. It removes evertthing before the BR tag including it.
    So gaygiorgia is totally correct in his observations.

    I do think that if we use the hidden classes field in the admin section of the module we could let the user select the tags to use on the front page.

    gaygiorgia, could you live with this solution?

    Hainn: Do you want me to work on this or do you already have someone doing this?
    I do think it is pretty easy to fix using mb_lib but I have no idea how to do it without it without a LOT of code and looping trough the string and a lot of exceptions.
    Perhaps we could do an intermediate solution to fix this bug and then work on the final solution?

    Bosse

    bossep Friend
    #266482

    Did a dirty fix for this and it seems to work but I dont know how it is handled without mb_lib and in sections. It seems to work on the frontpage.

    so here it goes:

    function replaceImage( &$row, $align, $autoresize, $maxchars, $showimage, $width = 0, $height = 0, $hiddenClasses = ” ) {
    global $database, $_MAMBOTS, $current_charset;
    $regex = “/<img.+srcs*=s*”([^”]*)”[^>]*>/”;
    //$row->introtext = $row->text;
    $row->introtext = str_replace(‘<br />’,’!@#!@#’,$row->text);
    $row->introtext = str_replace(‘<br/>’,’!@#!@#’,$row->introtext);
    $row->introtext = str_replace(‘<br>’,’!@#!@#’,$row->introtext);

    preg_match ($regex, $row->introtext, $matches);
    if(!count($matches)) preg_match ($regex, $row->fulltext, $matches);
    $images = (count($matches)) ? $matches : array();
    $image = ”;
    if (count($images)) $image = $images[1];
    $align = $align?”align=”$align””:””;
    if ($image && $showimage) {
    if ($autoresize && function_exists(‘imagecreatetruecolor’)
    && ($image1 = modJANewsHelper::processImage ( $image, $width, $height ))) {
    $image = “<img src=””.$image1.”” alt=”{$row->title}” $align />”;
    } else {
    $width = $width?”width=”$width””:””;
    $height = $height?”height=”$height””:””;
    $image = “<img src=””.$image.”” alt=”{$row->title}” $width $height $align />”;
    }
    } else $image = ”;

    $regex1 = “/<img.*/>/”;
    $row->introtext = preg_replace( $regex1, ”, $row->introtext );
    $regex1 = “/<div class=”mosimage”.*</div>/”;
    $row->introtext = preg_replace( $regex1, ”, $row->introtext );
    $row->introtext = trim($row->introtext);
    $row->introtext1 = $row->introtext;
    if ($maxchars && strlen ($row->introtext) > $maxchars) {
    $doc = JDocument::getInstance ();
    if (function_exists(‘mb_substr’)) {
    $row->introtext1 = SmartTrim::mb_trim($row->introtext, 0, $maxchars, $doc->_charset);
    $row->introtext1 = str_replace(‘!@#!@#’,'<br />’,$row->introtext1);
    //$row->introtext1 = SmartTrim::mb_trim($row->introtext, 0, $maxchars, $doc->_charset);
    } else {
    $row->introtext1 = SmartTrim::trim($row->introtext, 0, $maxchars);
    }
    }
    // clean up globals
    return $image;
    }

    function processImage ( &$img, $width, $height ) {
    if(!$img) return;
    $img = str_replace(JURI::base(),”,$img);
    $img = rawurldecode($img);
    $imagesurl = (file_exists(JPATH_SITE .’/’.$img)) ? modJANewsHelper::jaResize($img,$width,$height) : ” ;
    return $imagesurl;
    }

    cgc0202 Friend
    #266487

    Hi Hainn and Joomlart Staff,

    <em>@gaygiorgia 74850 wrote:</em><blockquote>the old helper.php (teline II v1.3 for J1.5.3 fixed by hainn84 -17kb weight) works good.
    the last helper.php (teline II v1.5 for J1.5.6 – 19kb weight) has the problem.

    SOME PARTIALS DIFFERENCES:

    First
    old 1.3 helper.php
    [PHP]$row->introtext = $row->text;[/PHP]

    Second
    old 1.3 helper.php fixed and perfectly working:
    [PHP]$row->introtext = str_replace(‘<br />’,’!@#!@#’,$row->text);
    $row->introtext = str_replace(‘<br/>’,’!@#!@#’,$row->introtext);
    $row->introtext = str_replace(‘<br>’,’!@#!@#’,$row->introtext);[/PHP]

    Third
    last helper.php with problem again:
    [PHP]//$row->introtext = $row->text;[/PHP]</blockquote>

    The examples shown here by gaygiorgia and the ones I found yesterday after going through the latest changelog for latest Joomla 1.5.x-Teline II are persuasive evidence why there is a need for Template (Patch) Update and not the standard uninstall the “old” -reinstall the “new” template or extension.

    By the way, the loss of the <br /> fix in the “latest version” is explained by the reinstatement of the original (Frist and Third), i.e., “stripping of the html markups”, a feature that did not include the fix for <br />.

    However, the “fatal error” encountered also by gaygiorgia, posted in another thread, is an error due to SEO modifications in Joomla 1.5.5. A different file is involved that was fixed by Omarran. If the person who prepared the latest update did not carryover this SEO bug fix, then the fatal error will be encountered.

    The above argues for a more systematic nomenclature such that there must also be a way to differentiate Joomla patches and template patches. And, to do this they must be numbered separately, and distinctly every time a new bug fix or feature modiiication is added.

    The trouble with the current Joomla-Template nomenclature adopted by Jomlart in their updates do not include these changes more clearly. It should not be

    Joomla 1.5.x-Teline II

    but

    1. Joomla 1.5.5-Teline IIv1.4
    2. Joomla 1.5.6-Teline II 1.4
    3. Joomla 1.5.6-Teline II 1.5

    instead what you have is this for the QuickStart Kit

    ja_teline_ii_quickstart_j15

    It is true that the changelog may provide insight to what were fixed, but if you have several variations (downloads) or did a “fresh download”, specifying the distinct version of both Joomla and teh Jomlart template is very important.

    Need for Template (Patch) Update

    The above though is not enough. As demonstrated above, the patch (fix) that gaygiorgia wants is different from that of customers like Bossep who prefers something else. Both have merits, and perhaps it is possible to accommodate both of them by further modification of the helper.php scrip here.

    However, what happened is that the latest “request” — that resulted in the “third” option in the helper.php — without due regard for the issue raised in the “second” version of the helper.php

    The only solution to this is to provide more defined patches that target specific bug fixes or script modifications.

    To be more systematic, the change log must indicate specifically what was changed (e.g., helper.php, etc.), the actual script change and what this change is doing. This has not been done more comprehensively in the changelog of Teline II.

    For example, the SEO fix in the Teline IIv1.3 deletes a part of the script that cause the problem in Jooomla1.5.5 (see below). If a customer has been intimately involved in these bug fixes, it is possible for the customer to make the needed script changes.

    However, how would you know what were fixed here?

    16-Aug-2008

    # Update new version for Base.class.php

    # Update Youtube highslide module

    Does the customer want the fix? What would be the impact if the customer does not implement? But, these questions cannot be answered properly because there is no frurther information provided — no Forum link, no script change and no specific template file changed indicated.

    Basically, Joomlart is stating: “It is good foryou — take it!

    And since you do not have adequate information, the only choice you have is to “reinstall everything back” — a very dangerous procedure, as exemplified by this thread — leading to deletion of the features that took gaygiorgia so many hours and days (multiple posts). And, also the “fatal error” post.

    All this would have been prevented, if Joomlart had only provided Template (Patch) Update.

    Consider this, if there was “one to one” ratio between a file that is affected by the bug and script modifcation listed in the changelog.txt (see below), less than a dozen files needed to be changed or updated. [Note: some of the fixes below would be superceded by later fixes. Thus, there would even be less files.]

    The use of a Template (Patch) Update, would take a minute or so. And, if something goes wrong, one can always do a diagnostic patch — one file at a time — to isolate the culprit. or, if a Forum link is provided for each fix, it is possible to find out what error is observed, and thus also the specific file to correct.

    Using a similar patch update, I was able to update up to Joomla 1.5.6-Teline IIv1.5 without any of the problems encountered here and similar posts by many customers.

    Obviously, I cannot perform any of the 16-Aug-2008 updates for the template because there is no specific information provided — files affected,, fixes, etc.

    Cornelio
    ************

    Complete (most recent) Teline II changelog.txt

    Changelog

    Legend:

    * -> Security Fix

    # -> Bug Fix

    $ -> Language fix or change

    + -> Addition

    ^ -> Change

    - -> Removed

    ! -> Note

    -------------------- 1.3 Stable Release [Jun-2008] ---------------------

    26-Jun-2008

    # Seo bug when set group by category.

    Reference: http://www.joomlart.com/forums/topic/seo-ja-news-problem/

    # Fixed Register form bug.

    Reference: http://www.joomlart.com/forums/topic/ja-portfolio-quick-start-user-register-login-is-invalid/#post-256064

    -------------------- 1.4 Stable Release [Jul-2008] ---------------------

    10-Jun-2008

    # Seo bug when set group by category.

    Reference: http://www.joomlart.com/forums/topic/seo-ja-news-problem/

    # Fixed Register form bug.

    Reference: http://www.joomlart.com/forums/topic/register-button-not-working/

    http://www.joomlart.com/forums/topic/ja-portfolio-quick-start-user-register-login-is-invalid/#post-256064

    # Fixed Smart Trim function error in JA News: <br /> tag issue (updated Helper class)

    Reference: http://www.joomlart.com/forums/topic/clean-installation-ja_news-1-3-1-module-visualization-problem/

    http://www.joomlart.com/forums/topic/quickstart-installation-ja-news-1-3-1-shows-only-partial-text-or-nothing/

    # Fixed error in JA News config : not working if ID section/category textbox has newline symbol (when you press enter)

    # Fixed duplicate ID of login box (cause register error, can not verify password)

    Reference: http://www.joomlart.com/forums/topic/registration-of-user-is-not-possible-after-installation/

    http://www.joomlart.com/forums/topic/register-button-not-working/

    # Fixed CSS style for mod_archive and articles with images (Joomla! 1.5)

    Reference: http://www.joomlart.com/forums/topic/new-great-sux-bug-mod_archive-and-articles-with-images/

    # Fixed description text for links in JA News (UTF-8 issue)

    Reference: http://www.joomlart.com/forums/topic/screen-tips-not-showing-correctly-in-ja-news/

    -------------------- 1.5 Stable Release ---------------------

    05-aug-2008

    ^ Update to joomla 1.5.5

    # Fixed SEO error in JA News when update to 1.5.5

    Reference: http://www.joomlart.com/forums/topic/upgraded-to-joomla-1-5-5-now-ja-news-3-1-problem/

    # Fixed : display joomlart.com at the top of frontend.

    Reference : http://www.joomlart.com/forums/topic/bug-theres-a-www-joomlart-com-at-the-top-left-of-the-page/

    16-Aug-2008

    ^ Update joomla 1.5.6

    # Update new version for Base.class.php

    # Update Youtube highslide module

    gaygiorgia Friend
    #266513

    <em>@bossep 74919 wrote:</em><blockquote>
    Hainn: Do you want me to work on this or do you already have someone doing this?
    I do think it is pretty easy to fix using mb_lib but I have no idea how to do it without it without a LOT of code and looping trough the string and a lot of exceptions.
    Perhaps we could do an intermediate solution to fix this bug and then work on the final solution?

    Bosse</blockquote>
    excuse me bossep, but sometimes i ask myself if read previous posts. hainn84 have written two couple of words in his post…
    and this is a quote of part of it:
    <blockquote>now, i’m working with him to resolve the problem</blockquote>

    i have not understood what you ask me about “hidden classes”, sry…

    <em>@bossep 74926 wrote:</em><blockquote>Did a dirty fix for this and it seems to work but I dont know how it is handled without mb_lib and in sections. It seems to work on the frontpage.

    so here it goes:

    function replaceImage( &$row, $align, $autoresize, $maxchars, $showimage, $width = 0, $height = 0, $hiddenClasses = ” ) {
    global $database, $_MAMBOTS, $current_charset;
    $regex = “/<img.+srcs*=s*”([^”]*)”[^>]*>/”;
    //$row->introtext = $row->text;
    $row->introtext = str_replace(‘<br />’,’!@#!@#’,$row->text);
    $row->introtext = str_replace(‘<br/>’,’!@#!@#’,$row->introtext);
    $row->introtext = str_replace(‘<br>’,’!@#!@#’,$row->introtext);

    preg_match ($regex, $row->introtext, $matches);
    if(!count($matches)) preg_match ($regex, $row->fulltext, $matches);
    $images = (count($matches)) ? $matches : array();
    $image = ”;
    if (count($images)) $image = $images[1];
    $align = $align?”align=”$align””:””;
    if ($image && $showimage) {
    if ($autoresize && function_exists(‘imagecreatetruecolor’)
    && ($image1 = modJANewsHelper::processImage ( $image, $width, $height ))) {
    $image = “<img src=””.$image1.”” alt=”{$row->title}” $align />”;
    } else {
    $width = $width?”width=”$width””:””;
    $height = $height?”height=”$height””:””;
    $image = “<img src=””.$image.”” alt=”{$row->title}” $width $height $align />”;
    }
    } else $image = ”;

    $regex1 = “/<img.*/>/”;
    $row->introtext = preg_replace( $regex1, ”, $row->introtext );
    $regex1 = “/<div class=”mosimage”.*</div>/”;
    $row->introtext = preg_replace( $regex1, ”, $row->introtext );
    $row->introtext = trim($row->introtext);
    $row->introtext1 = $row->introtext;
    if ($maxchars && strlen ($row->introtext) > $maxchars) {
    $doc = JDocument::getInstance ();
    if (function_exists(‘mb_substr’)) {
    $row->introtext1 = SmartTrim::mb_trim($row->introtext, 0, $maxchars, $doc->_charset);
    $row->introtext1 = str_replace(‘!@#!@#’,'<br />’,$row->introtext1);
    //$row->introtext1 = SmartTrim::mb_trim($row->introtext, 0, $maxchars, $doc->_charset);
    } else {
    $row->introtext1 = SmartTrim::trim($row->introtext, 0, $maxchars);
    }
    }
    // clean up globals
    return $image;
    }

    function processImage ( &$img, $width, $height ) {
    if(!$img) return;
    $img = str_replace(JURI::base(),”,$img);
    $img = rawurldecode($img);
    $imagesurl = (file_exists(JPATH_SITE .’/’.$img)) ? modJANewsHelper::jaResize($img,$width,$height) : ” ;
    return $imagesurl;
    }
    </blockquote>
    i tryed to modify actual helper.php with this code, but i get a fatal error.

    i repeat:
    helper.php of 1.4 works good but it is 17kb. last helper is 19kb, so with last helper.php we have 2kb about of changes/upgradations so i would have a v1.5 working good…

    bossep Friend
    #266527

    I did the above fix on my 1.5 ver. But it might be different from yours.

    To make the problem with diapearing text and BR go away you need to have the:


    $row->introtext = str_replace('<br />','!@#!@#',$row->text);
    $row->introtext = str_replace('<br/>','!@#!@#',$row->introtext);
    $row->introtext = str_replace('<br>','!@#!@#',$row->introtext);

    To tempoaray remove the BR
    and to get the BR back:


    $row->introtext1 = str_replace('!@#!@#','<br />',$row->introtext1);

    Also the reason I post is that a lot of other people is reading this tread and they might be helped.
    With regard of “hidden classes” There is a referance to it in the class SmartTrim line # 341.
    We also have a form field called “hidden classes” it in the admin part of mod_janews


    1. Hidden-Classes
    gaygiorgia Friend
    #266535

    <em>@bossep 74976 wrote:</em><blockquote>I did the above fix on my 1.5 ver. But it might be different from yours.</blockquote>
    i have last version of teline II. perhpas u have an old version which is without this bug.

    gaygiorgia Friend
    #266538

    hainn84 have u got some news?

    bossep Friend
    #266543

    <em>@gaygiorgia 74985 wrote:</em><blockquote>i have last version of teline II. perhpas u have an old version which is without this bug.</blockquote>
    Ihave the version based on 1.5.5 and installed the patch from hainn and I got the same error as you have.

    There is a problem (I cant find it) with single tags like the

    <BR />

    Tag.

    It works fine on the tag pairs like

    <p></p>

    But I cant find the problem in the SmartTrim class that should handle it.
    But you should be able to fix this with implementing the

    $row->introtext = str_replace('<br/>','!@#!@#',$row->introtext);

    Stuff again.

    I did a new test with the code I posted and the patch file from hainn and it works here.
    I will test it again from what I posted to see if I forgot a little } or something.

    Bosse

    bossep Friend
    #266544

    Could you please try to just replace the old function with this one?
    Make sure you replace all of it and dont leave the last }


    function replaceImage( &$row, $align, $autoresize, $maxchars, $showimage, $width = 0, $height = 0, $hiddenClasses = '' ) {
    global $database, $_MAMBOTS, $current_charset;
    $regex = "/<img.+srcs*=s*"([^"]*)"[^>]*>/";
    //$row->introtext = $row->text;
    $row->introtext = str_replace('<br />','!@#!@#',$row->text);
    $row->introtext = str_replace('<br/>','!@#!@#',$row->introtext);
    $row->introtext = str_replace('<br>','!@#!@#',$row->introtext);

    preg_match ($regex, $row->introtext, $matches);
    if(!count($matches)) preg_match ($regex, $row->fulltext, $matches);
    $images = (count($matches)) ? $matches : array();
    $image = '';
    if (count($images)) $image = $images[1];
    $align = $align?"align="$align"":"";
    if ($image && $showimage) {
    if ($autoresize && function_exists('imagecreatetruecolor')
    && ($image1 = modJANewsHelper::processImage ( $image, $width, $height ))) {
    $image = "<img src="".$image1."" alt="{$row->title}" $align />";
    } else {
    $width = $width?"width="$width"":"";
    $height = $height?"height="$height"":"";
    $image = "<img src="".$image."" alt="{$row->title}" $width $height $align />";
    }
    } else $image = '';

    $regex1 = "/<img.*/>/";
    $row->introtext = preg_replace( $regex1, '', $row->introtext );
    $regex1 = "/<div class="mosimage".*</div>/";
    $row->introtext = preg_replace( $regex1, '', $row->introtext );
    $row->introtext = trim($row->introtext);
    $row->introtext1 = $row->introtext;
    if ($maxchars && strlen ($row->introtext) > $maxchars) {
    $doc = JDocument::getInstance ();
    if (function_exists('mb_substr')) {
    $row->introtext1 = SmartTrim::mb_trim($row->introtext, 0, $maxchars, $doc->_charset);
    $row->introtext1 = str_replace('!@#!@#','<br />',$row->introtext1);
    //$row->introtext1 = SmartTrim::mb_trim($row->introtext, 0, $maxchars, $doc->_charset);
    } else {
    $row->introtext1 = SmartTrim::trim($row->introtext, 0, $maxchars);
    }
    }
    // clean up globals
    return $image;
    }

    Let me know if it helps or throws an error again.

    The reason for this is that it might take some time to get the final fix done so if this works for you use it for the time beeing. Until JA comes with a better solution.

    Bosse

    cgc0202 Friend
    #266625

    Hi gaygiorgia,

    If you have a working Joomla 1.5.3-Teline II QuickStart Kit — including the corrections done by Hainn related to the <br /> issue, why not just to a QuickStart installation of the Joomla 1.5.3-Teline II QuickStart Kit, then if that works just do a Joomla (only) upgrade to Joomla 1.5.6 using a Joomla 1.5.3 to 1.5.6 Patch update?

    At most, the installation using the above will not take more than twenty minutes — much less than the amount of time spent in this thread.

    Just a thought, other than the <br /> issue, there are only two other fixes of the Teline II template due to the SEO revisions in Joomla 1.5.5. One of the bug fixes will not be needed because it was introduced in the Joomla 1.5.5-Teline II v1.5.

    If this is the case, if you check this:

    http://www.joomlart.com/forums/topic/upgraded-to-joomla-1-5-5-now-ja-news-3-1-problem/
    and more specifically this:
    http://www.joomlart.com/forums/showpost.php?p=70929&postcount=20

    In fact, even this fix may not be needed because the earlier version of Teline II has the correct SEO script.

    Or, as you stated, just wait for the fix coming from Joomlart. I am not familiar with the fix done on 20080816.

    # Update new version for Base.class.php
    # Update Youtube highslide module

    and my Joomla 1.5.6-Teline II sites work. I inactivated the YouTube.

    Cornelio

    gaygiorgia Friend
    #266634

    <em>@bossep 74994 wrote:</em><blockquote>Could you please try to just replace the old function with this one?
    […cut…]

    Let me know if it helps or throws an error again.

    The reason for this is that it might take some time to get the final fix done so if this works for you use it for the time beeing. Until JA comes with a better solution.

    Bosse</blockquote>
    [PHP]<?php
    /**
    * @version $Id: helper.php 7274 2007-05-02 17:40:09Z jinx $
    * @package Joomla
    * @copyright Copyright (C) 2005 – 2007 Open Source Matters. All rights reserved.
    * @license GNU/GPL, see LICENSE.php
    * Joomla! is free software. This version may have been modified pursuant
    * to the GNU General Public License, and as distributed it includes or
    * is derivative of works licensed under the GNU General Public License or
    * other free or open source software licenses.
    * See COPYRIGHT.php for copyright notices and details.
    */

    // no direct access
    defined(‘_JEXEC’) or die(‘Restricted access’);
    if(!defined(‘_JA_NEWS_’)){
    define (‘_JA_NEWS_’, 1);

    require_once (JPATH_SITE . ‘/components/com_content/helpers/route.php’);

    class modJaNewsHelper
    {

    function replaceImage( &$row, $align, $autoresize, $maxchars, $showimage, $width = 0, $height = 0, $hiddenClasses = ” ) {
    global $database, $_MAMBOTS, $current_charset;
    $regex = “/<img.+srcs*=s*”([^”]*)”[^>]*>/”;
    //$row->introtext = $row->text;
    $row->introtext = str_replace(‘<br />’,’!@#!@#’,$row->text);
    $row->introtext = str_replace(‘<br/>’,’!@#!@#’,$row->introtext);
    $row->introtext = str_replace(‘<br>’,’!@#!@#’,$row->introtext);

    preg_match ($regex, $row->introtext, $matches);
    if(!count($matches)) preg_match ($regex, $row->fulltext, $matches);
    $images = (count($matches)) ? $matches : array();
    $image = ”;
    if (count($images)) $image = $images[1];
    $align = $align?”align=”$align””:””;
    if ($image && $showimage) {
    if ($autoresize && function_exists(‘imagecreatetruecolor’)
    && ($image1 = modJANewsHelper::processImage ( $image, $width, $height ))) {
    $image = “<img src=””.$image1.”” alt=”{$row->title}” $align />”;
    } else {
    $width = $width?”width=”$width””:””;
    $height = $height?”height=”$height””:””;
    $image = “<img src=””.$image.”” alt=”{$row->title}” $width $height $align />”;
    }
    } else $image = ”;

    $regex1 = “/<img.*/>/”;
    $row->introtext = preg_replace( $regex1, ”, $row->introtext );
    $regex1 = “/<div class=”mosimage”.*</div>/”;
    $row->introtext = preg_replace( $regex1, ”, $row->introtext );
    $row->introtext = trim($row->introtext);
    $row->introtext1 = $row->introtext;
    if ($maxchars && strlen ($row->introtext) > $maxchars) {
    $doc = JDocument::getInstance ();
    if (function_exists(‘mb_substr’)) {
    $row->introtext1 = SmartTrim::mb_trim($row->introtext, 0, $maxchars, $doc->_charset);
    $row->introtext1 = str_replace(‘!@#!@#’,'<br />’,$row->introtext1);
    //$row->introtext1 = SmartTrim::mb_trim($row->introtext, 0, $maxchars, $doc->_charset);
    } else {
    $row->introtext1 = SmartTrim::trim($row->introtext, 0, $maxchars);
    }
    }
    // clean up globals
    return $image;
    }

    function processImage ( &$img, $width, $height ) {
    if(!$img) return;
    $img = str_replace(JURI::base(),”,$img);
    $img = rawurldecode($img);
    $imagesurl = (file_exists(JPATH_SITE .’/’.$img)) ? modJANewsHelper::jaResize($img,$width,$height) : ” ;
    return $imagesurl;
    }

    function jaResize($image,$max_width,$max_height){
    $path = JPATH_SITE;
    $sizeThumb = getimagesize(JPATH_SITE.’/’.$image);
    $width = $sizeThumb[0];
    $height = $sizeThumb[1];
    if(!$max_width && !$max_height) {
    $max_width = $width;
    $max_height = $height;
    }else{
    if(!$max_width) $max_width = 1000;
    if(!$max_height) $max_height = 1000;
    }
    $x_ratio = $max_width / $width;
    $y_ratio = $max_height / $height;
    if (($width <= $max_width) && ($height <= $max_height) ) {
    $tn_width = $width;
    $tn_height = $height;
    } else if (($x_ratio * $height) < $max_height) {
    $tn_height = ceil($x_ratio * $height);
    $tn_width = $max_width;
    } else {
    $tn_width = ceil($y_ratio * $width);
    $tn_height = $max_height;
    }
    // read image
    $ext = strtolower(substr(strrchr($image, ‘.’), 1)); // get the file extension
    $rzname = strtolower(substr($image, 0, strpos($image,’.’))).”_{$tn_width}_{$tn_height}.{$ext}”; // get the file extension
    $resized = $path.’/images/resized/’.$rzname;
    if(file_exists($resized)){
    $smallImg = getimagesize($resized);
    if (($smallImg[0] <= $tn_width && $smallImg[1] == $tn_height) ||
    ($smallImg[1] <= $tn_height && $smallImg[0] == $tn_width)) {
    return “images/resized/”.$rzname;
    }
    }
    if(!file_exists($path.’/images/resized/’) && !mkdir($path.’/images/resized/’,0755)) return ”;
    $folders = explode(‘/’,$image);
    $tmppath = $path.’/images/resized/’;
    for($i=0;$i < count($folders)-1; $i++){
    if(!file_exists($tmppath.$folders[$i]) && !mkdir($tmppath.$folders[$i],0755)) return ”;
    $tmppath = $tmppath.$folders[$i].’/’;
    }
    switch ($ext) {
    case ‘jpg’: // jpg
    $src = imagecreatefromjpeg(JPATH_SITE.’/’.$image);
    break;
    case ‘png’: // png
    $src = imagecreatefrompng(JPATH_SITE.’/’.$image);
    break;
    case ‘gif’: // gif
    $src = imagecreatefromgif(JPATH_SITE.’/’.$image);
    break;
    default:
    }
    $dst = imagecreatetruecolor($tn_width,$tn_height);
    //imageantialias ($dst, true);
    if (function_exists(‘imageantialias’)) imageantialias ($dst, true);
    imagecopyresampled ($dst, $src, 0, 0, 0, 0, $tn_width, $tn_height, $width, $height);
    imagejpeg($dst, $resized, 90); // write the thumbnail to cache as well…
    return “images/resized/”.$rzname;
    }

    function calModStyle ($cols) {
    $modules = array();
    switch ($cols) {
    case 0: return null;
    break;
    case 1:
    $modules[0][‘class’] = “”;
    $modules[0][‘width’] = “100%”;
    $modules[0][‘subwidth’] = “100%”;
    break;
    case 2:
    $modules[0][‘class’] = “-left”;
    $modules[0][‘width’] = “49.9%”;
    $modules[0][‘subwidth’] = “95%”;
    $modules[1][‘class’] = “-right”;
    $modules[1][‘width’] = “49.9%”;
    $modules[1][‘subwidth’] = “95%”;
    break;
    default:

    $width1 = round(99.6/($cols-0.1), 2);
    $width2 = round((99.6 – $width1*($cols-2))/2, 2);

    for ($i=1; $i<$cols – 1; $i++){
    $modules[$i][‘class’] = “-center”;
    $modules[$i][‘width’] = $width1.”%”;
    $modules[$i][‘subwidth’] = “90%”;
    }
    $modules[0][‘class’] = “-left”;
    $modules[0][‘width’] = $width2.”%”;
    $modules[0][‘subwidth’] = “95%”;
    $modules[$cols – 1][‘class’] = “-right”;
    $modules[$cols – 1][‘width’] = $width2.”%”;
    $modules[$cols – 1][‘subwidth’] = “95%”;
    break;
    }
    return $modules;
    }

    function unhtmlentities($string)
    {
    $trans_tbl = array(“<” => “<“, “>” => “>”, “&” => “&”);
    return strtr($string, $trans_tbl);
    }

    function getList($catorsec, $catid, $items, $ordering,$showcontentfrontpage=false)
    {
    global $mainframe;

    $db =& JFactory::getDBO();
    $user =& JFactory::getUser();
    $aid = $user->get(‘aid’, 0);

    $contentConfig = &JComponentHelper::getParams( ‘com_content’ );
    $noauth = !$contentConfig->get(‘shownoauth’);

    jimport(‘joomla.utilities.date’);
    $date = new JDate();
    $now = $date->toMySQL();

    $nullDate = $db->getNullDate();

    // query to determine article count
    $query = ‘SELECT a.*,cc.description as catdesc, cc.title as cattitle,s.description as secdesc, s.title as sectitle,’ .
    ‘ CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(“:”, a.id, a.alias) ELSE a.id END as slug,’.
    ‘ CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(“:”, cc.id, cc.alias) ELSE cc.id END as catslug,’.
    ‘ CASE WHEN CHAR_LENGTH(s.alias) THEN CONCAT_WS(“:”, s.id, s.alias) ELSE s.id END as secslug’.
    ‘ FROM #__content AS a’ .
    ‘ INNER JOIN #__categories AS cc ON cc.id = a.catid’ .
    ‘ INNER JOIN #__sections AS s ON s.id = a.sectionid’;
    $query .= ‘ WHERE a.state = 1 ‘ .
    ($noauth ? ‘ AND a.access <= ‘ .(int) $aid. ‘ AND cc.access <= ‘ .(int) $aid. ‘ AND s.access <= ‘ .(int) $aid : ”).
    ‘ AND (a.publish_up = ‘.$db->Quote($nullDate).’ OR a.publish_up <= ‘.$db->Quote($now).’ ) ‘ .
    ‘ AND (a.publish_down = ‘.$db->Quote($nullDate).’ OR a.publish_down >= ‘.$db->Quote($now).’ )’ .
    (($catorsec)?”n AND cc.id=” . (int) $catid:’ AND s.id=’ . (int) $catid) .
    ‘ AND cc.section = s.id’ .
    ‘ AND cc.published = 1’ .
    ‘ AND s.published = 1’;
    if(!$showcontentfrontpage) {
    $query .= ‘ AND a.id not in (SELECT content_id FROM #__content_frontpage )’;
    }

    //$query .= ‘ ORDER BY a.created DESC’ ;
    $query .= ‘ ORDER BY a.’.$ordering;

    $db->setQuery($query, 0, $items);
    $rows = $db->loadObjectList();
    global $mainframe;
    JPluginHelper::importPlugin(‘content’);
    $dispatcher =& JDispatcher::getInstance();
    $params =& $mainframe->getParams(‘com_content’);
    $limitstart = JRequest::getVar(‘limitstart’, 0, ”, ‘int’);

    for($i=0;$i<count($rows);$i++) {
    $rows[$i]->text = $rows[$i]->introtext;
    $results = $dispatcher->trigger(‘onPrepareContent’, array (& $rows[$i], & $params, $limitstart));
    $rows[$i]->introtext = $rows[$i]->text;
    }
    return $rows;
    }

    function getHLNews($items) {
    $db =& JFactory::getDBO();
    $contentConfig = &JComponentHelper::getParams( ‘com_content’ );
    $noauth = !$contentConfig->get(‘shownoauth’);
    $user =& JFactory::getUser();
    $aid = $user->get(‘aid’, 0);

    jimport(‘joomla.utilities.date’);
    $date = new JDate();
    $now = $date->toMySQL();

    $nullDate = $db->getNullDate();
    $query = “SELECT a.*,”
    . “n CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(‘:’, a.id, a.alias) ELSE a.id END as slug,”
    . “n CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(‘:’, cc.id, cc.alias) ELSE cc.id END as catslug”
    . “n FROM #__content AS a”
    . “n INNER JOIN #__content_frontpage AS f ON f.content_id = a.id”
    . “n INNER JOIN #__categories AS cc ON cc.id = a.catid”
    . “n WHERE ( a.state = 1 AND a.sectionid > 0 “
    . ‘ AND (a.publish_up = ‘.$db->Quote($nullDate).’ OR a.publish_up <= ‘.$db->Quote($now).’ ) ‘
    . ‘ AND (a.publish_down = ‘.$db->Quote($nullDate).’ OR a.publish_down >= ‘.$db->Quote($now).’ )’
    . ($noauth ? ‘ AND a.access <= ‘ .(int) $aid. ‘ AND cc.access <= ‘ .(int) $aid : ”)
    . “n AND cc.published = 1 )”
    . “n ORDER BY f.ordering ASC”;
    $db->setQuery($query, 0, $items);
    $news = $db->loadObjectList();

    global $mainframe;
    JPluginHelper::importPlugin(‘content’);
    $dispatcher =& JDispatcher::getInstance();
    $params =& $mainframe->getParams(‘com_content’);
    $limitstart = JRequest::getVar(‘limitstart’, 0, ”, ‘int’);

    for($i=0;$i<count($news);$i++) {
    $news[$i]->text = $news[$i]->introtext;
    $results = $dispatcher->trigger(‘onPrepareContent’, array (& $news[$i], & $params, $limitstart));
    $news[$i]->introtext = $news[$i]->text;
    }

    return $news;
    }

    function getFile($name, $modPath, $tmplPath) {
    if (file_exists(JPATH_SITE.DS.$tmplPath.$name)) {
    return $tmplPath.$name;
    }
    return $modPath.$name;
    }

    function getAllCatIds ($catorsec) {
    $db =& JFactory::getDBO();
    if($catorsec){
    $query = “SELECT id FROM #__categories WHERE published = 1;”;
    }
    else{
    $query = “SELECT id FROM #__sections WHERE published = 1;”;
    }
    $db->setQuery($query);
    $c = $db->loadObjectList();
    $catids = array();
    foreach($c as $_c) $catids[] = $_c->id;
    return $catids;
    }

    function getAllCatIdsBySection ($sectionid) {
    $db =& JFactory::getDBO();
    $query = “SELECT id FROM #__categories WHERE section = $sectionid;”;

    $db->setQuery($query);
    $c = $db->loadObjectList();
    $catids = array();
    foreach($c as $_c) $catids[] = $_c->id;
    return $catids;
    }

    function getModuleParameters($modid) {
    $db =& JFactory::getDBO();
    $query = “SELECT params FROM #__modules WHERE id = $modid;”;
    $db->setQuery($query);
    return $db->loadResult();
    }

    function getItemid($sectionid) {
    $contentConfig = &JComponentHelper::getParams( ‘com_content’ );
    $noauth = !$contentConfig->get(‘shownoauth’);
    $user =& JFactory::getUser();
    $aid = $user->get(‘aid’, 0);
    $db =& JFactory::getDBO();
    $query = “SELECT id FROM #__menu WHERE `link` like ‘%option=com_content%view=section%id=$sectionid%'”
    . ‘ AND published = 1’
    . ($noauth ? ‘ AND access <= ‘ .(int) $aid : ”);

    $db->setQuery($query);
    return $db->loadResult();
    }
    }

    class SmartTrim {
    /*
    $hiddenClasses: Class that have property display: none or invisible.
    */
    function mb_trim($strin, $pos=0, $len=10000, $hiddenClasses = ”, $encoding=’utf-8′ ) {
    mb_internal_encoding($encoding);
    $strout = trim($strin);

    $pattern = ‘/(<[^>]*>)/’;
    $arr = preg_split($pattern, $strout, -1, PREG_SPLIT_DELIM_CAPTURE);
    $left = $pos;
    $length = $len;
    $strout = ”;
    for($i=0;$i<count($arr);$i++) {
    $arr[$i] = trim($arr[$i]);
    if ($arr[$i] == ”) continue;
    if ($i % 2 == 0) {
    if($left > 0) {
    $t = $arr[$i];
    $arr[$i] = mb_substr($t, $left);
    $left -= (mb_strlen ($t) – mb_strlen ($arr[$i]));
    }

    if ($left <= 0) {
    if ($length > 0) {
    $t = $arr[$i];
    $arr[$i] = mb_substr($t, 0, $length);
    $length -= mb_strlen ($arr[$i]);
    if ($length <= 0) {
    $arr[$i] .= ‘…’;
    }

    } else {
    $arr[$i] = ”;
    }
    }
    }else{
    if (SmartTrim::isHiddenTag ($arr[$i], $hiddenClasses)) {
    if ($endTag = SmartTrim::getCloseTag($arr, $i)){
    while ($i<$endTag) $strout .= $arr[$i++].”n”;
    }
    }
    }
    $strout .= $arr[$i].”n”;
    }
    //echo $strout;
    return SmartTrim::toString($arr, $len);
    }

    function trim($strin, $pos=0, $len=10000, $hiddenClasses = ” ) {
    $strout = trim($strin);

    $pattern = ‘/(<[^>]*>)/’;
    $arr = preg_split($pattern, $strout, -1, PREG_SPLIT_DELIM_CAPTURE);
    $left = $pos;
    $length = $len;
    $strout = ”;
    for($i=0;$i<count($arr);$i++) {
    $arr[$i] = trim($arr[$i]);
    if ($arr[$i] == ”) continue;
    if ($i % 2 == 0) {
    if($left > 0) {
    $t = $arr[$i];
    $arr[$i] = substr($t, $left);
    $left -= (strlen ($t) – strlen ($arr[$i]));
    }

    if ($left <= 0) {
    if ($length > 0) {
    $t = $arr[$i];
    $arr[$i] = substr($t, 0, $length);
    $length -= strlen ($arr[$i]);
    if ($length <= 0) {
    $arr[$i] .= ‘…’;
    }

    } else {
    $arr[$i] = ”;
    }
    }
    }else{
    if (SmartTrim::isHiddenTag ($arr[$i], $hiddenClasses)) {
    if ($endTag = SmartTrim::getCloseTag($arr, $i)){
    while ($i<$endTag) $strout .= $arr[$i++].”n”;
    }
    }
    }
    $strout .= $arr[$i].”n”;
    }
    //echo $strout;
    return SmartTrim::toString($arr, $len);
    }

    function isHiddenTag ($tag, $hiddenClasses=”) {
    //By pass full tag like img
    if (substr($tag, -2)==’/>’) return false;
    if (in_array(SmartTrim::getTag($tag), array(‘script’,’style’))) return true;
    if (preg_match(‘/displays*:s*none/’, $tag)) return true;
    if ($hiddenClasses && preg_match(‘/classs*=*(‘.$hiddenClasses.’)*/’, $tag)) return true;
    }

    function getCloseTag ($arr, $openidx) {
    $tag = trim($arr[$openidx]);
    if(!$openTag = SmartTrim::getTag($tag)) return 0;

    $endTag = “</$openTag>”;
    $endidx = $openidx+1;
    $i=1;
    while ($endidx<count($arr)) {
    if (trim($arr[$endidx]) == $endTag) $i–;
    if (SmartTrim::getTag($arr[$endidx])==$openTag) $i++;
    if ($i == 0) return $endidx;
    $endidx++;
    }
    return 0;
    }

    function getTag ($tag) {
    if (preg_match (‘/A<([^/>]*)/>Z/’, trim($tag), $matches)) return ”; //full tag
    if (preg_match (‘/A<([^ />]*)([^>]*)>Z/’, trim($tag), $matches)) {
    //echo “[“.strtolower($matches[1]).”]”;
    return strtolower($matches[1]);
    }
    //if (preg_match (‘/<([^ />]*)([^/>]*)>/’, trim($tag), $matches)) return strtolower($matches[1]);
    return ”;
    }

    function toString ($arr, $len) {
    $i = 0;
    $stack = new JAStack();
    $length = 0;
    while ($i<count($arr)) {
    $tag = trim($arr[$i++]);
    if ($tag == ”) continue;
    if (SmartTrim::isCloseTag ($tag)){
    if ($ltag = $stack->getLast()){
    if (‘</’.SmartTrim::getTag($ltag).’>’ == $tag) $stack->pop();
    else $stack->push($tag);
    }
    } else if (SmartTrim::isOpenTag ($tag)) {
    $stack->push ($tag);
    } else if (SmartTrim::isFullTag ($tag)) {
    //echo “n”;
    if ($length < $len)
    $stack->push ($tag);
    } else {
    $length += strlen ($tag);
    $stack->push ($tag);
    }
    }

    return $stack->toString();
    }

    function isOpenTag ($tag) {
    if (preg_match (‘/A<([^/>]+)/>Z/’, trim($tag), $matches)) return false; //full tag
    if (preg_match (‘/A<([^ />]+)([^>]*)>Z/’, trim($tag), $matches)) return true;
    return false;
    }

    function isFullTag ($tag) {
    //echo “n”;
    if (preg_match (‘/A<([^/>]*)/>Z/’, trim($tag), $matches)) return true; //full tag
    return false;
    }

    function isCloseTag ($tag) {
    if (preg_match (‘/</(.*)>/’, $tag)) return true;
    return false;
    }
    }

    class JAStack {
    var $_arr = null;
    function JAStack() {
    $this->_arr = array();
    }

    function push ($item) {
    $this->_arr = $item;
    }
    function pop () {
    if (!$c = count($this->_arr)) return null;
    $ret = $this->_arr[$c-1];
    unset ($this->_arr[$c-1]);
    return $ret;
    }
    function getLast() {
    if (!$c = count($this->_arr)) return null;
    return $this->_arr[$c-1];
    }
    function toString() {
    $output = ”;
    foreach ($this->_arr as $item) {
    $output .= $item.”n”;
    }
    return $output;
    }
    }
    }
    [/PHP]
    this code works. at least at the moment it works good. thx again.

    <em>@cgc0202 75083 wrote:</em><blockquote>Hi gaygiorgia,

    If you have a working Joomla 1.5.3-Teline II QuickStart Kit — including the corrections done by Hainn related to the <br /> issue, why not just to a QuickStart installation of the Joomla 1.5.3-Teline II QuickStart Kit, then if that works just do a Joomla (only) upgrade to Joomla 1.5.6 using a Joomla 1.5.3 to 1.5.6 Patch update?

    At most, the installation using the above will not take more than twenty minutes — much less than the amount of time spent in this thread.[…cut…]</blockquote>
    Because if something is changed in baseform by JA developers, is surely something of good 🙂
    2kb of difference in weight is an improvement that i don’t want to lose 😉


    1. helper.zip
    gaygiorgia Friend
    #266635

    now we have only to wait a hainn84 retry for an official responde 🙂

    cgc0202 Friend
    #266639

    I hope Hainn identifies the actual files and provides the specific scripts modified. The changelog on 2008015 definitely are new — too bad they did not provide the forum thread links associated with those fixes.

    gaygiorgia Friend
    #266642

    yeah, your totally right.
    when i downloaded the last version, i found a total new helper.php file. and i didn’t found any detailed info on changes.

    P.S.
    this is another reason that i cannot install a v1.3 with all fixes: not sufficient informations on code variations… 😉

    Sherlock Friend
    #266665

    Hi All,
    Sorry for the delay. We have figured out the solution for JA News problem.

    Description : When using Ja News with <br /> tag in introtext , format of introtext is incorrect in JA News , <br /> is removed in ja news.

    Please open attachment file go to line 46 :
    Download attachment : 2562
    old code :


    $regex1 = "/<img.*/>/";
    $row->introtext = preg_replace( $regex1, '', $row->introtext );

    new code :


    $regex1 = "/<img[^>]*>/";
    $row->introtext = preg_replace( $regex1, '', $row->introtext );

    2561

    this error appears when trim “<img” tag of introtext.
    if using old code , it will cut text from position #1 to position #3.
    with new code , it will cut text form position #1 to postion #2.
    because html code of position #2 and position #3 is similar , old code not seperate them.

Viewing 15 posts - 16 through 30 (of 57 total)

This topic contains 57 replies, has 4 voices, and was last updated by  bossep 15 years, 9 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum