let me get the exact error message that may help you more and l appreciate your patients
Here is the Code: to init.php
Code: › <?php
// Hack prevention.
$sensitiveList = array("gallery", "GALLERY_BASEDIR");
foreach ($sensitiveList as $sensitive) {
if (!empty($HTTP_GET_VARS[$sensitive]) ||
!empty($HTTP_POST_VARS[$sensitive]) ||
!empty($HTTP_COOKIE_VARS[$sensitive]) ||
!empty($HTTP_POST_FILES[$sensitive])) {
print _("Security violation") ."\n";
exit;
}
}
?>
<?php
error_reporting(E_ALL & ~E_NOTICE);
$register_globals = ini_get("register_globals");
if (empty($register_globals) ||
!strcasecmp($register_globals, "off") ||
!strcasecmp($register_globals, "false")) {
$gallery->register_globals = 0;
} else {
$gallery->register_globals = 1;
}
if (!$gallery->register_globals) {
$scrubList = array('HTTP_GET_VARS', 'HTTP_POST_VARS', 'HTTP_COOKIE_VARS', 'HTTP_POST_FILES');
foreach ($scrubList as $outer) {
foreach ($scrubList as $inner) {
unset(${$outer}[$inner]);
}
}
if (is_array($HTTP_GET_VARS)) {
extract($HTTP_GET_VARS);
}
if (is_array($HTTP_POST_VARS)) {
extract($HTTP_POST_VARS);
}
if (is_array($HTTP_COOKIE_VARS)) {
extract($HTTP_COOKIE_VARS);
}
if (is_array($HTTP_POST_FILES)) {
foreach($HTTP_POST_FILES as $key => $value) {
${$key."_name"} = $value["name"];
${$key."_size"} = $value["size"];
${$key."_type"} = $value["type"];
${$key} = $value["tmp_name"];
}
}
}
require($GALLERY_BASEDIR . "Version.php");
require($GALLERY_BASEDIR . "util.php");
/* Load bootstrap code */
if (getOS() == OS_WINDOWS) {
include($GALLERY_BASEDIR . "platform/fs_win32.php");
} else {
include($GALLERY_BASEDIR . "platform/fs_unix.php");
}
if (fs_file_exists($GALLERY_BASEDIR . "config.php")) {
global $gallery;
include($GALLERY_BASEDIR . "config.php");
}
if (isset($gallery->app->devMode) &&
$gallery->app->devMode == "yes") {
ini_set("display_errors", "1");
error_reporting(E_ALL);
} else {
error_reporting(E_ALL & ~E_NOTICE);
}
if(isset($gallery->app)) {
if (isset($HTTP_SERVER_VARS["HTTPS"] ) && stristr($HTTP_SERVER_VARS["HTTPS"], "on")) {
$gallery->app->photoAlbumURL =
eregi_replace("^http:", "https:", $gallery->app->photoAlbumURL);
$gallery->app->albumDirURL =
eregi_replace("^http:", "https:", $gallery->app->albumDirURL);
} else {
$gallery->app->photoAlbumURL =
eregi_replace("^https:", "http:", $gallery->app->photoAlbumURL);
$gallery->app->albumDirURL =
eregi_replace("^https:", "http:", $gallery->app->albumDirURL);
}
}
set_magic_quotes_runtime(0);
require($GALLERY_BASEDIR . "classes/Album.php");
require($GALLERY_BASEDIR . "classes/Image.php");
require($GALLERY_BASEDIR . "classes/AlbumItem.php");
require($GALLERY_BASEDIR . "classes/AlbumDB.php");
require($GALLERY_BASEDIR . "classes/User.php");
require($GALLERY_BASEDIR . "classes/EverybodyUser.php");
require($GALLERY_BASEDIR . "classes/NobodyUser.php");
require($GALLERY_BASEDIR . "classes/LoggedInUser.php");
require($GALLERY_BASEDIR . "classes/UserDB.php");
require($GALLERY_BASEDIR . "classes/Comment.php");
if (!isset($GALLERY_NO_SESSIONS)) {
require($GALLERY_BASEDIR . "session.php");
}
$gallerySanity = gallerySanityCheck();
initLanguage();
if ($gallerySanity != NULL) {
include ("${GALLERY_BASEDIR}errors/$gallerySanity");
exit;
}
if (isset($GALLERY_EMBEDDED_INSIDE) &&
!strcmp($GALLERY_EMBEDDED_INSIDE, "nuke")) {
include($GALLERY_BASEDIR . "classes/Database.php");
if ($GALLERY_EMBEDDED_INSIDE_TYPE == 'postnuke') {
/* We're in embedded in Postnuke */
if (!function_exists("pnUserGetVar")) {
/* pre 0.7.1 */
include($GALLERY_BASEDIR . "classes/postnuke/UserDB.php");
include($GALLERY_BASEDIR . "classes/postnuke/User.php");
$gallery->database{"db"} = $GLOBALS['dbconn'];
$gallery->database{"prefix"} = $GLOBALS['pnconfig']['prefix'] . "_";
} else {
/* 0.7.1 and beyond */
include($GALLERY_BASEDIR . "classes/postnuke0.7.1/UserDB.php");
include($GALLERY_BASEDIR . "classes/postnuke0.7.1/User.php");
}
$gallery->userDB = new PostNuke_UserDB;
if (isset($GLOBALS['user'])) {
$gallery->session->username = $GLOBALS['user'];
}
if (isset($GLOBALS['user']) && is_user($GLOBALS['user'])) {
$user_info = getusrinfo($GLOBALS['user']);
$gallery->session->username = $user_info["uname"];
$gallery->user =
$gallery->userDB->getUserByUsername($gallery->session->username);
}
} else {
/* we're in phpnuke */
include($GALLERY_BASEDIR . "classes/database/mysql/Database.php");
include($GALLERY_BASEDIR . "classes/nuke5/UserDB.php");
include($GALLERY_BASEDIR . "classes/nuke5/User.php");
$gallery->database{"nuke"} = new MySQL_Database(
$GLOBALS['dbhost'],
$GLOBALS['dbuname'],
$GLOBALS['dbpass'],
$GLOBALS['dbname']);
if (isset($GLOBALS['user_prefix'])) {
$gallery->database{"user_prefix"} = $GLOBALS['user_prefix'] . '_';
} else {
$gallery->database{"user_prefix"} = $GLOBALS['prefix'] . '_';
}
$gallery->database{"prefix"} = $GLOBALS['prefix'] . '_';
/* PHP-Nuke changed its "users" table field names in v.6.5 */
/* Select the appropriate field names */
if (isset($Version_Num) && $Version_Num >= 6.5) {
$gallery->database{'fields'} =
array ('name' => 'name',
'uname' => 'username',
'email' => 'user_email',
'uid' => 'user_id');
}
else {
$gallery->database{'fields'} =
array ('name' => 'name',
'uname' => 'uname',
'email' => 'email',
'uid' => 'uid');
}
/* Load our user database (and user object) */
$gallery->userDB = new Nuke5_UserDB;
if ($GLOBALS['user']) {
$gallery->session->username = $GLOBALS['user'];
}
if (isset($GLOBALS['admin']) && is_admin($GLOBALS['admin'])) {
include($GALLERY_BASEDIR . "classes/nuke5/AdminUser.php");
$gallery->user = new Nuke5_AdminUser($GLOBALS['admin']);
$gallery->session->username = $gallery->user->getUsername();
} else if (is_user($GLOBALS['user'])) {
$user_info = getusrinfo($GLOBALS['user']);
$gallery->session->username =
$user_info[$gallery->database{'fields'}{'uname'}];
$gallery->user =
$gallery->userDB->getUserByUsername($gallery->session->username);
}
}
} else {
include($GALLERY_BASEDIR . "classes/gallery/UserDB.php");
include($GALLERY_BASEDIR . "classes/gallery/User.php");
/* Load our user database (and user object) */
$gallery->userDB = new Gallery_UserDB;
/* Load their user object with their username as the key */
if (isset($gallery->session->username)) {
$gallery->user =
$gallery->userDB->getUserByUsername($gallery->session->username);
}
}
/* If there's no specific user, they are the special Everybody user */
if (!isset($gallery->user)) {
$gallery->user = $gallery->userDB->getEverybody();
$gallery->session->username = "";
}
if (!isset($gallery->session->offline)) {
$gallery->session->offline = FALSE;
}
if ($gallery->userDB->versionOutOfDate())
{
include($GALLERY_BASEDIR . "upgrade_users.php");
exit;
}
/* Load the correct album object */
if (!empty($gallery->session->albumName)) {
$gallery->album = new Album;
$ret = $gallery->album->load($gallery->session->albumName);
if (!$ret) {
$gallery->session->albumName = "";
} else {
if ($gallery->album->versionOutOfDate()) {
include($GALLERY_BASEDIR . "upgrade_album.php");
exit;
}
}
}
?>
And here I applied your Changes:
Code: › <?php
// Hack prevention.
$sensitiveList = array("gallery", "GALLERY_BASEDIR");
foreach ($sensitiveList as $sensitive) {
if (!empty($HTTP_GET_VARS[$sensitive]) ||
!empty($HTTP_POST_VARS[$sensitive]) ||
!empty($HTTP_COOKIE_VARS[$sensitive]) ||
!empty($HTTP_POST_FILES[$sensitive])) {
print _("Security violation") ."\n";
exit;
}
}
?>
<?php
error_reporting(E_ALL & ~E_NOTICE);
$register_globals = ini_get("register_globals");
if (empty($register_globals) ||
!strcasecmp($register_globals, "off") ||
!strcasecmp($register_globals, "false")) {
$gallery->register_globals = 0;
} else {
$gallery->register_globals = 1;
}
if (!$gallery->register_globals) {
$scrubList = array('HTTP_GET_VARS', 'HTTP_POST_VARS', 'HTTP_COOKIE_VARS', 'HTTP_POST_FILES');
foreach ($scrubList as $outer) {
foreach ($scrubList as $inner) {
unset(${$outer}[$inner]);
}
}
if (is_array($HTTP_GET_VARS)) {
extract($HTTP_GET_VARS);
}
if (is_array($HTTP_POST_VARS)) {
extract($HTTP_POST_VARS);
}
if (is_array($HTTP_COOKIE_VARS)) {
extract($HTTP_COOKIE_VARS);
}
if (is_array($HTTP_POST_FILES)) {
foreach($HTTP_POST_FILES as $key => $value) {
${$key."_name"} = $value["name"];
${$key."_size"} = $value["size"];
${$key."_type"} = $value["type"];
${$key} = $value["tmp_name"];
}
}
}
require($GALLERY_BASEDIR . "Version.php");
require($GALLERY_BASEDIR . "util.php");
/* Load bootstrap code */
if (getOS() == OS_WINDOWS) {
include($GALLERY_BASEDIR . "platform/fs_win32.php");
} else {
include($GALLERY_BASEDIR . "platform/fs_unix.php");
}
if (fs_file_exists($GALLERY_BASEDIR . "config.php")) {
global $gallery;
include($GALLERY_BASEDIR . "config.php");
}
if (isset($gallery->app->devMode) &&
$gallery->app->devMode == "yes") {
ini_set("display_errors", "1");
error_reporting(E_ALL);
} else {
error_reporting(E_ALL & ~E_NOTICE);
}
if(isset($gallery->app)) {
if (isset($HTTP_SERVER_VARS["HTTPS"] ) && stristr($HTTP_SERVER_VARS["HTTPS"], "on")) {
$gallery->app->photoAlbumURL =
eregi_replace("^http:", "https:", $gallery->app->photoAlbumURL);
$gallery->app->albumDirURL =
eregi_replace("^http:", "https:", $gallery->app->albumDirURL);
} else {
$gallery->app->photoAlbumURL =
eregi_replace("^https:", "http:", $gallery->app->photoAlbumURL);
$gallery->app->albumDirURL =
eregi_replace("^https:", "http:", $gallery->app->albumDirURL);
}
}
set_magic_quotes_runtime(0);
require($GALLERY_BASEDIR . "classes/Album.php");
require($GALLERY_BASEDIR . "classes/Image.php");
require($GALLERY_BASEDIR . "classes/AlbumItem.php");
require($GALLERY_BASEDIR . "classes/AlbumDB.php");
require($GALLERY_BASEDIR . "classes/User.php");
require($GALLERY_BASEDIR . "classes/EverybodyUser.php");
require($GALLERY_BASEDIR . "classes/NobodyUser.php");
require($GALLERY_BASEDIR . "classes/LoggedInUser.php");
require($GALLERY_BASEDIR . "classes/UserDB.php");
require($GALLERY_BASEDIR . "classes/Comment.php");
if (!isset($GALLERY_NO_SESSIONS)) {
require($GALLERY_BASEDIR . "session.php");
}
$gallerySanity = gallerySanityCheck();
initLanguage();
if ($gallerySanity != NULL) {
include ("${GALLERY_BASEDIR}errors/$gallerySanity");
exit;
}
if (isset($GALLERY_EMBEDDED_INSIDE) &&
!strcmp($GALLERY_EMBEDDED_INSIDE, "nuke")) {
include($GALLERY_BASEDIR . "classes/Database.php");
if ($GALLERY_EMBEDDED_INSIDE_TYPE == 'postnuke') {
/* We're in embedded in Postnuke */
if (!function_exists("pnUserGetVar")) {
/* pre 0.7.1 */
include($GALLERY_BASEDIR . "classes/postnuke/UserDB.php");
include($GALLERY_BASEDIR . "classes/postnuke/User.php");
$gallery->database{"db"} = $GLOBALS['dbconn'];
$gallery->database{"prefix"} = $GLOBALS['pnconfig']['prefix'] . "_";
} else {
/* 0.7.1 and beyond */
include($GALLERY_BASEDIR . "classes/postnuke0.7.1/UserDB.php");
include($GALLERY_BASEDIR . "classes/postnuke0.7.1/User.php");
}
$gallery->userDB = new PostNuke_UserDB;
if (isset($GLOBALS['user'])) {
$gallery->session->username = $GLOBALS['user'];
}
if (isset($GLOBALS['user']) && is_user($GLOBALS['user'])) {
$user_info = getusrinfo($GLOBALS['user']);
$gallery->session->username = $user_info["uname"];
$gallery->user =
$gallery->userDB->getUserByUsername($gallery->session->username);
}
} else {
/* we're in phpnuke */
include($GALLERY_BASEDIR . "classes/database/mysql/Database.php");
include($GALLERY_BASEDIR . "classes/nuke5/UserDB.php");
include($GALLERY_BASEDIR . "classes/nuke5/User.php");
$gallery->database{"nuke"} = new MySQL_Database(
$GLOBALS['dbhost'],
$GLOBALS['dbuname'],
$GLOBALS['dbpass'],
$GLOBALS['dbname']);
if (isset($GLOBALS['user_prefix'])) {
$gallery->database{"user_prefix"} = $GLOBALS['user_prefix'] . 'ourprefix_';
} else {
$gallery->database{"user_prefix"} = $GLOBALS['prefix'] . 'ourprefix_';
}
$gallery->database{"prefix"} = $GLOBALS['prefix'] . '_';
/* PHP-Nuke changed its "users" table field names in v.6.5 */
/* Select the appropriate field names */
if (isset($Version_Num) && $Version_Num >= 6.5) {
$gallery->database{'fields'} =
array ('name' => 'name',
'uname' => 'username',
'email' => 'user_email',
'uid' => 'user_id');
}
else {
$gallery->database{'fields'} =
array ('name' => 'name',
'uname' => 'uname',
'email' => 'email',
'uid' => 'uid');
}
/* Load our user database (and user object) */
$gallery->userDB = new Nuke5_UserDB;
if ($GLOBALS['user']) {
$gallery->session->username = $GLOBALS['user'];
}
if (isset($GLOBALS['admin']) && is_admin($GLOBALS['admin'])) {
include($GALLERY_BASEDIR . "classes/nuke5/AdminUser.php");
$gallery->user = new Nuke5_AdminUser($GLOBALS['admin']);
$gallery->session->username = $gallery->user->getUsername();
} else if (is_user($GLOBALS['user'])) {
$user_info = getusrinfo($GLOBALS['user']);
$gallery->session->username =
$user_info[$gallery->database{'fields'}{'uname'}];
$gallery->user =
$gallery->userDB->getUserByUsername($gallery->session->username);
}
}
} else {
include($GALLERY_BASEDIR . "classes/gallery/UserDB.php");
include($GALLERY_BASEDIR . "classes/gallery/User.php");
/* Load our user database (and user object) */
$gallery->userDB = new Gallery_UserDB;
/* Load their user object with their username as the key */
if (isset($gallery->session->username)) {
$gallery->user =
$gallery->userDB->getUserByUsername($gallery->session->username);
}
}
/* If there's no specific user, they are the special Everybody user */
if (!isset($gallery->user)) {
$gallery->user = $gallery->userDB->getEverybody();
$gallery->session->username = "";
}
if (!isset($gallery->session->offline)) {
$gallery->session->offline = FALSE;
}
if ($gallery->userDB->versionOutOfDate())
{
include($GALLERY_BASEDIR . "upgrade_users.php");
exit;
}
/* Load the correct album object */
if (!empty($gallery->session->albumName)) {
$gallery->album = new Album;
$ret = $gallery->album->load($gallery->session->albumName);
if (!$ret) {
$gallery->session->albumName = "";
} else {
if ($gallery->album->versionOutOfDate()) {
include($GALLERY_BASEDIR . "upgrade_album.php");
exit;
}
}
}
?>
Now the 'ourprefix_ is what we are using for out tables
And this is the error where still getting
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/virtual/site13/fst/var/www/html/modules/Gallery/classes/database/mysql/Database.php on line 37