From ariadne-cvs@muze.nl Mon Jul 1 14:55:01 2002 From: ariadne-cvs@muze.nl (gijs) Date: Mon, 01 Jul 2002 13:55:01 -0000 Subject: [Ariadne-cvs] cvs: ariadne /lib/modules mod_tar.phtml /lib/stores axstore.phtml Message-ID: This is a MIME encoded message --gijs1025531701 Content-Type: text/plain gijs Mon Jul 1 15:55:01 2002 EDT Added files: /ariadne/lib/modules mod_tar.phtml Modified files: /ariadne/lib/stores axstore.phtml Log: Moved tar/untar functionality into mod_tar. This module now also support the PEAR Archive/Tar module. --gijs1025531701 Content-Type: text/plain Content-Disposition: attachment; filename="gijs-20020701155501.txt" Index: ariadne/lib/stores/axstore.phtml diff -u ariadne/lib/stores/axstore.phtml:1.27 ariadne/lib/stores/axstore.phtml:1.28 --- ariadne/lib/stores/axstore.phtml:1.27 Thu Jun 6 17:04:20 2002 +++ ariadne/lib/stores/axstore.phtml Mon Jul 1 15:55:01 2002 @@ -25,6 +25,9 @@ *****************/ function axstore($path, $config) { + debug("axstore($path, $config)", "store"); + include_once($config["code"]."modules/mod_tar.phtml"); + $this->database=$config["database"]; $this->writeable=$config["writeable"]; @@ -32,20 +35,20 @@ $this->files=$config["temp"]; $this->code=$config["code"]; - $this->tar_error_handler=$config["tar_error_handler"]; - $this->tar_tar=$config["tar_tar"]; - $this->tar_untar=$config["tar_untar"]; - $this->tar_nofail=$config["tar_nofail"]; + $this->tar = new mod_tar($config["tar"]); // create tempdir (and do some windows compat magic) $this->tempdir=tempnam($this->temp, "axtemp"); @unlink($this->tempdir); + debug("creating tempdir (".$this->tempdir.")", "store"); if (@mkdir($this->tempdir, 0777)) { if (file_exists($this->database)) { - if ($this->_untar($this->database, " ", $this->tempdir)) { + debug("extracting database (".$this->database.")", "store"); + if ($this->tar->extract($this->database, " ", $this->tempdir)) { if (file_exists($this->tempdir."/objects.data")) { // now we have found our objects.data, lets make an index of it + debug("loading (".$this->tempdir."/objects.data)", "store"); $this->ofile=fopen($this->tempdir."/objects.data", "rb"); if ($this->ofile) { $currentoffset=ftell($this->ofile); @@ -86,6 +89,7 @@ $currentoffset=ftell($this->ofile); } + debug("loading (".$this->tempdir."/nodes.data", "store"); // read nodes data $fp_nodes=fopen($this->tempdir."/nodes.data", "rb"); if ($fp_nodes) { @@ -125,13 +129,13 @@ } if (!$this->error && file_exists($this->tempdir."/templates.tgz")) { - if (!$this->_untar($this->tempdir."/templates.tgz", "", $this->tempdir)) { + if (!$this->tar->extract($this->tempdir."/templates.tgz", "", $this->tempdir)) { $this->error="Could not untar templates archive"; } } if (!$this->error && file_exists($this->tempdir."/files.tgz")) { - if (!$this->_untar($this->tempdir."/files.tgz", "", $this->tempdir)) { + if (!$this->tar->extract($this->tempdir."/files.tgz", "", $this->tempdir)) { $this->error="Could not untar files archive"; } } @@ -140,6 +144,8 @@ /* create a temporary 'temp' directory */ @mkdir($this->files."temp/", 0755); } + } else { + $this->error="Could not extract database"; } } else if ($this->writeable) { @@ -152,6 +158,7 @@ $this->error="Could not create tempdir"; } + debug("axstore [end]", "store"); return $result; } @@ -650,95 +657,6 @@ return $result; } - function _fix_tar_paths($path) { - global $AR; - if ($AR->OS=="WIN32") { - $path=str_replace('\\', '/', $path); - if (eregi('^([a-z]):', $path, $regs)) { - $path="//".$regs[1].substr($path,2); - } - } - // escape spaces - $path=ereg_replace('([^\])[ ]', '\1\ ', $path); - return $path; - } - - function _untar($tarfile, $file, $dstdir) { - if ($this->tar_error_handler) { - $errfile=$this->tempdir."/tar.errors"; - $errfile=$this->_fix_tar_paths($errfile); - $handler=sprintf($this->tar_error_handler, $errfile); - } - $dstdir=$this->_fix_tar_paths($dstdir); - $tarfile=$this->_fix_tar_paths($tarfile); - - //$command=sprintf($this->tar_untar, $dstdir, $file, $tarfile, $handler ); - $arguments = Array( - "%destdir%" => $dstdir, - "%contents%" => $file, - "%archive%" => $tarfile, - "%errorhandler%" => $handler - ); - - $command = $this->tar_untar; - while (list($key, $val) = each($arguments)) { - $command = str_replace($key, $val, $command); - } - - system($command,$retVar); - if (!$this->tar_nofail && ($retVar!=0 && $retVar!=259)) { - $this->error.="Error:\n ($command):\n Can't untar $tarfile, untar failed in $dstdir with errorcode ($retVar)\n"; - if ($errfile && file_exists($errfile)) { - $this->error.=implode("",file($errfile)); - unlink($errfile); - $this->error.="\n"; - } - $result=0; - } else { - $result=1; // ok - } - return $result; - } - - function _tar($tarfile, $file, $dstdir) { - if ($this->tar_error_handler) { - $errfile=$this->tempdir."/tar.errors"; - $errfile=$this->_fix_tar_paths($errfile); - $handler=sprintf($this->tar_error_handler, $errfile); - } - - $dstdir=$this->_fix_tar_paths($dstdir); - $tarfile=$this->_fix_tar_paths($tarfile); - - //$command=sprintf($this->tar_tar, $dstdir, $file, $tarfile, $handler ); - $arguments = Array( - "%destdir%" => $dstdir, - "%contents%" => $file, - "%archive%" => $tarfile, - "%errorhandler%" => $handler - ); - - $command = $this->tar_tar; - - while (list($key, $val) = each($arguments)) { - $command = str_replace($key, $val, $command); - } - - system($command,$retVar); - if (!$this->tar_nofail && $retVar!=0) { - $this->error="Error: ($command):\n Can't tar to $tarfile, tar failed in $dstdir with errorcode ($retVar)\n"; - if ($errfile && file_exists($errfile)) { - $this->error.=implode("",file($errfile)); - unlink($errfile); - $this->error.="\n"; - } - $result=0; - } else { - $result=1; // ok - } - return $result; - } - function rm_dir($path) { debug("axstore::rm_dir($path)"); $path=($path[strlen($path)-1]=="/") ? $path : $path."/"; @@ -810,14 +728,14 @@ // filestores: if (file_exists($this->tempdir."/templates")) { - if (!$this->_tar($this->tempdir."/templates.tgz", "templates", $this->tempdir)) { + if (!$this->tar->create($this->tempdir."/templates.tgz", "templates", $this->tempdir)) { $this->error="Could not create templates archive"; } $this->rm_dir($this->tempdir."/templates"); } if (file_exists($this->tempdir."/files")) { - if (!$this->_tar($this->tempdir."/files.tgz", "files", $this->tempdir)) { + if (!$this->tar->create($this->tempdir."/files.tgz", "files", $this->tempdir)) { $this->error="Could not create files archive"; } $this->rm_dir($this->tempdir."/files"); @@ -827,7 +745,7 @@ $this->rm_dir($this->files."/temp"); } - if (!$this->_tar($this->database, " . ", $this->tempdir)) { + if (!$this->tar->create($this->database, " . ", $this->tempdir)) { $this->error="Could not save the new export file $this->database\n"; } else { $this->rm_dir($this->tempdir); Index: ariadne/lib/modules/mod_tar.phtml +++ ariadne/lib/modules/mod_tar.phtml config = $config; $this->tar_error_handler = $config["error_handler"]; $this->tar_tar = $config["tar"]; $this->tar_untar = $config["untar"]; $this->tar_nofail = $config["nofail"]; $this->mode = $config["mode"]; if ($this->mode == "pear" || !$this->mode) { $this->mode = "pear"; include_once("Archive/Tar.php"); PEAR::setErrorHandling(PEAR_ERROR_DIE); } debug("mod_tar:: mode='".$this->mode."'"); } function extract($archive, $file, $dstdir) { if ($this->mode == "system") { $result = $this->untar_system($archive, $file, $dstdir); } else { $result = $this->untar_pear($archive, $file, $dstdir); } return $result; } function create($archive, $file, $srcdir) { if ($this->mode == "system") { $result = $this->tar_system($archive, $file, $srcdir); } else { $result = $this->tar_pear($archive, $file, $srcdir); } return $result; } function untar_pear($archive, $file, $dstdir) { debug("untar_pear($archive, $file, $dstdir)"); $archive = new Archive_Tar($archive, true); $result = $archive->extract($dstdir); $archive->_Archive_Tar(); debug("untar_pear [return]"); return $result; } function tar_pear($archive, $filelist, $srcdir) { $archive = new Archive_Tar($archive, true); $filelist = trim($filelist); $filelist = explode(" ", $filelist); if ($srcdir && $srcdir[strlen($srcdir)-1] != '/') { $srcdir.='/'; } if (is_array($filelist)) { while (list($key, $file) = each($filelist)) { $filelist[$key] = $srcdir.$file; } } $result = $archive->addModify($filelist, "", $srcdir); $archive->_Archive_Tar(); return $result; } function untar_system($tarfile, $file, $dstdir) { debug("untar_system($tarfile, $file, $dstdir)"); if ($this->tar_error_handler) { $errfile=$dstdir."/tar.errors"; $errfile=$this->_fix_tar_paths($errfile); $handler=sprintf($this->tar_error_handler, $errfile); } $dstdir=$this->_fix_tar_paths($dstdir); $tarfile=$this->_fix_tar_paths($tarfile); //$command=sprintf($this->tar_untar, $dstdir, $file, $tarfile, $handler ); $arguments = Array( "%destdir%" => $dstdir, "%contents%" => $file, "%archive%" => $tarfile, "%errorhandler%" => $handler ); $command = $this->tar_untar; while (list($key, $val) = each($arguments)) { $command = str_replace($key, $val, $command); } debug("untar cmd ($command)"); system($command,$retVar); if (!$this->tar_nofail && ($retVar!=0 && $retVar!=259)) { $this->error.="Error:\n ($command):\n Can't untar $tarfile, untar failed in $dstdir with errorcode ($retVar)\n"; if ($errfile && file_exists($errfile)) { $this->error.=implode("",file($errfile)); @unlink($errfile); $this->error.="\n"; } $result=0; } else { $result=1; // ok } return $result; } function tar_system($tarfile, $file, $dstdir) { if ($this->tar_error_handler) { $errfile=$this->tempdir."/tar.errors"; $errfile=$this->_fix_tar_paths($errfile); $handler=sprintf($this->tar_error_handler, $errfile); } $dstdir=$this->_fix_tar_paths($dstdir); $tarfile=$this->_fix_tar_paths($tarfile); //$command=sprintf($this->tar_tar, $dstdir, $file, $tarfile, $handler ); $arguments = Array( "%destdir%" => $dstdir, "%contents%" => $file, "%archive%" => $tarfile, "%errorhandler%" => $handler ); $command = $this->tar_tar; while (list($key, $val) = each($arguments)) { $command = str_replace($key, $val, $command); } system($command,$retVar); if (!$this->tar_nofail && $retVar!=0) { $this->error="Error: ($command):\n Can't tar to $tarfile, tar failed in $dstdir with errorcode ($retVar)\n"; if ($errfile && file_exists($errfile)) { $this->error.=implode("",file($errfile)); unlink($errfile); $this->error.="\n"; } $result=0; } else { $result=1; // ok } return $result; } function _fix_tar_paths($path) { global $AR; if ($AR->OS=="WIN32") { $path=str_replace('\\', '/', $path); if (eregi('^([a-z]):', $path, $regs)) { $path="//".$regs[1].substr($path,2); } } // escape spaces $path=ereg_replace('([^\])[ ]', '\1\ ', $path); return $path; } } ?> --gijs1025531701-- From ariadne-cvs@muze.nl Mon Jul 1 15:03:49 2002 From: ariadne-cvs@muze.nl (gijs) Date: Mon, 01 Jul 2002 14:03:49 -0000 Subject: [Ariadne-cvs] cvs: ariadne /lib/configs axstore.phtml Message-ID: gijs Mon Jul 1 16:03:49 2002 EDT Modified files: /ariadne/lib/configs axstore.phtml Log: Adjusted axstore config Index: ariadne/lib/configs/axstore.phtml diff -u ariadne/lib/configs/axstore.phtml:1.4 ariadne/lib/configs/axstore.phtml:1.5 --- ariadne/lib/configs/axstore.phtml:1.4 Wed Apr 24 13:11:34 2002 +++ ariadne/lib/configs/axstore.phtml Mon Jul 1 16:03:49 2002 @@ -30,27 +30,30 @@ /* Tar configuration */ /*************************************************************************/ - if ($AR->OS=='WIN32') { - $tar_path=str_replace('\\', '/', $AR->dir->install); - if (eregi('^([a-z]):', $tar_path, $regs)) { - $tar_path="//".$regs[1].substr($tar_path,2); - } - $tar_path=ereg_replace('([^\])[ ]', '\1\ ', $tar_path); - - $compress_cmd = '--use-compress-program='.($tar_path).'/bin/gzip.exe'; - $tar_cmd = $AR->dir->install.'\bin\tar.exe '.$compress_cmd; - $ax_config['tar_error_handler'] = ''; - } else { - $tar_cmd = 'tar -z '; - $ax_config['tar_error_handler'] = ' 2> %s '; - } + $ax_config["tar"]["mode"] = "system"; - $ax_config["tar_tar"] = $tar_cmd." -c -C %destdir% %contents% -f %archive% %errorhandler%"; - $ax_config["tar_untar"] = $tar_cmd." -x -C %destdir% %contents% -f %archive% %errorhandler%"; + if ($ax_config["tar"]["mode"] == "system") { + if ($AR->OS=='WIN32') { + $tar_path=str_replace('\\', '/', $AR->dir->install); + if (eregi('^([a-z]):', $tar_path, $regs)) { + $tar_path="//".$regs[1].substr($tar_path,2); + } + $tar_path=ereg_replace('([^\])[ ]', '\1\ ', $tar_path); + + $compress_cmd = '--use-compress-program='.($tar_path).'/bin/gzip.exe'; + $tar_cmd = $AR->dir->install.'\bin\tar.exe '.$compress_cmd; + $ax_config["tar"]["error_handler"] = ''; + } else { + $tar_cmd = 'tar -z '; + $ax_config["tar"]["error_handler"] = ' 2> %s '; + } - // set this to true if you are really sure that tar throws errors which - // do not occur. + $ax_config["tar"]["tar"] = $tar_cmd." -c -C %destdir% %contents% -f %archive% %errorhandler%"; + $ax_config["tar"]["untar"] = $tar_cmd." -x -C %destdir% %contents% -f %archive% %errorhandler%"; - $ax_config['tar_nofail'] = false; + // set this to true if you are really sure that tar throws errors which + // do not occur. + $ax_config["tar"]["nofail"] = false; + } ?> From ariadne-cvs@muze.nl Tue Jul 2 14:26:11 2002 From: ariadne-cvs@muze.nl (gijs) Date: Tue, 02 Jul 2002 13:26:11 -0000 Subject: [Ariadne-cvs] cvs: ariadne /lib/templates/puser system.save.grants.phtml Message-ID: gijs Tue Jul 2 15:26:11 2002 EDT Modified files: /ariadne/lib/templates/puser system.save.grants.phtml Log: Fixed saving of grants on user/group objects. Index: ariadne/lib/templates/puser/system.save.grants.phtml diff -u ariadne/lib/templates/puser/system.save.grants.phtml:1.17 ariadne/lib/templates/puser/system.save.grants.phtml:1.18 --- ariadne/lib/templates/puser/system.save.grants.phtml:1.17 Tue Jun 11 15:45:00 2002 +++ ariadne/lib/templates/puser/system.save.grants.phtml Tue Jul 2 15:26:11 2002 @@ -92,7 +92,7 @@ "path" => $this->path, "grant" => $grant, "modifier" => $modifier))); - if ($result!="ok") { + if ($result!=$ARnls["ok"]) { $this->error=sprintf($ARnls["err:notremovegrant"],$id,$path); // FROP $this->error="Couldn't remove grant in $id ($path)"; } @@ -167,7 +167,7 @@ "path" => $this->path, "grant" => $delgrant, "modifier" => $modifier))); - if ($result!="ok") { + if ($result!=$ARnls["ok"]) { $this->error=sprintf($ARnls["err:notsavegrant"],$path); // FROP $this->error="Couldn't save grant in $path"; } @@ -211,7 +211,7 @@ "grant" => $newgrant, "modifier" => $modifier, "granttype" => $granttype))); - if ($result!="ok") { + if ($result!=$ARnls["ok"]) { $this->error=sprintf($ARnls["err:notsavegrant"],$path); // FROP $this->error="Couldn't save grant in $path"; } From ariadne-cvs@muze.nl Wed Jul 3 23:05:07 2002 From: ariadne-cvs@muze.nl (gijs) Date: Wed, 03 Jul 2002 22:05:07 -0000 Subject: [Ariadne-cvs] cvs: ariadne /lib/includes loader.web.php Message-ID: gijs Thu Jul 4 00:05:07 2002 EDT Modified files: /ariadne/lib/includes loader.web.php Log: Sessions without ARLogin will now stay alive after a login. Index: ariadne/lib/includes/loader.web.php diff -u ariadne/lib/includes/loader.web.php:1.29 ariadne/lib/includes/loader.web.php:1.30 --- ariadne/lib/includes/loader.web.php:1.29 Tue Jun 18 20:07:22 2002 +++ ariadne/lib/includes/loader.web.php Thu Jul 4 00:05:07 2002 @@ -187,7 +187,20 @@ $ARCookie = stripslashes($HTTP_COOKIE_VARS["ARCookie"]); debug("ldSetCredentials($login, [password])","object"); - if (!$ARCurrent->session || (!$ARCurrent->session->get("ARSessionActivated",1)) || ($ARCurrent->session->get("ARLogin")!=$login)) { + if ($ARCurrent->session && + (!$ARCurrent->session->get("ARSessionActivated",1) || + !$ARCurrent->session->get("ARLogin"))) { + + /* use the same sessionid if the user didn't login before */ + ldStartSession($ARCurrent->session->id); + $ARCurrent->session->put("ARLogin",$login); + $ARCurrent->session->put("ARPassword",$password,1); + $ARCurrent->session->put("ARSessionActivated",false,1); + + } else + if (!$ARCurrent->session || + (!$ARCurrent->session->get("ARSessionActivated",1)) || + ($ARCurrent->session->get("ARLogin")!=$login)) { // start a new session when there is no session yet, or // when a user uses a new login. (su) ldStartSession(); @@ -198,7 +211,6 @@ ldCheckCredentials($login, $password) && $ARCurrent->session->get("ARLogin") === $login && $ARCurrent->session->get("ARPassword",1) === $password ) { - /* cookie and login matches session */ $ARCurrent->session->put("ARSessionTimedout", false, 1); } From ariadne-cvs@muze.nl Fri Jul 5 20:57:35 2002 From: ariadne-cvs@muze.nl (gijs) Date: Fri, 05 Jul 2002 19:57:35 -0000 Subject: [Ariadne-cvs] cvs: ariadne /lib/templates/pobject classic.manage.html Message-ID: gijs Fri Jul 5 21:57:35 2002 EDT Modified files: /ariadne/lib/templates/pobject classic.manage.html Log: include widgets/menu/functions.js Index: ariadne/lib/templates/pobject/classic.manage.html diff -u ariadne/lib/templates/pobject/classic.manage.html:1.5 ariadne/lib/templates/pobject/classic.manage.html:1.6 --- ariadne/lib/templates/pobject/classic.manage.html:1.5 Thu Dec 13 17:07:08 2001 +++ ariadne/lib/templates/pobject/classic.manage.html Fri Jul 5 21:57:34 2002 @@ -6,6 +6,7 @@ <?php echo $ARnls["manage"]." ".$this->path; ?> + + + - + -