! -> Note
$ -> Affected files
+04-Dec-2008 Janusz Dobrowolski
+# Check write permissions and create per company subdirectory structure.
+$ /update.html
+ /update_db.php
+# Fixed index.php files in new company dirs.
+$ /admin/create_coy.php
+ /admin/db/maintenance_db.inc
+
04-Dec-2008 Joe Hunt
# [0000095] Inbalance double entry on Documents
$ /gl/includes/db/gl_db_trans.inc
{
return false;
}
- $index = "<?php\nheader(\"Location: ../../index.php\");\n?>";
if ($new)
{
- $cdir = $comp_path.'/'.$id;
- @mkdir($cdir);
- save_to_file($cdir.'/'.'index.php', 0, $index);
-
- foreach($comp_subdirs as $dir)
- {
- @mkdir($cdir.'/'.$dir);
- save_to_file($cdir.'/'.$dir.'/'.'index.php', 0, $index);
- }
+ create_comp_dirs("$comp_path/$id", $comp_subdirs);
}
return true;
}
}
}
-
+function create_comp_dirs($comp_path, $comp_subdirs)
+{
+ $index = "<?php\nheader(\"Location: ../index.php\");\n?>";
+ $cdir = $comp_path;
+ @mkdir($cdir);
+ $f = @fopen("$cdir/index.php", "wb");
+ @fwrite($f, $index);
+ @fclose($f);
+
+ foreach($comp_subdirs as $dir)
+ {
+ @mkdir($cdir.'/'.$dir);
+ $f = @fopen("$cdir/$dir/index.php", "wb");
+ @fwrite($f, $index);
+ @fclose($f);
+ }
+}
?>
\ No newline at end of file
<li>Upload all the new files.
</li>
<li>Restore the files mentioned in #1. Be <strong>careful</strong> with
- <strong>config.db</strong>. Look into variances. There might be new variables in
+ <strong>config.php</strong>. Look into variances. There might be new variables in
the new version. It might be easier to <em>manually change your former values in
the new file</em>.
</li>
do this, before entering FrontAccounting!
Enter the database user and the password and choose the alter.sql
script. Do the same for the alter2.sql script. If you have
-already updated release 2.0 Beta, you can just run the alter2.sql script.<br />You must also manuelly ensure that you have write permission to the new folder /company/0.<br /></strong><strong>There are no database changes during a major and minor release. Like from 2.0 to 2.0.1 - 2.0.5 .</strong></li>
+already updated release 2.0 Beta, you can just run the alter2.sql script.<br />You must also manuelly ensure that you have write permission to the new folder /company .<br /></strong><strong>There are no database changes during a major and minor release. Like from 2.0 to 2.0.1 - 2.0.5 .</strong></li>
</ul>
<p> </p>
$image = $path_to_root."/themes/default/images/logo_frontaccounting.png";
$title = "Update All Company Databases";
+$comp_subdirs = array('images', 'pdf_files', 'backup','js_cache');
+
function get_js_png_fix()
{
$js = "<script type=\"text/javascript\">\n"
if (isset($_POST["submit"]))
{
- if (!isset($_FILES['uploadfile']['tmp_name']) || !is_uploaded_file($_FILES['uploadfile']['tmp_name']))
+ $perms_ok = is_writable($path_to_root.'/company') && is_writable($path_to_root.'/company/0');
+ $checkdirs = $comp_subdirs;
+ foreach ($checkdirs as $dir) {
+ $perms_ok &= is_writable($path_to_root.'/company/0/'.$dir);
+ }
+
+ if (!$perms_ok) {
+ display_error("'System 'company' directory or any of its subdirectories
+ is not writable.<br> Change webserver access permissions to those
+ directories.");
+ } elseif (!isset($_FILES['uploadfile']['tmp_name']) || !is_uploaded_file($_FILES['uploadfile']['tmp_name']))
{
display_error("You must select an SQL script for update");;
}
display_notification("Database has been updated for company: "
. $id . " " . $conn['name']);
}
+ $cdir = "$path_to_root/company/$id";
+ if (!file_exists($cdir))
+ {
+ create_comp_dirs($cdir, $comp_subdirs);
+ }
}
}
}
$_POST['passwd'] = "";
if (!isset($_POST['user']))
$_POST['user'] = "";
-
+
echo "<form enctype='multipart/form-data' method='post' action='".$_SERVER['PHP_SELF']."'>\n";
echo "<table align='center' width='50%' cellpadding=3 border=1 bordercolor='#cccccc' style='border-collapse: collapse'>\n";