return true;
}
/** Detect if the user's PHP/LibXML is affected by the following bug: -

 *  http://bugs.php.net/bug.php?id=45996 

*/
function LibXml2IsBuggy()
{
    global $libxml2_test_query;
    $libxml2_test_query = '';
    $testxml = '<xml><libxml2_test_query>select &apos;a&apos;</libxml2_test_query></xml>';
    GetDetailsFromPostedXML($testxml);
    if (strcasecmp($libxml2_test_query, 'select a') == 0) {
        //This PHP/LibXML is buggy!
        return true;
    }
    //Not buggy!
    return false;
}
/* we can now use SQLyogTunnel.php to log debug informations, which will help us to point out the error */
function WriteLog($loginfo)
{
    if (defined("DEBUG")) {
        $fp = fopen("yogtunnel.log", "a");
        if ($fp == FALSE) {
            return;
        }
        fwrite($fp, $loginfo . "\r\n");
        // MY_CHANGE: Because below it was
        // printing 'Enter' instead of new line
        fclose($fp);
    }
}
function WriteLogTemp($loginfo)
{
    if (defined("DEBUG")) {
        $fp = fopen("sabya.log", "a");
        if ($fp == FALSE) {
            return;
        }
        fwrite($fp, $loginfo . "\r\n");
        // MY_CHANGE: Because below it was
        // printing 'Enter' instead of new line
        fclose($fp);
    }
}
/* Process the  query*/
function ProcessQuery()
{
    WriteLog("Enter processquery");
    if (CheckPHPVersion() == FALSE) {
        /*  now the call can be of three types

            1.) Specific to check tunnel version

            2.) Normal where it is expected that the PHP page is 4.3.0

            3.) From browser

            

            We check this by checking the query string which is sent if just a check is done by SQLyog */
        WriteLog("CheckPHPVersion is FALSE");
        if (isset($_GET['app'])) {
            echo tunnelversionstring;
            echo phpversionerror;
        } else {
            WriteLog("CheckPHPVersion is FALSE and app query string not set");
            ShowAccessError();
        }
        return;
    }
    /* in special case, sqlyog just sends garbage data with query string to check for tunnel version. we need to process that now */
    if (isset($_GET['app'])) {
        WriteLog("app query string not set");
        echo tunnelversionstring;
        echo tunnelversion;
        return;
    }
    /* Starting from 5.1 BETA 4, we dont get the data as URL encoded POST data, we just get it as raw data */
    WriteLog("Trying to get php://input");
    $xmlrecvd = file_get_contents("php://input");
    WriteLog("Got php://input!");
Esempio n. 2
0
function ExecuteBatchQuery($mysql, $query)
{
    WriteLog("Enter ExecuteBatchQuery");
    $found = FALSE;
    $token = NULL;
    $prev = NULL;
    $token = my_strtok($query, $found);
    while (!empty($token)) {
        $prev = $token;
        $token = my_strtok($query, $found);
        if (empty($token)) {
            return ExecuteSingleQuery($mysql, $prev);
        }
        $result = mysql_query($prev, $mysql);
        if (!$result) {
            return HandleError(mysql_errno(), mysql_error());
        }
        mysql_free_result($result);
    }
    WriteLog("Exit ExecuteBatchQuery");
    return;
}