projects
/
fa-stable.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Updated version for 2.3beta
[fa-stable.git]
/
admin
/
db
/
maintenance_db.inc
diff --git
a/admin/db/maintenance_db.inc
b/admin/db/maintenance_db.inc
index ceccb076fcb715ad2e6553b5bae020201ccfb7f9..958572c2b5ab0ffb12f5296f1430e8e88ec8f711 100644
(file)
--- a/
admin/db/maintenance_db.inc
+++ b/
admin/db/maintenance_db.inc
@@
-56,6
+56,12
@@
function array_natsort($aryData, $strIndex, $strSortBy, $strSortType=false)
return $aryResult;
}
return $aryResult;
}
+function update_admin_password($conn, $password)
+{
+ $sql = "UPDATE ".$conn['tbpref']."users SET password=".db_escape($password) . "
+ WHERE user_id='admin'";
+ db_query($sql, "could not update user password for 'admin'");
+}
function write_config_db($new = false)
{
function write_config_db($new = false)
{
@@
-98,7
+104,7
@@
function write_config_db($new = false)
$filename = $path_to_root . "/config_db.php";
// Check if the file exists and is writable first.
$filename = $path_to_root . "/config_db.php";
// Check if the file exists and is writable first.
- if (
!file_exists($filename) || (is_writable($path_to_root) && is_writable($filename)
))
+ if (
(!file_exists($filename) && is_writable($path_to_root)) || is_writable($filename
))
{
if (!$zp = fopen($filename, 'w'))
{
{
if (!$zp = fopen($filename, 'w'))
{
@@
-129,7
+135,9
@@
function write_extensions($extensions=null, $company = -1)
if (!isset($extensions)) {
$extensions = $installed_extensions;
}
if (!isset($extensions)) {
$extensions = $installed_extensions;
}
-
+ if (!isset($next_extension_id)) {
+ $next_extension_id = 1;
+ }
// $exts = array_natsort($extensions, 'name', 'name');
// $extensions = $exts;
// $exts = array_natsort($extensions, 'name', 'name');
// $extensions = $exts;
@@
-453,7
+461,7
@@
function db_unzip($mode, $path)
$all = implode("", file($path));
// convert path to name of ziped file
$all = implode("", file($path));
// convert path to name of ziped file
- $filename =
ereg_replace(".*
/", "", $path);
+ $filename =
preg_replace("/.*\/
/", "", $path);
$filename = substr($filename, 0, strlen($filename) - 4);
// compare filname in zip and filename from $_GET
$filename = substr($filename, 0, strlen($filename) - 4);
// compare filname in zip and filename from $_GET
@@
-549,7
+557,7
@@
function db_export($conn, $filename, $zip='no', $comment='', $tbpref = TB_PREF)
{
//if ($conn["tbpref"] == "" || strpos($row['Name'], $conn["tbpref"]) !== false) replaced
if (($conn["tbpref"] == "" && !preg_match('/[0-9]+_/', $row['Name'])) ||
{
//if ($conn["tbpref"] == "" || strpos($row['Name'], $conn["tbpref"]) !== false) replaced
if (($conn["tbpref"] == "" && !preg_match('/[0-9]+_/', $row['Name'])) ||
- ($conn["tbpref"] != "" && strpos($row['Name'], $conn["tbpref"])
!== false
))
+ ($conn["tbpref"] != "" && strpos($row['Name'], $conn["tbpref"])
=== 0
))
$all_tables[] = $row;
}
// get table structures
$all_tables[] = $row;
}
// get table structures
@@
-609,11
+617,11
@@
function db_export($conn, $filename, $zip='no', $comment='', $tbpref = TB_PREF)
// check if field types are NULL or NOT NULL
$res3 = db_query("SHOW COLUMNS FROM `" . $tablename . "`");
// check if field types are NULL or NOT NULL
$res3 = db_query("SHOW COLUMNS FROM `" . $tablename . "`");
- $field_
type
= array();
+ $field_
null
= array();
for ($j = 0; $j < db_num_rows($res3); $j++)
{
$row3 = db_fetch($res3);
for ($j = 0; $j < db_num_rows($res3); $j++)
{
$row3 = db_fetch($res3);
- $field_
type[] = $row3[2]
;
+ $field_
null[] = $row3[2]=='YES' && $row3[4]===null
;
}
$res2 = db_query("SELECT * FROM `" . $tablename . "`");
}
$res2 = db_query("SELECT * FROM `" . $tablename . "`");
@@
-624,7
+632,7
@@
function db_export($conn, $filename, $zip='no', $comment='', $tbpref = TB_PREF)
// run through each field
for ($k = 0; $k < $nf = db_num_fields($res2); $k++)
{
// run through each field
for ($k = 0; $k < $nf = db_num_fields($res2); $k++)
{
- $out .= db_escape(
@html_entity_decode($row2[$k], ENT_QUOTES, $_SESSION['language']->encoding)
);
+ $out .= db_escape(
$row2[$k], $field_null[$k]
);
if ($k < ($nf - 1))
$out .= ", ";
}
if ($k < ($nf - 1))
$out .= ", ";
}