NineChime forum

Furry stuff, oekaki stuff, and other stuff.

You are not logged in.

#1 03-04-2010 02:53:01

Waccoon
Administrator

Wacintaki 1.5.0 is now available

At long last, 1.5.0 may be downloaded from the products page.  I've only been working on it on-and-off so that's why it took so long.

It's pretty well tested, but please do let me know about any teething problems.

I'm afraid there's not many new features, but a LOT of things have changed under the hood, most notably the new database layer and configuration file which are long, long overdue.  There's also a new language translation system which is easier to work with, allows data insertions, and also supports basic plurals.  I have to work out an encoding issue that messed up the Chinese language pack, however.  My text editor messed up the UTF-8 and Big5 encoding of the language packs a while ago and I never noticed.  I have to figure out how to convert the files properly, and apparently, my UTF-8 compatible IDE won't do it.  Hmm...

I made a script to automatically convert language files with a bunch of regex expressions, but it's much too raw to release publicly.  Once I work out the UTF-8 issues with my IDE, it should be possible to easily convert any existing language pack to the new format.

Code:

v1.5.0 - March 4, 2010

    KNOWN ISSUES:
    - Chinese language packs temporarily suspended.  Character encoding has become corrupt over the last few versions of Wacintaki and needs to be cleaned up.

    CHANGES:
    - New database layer supports updated MySQL 5 authentication (mysqli).  MySQL compatibility should now be better in the future.
    - New database error reporting makes diagnostics and installation easier.  Moving towards PostgreSQL support.
    - Moved regular maintenance into "maint.php".  Todo: refactor into a cron manager.
    - Fixed default password issue with uploader and strict syntax with MySQL 5.
    - Fixed very strange problem with duplicate names being added to online list if pages are refreshed very quickly, particularly with the mailbox (?!)
    - Removed some "windows-1252" charset codes from comments (PHP may output garbage even when codes are commented out).
    - New debug added to paintsave which helps to identify upload issues on servers with bizarre security policies.
    - JavaScript is no longer needed for pop-up windows (such as the online list).
    - Language selector will no longer show index files if one is in the language folder.
    - Fixed two undefined index issues with the avatar editor.
    - Simplified updater, and fixed a few issues with version detection for 1.3.x updates.

    FEATURES:
    - PHP 6 compatible (fixed NiftyToo and short tag support, plus userflag parsing).
    - New function-based language system improves translation and prevents missing translations.
    - Language system now supports basic plurals, as well as the singular zero cluase.
    - Editing old comments now redirects to the correct page/post.
    - Cleaned up guest IP/Host output so it can be copy/pasted to a text file.
    - Picture recovery now shows friendlier dates and time remaining until WIP deletion.
    - Comments now allowed in ban list, to help identify users and reasons for banning.
    - SQL direct call script makes tech support easier (removable, available to owner only).

    "U-DO-IT":
    - Language usage as follows:
        Using the new t() function:
            echo "<strong>{$langop_something}</strong>\n";
            echo '<strong>'.t('something')."</strong>\n";

        The tt() function replaces echo() and short PHP tags:
            <?=$langop_something;?>
            <?php tt('something');?>

        Don't use tt() when concatenating:
            <?php echo t('something').t('something_else');?>

        Substitutions:
            // 'report_vars' = "There are {1} of type {2} available."
            t('report_vars', $number, $name);

        Easily change the order of substitutions in the language files:
            // 'report_vars' = "Type {2}: {1} available."
            t('report_vars', $number, $name);

        Plurals:
            // {p?x:y} where p is the parameter number, x is singular, and y is plural
            $lang['something'] = '{1} {1?member:members}' found.';
            $lang['something'] = 'There {1?is:are} {1} {1?value:values} found.';
            $lang['something'] = 'Set {1} {1?value:values}' on {2} {2?system:systems}';

            // Embedding WILL NOT work:
            $lang['something'] = 'There {1?is {1} value and it is:are {1} values and they are} useless.';

            // Simplify sentence structure to avoid gotchas.

            // Zero can be set to singular in language config (example: French uses singular zero)
            $lang['cfg_zero_plural'] = 0;

Offline

#2 03-25-2010 20:55:28

Nullig
Member

Re: Wacintaki 1.5.0 is now available

I've updated my sites, but now I get the following error:

Fatal error: Call to undefined function: mysqli_query() in /my/path/to/db_layer.php  on line 78

Any ideas?

Nullig

Offline

#3 03-26-2010 04:07:36

Waccoon
Administrator

Re: Wacintaki 1.5.0 is now available

Hmm... apparently, I have to use a different method to detect the database type.

This file should fix it:  1.5.1 database layer

I'll take a closer look at this and get a proper patch out ASAP.

Offline

#4 03-26-2010 23:21:40

Nullig
Member

Re: Wacintaki 1.5.0 is now available

That gives me this error:

Fatal error: Call to undefined function: mysqli_query() in /my/path/to/db_layer.php  on line 79

I fixed it temporarily by commenting out all of the ($GLOBALS['si']) conditional statements.

Nullig

Offline

#5 03-27-2010 03:38:27

Waccoon
Administrator

Re: Wacintaki 1.5.0 is now available

I think your host is doing something really strange.  Let me know if this updated file works:  1.5.1 database layer.

I tried to force my own server to behave like your host by disabling the query function, but I get a different error message.  I'm not sure what they're doing to disable the new database handler, but I think this updated file will get around that.  If anything, this should be a pretty rare problem, I hope.

Offline

#6 03-27-2010 13:28:26

Nullig
Member

Re: Wacintaki 1.5.0 is now available

Yes, I'm sure the host has some weird settings.

The latest fix still gives an error:

Fatal error: Call to undefined function: mysqli_query() in /my/path to/db_layer.php  on line 82

I tried explicitly setting $si to FALSE, as well, and it didn't work for me either. As I said, the only way I can get it to work is by removing all of the ($GLOBALS['si']) conditional statements.

Here is the db_layer.php I'm using:

Code:

<?php // Include only
if (!defined ('BOOT')) exit ('No bootstrap.  Exiting.');

/*
Wacintaki Poteto database layer Copyright 2010 Marc "Waccoon" Leveille
http://www.NineChime.com/products/
Version 1.5.0 - Last modified 11/26/2009

Fixes MySQL 5 password support, improves error reporting.  First step towards a real database layer.

Notes:
    PHP < 5.3 does not support namespaces, so for compatibility, "global" is used a lot, here.
    OO style is not used, because MySQL4 layer doesn't support it.

Todo:
    history/error caches more than one message

*/


// Init
$dbconn    = NULL;
$dbcharset = NULL;
// $wactest = (Debug var set in hacks.php file)

// Config must be public for backwards compatibility
require_once ('dbconn.php');

// Remap prefixes
$db_p   = $OekakiPoteto_Prefix;
$db_mem = $OekakiPoteto_MemberPrefix;
$db_op  = $db_p;   // Deprecated
$db_pre = $db_p;   // Deprecated
$db_mem = $db_mem; // Deprecated

// Do not use outside of db_layer.php!
$db_error = '';
$db_history = '';

// Use mysql or mysqli?
$si = (extension_loaded ('mysqli')) ? TRUE : FALSE;

//    =    =    =    =    =    =    =    =    =    =    =    =    =    =    =    =    =    =

function db_backtrace() {
    // Gets backtrace to figure out line number for bad db_*() call

    next (debug_backtrace());
    next (debug_backtrace());
    $debug = next(debug_backtrace());
    end (debug_backtrace());

    $info = pathinfo ($debug['file']);

    return ("[{$info['basename']} > db_result() > {$debug['line']}]");
}

function db_trigger() {
    global $dbconn, $wactest;

    $marker = db_backtrace();

    trigger_error ($marker, E_USER_WARNING);
    if ($wactest) {
        echo ('<b>DB: '.db_error().'</b><br />');
    }

    return;
}

function db_query($q) {
    global $dbconn, $wactest;

    db_push_history($q);

    // Note: Queries do not trigger errors.  Do not mask with "@".
    $result = mysql_query ($q, $dbconn);

    if ($result === FALSE) {
        $marker = db_backtrace();
        db_push_error($marker.' '.db_error ($dbconn));

        if ($wactest) {
            echo ('<b>'.$marker.'</b> DB: '.db_error().' <b>(Q: '.htmlspecialchars(db_history()).')</b><br />');
        }
    }

    return ($result);
}

function db_result ($result, $offset = 0) {
    // NOTE: field names are no longer used in Wacintaki, and result
    // offset should always be 0!  This function should only be used
    // to retrieve a single, one-time value.

    global $dbconn, $wactest;

    $data = @mysql_result ($result, $offset);

    if ($data === FALSE) {
        $marker = db_backtrace();
        db_push_error(db_error());

        if ($wactest) {
            echo ('<b>'.$marker.'</b> DB: '.db_error().' <b>(Q: '.htmlspecialchars(db_history()).')</b><br />');
        } else {
            db_trigger();
        }
    }

    return ($data);
}

function db_fetch_array($result, $type = MYSQLI_ASSOC) {
    global $dbconn, $wactest;

    /*
        Notes:

        - Unlike the native mysql functions, this function always
        returns associative arrays by default.

        - Due to the shifting internal pointer in mysql_fetch_array(),
        we cannot test for "FALSE" here.  Do not mask errors with "@".
    */
    return (mysql_fetch_array ($result));
}

function db_fetch_row($result) {
    global $dbconn, $wactest;

    /*
        Note: due to the shifting internal pointer in mysql_fetch_array(),
        we cannot test for "FALSE" here.  Do not mask errors with "@".
    */
    return (mysql_fetch_row ($result));
}

function db_num_rows($result) {
    global $dbconn;

    return (mysql_num_rows ($result));
}

function db_affected_rows() {
    global $dbconn;

    // WARNING: Make sure $dbconn is global, even though it is not passed.
    // PHP does some magic here, and passing $dbconn explicitly causes "trouble".
    return (mysql_affected_rows());
}

function db_free_result($result) {
    global $dbconn;

    return (@mysql_free_result($result));
}

function db_error($offset = 0) {
    global $dbconn, $db_error;

    return (mysql_error());
}

//function db_num_error() {
//    global $db_error;
//    return (count ($db_error));
//}

function db_push_error($in) {
    global $db_error;

    if (!empty ($in)) {
        $db_error = $in;
    }

    return;
}

function db_history($offset = 0) {
    global $db_history;

    return ($db_history);
}

//function db_num_history() {
//    global $db_history;
//    return (count ($db_history));
//}

function db_push_history($in) {
    global $db_history;

    if (!empty ($in)) {
        $db_history = $in;
    }

    return;
}

function db_escape($in) {
    global $dbconn;

    if (is_array ($in)) {
        // Let godmode sort 'em out
        return '';
    //     return (mysqli_real_escape_string ($in, $dbconn));
    } else {
        if (function_exists ('mysql_real_escape_string')) {
            return (mysql_real_escape_string ($in, $dbconn));
        } else {
            // Old PHP (no charset support)
            return (mysql_escape_string ($in, $dbconn));
        }
    }
}

function db_set_charset($charset = 'utf8') {
    global $dbconn;

    // Requires PHP5 and MySQL 5.0.8
    $my_version = explode ('.', PHP_VERSION);

    $done = FALSE;
    if ($my_version[0] > 4) {
        if (function_exists('mysql_set_charset')) {
            $done = @mysqli_set_charset($charset);
            }
    }

    return ($done);
}

function db_get_charset() {
    global $dbconn;

    return( mysql_client_encoding($dbconn) );
}

function db_open() {
    global $dbhost, $dbuser, $dbpass, $db_error, $dbname;

    $GLOBALS['dbconn'] = mysql_connect ($dbhost, $dbuser, $dbpass);

    $db_type = 'MySQL';

    if (!$GLOBALS['dbconn']) {
        exit ('Could not connect to the SQL database (API: '.$db_type.')<br />DB: '.db_error());
    }

    $mySQLDB = db_select($GLOBALS['dbconn'], $dbname);
    if (!$mySQLDB) {
        db_close();
        exit ('Database name &ldquo;'.htmlspecialchars ($dbname).'&rdquo; is invalid (API: '.$db_type.')<br />DB: '.db_error());
    }

    // UTF-8 is not yet active!  Do NOT enable!
    // db_set_charset('utf8');
    $GLOBALS['dbcharset'] = db_get_charset();

    return ($GLOBALS['dbconn']);
}

function db_select($conn, $dbname) {
    return (@mysql_select_db ($dbname));
}

function db_close($unused = 0) {
    // Don't global $dbconn here.  PHP may throw an undeclared variable error.

    if (isset($GLOBALS['dbconn']) && !empty ($GLOBALS['dbconn'])) {
        return (@mysql_close ($GLOBALS['dbconn']));
    } else {
        return (@mysql_close());
     }

    $GLOBALS['dbconn'] = NULL;
}

?>

Nullig

Last edited by Nullig (03-27-2010 13:34:53)

Offline

#7 03-28-2010 07:12:49

Waccoon
Administrator

Re: Wacintaki 1.5.0 is now available

I have one more thing I'd like to try:  1.5.1 database layer

If this doesn't work, use the file you made, and I'll have to make some kind of manual override until I understand how PHP is being configured to do this.  I'm using the same method as Drupal to detect the database layer, so someone out there has to be having the same problem.

Offline

#8 03-28-2010 16:42:06

Nullig
Member

Re: Wacintaki 1.5.0 is now available

This new one gives the error:

Fatal error: Call to undefined function: mysqli_query() in /my/path/to/db_layer.php  on line 82

It seems like the $si variable always is true, regardless.

I even removed the test, just leaving $si = false, or %si = "" or $si = 0:

Code:

$si = FALSE;
// if (extension_loaded ('mysqli') && function_exists ('mysqli_connect') && defined ('MYSQLI_ASSOC')) {
//     $si = TRUE;
// }

and I still get the error.

PHP Version 4.4.7 with:
'./configure' '--prefix=/usr' '--with-apxs=/usr/sbin/apxs' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--with-exec-dir=/usr/bin' '--enable-force-cgi-redirect' '--disable-debug' '--enable-pic' '--disable-rpath' '--enable-inline-optimization' '--with-bz2' '--with-db4=/usr' '--with-curl' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-gd=shared' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-ncurses=shared' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png' '--with-pspell' '--with-xml' '--with-expat-dir=/usr' '--with-dom=shared,/usr' '--with-dom-xslt=/usr' '--with-dom-exslt=/usr' '--with-xmlrpc=shared' '--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU' '--enable-bcmath' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--with-pear=/usr/share/pear' '--with-imap=shared' '--with-imap-ssl' '--with-kerberos' '--with-ldap=shared' '--with-mysql=shared,/usr' '--with-pgsql=shared' '--with-snmp=shared,/usr' '--with-snmp=shared' '--enable-ucd-snmp-hack' '--with-unixODBC=shared,/usr' '--enable-memory-limit' '--enable-shmop' '--enable-calendar' '--enable-dbx' '--enable-dio' '--enable-mbstring=shared' '--enable-mbstr-enc-trans' '--enable-mbregex' '--with-mime-magic=/etc/httpd/conf/magic'

MySQL Client API version 4.1.20

Apache Version     1.3.39 with loaded modules:
mod_limitipconn, mod_casp2, mod_frontpage, mod_security, mod_jrun, mod_gzip, mod_php4, mod_ssl, mod_setenvif, mod_so, mod_unique_id, mod_log_forensic, mod_example, mod_usertrack, mod_headers, mod_expires, mod_cern_meta, mod_proxy, mod_digest, mod_auth_db, mod_auth_dbm, mod_auth_anon, mod_auth, mod_access, mod_rewrite, mod_alias, mod_userdir, mod_speling, mod_actions, mod_imap, mod_asis, mod_cgi, mod_dir, mod_autoindex, mod_include, mod_info, mod_status, mod_negotiation, mod_mime, mod_mime_magic, mod_log_referer, mod_log_agent, mod_log_config, mod_define, mod_env, mod_vhost_alias, mod_mmap_static, mod_bandwidth, http_core

Nullig

Last edited by Nullig (03-28-2010 16:54:21)

Offline

#9 03-28-2010 23:14:29

Waccoon
Administrator

Re: Wacintaki 1.5.0 is now available

I just read an article about PHP superglobals.  It appears that PHP4 handles them differently than PHP5, and for security reasons it's possible for hosts to change how superglobals work.

So, I'll check the code with an older version of PHP and see what happens.  Chances are I'll have to rewrite everything.

Thanks for your patience.

Offline

Board footer

Yep, still running PunBB
© Copyright 2002–2008 PunBB