');
-// }
-
return array_key_exists($name, self::$_instance) ? self::$_instance[$name] : false;
}
+ /**
+ *
+ * @param string $name
+ * @return PDO
+ */
+ public static function getPDOConnection($name = null)
+ {
+ if (!isset(self::$_PDO_instance[$name]))
+ {
+ $hostname = $port = $user = $password = $dbname = false;
+
+ $connection_params = array();
+
+ if (trim($name) !== '')
+ {
+ $connection_params = phrasea::sbas_params();
+ }
+ else
+ {
+ require (dirname(__FILE__) . '/../../config/connexion.inc');
+ $name = 'app_box';
+ }
+
+ if (isset($connection_params[$name]))
+ {
+ $hostname = $connection_params[$name]['host'];
+ $port = $connection_params[$name]['port'];
+ $user = $connection_params[$name]['user'];
+ $password = $connection_params[$name]['pwd'];
+ $dbname = $connection_params[$name]['dbname'];
+ }
+
+ $dsn = 'mysql:dbname=' . $dbname . ';host=' . $hostname.';port='.$port.';';
+
+ try
+ {
+ self::$_PDO_instance[$name] = new PDO($dsn, $user, $password);
+ self::$_PDO_instance[$name]->query("SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'");
+ }
+ catch (Exception $e)
+ {
+ throw new Exception('Connection not avalaible');
+ }
+ }
+ if (array_key_exists($name, self::$_PDO_instance))
+ return self::$_PDO_instance[$name];
+ throw new Exception('Connection not avalaible');
+ }
+
function __construct($name)
{
diff --git a/lib/classes/databox.class.php b/lib/classes/databox.class.php
index 312c432e25..70cfd79678 100644
--- a/lib/classes/databox.class.php
+++ b/lib/classes/databox.class.php
@@ -1,664 +1,684 @@
$host,
- 'port'=>$port,
- 'user'=>$user,
- 'password'=>$password
- );
-
- if($this->init_data_conn($newServer) === false)
- return false;
-
- if($this->load_schema('data_box')=== false)
- return false;
-
- if($id !== false)
- $this->load((int)$id);
-
- $this->type = 'data_box';
+ var $structure = false;
+ private static $_xpath_thesaurus = array();
+ private static $_dom_thesaurus = array();
+ private static $_thesaurus = array();
+ private static $_xpath_structure = array();
+ private static $_dom_structure = array();
+ private static $_sxml_structure = array();
+ private static $_sxml_thesaurus = array();
- return true;
- }
-
- function load($id)
- {
-
- $conn = connection::getInstance();
- $sql = 'SELECT dbname FROM sbas WHERE sbas_id="'.$id.'"';
- if($rs = $conn->query($sql))
- {
- if($row = $conn->fetch_assoc($rs))
- {
- $this->id = $id;
- if(mysql_select_db($row['dbname'],$this->conn))
- $this->dbname = $row['dbname'];
- }
- $conn->free_result($rs);
- }
-// $sql = 'SELECT value FROM pref WHERE prop="mail_request"';
-// if($rs = mysql_query($sql,$this->conn))
-// {
-// while($row = mysql_fetch_assoc($rs))
-// {
-// $this->request_mails[] = $row['value'];
-// }
-// mysql_free_result($rs);
-// }
-
- return false;
- }
-
- function __destruct()
- {
-
- return true;
- }
-
- public function get_mountable_colls()
- {
- $conn = connection::getInstance();
- $colls = array();
-
- $sql = 'SELECT server_coll_id FROM bas WHERE sbas_id="'.$conn->escape_string($this->id).'"';
- if($rs = $conn->query($sql))
- {
- while($row = $conn->fetch_assoc($rs))
- $colls[] = $row['server_coll_id'];
- $conn->free_result($rs);
- }
-
- $connbas = connection::getInstance($this->id);
-
- $mountable_colls = array();
-
- $sql = 'SELECT coll_id, asciiname FROM coll WHERE coll_id NOT IN ('.implode(',', $colls).')';
-
- if($rs = $connbas->query($sql))
- {
- while($row = $connbas->fetch_assoc($rs))
- $mountable_colls[$row['coll_id']] = $row['asciiname'];
- $connbas->free_result($rs);
- }
-
- return $mountable_colls;
- }
-
- public function list_colls()
- {
- $lb = phrasea::bases();
-
- $colls = array();
-
- foreach($lb['bases'] as $base)
- {
- if($base['sbas_id'] != $this->id)
- continue;
- foreach($base['collections'] as $coll)
- {
- $colls[$coll['base_id']] = $coll['name'];
- }
- }
- return $colls;
- }
-
- public function save($usr_id)
- {
- $conn = connection::getInstance();
- if($this->id === false)
- {
- if(trim($this->dbname) == '')
- throw new Exception('invalid dbname');
- if(trim($this->user) == '')
- throw new Exception('invalid user');
- if(trim($this->host) == '')
- throw new Exception('invalid host');
-
- $ord = 0;
- $sql = '(SELECT MAX(ord) as ord FROM sbas)';
- if($rs = $conn->query($sql))
- {
- if($row = mysql_fetch_assoc($rs))
- $ord = $row['ord']+1;
- }
-
- $sql = 'INSERT INTO sbas (sbas_id, ord, host, port, dbname, sqlengine, user, pwd) VALUES (null, "'.$ord.'", "'.$conn->escape_string($this->host).'", "'.$conn->escape_string($this->port).'", "'.$conn->escape_string($this->dbname).'", "MYSQL", "'.$conn->escape_string($this->user).'", "'.mysql_real_escape_string($this->passwd).'")';
-
- if($conn->query($sql))
- {
- $this->id = $conn->insert_id();
-
- $sql = 'INSERT INTO sbasusr (sbasusr_id, sbas_id, usr_id, bas_manage, bas_modify_struct, bas_modif_th, bas_chupub) VALUES (null, "'.$this->id.'", "'.$usr_id.'", "0", "0", "0", "0")';
- $conn->query($sql);
- }
- else
- throw new Exception('unable to save databox in sbasusr : '.$conn->last_error());
- }
-
- return $this->id;
- }
-
- function create($dbname)
- {
- $this->createDb($dbname);
- $cache_appbox = cache_appbox::getInstance();
- $cache_appbox->delete('list_bases');
- cache_databox::update($this->id,'structure');
- }
-
- function mount($dbname, $usr_id)
- {
- $conn = connection::getInstance();
- if(mysql_select_db($dbname,$this->conn))
- {
- $this->dbname = $dbname;
- if($this->save($usr_id) !== false)
- {
- $cache_appbox = cache_appbox::getInstance();
-
-
- $sql = "SELECT * FROM coll";
- if($rs = mysql_query($sql, $this->conn))
- {
- $base_id = $this->getAppboxId('BAS', mysql_num_rows($rs));
-
-
- while($row = mysql_fetch_assoc($rs))
- {
- if(!empty($row['logo']) && ($fp = fopen(GV_RootPath.'config/minilogos/'.$base_id, 'w')) !== false)
- {
- fwrite($fp, $row["logo"]);
- fclose($fp);
- }
-
- $sql = "INSERT INTO bas
+ function __construct($id=false, $host=false, $port=false, $user=false, $password=false)
+ {
+ $newServer = false;
+ if ($host !== false && $port !== false && $user !== false && $password !== false)
+ $newServer = array(
+ 'hostname' => $host,
+ 'port' => $port,
+ 'user' => $user,
+ 'password' => $password
+ );
+ elseif ($id !== false)
+ {
+ try
+ {
+ $conn = connection::getPDOConnection();
+ $sql = 'SELECT host, port, user, pwd FROM sbas WHERE sbas_id= :sbas_id';
+ $stmt = $conn->prepare($sql);
+ $stmt->execute(array(':sbas_id' => $id));
+ $row = $stmt->fetch(PDO::FETCH_ASSOC);
+ $newServer = array(
+ 'hostname' => $row['host'],
+ 'port' => $row['port'],
+ 'user' => $row['user'],
+ 'password' => $row['pwd']
+ );
+ }
+ catch (Exception $e)
+ {
+
+ }
+ }
+
+ if ($this->init_data_conn($newServer) === false)
+ return false;
+
+ if ($this->load_schema('data_box') === false)
+ return false;
+
+ if ($id !== false)
+ $this->load((int) $id);
+
+ $this->type = 'data_box';
+
+ return true;
+ }
+
+ function load($id)
+ {
+
+ $conn = connection::getInstance();
+ $sql = 'SELECT dbname FROM sbas WHERE sbas_id="' . $id . '"';
+ if ($rs = $conn->query($sql))
+ {
+ if ($row = $conn->fetch_assoc($rs))
+ {
+ $this->id = $id;
+ if (mysql_select_db($row['dbname'], $this->conn))
+ $this->dbname = $row['dbname'];
+ }
+ $conn->free_result($rs);
+ }
+
+ return false;
+ }
+
+ function __destruct()
+ {
+
+ return true;
+ }
+
+ public function get_mountable_colls()
+ {
+ $conn = connection::getInstance();
+ $colls = array();
+
+ $sql = 'SELECT server_coll_id FROM bas WHERE sbas_id="' . $conn->escape_string($this->id) . '"';
+ if ($rs = $conn->query($sql))
+ {
+ while ($row = $conn->fetch_assoc($rs))
+ $colls[] = $row['server_coll_id'];
+ $conn->free_result($rs);
+ }
+
+ $connbas = connection::getInstance($this->id);
+
+ $mountable_colls = array();
+
+ $sql = 'SELECT coll_id, asciiname FROM coll WHERE coll_id NOT IN (' . implode(',', $colls) . ')';
+
+ if ($rs = $connbas->query($sql))
+ {
+ while ($row = $connbas->fetch_assoc($rs))
+ $mountable_colls[$row['coll_id']] = $row['asciiname'];
+ $connbas->free_result($rs);
+ }
+
+ return $mountable_colls;
+ }
+
+ public function list_colls()
+ {
+ $lb = phrasea::bases();
+
+ $colls = array();
+
+ foreach ($lb['bases'] as $base)
+ {
+ if ($base['sbas_id'] != $this->id)
+ continue;
+ foreach ($base['collections'] as $coll)
+ {
+ $colls[$coll['base_id']] = $coll['name'];
+ }
+ }
+ return $colls;
+ }
+
+ public function save($usr_id)
+ {
+ $conn = connection::getInstance();
+ if ($this->id === false)
+ {
+ if (trim($this->dbname) == '')
+ throw new Exception('invalid dbname');
+ if (trim($this->user) == '')
+ throw new Exception('invalid user');
+ if (trim($this->host) == '')
+ throw new Exception('invalid host');
+
+ $ord = 0;
+ $sql = '(SELECT MAX(ord) as ord FROM sbas)';
+ if ($rs = $conn->query($sql))
+ {
+ if ($row = mysql_fetch_assoc($rs))
+ $ord = $row['ord'] + 1;
+ }
+
+ $sql = 'INSERT INTO sbas (sbas_id, ord, host, port, dbname, sqlengine, user, pwd) VALUES (null, "' . $ord . '", "' . $conn->escape_string($this->host) . '", "' . $conn->escape_string($this->port) . '", "' . $conn->escape_string($this->dbname) . '", "MYSQL", "' . $conn->escape_string($this->user) . '", "' . mysql_real_escape_string($this->passwd) . '")';
+
+ if ($conn->query($sql))
+ {
+ $this->id = $conn->insert_id();
+
+ $sql = 'INSERT INTO sbasusr (sbasusr_id, sbas_id, usr_id, bas_manage, bas_modify_struct, bas_modif_th, bas_chupub) VALUES (null, "' . $this->id . '", "' . $usr_id . '", "0", "0", "0", "0")';
+ $conn->query($sql);
+ }
+ else
+ throw new Exception('unable to save databox in sbasusr : ' . $conn->last_error());
+ }
+
+ return $this->id;
+ }
+
+ function create($dbname)
+ {
+ $this->createDb($dbname);
+ $cache_appbox = cache_appbox::getInstance();
+ $cache_appbox->delete('list_bases');
+ cache_databox::update($this->id, 'structure');
+ }
+
+ function mount($dbname, $usr_id)
+ {
+ $conn = connection::getInstance();
+ if (mysql_select_db($dbname, $this->conn))
+ {
+ $this->dbname = $dbname;
+ if ($this->save($usr_id) !== false)
+ {
+ $cache_appbox = cache_appbox::getInstance();
+
+
+ $sql = "SELECT * FROM coll";
+ if ($rs = mysql_query($sql, $this->conn))
+ {
+ $base_id = $this->getAppboxId('BAS', mysql_num_rows($rs));
+
+
+ while ($row = mysql_fetch_assoc($rs))
+ {
+ if (!empty($row['logo']) && ($fp = fopen(GV_RootPath . 'config/minilogos/' . $base_id, 'w')) !== false)
+ {
+ fwrite($fp, $row["logo"]);
+ fclose($fp);
+ }
+
+ $sql = "INSERT INTO bas
(base_id, active, server_coll_id, sbas_id) VALUES
- ('".$conn->escape_string($base_id)."','1',
- '".$conn->escape_string($row['coll_id'])."','".$conn->escape_string($this->id)."')";
- if($conn->query($sql))
- {
-
- $sql = "INSERT INTO basusr
+ ('" . $conn->escape_string($base_id) . "','1',
+ '" . $conn->escape_string($row['coll_id']) . "','" . $conn->escape_string($this->id) . "')";
+ if ($conn->query($sql))
+ {
+
+ $sql = "INSERT INTO basusr
(base_id, usr_id, canpreview, canpush, canhd, cancmd, canputinalbum, candwnldhd, candwnldpreview, canadmin, actif, canreport, canaddrecord, canmodifrecord, candeleterecord, chgstatus, imgtools, manage, modify_struct, mask_and, mask_xor, basusr_infousr, creationdate ) VALUES
- ('".$base_id."', '".$usr_id."', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '0', '0', '', NOW())";
+ ('" . $base_id . "', '" . $usr_id . "', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '0', '0', '', NOW())";
- $conn->query($sql);
- }
-
- $base_id++;
- }
- $cache_appbox->delete('list_bases');
- cache_databox::update($this->id,'structure');
- }
- return $this->id;
- }
- }
- return false;
- }
-
- public function saveStructure()
- {
-
- }
-
- private function getAppboxId($typeId, $askfor_n=1)
- {
- $x = null;
-
- $conn = connection::getInstance();
-
- $sql = 'LOCK TABLE uids WRITE';
- if($conn->query($sql))
- {
- $sql = "UPDATE uids SET uid=uid+$askfor_n WHERE name='$typeId'" ;
- if($conn->query($sql))
- {
- $sql = "SELECT uid FROM uids WHERE name='$typeId'";
- if($result = $conn->query($sql))
- {
- if($row = mysql_fetch_assoc($result))
- $x = ($row["uid"]-$askfor_n)+1;
- mysql_free_result($result);
- }
- }
- $sql = 'UNLOCK TABLES';
- $conn->query($sql);
- }
- return $x;
- }
+ $conn->query($sql);
+ }
- private function init_data_conn($new_db=false)
- {
- // just in case
- if(is_resource($this->conn))
- {
- mysql_close($this->conn);
- $this->conn = false;
- }
-
- // connect to appbox
- require dirname( __FILE__ ) . '/../../config/connexion.inc';
-
- $conn = connection::getInstance();
-
- if($conn)
- {
-
- if(!$new_db)
- {
- // same as appbox
- $this->host = $hostname;
- $this->port = $port;
- $this->user = $user;
- $this->passwd = $password;
- }
- else
- {
- $this->host = $new_db['hostname'];
- $this->port = $new_db['port'];
- $this->user = $new_db['user'];
- $this->passwd = $new_db['password'];
- }
-
- $this->conn = mysql_connect($this->host.":".$this->port, $this->user, $this->passwd, true );
-
- mysql_set_charset('utf8',$this->conn);
- mysql_query("SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'", $this->conn);
-
- if($this->conn !== false)
- return true;
- }
- return false;
- }
-
- public function setNewStructure($data_template,$path_web,$path_doc,$baseurl)
- {
- if(is_file($data_template))
- {
- $contents = file_get_contents($data_template);
-
- $contents = str_replace(
- array("{{dataurl}}" , "{{basename}}" , "{{datapathweb}}" , "{{datapathnoweb}}"),
- array($baseurl , $this->dbname, $path_web, $path_doc ),
- $contents
- );
-
- $this->structure = $contents;
-
- $sql = 'UPDATE pref SET value="'.mysql_real_escape_string($this->structure,$this->conn).'", updated_on=NOW() WHERE prop="structure"';
- if(mysql_query($sql,$this->conn))
- return true;
- }
-
- return false;
- }
-
- public function registerAdmin($usr_id,$bool)
- {
- $conn = connection::getInstance();
- $sql = 'UPDATE sbasusr SET bas_manage="'.($bool === true ? '1' : '0').'" WHERE usr_id = "'.$usr_id.'" AND sbas_id="'.$this->id.'"';
- if($conn->query($sql))
- return true;
- return false;
- }
-
- public function registerAdminStruct($usr_id,$bool)
- {
- $conn = connection::getInstance();
- $sql = 'UPDATE sbasusr SET bas_modify_struct="'.($bool === true ? '1' : '0').'" WHERE usr_id = "'.$usr_id.'" AND sbas_id="'.$this->id.'"';
- if($conn->query($sql))
- return true;
- return false;
- }
-
- public function registerAdminThesaurus($usr_id,$bool)
- {
- $conn = connection::getInstance();
- $sql = 'UPDATE sbasusr SET bas_modif_th="'.($bool === true ? '1' : '0').'" WHERE usr_id = "'.$usr_id.'" AND sbas_id="'.$this->id.'"';
- if($conn->query($sql))
- return true;
- return false;
- }
-
- public function registerPublication($usr_id,$bool)
- {
- $conn = connection::getInstance();
- $sql = 'UPDATE sbasusr SET bas_chupub="'.($bool === true ? '1' : '0').'" WHERE usr_id = "'.$usr_id.'" AND sbas_id="'.$this->id.'"';
- if($conn->query($sql))
- return true;
- return false;
- }
+ $base_id++;
+ }
+ $cache_appbox->delete('list_bases');
+ cache_databox::update($this->id, 'structure');
+ }
+ return $this->id;
+ }
+ }
+ return false;
+ }
-
- public static function printStatus($name)
- {
-
- $cache_data = cache_appbox::getInstance();
-
- if(($tmp = $cache_data->get('status'.$name)) !== false)
- return $tmp;
-
- $filename = GV_RootPath.'config/status/'.$name;
-
- $out = '';
-
- if(is_file($filename))
- {
- $out = file_get_contents($filename);
- }
-
- $cache_data->set('status'.$name,$out);
-
- return $out;
- }
+ public function saveStructure()
+ {
+
+ }
- public static function getPrintLogo($sbas_id)
- {
-
- $cache_data = cache_appbox::getInstance();
-
- $out = '';
- if(is_file( ($filename = GV_RootPath.'config/minilogos/logopdf_'.$sbas_id.'.jpg') ))
- $out = file_get_contents($filename);
-
- return $out;
- }
+ private function getAppboxId($typeId, $askfor_n=1)
+ {
+ $x = null;
- public static function getColls($sbas_id=false)
- {
- $tbas = array();
- $conn = connection::getInstance();
-
- if($sbas_id !== false)
- $sql = "SELECT * FROM sbas s, bas b WHERE s.sbas_id='".$conn->escape_string($sbas_id)."' AND s.sbas_id = b.sbas_id AND b.active = '1' ORDER BY s.ord ASC, b.ord ASC";
- else
- $sql = "SELECT * FROM sbas s, bas b WHERE s.sbas_id = b.sbas_id AND b.active = '1' ORDER BY s.ord ASC, b.ord ASC";
-
- if($rs = $conn->query($sql))
- {
- while($row = $conn->fetch_assoc($rs))
- {
- if(!isset($tbas[$row["sbas_id"]]))
- {
- $tbas[$row["sbas_id"]] = array('viewname'=>(trim($row['viewname']) != '' ?$row['viewname'] : $row['dbname']), 'colls'=>array());
-
- $connbas = connection::getInstance($row['sbas_id']);
- if($connbas)
- {
- $sql = "SELECT coll_id, asciiname FROM coll";
- if($rsbas = $connbas->query($sql))
- {
- while($rowbas = $connbas->fetch_assoc($rsbas))
- {
- $colls[$row['sbas_id']][$rowbas["coll_id"]] = $rowbas['asciiname'];
- }
- $conn->free_result($rsbas);
- }
- }
- }
- $tbas[$row["sbas_id"]]['colls'][$row['base_id']] = isset($colls[$row['sbas_id']][$row['server_coll_id']]) ? $colls[$row['sbas_id']][$row['server_coll_id']] : 'unknown name';
- }
- $conn->free_result($rs);
- }
- return($tbas);
- }
+ $conn = connection::getInstance();
-
- public static function get_dom_thesaurus($sbas_id)
- {
- if(isset(self::$_dom_thesaurus[$sbas_id]))
- {
- return self::$_dom_thesaurus[$sbas_id];
- }
-
- $thesaurus = self::get_thesaurus($sbas_id);
-
- if($thesaurus && ($tmp = DomDocument::loadXML($thesaurus)) !== false)
- self::$_dom_thesaurus[$sbas_id] = $tmp;
- else
- self::$_dom_thesaurus[$sbas_id] = false;
-
- return self::$_dom_thesaurus[$sbas_id];
- }
-
- public static function get_xpath_thesaurus($sbas_id)
- {
- if(isset(self::$_xpath_thesaurus[$sbas_id]))
- {
- return self::$_xpath_thesaurus[$sbas_id];
- }
-
- $DOM_thesaurus = self::get_dom_thesaurus($sbas_id);
+ $sql = 'LOCK TABLE uids WRITE';
+ if ($conn->query($sql))
+ {
+ $sql = "UPDATE uids SET uid=uid+$askfor_n WHERE name='$typeId'";
+ if ($conn->query($sql))
+ {
+ $sql = "SELECT uid FROM uids WHERE name='$typeId'";
+ if ($result = $conn->query($sql))
+ {
+ if ($row = mysql_fetch_assoc($result))
+ $x = ($row["uid"] - $askfor_n) + 1;
+ mysql_free_result($result);
+ }
+ }
+ $sql = 'UNLOCK TABLES';
+ $conn->query($sql);
+ }
+ return $x;
+ }
- if($DOM_thesaurus && ($tmp = new DOMXPath( $DOM_thesaurus )) !== false)
- self::$_xpath_thesaurus[$sbas_id] = $tmp;
- else
- self::$_xpath_thesaurus[$sbas_id] = false;
-
- return self::$_xpath_thesaurus[$sbas_id];
- }
-
-
- public static function get_sxml_thesaurus($sbas_id)
- {
-
- if(isset(self::$_sxml_thesaurus[$sbas_id]))
- {
- return self::$_sxml_thesaurus[$sbas_id];
- }
-
- $thesaurus = self::get_thesaurus($sbas_id);
-
- if($thesaurus && ($tmp = simplexml_load_string($thesaurus)) !== false)
- self::$_sxml_thesaurus[$sbas_id] = $tmp;
- else
- self::$_sxml_thesaurus[$sbas_id] = false;
-
- return self::$_sxml_thesaurus[$sbas_id];
- }
-
-
- public static function get_thesaurus($sbas_id)
- {
- $cache_appbox = cache_appbox::getInstance();
-
- if(($tmp = $cache_appbox->get('thesaurus_'.$sbas_id)) !== false)
- {
- self::$_thesaurus[$sbas_id] = $tmp;
- return $tmp;
- }
-
- if(isset(self::$_thesaurus[$sbas_id]))
- {
- return self::$_thesaurus[$sbas_id];
- }
-
- $thesaurus = false;
- $connsbas = connection::getInstance($sbas_id);
- $sql = 'SELECT value AS thesaurus FROM pref WHERE prop="thesaurus" LIMIT 1;';
-
- if($rs = $connsbas->query($sql))
- {
- if($row = $connsbas->fetch_assoc($rs))
- {
- $thesaurus = trim($row['thesaurus']);
- }
- $connsbas->free_result($rs);
- }
-
- self::$_thesaurus[$sbas_id] = $thesaurus;
-
- if(self::$_thesaurus[$sbas_id])
- $cache_appbox->set('thesaurus_'.$sbas_id,self::$_thesaurus[$sbas_id]);
-
- return self::$_thesaurus[$sbas_id];
- }
-
+ private function init_data_conn($new_db=false)
+ {
+ // just in case
+ if (is_resource($this->conn))
+ {
+ mysql_close($this->conn);
+ $this->conn = false;
+ }
- public static function get_structure($sbas_id)
+ // connect to appbox
+ require dirname(__FILE__) . '/../../config/connexion.inc';
+
+ $conn = connection::getInstance();
+
+ if ($conn)
+ {
+
+ if (!$new_db)
+ {
+ // same as appbox
+ $this->host = $hostname;
+ $this->port = $port;
+ $this->user = $user;
+ $this->passwd = $password;
+ }
+ else
+ {
+ $this->host = $new_db['hostname'];
+ $this->port = $new_db['port'];
+ $this->user = $new_db['user'];
+ $this->passwd = $new_db['password'];
+ }
+
+ $this->conn = mysql_connect($this->host . ":" . $this->port, $this->user, $this->passwd, true);
+
+ mysql_set_charset('utf8', $this->conn);
+ mysql_query("SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'", $this->conn);
+
+ if ($this->conn !== false)
+ return true;
+ }
+ return false;
+ }
+
+ public function setNewStructure($data_template, $path_web, $path_doc, $baseurl)
+ {
+ if (is_file($data_template))
+ {
+ $contents = file_get_contents($data_template);
+
+ $baseurl = $baseurl ? p4string::addEndSlash($baseurl) : '';
+
+ $contents = str_replace(
+ array("{{dataurl}}", "{{basename}}", "{{datapathweb}}", "{{datapathnoweb}}"),
+ array($baseurl, $this->dbname, $path_web, $path_doc),
+ $contents
+ );
+
+ $this->structure = $contents;
+
+ $sql = 'UPDATE pref SET value="' . mysql_real_escape_string($this->structure, $this->conn) . '", updated_on=NOW() WHERE prop="structure"';
+ if (mysql_query($sql, $this->conn))
+ return true;
+ }
+
+ return false;
+ }
+
+ public function registerAdmin($usr_id, $bool)
+ {
+ $conn = connection::getInstance();
+ $sql = 'UPDATE sbasusr SET bas_manage="' . ($bool === true ? '1' : '0') . '" WHERE usr_id = "' . $usr_id . '" AND sbas_id="' . $this->id . '"';
+ if ($conn->query($sql))
+ return true;
+ return false;
+ }
+
+ public function registerAdminStruct($usr_id, $bool)
+ {
+ $conn = connection::getInstance();
+ $sql = 'UPDATE sbasusr SET bas_modify_struct="' . ($bool === true ? '1' : '0') . '" WHERE usr_id = "' . $usr_id . '" AND sbas_id="' . $this->id . '"';
+ if ($conn->query($sql))
+ return true;
+ return false;
+ }
+
+ public function registerAdminThesaurus($usr_id, $bool)
+ {
+ $conn = connection::getInstance();
+ $sql = 'UPDATE sbasusr SET bas_modif_th="' . ($bool === true ? '1' : '0') . '" WHERE usr_id = "' . $usr_id . '" AND sbas_id="' . $this->id . '"';
+ if ($conn->query($sql))
+ return true;
+ return false;
+ }
+
+ public function registerPublication($usr_id, $bool)
+ {
+ $conn = connection::getInstance();
+ $sql = 'UPDATE sbasusr SET bas_chupub="' . ($bool === true ? '1' : '0') . '" WHERE usr_id = "' . $usr_id . '" AND sbas_id="' . $this->id . '"';
+ if ($conn->query($sql))
+ return true;
+ return false;
+ }
+
+ public static function printStatus($name)
+ {
+
+ $cache_data = cache_appbox::getInstance();
+
+ if (($tmp = $cache_data->get('status' . $name)) !== false)
+ return $tmp;
+
+ $filename = GV_RootPath . 'config/status/' . $name;
+
+ $out = '';
+
+ if (is_file($filename))
+ {
+ $out = file_get_contents($filename);
+ }
+
+ $cache_data->set('status' . $name, $out);
+
+ return $out;
+ }
+
+ public static function getPrintLogo($sbas_id)
+ {
+
+ $cache_data = cache_appbox::getInstance();
+
+ $out = '';
+ if (is_file(($filename = GV_RootPath . 'config/minilogos/logopdf_' . $sbas_id . '.jpg')))
+ $out = file_get_contents($filename);
+
+ return $out;
+ }
+
+ public static function getColls($sbas_id=false)
+ {
+ $tbas = array();
+ $conn = connection::getInstance();
+
+ if ($sbas_id !== false)
+ $sql = "SELECT * FROM sbas s, bas b WHERE s.sbas_id='" . $conn->escape_string($sbas_id) . "' AND s.sbas_id = b.sbas_id AND b.active = '1' ORDER BY s.ord ASC, b.ord ASC";
+ else
+ $sql = "SELECT * FROM sbas s, bas b WHERE s.sbas_id = b.sbas_id AND b.active = '1' ORDER BY s.ord ASC, b.ord ASC";
+
+ if ($rs = $conn->query($sql))
+ {
+ while ($row = $conn->fetch_assoc($rs))
+ {
+ if (!isset($tbas[$row["sbas_id"]]))
+ {
+ $tbas[$row["sbas_id"]] = array('viewname' => (trim($row['viewname']) != '' ? $row['viewname'] : $row['dbname']), 'colls' => array());
+
+ $connbas = connection::getInstance($row['sbas_id']);
+ if ($connbas)
+ {
+ $sql = "SELECT coll_id, asciiname FROM coll";
+ if ($rsbas = $connbas->query($sql))
+ {
+ while ($rowbas = $connbas->fetch_assoc($rsbas))
+ {
+ $colls[$row['sbas_id']][$rowbas["coll_id"]] = $rowbas['asciiname'];
+ }
+ $conn->free_result($rsbas);
+ }
+ }
+ }
+ $tbas[$row["sbas_id"]]['colls'][$row['base_id']] = isset($colls[$row['sbas_id']][$row['server_coll_id']]) ? $colls[$row['sbas_id']][$row['server_coll_id']] : 'unknown name';
+ }
+ $conn->free_result($rs);
+ }
+ return($tbas);
+ }
+
+ public static function get_dom_thesaurus($sbas_id)
+ {
+ if (isset(self::$_dom_thesaurus[$sbas_id]))
+ {
+ return self::$_dom_thesaurus[$sbas_id];
+ }
+
+ $thesaurus = self::get_thesaurus($sbas_id);
+
+ if ($thesaurus && ($tmp = DomDocument::loadXML($thesaurus)) !== false)
+ self::$_dom_thesaurus[$sbas_id] = $tmp;
+ else
+ self::$_dom_thesaurus[$sbas_id] = false;
+
+ return self::$_dom_thesaurus[$sbas_id];
+ }
+
+ public static function get_xpath_thesaurus($sbas_id)
+ {
+ if (isset(self::$_xpath_thesaurus[$sbas_id]))
+ {
+ return self::$_xpath_thesaurus[$sbas_id];
+ }
+
+ $DOM_thesaurus = self::get_dom_thesaurus($sbas_id);
+
+ if ($DOM_thesaurus && ($tmp = new phrasea_DOMXPath($DOM_thesaurus)) !== false)
+ self::$_xpath_thesaurus[$sbas_id] = $tmp;
+ else
+ self::$_xpath_thesaurus[$sbas_id] = false;
+
+ return self::$_xpath_thesaurus[$sbas_id];
+ }
+
+ public static function get_sxml_thesaurus($sbas_id)
+ {
+
+ if (isset(self::$_sxml_thesaurus[$sbas_id]))
+ {
+ return self::$_sxml_thesaurus[$sbas_id];
+ }
+
+ $thesaurus = self::get_thesaurus($sbas_id);
+
+ if ($thesaurus && ($tmp = simplexml_load_string($thesaurus)) !== false)
+ self::$_sxml_thesaurus[$sbas_id] = $tmp;
+ else
+ self::$_sxml_thesaurus[$sbas_id] = false;
+
+ return self::$_sxml_thesaurus[$sbas_id];
+ }
+
+ public static function get_thesaurus($sbas_id)
+ {
+ $cache_appbox = cache_appbox::getInstance();
+
+ if (($tmp = $cache_appbox->get('thesaurus_' . $sbas_id)) !== false)
+ {
+ self::$_thesaurus[$sbas_id] = $tmp;
+ return $tmp;
+ }
+
+ if (isset(self::$_thesaurus[$sbas_id]))
+ {
+ return self::$_thesaurus[$sbas_id];
+ }
+
+ $thesaurus = false;
+ $connsbas = connection::getInstance($sbas_id);
+ $sql = 'SELECT value AS thesaurus FROM pref WHERE prop="thesaurus" LIMIT 1;';
+
+ if ($rs = $connsbas->query($sql))
+ {
+ if ($row = $connsbas->fetch_assoc($rs))
+ {
+ $thesaurus = trim($row['thesaurus']);
+ }
+ $connsbas->free_result($rs);
+ }
+
+ self::$_thesaurus[$sbas_id] = $thesaurus;
+
+ if (self::$_thesaurus[$sbas_id])
+ $cache_appbox->set('thesaurus_' . $sbas_id, self::$_thesaurus[$sbas_id]);
+
+ return self::$_thesaurus[$sbas_id];
+ }
+
+ public static function get_structure($sbas_id)
+ {
+ $session = session::getInstance();
+ $locale = isset($session->locale) ? $session->locale : GV_default_lng;
+ $basesettings = phrasea::load_settings($locale);
+
+ if (isset($basesettings["bases"][$sbas_id]))
+ return $basesettings["bases"][$sbas_id]["structure"];
+
+ return false;
+ }
+
+ public static function get_dom_structure($sbas_id)
+ {
+ if (isset(self::$_dom_structure[$sbas_id]))
+ {
+ return self::$_dom_structure[$sbas_id];
+ }
+
+ $structure = self::get_structure($sbas_id);
+
+ $dom = new DOMDocument();
+
+ $dom->standalone = true;
+ $dom->preserveWhiteSpace = false;
+ $dom->formatOutput = true;
+
+ if ($structure && $dom->loadXML($structure) !== false)
+ self::$_dom_structure[$sbas_id] = $dom;
+ else
+ self::$_dom_structure[$sbas_id] = false;
+
+ return self::$_dom_structure[$sbas_id];
+ }
+
+ public static function get_sxml_structure($sbas_id)
+ {
+ if (isset(self::$_sxml_structure[$sbas_id]))
+ {
+ return self::$_sxml_structure[$sbas_id];
+ }
+
+ $structure = self::get_structure($sbas_id);
+
+ if ($structure && ($tmp = simplexml_load_string($structure)) !== false)
+ self::$_sxml_structure[$sbas_id] = $tmp;
+ else
+ self::$_sxml_structure[$sbas_id] = false;
+
+ return self::$_sxml_structure[$sbas_id];
+ }
+
+ public static function get_xpath_structure($sbas_id)
+ {
+ if (isset(self::$_xpath_structure[$sbas_id]))
+ {
+ return self::$_xpath_structure[$sbas_id];
+ }
+
+ $dom_doc = self::get_dom_structure($sbas_id);
+
+ if ($dom_doc && ($tmp = new DOMXpath($dom_doc)) !== false)
+ self::$_xpath_structure[$sbas_id] = $tmp;
+ else
+ self::$_xpath_structure[$sbas_id] = false;
+
+ return self::$_xpath_structure[$sbas_id];
+ }
+
+ public static function get_structure_errors($structure)
+ {
+ $sx_structure = simplexml_load_string($structure);
+
+ $subdefgroup = $sx_structure->subdefs[0];
+ $AvSubdefs = array();
+
+ $errors = array();
+
+ foreach ($subdefgroup as $k => $subdefs)
+ {
+ $subdefgroup_name = trim((string) $subdefs->attributes()->name);
+
+ if ($subdefgroup_name == '')
+ {
+ $errors[] = _('ERREUR : TOUTES LES BALISES subdefgroup necessitent un attribut name');
+ continue;
+ }
+
+ if (!isset($AvSubdefs[$subdefgroup_name]))
+ $AvSubdefs[$subdefgroup_name] = array();
+
+ foreach ($subdefs as $sd)
+ {
+ $sd_name = trim(mb_strtolower((string) $sd->attributes()->name));
+ $sd_class = trim(mb_strtolower((string) $sd->attributes()->class));
+ if ($sd_name == '' || isset($AvSubdefs[$subdefgroup_name][$sd_name]))
+ {
+ $errors[] = _('ERREUR : Les name de subdef sont uniques par groupe de subdefs et necessaire');
+ continue;
+ }
+ if (!in_array($sd_class, array('thumbnail', 'preview', 'document')))
+ {
+ $errors[] = _('ERREUR : La classe de subdef est necessaire et egal a "thumbnail","preview" ou "document"');
+ continue;
+ }
+ $AvSubdefs[$subdefgroup_name][$sd_name] = $sd;
+ }
+ }
+
+ return $errors;
+ }
+
+ public static function get_subdefs($sbas_id)
+ {
+ $sx_struct = self::get_sxml_structure($sbas_id);
+
+ if (!$sx_struct)
+ return array();
+
+ $subdefgroup = $sx_struct->subdefs[0];
+
+ $AvSubdefs = array();
+
+ foreach ($subdefgroup as $k => $subdefs)
+ {
+ $subdefgroup_name = (string) $subdefs->attributes()->name;
+
+ if (!isset($AvSubdefs[$subdefgroup_name]))
+ $AvSubdefs[$subdefgroup_name] = array();
+
+ foreach ($subdefs as $sd)
+ {
+ $AvSubdefs[$subdefgroup_name][mb_strtolower((string) $sd->attributes()->name)] = $sd;
+ }
+ }
+
+ if (!isset($AvSubdefs['flash']))
+ $AvSubdefs['flash'] = $AvSubdefs['image'];
+ if (!isset($AvSubdefs['document']))
+ $AvSubdefs['document'] = $AvSubdefs['image'];
+
+
+ return $AvSubdefs;
+ }
+
+}
+
+class phrasea_DOMXPath extends DOMXPath
+{
+ static $r = array();
+ function cache_query($xquery, $context_node=NULL, $context_path='')
{
- $session = session::getInstance();
- $locale = isset($session->locale) ? $session->locale : GV_default_lng;
- $basesettings = phrasea::load_settings($locale);
-
- if(isset($basesettings["bases"][$sbas_id]))
- return $basesettings["bases"][$sbas_id]["structure"];
-
- return false;
+ $context_path .= $xquery;
+ if(!array_key_exists($context_path, self::$r))
+ self::$r[$context_path] = $context_node ? parent::query($xquery, $context_node) : parent::query($xquery);
+ return(self::$r[$context_path]);
}
-
-
- public static function get_dom_structure($sbas_id)
- {
- if(isset(self::$_dom_structure[$sbas_id]))
- {
- return self::$_dom_structure[$sbas_id];
- }
-
- $structure = self::get_structure($sbas_id);
-
- $dom = new DOMDocument();
-
- $dom->standalone = true;
- $dom->preserveWhiteSpace = false;
- $dom->formatOutput = true;
-
- if($structure && $dom->loadXML($structure) !== false)
- self::$_dom_structure[$sbas_id] = $dom;
- else
- self::$_dom_structure[$sbas_id] = false;
-
- return self::$_dom_structure[$sbas_id];
- }
-
-
-
- public static function get_sxml_structure($sbas_id)
- {
- if(isset(self::$_sxml_structure[$sbas_id]))
- {
- return self::$_sxml_structure[$sbas_id];
- }
-
- $structure = self::get_structure($sbas_id);
-
- if($structure && ($tmp = simplexml_load_string($structure)) !== false)
- self::$_sxml_structure[$sbas_id] = $tmp;
- else
- self::$_sxml_structure[$sbas_id] = false;
-
- return self::$_sxml_structure[$sbas_id];
- }
-
-
- public static function get_xpath_structure($sbas_id)
- {
- if(isset(self::$_xpath_structure[$sbas_id]))
- {
- return self::$_xpath_structure[$sbas_id];
- }
-
- $dom_doc = self::get_dom_structure($sbas_id);
-
- if($dom_doc && ($tmp = new DOMXpath($dom_doc)) !== false)
- self::$_xpath_structure[$sbas_id] = $tmp;
- else
- self::$_xpath_structure[$sbas_id] = false;
-
- return self::$_xpath_structure[$sbas_id];
- }
-
- public static function get_structure_errors($structure)
- {
- $sx_structure = simplexml_load_string($structure);
-
- $subdefgroup = $sx_structure->subdefs[0];
- $AvSubdefs = array();
-
- $errors = array();
-
- foreach($subdefgroup as $k=>$subdefs)
- {
- $subdefgroup_name = trim((string)$subdefs->attributes()->name);
-
- if($subdefgroup_name == '')
- {
- $errors[] = _('ERREUR : TOUTES LES BALISES subdefgroup necessitent un attribut name');
- continue;
- }
-
- if(!isset($AvSubdefs[$subdefgroup_name]))
- $AvSubdefs[$subdefgroup_name] = array();
-
- foreach($subdefs as $sd)
- {
- $sd_name = trim(mb_strtolower((string)$sd->attributes()->name));
- $sd_class = trim(mb_strtolower((string)$sd->attributes()->class));
- if($sd_name == '' || isset($AvSubdefs[$subdefgroup_name][$sd_name]))
- {
- $errors[] = _('ERREUR : Les name de subdef sont uniques par groupe de subdefs et necessaire');
- continue;
- }
- if(!in_array($sd_class,array('thumbnail','preview','document')))
- {
- $errors[] = _('ERREUR : La classe de subdef est necessaire et egal a "thumbnail","preview" ou "document"');
- continue;
- }
- $AvSubdefs[$subdefgroup_name][$sd_name] = $sd;
- }
- }
-
- return $errors;
- }
-
- public static function get_subdefs($sbas_id)
- {
- $sx_struct = self::get_sxml_structure($sbas_id);
-
- if(!$sx_struct)
- return array();
-
- $subdefgroup = $sx_struct->subdefs[0];
-
- $AvSubdefs = array();
-
- foreach($subdefgroup as $k=>$subdefs)
- {
- $subdefgroup_name = (string)$subdefs->attributes()->name;
-
- if(!isset($AvSubdefs[$subdefgroup_name]))
- $AvSubdefs[$subdefgroup_name] = array();
-
- foreach($subdefs as $sd)
- {
- $AvSubdefs[$subdefgroup_name][mb_strtolower((string)$sd->attributes()->name)] = $sd;
- }
- }
-
- if(!isset($AvSubdefs['flash']))
- $AvSubdefs['flash'] = $AvSubdefs['image'];
- if(!isset($AvSubdefs['document']))
- $AvSubdefs['document'] = $AvSubdefs['image'];
-
-
- return $AvSubdefs;
- }
-}
\ No newline at end of file
+}
+
diff --git a/lib/classes/export.class.php b/lib/classes/export.class.php
index 377ade17fe..83d4c2aa87 100644
--- a/lib/classes/export.class.php
+++ b/lib/classes/export.class.php
@@ -699,7 +699,19 @@ class export
if(GV_modxsendfile)
{
- $file_xaccel = str_replace(array(GV_X_Accel_Redirect, GV_RootPath.'tmp/download/'), array('/'.GV_X_Accel_Redirect_mount_point.'/', '/download/'), $file);
+ $file_xaccel = str_replace(
+ array(
+ GV_X_Accel_Redirect,
+ GV_RootPath . 'tmp/download/',
+ GV_RootPath . 'tmp/lazaret/'
+ )
+ , array(
+ '/' . GV_X_Accel_Redirect_mount_point . '/',
+ '/download/',
+ '/lazaret/'
+ )
+ , $file
+ );
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
diff --git a/lib/classes/mail.class.php b/lib/classes/mail.class.php
index 089f45d8aa..c9057696a7 100644
--- a/lib/classes/mail.class.php
+++ b/lib/classes/mail.class.php
@@ -2,266 +2,273 @@
class mail
{
-
- public static function mail_test($email)
- {
- $from = array('email'=>GV_defaulmailsenderaddr,'name'=>GV_defaulmailsenderaddr);
-
- $subject = _('mail:: test d\'envoi d\'email');
-
- $message = sprintf(_('Ce mail est un test d\'envoi de mail depuis %s'),GV_ServerName);
-
- $to = array('email'=>$email,'name'=>$email);
-
- return self::send_mail($subject, $message, $to, $from);
- }
-
- public static function send_validation_results($email,$subject,$from, $message)
- {
- $to = array('email'=>$email,'name'=>$email);
-
- return self::send_mail($subject, $message, $to, $from);
- }
-
- public static function hack_alert($email, $body)
- {
- $subject = 'Hack on '.GV_homeTitle;
-
- $to = array('email'=>$email,'name'=>$email);
-
- return self::send_mail($subject, $body, $to);
- }
-
- public static function ftp_sent($email, $subject, $body)
- {
- $to = array('email'=>$email,'name'=>$email);
-
- return self::send_mail($subject, $body, $to);
- }
-
- public static function ftp_receive($email, $body)
- {
- $subject = _("task::ftp:Someone has sent some files onto FTP server");
-
- $to = array('email'=>$email,'name'=>$email);
-
- return self::send_mail($subject, $body, $to);
- }
-
- public static function send_documents($email, $url,$from, $message='',$accuse)
- {
- $subject = _('export::vous avez recu des documents');
-
- $body = ' '._('Vous avez recu des documents, vous pourrez les telecharger a ladresse suivante ')."
\n";
- $body .= "".$url." \n";
-
- if($message != '')
- {
- $body .= "---------------------------------------------------
\n".$message;
- }
-
- $to = array('email'=>$email,'name'=>$email);
-
- return self::send_mail($subject, $body, $to, $from, array(), $accuse);
- }
-
- public static function forgot_passord($email, $login, $url)
- {
- $subject = _('login:: Forgot your password') ; // Registration order on .
-
- $body = ""._('login:: Quelqu\'un a demande a reinitialiser le mode passe correspondant au login suivant : ') . "
\n\n" . $login . "
\n\n";
- $body .= ""._('login:: Visitez le lien suivant et suivez les instructions pour continuer, sinon ignorez cet email et il ne se passera rien') . "
\n\n" ;
- $body .= "\n" ;
-
- $to = array('email'=>$email,'name'=>$email);
-
- return self::send_mail($subject, $body, $to);
- }
-
-
- public static function register_confirm($email, $accept, $deny)
- {
-
- $subject = sprintf(_('login::register:email: Votre compte %s'), GV_homeTitle);
-
- $body = ''._('login::register:email: Voici un compte rendu du traitement de vos demandes d\'acces :')."
\n";
-
- if($accept != '')
- {
- $body .= " \n"._('login::register:email: Vous avez ete accepte sur les collections suivantes : ')."
\n\n";
- }
- if($deny != '')
- {
- $body .= " \n"._('login::register:email: Vous avez ete refuse sur les collections suivantes : ')."
\n\n";
- }
-
- $to = array('email'=>$email,'name'=>$email);
-
- return self::send_mail($subject, $body, $to);
- }
-
-
- public static function register_user($email, $auto, $others)
- {
-
- $subject = sprintf(_('login::register:email: Votre compte %s'),GV_homeTitle);
-
-
- $body = ""._('login::register:Votre inscription a ete prise en compte')."
\n";
-
- if($auto != '')
- {
- $body .= " \n"._('login::register: vous avez des a present acces aux collections suivantes : ')."
\n\n";
- }
-
- if($others != '')
- {
- $body .= " \n"._('login::register: vos demandes concernat les collections suivantes sont sujettes a approbation d\'un administrateur')."
\n\n";
- $body .= " \n"._('login::register : vous serez avertis par email lorsque vos demandes seront traitees')."
\n";
- }
-
- $to = array('email'=>$email,'name'=>$email);
-
- return self::send_mail($subject, $body, $to);
- }
-
- public static function reset_email($email,$usr_id)
- {
- $date = new DateTime('1 day');
- $date = phraseadate::format_mysql($date);
- $token = random::getUrlToken('email',$usr_id,$date,$email);
-
- $url = GV_ServerName.'login/reset-email.php?token='.$token;
-
- $subject = _('login::register: sujet email : confirmation de votre adresse email');
-
- $body = ""._('admin::compte-utilisateur: email changement de mot d\'email Bonjour, nous avons bien recu votre demande de changement d\'adresse e-mail. Pour la confirmer, veuillez suivre le lien qui suit. SI vous recevez ce mail sans l\'avoir sollicite, merci de le detruire et de l\'ignorer.')."
\n";
- $body .= '\n';
-
- $to = array('email'=>$email,'name'=>$email);
-
- return self::send_mail($subject, $body, $to);
- }
-
- public static function mail_confirm_registered($email)
- {
- $subject = _('login::register: sujet email : confirmation de votre adresse email');
-
- $body = ""._('login::register: merci d\'avoir confirme votre adresse email')."
\n";
- $body .= ""._('login::register: vous pouvez maintenant vous connecter a l\'adresse suivante : ')."
\n";
- $body .= "\n";
-
- $to = array('email'=>$email,'name'=>$email);
-
- return self::send_mail($subject, $body, $to);
- }
-
- public static function mail_confirm_unregistered($email, $others)
- {
-
- $subject = _('login::register: sujet email : confirmation de votre adresse email');
-
- $body = ""._('login::register: merci d\'avoir confirme votre adresse email')."
\n";
- $body .= " \n"._('login::register: vous devez attendre la confirmation d\'un administrateur ; vos demandes sur les collections suivantes sont toujours en attente : ')."
\n\n";
- $body .= " \n"._('login::register : vous serez avertis par email lorsque vos demandes seront traitees')."
\n";
-
- $to = array('email'=>$email,'name'=>$email);
-
- return self::send_mail($subject, $body, $to);
- }
-
- public static function mail_confirmation($email,$usr_id)
- {
-
- $expire = new DateTime('+3 days');
- $expire = phraseadate::format_mysql($expire);
- $token = random::getUrlToken('password',$usr_id,$expire,$email);
-
- $subject = _('login::register: sujet email : confirmation de votre adresse email');
-
- $body = ""._('login::register: email confirmation email Pour valider votre inscription a la base de donnees, merci de confirmer votre e-mail en suivant le lien ci-dessous.')."
\n";
- $body .= " \n\n";
-
- $to = array('email'=>$email,'name'=>$email);
-
- return self::send_mail($subject, $body, $to);
- }
-
-
- public static function send_mail($subject,$body,$to,$from=false,$files=array(),$reading_confirm_to=false)
- {
- require_once(GV_RootPath.'lib/PHPMailer_v5.1/class.phpmailer.php');
-
- if(!isset($to['email']) || !PHPMailer::ValidateAddress($to['email']))
- return false;
-
- $mail = new PHPMailer();
-
- $body = eregi_replace("[\]",'',$body);
-
- $body .= " \n\n\n\n";
- $body .= ''._('phraseanet::signature automatique des notifications par mail, infos a l\'url suivante')."
\n";
- $body .= '\n";
- $body = ''.$body.'';
-
- try {
- $mail->CharSet = 'utf-8';
- $mail->Encoding = 'base64';//'quoted-printable';
-
- if(GV_smtp)
- {
- $mail->IsSMTP();
- if(GV_smtp_host != '')
- $mail->Host = GV_smtp_host;
-// $mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
- if(GV_smtp_auth)
- {
- $mail->SMTPAuth = true;
-
- if(GV_smtp_secure === true)
- {
- $mail->SMTPSecure = "ssl";
- }
- $mail->Host = GV_smtp_host;
- $mail->Port = GV_smtp_port;
- $mail->Username = GV_smtp_user;
- $mail->Password = GV_smtp_password;
- }
- }
- if($from && trim($from['email']) != '')
- $mail->AddReplyTo($from['email'],$from['name']);
-
- $mail->AddAddress($to['email'], $to['name']);
-
- $mail->SetFrom(GV_defaulmailsenderaddr, GV_homeTitle);
-
- $mail->Subject = $subject;
-
- $mail->AltBody = html_entity_decode(strip_tags($body),ENT_QUOTES,'UTF-8');
-
- if($reading_confirm_to)
- {
- $mail->ConfirmReadingTo = $reading_confirm_to;
- }
-
- $mail->MsgHTML(p4string::cleanTags($body));
-
- foreach($files as $f)
- {
- $mail->AddAttachment($f); // attachment
- }
-
- $mail->Send();
- return true;
- }
- catch (phpmailerException $e)
- {
- return $e->errorMessage();
- }
- catch (Exception $e)
- {
- return $e->getMessage();
- }
- }
+ public static function mail_test($email)
+ {
+ $from = array('email' => GV_defaulmailsenderaddr, 'name' => GV_defaulmailsenderaddr);
+
+ $subject = _('mail:: test d\'envoi d\'email');
+
+ $message = sprintf(_('Ce mail est un test d\'envoi de mail depuis %s'), GV_ServerName);
+
+ $to = array('email' => $email, 'name' => $email);
+
+ return self::send_mail($subject, $message, $to, $from);
+ }
+
+ public static function send_validation_results($email, $subject, $from, $message)
+ {
+ $to = array('email' => $email, 'name' => $email);
+
+ return self::send_mail($subject, $message, $to, $from);
+ }
+
+ public static function hack_alert($email, $body)
+ {
+ $subject = 'Hack on ' . GV_homeTitle;
+
+ $to = array('email' => $email, 'name' => $email);
+
+ return self::send_mail($subject, $body, $to);
+ }
+
+ public static function ftp_sent($email, $subject, $body)
+ {
+ $to = array('email' => $email, 'name' => $email);
+
+ return self::send_mail($subject, $body, $to);
+ }
+
+ public static function ftp_receive($email, $body)
+ {
+ $subject = _("task::ftp:Someone has sent some files onto FTP server");
+
+ $to = array('email' => $email, 'name' => $email);
+
+ return self::send_mail($subject, $body, $to);
+ }
+
+ public static function send_documents($email, $url, $from, $endate_obj, $message='', $accuse)
+ {
+ $subject = _('export::vous avez recu des documents');
+
+ $body = '' . _('Vous avez recu des documents, vous pourrez les telecharger a ladresse suivante ') . "
\n";
+ $body .= "" . $url . " \n";
+
+ $body .= '' .
+ sprintf(
+ _('Attention, ce lien lien est valable jusqu\'au %s'),
+ phraseadate::getDate($endate_obj) . ' ' . phraseadate::getTime($endate_obj)
+ )
+ . '
';
+
+
+ if ($message != '')
+ {
+ $body .= "---------------------------------------------------
\n" . $message;
+ }
+
+ $to = array('email' => $email, 'name' => $email);
+
+ return self::send_mail($subject, $body, $to, $from, array(), $accuse);
+ }
+
+ public static function forgot_passord($email, $login, $url)
+ {
+ $subject = _('login:: Forgot your password'); // Registration order on .
+
+ $body = "" . _('login:: Quelqu\'un a demande a reinitialiser le mode passe correspondant au login suivant : ') . "
\n\n" . $login . "
\n\n";
+ $body .= "" . _('login:: Visitez le lien suivant et suivez les instructions pour continuer, sinon ignorez cet email et il ne se passera rien') . "
\n\n";
+ $body .= "\n";
+
+ $to = array('email' => $email, 'name' => $email);
+
+ return self::send_mail($subject, $body, $to);
+ }
+
+ public static function register_confirm($email, $accept, $deny)
+ {
+
+ $subject = sprintf(_('login::register:email: Votre compte %s'), GV_homeTitle);
+
+ $body = '' . _('login::register:email: Voici un compte rendu du traitement de vos demandes d\'acces :') . "
\n";
+
+ if ($accept != '')
+ {
+ $body .= " \n" . _('login::register:email: Vous avez ete accepte sur les collections suivantes : ') . "
\n\n";
+ }
+ if ($deny != '')
+ {
+ $body .= " \n" . _('login::register:email: Vous avez ete refuse sur les collections suivantes : ') . "
\n\n";
+ }
+
+ $to = array('email' => $email, 'name' => $email);
+
+ return self::send_mail($subject, $body, $to);
+ }
+
+ public static function register_user($email, $auto, $others)
+ {
+
+ $subject = sprintf(_('login::register:email: Votre compte %s'), GV_homeTitle);
+
+
+ $body = "" . _('login::register:Votre inscription a ete prise en compte') . "
\n";
+
+ if ($auto != '')
+ {
+ $body .= " \n" . _('login::register: vous avez des a present acces aux collections suivantes : ') . "
\n\n";
+ }
+
+ if ($others != '')
+ {
+ $body .= " \n" . _('login::register: vos demandes concernat les collections suivantes sont sujettes a approbation d\'un administrateur') . "
\n\n";
+ $body .= " \n" . _('login::register : vous serez avertis par email lorsque vos demandes seront traitees') . "
\n";
+ }
+
+ $to = array('email' => $email, 'name' => $email);
+
+ return self::send_mail($subject, $body, $to);
+ }
+
+ public static function reset_email($email, $usr_id)
+ {
+ $date = new DateTime('1 day');
+ $date = phraseadate::format_mysql($date);
+ $token = random::getUrlToken('email', $usr_id, $date, $email);
+
+ $url = GV_ServerName . 'login/reset-email.php?token=' . $token;
+
+ $subject = _('login::register: sujet email : confirmation de votre adresse email');
+
+ $body = "" . _('admin::compte-utilisateur: email changement de mot d\'email Bonjour, nous avons bien recu votre demande de changement d\'adresse e-mail. Pour la confirmer, veuillez suivre le lien qui suit. SI vous recevez ce mail sans l\'avoir sollicite, merci de le detruire et de l\'ignorer.') . "
\n";
+ $body .= '\n';
+
+ $to = array('email' => $email, 'name' => $email);
+
+ return self::send_mail($subject, $body, $to);
+ }
+
+ public static function mail_confirm_registered($email)
+ {
+ $subject = _('login::register: sujet email : confirmation de votre adresse email');
+
+ $body = "" . _('login::register: merci d\'avoir confirme votre adresse email') . "
\n";
+ $body .= "" . _('login::register: vous pouvez maintenant vous connecter a l\'adresse suivante : ') . "
\n";
+ $body .= "\n";
+
+ $to = array('email' => $email, 'name' => $email);
+
+ return self::send_mail($subject, $body, $to);
+ }
+
+ public static function mail_confirm_unregistered($email, $others)
+ {
+
+ $subject = _('login::register: sujet email : confirmation de votre adresse email');
+
+ $body = "" . _('login::register: merci d\'avoir confirme votre adresse email') . "
\n";
+ $body .= " \n" . _('login::register: vous devez attendre la confirmation d\'un administrateur ; vos demandes sur les collections suivantes sont toujours en attente : ') . "
\n\n";
+ $body .= " \n" . _('login::register : vous serez avertis par email lorsque vos demandes seront traitees') . "
\n";
+
+ $to = array('email' => $email, 'name' => $email);
+
+ return self::send_mail($subject, $body, $to);
+ }
+
+ public static function mail_confirmation($email, $usr_id)
+ {
+
+ $expire = new DateTime('+3 days');
+ $expire = phraseadate::format_mysql($expire);
+ $token = random::getUrlToken('password', $usr_id, $expire, $email);
+
+ $subject = _('login::register: sujet email : confirmation de votre adresse email');
+
+ $body = "" . _('login::register: email confirmation email Pour valider votre inscription a la base de donnees, merci de confirmer votre e-mail en suivant le lien ci-dessous.') . "
\n";
+ $body .= " \n\n";
+
+ $to = array('email' => $email, 'name' => $email);
+
+ return self::send_mail($subject, $body, $to);
+ }
+
+ public static function send_mail($subject, $body, $to, $from=false, $files=array(), $reading_confirm_to=false)
+ {
+ require_once(GV_RootPath . 'lib/PHPMailer_v5.1/class.phpmailer.php');
+
+ if (!isset($to['email']) || !PHPMailer::ValidateAddress($to['email']))
+ return false;
+
+ $mail = new PHPMailer();
+
+ $body = eregi_replace("[\]", '', $body);
+
+ $body .= " \n\n\n\n";
+ $body .= '' . _('phraseanet::signature automatique des notifications par mail, infos a l\'url suivante') . "
\n";
+ $body .= '\n";
+ $body = '' . $body . '';
+
+ try
+ {
+ $mail->CharSet = 'utf-8';
+ $mail->Encoding = 'base64'; //'quoted-printable';
+
+ if (GV_smtp)
+ {
+ $mail->IsSMTP();
+ if (GV_smtp_host != '')
+ $mail->Host = GV_smtp_host;
+// $mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
+ if (GV_smtp_auth)
+ {
+ $mail->SMTPAuth = true;
+
+ if (GV_smtp_secure === true)
+ {
+ $mail->SMTPSecure = "ssl";
+ }
+ $mail->Host = GV_smtp_host;
+ $mail->Port = GV_smtp_port;
+ $mail->Username = GV_smtp_user;
+ $mail->Password = GV_smtp_password;
+ }
+ }
+
+ if ($from && trim($from['email']) != '')
+ $mail->AddReplyTo($from['email'], $from['name']);
+
+ $mail->AddAddress($to['email'], $to['name']);
+
+ $mail->SetFrom(GV_defaulmailsenderaddr, GV_homeTitle);
+
+ $mail->Subject = $subject;
+
+ $mail->AltBody = html_entity_decode(strip_tags($body), ENT_QUOTES, 'UTF-8');
+
+ if ($reading_confirm_to)
+ {
+ $mail->ConfirmReadingTo = $reading_confirm_to;
+ }
+
+ $mail->MsgHTML(p4string::cleanTags($body));
+
+ foreach ($files as $f)
+ {
+ $mail->AddAttachment($f); // attachment
+ }
+
+ $mail->Send();
+ return true;
+ }
+ catch (phpmailerException $e)
+ {
+ return $e->errorMessage();
+ }
+ catch (Exception $e)
+ {
+ return $e->getMessage();
+ }
+ }
+
}
\ No newline at end of file
diff --git a/lib/classes/phraseadate.class.php b/lib/classes/phraseadate.class.php
index 37b1012f6d..bb4ca961a0 100644
--- a/lib/classes/phraseadate.class.php
+++ b/lib/classes/phraseadate.class.php
@@ -37,7 +37,7 @@ class phraseadate
$diff = $compareTo->format('U') - $date->format('U');
$dayDiff = floor($diff / 86400);
- if(is_nan($dayDiff) || $dayDiff < 0) {
+ if(is_nan($dayDiff)) {
return '';
}
diff --git a/lib/classes/query.class.php b/lib/classes/query.class.php
index 02bfef8722..4813f2b9c8 100644
--- a/lib/classes/query.class.php
+++ b/lib/classes/query.class.php
@@ -247,7 +247,6 @@ class query
$dstatus = status::getDisplayStatus();
-
$array_icons = array(
'flash' => '',
'document' => '',
@@ -308,6 +307,7 @@ class query
$base_id = $data["base_id"];
$thumbnail = answer::getThumbnail($session->ses_id, $data["base_id"], $data["record_id"],GV_zommPrev_rollover_clientAnswer);
+
if($thumbnail['sha256'])
$rsScreen[$irec]['sha256'] = $thumbnail['sha256'];
@@ -319,6 +319,7 @@ class query
$exifinfos = answer::format_infos($data['xml'], $sbas_id, $data["record_id"],$thumbnail['type']);
$captions = answer::format_caption($base_id, $data["record_id"],$data['xml']);
}
+
diff --git a/lib/clientUtils.php b/lib/clientUtils.php
index aff063ddfc..01f5bc8073 100644
--- a/lib/clientUtils.php
+++ b/lib/clientUtils.php
@@ -452,7 +452,8 @@ function getPreviewWindow($usr,$ses,$lng,$env,$pos,$contId,$roll)
$docType = isset($sdMain['document'])?$sdMain['document']['type']:'unknown';
$prev = answer::get_preview($bas,$rec,$isFullyPublic);
-
+
+ $preview_html = $prev['html'];
$preview = $prev['preview'];
$flashcontent = $prev['flashcontent'];
$width = $prev['width'];
@@ -678,6 +679,7 @@ function getPreviewWindow($usr,$ses,$lng,$env,$pos,$contId,$roll)
return p4string::jsonencode(array(
"prev"=>$preview
+ ,"prev_html"=>$preview_html
,"flashcontent"=>$flashcontent
,"desc"=>p4string::entitydecode($caption)
,"width"=>$width
diff --git a/lib/conf.d/data_templates/en-simple.xml b/lib/conf.d/data_templates/en-simple.xml
index 67dbb6a1b2..1bc8895251 100644
--- a/lib/conf.d/data_templates/en-simple.xml
+++ b/lib/conf.d/data_templates/en-simple.xml
@@ -1,8 +1,8 @@
- {{datapathnoweb}}{{basename}}/documents
+ {{datapathnoweb}}{{basename}}/documents
-
+
{{datapathnoweb}}{{basename}}/subdefs
@@ -13,9 +13,9 @@
75
yes
- image
- Prévisualisation
- Preview
+ image
+ Prévisualisation
+ Preview
{{datapathweb}}{{basename}}/subdefs
@@ -25,10 +25,10 @@
yes
75
no
- image
+ image
{{dataurl}}{{basename}}/subdefs
- Imagette
- Thumbnail
+ Imagette
+ Thumbnail
@@ -36,171 +36,187 @@
{{datapathnoweb}}{{basename}}/subdefs
800
- video
+ video
yes
faac
libx264
1000
- 8
+ 8
15
- Prévisualisation
- Preview
+ Prévisualisation
+ Preview
{{datapathweb}}{{basename}}/subdefs
200
- gif
- 1
+ gif
+ 1
no
{{dataurl}}/{{basename}}/subdefs
- Animation GIF
- GIF Animation
+ Animation GIF
+ GIF Animation
{{datapathweb}}{{basename}}/subdefs
200
- image
+ image
no
{{dataurl}}{{basename}}/subdefs
- Imagette
- Thumbnail
+ Imagette
+ Thumbnail
{{datapathnoweb}}{{basename}}/subdefs
- audio
+ audio
yes
- Prévisualisation
- Preview
+ Prévisualisation
+ Preview
{{datapathweb}}{{basename}}/subdefs
- image
+ image
no
{{dataurl}}{{basename}}/subdefs
- Imagette
- Thumbnail
+ Imagette
+ Thumbnail
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
- Online
-
+
+ Online
+
-
-
-
-
- :
-
-
-
+
+
+
+
+
+
+ :
+
+
+
+
+
-
-
-
-
- :
-
-
-
+
+
+
+
+
+
+ :
+
+
+
+
+
-
-
-
-
- :
-
-
-
+
+
+
+
+
+
+ :
+
+
+
+
+
-
-
-
-
- :
-
-
-
+
+
+
+
+
+
+ :
+
+
+
+
+
\ No newline at end of file
diff --git a/lib/conf.d/data_templates/fr-simple.xml b/lib/conf.d/data_templates/fr-simple.xml
index 0f27deb360..cb65cf671b 100755
--- a/lib/conf.d/data_templates/fr-simple.xml
+++ b/lib/conf.d/data_templates/fr-simple.xml
@@ -1,208 +1,224 @@
- {{datapathnoweb}}{{basename}}/documents
-
-
-
- {{datapathnoweb}}{{basename}}/subdefs
- 800
- resample
- 72
- no
- 75
- yes
-
- image
- Prévisualisation
- Preview
-
-
- {{datapathweb}}{{basename}}/subdefs
- 200
- resample
- 72
- yes
- 75
- no
- image
- {{dataurl}}{{basename}}/subdefs
- Imagette
- Thumbnail
-
-
+ {{datapathnoweb}}{{basename}}/documents
+
+
+
+ {{datapathnoweb}}{{basename}}/subdefs
+ 800
+ resample
+ 72
+ no
+ 75
+ yes
+
+ image
+ Prévisualisation
+ Preview
+
+
+ {{datapathweb}}{{basename}}/subdefs
+ 200
+ resample
+ 72
+ yes
+ 75
+ no
+ image
+ {{dataurl}}{{basename}}/subdefs
+ Imagette
+ Thumbnail
+
+
-
-
- {{datapathnoweb}}{{basename}}/subdefs
- 800
- video
- yes
-
- faac
- libx264
- 1000
- 8
- 15
- Prévisualisation
- Preview
-
-
- {{datapathweb}}{{basename}}/subdefs
- 200
- gif
- 1
- no
- {{dataurl}}/{{basename}}/subdefs
- Animation GIF
- GIF Animation
-
-
- {{datapathweb}}{{basename}}/subdefs
- 200
- image
- no
- {{dataurl}}{{basename}}/subdefs
- Imagette
- Thumbnail
-
-
+
+
+ {{datapathnoweb}}{{basename}}/subdefs
+ 800
+ video
+ yes
+
+ faac
+ libx264
+ 1000
+ 8
+ 15
+ Prévisualisation
+ Preview
+
+
+ {{datapathweb}}{{basename}}/subdefs
+ 200
+ gif
+ 1
+ no
+ {{dataurl}}/{{basename}}/subdefs
+ Animation GIF
+ GIF Animation
+
+
+ {{datapathweb}}{{basename}}/subdefs
+ 200
+ image
+ no
+ {{dataurl}}{{basename}}/subdefs
+ Imagette
+ Thumbnail
+
+
-
-
- {{datapathnoweb}}{{basename}}/subdefs
- audio
- yes
-
- Prévisualisation
- Preview
-
-
- {{datapathweb}}{{basename}}/subdefs
- image
- no
- {{dataurl}}{{basename}}/subdefs
- Imagette
- Thumbnail
-
-
+
+
+ {{datapathnoweb}}{{basename}}/subdefs
+ audio
+ yes
+
+ Prévisualisation
+ Preview
+
+
+ {{datapathweb}}{{basename}}/subdefs
+ image
+ no
+ {{dataurl}}{{basename}}/subdefs
+ Imagette
+ Thumbnail
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
- Online
-
+
+ Online
+
-
-
-
-
- :
-
-
-
+
+
+
+
+
+
+ :
+
+
+
+
+
-
-
-
-
- :
-
-
-
+
+
+
+
+
+
+ :
+
+
+
+
+
-
-
-
-
- :
-
-
-
-
-
-
-
- :
-
-
-
+
+
+
+
+
+
+ :
+
+
+
+
+
+
+
+
+
+
+
+ :
+
+
+
+
+
\ No newline at end of file
diff --git a/lib/index_utils2.php b/lib/index_utils2.php
index 4d3c5eb3ad..30760df40e 100644
--- a/lib/index_utils2.php
+++ b/lib/index_utils2.php
@@ -1849,7 +1849,7 @@ function make1subdef($infile, $sd, $physdpath, $infos)
// attention, au cas ou il y aurait des espaces dans le path, il faut des quotes
// windows n'accepte pas les simple quotes
// pour mac les quotes pour les noms de fichiers sont indispensables car si il y a un espace -> ca plante
- $array = array('application/pdf','image/psd','image/vnd.adobe.photoshop','image/photoshop','image/ai','image/illustrator','image/vnd.adobe.illustrator');
+ $array = array('image/tiff', 'application/pdf','image/psd','image/vnd.adobe.photoshop','image/photoshop','image/ai','image/illustrator','image/vnd.adobe.illustrator');
if( in_array($infos['mime'], $array ) )
$cmd .= ' "'.$infile .'[0]" "'. $outfile .'"';
else
diff --git a/templates/web/common/menubar.twig b/templates/web/common/menubar.twig
index 757ad10b91..fedc2af53e 100644
--- a/templates/web/common/menubar.twig
+++ b/templates/web/common/menubar.twig
@@ -46,7 +46,7 @@
{% endif %}
{# MODULE #}
- {% if module == "validation" %}
+ {% if module == "lightbox" %}
{% trans 'admin::monitor: module validation' %}
{% else %}
{% trans 'Aucun document dans la quarantaine actuellement' %}
{% endif %}
+
\ No newline at end of file
diff --git a/www/admin/databases.php b/www/admin/databases.php
index d6f9211cde..e8abbae21c 100644
--- a/www/admin/databases.php
+++ b/www/admin/databases.php
@@ -135,15 +135,14 @@ if($request->has_post_datas() && $user->is_admin === true)
}
}
}
- elseif($parm['mount_base'] && $parm['new_hostname'] && $parm['new_port'] && $parm['new_user']
- && $parm['new_password'] && $parm['new_dbname'])
+ elseif($parm['mount_base'])
{
if(!$parm['new_settings'] && $parm['new_dbname'])
{
if(p4string::hasAccent($parm['new_dbname']))
$error['new_dbname'] = 'No special chars in dbname';
-
+
if(count($error) === 0)
{
if( ($base = new databox()) !== false )
@@ -160,9 +159,8 @@ if($request->has_post_datas() && $user->is_admin === true)
}
}
elseif($parm['new_settings'] && $parm['new_hostname'] && $parm['new_port'] && $parm['new_user']
- && $parm['new_password'] && $parm['new_dbname'] && $parm['new_data_template'])
+ && $parm['new_password'] && $parm['new_dbname'])
{
-
if(p4string::hasAccent($parm['new_dbname']))
$error['new_dbname'] = 'No special chars in dbname';
@@ -170,7 +168,7 @@ if($request->has_post_datas() && $user->is_admin === true)
{
if( ($base = new databox(false,$parm['new_hostname'],$parm['new_port'],$parm['new_user'],$parm['new_password'])) !== false )
{
- if($base->mount($parm['new_dbname']))
+ if($base->mount($parm['new_dbname'], $usr_id))
{
$sbas_id = $base->save($usr_id);
@@ -181,12 +179,12 @@ if($request->has_post_datas() && $user->is_admin === true)
$base->registerAdminThesaurus($usr_id, true);
$base->registerPublication($usr_id, true);
$mountBase = true;
- }
- }
- }
- }
- }
- }
+ }
+ }
+ }
+ }
+ }
+ }
}
diff --git a/www/admin/structure.php b/www/admin/structure.php
index 57fb042c94..8838248970 100644
--- a/www/admin/structure.php
+++ b/www/admin/structure.php
@@ -92,19 +92,30 @@ if($connbas)
if($parm["act"]=="CHGSTRUCTURE")
{
$errors = databox::get_structure_errors($parm["str"]);
- if(count($errors) == 0 && $domst = @DOMDocument::loadXML($parm["str"])) // simplexml_load_string($parm["str"]))
+ if(count($errors) == 0)
{
- $domst->documentElement->setAttribute("modification_date", $now = date("YmdHis"));
-
- $sql = "UPDATE pref SET value='" . $conn->escape_string($parm["str"] = $domst->saveXML()) . "', updated_on='" . $now . "' WHERE prop='structure'" ;
- $connbas->query($sql);
-
- $cache_appbox = cache_appbox::getInstance();
- $cache_appbox->delete('list_bases');
-
- cache_databox::update($parm["p0"],'structure');
+ $domst = new DOMDocument('1.0', 'UTF-8');
+ $domst->preserveWhiteSpace = false;
+ $domst->formatOutput = true;
+ if(@$domst->loadXML($parm["str"]))
+ {
+ $domst->documentElement->setAttribute("modification_date", $now = date("YmdHis"));
+
+ $sql = "UPDATE pref SET value='" . $conn->escape_string($parm["str"] = $domst->saveXML()) . "', updated_on='" . $now . "' WHERE prop='structure'" ;
+ $connbas->query($sql);
+
+ $cache_appbox = cache_appbox::getInstance();
+ $cache_appbox->delete('list_bases');
+
+ cache_databox::update($parm["p0"],'structure');
+ }
+ else
+ {
+ $errors[] = "Error loadXML(structure)";
+ }
}
- else
+
+ if(count($errors) != 0)
{
$msg .= p4string::MakeString(_('admin::base: xml invalide, les changements ne seront pas appliques'), 'js') . "" ;
$loadit = false;
diff --git a/www/client/index.php b/www/client/index.php
index e95d11d596..5ebba40c27 100644
--- a/www/client/index.php
+++ b/www/client/index.php
@@ -662,7 +662,7 @@ if($cssfile)
-
+
+
';
break;
case 'video':
- $embed = '
';
+ $embed = '
';
break;
case 'document':
$embed = '
diff --git a/www/include/sendmailpage.php b/www/include/sendmailpage.php
index d40b508185..4729550f2b 100644
--- a/www/include/sendmailpage.php
+++ b/www/include/sendmailpage.php
@@ -52,7 +52,8 @@ $list = $download->prepare_export($parm['obj'], $titre);
$list['export_name'] = $exportname.'.zip';
-$endDate = phraseadate::format_mysql(new DateTime('+1 day'));
+$endate_obj = new DateTime('+1 day');
+$endDate = phraseadate::format_mysql($endate_obj);
$token = random::getUrlToken('download',false,$endDate,serialize($list));
@@ -75,7 +76,7 @@ if($parm['reading_confirm'] == '1')
foreach($dest as $email)
{
- if(($result = mail::send_documents(trim($email), $url,$from, $parm["textmail"], $reading_confirm_to))!==true)
+ if(($result = mail::send_documents(trim($email), $url,$from, $endate_obj, $parm["textmail"], $reading_confirm_to))!==true)
$res[] = $email;
}
diff --git a/www/lightbox/validator.php b/www/lightbox/validator.php
index 8e7a5ef7a9..90a7ca23ce 100644
--- a/www/lightbox/validator.php
+++ b/www/lightbox/validator.php
@@ -51,7 +51,7 @@ try
'baskets_collection' => $basket_collection,
'basket' => $basket,
'local_title' => strip_tags($basket->name),
- 'module' => 'validation',
+ 'module' => 'lightbox',
'module_name' => _('admin::monitor: module validation')
)
);
diff --git a/www/login/homepubli.php b/www/login/homepubli.php
index cf3a08e163..93576526c8 100644
--- a/www/login/homepubli.php
+++ b/www/login/homepubli.php
@@ -26,10 +26,10 @@ $item = $defaultchannel->appendChild($defaultdom->createElement('item'));
$title = $item->appendChild($defaultdom->createElement('title'));
$title->appendChild($defaultdom->createTextNode(GV_homeTitle));
-if(file_exists(GV_RootPath.'config/home.jpg'))
+if(file_exists(GV_RootPath.'www/custom/home.jpg'))
{
- $pathPic = GV_RootPath.'config/home.jpg';
- $urlPic = '/config/home.jpg';
+ $pathPic = GV_RootPath.'www/custom/home.jpg';
+ $urlPic = '/custom/home.jpg';
}
else
{
diff --git a/www/prod/answer.php b/www/prod/answer.php
index a0cde382e3..c242421e1f 100644
--- a/www/prod/answer.php
+++ b/www/prod/answer.php
@@ -1,233 +1,233 @@
get_parms("bas", "qry", "pag"
- , "sel", "ord"
- , "search_type", "recordtype", "status", "fields", "datemin", "datemax", "datefield");
+if (!isset($parm))
+ $parm = $request->get_parms("bas", "qry", "pag"
+ , "sel", "ord"
+ , "search_type", "recordtype", "status", "fields", "datemin", "datemax", "datefield");
-
-if(isset($session->usr_id) && isset($session->ses_id))
+
+if (isset($session->usr_id) && isset($session->ses_id))
{
- $ses_id = $session->ses_id;
- $usr_id = $session->usr_id;
- if(!($ph_session = phrasea_open_session((int)$ses_id, $usr_id)))
- {
- header("Location: /login/?err=no-session");
- exit();
- }
+ $ses_id = $session->ses_id;
+ $usr_id = $session->usr_id;
+ if (!($ph_session = phrasea_open_session((int) $ses_id, $usr_id)))
+ {
+ header("Location: /login/?err=no-session");
+ exit();
+ }
}
else
{
- $request = httpRequest::getInstance();
- if($request->is_ajax())
- {
- echo _('Votre session est expiree, veuillez vous reconnecter');
- }
- else
- {
- header("Location: /login/");
- }
- exit();
+ $request = httpRequest::getInstance();
+ if ($request->is_ajax())
+ {
+ echo _('Votre session est expiree, veuillez vous reconnecter');
+ }
+ else
+ {
+ header("Location: /login/");
+ }
+ exit();
}
-
-if(!($ph_session = phrasea_open_session($ses_id,$usr_id)))
+
+if (!($ph_session = phrasea_open_session($ses_id, $usr_id)))
{
- die();
+ die();
}
-if($parm["ord"]===NULL)
- $parm["ord"] = PHRASEA_ORDER_DESC;
+if ($parm["ord"] === NULL)
+ $parm["ord"] = PHRASEA_ORDER_DESC;
else
- $parm["ord"] = (int)$parm["ord"];
-
-$parm['sel'] = explode(';',$parm['sel']);
+ $parm["ord"] = (int) $parm["ord"];
-if(!$parm['bas'])
- $parm['bas'] = array();
+$parm['sel'] = explode(';', $parm['sel']);
-if(!$parm["pag"]===NULL)
- $parm["pag"] = "0";
-
-if(trim($parm["qry"])==='')
- $parm["qry"] = "all";
+if (!$parm['bas'])
+ $parm['bas'] = array();
+
+if (!$parm["pag"] === NULL)
+ $parm["pag"] = "0";
+
+if (trim($parm["qry"]) === '')
+ $parm["qry"] = "all";
$mod = user::getPrefs('view');
$options = array(
- 'type' => $parm['search_type'],
- 'bases' => $parm['bas'],
- 'champs' => $parm['fields'],
- 'status' => $parm['status'],
- 'date' => array(
- 'minbound'=>$parm['datemin'],
- 'maxbound'=>$parm['datemax'],
- 'field'=>explode('|',$parm['datefield'])
- )
+ 'type' => $parm['search_type'],
+ 'bases' => $parm['bas'],
+ 'champs' => $parm['fields'],
+ 'status' => $parm['status'],
+ 'date' => array(
+ 'minbound' => $parm['datemin'],
+ 'maxbound' => $parm['datemax'],
+ 'field' => explode('|', $parm['datefield'])
+ )
);
-if($parm['recordtype'] != '' && in_array($parm['recordtype'],array('image','video','audio','document','flash')))
+if ($parm['recordtype'] != '' && in_array($parm['recordtype'], array('image', 'video', 'audio', 'document', 'flash')))
{
- $parm['qry'] .= ' AND recordtype='.$parm['recordtype'];
+ $parm['qry'] .= ' AND recordtype=' . $parm['recordtype'];
}
$query = new query($options);
-$result = $query->results($parm['qry'], $parm["pag"]);//$parm['search_type'],
+
+$result = $query->results($parm['qry'], $parm["pag"]); //$parm['search_type'],
$proposals = trim($parm['pag']) === '' ? $query->proposals() : false;
-
$npages = $result['pages'];
$page = $result['current_page'];
-$string ='';
+$string = '';
- if($npages>1)
- {
-
- $d2top = ($npages - $page);
- $d2bottom = $page;
-
- if(min($d2top,$d2bottom) < 4)
- {
- if($d2bottom < 4)
- {
- for($i=1;($i<=4 && (($i<=$npages)===true));$i++)
- {
- if($i == $page)
- $string .= ' ';
- else
- $string .= "".$i." ";
- }
- if($npages >4)
- $string .= ">> ";
- }
- else
- {
- $start = $npages-4;
- if(($start)>0)
- $string .= "<< ";
- else
- $start = 1;
- for($i=($start);$i<=$npages;$i++)
- {
- if($i == $page)
- $string .= ' ';
- else
- $string .= "".$i." ";
- }
- }
- }
- else
- {
- $string .= "<< ";
-
- for($i=($page-2);$i<=($page+2);$i++)
- {
- if($i == $page)
- $string .= ' ';
- else
- $string .= "".$i." ";
- }
-
- $string .= ">> ";
-
- }
-
-
-
- }
- $string .= '';
-
-
- $explain = $result['explain'];
-
- $infoResult = ' | '.sprintf(_('reponses:: %d reponses'),$session->prod['query']['nba']).' | '.sprintf(_('reponses:: %s documents selectionnes'),' ');
+if ($npages > 1)
+{
- echo "";
- echo "";
-
- $rsScreen = $result['result'];
-
- if(count($rsScreen)>0)
- {
- if($mod == 'thumbs')
- require("answergrid.php");
- else
- require("answerlist.php");
- }
- else
- {
- echo '';
- phrasea::getHome('HELP','prod');
- echo '
';
- }
-
+ $d2top = ($npages - $page);
+ $d2bottom = $page;
+
+ if (min($d2top, $d2bottom) < 4)
+ {
+ if ($d2bottom < 4)
+ {
+ for ($i = 1; ($i <= 4 && (($i <= $npages) === true)); $i++)
+ {
+ if ($i == $page)
+ $string .= ' ';
+ else
+ $string .= "" . $i . " ";
+ }
+ if ($npages > 4)
+ $string .= ">> ";
+ }
+ else
+ {
+ $start = $npages - 4;
+ if (($start) > 0)
+ $string .= "<< ";
+ else
+ $start = 1;
+ for ($i = ($start); $i <= $npages; $i++)
+ {
+ if ($i == $page)
+ $string .= ' ';
+ else
+ $string .= "" . $i . " ";
+ }
+ }
+ }
+ else
+ {
+ $string .= "<< ";
+
+ for ($i = ($page - 2); $i <= ($page + 2); $i++)
+ {
+ if ($i == $page)
+ $string .= ' ';
+ else
+ $string .= "" . $i . " ";
+ }
+
+ $string .= ">> ";
+ }
+}
+$string .= '';
+
+$explain = $result['explain'];
+
+$infoResult = ' | ' . sprintf(_('reponses:: %d reponses'), $session->prod['query']['nba']) . ' | ' . sprintf(_('reponses:: %s documents selectionnes'), ' ');
+
+echo "";
+echo "";
+
+$rsScreen = $result['result'];
+
+if (count($rsScreen) > 0)
+{
+ if ($mod == 'thumbs')
+ require("answergrid.php");
+ else
+ require("answerlist.php");
+}
+else
+{
+ echo '';
+ phrasea::getHome('HELP', 'prod');
+ echo '
';
+}
function proposalsToHTML(&$proposals)
{
- $html = "";
-
- $nbasesWprop = count($proposals["BASES"]);
-
- $b = 0;
- foreach($proposals["BASES"] as $zbase)
- {
- if((int)(count($zbase["TERMS"]) > 0))
- {
- if(($nbasesWprop > 1))
- {
- $style = $b==0 ? "style=\"margin-top:0px;\"":"";
- $html .= "
". sprintf(_('reponses::propositions pour la base %s'),$zbase["NAME"])." ";
- }
- $t = 0;
- foreach($zbase["TERMS"] as $path=>$props)
- {
- $style = $t==0 ? "style=\"margin-top:0px;\"":"";
- $html .= "" . sprintf(_('reponses::propositions pour le terme %s'), $props["TERM"]) . " ";
- $html .= $props["HTML"];
- $t++;
- }
- $b++;
- }
- }
- $html .= "";
- return($html);
+ $html = "";
+
+ $nbasesWprop = count($proposals["BASES"]);
+
+ $b = 0;
+ foreach ($proposals["BASES"] as $zbase)
+ {
+ if ((int) (count($zbase["TERMS"]) > 0))
+ {
+ if (($nbasesWprop > 1))
+ {
+ $style = $b == 0 ? "style=\"margin-top:0px;\"" : "";
+ $html .= "
" . sprintf(_('reponses::propositions pour la base %s'), $zbase["NAME"]) . " ";
+ }
+ $t = 0;
+ foreach ($zbase["TERMS"] as $path => $props)
+ {
+ $style = $t == 0 ? "style=\"margin-top:0px;\"" : "";
+ $html .= "" . sprintf(_('reponses::propositions pour le terme %s'), $props["TERM"]) . " ";
+ $html .= $props["HTML"];
+ $t++;
+ }
+ $b++;
+ }
+ }
+ $html .= "";
+ return($html);
}
?>
diff --git a/www/prod/edit.php b/www/prod/edit.php
index 318d3bc91b..1b61adff12 100644
--- a/www/prod/edit.php
+++ b/www/prod/edit.php
@@ -910,7 +910,7 @@ function HTML_Thesaurus(&$html)
$class_status = '';
}
?>
-
+
diff --git a/www/prod/index.php b/www/prod/index.php
index a9ea97b32d..3289b14728 100644
--- a/www/prod/index.php
+++ b/www/prod/index.php
@@ -769,13 +769,15 @@ $rss_infos = user::getMyRss();
-
+
+
+
@@ -783,6 +785,7 @@ $rss_infos = user::getMyRss();
+
@@ -1245,6 +1248,17 @@ $rss_infos = user::getMyRss();
?>
+
+
+
-
-
-
diff --git a/www/prod/jquery.edit.js b/www/prod/jquery.edit.js
index 578f2b6734..ff56d1a7a7 100644
--- a/www/prod/jquery.edit.js
+++ b/www/prod/jquery.edit.js
@@ -852,7 +852,7 @@ function edit_clk_editimg(evt, i)
}
}
- $('#TH_Opreview .PNB10').empty();
+ empty_preview_edit();
var selected = $('#EDIT_FILM2 .diapo.selected');
if(selected.length == 1)
@@ -1234,6 +1234,7 @@ function edit_applyMultiDesc(evt)
var sendorder = "";
var sendChuOrder = "";
+ empty_preview_edit();
var t = "";
if(p4.edit.textareaIsDirty && edit_validField(evt, "ask_ok")==false)
@@ -1334,7 +1335,7 @@ function edit_applyMultiDesc(evt)
function edit_cancelMultiDesc(evt)
{
-
+ empty_preview_edit();
var dirty = false;
evt.cancelBubble = true;
@@ -1502,6 +1503,7 @@ function EditThesaurusSeeker(sbas_id)
this.jq = $.ajax({
url: url,
data: parms,
+ type:'POST',
success: function(ret)
{
me.TH_P_node.html("...");
@@ -1855,7 +1857,7 @@ function vsplit2()
function setPreviewEdit()
{
- if(!$('#EDITWINDOW').is(':visible'))
+ if(!$('#TH_Opreview').is(':visible'))
return false;
var selected = $('#EDIT_FILM2 .diapo.selected');
@@ -1936,10 +1938,21 @@ function setPreviewEdit()
}
+function empty_preview_edit()
+{
+ var el = $('#TH_Opreview .PNB10 object').parent();
+ if(el.parent().attr('id') != 'TH_Opreview')
+ {
+ el.empty();
+ el.remove();
+ }
+ $('#TH_Opreview .PNB10').empty();
+}
+
function previewEdit(r)
{
-
- $('#TH_Opreview .PNB10').empty().append(p4.edit.T_records[r].preview.preview);
+ empty_preview_edit();
+ $('#TH_Opreview .PNB10').append(p4.edit.T_records[r].preview.preview);
var data = p4.edit.T_records[r].preview;
@@ -1964,7 +1977,7 @@ function previewEdit(r)
}
else
{
- flowplayer("FLASHPREVIEW", '/include/flowplayer/flowplayer-3.2.2.swf',{
+ flowplayer("rolloverpreview", '/include/flowplayer/flowplayer-3.2.6.swf',{
clip: {
autoPlay: true,
autoBuffering:true,
@@ -1978,7 +1991,7 @@ function previewEdit(r)
},
plugins: {
h264streaming: {
- url: '/include/flowplayer/flowplayer.pseudostreaming-3.2.2.swf'
+ url: '/include/flowplayer/flowplayer.pseudostreaming-3.2.6.swf'
}
}
});
@@ -2000,7 +2013,22 @@ function startThisEditing(sbas_id,what,regbasprid,ssel)
p4.edit.regbasprid = regbasprid;
p4.edit.ssel = ssel;
- $('#EDIT_MID_R .tabs').tabs();
+ $('#EDIT_MID_R .tabs').tabs(
+ {
+ select: function(event, ui)
+ {
+ var bloc = $('#EDIT_FILM2 .diapo.video_bloc .previewTips');
+ if($(ui.panel).attr('id') == 'TH_Opreview')
+ {
+ bloc.hide();
+ }
+ else
+ {
+ bloc.show();
+ }
+ }
+ }
+ );
$('#divS div.edit_field:odd').addClass('odd');
$('#divS div').bind('mouseover',function(){
diff --git a/www/prod/newtemporary.php b/www/prod/newtemporary.php
index 5be42c971b..9ce8ad4572 100644
--- a/www/prod/newtemporary.php
+++ b/www/prod/newtemporary.php
@@ -30,8 +30,8 @@ if($request->has_post_datas())
$parm = $request->get_parms('name', 'type', 'desc', 'lst', 'coll');
if(trim($parm['name']) != '')
- {
- if(is_null($parm['type']) || $parm['type']=="CHU")
+ {
+ if(is_null($parm['type']) || $parm['type']=="CHU")
{
try
{
@@ -61,7 +61,7 @@ if($request->has_post_datas())
try{
$story = new basket();
$story->name = $parm['name'];
- $story->desc = $parm['desc'];
+ $story->desc = strip_tags(str_replace(' ',"\n",$parm['desc']));
$story->is_grouping = true;
$story->base_id = $parm['coll'];
$story->save();
diff --git a/www/prod/share.php b/www/prod/share.php
index c37251f019..25ea596309 100644
--- a/www/prod/share.php
+++ b/www/prod/share.php
@@ -114,7 +114,7 @@ $right = false;
switch($type)
{
case 'video':
- $embed = ''.
+ $embed = ''.
' '.
' '.
' '.
diff --git a/www/prod/thesaurus.php b/www/prod/thesaurus.php
index 896c27003e..34f1813983 100644
--- a/www/prod/thesaurus.php
+++ b/www/prod/thesaurus.php
@@ -184,13 +184,14 @@ function T_filter_delayed2(f, delay, mode)
var zurl = "/xmlhttp/search_th_term_prod.j.php"
+ "?sbid=" + sbas[i].sbid
+ "&t=" + encodeURIComponent(f);
- sbas[i].seeker = $.get(
- zurl,
- [],
- function(j, status)
- {
- if(status == 'success')
- {
+
+ sbas[i].seeker = $.ajax({
+ url: zurl,
+ type:'POST',
+ data: [],
+ dataType:'json',
+ success: function(j)
+ {
var z = '#TX_P\\.' + j.parm['sbid'] + '\\.T';
var o = $(z);
@@ -200,10 +201,17 @@ function T_filter_delayed2(f, delay, mode)
if(isLast)
$(z).addClass('last');
- }
- },
- "json"
- );
+ },
+ error:function(){
+
+ },
+ timeout:function(){
+
+ }
+ });
+
+
+
}
}
else if(mode=='CANDIDATE')
@@ -219,13 +227,13 @@ function T_filter_delayed2(f, delay, mode)
zurl += "&t=" + encodeURIComponent(f)
+ "&field=" + encodeURIComponent(trees.C._selInfos.field);
}
- sbas[i].seeker = $.get(
- zurl,
- [],
- function(j, status)
- {
- if(status == 'success')
- {
+ sbas[i].seeker = $.ajax({
+ url: zurl,
+ type:'POST',
+ data: [],
+ dataType:'json',
+ success: function(j)
+ {
var z = '#TX_P\\.' + j.parm['sbid'] + '\\.T';
var o = $(z);
@@ -235,10 +243,15 @@ function T_filter_delayed2(f, delay, mode)
if(isLast)
$(z).addClass('last');
- }
- },
- "json"
- );
+ },
+ error:function(){
+
+ },
+ timeout:function(){
+
+ }
+ });
+
}
}
},
@@ -358,6 +371,8 @@ function T_acceptCandidates_OK(dlgnode)
// $("#THPD_confirm_accept_dlg_msg").dialog("close");
},
+ error:function(){},
+ timeout:function(){},
_ret: null // private alchemy
};
@@ -878,40 +893,12 @@ function replaceEditSel(value)
return;
}
-function crossBrowser_XMLHttpRequest()
-{
- var xmlhttp=false;
- var e;
- try
- {
- xmlhttp=new XMLHttpRequest();
- }
- catch(e)
- {
- try
- {
- xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
- }
- catch(e)
- {
- try
- {
- xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
- }
- catch(e)
- {
- xmlhttp=false;
- }
- }
- }
- return xmlhttp;
-}
function ThesauThesaurusSeeker(sbas_id)
{
this.sbas_id = sbas_id;
this._ctimer = null;
- this._xmlhttp = new crossBrowser_XMLHttpRequest();
+ this._xmlhttp = null;
this.tObj = { 'TH_searching':null , 'TH_P':null , 'TH_K':null };
this.search = function(txt) {
if(this._ctimer)
@@ -921,69 +908,100 @@ function ThesauThesaurusSeeker(sbas_id)
} ;
this.search_delayed = function(txt) {
var me = this;
- this._xmlhttp.abort();
+ if($this._xmlttp.abort && typeof $this._xmlttp.abort == 'function')
+ {
+ this._xmlhttp.abort();
+ }
var url = "/xmlhttp/openbranches_prod.x.php";
- var parms = "bid=" + this.sbas_id + "&lng=" + "&t=" + encodeURIComponent(txt);
- parms += "&mod=TREE";
- this._xmlhttp.open("POST", url, true); // yes, BEFORE setting callback
- this._xmlhttp.onreadystatechange = function() { me.xmlhttpstatechanged(); } ;
- this._xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
- this._xmlhttp.send(parms);
+ var parms = {
+ bid : this.sbas_id,
+ lng : "",
+ t : txt,
+ mod : "TREE"
+ };
+
+ this._xmlhttp = $.ajax({
+ url: url,
+ type:'POST',
+ data: parms,
+ success: function(ret)
+ {
+ me.xmlhttpstatechanged(ret);
+ },
+ error:function(){
+
+ },
+ timeout:function(){
+
+ }
+ });
+
this._ctimer = null;
} ;
this.openBranch = function(id, thid) {
var me = this;
- this._xmlhttp.abort();
+ if($this._xmlttp.abort && typeof $this._xmlttp.abort == 'function')
+ {
+ this._xmlhttp.abort();
+ }
var url = "/xmlhttp/getterm_prod.x.php";
- var parms = "bid=" + sbas_id;
- parms += "&lng=";
- parms += "&sortsy=1";
- parms += "&id=" + thid;
- parms += "&typ=TH";
- this._xmlhttp.open("POST", url, true); // yes, BEFORE setting callback
- this._xmlhttp.onreadystatechange = function() { me.xmlhttpstatechanged(id); } ;
- this._xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
- this._xmlhttp.send(parms);
+ var parms = {
+ bid : this.sbas_id,
+ lng : "",
+ sortsy : 1,
+ id : thid,
+ typ : "TH"
+ }
+
+ this._xmlhttp = $.ajax({
+ url: url,
+ type:'POST',
+ data: parms,
+ success: function(ret)
+ {
+ me.xmlhttpstatechanged(ret, id);
+ },
+ error:function(){
+
+ },
+ timeout:function(){
+
+ }
+ });
+
};
- this.xmlhttpstatechanged = function(id) {
+ this.xmlhttpstatechanged = function(ret, id) {
try
{
- if (this._xmlhttp.readyState==4)
- {
- if(!this.tObj["TH_searching"])
- this.tObj["TH_searching"] = document.getElementById("TH_searching");
- this.tObj["TH_searching"].src = "/skins/icons/ftp-loader-blank.gif";
-
- if (this._xmlhttp.status==200)
- {
- var ret = this._xmlhttp.responseXML;
- if(ret) // && (typeof(ret.parsed)=="undefined" || ret.parsed))
- {
- var htmlnodes = ret.getElementsByTagName("html");
- if(htmlnodes && htmlnodes.length==1 && (htmlnode=htmlnodes.item(0).firstChild))
- {
- if(typeof(id)=="undefined")
- {
- // called from search or 'auto' : full thesaurus search
- if(!this.tObj["TH_P"])
- this.tObj["TH_P"] = document.getElementById("TH_P."+this.sbas_id+".T");
- if(!this.tObj["TH_K"])
- this.tObj["TH_K"] = document.getElementById("TH_K."+this.sbas_id+".T");
- this.tObj["TH_P"].innerHTML = "...";
- this.tObj["TH_K"].className = "h";
- this.tObj["TH_K"].innerHTML = htmlnode.nodeValue;
- }
- else
- {
- // called from 'openBranch'
- // var js = "document.getElementById('TH_K."+thid+"').innerHTML = \""+htmlnode.nodeValue+"\"";
- // self.setTimeout(js, 10);
- document.getElementById("TH_K."+id).innerHTML = htmlnode.nodeValue;
- }
- }
- }
- }
- }
+ if(!this.tObj["TH_searching"])
+ this.tObj["TH_searching"] = document.getElementById("TH_searching");
+ this.tObj["TH_searching"].src = "/skins/icons/ftp-loader-blank.gif";
+
+ if(ret) // && (typeof(ret.parsed)=="undefined" || ret.parsed))
+ {
+ var htmlnodes = ret.getElementsByTagName("html");
+ if(htmlnodes && htmlnodes.length==1 && (htmlnode=htmlnodes.item(0).firstChild))
+ {
+ if(typeof(id)=="undefined")
+ {
+ // called from search or 'auto' : full thesaurus search
+ if(!this.tObj["TH_P"])
+ this.tObj["TH_P"] = document.getElementById("TH_P."+this.sbas_id+".T");
+ if(!this.tObj["TH_K"])
+ this.tObj["TH_K"] = document.getElementById("TH_K."+this.sbas_id+".T");
+ this.tObj["TH_P"].innerHTML = "...";
+ this.tObj["TH_K"].className = "h";
+ this.tObj["TH_K"].innerHTML = htmlnode.nodeValue;
+ }
+ else
+ {
+ // called from 'openBranch'
+ // var js = "document.getElementById('TH_K."+thid+"').innerHTML = \""+htmlnode.nodeValue+"\"";
+ // self.setTimeout(js, 10);
+ document.getElementById("TH_K."+id).innerHTML = htmlnode.nodeValue;
+ }
+ }
+ }
}
catch(err)
{