skat123 0 Newbie Poster

Getting the following error while running the website script

Parse error: parse error, expecting `';'' in F:\xampp 1.7.1\xampp\htdocs\engine\includes\functions.php on line 23

Please help to solve this. Here is the coding of functions.php from line 1 till end

function paging( $frontUrl, $backUrl, $currentPage, $rowsPerPage, $allRows )
{
    global $langArray;
    if ( $allRows <= $rowsPerPage && !check_debug( ) )
    {
        return "";
    }
    $paging = "<div class=\"pagination\"><div class=\"page_numbers\"><span class=\"page-first\">".$langArray['page']."</span>";
    $pages = ceil( $allRows / $rowsPerPage );
    if ( 2 < $currentPage )
    {
        $paging .= "<a href=\"".$frontUrl."1".$backUrl."\" title=\"First page\" class=\"arrows\">«</a>";
    }
    if ( 1 < $currentPage )
    {
        $paging .= ( "<a href=\"".$frontUrl.( $currentPage - 1 ) ).$backUrl."\" title=\"Previous page\" class=\"arrows\">‹</a>";
    }
    if ( 10 < $pages )
    {
        if ( $currentPage == 1 )
        {
            $i = 1;
            for ( ; do ;
 {
 $i <= 10; ++$i, )
                {
                    $paging .= "<a href=\"".$frontUrl.$i.$backUrl."\" ".( $i == $currentPage ? " class=\"selected\"" : " class=\"normal\"" ).">".$i."</a>";
                    break;
                }
            } while ( 1 );
        }
        else if ( $currentPage == $pages )
        {
            $i = $pages - 10;
            for ( ; do
 {
 $i <= $pages; ++$i, )
                {
                    $paging .= "<a href=\"".$frontUrl.$i.$backUrl."\" ".( $i == $currentPage ? " class=\"selected\"" : " class=\"normal\"" ).">".$i."</a>";
                    break;
                }
            } while ( 1 );
        }
        else
        {
            $start = $currentPage - 5;
            if ( $start < 1 )
            {
                $start_at = 1;
                $end = -1 * $start + 5 + $currentPage;
            }
            else
            {
                $start_at = $start;
                $end = $start_at + 10;
                if ( $pages < $end )
                {
                    $start_at -= $end - $pages;
                    $end = $pages;
                }
            }
            $i = $start_at;
            for ( ; do
 {
 $i <= $end; ++$i, )
                {
                    $paging .= "<a href=\"".$frontUrl.$i.$backUrl."\" ".( $i == $currentPage ? " class=\"selected\"" : " class=\"normal\"" ).">".$i."</a>";
                    break;
                }
            } while ( 1 );
        }
    }
    else
    {
        $i = 1;
        for ( ; $i <= $pages; ++$i )
        {
            $paging .= "<a href=\"".$frontUrl.$i.$backUrl."\" ".( $i == $currentPage ? " class=\"selected\"" : " class=\"normal\"" ).">".$i."</a>";
        }
    }
    if ( $currentPage < $pages )
    {
        $paging .= ( "<a href=\"".$frontUrl.( $currentPage + 1 ) ).$backUrl."\"  title=\"Next page\" class=\"arrows\">›</a>";
    }
    if ( $currentPage + 1 < $pages )
    {
        $paging .= "<a href=\"".$frontUrl.$pages.$backUrl."\" title=\"Last page\" class=\"arrows\">»</a>";
    }
    $toPages = $currentPage * $rowsPerPage;
    if ( $allRows < $toPages )
    {
        $toPages = $allRows;
    }
    return ( $paging."</div><p class=\"page_items\">".( ( $currentPage - 1 ) * $rowsPerPage + 1 ) )." - ".$toPages." ".$langArray['of']." ".$allRows." ".$langArray['themes']."</p></div>";
}

function timeLeft( $integer )
{
    $days = "";
    $weeks = "";
    $hours = "";
    $minutes = "";
    $return = "";
    $seconds = $integer;
    if ( 1 <= $seconds / 60 )
    {
        $minutes = floor( $seconds / 60 );
        if ( 1 <= $minutes / 60 )
        {
            $hours = floor( $minutes / 60 );
            if ( 1 <= $hours / 24 )
            {
                $days = floor( $hours / 24 );
                if ( 1 <= $days / 7 )
                {
                    $weeks = floor( $days / 7 );
                    if ( 2 <= $weeks )
                    {
                        return "{$weeks} weeks";
                    }
                    return "{$weeks} week";
                }
                $days -= floor( $days / 7 ) * 7;
                if ( 2 <= $days )
                {
                    return "{$days} days";
                }
                if ( $days == 1 )
                {
                    return "{$days} day";
                }
            }
            $hours -= floor( $hours / 24 ) * 24;
            if ( 2 <= $hours )
            {
                $return = "{$hours} hours";
            }
            if ( $hours == 1 )
            {
                $return = "{$hours} hour";
            }
        }
        $minutes -= floor( $minutes / 60 ) * 60;
        if ( 2 <= $minutes )
        {
            return "{$return} {$minutes} minutes";
        }
        if ( $minutes == 1 )
        {
            return "{$return} {$minutes} minute";
        }
    }
    $seconds = $integer - floor( $integer / 60 ) * 60;
    if ( 2 <= $seconds )
    {
        return "{$seconds} seconds";
    }
    if ( $seconds == 1 )
    {
        return "{$seconds} second";
    }
    return "0 seconds";
}

function yearsOld( $birthday )
{
    if ( ( $birthday = strtotime( $birthday ) ) === FALSE )
    {
        return FALSE;
    }
    $i = 0;
    while ( $birthday < strtotime( "-".$i." year" ) )
    {
        ++$i;
    }
    return $i - 1;
}

function getSignByDate( $day, $month )
{
    if ( !( $month == 1 ) && 21 <= $day || $month == 2 && $day <= 19 )
    {
        $sign = 1;
        return $sign;
    }
    if ( !( $month == 2 ) && 20 <= $day || $month == 3 && $day <= 20 )
    {
        $sign = 2;
        return $sign;
    }
    if ( !( $month == 3 ) && 21 <= $day || $month == 4 && $day <= 20 )
    {
        $sign = 3;
        return $sign;
    }
    if ( !( $month == 4 ) && 21 <= $day || $month == 5 && $day <= 20 )
    {
        $sign = 4;
        return $sign;
    }
    if ( !( $month == 5 ) && 21 <= $day || $month == 6 && $day <= 21 )
    {
        $sign = 5;
        return $sign;
    }
    if ( !( $month == 6 ) && 22 <= $day || $month == 7 && $day <= 22 )
    {
        $sign = 6;
        return $sign;
    }
    if ( !( $month == 7 ) && 23 <= $day || $month == 8 && $day <= 22 )
    {
        $sign = 7;
        return $sign;
    }
    if ( !( $month == 8 ) && 23 <= $day || $month == 9 && $day <= 22 )
    {
        $sign = 8;
        return $sign;
    }
    if ( !( $month == 9 ) && 23 <= $day || $month == 10 && $day <= 23 )
    {
        $sign = 9;
        return $sign;
    }
    if ( !( $month == 10 ) && 24 <= $day || $month == 11 && $day <= 22 )
    {
        $sign = 10;
        return $sign;
    }
    if ( !( $month == 11 ) && 23 <= $day || $month == 12 && $day <= 21 )
    {
        $sign = 11;
        return $sign;
    }
    if ( !( $month == 12 ) && 22 <= $day || $month == 1 && $day <= 20 )
    {
        $sign = 12;
    }
    return $sign;
}

function deleteFile( $path )
{
    if ( is_file( $path ) )
    {
        return unlink( $path );
    }
    return FALSE;
}

function cyr2lat( $input )
{
    $cyr = array( "Щ", "Ш", "Ч", "Ц", "Ю", "Я", "Ж", "А", "Б", "В", "Г", "Д", "Е", "З", "И", "Й", "К", "Л", "М", "Н", "О", "П", "Р", "С", "Т", "У", "Ф", "Х", "Ь", "Ъ", "щ", "ш", "ч", "ц", "ю", "я", "ж", "а", "б", "в", "г", "д", "е", "з", "и", "й", "к", "л", "м", "н", "о", "п", "р", "с", "т", "у", "ф", "х", "ь", "ъ", " " );
    $lat = array( "Sht", "Sh", "Ch", "Tz", "Yu", "Ya", "Zh", "A", "B", "V", "G", "D", "E", "Z", "I", "J", "K", "L", "M", "N", "O", "P", "R", "S", "T", "U", "F", "H", "Io", "Y", "sht", "sh", "ch", "tz", "yu", "ya", "zh", "a", "b", "v", "g", "d", "e", "z", "i", "j", "k", "l", "m", "n", "o", "p", "r", "s", "t", "u", "f", "h", "io", "y", "_" );
    $cyrCount = count( $cyr );
    $i = 0;
    for ( ; $i < $cyrCount; ++$i )
    {
        $current_cyr = $cyr[$i];
        $current_lat = $lat[$i];
        $input = str_replace( $current_cyr, $current_lat, $input );
    }
    return $input;
}

function cp1251_to_utf8( $s )
{
    $t = "";
    $c209 = chr( 209 );
    $c208 = chr( 208 );
    $c129 = chr( 129 );
    $i = 0;
    for ( ; $i < strlen( $s ); ++$i )
    {
        $c = ord( $s[$i] );
        if ( 192 <= $c && $c <= 239 )
        {
            $t .= $c208.chr( $c - 48 );
        }
        else if ( 239 < $c )
        {
            $t .= $c209.chr( $c - 112 );
        }
        else if ( $c == 184 )
        {
            $t .= $c209.$c209;
        }
        else if ( $c == 168 )
        {
            $t .= $c208.$c129;
        }
        else
        {
            $t .= $s[$i];
        }
    }
    return $t;
}

function utf8_to_cp1251( $s )
{
    $out = "";
    $byte2 = FALSE;
    $c = 0;
    for ( ; $c < strlen( $s ); ++$c )
    {
        $i = ord( $s[$c] );
        if ( $i <= 127 )
        {
            $out .= $s[$c];
        }
        if ( $byte2 )
        {
            $new_c2 = ( $c1 & 3 ) * 64 + ( $i & 63 );
            $new_c1 = $c1 >> 2 & 5;
            $new_i = $new_c1 * 256 + $new_c2;
            if ( $new_i == 1025 )
            {
                $out_i = 168;
            }
            else if ( $new_i == 1105 )
            {
                $out_i = 184;
            }
            else
            {
                $out_i = $new_i - 848;
            }
            $out .= chr( $out_i );
            $byte2 = FALSE;
        }
        if ( $i >> 5 == 6 )
        {
            $c1 = $i;
            $byte2 = TRUE;
        }
    }
    return $out;
}

function replaceEmoticons( $text )
{
    global $config;
    $codes = array_keys( $config['emoticons'] );
    $images = array_values( $config['emoticons'] );
    $tmp = array( );
    foreach ( $images as $k => $v )
    {
        $tmp[$k] = "<img src=\"".DATA_SERVER."/images/emoticons/".$v."\" alt=\"emoticon\" />";
    }
    return str_ireplace( $codes, $tmp, $text );
}

?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.