Jump to content

[SOLVED] Im New


shage

Recommended Posts

Im new and thank you for the welcomes!

 

Why am i getting such errors?

 

Thank you in advance, im new to this whole php thing so take it easy on me ya know :)

 

 

function version_compare_replacement_sub( $version1, $version2, $operator = "" )

    {

        global $versiontype_lookup;

        if ( isset( $versiontype_lookup ) )

        {

            $versiontype_lookup['dev'] = 10001;

            $versiontype_lookup['a'] = 10002;

            $versiontype_lookup['alpha'] = 10002;

            $versiontype_lookup['b'] = 10003;

            $versiontype_lookup['beta'] = 10003;

            $versiontype_lookup['RC'] = 10004;

            $versiontype_lookup['pl'] = 10005;

        }

        if ( isset( $Var_1 ) )

        {

            $version1 = $versiontype_lookup[$version1];

        }

        if ( isset( $Var_1 ) )

        {

            $version2 = $versiontype_lookup[$version2];

        }

       

    case "<" :

    case "lt" :

    default :

        return intval( $version1 < $version2 );

    case "<=" :

    case "le" :

    default :

        return intval( $version1 <= $version2 );

    case ">" :

    case "gt" :

    default :

        return intval( $version2 < $version1 );

    case ">=" :

    case "ge" :

    default :

        return intval( $version2 <= $version1 );

    case "==" :

    case "=" :

    case "eq" :

    default :

    default :

        return intval( $version1 == $version2 );

    case "!=" :

    case "<>" :

    case "ne" :

    default :

    default :

        return intval( $version1 != $version2 );

    default :

        if ( $version1 == $version2 )

        {

            return 0;

        }

        else if ( $version1 < $version2 )

        {

            return -1;

        }

        return 1;

    }

 

 

Link to comment
Share on other sites

also... your missing you entire switch() function...

 

Hehe... I must be going blind.

 

so i could just take that function out and all references to it and it would be alright again

 

Maybe, that function is broken, but you may also have other code that relies on it (when its working).

Link to comment
Share on other sites

Well i took it out and it errors on

 

function imagecreatefunction( $x_size, $y_size )

    {

        $ImageCreateFunction = "ImageCreate";

        if ( 0 <= phpthumb_functions::gd_version( ) )

        {

            $ImageCreateFunction = "ImageCreateTrueColor";

        }

        do

        {

            if ( function_exists( $ImageCreateFunction ) )

                break;

            return phpthumb::ErrorImage( $ImageCreateFunction."() does not exist - no GD support?" );

        } while( 0 );

        if ( $x_size <= 0 || $y_size <= 0 )

        {

            return phpthumb::ErrorImage( "Invalid image dimensions: ".$ImageCreateFunction."(".$x_size.", ".$y_size.")" );

        }

        else

        {

        }

        return ( $x_size, $y_size );

    }

 

that was because it was erroring before that call,hmm

 

Link to comment
Share on other sites

<?php
function version_compare_replacement_sub( $version1, $version2, $operator = "" )
    {
        global $versiontype_lookup;
        if ( isset( $versiontype_lookup ) )
        {
            $versiontype_lookup['dev'] = 10001;
            $versiontype_lookup['a'] = 10002;
            $versiontype_lookup['alpha'] = 10002;
            $versiontype_lookup['b'] = 10003;
            $versiontype_lookup['beta'] = 10003;
            $versiontype_lookup['RC'] = 10004;
            $versiontype_lookup['pl'] = 10005;
        }
        if ( isset( $Var_1 ) )
        {
            $version1 = $versiontype_lookup[$version1];
        }
        if ( isset( $Var_1 ) )
        {
            $version2 = $versiontype_lookup[$version2];
        }
    switch ($operator) {   
    case "<" :
    case "lt" :
        return intval( $version1 < $version2 );
        break;
    case "<=" :
    case "le" :
        return intval( $version1 <= $version2 );
        break;
    case ">" :
    case "gt" :
        return intval( $version2 < $version1 );
        break;
    case ">=" :
    case "ge" :
        return intval( $version2 <= $version1 );
        break;
    case "==" :
    case "=" :
    case "eq" :
        return intval( $version1 == $version2 );
        break;
    case "!=" :
    case "<>" :
    case "ne" :
    default:
        return intval( $version1 != $version2 );
        break;
    }

        if ( $version1 == $version2 )
        {
            return 0;
        }
        else if ( $version1 < $version2 )
        {
            return -1;
        }
        return 1;
}
?>

 

Given I didn't mess up syntax that should work.

Link to comment
Share on other sites

function version_compare_replacement_sub($version1, $version2, $operator='') {

static $versiontype_lookup = array();

        if (empty($versiontype_lookup)) {

            $versiontype_lookup['dev']  = 10001;

            $versiontype_lookup['a']    = 10002;

            $versiontype_lookup['alpha'] = 10002;

            $versiontype_lookup['b']    = 10003;

            $versiontype_lookup['beta']  = 10003;

            $versiontype_lookup['RC']    = 10004;

            $versiontype_lookup['pl']    = 10005;

        }

        if (isset($versiontype_lookup[$version1])) {

            $version1 = $versiontype_lookup[$version1];

        }

        if (isset($versiontype_lookup[$version2])) {

            $version2 = $versiontype_lookup[$version2];

        }

 

        switch ($operator) {

            case '<':

            case 'lt':

                return intval($version1 < $version2);

                break;

            case '<=':

            case 'le':

                return intval($version1 <= $version2);

                break;

            case '>':

            case 'gt':

                return intval($version1 > $version2);

                break;

            case '>=':

            case 'ge':

                return intval($version1 >= $version2);

                break;

            case '==':

            case '=':

            case 'eq':

                return intval($version1 == $version2);

                break;

            case '!=':

            case '<>':

            case 'ne':

                return intval($version1 != $version2);

                break;

        }

        if ($version1 == $version2) {

            return 0;

        } elseif ($version1 < $version2) {

            return -1;

        }

        return 1;

    }

 

 

That fixed it dont know why but it diid

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.