mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-12 20:43:25 +00:00
Update 3.1.4
This commit is contained in:
@@ -71,7 +71,7 @@ class answer
|
|||||||
$preview = '/include/directprev.php%3F'."bas%3D".$base_id."%26rec%3D".$record_id;
|
$preview = '/include/directprev.php%3F'."bas%3D".$base_id."%26rec%3D".$record_id;
|
||||||
|
|
||||||
$JS_roll = '<div class="imgTips" style="z-index:99;width:'.((int)$sd["preview"]["width"]+10).'px;height:'.((int)$sd["preview"]["height"]+10).'px" id="rolloverpreview"></div>
|
$JS_roll = '<div class="imgTips" style="z-index:99;width:'.((int)$sd["preview"]["width"]+10).'px;height:'.((int)$sd["preview"]["height"]+10).'px" id="rolloverpreview"></div>
|
||||||
<script type="text/javascript">flowplayer("rolloverpreview", {src:"/include/flowplayer/flowplayer-3.2.2.swf", wmode: "transparent"}, {clip:{url:"'.$preview.'",autoPlay: true,autoBuffering:true,provider: "h264streaming",scaling:"fit"}, onError:function(code,message){getNewVideoToken('.$base_id.', '.$record_id.', this);},plugins: {h264streaming: {url: "/include/flowplayer/flowplayer.pseudostreaming-3.2.2.swf"}}});</script>';
|
<script type="text/javascript">flowplayer("rolloverpreview", {src:"/include/flowplayer/flowplayer-3.2.6.swf", wmode: "transparent"}, {clip:{url:"'.$preview.'",autoPlay: true,autoBuffering:true,provider: "h264streaming",scaling:"fit"}, onError:function(code,message){getNewVideoToken('.$base_id.', '.$record_id.', this);},plugins: {h264streaming: {url: "/include/flowplayer/flowplayer.pseudostreaming-3.2.6.swf"}}});</script>';
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -256,12 +256,12 @@ class answer
|
|||||||
$token = md5(time().mt_rand(100000,999999));
|
$token = md5(time().mt_rand(100000,999999));
|
||||||
|
|
||||||
$html_view = '<div class="record record_video" style="width:'.$width.'px;height:'.$height.'px;">
|
$html_view = '<div class="record record_video" style="width:'.$width.'px;height:'.$height.'px;">
|
||||||
<div id="preview_'.$base_id.'_'.$record_id.'_'.$token.'" class="PNB" style=""></div>
|
<div id="rolloverpreview" class="PNB" style=""></div>
|
||||||
<input type="hidden" name="width" value="'.$width.'"/>
|
<input type="hidden" name="width" value="'.$width.'"/>
|
||||||
<input type="hidden" name="height" value="'.$height.'"/>
|
<input type="hidden" name="height" value="'.$height.'"/>
|
||||||
</div><script type="text/javascript">flowplayer("preview_'.$base_id.'_'.$record_id.'_'.$token.'",{src:"/include/flowplayer/flowplayer-3.2.2.swf", wmode: "transparent"},{clip:{url:"'.$preview.'",autoPlay: true,autoBuffering:true,provider: "h264streaming",scaling:"fit"},onError:function(code,message){getNewVideoToken('.$base_id.', '.$record_id.', this);},plugins: {h264streaming: {url: "/include/flowplayer/flowplayer.pseudostreaming-3.2.2.swf"}}});</script>';
|
</div><script type="text/javascript">flowplayer("rolloverpreview",{src:"/include/flowplayer/flowplayer-3.2.6.swf", wmode: "transparent"},{clip:{url:"'.$preview.'",autoPlay: true,autoBuffering:true,provider: "h264streaming",scaling:"fit"},onError:function(code,message){getNewVideoToken('.$base_id.', '.$record_id.', this);},plugins: {h264streaming: {url: "/include/flowplayer/flowplayer.pseudostreaming-3.2.6.swf"}}});</script>';
|
||||||
|
|
||||||
$preview = '<div id="FLASHPREVIEW" class="PREVIEW_PIC" style="margin:0 auto;width: 600px; height: 300px;" ></div>';
|
$preview = '<div id="rolloverpreview" class="PREVIEW_PIC" style="margin:0 auto;width: 600px; height: 300px;" ></div>';
|
||||||
// $width = $height = '200';
|
// $width = $height = '200';
|
||||||
}
|
}
|
||||||
elseif(in_array($sdMain[$typedoc]['mime'],$gviewer_docs))
|
elseif(in_array($sdMain[$typedoc]['mime'],$gviewer_docs))
|
||||||
@@ -453,7 +453,6 @@ class answer
|
|||||||
|
|
||||||
$basesettings = phrasea::load_settings($locale);
|
$basesettings = phrasea::load_settings($locale);
|
||||||
|
|
||||||
|
|
||||||
$captions = _('reponses::record::Pas de description');
|
$captions = _('reponses::record::Pas de description');
|
||||||
|
|
||||||
$xsl = '';
|
$xsl = '';
|
||||||
@@ -470,8 +469,8 @@ class answer
|
|||||||
if($dom_doc->loadXML($xml))
|
if($dom_doc->loadXML($xml))
|
||||||
{
|
{
|
||||||
$XPATH_thesaurus = databox::get_xpath_thesaurus($sbas_id);
|
$XPATH_thesaurus = databox::get_xpath_thesaurus($sbas_id);
|
||||||
|
|
||||||
$XPATH_struct = databox::get_xpath_structure($sbas_id);
|
$XPATH_struct = databox::get_xpath_structure($sbas_id);
|
||||||
|
|
||||||
$DOM_thFields = array();
|
$DOM_thFields = array();
|
||||||
|
|
||||||
if($XPATH_struct)
|
if($XPATH_struct)
|
||||||
@@ -496,16 +495,16 @@ class answer
|
|||||||
$context_noacc = noaccent_utf8($context_noacc, PARSED);
|
$context_noacc = noaccent_utf8($context_noacc, PARSED);
|
||||||
if($context_noacc)
|
if($context_noacc)
|
||||||
{
|
{
|
||||||
$q = "($tbranch)//sy[@w='".$term_noacc."' and @k='".$context_noacc."']";
|
$q = "//sy[@w='".$term_noacc."' and @k='".$context_noacc."']";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$q = "($tbranch)//sy[@w='".$term_noacc."' and not(@k)]";
|
$q = "//sy[@w='".$term_noacc."' and not(@k)]";
|
||||||
}
|
}
|
||||||
$t = "";
|
$t = "";
|
||||||
foreach($DOM_branchs as $DOM_branch)
|
foreach($DOM_branchs as $DOM_branch)
|
||||||
{
|
{
|
||||||
$nodes = $XPATH_thesaurus->query($q, $DOM_branch);
|
$nodes = $XPATH_thesaurus->cache_query($q, $DOM_branch, $tbranch);
|
||||||
if($nodes->length > 0)
|
if($nodes->length > 0)
|
||||||
{
|
{
|
||||||
$lngfound = false;
|
$lngfound = false;
|
||||||
@@ -529,12 +528,12 @@ class answer
|
|||||||
$t .= "');return(false);\"]]";
|
$t .= "');return(false);\"]]";
|
||||||
$t .= $fvalue;
|
$t .= $fvalue;
|
||||||
$t .= "[[/a]]";
|
$t .= "[[/a]]";
|
||||||
|
|
||||||
$lngfound = true;
|
$lngfound = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$synonyms = $XPATH_thesaurus->query("sy[@lng='" . $session->usr_i18 . "']", $node->parentNode);
|
$synonyms = $XPATH_thesaurus->query("sy[@lng='" . $session->usr_i18n . "']", $node->parentNode);
|
||||||
|
|
||||||
foreach($synonyms as $synonym)
|
foreach($synonyms as $synonym)
|
||||||
{
|
{
|
||||||
$k = $synonym->getAttribute("k");
|
$k = $synonym->getAttribute("k");
|
||||||
@@ -554,7 +553,6 @@ class answer
|
|||||||
$t .= "');return(false);\"]]";
|
$t .= "');return(false);\"]]";
|
||||||
$t .= $link;
|
$t .= $link;
|
||||||
$t .= "[[/a]]";
|
$t .= "[[/a]]";
|
||||||
|
|
||||||
$lngfound = true;
|
$lngfound = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1204,3 +1202,5 @@ class answer
|
|||||||
return($value);
|
return($value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
abstract class base
|
abstract class base
|
||||||
{
|
{
|
||||||
|
|
||||||
var $schema = false;
|
var $schema = false;
|
||||||
var $conn = false;
|
var $conn = false;
|
||||||
var $dbname = false;
|
var $dbname = false;
|
||||||
@@ -11,16 +12,15 @@ abstract class base
|
|||||||
var $host = false;
|
var $host = false;
|
||||||
var $type = false;
|
var $type = false;
|
||||||
|
|
||||||
|
|
||||||
function init_conn()
|
function init_conn()
|
||||||
{
|
{
|
||||||
require dirname( __FILE__ ) . '/../../config/connexion.inc';
|
require dirname(__FILE__) . '/../../config/connexion.inc';
|
||||||
$this->conn = mysql_connect($hostname.":".$port, $user, $password, true);
|
$this->conn = mysql_connect($hostname . ":" . $port, $user, $password, true);
|
||||||
|
|
||||||
mysql_set_charset('utf8',$this->conn);
|
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);
|
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)
|
if ($this->conn !== false)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -31,45 +31,43 @@ abstract class base
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function load_schema($schema_type)
|
function load_schema($schema_type)
|
||||||
{
|
{
|
||||||
$this->schema = false;
|
$this->schema = false;
|
||||||
$structure = simplexml_load_file(dirname(__FILE__)."/../../lib/conf.d/bases_structure.xml");
|
$structure = simplexml_load_file(dirname(__FILE__) . "/../../lib/conf.d/bases_structure.xml");
|
||||||
if($structure !== false)
|
if ($structure !== false)
|
||||||
{
|
{
|
||||||
if($schema_type === 'application_box')
|
if ($schema_type === 'application_box')
|
||||||
$this->schema = $structure->appbox;
|
$this->schema = $structure->appbox;
|
||||||
if($schema_type === 'data_box')
|
if ($schema_type === 'data_box')
|
||||||
$this->schema = $structure->databox;
|
$this->schema = $structure->databox;
|
||||||
}
|
}
|
||||||
return $this->schema !== false ? true : false ;
|
return $this->schema !== false ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function createDb($dbname)
|
function createDb($dbname)
|
||||||
{
|
{
|
||||||
if($this->schema)
|
if ($this->schema)
|
||||||
{
|
{
|
||||||
$sql = 'CREATE DATABASE `'.mysql_real_escape_string($dbname,$this->conn).'` CHARACTER SET utf8 COLLATE utf8_unicode_ci';
|
$sql = 'CREATE DATABASE `' . mysql_real_escape_string($dbname, $this->conn) . '` CHARACTER SET utf8 COLLATE utf8_unicode_ci';
|
||||||
if(mysql_query($sql,$this->conn) || mysql_select_db($dbname,$this->conn))
|
if (mysql_query($sql, $this->conn) || mysql_select_db($dbname, $this->conn))
|
||||||
{
|
{
|
||||||
mysql_select_db($dbname,$this->conn);
|
mysql_select_db($dbname, $this->conn);
|
||||||
|
|
||||||
foreach($this->schema->tables->table as $table)
|
foreach ($this->schema->tables->table as $table)
|
||||||
{
|
{
|
||||||
$this->createTable($table);
|
$this->createTable($table);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->dbname = $dbname;
|
$this->dbname = $dbname;
|
||||||
|
|
||||||
if(defined('GV_version'))
|
if (defined('GV_version'))
|
||||||
$this->setVersion(GV_version);
|
$this->setVersion(GV_version);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -78,169 +76,177 @@ abstract class base
|
|||||||
{
|
{
|
||||||
$field_stmt = $defaults_stmt = array();
|
$field_stmt = $defaults_stmt = array();
|
||||||
|
|
||||||
$create_stmt = "CREATE TABLE `".mysql_real_escape_string($table['name'],$this->conn)."` (";
|
$create_stmt = "CREATE TABLE `" . mysql_real_escape_string($table['name'], $this->conn) . "` (";
|
||||||
|
|
||||||
foreach($table->fields->field as $field){
|
foreach ($table->fields->field as $field)
|
||||||
|
{
|
||||||
|
|
||||||
$isnull=trim($field->null)==""?"NOT NULL":"NULL";
|
$isnull = trim($field->null) == "" ? "NOT NULL" : "NULL";
|
||||||
|
|
||||||
if(trim($field->default) != "" && trim($field->default)!="CURRENT_TIMESTAMP")
|
if (trim($field->default) != "" && trim($field->default) != "CURRENT_TIMESTAMP")
|
||||||
$is_default = " default '".$field->default."'";
|
$is_default = " default '" . $field->default . "'";
|
||||||
elseif(trim($field->default)=="CURRENT_TIMESTAMP")
|
elseif (trim($field->default) == "CURRENT_TIMESTAMP")
|
||||||
$is_default = " default ".$field->default;
|
$is_default = " default " . $field->default;
|
||||||
else
|
else
|
||||||
$is_default = '';
|
$is_default = '';
|
||||||
|
|
||||||
$character_set = '';
|
$character_set = '';
|
||||||
if(in_array(strtolower((string)$field->type),array('text','longtext','mediumtext','tinytext')) || substr(strtolower((string)$field->type), 0, 7) == 'varchar' || in_array(substr(strtolower((string)$field->type), 0, 4), array('char','enum')))
|
if (in_array(strtolower((string) $field->type), array('text', 'longtext', 'mediumtext', 'tinytext')) || substr(strtolower((string) $field->type), 0, 7) == 'varchar' || in_array(substr(strtolower((string) $field->type), 0, 4), array('char', 'enum')))
|
||||||
{
|
{
|
||||||
|
|
||||||
$collation = trim((string)$field->collation) != '' ? trim((string)$field->collation) : 'utf8_unicode_ci';
|
$collation = trim((string) $field->collation) != '' ? trim((string) $field->collation) : 'utf8_unicode_ci';
|
||||||
|
|
||||||
$code = array_pop(array_reverse(explode('_',$collation)));
|
$code = array_pop(array_reverse(explode('_', $collation)));
|
||||||
|
|
||||||
$character_set = ' CHARACTER SET '.$code.' COLLATE ' . $collation ;
|
|
||||||
|
|
||||||
|
$character_set = ' CHARACTER SET ' . $code . ' COLLATE ' . $collation;
|
||||||
}
|
}
|
||||||
|
|
||||||
$field_stmt[] = " `".mysql_real_escape_string($field->name,$this->conn)."` ".$field->type." ".$field->extra." ".$character_set." ".$is_default." ".$isnull."";
|
$field_stmt[] = " `" . mysql_real_escape_string($field->name, $this->conn) . "` " . $field->type . " " . $field->extra . " " . $character_set . " " . $is_default . " " . $isnull . "";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if($table->indexes){
|
if ($table->indexes)
|
||||||
foreach($table->indexes->index as $index){
|
{
|
||||||
switch($index->type){
|
foreach ($table->indexes->index as $index)
|
||||||
|
{
|
||||||
|
switch ($index->type)
|
||||||
|
{
|
||||||
|
|
||||||
case "PRIMARY":{
|
case "PRIMARY":
|
||||||
|
{
|
||||||
$primary_fields = array();
|
$primary_fields = array();
|
||||||
|
|
||||||
foreach($index->fields->field as $field){
|
foreach ($index->fields->field as $field)
|
||||||
$primary_fields[] = "`".mysql_real_escape_string($field,$this->conn)."`";
|
{
|
||||||
|
$primary_fields[] = "`" . mysql_real_escape_string($field, $this->conn) . "`";
|
||||||
}
|
}
|
||||||
|
|
||||||
$field_stmt[] = 'PRIMARY KEY ('.implode(',' , $primary_fields).')';
|
$field_stmt[] = 'PRIMARY KEY (' . implode(',', $primary_fields) . ')';
|
||||||
};break;
|
};
|
||||||
|
break;
|
||||||
|
|
||||||
case "UNIQUE":{
|
case "UNIQUE":
|
||||||
|
{
|
||||||
$unique_fields = array();
|
$unique_fields = array();
|
||||||
|
|
||||||
foreach($index->fields->field as $field){
|
foreach ($index->fields->field as $field)
|
||||||
$unique_fields[] = "`".mysql_real_escape_string($field,$this->conn)."`";
|
{
|
||||||
|
$unique_fields[] = "`" . mysql_real_escape_string($field, $this->conn) . "`";
|
||||||
}
|
}
|
||||||
|
|
||||||
$field_stmt[] = 'UNIQUE KEY `'.mysql_real_escape_string($index->name,$this->conn).'` ('.implode(',',$unique_fields).')';
|
$field_stmt[] = 'UNIQUE KEY `' . mysql_real_escape_string($index->name, $this->conn) . '` (' . implode(',', $unique_fields) . ')';
|
||||||
};break;
|
};
|
||||||
|
break;
|
||||||
|
|
||||||
case "INDEX":{
|
case "INDEX":
|
||||||
|
{
|
||||||
$index_fields = array();
|
$index_fields = array();
|
||||||
|
|
||||||
foreach($index->fields->field as $field){
|
foreach ($index->fields->field as $field)
|
||||||
$index_fields[] = "`".mysql_real_escape_string($field,$this->conn)."`";
|
{
|
||||||
}
|
$index_fields[] = "`" . mysql_real_escape_string($field, $this->conn) . "`";
|
||||||
|
|
||||||
$field_stmt[] = 'KEY `'.mysql_real_escape_string($index->name,$this->conn).'` ('.implode(',',$index_fields).')';
|
|
||||||
};break;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$field_stmt[] = 'KEY `' . mysql_real_escape_string($index->name, $this->conn) . '` (' . implode(',', $index_fields) . ')';
|
||||||
|
};
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($table->defaults){
|
}
|
||||||
foreach($table->defaults->default as $default)
|
if ($table->defaults)
|
||||||
|
{
|
||||||
|
foreach ($table->defaults->default as $default)
|
||||||
{
|
{
|
||||||
|
|
||||||
$k = $v = array();
|
$k = $v = array();
|
||||||
|
|
||||||
foreach($default->data as $data)
|
foreach ($default->data as $data)
|
||||||
{
|
{
|
||||||
$k[] = mysql_real_escape_string($data['key'],$this->conn);
|
$k[] = mysql_real_escape_string($data['key'], $this->conn);
|
||||||
if($k === 'usr_password')
|
if ($k === 'usr_password')
|
||||||
$data = hash('sha256',$data);
|
$data = hash('sha256', $data);
|
||||||
$v[] = mysql_real_escape_string(trim(str_replace(array("\r\n","\r","\n","\t"),'',$data)),$this->conn);
|
$v[] = mysql_real_escape_string(trim(str_replace(array("\r\n", "\r", "\n", "\t"), '', $data)), $this->conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
$k = implode(',',$k);
|
$k = implode(',', $k);
|
||||||
$v = str_ireplace(array('"NOW()"','"null"'),array('NOW()','null'),'"'.implode('","',$v).'"');
|
$v = str_ireplace(array('"NOW()"', '"null"'), array('NOW()', 'null'), '"' . implode('","', $v) . '"');
|
||||||
|
|
||||||
|
|
||||||
$defaults_stmt[] = 'INSERT INTO '.mysql_real_escape_string($table['name'],$this->conn).' ('.$k.') VALUES ('.$v.') ';
|
$defaults_stmt[] = 'INSERT INTO ' . mysql_real_escape_string($table['name'], $this->conn) . ' (' . $k . ') VALUES (' . $v . ') ';
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$engine = mb_strtolower(trim($table->engine));
|
$engine = mb_strtolower(trim($table->engine));
|
||||||
|
|
||||||
$engine = in_array($engine,array('innodb','myisam')) ? $engine : 'innodb';
|
$engine = in_array($engine, array('innodb', 'myisam')) ? $engine : 'innodb';
|
||||||
|
|
||||||
$create_stmt .= implode(',' , $field_stmt);
|
$create_stmt .= implode(',', $field_stmt);
|
||||||
$create_stmt .= ") ENGINE=".$engine." CHARACTER SET utf8 COLLATE utf8_unicode_ci;";
|
$create_stmt .= ") ENGINE=" . $engine . " CHARACTER SET utf8 COLLATE utf8_unicode_ci;";
|
||||||
|
|
||||||
mysql_query($create_stmt,$this->conn);
|
mysql_query($create_stmt, $this->conn);
|
||||||
|
|
||||||
foreach($defaults_stmt as $def)
|
foreach ($defaults_stmt as $def)
|
||||||
{
|
{
|
||||||
mysql_query($def,$this->conn);
|
mysql_query($def, $this->conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function upgradeTable($table)
|
private function upgradeTable($table)
|
||||||
{
|
{
|
||||||
$correct_table = array('fields'=>array(), 'indexes'=>array(), 'collation'=>array());
|
$correct_table = array('fields' => array(), 'indexes' => array(), 'collation' => array());
|
||||||
$alter = $alter_pre = array();
|
$alter = $alter_pre = array();
|
||||||
|
|
||||||
if($table)
|
if ($table)
|
||||||
{
|
{
|
||||||
foreach($table->fields->field as $field)
|
foreach ($table->fields->field as $field)
|
||||||
{
|
{
|
||||||
$expr = trim((string)$field->type);
|
$expr = trim((string) $field->type);
|
||||||
|
|
||||||
|
|
||||||
$_extra = trim((string)$field->extra);
|
$_extra = trim((string) $field->extra);
|
||||||
if($_extra)
|
if ($_extra)
|
||||||
$expr .= ' ' . $_extra;
|
$expr .= ' ' . $_extra;
|
||||||
|
|
||||||
$collation = trim((string)$field->collation) != '' ? trim((string)$field->collation) : 'utf8_unicode_ci';
|
$collation = trim((string) $field->collation) != '' ? trim((string) $field->collation) : 'utf8_unicode_ci';
|
||||||
|
|
||||||
if(in_array(strtolower((string)$field->type),array('text','longtext','mediumtext','tinytext')) || substr(strtolower((string)$field->type), 0, 7) == 'varchar' || in_array(substr(strtolower((string)$field->type), 0, 4), array('char','enum')))
|
if (in_array(strtolower((string) $field->type), array('text', 'longtext', 'mediumtext', 'tinytext')) || substr(strtolower((string) $field->type), 0, 7) == 'varchar' || in_array(substr(strtolower((string) $field->type), 0, 4), array('char', 'enum')))
|
||||||
{
|
{
|
||||||
$code = array_pop(array_reverse(explode('_',$collation)));
|
$code = array_pop(array_reverse(explode('_', $collation)));
|
||||||
|
|
||||||
$collation = ' CHARACTER SET '.$code.' COLLATE ' . $collation ;
|
$collation = ' CHARACTER SET ' . $code . ' COLLATE ' . $collation;
|
||||||
|
|
||||||
$correct_table['collation'][trim((string)$field->name)] = $collation ;
|
$correct_table['collation'][trim((string) $field->name)] = $collation;
|
||||||
|
|
||||||
$expr .= $collation;
|
$expr .= $collation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$_null = mb_strtolower(trim((string)$field->null));
|
$_null = mb_strtolower(trim((string) $field->null));
|
||||||
if(!$_null || $_null=='no')
|
if (!$_null || $_null == 'no')
|
||||||
$expr .= ' NOT NULL';
|
$expr .= ' NOT NULL';
|
||||||
|
|
||||||
$_default = (string)$field->default;
|
$_default = (string) $field->default;
|
||||||
if($_default && $_default != 'CURRENT_TIMESTAMP')
|
if ($_default && $_default != 'CURRENT_TIMESTAMP')
|
||||||
$expr .= ' DEFAULT \'' . $_default . '\'';
|
$expr .= ' DEFAULT \'' . $_default . '\'';
|
||||||
elseif($_default == 'CURRENT_TIMESTAMP')
|
elseif ($_default == 'CURRENT_TIMESTAMP')
|
||||||
$expr .= ' DEFAULT ' . $_default . '';
|
$expr .= ' DEFAULT ' . $_default . '';
|
||||||
|
|
||||||
$correct_table['fields'][trim((string)$field->name)] = $expr;
|
$correct_table['fields'][trim((string) $field->name)] = $expr;
|
||||||
}
|
}
|
||||||
if($table->indexes)
|
if ($table->indexes)
|
||||||
{
|
{
|
||||||
foreach($table->indexes->index as $index)
|
foreach ($table->indexes->index as $index)
|
||||||
{
|
{
|
||||||
$i_name = (string)$index->name;
|
$i_name = (string) $index->name;
|
||||||
$expr = array();
|
$expr = array();
|
||||||
foreach($index->fields->field as $field)
|
foreach ($index->fields->field as $field)
|
||||||
$expr[] = '`'.trim((string)$field).'`';
|
$expr[] = '`' . trim((string) $field) . '`';
|
||||||
|
|
||||||
$expr = implode(', ',$expr);
|
$expr = implode(', ', $expr);
|
||||||
|
|
||||||
switch((string)$index->type)
|
switch ((string) $index->type)
|
||||||
{
|
{
|
||||||
case "PRIMARY":
|
case "PRIMARY":
|
||||||
$correct_table['indexes']['PRIMARY'] = 'PRIMARY KEY (' . $expr . ')';
|
$correct_table['indexes']['PRIMARY'] = 'PRIMARY KEY (' . $expr . ')';
|
||||||
@@ -258,56 +264,56 @@ abstract class base
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$sql = "SHOW FULL FIELDS FROM `".$table['name']."`";
|
$sql = "SHOW FULL FIELDS FROM `" . $table['name'] . "`";
|
||||||
if($rs2 = mysql_query($sql,$this->conn))
|
if ($rs2 = mysql_query($sql, $this->conn))
|
||||||
{
|
{
|
||||||
while( $row2 = mysql_fetch_assoc($rs2) )
|
while ($row2 = mysql_fetch_assoc($rs2))
|
||||||
{
|
{
|
||||||
$f_name = $row2['Field'];
|
$f_name = $row2['Field'];
|
||||||
$expr_found = trim($row2['Type']);
|
$expr_found = trim($row2['Type']);
|
||||||
|
|
||||||
$_extra = $row2['Extra'];
|
$_extra = $row2['Extra'];
|
||||||
|
|
||||||
if($_extra)
|
if ($_extra)
|
||||||
$expr_found .= ' ' . $_extra;
|
$expr_found .= ' ' . $_extra;
|
||||||
|
|
||||||
$_collation = $row2['Collation'];
|
$_collation = $row2['Collation'];
|
||||||
|
|
||||||
$current_collation = '';
|
$current_collation = '';
|
||||||
|
|
||||||
if($_collation)
|
if ($_collation)
|
||||||
{
|
{
|
||||||
$_collation = explode('_',$row2['Collation']);
|
$_collation = explode('_', $row2['Collation']);
|
||||||
|
|
||||||
$expr_found .= $current_collation = ' CHARACTER SET ' . $_collation[0] . ' COLLATE ' . implode('_', $_collation);
|
$expr_found .= $current_collation = ' CHARACTER SET ' . $_collation[0] . ' COLLATE ' . implode('_', $_collation);
|
||||||
}
|
}
|
||||||
|
|
||||||
$_null = mb_strtolower(trim($row2['Null']));
|
$_null = mb_strtolower(trim($row2['Null']));
|
||||||
|
|
||||||
if(!$_null || $_null=='no')
|
if (!$_null || $_null == 'no')
|
||||||
$expr_found .= ' NOT NULL';
|
$expr_found .= ' NOT NULL';
|
||||||
|
|
||||||
$_default = $row2['Default'];
|
$_default = $row2['Default'];
|
||||||
|
|
||||||
if($_default)
|
if ($_default)
|
||||||
{
|
{
|
||||||
if(trim($row2['Type'])=='timestamp' && $_default=='CURRENT_TIMESTAMP')
|
if (trim($row2['Type']) == 'timestamp' && $_default == 'CURRENT_TIMESTAMP')
|
||||||
$expr_found .= ' DEFAULT CURRENT_TIMESTAMP';
|
$expr_found .= ' DEFAULT CURRENT_TIMESTAMP';
|
||||||
else
|
else
|
||||||
$expr_found .= ' DEFAULT \'' . $_default . '\'';
|
$expr_found .= ' DEFAULT \'' . $_default . '\'';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(isset($correct_table['fields'][$f_name]))
|
if (isset($correct_table['fields'][$f_name]))
|
||||||
{
|
{
|
||||||
if(isset($correct_table['collation'][$f_name]) && $correct_table['collation'][$f_name] != $current_collation)
|
if (isset($correct_table['collation'][$f_name]) && $correct_table['collation'][$f_name] != $current_collation)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
$old_type = mb_strtolower(trim($row2['Type']));
|
$old_type = mb_strtolower(trim($row2['Type']));
|
||||||
$new_type = false;
|
$new_type = false;
|
||||||
|
|
||||||
switch($old_type)
|
switch ($old_type)
|
||||||
{
|
{
|
||||||
case 'text':
|
case 'text':
|
||||||
$new_type = 'blob';
|
$new_type = 'blob';
|
||||||
@@ -322,22 +328,22 @@ abstract class base
|
|||||||
$new_type = 'tinyblob';
|
$new_type = 'tinyblob';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if(substr($old_type, 0, 4) == 'char')
|
if (substr($old_type, 0, 4) == 'char')
|
||||||
$new_type = 'varbinary(255)';
|
$new_type = 'varbinary(255)';
|
||||||
if(substr($old_type, 0, 7) == 'varchar')
|
if (substr($old_type, 0, 7) == 'varchar')
|
||||||
$new_type = 'varbinary(767)';
|
$new_type = 'varbinary(767)';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($new_type)
|
if ($new_type)
|
||||||
{
|
{
|
||||||
$alter_pre[] = "ALTER TABLE `".$table['name']."` CHANGE `$f_name` `$f_name` ".$new_type."";
|
$alter_pre[] = "ALTER TABLE `" . $table['name'] . "` CHANGE `$f_name` `$f_name` " . $new_type . "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strtolower($expr_found) !== strtolower($correct_table['fields'][$f_name]))
|
if (strtolower($expr_found) !== strtolower($correct_table['fields'][$f_name]))
|
||||||
{
|
{
|
||||||
$alter[] = "ALTER TABLE `".$table['name']."` CHANGE `$f_name` `$f_name` " . $correct_table['fields'][$f_name] ;
|
$alter[] = "ALTER TABLE `" . $table['name'] . "` CHANGE `$f_name` `$f_name` " . $correct_table['fields'][$f_name];
|
||||||
}
|
}
|
||||||
unset($correct_table['fields'][$f_name]);
|
unset($correct_table['fields'][$f_name]);
|
||||||
}
|
}
|
||||||
@@ -347,54 +353,54 @@ abstract class base
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($correct_table['fields'] as $f_name=>$expr)
|
foreach ($correct_table['fields'] as $f_name => $expr)
|
||||||
{
|
{
|
||||||
$alter[] = "ALTER TABLE `".$table['name']."` ADD `$f_name` " . $correct_table['fields'][$f_name];
|
$alter[] = "ALTER TABLE `" . $table['name'] . "` ADD `$f_name` " . $correct_table['fields'][$f_name];
|
||||||
}
|
}
|
||||||
|
|
||||||
mysql_free_result($rs2);
|
mysql_free_result($rs2);
|
||||||
}
|
}
|
||||||
|
|
||||||
$tIndex = array();
|
$tIndex = array();
|
||||||
$sql = "SHOW INDEXES FROM `".$table['name']."`";
|
$sql = "SHOW INDEXES FROM `" . $table['name'] . "`";
|
||||||
|
|
||||||
if($rs2 = mysql_query($sql,$this->conn))
|
if ($rs2 = mysql_query($sql, $this->conn))
|
||||||
{
|
{
|
||||||
while( $row2 = mysql_fetch_assoc($rs2) )
|
while ($row2 = mysql_fetch_assoc($rs2))
|
||||||
{
|
{
|
||||||
if(!isset($tIndex[$row2['Key_name']]))
|
if (!isset($tIndex[$row2['Key_name']]))
|
||||||
$tIndex[$row2['Key_name']] = array('unique'=>((int)($row2['Non_unique'])==0), 'columns'=>array());
|
$tIndex[$row2['Key_name']] = array('unique' => ((int) ($row2['Non_unique']) == 0), 'columns' => array());
|
||||||
$tIndex[$row2['Key_name']]['columns'][(int)($row2['Seq_in_index'])] = $row2['Column_name'];
|
$tIndex[$row2['Key_name']]['columns'][(int) ($row2['Seq_in_index'])] = $row2['Column_name'];
|
||||||
}
|
}
|
||||||
mysql_free_result($rs2);
|
mysql_free_result($rs2);
|
||||||
|
|
||||||
foreach($tIndex as $kIndex=>$vIndex)
|
foreach ($tIndex as $kIndex => $vIndex)
|
||||||
{
|
{
|
||||||
$strColumns = array();
|
$strColumns = array();
|
||||||
|
|
||||||
foreach($vIndex['columns'] as $column)
|
foreach ($vIndex['columns'] as $column)
|
||||||
$strColumns[] = '`'.$column.'`';
|
$strColumns[] = '`' . $column . '`';
|
||||||
|
|
||||||
$strColumns = '('.implode(', ',$strColumns).')';
|
$strColumns = '(' . implode(', ', $strColumns) . ')';
|
||||||
|
|
||||||
if($kIndex=='PRIMARY')
|
if ($kIndex == 'PRIMARY')
|
||||||
$expr_found = 'PRIMARY KEY '.$strColumns;
|
$expr_found = 'PRIMARY KEY ' . $strColumns;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if($vIndex['unique'])
|
if ($vIndex['unique'])
|
||||||
$expr_found = 'UNIQUE KEY `' . $kIndex . '` ' .$strColumns;
|
$expr_found = 'UNIQUE KEY `' . $kIndex . '` ' . $strColumns;
|
||||||
else
|
else
|
||||||
$expr_found = 'KEY `' . $kIndex . '` ' .$strColumns;
|
$expr_found = 'KEY `' . $kIndex . '` ' . $strColumns;
|
||||||
}
|
}
|
||||||
|
|
||||||
$full_name_index = ($kIndex=='PRIMARY') ? 'PRIMARY KEY' : ('INDEX `'.$kIndex.'`');
|
$full_name_index = ($kIndex == 'PRIMARY') ? 'PRIMARY KEY' : ('INDEX `' . $kIndex . '`');
|
||||||
|
|
||||||
if( isset($correct_table['indexes'][$kIndex]) )
|
if (isset($correct_table['indexes'][$kIndex]))
|
||||||
{
|
{
|
||||||
|
|
||||||
if(mb_strtolower($expr_found) !== mb_strtolower($correct_table['indexes'][$kIndex]))
|
if (mb_strtolower($expr_found) !== mb_strtolower($correct_table['indexes'][$kIndex]))
|
||||||
{
|
{
|
||||||
$alter[] = 'ALTER TABLE `'.$table['name'].'` DROP ' . $full_name_index . ', ADD ' . $correct_table['indexes'][$kIndex];
|
$alter[] = 'ALTER TABLE `' . $table['name'] . '` DROP ' . $full_name_index . ', ADD ' . $correct_table['indexes'][$kIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($correct_table['indexes'][$kIndex]);
|
unset($correct_table['indexes'][$kIndex]);
|
||||||
@@ -404,63 +410,60 @@ abstract class base
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($correct_table['indexes'] as $kIndex=>$expr)
|
foreach ($correct_table['indexes'] as $kIndex => $expr)
|
||||||
$alter[] = 'ALTER TABLE `'.$table['name'].'` ADD ' . $expr;
|
$alter[] = 'ALTER TABLE `' . $table['name'] . '` ADD ' . $expr;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$return = true;
|
$return = true;
|
||||||
|
|
||||||
foreach($alter_pre as $a)
|
foreach ($alter_pre as $a)
|
||||||
{
|
{
|
||||||
if(!mysql_query($a, $this->conn))
|
if (!mysql_query($a, $this->conn))
|
||||||
$return = false;
|
$return = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
foreach($alter as $a)
|
foreach ($alter as $a)
|
||||||
{
|
{
|
||||||
if(!mysql_query($a, $this->conn))
|
if (!mysql_query($a, $this->conn))
|
||||||
{
|
{
|
||||||
if(GV_debug)
|
if (GV_debug)
|
||||||
{
|
{
|
||||||
echo $a,' -- ',mysql_error($this->conn),'<br/>';
|
echo $a, ' -- ', mysql_error($this->conn), '<br/>';
|
||||||
}
|
}
|
||||||
$return = false;
|
$return = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function upgradeDb()
|
function upgradeDb()
|
||||||
{
|
{
|
||||||
require_once dirname( __FILE__ ) . '/../version.inc';
|
require_once dirname(__FILE__) . '/../version.inc';
|
||||||
if($this->schema && $this->dbname)
|
if ($this->schema && $this->dbname)
|
||||||
{
|
{
|
||||||
$allTables = array();
|
$allTables = array();
|
||||||
|
|
||||||
foreach($this->schema->tables->table as $table)
|
foreach ($this->schema->tables->table as $table)
|
||||||
$allTables[(string)$table['name']] = $table;
|
$allTables[(string) $table['name']] = $table;
|
||||||
|
|
||||||
$sql = "SHOW TABLE STATUS";
|
$sql = "SHOW TABLE STATUS";
|
||||||
if($rs = mysql_query($sql,$this->conn))
|
if ($rs = mysql_query($sql, $this->conn))
|
||||||
{
|
{
|
||||||
while( $row = mysql_fetch_assoc($rs) )
|
while ($row = mysql_fetch_assoc($rs))
|
||||||
{
|
{
|
||||||
$tname = $row["Name"];
|
$tname = $row["Name"];
|
||||||
|
|
||||||
if(isset($allTables[$tname]))
|
if (isset($allTables[$tname]))
|
||||||
{
|
{
|
||||||
$engine = strtolower(trim($allTables[$tname]->engine));
|
$engine = strtolower(trim($allTables[$tname]->engine));
|
||||||
$ref_engine = strtolower($row['Engine']);
|
$ref_engine = strtolower($row['Engine']);
|
||||||
|
|
||||||
if($engine != $ref_engine && in_array($engine,array('innodb','myisam')))
|
if ($engine != $ref_engine && in_array($engine, array('innodb', 'myisam')))
|
||||||
{
|
{
|
||||||
$sql = 'ALTER TABLE `'.$tname.'` ENGINE = '.$engine;
|
$sql = 'ALTER TABLE `' . $tname . '` ENGINE = ' . $engine;
|
||||||
mysql_query($sql,$this->conn);
|
mysql_query($sql, $this->conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
self::upgradeTable($allTables[$tname]);
|
self::upgradeTable($allTables[$tname]);
|
||||||
@@ -469,7 +472,7 @@ abstract class base
|
|||||||
}
|
}
|
||||||
mysql_free_result($rs);
|
mysql_free_result($rs);
|
||||||
}
|
}
|
||||||
foreach($allTables as $tname=>$table)
|
foreach ($allTables as $tname => $table)
|
||||||
{
|
{
|
||||||
$this->createTable($table);
|
$this->createTable($table);
|
||||||
}
|
}
|
||||||
@@ -478,36 +481,36 @@ abstract class base
|
|||||||
$current_version = self::getVersion();
|
$current_version = self::getVersion();
|
||||||
|
|
||||||
|
|
||||||
if(self::apply_patches($current_version,GV_version))
|
if (self::apply_patches($current_version, GV_version))
|
||||||
self::setVersion(GV_version);
|
self::setVersion(GV_version);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function apply_patches($from,$to)
|
function apply_patches($from, $to)
|
||||||
{
|
{
|
||||||
if(version_compare($from,$to,'='))
|
if (version_compare($from, $to, '='))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
$list_patches = array();
|
$list_patches = array();
|
||||||
|
|
||||||
$iterator = new DirectoryIterator(GV_RootPath.'lib/classes/patch/');
|
$iterator = new DirectoryIterator(GV_RootPath . 'lib/classes/patch/');
|
||||||
|
|
||||||
foreach ($iterator as $fileinfo)
|
foreach ($iterator as $fileinfo)
|
||||||
{
|
{
|
||||||
if (!$fileinfo->isDot())
|
if (!$fileinfo->isDot())
|
||||||
{
|
{
|
||||||
if(substr($fileinfo->getFilename(),0,1) == '.')
|
if (substr($fileinfo->getFilename(), 0, 1) == '.')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$classname = 'patch_'.array_pop(array_reverse(explode('.',$fileinfo->getFilename())));
|
$classname = 'patch_' . array_pop(array_reverse(explode('.', $fileinfo->getFilename())));
|
||||||
|
|
||||||
$patch = new $classname();
|
$patch = new $classname();
|
||||||
|
|
||||||
if(!in_array($this->type, $patch->concern()))
|
if (!in_array($this->type, $patch->concern()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(!version_compare($patch->get_release(), $from, '>') || !version_compare($patch->get_release(), $to, '<='))
|
if (!version_compare($patch->get_release(), $from, '>') || !version_compare($patch->get_release(), $to, '<='))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -519,11 +522,11 @@ abstract class base
|
|||||||
|
|
||||||
$success = true;
|
$success = true;
|
||||||
|
|
||||||
foreach($list_patches as $v=>$patches)
|
foreach ($list_patches as $v => $patches)
|
||||||
{
|
{
|
||||||
foreach($patches as $patch)
|
foreach ($patches as $patch)
|
||||||
{
|
{
|
||||||
if(!$patch->apply($this->id))
|
if (!$patch->apply($this->id))
|
||||||
$success = false;
|
$success = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -531,24 +534,23 @@ abstract class base
|
|||||||
return $success;
|
return $success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function upgradeAvalaible()
|
function upgradeAvalaible()
|
||||||
{
|
{
|
||||||
if($this->type == 'application_box')
|
if ($this->type == 'application_box')
|
||||||
$sql = 'SELECT version FROM sitepreff';
|
$sql = 'SELECT version FROM sitepreff';
|
||||||
if($this->type == 'data_box')
|
if ($this->type == 'data_box')
|
||||||
$sql = 'SELECT value AS version FROM pref WHERE prop="version" LIMIT 1;';
|
$sql = 'SELECT value AS version FROM pref WHERE prop="version" LIMIT 1;';
|
||||||
|
|
||||||
if($sql !== '')
|
if ($sql !== '')
|
||||||
{
|
{
|
||||||
if($rs = mysql_query($sql,$this->conn))
|
if ($rs = mysql_query($sql, $this->conn))
|
||||||
{
|
{
|
||||||
if($row = mysql_fetch_assoc($rs))
|
if ($row = mysql_fetch_assoc($rs))
|
||||||
$version = $row['version'];
|
$version = $row['version'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(isset($version))
|
if (isset($version))
|
||||||
return version_compare(GV_version,$version,'>');
|
return version_compare(GV_version, $version, '>');
|
||||||
else
|
else
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -556,18 +558,18 @@ abstract class base
|
|||||||
private function setVersion($version)
|
private function setVersion($version)
|
||||||
{
|
{
|
||||||
$sql = '';
|
$sql = '';
|
||||||
if($this->type == 'application_box')
|
if ($this->type == 'application_box')
|
||||||
$sql = 'UPDATE sitepreff SET version = "'.$version.'"';
|
$sql = 'UPDATE sitepreff SET version = "' . $version . '"';
|
||||||
if($this->type == 'data_box')
|
if ($this->type == 'data_box')
|
||||||
{
|
{
|
||||||
$sql = 'DELETE FROM pref WHERE prop="version" AND locale IS NULL';
|
$sql = 'DELETE FROM pref WHERE prop="version" AND locale IS NULL';
|
||||||
mysql_query($sql,$this->conn);
|
mysql_query($sql, $this->conn);
|
||||||
$sql = 'REPLACE INTO pref (id, prop, value,locale, updated_on) VALUES (null, "version", "'.$version.'","", NOW())';
|
$sql = 'REPLACE INTO pref (id, prop, value,locale, updated_on) VALUES (null, "version", "' . $version . '","", NOW())';
|
||||||
}
|
}
|
||||||
|
|
||||||
if($sql !== '')
|
if ($sql !== '')
|
||||||
{
|
{
|
||||||
if(mysql_query($sql,$this->conn))
|
if (mysql_query($sql, $this->conn))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -577,20 +579,20 @@ abstract class base
|
|||||||
public function getVersion()
|
public function getVersion()
|
||||||
{
|
{
|
||||||
$sql = '';
|
$sql = '';
|
||||||
if($this->type == 'application_box')
|
if ($this->type == 'application_box')
|
||||||
$sql = 'SELECT version FROM sitepreff';
|
$sql = 'SELECT version FROM sitepreff';
|
||||||
if($this->type == 'data_box')
|
if ($this->type == 'data_box')
|
||||||
{
|
{
|
||||||
$sql = 'DELETE FROM pref WHERE prop="version" AND locale IS NULL';
|
$sql = 'DELETE FROM pref WHERE prop="version" AND locale IS NULL';
|
||||||
mysql_query($sql,$this->conn);
|
mysql_query($sql, $this->conn);
|
||||||
$sql = 'SELECT value AS version FROM pref WHERE prop="version" LIMIT 1;';
|
$sql = 'SELECT value AS version FROM pref WHERE prop="version" LIMIT 1;';
|
||||||
}
|
}
|
||||||
|
|
||||||
if($sql !== '')
|
if ($sql !== '')
|
||||||
{
|
{
|
||||||
if($rs = mysql_query($sql,$this->conn))
|
if ($rs = mysql_query($sql, $this->conn))
|
||||||
{
|
{
|
||||||
if($row = mysql_fetch_assoc($rs))
|
if ($row = mysql_fetch_assoc($rs))
|
||||||
{
|
{
|
||||||
return $row['version'];
|
return $row['version'];
|
||||||
}
|
}
|
||||||
@@ -600,7 +602,4 @@ abstract class base
|
|||||||
return '0.0.0';
|
return '0.0.0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,11 +1,21 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Phraseanet
|
||||||
|
*
|
||||||
|
* (c) 2005-2010 Alchemy
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
class connection
|
class connection
|
||||||
{
|
{
|
||||||
|
|
||||||
private $private_connect = false;
|
private $private_connect = false;
|
||||||
private $private_lockedtables; // tableau assoc. des bases lockees
|
private $private_lockedtables; // tableau assoc. des bases lockees
|
||||||
private static $_instance = array();
|
private static $_instance = array();
|
||||||
|
private static $_PDO_instance = array();
|
||||||
private static $_query_counter = array();
|
private static $_query_counter = array();
|
||||||
private $_id;
|
private $_id;
|
||||||
private $_name = false;
|
private $_name = false;
|
||||||
@@ -35,16 +45,58 @@ class connection
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// if(!self::$_instance[$name]->isok())
|
|
||||||
// {
|
|
||||||
// header("HTTP/1.0 500 Internal Server Error");
|
|
||||||
// die('<h2>HTTP/1.0 500 Internal Server Error</h2><h2>Can\'t establish database connection<h2>');
|
|
||||||
// }
|
|
||||||
|
|
||||||
return array_key_exists($name, self::$_instance) ? self::$_instance[$name] : false;
|
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)
|
function __construct($name)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
class databox extends base {
|
|
||||||
|
class databox extends base
|
||||||
|
{
|
||||||
|
|
||||||
var $id = false;
|
var $id = false;
|
||||||
// var $request_mails = array();
|
// var $request_mails = array();
|
||||||
@@ -16,22 +18,43 @@ class databox extends base {
|
|||||||
function __construct($id=false, $host=false, $port=false, $user=false, $password=false)
|
function __construct($id=false, $host=false, $port=false, $user=false, $password=false)
|
||||||
{
|
{
|
||||||
$newServer = false;
|
$newServer = false;
|
||||||
if($host !== false && $port !== false && $user !== false && $password !== false)
|
if ($host !== false && $port !== false && $user !== false && $password !== false)
|
||||||
$newServer = array(
|
$newServer = array(
|
||||||
'hostname'=>$host,
|
'hostname' => $host,
|
||||||
'port'=>$port,
|
'port' => $port,
|
||||||
'user'=>$user,
|
'user' => $user,
|
||||||
'password'=>$password
|
'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)
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->init_data_conn($newServer) === false)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if($this->load_schema('data_box')=== false)
|
if ($this->load_schema('data_box') === false)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if($id !== false)
|
if ($id !== false)
|
||||||
$this->load((int)$id);
|
$this->load((int) $id);
|
||||||
|
|
||||||
$this->type = 'data_box';
|
$this->type = 'data_box';
|
||||||
|
|
||||||
@@ -42,26 +65,17 @@ class databox extends base {
|
|||||||
{
|
{
|
||||||
|
|
||||||
$conn = connection::getInstance();
|
$conn = connection::getInstance();
|
||||||
$sql = 'SELECT dbname FROM sbas WHERE sbas_id="'.$id.'"';
|
$sql = 'SELECT dbname FROM sbas WHERE sbas_id="' . $id . '"';
|
||||||
if($rs = $conn->query($sql))
|
if ($rs = $conn->query($sql))
|
||||||
{
|
{
|
||||||
if($row = $conn->fetch_assoc($rs))
|
if ($row = $conn->fetch_assoc($rs))
|
||||||
{
|
{
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
if(mysql_select_db($row['dbname'],$this->conn))
|
if (mysql_select_db($row['dbname'], $this->conn))
|
||||||
$this->dbname = $row['dbname'];
|
$this->dbname = $row['dbname'];
|
||||||
}
|
}
|
||||||
$conn->free_result($rs);
|
$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;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -77,10 +91,10 @@ class databox extends base {
|
|||||||
$conn = connection::getInstance();
|
$conn = connection::getInstance();
|
||||||
$colls = array();
|
$colls = array();
|
||||||
|
|
||||||
$sql = 'SELECT server_coll_id FROM bas WHERE sbas_id="'.$conn->escape_string($this->id).'"';
|
$sql = 'SELECT server_coll_id FROM bas WHERE sbas_id="' . $conn->escape_string($this->id) . '"';
|
||||||
if($rs = $conn->query($sql))
|
if ($rs = $conn->query($sql))
|
||||||
{
|
{
|
||||||
while($row = $conn->fetch_assoc($rs))
|
while ($row = $conn->fetch_assoc($rs))
|
||||||
$colls[] = $row['server_coll_id'];
|
$colls[] = $row['server_coll_id'];
|
||||||
$conn->free_result($rs);
|
$conn->free_result($rs);
|
||||||
}
|
}
|
||||||
@@ -89,11 +103,11 @@ class databox extends base {
|
|||||||
|
|
||||||
$mountable_colls = array();
|
$mountable_colls = array();
|
||||||
|
|
||||||
$sql = 'SELECT coll_id, asciiname FROM coll WHERE coll_id NOT IN ('.implode(',', $colls).')';
|
$sql = 'SELECT coll_id, asciiname FROM coll WHERE coll_id NOT IN (' . implode(',', $colls) . ')';
|
||||||
|
|
||||||
if($rs = $connbas->query($sql))
|
if ($rs = $connbas->query($sql))
|
||||||
{
|
{
|
||||||
while($row = $connbas->fetch_assoc($rs))
|
while ($row = $connbas->fetch_assoc($rs))
|
||||||
$mountable_colls[$row['coll_id']] = $row['asciiname'];
|
$mountable_colls[$row['coll_id']] = $row['asciiname'];
|
||||||
$connbas->free_result($rs);
|
$connbas->free_result($rs);
|
||||||
}
|
}
|
||||||
@@ -107,11 +121,11 @@ class databox extends base {
|
|||||||
|
|
||||||
$colls = array();
|
$colls = array();
|
||||||
|
|
||||||
foreach($lb['bases'] as $base)
|
foreach ($lb['bases'] as $base)
|
||||||
{
|
{
|
||||||
if($base['sbas_id'] != $this->id)
|
if ($base['sbas_id'] != $this->id)
|
||||||
continue;
|
continue;
|
||||||
foreach($base['collections'] as $coll)
|
foreach ($base['collections'] as $coll)
|
||||||
{
|
{
|
||||||
$colls[$coll['base_id']] = $coll['name'];
|
$colls[$coll['base_id']] = $coll['name'];
|
||||||
}
|
}
|
||||||
@@ -122,68 +136,67 @@ class databox extends base {
|
|||||||
public function save($usr_id)
|
public function save($usr_id)
|
||||||
{
|
{
|
||||||
$conn = connection::getInstance();
|
$conn = connection::getInstance();
|
||||||
if($this->id === false)
|
if ($this->id === false)
|
||||||
{
|
{
|
||||||
if(trim($this->dbname) == '')
|
if (trim($this->dbname) == '')
|
||||||
throw new Exception('invalid dbname');
|
throw new Exception('invalid dbname');
|
||||||
if(trim($this->user) == '')
|
if (trim($this->user) == '')
|
||||||
throw new Exception('invalid user');
|
throw new Exception('invalid user');
|
||||||
if(trim($this->host) == '')
|
if (trim($this->host) == '')
|
||||||
throw new Exception('invalid host');
|
throw new Exception('invalid host');
|
||||||
|
|
||||||
$ord = 0;
|
$ord = 0;
|
||||||
$sql = '(SELECT MAX(ord) as ord FROM sbas)';
|
$sql = '(SELECT MAX(ord) as ord FROM sbas)';
|
||||||
if($rs = $conn->query($sql))
|
if ($rs = $conn->query($sql))
|
||||||
{
|
{
|
||||||
if($row = mysql_fetch_assoc($rs))
|
if ($row = mysql_fetch_assoc($rs))
|
||||||
$ord = $row['ord']+1;
|
$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).'")';
|
$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))
|
if ($conn->query($sql))
|
||||||
{
|
{
|
||||||
$this->id = $conn->insert_id();
|
$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")';
|
$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);
|
$conn->query($sql);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw new Exception('unable to save databox in sbasusr : '.$conn->last_error());
|
throw new Exception('unable to save databox in sbasusr : ' . $conn->last_error());
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function create($dbname)
|
function create($dbname)
|
||||||
{
|
{
|
||||||
$this->createDb($dbname);
|
$this->createDb($dbname);
|
||||||
$cache_appbox = cache_appbox::getInstance();
|
$cache_appbox = cache_appbox::getInstance();
|
||||||
$cache_appbox->delete('list_bases');
|
$cache_appbox->delete('list_bases');
|
||||||
cache_databox::update($this->id,'structure');
|
cache_databox::update($this->id, 'structure');
|
||||||
}
|
}
|
||||||
|
|
||||||
function mount($dbname, $usr_id)
|
function mount($dbname, $usr_id)
|
||||||
{
|
{
|
||||||
$conn = connection::getInstance();
|
$conn = connection::getInstance();
|
||||||
if(mysql_select_db($dbname,$this->conn))
|
if (mysql_select_db($dbname, $this->conn))
|
||||||
{
|
{
|
||||||
$this->dbname = $dbname;
|
$this->dbname = $dbname;
|
||||||
if($this->save($usr_id) !== false)
|
if ($this->save($usr_id) !== false)
|
||||||
{
|
{
|
||||||
$cache_appbox = cache_appbox::getInstance();
|
$cache_appbox = cache_appbox::getInstance();
|
||||||
|
|
||||||
|
|
||||||
$sql = "SELECT * FROM coll";
|
$sql = "SELECT * FROM coll";
|
||||||
if($rs = mysql_query($sql, $this->conn))
|
if ($rs = mysql_query($sql, $this->conn))
|
||||||
{
|
{
|
||||||
$base_id = $this->getAppboxId('BAS', mysql_num_rows($rs));
|
$base_id = $this->getAppboxId('BAS', mysql_num_rows($rs));
|
||||||
|
|
||||||
|
|
||||||
while($row = mysql_fetch_assoc($rs))
|
while ($row = mysql_fetch_assoc($rs))
|
||||||
{
|
{
|
||||||
if(!empty($row['logo']) && ($fp = fopen(GV_RootPath.'config/minilogos/'.$base_id, 'w')) !== false)
|
if (!empty($row['logo']) && ($fp = fopen(GV_RootPath . 'config/minilogos/' . $base_id, 'w')) !== false)
|
||||||
{
|
{
|
||||||
fwrite($fp, $row["logo"]);
|
fwrite($fp, $row["logo"]);
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
@@ -191,14 +204,14 @@ class databox extends base {
|
|||||||
|
|
||||||
$sql = "INSERT INTO bas
|
$sql = "INSERT INTO bas
|
||||||
(base_id, active, server_coll_id, sbas_id) VALUES
|
(base_id, active, server_coll_id, sbas_id) VALUES
|
||||||
('".$conn->escape_string($base_id)."','1',
|
('" . $conn->escape_string($base_id) . "','1',
|
||||||
'".$conn->escape_string($row['coll_id'])."','".$conn->escape_string($this->id)."')";
|
'" . $conn->escape_string($row['coll_id']) . "','" . $conn->escape_string($this->id) . "')";
|
||||||
if($conn->query($sql))
|
if ($conn->query($sql))
|
||||||
{
|
{
|
||||||
|
|
||||||
$sql = "INSERT INTO basusr
|
$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, 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);
|
$conn->query($sql);
|
||||||
}
|
}
|
||||||
@@ -206,7 +219,7 @@ class databox extends base {
|
|||||||
$base_id++;
|
$base_id++;
|
||||||
}
|
}
|
||||||
$cache_appbox->delete('list_bases');
|
$cache_appbox->delete('list_bases');
|
||||||
cache_databox::update($this->id,'structure');
|
cache_databox::update($this->id, 'structure');
|
||||||
}
|
}
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
@@ -226,16 +239,16 @@ class databox extends base {
|
|||||||
$conn = connection::getInstance();
|
$conn = connection::getInstance();
|
||||||
|
|
||||||
$sql = 'LOCK TABLE uids WRITE';
|
$sql = 'LOCK TABLE uids WRITE';
|
||||||
if($conn->query($sql))
|
if ($conn->query($sql))
|
||||||
{
|
{
|
||||||
$sql = "UPDATE uids SET uid=uid+$askfor_n WHERE name='$typeId'" ;
|
$sql = "UPDATE uids SET uid=uid+$askfor_n WHERE name='$typeId'";
|
||||||
if($conn->query($sql))
|
if ($conn->query($sql))
|
||||||
{
|
{
|
||||||
$sql = "SELECT uid FROM uids WHERE name='$typeId'";
|
$sql = "SELECT uid FROM uids WHERE name='$typeId'";
|
||||||
if($result = $conn->query($sql))
|
if ($result = $conn->query($sql))
|
||||||
{
|
{
|
||||||
if($row = mysql_fetch_assoc($result))
|
if ($row = mysql_fetch_assoc($result))
|
||||||
$x = ($row["uid"]-$askfor_n)+1;
|
$x = ($row["uid"] - $askfor_n) + 1;
|
||||||
mysql_free_result($result);
|
mysql_free_result($result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -248,21 +261,21 @@ class databox extends base {
|
|||||||
private function init_data_conn($new_db=false)
|
private function init_data_conn($new_db=false)
|
||||||
{
|
{
|
||||||
// just in case
|
// just in case
|
||||||
if(is_resource($this->conn))
|
if (is_resource($this->conn))
|
||||||
{
|
{
|
||||||
mysql_close($this->conn);
|
mysql_close($this->conn);
|
||||||
$this->conn = false;
|
$this->conn = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// connect to appbox
|
// connect to appbox
|
||||||
require dirname( __FILE__ ) . '/../../config/connexion.inc';
|
require dirname(__FILE__) . '/../../config/connexion.inc';
|
||||||
|
|
||||||
$conn = connection::getInstance();
|
$conn = connection::getInstance();
|
||||||
|
|
||||||
if($conn)
|
if ($conn)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(!$new_db)
|
if (!$new_db)
|
||||||
{
|
{
|
||||||
// same as appbox
|
// same as appbox
|
||||||
$this->host = $hostname;
|
$this->host = $hostname;
|
||||||
@@ -278,94 +291,95 @@ class databox extends base {
|
|||||||
$this->passwd = $new_db['password'];
|
$this->passwd = $new_db['password'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->conn = mysql_connect($this->host.":".$this->port, $this->user, $this->passwd, true );
|
$this->conn = mysql_connect($this->host . ":" . $this->port, $this->user, $this->passwd, true);
|
||||||
|
|
||||||
mysql_set_charset('utf8',$this->conn);
|
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);
|
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)
|
if ($this->conn !== false)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setNewStructure($data_template,$path_web,$path_doc,$baseurl)
|
public function setNewStructure($data_template, $path_web, $path_doc, $baseurl)
|
||||||
{
|
{
|
||||||
if(is_file($data_template))
|
if (is_file($data_template))
|
||||||
{
|
{
|
||||||
$contents = file_get_contents($data_template);
|
$contents = file_get_contents($data_template);
|
||||||
|
|
||||||
|
$baseurl = $baseurl ? p4string::addEndSlash($baseurl) : '';
|
||||||
|
|
||||||
$contents = str_replace(
|
$contents = str_replace(
|
||||||
array("{{dataurl}}" , "{{basename}}" , "{{datapathweb}}" , "{{datapathnoweb}}"),
|
array("{{dataurl}}", "{{basename}}", "{{datapathweb}}", "{{datapathnoweb}}"),
|
||||||
array($baseurl , $this->dbname, $path_web, $path_doc ),
|
array($baseurl, $this->dbname, $path_web, $path_doc),
|
||||||
$contents
|
$contents
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->structure = $contents;
|
$this->structure = $contents;
|
||||||
|
|
||||||
$sql = 'UPDATE pref SET value="'.mysql_real_escape_string($this->structure,$this->conn).'", updated_on=NOW() WHERE prop="structure"';
|
$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))
|
if (mysql_query($sql, $this->conn))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function registerAdmin($usr_id,$bool)
|
public function registerAdmin($usr_id, $bool)
|
||||||
{
|
{
|
||||||
$conn = connection::getInstance();
|
$conn = connection::getInstance();
|
||||||
$sql = 'UPDATE sbasusr SET bas_manage="'.($bool === true ? '1' : '0').'" WHERE usr_id = "'.$usr_id.'" AND sbas_id="'.$this->id.'"';
|
$sql = 'UPDATE sbasusr SET bas_manage="' . ($bool === true ? '1' : '0') . '" WHERE usr_id = "' . $usr_id . '" AND sbas_id="' . $this->id . '"';
|
||||||
if($conn->query($sql))
|
if ($conn->query($sql))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function registerAdminStruct($usr_id,$bool)
|
public function registerAdminStruct($usr_id, $bool)
|
||||||
{
|
{
|
||||||
$conn = connection::getInstance();
|
$conn = connection::getInstance();
|
||||||
$sql = 'UPDATE sbasusr SET bas_modify_struct="'.($bool === true ? '1' : '0').'" WHERE usr_id = "'.$usr_id.'" AND sbas_id="'.$this->id.'"';
|
$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))
|
if ($conn->query($sql))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function registerAdminThesaurus($usr_id,$bool)
|
public function registerAdminThesaurus($usr_id, $bool)
|
||||||
{
|
{
|
||||||
$conn = connection::getInstance();
|
$conn = connection::getInstance();
|
||||||
$sql = 'UPDATE sbasusr SET bas_modif_th="'.($bool === true ? '1' : '0').'" WHERE usr_id = "'.$usr_id.'" AND sbas_id="'.$this->id.'"';
|
$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))
|
if ($conn->query($sql))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function registerPublication($usr_id,$bool)
|
public function registerPublication($usr_id, $bool)
|
||||||
{
|
{
|
||||||
$conn = connection::getInstance();
|
$conn = connection::getInstance();
|
||||||
$sql = 'UPDATE sbasusr SET bas_chupub="'.($bool === true ? '1' : '0').'" WHERE usr_id = "'.$usr_id.'" AND sbas_id="'.$this->id.'"';
|
$sql = 'UPDATE sbasusr SET bas_chupub="' . ($bool === true ? '1' : '0') . '" WHERE usr_id = "' . $usr_id . '" AND sbas_id="' . $this->id . '"';
|
||||||
if($conn->query($sql))
|
if ($conn->query($sql))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function printStatus($name)
|
public static function printStatus($name)
|
||||||
{
|
{
|
||||||
|
|
||||||
$cache_data = cache_appbox::getInstance();
|
$cache_data = cache_appbox::getInstance();
|
||||||
|
|
||||||
if(($tmp = $cache_data->get('status'.$name)) !== false)
|
if (($tmp = $cache_data->get('status' . $name)) !== false)
|
||||||
return $tmp;
|
return $tmp;
|
||||||
|
|
||||||
$filename = GV_RootPath.'config/status/'.$name;
|
$filename = GV_RootPath . 'config/status/' . $name;
|
||||||
|
|
||||||
$out = '';
|
$out = '';
|
||||||
|
|
||||||
if(is_file($filename))
|
if (is_file($filename))
|
||||||
{
|
{
|
||||||
$out = file_get_contents($filename);
|
$out = file_get_contents($filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
$cache_data->set('status'.$name,$out);
|
$cache_data->set('status' . $name, $out);
|
||||||
|
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
@@ -376,7 +390,7 @@ class databox extends base {
|
|||||||
$cache_data = cache_appbox::getInstance();
|
$cache_data = cache_appbox::getInstance();
|
||||||
|
|
||||||
$out = '';
|
$out = '';
|
||||||
if(is_file( ($filename = GV_RootPath.'config/minilogos/logopdf_'.$sbas_id.'.jpg') ))
|
if (is_file(($filename = GV_RootPath . 'config/minilogos/logopdf_' . $sbas_id . '.jpg')))
|
||||||
$out = file_get_contents($filename);
|
$out = file_get_contents($filename);
|
||||||
|
|
||||||
return $out;
|
return $out;
|
||||||
@@ -387,26 +401,26 @@ class databox extends base {
|
|||||||
$tbas = array();
|
$tbas = array();
|
||||||
$conn = connection::getInstance();
|
$conn = connection::getInstance();
|
||||||
|
|
||||||
if($sbas_id !== false)
|
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";
|
$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
|
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";
|
$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))
|
if ($rs = $conn->query($sql))
|
||||||
{
|
{
|
||||||
while($row = $conn->fetch_assoc($rs))
|
while ($row = $conn->fetch_assoc($rs))
|
||||||
{
|
{
|
||||||
if(!isset($tbas[$row["sbas_id"]]))
|
if (!isset($tbas[$row["sbas_id"]]))
|
||||||
{
|
{
|
||||||
$tbas[$row["sbas_id"]] = array('viewname'=>(trim($row['viewname']) != '' ?$row['viewname'] : $row['dbname']), 'colls'=>array());
|
$tbas[$row["sbas_id"]] = array('viewname' => (trim($row['viewname']) != '' ? $row['viewname'] : $row['dbname']), 'colls' => array());
|
||||||
|
|
||||||
$connbas = connection::getInstance($row['sbas_id']);
|
$connbas = connection::getInstance($row['sbas_id']);
|
||||||
if($connbas)
|
if ($connbas)
|
||||||
{
|
{
|
||||||
$sql = "SELECT coll_id, asciiname FROM coll";
|
$sql = "SELECT coll_id, asciiname FROM coll";
|
||||||
if($rsbas = $connbas->query($sql))
|
if ($rsbas = $connbas->query($sql))
|
||||||
{
|
{
|
||||||
while($rowbas = $connbas->fetch_assoc($rsbas))
|
while ($rowbas = $connbas->fetch_assoc($rsbas))
|
||||||
{
|
{
|
||||||
$colls[$row['sbas_id']][$rowbas["coll_id"]] = $rowbas['asciiname'];
|
$colls[$row['sbas_id']][$rowbas["coll_id"]] = $rowbas['asciiname'];
|
||||||
}
|
}
|
||||||
@@ -421,17 +435,16 @@ class databox extends base {
|
|||||||
return($tbas);
|
return($tbas);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function get_dom_thesaurus($sbas_id)
|
public static function get_dom_thesaurus($sbas_id)
|
||||||
{
|
{
|
||||||
if(isset(self::$_dom_thesaurus[$sbas_id]))
|
if (isset(self::$_dom_thesaurus[$sbas_id]))
|
||||||
{
|
{
|
||||||
return self::$_dom_thesaurus[$sbas_id];
|
return self::$_dom_thesaurus[$sbas_id];
|
||||||
}
|
}
|
||||||
|
|
||||||
$thesaurus = self::get_thesaurus($sbas_id);
|
$thesaurus = self::get_thesaurus($sbas_id);
|
||||||
|
|
||||||
if($thesaurus && ($tmp = DomDocument::loadXML($thesaurus)) !== false)
|
if ($thesaurus && ($tmp = DomDocument::loadXML($thesaurus)) !== false)
|
||||||
self::$_dom_thesaurus[$sbas_id] = $tmp;
|
self::$_dom_thesaurus[$sbas_id] = $tmp;
|
||||||
else
|
else
|
||||||
self::$_dom_thesaurus[$sbas_id] = false;
|
self::$_dom_thesaurus[$sbas_id] = false;
|
||||||
@@ -441,14 +454,14 @@ class databox extends base {
|
|||||||
|
|
||||||
public static function get_xpath_thesaurus($sbas_id)
|
public static function get_xpath_thesaurus($sbas_id)
|
||||||
{
|
{
|
||||||
if(isset(self::$_xpath_thesaurus[$sbas_id]))
|
if (isset(self::$_xpath_thesaurus[$sbas_id]))
|
||||||
{
|
{
|
||||||
return self::$_xpath_thesaurus[$sbas_id];
|
return self::$_xpath_thesaurus[$sbas_id];
|
||||||
}
|
}
|
||||||
|
|
||||||
$DOM_thesaurus = self::get_dom_thesaurus($sbas_id);
|
$DOM_thesaurus = self::get_dom_thesaurus($sbas_id);
|
||||||
|
|
||||||
if($DOM_thesaurus && ($tmp = new DOMXPath( $DOM_thesaurus )) !== false)
|
if ($DOM_thesaurus && ($tmp = new phrasea_DOMXPath($DOM_thesaurus)) !== false)
|
||||||
self::$_xpath_thesaurus[$sbas_id] = $tmp;
|
self::$_xpath_thesaurus[$sbas_id] = $tmp;
|
||||||
else
|
else
|
||||||
self::$_xpath_thesaurus[$sbas_id] = false;
|
self::$_xpath_thesaurus[$sbas_id] = false;
|
||||||
@@ -456,18 +469,17 @@ class databox extends base {
|
|||||||
return self::$_xpath_thesaurus[$sbas_id];
|
return self::$_xpath_thesaurus[$sbas_id];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function get_sxml_thesaurus($sbas_id)
|
public static function get_sxml_thesaurus($sbas_id)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(isset(self::$_sxml_thesaurus[$sbas_id]))
|
if (isset(self::$_sxml_thesaurus[$sbas_id]))
|
||||||
{
|
{
|
||||||
return self::$_sxml_thesaurus[$sbas_id];
|
return self::$_sxml_thesaurus[$sbas_id];
|
||||||
}
|
}
|
||||||
|
|
||||||
$thesaurus = self::get_thesaurus($sbas_id);
|
$thesaurus = self::get_thesaurus($sbas_id);
|
||||||
|
|
||||||
if($thesaurus && ($tmp = simplexml_load_string($thesaurus)) !== false)
|
if ($thesaurus && ($tmp = simplexml_load_string($thesaurus)) !== false)
|
||||||
self::$_sxml_thesaurus[$sbas_id] = $tmp;
|
self::$_sxml_thesaurus[$sbas_id] = $tmp;
|
||||||
else
|
else
|
||||||
self::$_sxml_thesaurus[$sbas_id] = false;
|
self::$_sxml_thesaurus[$sbas_id] = false;
|
||||||
@@ -475,18 +487,17 @@ class databox extends base {
|
|||||||
return self::$_sxml_thesaurus[$sbas_id];
|
return self::$_sxml_thesaurus[$sbas_id];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function get_thesaurus($sbas_id)
|
public static function get_thesaurus($sbas_id)
|
||||||
{
|
{
|
||||||
$cache_appbox = cache_appbox::getInstance();
|
$cache_appbox = cache_appbox::getInstance();
|
||||||
|
|
||||||
if(($tmp = $cache_appbox->get('thesaurus_'.$sbas_id)) !== false)
|
if (($tmp = $cache_appbox->get('thesaurus_' . $sbas_id)) !== false)
|
||||||
{
|
{
|
||||||
self::$_thesaurus[$sbas_id] = $tmp;
|
self::$_thesaurus[$sbas_id] = $tmp;
|
||||||
return $tmp;
|
return $tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset(self::$_thesaurus[$sbas_id]))
|
if (isset(self::$_thesaurus[$sbas_id]))
|
||||||
{
|
{
|
||||||
return self::$_thesaurus[$sbas_id];
|
return self::$_thesaurus[$sbas_id];
|
||||||
}
|
}
|
||||||
@@ -495,9 +506,9 @@ class databox extends base {
|
|||||||
$connsbas = connection::getInstance($sbas_id);
|
$connsbas = connection::getInstance($sbas_id);
|
||||||
$sql = 'SELECT value AS thesaurus FROM pref WHERE prop="thesaurus" LIMIT 1;';
|
$sql = 'SELECT value AS thesaurus FROM pref WHERE prop="thesaurus" LIMIT 1;';
|
||||||
|
|
||||||
if($rs = $connsbas->query($sql))
|
if ($rs = $connsbas->query($sql))
|
||||||
{
|
{
|
||||||
if($row = $connsbas->fetch_assoc($rs))
|
if ($row = $connsbas->fetch_assoc($rs))
|
||||||
{
|
{
|
||||||
$thesaurus = trim($row['thesaurus']);
|
$thesaurus = trim($row['thesaurus']);
|
||||||
}
|
}
|
||||||
@@ -506,29 +517,27 @@ class databox extends base {
|
|||||||
|
|
||||||
self::$_thesaurus[$sbas_id] = $thesaurus;
|
self::$_thesaurus[$sbas_id] = $thesaurus;
|
||||||
|
|
||||||
if(self::$_thesaurus[$sbas_id])
|
if (self::$_thesaurus[$sbas_id])
|
||||||
$cache_appbox->set('thesaurus_'.$sbas_id,self::$_thesaurus[$sbas_id]);
|
$cache_appbox->set('thesaurus_' . $sbas_id, self::$_thesaurus[$sbas_id]);
|
||||||
|
|
||||||
return self::$_thesaurus[$sbas_id];
|
return self::$_thesaurus[$sbas_id];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function get_structure($sbas_id)
|
public static function get_structure($sbas_id)
|
||||||
{
|
{
|
||||||
$session = session::getInstance();
|
$session = session::getInstance();
|
||||||
$locale = isset($session->locale) ? $session->locale : GV_default_lng;
|
$locale = isset($session->locale) ? $session->locale : GV_default_lng;
|
||||||
$basesettings = phrasea::load_settings($locale);
|
$basesettings = phrasea::load_settings($locale);
|
||||||
|
|
||||||
if(isset($basesettings["bases"][$sbas_id]))
|
if (isset($basesettings["bases"][$sbas_id]))
|
||||||
return $basesettings["bases"][$sbas_id]["structure"];
|
return $basesettings["bases"][$sbas_id]["structure"];
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function get_dom_structure($sbas_id)
|
public static function get_dom_structure($sbas_id)
|
||||||
{
|
{
|
||||||
if(isset(self::$_dom_structure[$sbas_id]))
|
if (isset(self::$_dom_structure[$sbas_id]))
|
||||||
{
|
{
|
||||||
return self::$_dom_structure[$sbas_id];
|
return self::$_dom_structure[$sbas_id];
|
||||||
}
|
}
|
||||||
@@ -541,7 +550,7 @@ class databox extends base {
|
|||||||
$dom->preserveWhiteSpace = false;
|
$dom->preserveWhiteSpace = false;
|
||||||
$dom->formatOutput = true;
|
$dom->formatOutput = true;
|
||||||
|
|
||||||
if($structure && $dom->loadXML($structure) !== false)
|
if ($structure && $dom->loadXML($structure) !== false)
|
||||||
self::$_dom_structure[$sbas_id] = $dom;
|
self::$_dom_structure[$sbas_id] = $dom;
|
||||||
else
|
else
|
||||||
self::$_dom_structure[$sbas_id] = false;
|
self::$_dom_structure[$sbas_id] = false;
|
||||||
@@ -549,18 +558,16 @@ class databox extends base {
|
|||||||
return self::$_dom_structure[$sbas_id];
|
return self::$_dom_structure[$sbas_id];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static function get_sxml_structure($sbas_id)
|
public static function get_sxml_structure($sbas_id)
|
||||||
{
|
{
|
||||||
if(isset(self::$_sxml_structure[$sbas_id]))
|
if (isset(self::$_sxml_structure[$sbas_id]))
|
||||||
{
|
{
|
||||||
return self::$_sxml_structure[$sbas_id];
|
return self::$_sxml_structure[$sbas_id];
|
||||||
}
|
}
|
||||||
|
|
||||||
$structure = self::get_structure($sbas_id);
|
$structure = self::get_structure($sbas_id);
|
||||||
|
|
||||||
if($structure && ($tmp = simplexml_load_string($structure)) !== false)
|
if ($structure && ($tmp = simplexml_load_string($structure)) !== false)
|
||||||
self::$_sxml_structure[$sbas_id] = $tmp;
|
self::$_sxml_structure[$sbas_id] = $tmp;
|
||||||
else
|
else
|
||||||
self::$_sxml_structure[$sbas_id] = false;
|
self::$_sxml_structure[$sbas_id] = false;
|
||||||
@@ -568,17 +575,16 @@ class databox extends base {
|
|||||||
return self::$_sxml_structure[$sbas_id];
|
return self::$_sxml_structure[$sbas_id];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function get_xpath_structure($sbas_id)
|
public static function get_xpath_structure($sbas_id)
|
||||||
{
|
{
|
||||||
if(isset(self::$_xpath_structure[$sbas_id]))
|
if (isset(self::$_xpath_structure[$sbas_id]))
|
||||||
{
|
{
|
||||||
return self::$_xpath_structure[$sbas_id];
|
return self::$_xpath_structure[$sbas_id];
|
||||||
}
|
}
|
||||||
|
|
||||||
$dom_doc = self::get_dom_structure($sbas_id);
|
$dom_doc = self::get_dom_structure($sbas_id);
|
||||||
|
|
||||||
if($dom_doc && ($tmp = new DOMXpath($dom_doc)) !== false)
|
if ($dom_doc && ($tmp = new DOMXpath($dom_doc)) !== false)
|
||||||
self::$_xpath_structure[$sbas_id] = $tmp;
|
self::$_xpath_structure[$sbas_id] = $tmp;
|
||||||
else
|
else
|
||||||
self::$_xpath_structure[$sbas_id] = false;
|
self::$_xpath_structure[$sbas_id] = false;
|
||||||
@@ -595,29 +601,29 @@ class databox extends base {
|
|||||||
|
|
||||||
$errors = array();
|
$errors = array();
|
||||||
|
|
||||||
foreach($subdefgroup as $k=>$subdefs)
|
foreach ($subdefgroup as $k => $subdefs)
|
||||||
{
|
{
|
||||||
$subdefgroup_name = trim((string)$subdefs->attributes()->name);
|
$subdefgroup_name = trim((string) $subdefs->attributes()->name);
|
||||||
|
|
||||||
if($subdefgroup_name == '')
|
if ($subdefgroup_name == '')
|
||||||
{
|
{
|
||||||
$errors[] = _('ERREUR : TOUTES LES BALISES subdefgroup necessitent un attribut name');
|
$errors[] = _('ERREUR : TOUTES LES BALISES subdefgroup necessitent un attribut name');
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isset($AvSubdefs[$subdefgroup_name]))
|
if (!isset($AvSubdefs[$subdefgroup_name]))
|
||||||
$AvSubdefs[$subdefgroup_name] = array();
|
$AvSubdefs[$subdefgroup_name] = array();
|
||||||
|
|
||||||
foreach($subdefs as $sd)
|
foreach ($subdefs as $sd)
|
||||||
{
|
{
|
||||||
$sd_name = trim(mb_strtolower((string)$sd->attributes()->name));
|
$sd_name = trim(mb_strtolower((string) $sd->attributes()->name));
|
||||||
$sd_class = trim(mb_strtolower((string)$sd->attributes()->class));
|
$sd_class = trim(mb_strtolower((string) $sd->attributes()->class));
|
||||||
if($sd_name == '' || isset($AvSubdefs[$subdefgroup_name][$sd_name]))
|
if ($sd_name == '' || isset($AvSubdefs[$subdefgroup_name][$sd_name]))
|
||||||
{
|
{
|
||||||
$errors[] = _('ERREUR : Les name de subdef sont uniques par groupe de subdefs et necessaire');
|
$errors[] = _('ERREUR : Les name de subdef sont uniques par groupe de subdefs et necessaire');
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(!in_array($sd_class,array('thumbnail','preview','document')))
|
if (!in_array($sd_class, array('thumbnail', 'preview', 'document')))
|
||||||
{
|
{
|
||||||
$errors[] = _('ERREUR : La classe de subdef est necessaire et egal a "thumbnail","preview" ou "document"');
|
$errors[] = _('ERREUR : La classe de subdef est necessaire et egal a "thumbnail","preview" ou "document"');
|
||||||
continue;
|
continue;
|
||||||
@@ -633,32 +639,46 @@ class databox extends base {
|
|||||||
{
|
{
|
||||||
$sx_struct = self::get_sxml_structure($sbas_id);
|
$sx_struct = self::get_sxml_structure($sbas_id);
|
||||||
|
|
||||||
if(!$sx_struct)
|
if (!$sx_struct)
|
||||||
return array();
|
return array();
|
||||||
|
|
||||||
$subdefgroup = $sx_struct->subdefs[0];
|
$subdefgroup = $sx_struct->subdefs[0];
|
||||||
|
|
||||||
$AvSubdefs = array();
|
$AvSubdefs = array();
|
||||||
|
|
||||||
foreach($subdefgroup as $k=>$subdefs)
|
foreach ($subdefgroup as $k => $subdefs)
|
||||||
{
|
{
|
||||||
$subdefgroup_name = (string)$subdefs->attributes()->name;
|
$subdefgroup_name = (string) $subdefs->attributes()->name;
|
||||||
|
|
||||||
if(!isset($AvSubdefs[$subdefgroup_name]))
|
if (!isset($AvSubdefs[$subdefgroup_name]))
|
||||||
$AvSubdefs[$subdefgroup_name] = array();
|
$AvSubdefs[$subdefgroup_name] = array();
|
||||||
|
|
||||||
foreach($subdefs as $sd)
|
foreach ($subdefs as $sd)
|
||||||
{
|
{
|
||||||
$AvSubdefs[$subdefgroup_name][mb_strtolower((string)$sd->attributes()->name)] = $sd;
|
$AvSubdefs[$subdefgroup_name][mb_strtolower((string) $sd->attributes()->name)] = $sd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isset($AvSubdefs['flash']))
|
if (!isset($AvSubdefs['flash']))
|
||||||
$AvSubdefs['flash'] = $AvSubdefs['image'];
|
$AvSubdefs['flash'] = $AvSubdefs['image'];
|
||||||
if(!isset($AvSubdefs['document']))
|
if (!isset($AvSubdefs['document']))
|
||||||
$AvSubdefs['document'] = $AvSubdefs['image'];
|
$AvSubdefs['document'] = $AvSubdefs['image'];
|
||||||
|
|
||||||
|
|
||||||
return $AvSubdefs;
|
return $AvSubdefs;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class phrasea_DOMXPath extends DOMXPath
|
||||||
|
{
|
||||||
|
static $r = array();
|
||||||
|
function cache_query($xquery, $context_node=NULL, $context_path='')
|
||||||
|
{
|
||||||
|
$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]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -699,7 +699,19 @@ class export
|
|||||||
if(GV_modxsendfile)
|
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("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||||
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
||||||
|
@@ -5,36 +5,36 @@ class mail
|
|||||||
|
|
||||||
public static function mail_test($email)
|
public static function mail_test($email)
|
||||||
{
|
{
|
||||||
$from = array('email'=>GV_defaulmailsenderaddr,'name'=>GV_defaulmailsenderaddr);
|
$from = array('email' => GV_defaulmailsenderaddr, 'name' => GV_defaulmailsenderaddr);
|
||||||
|
|
||||||
$subject = _('mail:: test d\'envoi d\'email');
|
$subject = _('mail:: test d\'envoi d\'email');
|
||||||
|
|
||||||
$message = sprintf(_('Ce mail est un test d\'envoi de mail depuis %s'),GV_ServerName);
|
$message = sprintf(_('Ce mail est un test d\'envoi de mail depuis %s'), GV_ServerName);
|
||||||
|
|
||||||
$to = array('email'=>$email,'name'=>$email);
|
$to = array('email' => $email, 'name' => $email);
|
||||||
|
|
||||||
return self::send_mail($subject, $message, $to, $from);
|
return self::send_mail($subject, $message, $to, $from);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function send_validation_results($email,$subject,$from, $message)
|
public static function send_validation_results($email, $subject, $from, $message)
|
||||||
{
|
{
|
||||||
$to = array('email'=>$email,'name'=>$email);
|
$to = array('email' => $email, 'name' => $email);
|
||||||
|
|
||||||
return self::send_mail($subject, $message, $to, $from);
|
return self::send_mail($subject, $message, $to, $from);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function hack_alert($email, $body)
|
public static function hack_alert($email, $body)
|
||||||
{
|
{
|
||||||
$subject = 'Hack on '.GV_homeTitle;
|
$subject = 'Hack on ' . GV_homeTitle;
|
||||||
|
|
||||||
$to = array('email'=>$email,'name'=>$email);
|
$to = array('email' => $email, 'name' => $email);
|
||||||
|
|
||||||
return self::send_mail($subject, $body, $to);
|
return self::send_mail($subject, $body, $to);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function ftp_sent($email, $subject, $body)
|
public static function ftp_sent($email, $subject, $body)
|
||||||
{
|
{
|
||||||
$to = array('email'=>$email,'name'=>$email);
|
$to = array('email' => $email, 'name' => $email);
|
||||||
|
|
||||||
return self::send_mail($subject, $body, $to);
|
return self::send_mail($subject, $body, $to);
|
||||||
}
|
}
|
||||||
@@ -43,102 +43,108 @@ class mail
|
|||||||
{
|
{
|
||||||
$subject = _("task::ftp:Someone has sent some files onto FTP server");
|
$subject = _("task::ftp:Someone has sent some files onto FTP server");
|
||||||
|
|
||||||
$to = array('email'=>$email,'name'=>$email);
|
$to = array('email' => $email, 'name' => $email);
|
||||||
|
|
||||||
return self::send_mail($subject, $body, $to);
|
return self::send_mail($subject, $body, $to);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function send_documents($email, $url,$from, $message='',$accuse)
|
public static function send_documents($email, $url, $from, $endate_obj, $message='', $accuse)
|
||||||
{
|
{
|
||||||
$subject = _('export::vous avez recu des documents');
|
$subject = _('export::vous avez recu des documents');
|
||||||
|
|
||||||
$body = '<div>'._('Vous avez recu des documents, vous pourrez les telecharger a ladresse suivante ')."</div>\n";
|
$body = '<div>' . _('Vous avez recu des documents, vous pourrez les telecharger a ladresse suivante ') . "</div>\n";
|
||||||
$body .= "<a title='' href='".$url."'>".$url."</a>\n";
|
$body .= "<a title='' href='" . $url . "'>" . $url . "</a>\n";
|
||||||
|
|
||||||
if($message != '')
|
$body .= '<br><div>' .
|
||||||
|
sprintf(
|
||||||
|
_('Attention, ce lien lien est valable jusqu\'au %s'),
|
||||||
|
phraseadate::getDate($endate_obj) . ' ' . phraseadate::getTime($endate_obj)
|
||||||
|
)
|
||||||
|
. '</div>';
|
||||||
|
|
||||||
|
|
||||||
|
if ($message != '')
|
||||||
{
|
{
|
||||||
$body .= "<div>---------------------------------------------------</div>\n".$message;
|
$body .= "<div>---------------------------------------------------</div>\n" . $message;
|
||||||
}
|
}
|
||||||
|
|
||||||
$to = array('email'=>$email,'name'=>$email);
|
$to = array('email' => $email, 'name' => $email);
|
||||||
|
|
||||||
return self::send_mail($subject, $body, $to, $from, array(), $accuse);
|
return self::send_mail($subject, $body, $to, $from, array(), $accuse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function forgot_passord($email, $login, $url)
|
public static function forgot_passord($email, $login, $url)
|
||||||
{
|
{
|
||||||
$subject = _('login:: Forgot your password') ; // Registration order on .
|
$subject = _('login:: Forgot your password'); // Registration order on .
|
||||||
|
|
||||||
$body = "<div>"._('login:: Quelqu\'un a demande a reinitialiser le mode passe correspondant au login suivant : ') . "</div><div>\n\n" . $login . "</div>\n\n";
|
$body = "<div>" . _('login:: Quelqu\'un a demande a reinitialiser le mode passe correspondant au login suivant : ') . "</div><div>\n\n" . $login . "</div>\n\n";
|
||||||
$body .= "<div>"._('login:: Visitez le lien suivant et suivez les instructions pour continuer, sinon ignorez cet email et il ne se passera rien') . "</div>\n\n" ;
|
$body .= "<div>" . _('login:: Visitez le lien suivant et suivez les instructions pour continuer, sinon ignorez cet email et il ne se passera rien') . "</div>\n\n";
|
||||||
$body .= "<div>".'<a href="'.$url.'">'.$url.'</a>'."</div>\n" ;
|
$body .= "<div>" . '<a href="' . $url . '">' . $url . '</a>' . "</div>\n";
|
||||||
|
|
||||||
$to = array('email'=>$email,'name'=>$email);
|
$to = array('email' => $email, 'name' => $email);
|
||||||
|
|
||||||
return self::send_mail($subject, $body, $to);
|
return self::send_mail($subject, $body, $to);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function register_confirm($email, $accept, $deny)
|
public static function register_confirm($email, $accept, $deny)
|
||||||
{
|
{
|
||||||
|
|
||||||
$subject = sprintf(_('login::register:email: Votre compte %s'), GV_homeTitle);
|
$subject = sprintf(_('login::register:email: Votre compte %s'), GV_homeTitle);
|
||||||
|
|
||||||
$body = '<div>'._('login::register:email: Voici un compte rendu du traitement de vos demandes d\'acces :')."</div>\n";
|
$body = '<div>' . _('login::register:email: Voici un compte rendu du traitement de vos demandes d\'acces :') . "</div>\n";
|
||||||
|
|
||||||
if($accept != '')
|
if ($accept != '')
|
||||||
{
|
{
|
||||||
$body .= "<br/>\n<div>"._('login::register:email: Vous avez ete accepte sur les collections suivantes : ')."</div>\n<ul>".$accept."</ul>\n";
|
$body .= "<br/>\n<div>" . _('login::register:email: Vous avez ete accepte sur les collections suivantes : ') . "</div>\n<ul>" . $accept . "</ul>\n";
|
||||||
}
|
}
|
||||||
if($deny != '')
|
if ($deny != '')
|
||||||
{
|
{
|
||||||
$body .= "<br/>\n<div>"._('login::register:email: Vous avez ete refuse sur les collections suivantes : ')."</div>\n<ul>".$deny."</ul>\n";
|
$body .= "<br/>\n<div>" . _('login::register:email: Vous avez ete refuse sur les collections suivantes : ') . "</div>\n<ul>" . $deny . "</ul>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$to = array('email'=>$email,'name'=>$email);
|
$to = array('email' => $email, 'name' => $email);
|
||||||
|
|
||||||
return self::send_mail($subject, $body, $to);
|
return self::send_mail($subject, $body, $to);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function register_user($email, $auto, $others)
|
public static function register_user($email, $auto, $others)
|
||||||
{
|
{
|
||||||
|
|
||||||
$subject = sprintf(_('login::register:email: Votre compte %s'),GV_homeTitle);
|
$subject = sprintf(_('login::register:email: Votre compte %s'), GV_homeTitle);
|
||||||
|
|
||||||
|
|
||||||
$body = "<div>"._('login::register:Votre inscription a ete prise en compte')."</div>\n";
|
$body = "<div>" . _('login::register:Votre inscription a ete prise en compte') . "</div>\n";
|
||||||
|
|
||||||
if($auto != '')
|
if ($auto != '')
|
||||||
{
|
{
|
||||||
$body .= "<br/>\n<div>"._('login::register: vous avez des a present acces aux collections suivantes : ')."</div>\n<ul>".$auto."</ul>\n";
|
$body .= "<br/>\n<div>" . _('login::register: vous avez des a present acces aux collections suivantes : ') . "</div>\n<ul>" . $auto . "</ul>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if($others != '')
|
if ($others != '')
|
||||||
{
|
{
|
||||||
$body .= "<br/>\n<div>"._('login::register: vos demandes concernat les collections suivantes sont sujettes a approbation d\'un administrateur')."</div>\n<ul>".$others."</ul>\n";
|
$body .= "<br/>\n<div>" . _('login::register: vos demandes concernat les collections suivantes sont sujettes a approbation d\'un administrateur') . "</div>\n<ul>" . $others . "</ul>\n";
|
||||||
$body .= "<br/>\n<div>"._('login::register : vous serez avertis par email lorsque vos demandes seront traitees')."</div>\n";
|
$body .= "<br/>\n<div>" . _('login::register : vous serez avertis par email lorsque vos demandes seront traitees') . "</div>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$to = array('email'=>$email,'name'=>$email);
|
$to = array('email' => $email, 'name' => $email);
|
||||||
|
|
||||||
return self::send_mail($subject, $body, $to);
|
return self::send_mail($subject, $body, $to);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function reset_email($email,$usr_id)
|
public static function reset_email($email, $usr_id)
|
||||||
{
|
{
|
||||||
$date = new DateTime('1 day');
|
$date = new DateTime('1 day');
|
||||||
$date = phraseadate::format_mysql($date);
|
$date = phraseadate::format_mysql($date);
|
||||||
$token = random::getUrlToken('email',$usr_id,$date,$email);
|
$token = random::getUrlToken('email', $usr_id, $date, $email);
|
||||||
|
|
||||||
$url = GV_ServerName.'login/reset-email.php?token='.$token;
|
$url = GV_ServerName . 'login/reset-email.php?token=' . $token;
|
||||||
|
|
||||||
$subject = _('login::register: sujet email : confirmation de votre adresse email');
|
$subject = _('login::register: sujet email : confirmation de votre adresse email');
|
||||||
|
|
||||||
$body = "<div>"._('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.')."</div>\n";
|
$body = "<div>" . _('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.') . "</div>\n";
|
||||||
$body .= '<div><a href="'.$url.'">'.$url.'</a></div>\n';
|
$body .= '<div><a href="' . $url . '">' . $url . '</a></div>\n';
|
||||||
|
|
||||||
$to = array('email'=>$email,'name'=>$email);
|
$to = array('email' => $email, 'name' => $email);
|
||||||
|
|
||||||
return self::send_mail($subject, $body, $to);
|
return self::send_mail($subject, $body, $to);
|
||||||
}
|
}
|
||||||
@@ -147,11 +153,11 @@ class mail
|
|||||||
{
|
{
|
||||||
$subject = _('login::register: sujet email : confirmation de votre adresse email');
|
$subject = _('login::register: sujet email : confirmation de votre adresse email');
|
||||||
|
|
||||||
$body = "<div>"._('login::register: merci d\'avoir confirme votre adresse email')."</div>\n";
|
$body = "<div>" . _('login::register: merci d\'avoir confirme votre adresse email') . "</div>\n";
|
||||||
$body .= "<br/><div>"._('login::register: vous pouvez maintenant vous connecter a l\'adresse suivante : ')."</div>\n";
|
$body .= "<br/><div>" . _('login::register: vous pouvez maintenant vous connecter a l\'adresse suivante : ') . "</div>\n";
|
||||||
$body .= "<div><a href='".GV_ServerName."' target='_blank'>".GV_ServerName."</a></div>\n";
|
$body .= "<div><a href='" . GV_ServerName . "' target='_blank'>" . GV_ServerName . "</a></div>\n";
|
||||||
|
|
||||||
$to = array('email'=>$email,'name'=>$email);
|
$to = array('email' => $email, 'name' => $email);
|
||||||
|
|
||||||
return self::send_mail($subject, $body, $to);
|
return self::send_mail($subject, $body, $to);
|
||||||
}
|
}
|
||||||
@@ -161,64 +167,64 @@ class mail
|
|||||||
|
|
||||||
$subject = _('login::register: sujet email : confirmation de votre adresse email');
|
$subject = _('login::register: sujet email : confirmation de votre adresse email');
|
||||||
|
|
||||||
$body = "<div>"._('login::register: merci d\'avoir confirme votre adresse email')."</div>\n";
|
$body = "<div>" . _('login::register: merci d\'avoir confirme votre adresse email') . "</div>\n";
|
||||||
$body .= "<br/>\n<div>"._('login::register: vous devez attendre la confirmation d\'un administrateur ; vos demandes sur les collections suivantes sont toujours en attente : ')."</div>\n<ul>".$others."</ul>\n";
|
$body .= "<br/>\n<div>" . _('login::register: vous devez attendre la confirmation d\'un administrateur ; vos demandes sur les collections suivantes sont toujours en attente : ') . "</div>\n<ul>" . $others . "</ul>\n";
|
||||||
$body .= "<br/>\n<div>"._('login::register : vous serez avertis par email lorsque vos demandes seront traitees')."</div>\n";
|
$body .= "<br/>\n<div>" . _('login::register : vous serez avertis par email lorsque vos demandes seront traitees') . "</div>\n";
|
||||||
|
|
||||||
$to = array('email'=>$email,'name'=>$email);
|
$to = array('email' => $email, 'name' => $email);
|
||||||
|
|
||||||
return self::send_mail($subject, $body, $to);
|
return self::send_mail($subject, $body, $to);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function mail_confirmation($email,$usr_id)
|
public static function mail_confirmation($email, $usr_id)
|
||||||
{
|
{
|
||||||
|
|
||||||
$expire = new DateTime('+3 days');
|
$expire = new DateTime('+3 days');
|
||||||
$expire = phraseadate::format_mysql($expire);
|
$expire = phraseadate::format_mysql($expire);
|
||||||
$token = random::getUrlToken('password',$usr_id,$expire,$email);
|
$token = random::getUrlToken('password', $usr_id, $expire, $email);
|
||||||
|
|
||||||
$subject = _('login::register: sujet email : confirmation de votre adresse email');
|
$subject = _('login::register: sujet email : confirmation de votre adresse email');
|
||||||
|
|
||||||
$body = "<div>"._('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.')."</div>\n";
|
$body = "<div>" . _('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.') . "</div>\n";
|
||||||
$body .= "<br/>\n<div><a href='".GV_ServerName."register-confirm=".$token."' target='_blank'>".GV_ServerName."register-confirm=".$token."</a></div>\n";
|
$body .= "<br/>\n<div><a href='" . GV_ServerName . "register-confirm=" . $token . "' target='_blank'>" . GV_ServerName . "register-confirm=" . $token . "</a></div>\n";
|
||||||
|
|
||||||
$to = array('email'=>$email,'name'=>$email);
|
$to = array('email' => $email, 'name' => $email);
|
||||||
|
|
||||||
return self::send_mail($subject, $body, $to);
|
return self::send_mail($subject, $body, $to);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function send_mail($subject, $body, $to, $from=false, $files=array(), $reading_confirm_to=false)
|
||||||
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');
|
require_once(GV_RootPath . 'lib/PHPMailer_v5.1/class.phpmailer.php');
|
||||||
|
|
||||||
if(!isset($to['email']) || !PHPMailer::ValidateAddress($to['email']))
|
if (!isset($to['email']) || !PHPMailer::ValidateAddress($to['email']))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$mail = new PHPMailer();
|
$mail = new PHPMailer();
|
||||||
|
|
||||||
$body = eregi_replace("[\]",'',$body);
|
$body = eregi_replace("[\]", '', $body);
|
||||||
|
|
||||||
$body .= "<br/><br/><br/><br/>\n\n\n\n";
|
$body .= "<br/><br/><br/><br/>\n\n\n\n";
|
||||||
$body .= '<div style="font-style:italic;">'._('phraseanet::signature automatique des notifications par mail, infos a l\'url suivante')."</div>\n";
|
$body .= '<div style="font-style:italic;">' . _('phraseanet::signature automatique des notifications par mail, infos a l\'url suivante') . "</div>\n";
|
||||||
$body .= '<div><a href="'.GV_ServerName.'">'.GV_ServerName."</a></div>\n";
|
$body .= '<div><a href="' . GV_ServerName . '">' . GV_ServerName . "</a></div>\n";
|
||||||
$body = '<body>'.$body.'</body>';
|
$body = '<body>' . $body . '</body>';
|
||||||
|
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
$mail->CharSet = 'utf-8';
|
$mail->CharSet = 'utf-8';
|
||||||
$mail->Encoding = 'base64';//'quoted-printable';
|
$mail->Encoding = 'base64'; //'quoted-printable';
|
||||||
|
|
||||||
if(GV_smtp)
|
if (GV_smtp)
|
||||||
{
|
{
|
||||||
$mail->IsSMTP();
|
$mail->IsSMTP();
|
||||||
if(GV_smtp_host != '')
|
if (GV_smtp_host != '')
|
||||||
$mail->Host = GV_smtp_host;
|
$mail->Host = GV_smtp_host;
|
||||||
// $mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
|
// $mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
|
||||||
if(GV_smtp_auth)
|
if (GV_smtp_auth)
|
||||||
{
|
{
|
||||||
$mail->SMTPAuth = true;
|
$mail->SMTPAuth = true;
|
||||||
|
|
||||||
if(GV_smtp_secure === true)
|
if (GV_smtp_secure === true)
|
||||||
{
|
{
|
||||||
$mail->SMTPSecure = "ssl";
|
$mail->SMTPSecure = "ssl";
|
||||||
}
|
}
|
||||||
@@ -229,8 +235,8 @@ class mail
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($from && trim($from['email']) != '')
|
if ($from && trim($from['email']) != '')
|
||||||
$mail->AddReplyTo($from['email'],$from['name']);
|
$mail->AddReplyTo($from['email'], $from['name']);
|
||||||
|
|
||||||
$mail->AddAddress($to['email'], $to['name']);
|
$mail->AddAddress($to['email'], $to['name']);
|
||||||
|
|
||||||
@@ -238,16 +244,16 @@ class mail
|
|||||||
|
|
||||||
$mail->Subject = $subject;
|
$mail->Subject = $subject;
|
||||||
|
|
||||||
$mail->AltBody = html_entity_decode(strip_tags($body),ENT_QUOTES,'UTF-8');
|
$mail->AltBody = html_entity_decode(strip_tags($body), ENT_QUOTES, 'UTF-8');
|
||||||
|
|
||||||
if($reading_confirm_to)
|
if ($reading_confirm_to)
|
||||||
{
|
{
|
||||||
$mail->ConfirmReadingTo = $reading_confirm_to;
|
$mail->ConfirmReadingTo = $reading_confirm_to;
|
||||||
}
|
}
|
||||||
|
|
||||||
$mail->MsgHTML(p4string::cleanTags($body));
|
$mail->MsgHTML(p4string::cleanTags($body));
|
||||||
|
|
||||||
foreach($files as $f)
|
foreach ($files as $f)
|
||||||
{
|
{
|
||||||
$mail->AddAttachment($f); // attachment
|
$mail->AddAttachment($f); // attachment
|
||||||
}
|
}
|
||||||
@@ -264,4 +270,5 @@ class mail
|
|||||||
return $e->getMessage();
|
return $e->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@@ -37,7 +37,7 @@ class phraseadate
|
|||||||
$diff = $compareTo->format('U') - $date->format('U');
|
$diff = $compareTo->format('U') - $date->format('U');
|
||||||
$dayDiff = floor($diff / 86400);
|
$dayDiff = floor($diff / 86400);
|
||||||
|
|
||||||
if(is_nan($dayDiff) || $dayDiff < 0) {
|
if(is_nan($dayDiff)) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -247,7 +247,6 @@ class query
|
|||||||
|
|
||||||
$dstatus = status::getDisplayStatus();
|
$dstatus = status::getDisplayStatus();
|
||||||
|
|
||||||
|
|
||||||
$array_icons = array(
|
$array_icons = array(
|
||||||
'flash' => '',
|
'flash' => '',
|
||||||
'document' => '',
|
'document' => '',
|
||||||
@@ -309,6 +308,7 @@ class query
|
|||||||
|
|
||||||
$thumbnail = answer::getThumbnail($session->ses_id, $data["base_id"], $data["record_id"],GV_zommPrev_rollover_clientAnswer);
|
$thumbnail = answer::getThumbnail($session->ses_id, $data["base_id"], $data["record_id"],GV_zommPrev_rollover_clientAnswer);
|
||||||
|
|
||||||
|
|
||||||
if($thumbnail['sha256'])
|
if($thumbnail['sha256'])
|
||||||
$rsScreen[$irec]['sha256'] = $thumbnail['sha256'];
|
$rsScreen[$irec]['sha256'] = $thumbnail['sha256'];
|
||||||
|
|
||||||
@@ -322,6 +322,7 @@ class query
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(isset($data) && isset($data["status"]))
|
if(isset($data) && isset($data["status"]))
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@@ -453,6 +453,7 @@ function getPreviewWindow($usr,$ses,$lng,$env,$pos,$contId,$roll)
|
|||||||
|
|
||||||
$prev = answer::get_preview($bas,$rec,$isFullyPublic);
|
$prev = answer::get_preview($bas,$rec,$isFullyPublic);
|
||||||
|
|
||||||
|
$preview_html = $prev['html'];
|
||||||
$preview = $prev['preview'];
|
$preview = $prev['preview'];
|
||||||
$flashcontent = $prev['flashcontent'];
|
$flashcontent = $prev['flashcontent'];
|
||||||
$width = $prev['width'];
|
$width = $prev['width'];
|
||||||
@@ -678,6 +679,7 @@ function getPreviewWindow($usr,$ses,$lng,$env,$pos,$contId,$roll)
|
|||||||
|
|
||||||
return p4string::jsonencode(array(
|
return p4string::jsonencode(array(
|
||||||
"prev"=>$preview
|
"prev"=>$preview
|
||||||
|
,"prev_html"=>$preview_html
|
||||||
,"flashcontent"=>$flashcontent
|
,"flashcontent"=>$flashcontent
|
||||||
,"desc"=>p4string::entitydecode($caption)
|
,"desc"=>p4string::entitydecode($caption)
|
||||||
,"width"=>$width
|
,"width"=>$width
|
||||||
|
@@ -170,7 +170,11 @@
|
|||||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||||
<xsl:output method="html"/>
|
<xsl:output method="html"/>
|
||||||
<xsl:template match="/record/description/*">
|
<xsl:template match="/record/description/*">
|
||||||
<b><xsl:value-of select="name()" /></b> : <xsl:value-of select="current()" /><br />
|
<b>
|
||||||
|
<xsl:value-of select="name()" />
|
||||||
|
</b> :
|
||||||
|
<xsl:value-of select="current()" />
|
||||||
|
<br />
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
</xsl:stylesheet>
|
</xsl:stylesheet>
|
||||||
</layout>
|
</layout>
|
||||||
@@ -179,7 +183,11 @@
|
|||||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||||
<xsl:output method="html"/>
|
<xsl:output method="html"/>
|
||||||
<xsl:template match="/record/description/*">
|
<xsl:template match="/record/description/*">
|
||||||
<b><xsl:value-of select="name()" /></b> : <xsl:value-of select="current()" /><br />
|
<b>
|
||||||
|
<xsl:value-of select="name()" />
|
||||||
|
</b> :
|
||||||
|
<xsl:value-of select="current()" />
|
||||||
|
<br />
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
</xsl:stylesheet>
|
</xsl:stylesheet>
|
||||||
</layout>
|
</layout>
|
||||||
@@ -190,7 +198,11 @@
|
|||||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||||
<xsl:output method="html"/>
|
<xsl:output method="html"/>
|
||||||
<xsl:template match="/record/description/*">
|
<xsl:template match="/record/description/*">
|
||||||
<b><xsl:value-of select="name()" /></b> : <xsl:value-of select="current()" /><br />
|
<b>
|
||||||
|
<xsl:value-of select="name()" />
|
||||||
|
</b> :
|
||||||
|
<xsl:value-of select="current()" />
|
||||||
|
<br />
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
</xsl:stylesheet>
|
</xsl:stylesheet>
|
||||||
</layout>
|
</layout>
|
||||||
@@ -199,7 +211,11 @@
|
|||||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||||
<xsl:output method="html"/>
|
<xsl:output method="html"/>
|
||||||
<xsl:template match="/record/description/*">
|
<xsl:template match="/record/description/*">
|
||||||
<b><xsl:value-of select="name()" /></b> : <xsl:value-of select="current()" /><br />
|
<b>
|
||||||
|
<xsl:value-of select="name()" />
|
||||||
|
</b> :
|
||||||
|
<xsl:value-of select="current()" />
|
||||||
|
<br />
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
</xsl:stylesheet>
|
</xsl:stylesheet>
|
||||||
</layout>
|
</layout>
|
||||||
|
@@ -173,7 +173,11 @@
|
|||||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||||
<xsl:output method="html"/>
|
<xsl:output method="html"/>
|
||||||
<xsl:template match="/record/description/*">
|
<xsl:template match="/record/description/*">
|
||||||
<b><xsl:value-of select="name()" /></b> : <xsl:value-of select="current()" /><br />
|
<b>
|
||||||
|
<xsl:value-of select="name()" />
|
||||||
|
</b> :
|
||||||
|
<xsl:value-of select="current()" />
|
||||||
|
<br />
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
</xsl:stylesheet>
|
</xsl:stylesheet>
|
||||||
</layout>
|
</layout>
|
||||||
@@ -182,7 +186,11 @@
|
|||||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||||
<xsl:output method="html"/>
|
<xsl:output method="html"/>
|
||||||
<xsl:template match="/record/description/*">
|
<xsl:template match="/record/description/*">
|
||||||
<b><xsl:value-of select="name()" /></b> : <xsl:value-of select="current()" /><br />
|
<b>
|
||||||
|
<xsl:value-of select="name()" />
|
||||||
|
</b> :
|
||||||
|
<xsl:value-of select="current()" />
|
||||||
|
<br />
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
</xsl:stylesheet>
|
</xsl:stylesheet>
|
||||||
</layout>
|
</layout>
|
||||||
@@ -193,7 +201,11 @@
|
|||||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||||
<xsl:output method="html"/>
|
<xsl:output method="html"/>
|
||||||
<xsl:template match="/record/description/*">
|
<xsl:template match="/record/description/*">
|
||||||
<b><xsl:value-of select="name()" /></b> : <xsl:value-of select="current()" /><br />
|
<b>
|
||||||
|
<xsl:value-of select="name()" />
|
||||||
|
</b> :
|
||||||
|
<xsl:value-of select="current()" />
|
||||||
|
<br />
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
</xsl:stylesheet>
|
</xsl:stylesheet>
|
||||||
</layout>
|
</layout>
|
||||||
@@ -201,7 +213,11 @@
|
|||||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||||
<xsl:output method="html"/>
|
<xsl:output method="html"/>
|
||||||
<xsl:template match="/record/description/*">
|
<xsl:template match="/record/description/*">
|
||||||
<b><xsl:value-of select="name()" /></b> : <xsl:value-of select="current()" /><br />
|
<b>
|
||||||
|
<xsl:value-of select="name()" />
|
||||||
|
</b> :
|
||||||
|
<xsl:value-of select="current()" />
|
||||||
|
<br />
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
</xsl:stylesheet>
|
</xsl:stylesheet>
|
||||||
</layout>
|
</layout>
|
||||||
|
@@ -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
|
// attention, au cas ou il y aurait des espaces dans le path, il faut des quotes
|
||||||
// windows n'accepte pas les simple 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
|
// 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 ) )
|
if( in_array($infos['mime'], $array ) )
|
||||||
$cmd .= ' "'.$infile .'[0]" "'. $outfile .'"';
|
$cmd .= ' "'.$infile .'[0]" "'. $outfile .'"';
|
||||||
else
|
else
|
||||||
|
@@ -46,7 +46,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{# MODULE #}
|
{# MODULE #}
|
||||||
{% if module == "validation" %}
|
{% if module == "lightbox" %}
|
||||||
<b>{% trans 'admin::monitor: module validation' %}</b>
|
<b>{% trans 'admin::monitor: module validation' %}</b>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a id="validation_link" style="display:"
|
<a id="validation_link" style="display:"
|
||||||
|
@@ -138,4 +138,9 @@
|
|||||||
{% if lazaret|length == 0 %}
|
{% if lazaret|length == 0 %}
|
||||||
<div style="margin:20px 10px;">{% trans 'Aucun document dans la quarantaine actuellement' %}</div>
|
<div style="margin:20px 10px;">{% trans 'Aucun document dans la quarantaine actuellement' %}</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function(){
|
||||||
|
$('.tooltip').tooltip();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
</div>
|
</div>
|
@@ -135,8 +135,7 @@ if($request->has_post_datas() && $user->is_admin === true)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif($parm['mount_base'] && $parm['new_hostname'] && $parm['new_port'] && $parm['new_user']
|
elseif($parm['mount_base'])
|
||||||
&& $parm['new_password'] && $parm['new_dbname'])
|
|
||||||
{
|
{
|
||||||
if(!$parm['new_settings'] && $parm['new_dbname'])
|
if(!$parm['new_settings'] && $parm['new_dbname'])
|
||||||
{
|
{
|
||||||
@@ -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']
|
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']))
|
if(p4string::hasAccent($parm['new_dbname']))
|
||||||
$error['new_dbname'] = 'No special chars in 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 = 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);
|
$sbas_id = $base->save($usr_id);
|
||||||
|
|
||||||
|
@@ -92,7 +92,12 @@ if($connbas)
|
|||||||
if($parm["act"]=="CHGSTRUCTURE")
|
if($parm["act"]=="CHGSTRUCTURE")
|
||||||
{
|
{
|
||||||
$errors = databox::get_structure_errors($parm["str"]);
|
$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 = 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"));
|
$domst->documentElement->setAttribute("modification_date", $now = date("YmdHis"));
|
||||||
|
|
||||||
@@ -105,6 +110,12 @@ if($connbas)
|
|||||||
cache_databox::update($parm["p0"],'structure');
|
cache_databox::update($parm["p0"],'structure');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
$errors[] = "Error loadXML(structure)";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(count($errors) != 0)
|
||||||
{
|
{
|
||||||
$msg .= p4string::MakeString(_('admin::base: xml invalide, les changements ne seront pas appliques'), 'js') . "" ;
|
$msg .= p4string::MakeString(_('admin::base: xml invalide, les changements ne seront pas appliques'), 'js') . "" ;
|
||||||
$loadit = false;
|
$loadit = false;
|
||||||
|
@@ -662,7 +662,7 @@ if($cssfile)
|
|||||||
<input type="hidden" name="app" value="client">
|
<input type="hidden" name="app" value="client">
|
||||||
</form>
|
</form>
|
||||||
<script type="text/javascript" src="/include/minify/g=client"></script>
|
<script type="text/javascript" src="/include/minify/g=client"></script>
|
||||||
<script type="text/javascript" src="/include/flowplayer/flowplayer-3.2.2.min.js"></script>
|
<script type="text/javascript" src="/include/flowplayer/flowplayer-3.2.6.min.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
|
||||||
|
@@ -94,7 +94,7 @@ function openPreview(env, pos, contId, reload){
|
|||||||
'display': 'none'
|
'display': 'none'
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#PREVIEWIMGCONT').empty();
|
empty_preview();
|
||||||
|
|
||||||
prevAjax = $.ajax({
|
prevAjax = $.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
@@ -114,6 +114,7 @@ function openPreview(env, pos, contId, reload){
|
|||||||
$('#current_result_n').empty().append(parseInt(pos)+1);
|
$('#current_result_n').empty().append(parseInt(pos)+1);
|
||||||
prevAjaxrunning = true;
|
prevAjaxrunning = true;
|
||||||
$('#PREVIEWIMGDESC, #PREVIEWOTHERS').addClass('loading');
|
$('#PREVIEWIMGDESC, #PREVIEWOTHERS').addClass('loading');
|
||||||
|
empty_preview();
|
||||||
},
|
},
|
||||||
error: function(data){
|
error: function(data){
|
||||||
prevAjaxrunning = false;
|
prevAjaxrunning = false;
|
||||||
@@ -139,7 +140,14 @@ function openPreview(env, pos, contId, reload){
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#PREVIEWIMGCONT').empty().append(data.prev);
|
if((data.type == 'video'))
|
||||||
|
{
|
||||||
|
$('#PREVIEWIMGCONT').html(data.prev_html);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$('#PREVIEWIMGCONT').html(data.prev);
|
||||||
|
}
|
||||||
|
|
||||||
$('#PREVIEWIMGDESCINNER').empty().append(data.desc);
|
$('#PREVIEWIMGDESCINNER').empty().append(data.desc);
|
||||||
$('#HISTORICOPS').empty().append(data.history);
|
$('#HISTORICOPS').empty().append(data.history);
|
||||||
@@ -171,7 +179,8 @@ function openPreview(env, pos, contId, reload){
|
|||||||
p4.preview.current.pos = data.pos;
|
p4.preview.current.pos = data.pos;
|
||||||
p4.preview.current.flashcontent = data.flashcontent;
|
p4.preview.current.flashcontent = data.flashcontent;
|
||||||
|
|
||||||
if ((data.type == 'video' || data.type == 'audio' || data.type == 'flash')) {
|
if ((data.type == 'video' || data.type == 'audio' || data.type == 'flash'))
|
||||||
|
{
|
||||||
if(data.type != 'video' && p4.preview.current.flashcontent.url)
|
if(data.type != 'video' && p4.preview.current.flashcontent.url)
|
||||||
{
|
{
|
||||||
var flashvars = false;
|
var flashvars = false;
|
||||||
@@ -192,22 +201,32 @@ function openPreview(env, pos, contId, reload){
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
flowplayer("FLASHPREVIEW", '/include/flowplayer/flowplayer-3.2.2.swf', {
|
// alert(data.flashcontent.flv);
|
||||||
clip: {
|
// try
|
||||||
autoPlay: true,
|
// {
|
||||||
autoBuffering:true,
|
// flowplayer("FLASHPREVIEW", {src:"/include/flowplayer/flowplayer-3.2.6.swf", wmode: "transparent"}, {
|
||||||
provider: 'h264streaming',
|
// clip: {
|
||||||
metadata: false,
|
// autoPlay: true,
|
||||||
scaling:'fit',
|
// autoBuffering:true,
|
||||||
url: data.flashcontent.flv
|
// provider: 'h264streaming',
|
||||||
},
|
// metadata: false,
|
||||||
onError:function(code,message){getNewVideoToken(data.base_id, data.record_id, this);},
|
// scaling:'fit',
|
||||||
plugins: {
|
// url: data.flashcontent.flv
|
||||||
h264streaming: {
|
// },
|
||||||
url: '/include/flowplayer/flowplayer.pseudostreaming-3.2.2.swf'
|
// onError:function(code,message){getNewVideoToken(data.base_id, data.record_id, this);},
|
||||||
}
|
// plugins: {
|
||||||
}
|
// h264streaming: {
|
||||||
});
|
// url: '/include/flowplayer/flowplayer.pseudostreaming-3.2.6.swf'
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// $('#PREVIEWIMGDESCINNER').empty().append('<textarea></textarea>').find('textarea').val($('#FLASHPREVIEW').html());
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// catch(err)
|
||||||
|
// {
|
||||||
|
// alert(err);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -365,10 +384,20 @@ function setTitle(title){
|
|||||||
|
|
||||||
function cancelPreview(){
|
function cancelPreview(){
|
||||||
$('#PREVIEWIMGDESCINNER').empty();
|
$('#PREVIEWIMGDESCINNER').empty();
|
||||||
$('#PREVIEWIMGCONT').empty();
|
empty_preview();
|
||||||
p4.preview.current = false;
|
p4.preview.current = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function empty_preview()
|
||||||
|
{
|
||||||
|
var player_cont = $('#PREVIEWIMGCONT object').parent();
|
||||||
|
if(player_cont.attr('id') != 'PREVIEWIMGCONT')
|
||||||
|
{
|
||||||
|
player_cont.empty();
|
||||||
|
player_cont.remove();
|
||||||
|
}
|
||||||
|
$('#PREVIEWIMGCONT').empty();
|
||||||
|
}
|
||||||
|
|
||||||
function startSlide(){
|
function startSlide(){
|
||||||
if (!p4.slideShow) {
|
if (!p4.slideShow) {
|
||||||
@@ -580,6 +609,7 @@ function doudouMode(){
|
|||||||
|
|
||||||
function closePreview(){
|
function closePreview(){
|
||||||
p4.preview.open = false;
|
p4.preview.open = false;
|
||||||
|
empty_preview();
|
||||||
hideOverlay();
|
hideOverlay();
|
||||||
|
|
||||||
$('#PREVIEWBOX').fadeTo(500, 0);
|
$('#PREVIEWBOX').fadeTo(500, 0);
|
||||||
|
@@ -143,6 +143,11 @@
|
|||||||
// save elements title before the tooltip is displayed
|
// save elements title before the tooltip is displayed
|
||||||
function save(event) {
|
function save(event) {
|
||||||
// if this is the current source, or it has no title (occurs with click event), stop
|
// if this is the current source, or it has no title (occurs with click event), stop
|
||||||
|
if(event.stopPropagation)
|
||||||
|
event.stopPropagation();
|
||||||
|
|
||||||
|
event.cancelBubble = true;
|
||||||
|
|
||||||
if ( $.tooltip.blocked || this == $.tooltip.current || (!this.tooltipText && !settings(this).bodyHandler) )
|
if ( $.tooltip.blocked || this == $.tooltip.current || (!this.tooltipText && !settings(this).bodyHandler) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -509,6 +514,9 @@
|
|||||||
$.tooltip.current = null;
|
$.tooltip.current = null;
|
||||||
function complete() {
|
function complete() {
|
||||||
helper.parent.removeClass( tsettings.extraClass ).hide().css("opacity", "");
|
helper.parent.removeClass( tsettings.extraClass ).hide().css("opacity", "");
|
||||||
|
var el =helper.parent.find('object').parent();
|
||||||
|
el.empty();
|
||||||
|
el.remove();
|
||||||
}
|
}
|
||||||
if ((!IE || !$.fn.bgiframe) && tsettings.fade) {
|
if ((!IE || !$.fn.bgiframe) && tsettings.fade) {
|
||||||
if (helper.parent.is(':animated'))
|
if (helper.parent.is(':animated'))
|
||||||
|
@@ -95,7 +95,7 @@ $groups = array(
|
|||||||
,'//prod/jquery.order.js'
|
,'//prod/jquery.order.js'
|
||||||
,'//include/jslibs/jquery.sprintf.1.0.3.js'
|
,'//include/jslibs/jquery.sprintf.1.0.3.js'
|
||||||
, '//include/jquery.tooltip.js'
|
, '//include/jquery.tooltip.js'
|
||||||
, '//include/flowplayer/flowplayer-3.2.2.min.js'
|
, '//include/flowplayer/flowplayer-3.2.6.min.js'
|
||||||
, '//include/jquery.p4.preview.js'
|
, '//include/jquery.p4.preview.js'
|
||||||
, '//prod/jquery.edit.js'
|
, '//prod/jquery.edit.js'
|
||||||
, '//include/jslibs/jquery.color.animation.js'
|
, '//include/jslibs/jquery.color.animation.js'
|
||||||
@@ -134,7 +134,7 @@ $groups = array(
|
|||||||
,'//include/jslibs/jquery.contextmenu_scroll.js'
|
,'//include/jslibs/jquery.contextmenu_scroll.js'
|
||||||
,'//include/jquery.common.js'
|
,'//include/jquery.common.js'
|
||||||
,'//lightbox/jquery.lightbox.js'
|
,'//lightbox/jquery.lightbox.js'
|
||||||
, '//include/flowplayer/flowplayer-3.2.2.min.js'
|
, '//include/flowplayer/flowplayer-3.2.6.min.js'
|
||||||
),
|
),
|
||||||
'lightboxie6' => array(
|
'lightboxie6' => array(
|
||||||
'//include/jslibs/jquery-1.4.4.js'
|
'//include/jslibs/jquery-1.4.4.js'
|
||||||
@@ -148,7 +148,7 @@ $groups = array(
|
|||||||
, '//include/jslibs/jquery.contextmenu_scroll.js'
|
, '//include/jslibs/jquery.contextmenu_scroll.js'
|
||||||
,'//include/jquery.common.js'
|
,'//include/jquery.common.js'
|
||||||
,'//lightbox/jquery.lightbox.ie6.js'
|
,'//lightbox/jquery.lightbox.ie6.js'
|
||||||
, '//include/flowplayer/flowplayer-3.2.2.min.js'
|
, '//include/flowplayer/flowplayer-3.2.6.min.js'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@@ -117,7 +117,7 @@ phrasea::headers();
|
|||||||
padding:50px 0 20px;
|
padding:50px 0 20px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script type="text/javascript" src="/include/flowplayer/flowplayer-3.2.2.min.js"></script>
|
<script type="text/javascript" src="/include/flowplayer/flowplayer-3.2.6.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<?php
|
<?php
|
||||||
@@ -142,7 +142,7 @@ phrasea::headers();
|
|||||||
$embed = '<img src="'.$url.'" title="" />';
|
$embed = '<img src="'.$url.'" title="" />';
|
||||||
break;
|
break;
|
||||||
case 'video':
|
case 'video':
|
||||||
$embed = '<div style="width: 600px; height: 400px;" id="flash_preview"></div><script type="text/javascript">flowplayer("flash_preview", "/include/flowplayer/flowplayer-3.2.2.swf", "'.$url.'");</script>';
|
$embed = '<div style="width: 600px; height: 400px;" id="flash_preview"></div><script type="text/javascript">flowplayer("flash_preview", "/include/flowplayer/flowplayer-3.2.6.swf", "'.$url.'");</script>';
|
||||||
break;
|
break;
|
||||||
case 'document':
|
case 'document':
|
||||||
$embed = '<object width="850" height="500" type="application/x-shockwave-flash" data="/include/FlexPaper_flash/FlexPaperViewer.swf" style="visibility: visible; width: 850px; height: 500px; top: 0px;">
|
$embed = '<object width="850" height="500" type="application/x-shockwave-flash" data="/include/FlexPaper_flash/FlexPaperViewer.swf" style="visibility: visible; width: 850px; height: 500px; top: 0px;">
|
||||||
|
@@ -52,7 +52,8 @@ $list = $download->prepare_export($parm['obj'], $titre);
|
|||||||
|
|
||||||
$list['export_name'] = $exportname.'.zip';
|
$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));
|
$token = random::getUrlToken('download',false,$endDate,serialize($list));
|
||||||
|
|
||||||
@@ -75,7 +76,7 @@ if($parm['reading_confirm'] == '1')
|
|||||||
|
|
||||||
foreach($dest as $email)
|
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;
|
$res[] = $email;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -51,7 +51,7 @@ try
|
|||||||
'baskets_collection' => $basket_collection,
|
'baskets_collection' => $basket_collection,
|
||||||
'basket' => $basket,
|
'basket' => $basket,
|
||||||
'local_title' => strip_tags($basket->name),
|
'local_title' => strip_tags($basket->name),
|
||||||
'module' => 'validation',
|
'module' => 'lightbox',
|
||||||
'module_name' => _('admin::monitor: module validation')
|
'module_name' => _('admin::monitor: module validation')
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@@ -26,10 +26,10 @@ $item = $defaultchannel->appendChild($defaultdom->createElement('item'));
|
|||||||
$title = $item->appendChild($defaultdom->createElement('title'));
|
$title = $item->appendChild($defaultdom->createElement('title'));
|
||||||
$title->appendChild($defaultdom->createTextNode(GV_homeTitle));
|
$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';
|
$pathPic = GV_RootPath.'www/custom/home.jpg';
|
||||||
$urlPic = '/config/home.jpg';
|
$urlPic = '/custom/home.jpg';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -1,22 +1,22 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once dirname( __FILE__ ) . "/../../lib/bootstrap.php";
|
require_once dirname(__FILE__) . "/../../lib/bootstrap.php";
|
||||||
$session = session::getInstance();
|
$session = session::getInstance();
|
||||||
|
|
||||||
require_once( GV_RootPath . 'lib/unicode/lownodiacritics_utf8.php' );
|
require_once( GV_RootPath . 'lib/unicode/lownodiacritics_utf8.php' );
|
||||||
|
|
||||||
$request = httpRequest::getInstance();
|
$request = httpRequest::getInstance();
|
||||||
|
|
||||||
if(!isset($parm))
|
if (!isset($parm))
|
||||||
$parm = $request->get_parms("bas", "qry", "pag"
|
$parm = $request->get_parms("bas", "qry", "pag"
|
||||||
, "sel", "ord"
|
, "sel", "ord"
|
||||||
, "search_type", "recordtype", "status", "fields", "datemin", "datemax", "datefield");
|
, "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;
|
$ses_id = $session->ses_id;
|
||||||
$usr_id = $session->usr_id;
|
$usr_id = $session->usr_id;
|
||||||
if(!($ph_session = phrasea_open_session((int)$ses_id, $usr_id)))
|
if (!($ph_session = phrasea_open_session((int) $ses_id, $usr_id)))
|
||||||
{
|
{
|
||||||
header("Location: /login/?err=no-session");
|
header("Location: /login/?err=no-session");
|
||||||
exit();
|
exit();
|
||||||
@@ -25,7 +25,7 @@ if(isset($session->usr_id) && isset($session->ses_id))
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$request = httpRequest::getInstance();
|
$request = httpRequest::getInstance();
|
||||||
if($request->is_ajax())
|
if ($request->is_ajax())
|
||||||
{
|
{
|
||||||
echo _('Votre session est expiree, veuillez vous reconnecter');
|
echo _('Votre session est expiree, veuillez vous reconnecter');
|
||||||
}
|
}
|
||||||
@@ -36,25 +36,25 @@ else
|
|||||||
exit();
|
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)
|
if ($parm["ord"] === NULL)
|
||||||
$parm["ord"] = PHRASEA_ORDER_DESC;
|
$parm["ord"] = PHRASEA_ORDER_DESC;
|
||||||
else
|
else
|
||||||
$parm["ord"] = (int)$parm["ord"];
|
$parm["ord"] = (int) $parm["ord"];
|
||||||
|
|
||||||
$parm['sel'] = explode(';',$parm['sel']);
|
$parm['sel'] = explode(';', $parm['sel']);
|
||||||
|
|
||||||
if(!$parm['bas'])
|
if (!$parm['bas'])
|
||||||
$parm['bas'] = array();
|
$parm['bas'] = array();
|
||||||
|
|
||||||
if(!$parm["pag"]===NULL)
|
if (!$parm["pag"] === NULL)
|
||||||
$parm["pag"] = "0";
|
$parm["pag"] = "0";
|
||||||
|
|
||||||
if(trim($parm["qry"])==='')
|
if (trim($parm["qry"]) === '')
|
||||||
$parm["qry"] = "all";
|
$parm["qry"] = "all";
|
||||||
|
|
||||||
$mod = user::getPrefs('view');
|
$mod = user::getPrefs('view');
|
||||||
@@ -65,61 +65,61 @@ $options = array(
|
|||||||
'champs' => $parm['fields'],
|
'champs' => $parm['fields'],
|
||||||
'status' => $parm['status'],
|
'status' => $parm['status'],
|
||||||
'date' => array(
|
'date' => array(
|
||||||
'minbound'=>$parm['datemin'],
|
'minbound' => $parm['datemin'],
|
||||||
'maxbound'=>$parm['datemax'],
|
'maxbound' => $parm['datemax'],
|
||||||
'field'=>explode('|',$parm['datefield'])
|
'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);
|
$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;
|
$proposals = trim($parm['pag']) === '' ? $query->proposals() : false;
|
||||||
|
|
||||||
|
|
||||||
$npages = $result['pages'];
|
$npages = $result['pages'];
|
||||||
$page = $result['current_page'];
|
$page = $result['current_page'];
|
||||||
$string ='';
|
$string = '';
|
||||||
|
|
||||||
if($npages>1)
|
if ($npages > 1)
|
||||||
{
|
{
|
||||||
|
|
||||||
$d2top = ($npages - $page);
|
$d2top = ($npages - $page);
|
||||||
$d2bottom = $page;
|
$d2bottom = $page;
|
||||||
|
|
||||||
if(min($d2top,$d2bottom) < 4)
|
if (min($d2top, $d2bottom) < 4)
|
||||||
{
|
{
|
||||||
if($d2bottom < 4)
|
if ($d2bottom < 4)
|
||||||
{
|
{
|
||||||
for($i=1;($i<=4 && (($i<=$npages)===true));$i++)
|
for ($i = 1; ($i <= 4 && (($i <= $npages) === true)); $i++)
|
||||||
{
|
{
|
||||||
if($i == $page)
|
if ($i == $page)
|
||||||
$string .= '<input onkeypress="if(event.keyCode == 13 && !isNaN(parseInt(this.value)))gotopage(parseInt(this.value))" type="text" value="'.$i.'" size="'.(strlen((string)$i)).'" />';
|
$string .= '<input onkeypress="if(event.keyCode == 13 && !isNaN(parseInt(this.value)))gotopage(parseInt(this.value))" type="text" value="' . $i . '" size="' . (strlen((string) $i)) . '" />';
|
||||||
else
|
else
|
||||||
$string .= "<a onclick='gotopage(".$i.");return false;'>".$i."</a>";
|
$string .= "<a onclick='gotopage(" . $i . ");return false;'>" . $i . "</a>";
|
||||||
}
|
}
|
||||||
if($npages >4)
|
if ($npages > 4)
|
||||||
$string .= "<a onclick='gotopage(".($npages).");return false;'>>></a>";
|
$string .= "<a onclick='gotopage(" . ($npages) . ");return false;'>>></a>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$start = $npages-4;
|
$start = $npages - 4;
|
||||||
if(($start)>0)
|
if (($start) > 0)
|
||||||
$string .= "<a onclick='gotopage(1);return false;'><<</a>";
|
$string .= "<a onclick='gotopage(1);return false;'><<</a>";
|
||||||
else
|
else
|
||||||
$start = 1;
|
$start = 1;
|
||||||
for($i=($start);$i<=$npages;$i++)
|
for ($i = ($start); $i <= $npages; $i++)
|
||||||
{
|
{
|
||||||
if($i == $page)
|
if ($i == $page)
|
||||||
$string .= '<input onkeypress="if(event.keyCode == 13 && !isNaN(parseInt(this.value)))gotopage(parseInt(this.value))" type="text" value="'.$i.'" size="'.(strlen((string)$i)).'" />';
|
$string .= '<input onkeypress="if(event.keyCode == 13 && !isNaN(parseInt(this.value)))gotopage(parseInt(this.value))" type="text" value="' . $i . '" size="' . (strlen((string) $i)) . '" />';
|
||||||
else
|
else
|
||||||
$string .= "<a onclick='gotopage(".$i.");return false;'>".$i."</a>";
|
$string .= "<a onclick='gotopage(" . $i . ");return false;'>" . $i . "</a>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -127,47 +127,41 @@ $string ='';
|
|||||||
{
|
{
|
||||||
$string .= "<a onclick='gotopage(1);return false;'><<</a>";
|
$string .= "<a onclick='gotopage(1);return false;'><<</a>";
|
||||||
|
|
||||||
for($i=($page-2);$i<=($page+2);$i++)
|
for ($i = ($page - 2); $i <= ($page + 2); $i++)
|
||||||
{
|
{
|
||||||
if($i == $page)
|
if ($i == $page)
|
||||||
$string .= '<input onkeypress="if(event.keyCode == 13 && !isNaN(parseInt(this.value)))gotopage(parseInt(this.value))" type="text" value="'.$i.'" size="'.(strlen((string)$i)).'" />';
|
$string .= '<input onkeypress="if(event.keyCode == 13 && !isNaN(parseInt(this.value)))gotopage(parseInt(this.value))" type="text" value="' . $i . '" size="' . (strlen((string) $i)) . '" />';
|
||||||
else
|
else
|
||||||
$string .= "<a onclick='gotopage(".$i.");return false;'>".$i."</a>";
|
$string .= "<a onclick='gotopage(" . $i . ");return false;'>" . $i . "</a>";
|
||||||
}
|
}
|
||||||
|
|
||||||
$string .= "<a onclick='gotopage(".($npages).");return false;'>>></a>";
|
$string .= "<a onclick='gotopage(" . ($npages) . ");return false;'>>></a>";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
$string .= '<div style="display:none;"><div id="NEXT_PAGE"></div><div id="PREV_PAGE"></div></div>';
|
||||||
|
|
||||||
|
$explain = $result['explain'];
|
||||||
|
|
||||||
|
$infoResult = ' | <a href="#" class="infoDialog" infos="' . str_replace('"', '"', $explain) . '">' . sprintf(_('reponses:: %d reponses'), $session->prod['query']['nba']) . '</a> | ' . sprintf(_('reponses:: %s documents selectionnes'), '<span id="nbrecsel"></span>');
|
||||||
|
|
||||||
}
|
echo "<script type='text/javascript'>$('#tool_results').empty().append('" . str_replace("'", "\'", $infoResult) . "');</script>";
|
||||||
$string .= '<div style="display:none;"><div id="NEXT_PAGE"></div><div id="PREV_PAGE"></div></div>';
|
echo "<script type='text/javascript'>$('#tool_navigate').empty().append('" . str_replace("'", "\'", $string) . "');</script>";
|
||||||
|
|
||||||
|
$rsScreen = $result['result'];
|
||||||
|
|
||||||
$explain = $result['explain'];
|
if (count($rsScreen) > 0)
|
||||||
|
{
|
||||||
$infoResult = ' | <a href="#" class="infoDialog" infos="'.str_replace('"','"',$explain).'">'.sprintf(_('reponses:: %d reponses'),$session->prod['query']['nba']).'</a> | '.sprintf(_('reponses:: %s documents selectionnes'),'<span id="nbrecsel"></span>');
|
if ($mod == 'thumbs')
|
||||||
|
|
||||||
echo "<script type='text/javascript'>$('#tool_results').empty().append('".str_replace("'","\'",$infoResult)."');</script>";
|
|
||||||
echo "<script type='text/javascript'>$('#tool_navigate').empty().append('".str_replace("'","\'",$string)."');</script>";
|
|
||||||
|
|
||||||
$rsScreen = $result['result'];
|
|
||||||
|
|
||||||
if(count($rsScreen)>0)
|
|
||||||
{
|
|
||||||
if($mod == 'thumbs')
|
|
||||||
require("answergrid.php");
|
require("answergrid.php");
|
||||||
else
|
else
|
||||||
require("answerlist.php");
|
require("answerlist.php");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo '<div style="float:left;">';
|
echo '<div style="float:left;">';
|
||||||
phrasea::getHome('HELP','prod');
|
phrasea::getHome('HELP', 'prod');
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function proposalsToHTML(&$proposals)
|
function proposalsToHTML(&$proposals)
|
||||||
{
|
{
|
||||||
@@ -176,19 +170,19 @@ function proposalsToHTML(&$proposals)
|
|||||||
$nbasesWprop = count($proposals["BASES"]);
|
$nbasesWprop = count($proposals["BASES"]);
|
||||||
|
|
||||||
$b = 0;
|
$b = 0;
|
||||||
foreach($proposals["BASES"] as $zbase)
|
foreach ($proposals["BASES"] as $zbase)
|
||||||
{
|
{
|
||||||
if((int)(count($zbase["TERMS"]) > 0))
|
if ((int) (count($zbase["TERMS"]) > 0))
|
||||||
{
|
{
|
||||||
if(($nbasesWprop > 1))
|
if (($nbasesWprop > 1))
|
||||||
{
|
{
|
||||||
$style = $b==0 ? "style=\"margin-top:0px;\"":"";
|
$style = $b == 0 ? "style=\"margin-top:0px;\"" : "";
|
||||||
$html .= "<h1".$style.">". sprintf(_('reponses::propositions pour la base %s'),$zbase["NAME"])."</h1>";
|
$html .= "<h1" . $style . ">" . sprintf(_('reponses::propositions pour la base %s'), $zbase["NAME"]) . "</h1>";
|
||||||
}
|
}
|
||||||
$t = 0;
|
$t = 0;
|
||||||
foreach($zbase["TERMS"] as $path=>$props)
|
foreach ($zbase["TERMS"] as $path => $props)
|
||||||
{
|
{
|
||||||
$style = $t==0 ? "style=\"margin-top:0px;\"":"";
|
$style = $t == 0 ? "style=\"margin-top:0px;\"" : "";
|
||||||
$html .= "<h2 $style>" . sprintf(_('reponses::propositions pour le terme %s'), $props["TERM"]) . "</h2>";
|
$html .= "<h2 $style>" . sprintf(_('reponses::propositions pour le terme %s'), $props["TERM"]) . "</h2>";
|
||||||
$html .= $props["HTML"];
|
$html .= $props["HTML"];
|
||||||
$t++;
|
$t++;
|
||||||
@@ -201,33 +195,39 @@ function proposalsToHTML(&$proposals)
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
<?php
|
<?php
|
||||||
if($proposals)
|
if ($proposals)
|
||||||
{
|
{
|
||||||
?>
|
?>
|
||||||
$('#proposals').empty().append("<?php echo $proposals?>");
|
$('#proposals').empty().append("<?php echo $proposals ?>");
|
||||||
$('.activeproposals').show();
|
$('.activeproposals').show();
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
elseif(trim($parm['pag']) === '')
|
elseif (trim($parm['pag']) === '')
|
||||||
{
|
{
|
||||||
?>
|
?>
|
||||||
$('#proposals').empty();
|
$('#proposals').empty();
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<?php if($page>1 && $session->prod['query']['nba']>0){ ?>
|
<?php if ($page > 1 && $session->prod['query']['nba'] > 0)
|
||||||
$("#PREV_PAGE").bind('click',function(){gotopage(<?php echo ($page-1)?>)});
|
{ ?>
|
||||||
<?php }else{?>
|
$("#PREV_PAGE").bind('click',function(){gotopage(<?php echo ($page - 1) ?>)});
|
||||||
|
<?php }
|
||||||
|
else
|
||||||
|
{ ?>
|
||||||
$("#PREV_PAGE").unbind('click');
|
$("#PREV_PAGE").unbind('click');
|
||||||
<?php }
|
<?php }
|
||||||
if($page<$npages && $session->prod['query']['nba']>0){ ?>
|
if ($page < $npages && $session->prod['query']['nba'] > 0)
|
||||||
$("#NEXT_PAGE").bind('click',function(){gotopage(<?php echo ($page+1)?>)});
|
{ ?>
|
||||||
<?php }else{?>
|
$("#NEXT_PAGE").bind('click',function(){gotopage(<?php echo ($page + 1) ?>)});
|
||||||
|
<?php }
|
||||||
|
else
|
||||||
|
{ ?>
|
||||||
$("#NEXT_PAGE").unbind('click');
|
$("#NEXT_PAGE").unbind('click');
|
||||||
<?php }?>
|
<?php } ?>
|
||||||
p4.tot = <?php echo ((is_int((int)$session->prod['query']['nba']) && (int)$session->prod['query']['nba']>=0)?(int)$session->prod['query']['nba']:0)?>;
|
p4.tot = <?php echo ((is_int((int) $session->prod['query']['nba']) && (int) $session->prod['query']['nba'] >= 0) ? (int) $session->prod['query']['nba'] : 0) ?>;
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@@ -910,7 +910,7 @@ function HTML_Thesaurus(&$html)
|
|||||||
$class_status = '';
|
$class_status = '';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<div pos="<?php echo $idia ?>" id="idEditDiapo_<?php echo $idia ?>" class="diapo <?php echo $class_status; ?>" style="<?php echo $diapostyle ?>;">
|
<div pos="<?php echo $idia ?>" id="idEditDiapo_<?php echo $idia ?>" class="diapo <?php echo $class_status; ?> <?php echo $basrec['type'] ?>_bloc" style="<?php echo $diapostyle ?>;">
|
||||||
<div class='titre'>
|
<div class='titre'>
|
||||||
<?php echo p4string::MakeString($basrec['originalname'], 'html') . "\n" ?>
|
<?php echo p4string::MakeString($basrec['originalname'], 'html') . "\n" ?>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -776,6 +776,8 @@ $rss_infos = user::getMyRss();
|
|||||||
<script type="text/javascript" src="/include/swfobject/swfobject.js"></script>
|
<script type="text/javascript" src="/include/swfobject/swfobject.js"></script>
|
||||||
<script type="text/javascript" src="/include/jslibs/jquery-1.4.4.js"></script>
|
<script type="text/javascript" src="/include/jslibs/jquery-1.4.4.js"></script>
|
||||||
<script type="text/javascript" src="/include/jslibs/jquery-ui-1.7.2.js"></script>
|
<script type="text/javascript" src="/include/jslibs/jquery-ui-1.7.2.js"></script>
|
||||||
|
<script type="text/javascript" src="/include/colorpicker/js/colorpicker.js"></script>
|
||||||
|
<script type="text/javascript" src="/include/jslibs/json2.js"></script>
|
||||||
<script type="text/javascript" src="/include/jslibs/jquery.cookie.js"></script>
|
<script type="text/javascript" src="/include/jslibs/jquery.cookie.js"></script>
|
||||||
<script type="text/javascript" src="/include/jquery.common.js"></script>
|
<script type="text/javascript" src="/include/jquery.common.js"></script>
|
||||||
<script type="text/javascript" src="/include/jslibs/jquery.form.2.49.js"></script>
|
<script type="text/javascript" src="/include/jslibs/jquery.form.2.49.js"></script>
|
||||||
@@ -783,6 +785,7 @@ $rss_infos = user::getMyRss();
|
|||||||
<script type="text/javascript" src="/include/jslibs/json2.js"></script>
|
<script type="text/javascript" src="/include/jslibs/json2.js"></script>
|
||||||
<script type="text/javascript" src="/include/jslibs/jquery.sprintf.1.0.3.js"></script>
|
<script type="text/javascript" src="/include/jslibs/jquery.sprintf.1.0.3.js"></script>
|
||||||
<script type="text/javascript" src="/include/jquery.tooltip.js"></script>
|
<script type="text/javascript" src="/include/jquery.tooltip.js"></script>
|
||||||
|
<script type="text/javascript" src="/include/flowplayer/flowplayer-3.2.6.min.js"></script>
|
||||||
<script type="text/javascript" src="/include/jquery.p4.preview.js"></script>
|
<script type="text/javascript" src="/include/jquery.p4.preview.js"></script>
|
||||||
<script type="text/javascript" src="/prod/jquery.edit.js"></script>
|
<script type="text/javascript" src="/prod/jquery.edit.js"></script>
|
||||||
<script type="text/javascript" src="/include/jslibs/jquery.color.animation.js"></script>
|
<script type="text/javascript" src="/include/jslibs/jquery.color.animation.js"></script>
|
||||||
@@ -1245,6 +1248,17 @@ $rss_infos = user::getMyRss();
|
|||||||
?>
|
?>
|
||||||
<!-- <li><a href="#popular-queries">Popular</a></li>-->
|
<!-- <li><a href="#popular-queries">Popular</a></li>-->
|
||||||
</ul>
|
</ul>
|
||||||
|
<div id="bases-queries" class="PNB" style="top:30px;overflow:hidden;">
|
||||||
|
<div class="PNB10" style="overflow-y:auto;overflow-x:auto;">
|
||||||
|
|
||||||
|
<?php echo $outB.str_replace('__UNIQUEID__',mt_rand(10000,99999),implode('<div><hr/></div>',$sbase));?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="history-queries" class="PNB" style="top:30px;overflow:hidden;">
|
||||||
|
<div class="PNB10" style="overflow-y:auto;overflow-x:auto;">
|
||||||
|
<?php echo queries::history(); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<?php
|
<?php
|
||||||
if(queries::topics_exists())
|
if(queries::topics_exists())
|
||||||
{
|
{
|
||||||
@@ -1262,17 +1276,6 @@ $rss_infos = user::getMyRss();
|
|||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<div id="bases-queries" class="PNB" style="top:30px;overflow:hidden;">
|
|
||||||
<div class="PNB10" style="overflow-y:auto;overflow-x:auto;">
|
|
||||||
|
|
||||||
<?php echo $outB.str_replace('__UNIQUEID__',mt_rand(10000,99999),implode('<div><hr/></div>',$sbase));?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="history-queries" class="PNB" style="top:30px;overflow:hidden;">
|
|
||||||
<div class="PNB10" style="overflow-y:auto;overflow-x:auto;">
|
|
||||||
<?php echo queries::history(); ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- <div id="popular-queries" class="PNB" style="top:30px;overflow:hidden;">-->
|
<!-- <div id="popular-queries" class="PNB" style="top:30px;overflow:hidden;">-->
|
||||||
<!-- <div class="PNB10" style="overflow-y:auto;overflow-x:auto;">-->
|
<!-- <div class="PNB10" style="overflow-y:auto;overflow-x:auto;">-->
|
||||||
<!---->
|
<!---->
|
||||||
|
@@ -852,7 +852,7 @@ function edit_clk_editimg(evt, i)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#TH_Opreview .PNB10').empty();
|
empty_preview_edit();
|
||||||
|
|
||||||
var selected = $('#EDIT_FILM2 .diapo.selected');
|
var selected = $('#EDIT_FILM2 .diapo.selected');
|
||||||
if(selected.length == 1)
|
if(selected.length == 1)
|
||||||
@@ -1234,6 +1234,7 @@ function edit_applyMultiDesc(evt)
|
|||||||
var sendorder = "";
|
var sendorder = "";
|
||||||
var sendChuOrder = "";
|
var sendChuOrder = "";
|
||||||
|
|
||||||
|
empty_preview_edit();
|
||||||
var t = "";
|
var t = "";
|
||||||
|
|
||||||
if(p4.edit.textareaIsDirty && edit_validField(evt, "ask_ok")==false)
|
if(p4.edit.textareaIsDirty && edit_validField(evt, "ask_ok")==false)
|
||||||
@@ -1334,7 +1335,7 @@ function edit_applyMultiDesc(evt)
|
|||||||
function edit_cancelMultiDesc(evt)
|
function edit_cancelMultiDesc(evt)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
empty_preview_edit();
|
||||||
var dirty = false;
|
var dirty = false;
|
||||||
|
|
||||||
evt.cancelBubble = true;
|
evt.cancelBubble = true;
|
||||||
@@ -1502,6 +1503,7 @@ function EditThesaurusSeeker(sbas_id)
|
|||||||
this.jq = $.ajax({
|
this.jq = $.ajax({
|
||||||
url: url,
|
url: url,
|
||||||
data: parms,
|
data: parms,
|
||||||
|
type:'POST',
|
||||||
success: function(ret)
|
success: function(ret)
|
||||||
{
|
{
|
||||||
me.TH_P_node.html("...");
|
me.TH_P_node.html("...");
|
||||||
@@ -1855,7 +1857,7 @@ function vsplit2()
|
|||||||
|
|
||||||
function setPreviewEdit()
|
function setPreviewEdit()
|
||||||
{
|
{
|
||||||
if(!$('#EDITWINDOW').is(':visible'))
|
if(!$('#TH_Opreview').is(':visible'))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var selected = $('#EDIT_FILM2 .diapo.selected');
|
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)
|
function previewEdit(r)
|
||||||
{
|
{
|
||||||
|
empty_preview_edit();
|
||||||
$('#TH_Opreview .PNB10').empty().append(p4.edit.T_records[r].preview.preview);
|
$('#TH_Opreview .PNB10').append(p4.edit.T_records[r].preview.preview);
|
||||||
|
|
||||||
var data = p4.edit.T_records[r].preview;
|
var data = p4.edit.T_records[r].preview;
|
||||||
|
|
||||||
@@ -1964,7 +1977,7 @@ function previewEdit(r)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
flowplayer("FLASHPREVIEW", '/include/flowplayer/flowplayer-3.2.2.swf',{
|
flowplayer("rolloverpreview", '/include/flowplayer/flowplayer-3.2.6.swf',{
|
||||||
clip: {
|
clip: {
|
||||||
autoPlay: true,
|
autoPlay: true,
|
||||||
autoBuffering:true,
|
autoBuffering:true,
|
||||||
@@ -1978,7 +1991,7 @@ function previewEdit(r)
|
|||||||
},
|
},
|
||||||
plugins: {
|
plugins: {
|
||||||
h264streaming: {
|
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.regbasprid = regbasprid;
|
||||||
p4.edit.ssel = ssel;
|
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.edit_field:odd').addClass('odd');
|
||||||
$('#divS div').bind('mouseover',function(){
|
$('#divS div').bind('mouseover',function(){
|
||||||
|
@@ -61,7 +61,7 @@ if($request->has_post_datas())
|
|||||||
try{
|
try{
|
||||||
$story = new basket();
|
$story = new basket();
|
||||||
$story->name = $parm['name'];
|
$story->name = $parm['name'];
|
||||||
$story->desc = $parm['desc'];
|
$story->desc = strip_tags(str_replace('<br>',"\n",$parm['desc']));
|
||||||
$story->is_grouping = true;
|
$story->is_grouping = true;
|
||||||
$story->base_id = $parm['coll'];
|
$story->base_id = $parm['coll'];
|
||||||
$story->save();
|
$story->save();
|
||||||
|
@@ -114,7 +114,7 @@ $right = false;
|
|||||||
switch($type)
|
switch($type)
|
||||||
{
|
{
|
||||||
case 'video':
|
case 'video':
|
||||||
$embed = '<object width="100%" height="100%" type="application/x-shockwave-flash" data="'.GV_ServerName.'include/flowplayer/flowplayer-3.2.2.swf">'.
|
$embed = '<object width="100%" height="100%" type="application/x-shockwave-flash" data="'.GV_ServerName.'include/flowplayer/flowplayer-3.2.6.swf">'.
|
||||||
'<param value="true" name="allowfullscreen">'.
|
'<param value="true" name="allowfullscreen">'.
|
||||||
'<param value="always" name="allowscriptaccess">'.
|
'<param value="always" name="allowscriptaccess">'.
|
||||||
'<param value="high" name="quality">'.
|
'<param value="high" name="quality">'.
|
||||||
|
@@ -184,12 +184,13 @@ function T_filter_delayed2(f, delay, mode)
|
|||||||
var zurl = "/xmlhttp/search_th_term_prod.j.php"
|
var zurl = "/xmlhttp/search_th_term_prod.j.php"
|
||||||
+ "?sbid=" + sbas[i].sbid
|
+ "?sbid=" + sbas[i].sbid
|
||||||
+ "&t=" + encodeURIComponent(f);
|
+ "&t=" + encodeURIComponent(f);
|
||||||
sbas[i].seeker = $.get(
|
|
||||||
zurl,
|
sbas[i].seeker = $.ajax({
|
||||||
[],
|
url: zurl,
|
||||||
function(j, status)
|
type:'POST',
|
||||||
{
|
data: [],
|
||||||
if(status == 'success')
|
dataType:'json',
|
||||||
|
success: function(j)
|
||||||
{
|
{
|
||||||
var z = '#TX_P\\.' + j.parm['sbid'] + '\\.T';
|
var z = '#TX_P\\.' + j.parm['sbid'] + '\\.T';
|
||||||
|
|
||||||
@@ -200,10 +201,17 @@ function T_filter_delayed2(f, delay, mode)
|
|||||||
|
|
||||||
if(isLast)
|
if(isLast)
|
||||||
$(z).addClass('last');
|
$(z).addClass('last');
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"json"
|
error:function(){
|
||||||
);
|
|
||||||
|
},
|
||||||
|
timeout:function(){
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(mode=='CANDIDATE')
|
else if(mode=='CANDIDATE')
|
||||||
@@ -219,12 +227,12 @@ function T_filter_delayed2(f, delay, mode)
|
|||||||
zurl += "&t=" + encodeURIComponent(f)
|
zurl += "&t=" + encodeURIComponent(f)
|
||||||
+ "&field=" + encodeURIComponent(trees.C._selInfos.field);
|
+ "&field=" + encodeURIComponent(trees.C._selInfos.field);
|
||||||
}
|
}
|
||||||
sbas[i].seeker = $.get(
|
sbas[i].seeker = $.ajax({
|
||||||
zurl,
|
url: zurl,
|
||||||
[],
|
type:'POST',
|
||||||
function(j, status)
|
data: [],
|
||||||
{
|
dataType:'json',
|
||||||
if(status == 'success')
|
success: function(j)
|
||||||
{
|
{
|
||||||
var z = '#TX_P\\.' + j.parm['sbid'] + '\\.T';
|
var z = '#TX_P\\.' + j.parm['sbid'] + '\\.T';
|
||||||
|
|
||||||
@@ -235,10 +243,15 @@ function T_filter_delayed2(f, delay, mode)
|
|||||||
|
|
||||||
if(isLast)
|
if(isLast)
|
||||||
$(z).addClass('last');
|
$(z).addClass('last');
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"json"
|
error:function(){
|
||||||
);
|
|
||||||
|
},
|
||||||
|
timeout:function(){
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -358,6 +371,8 @@ function T_acceptCandidates_OK(dlgnode)
|
|||||||
|
|
||||||
// $("#THPD_confirm_accept_dlg_msg").dialog("close");
|
// $("#THPD_confirm_accept_dlg_msg").dialog("close");
|
||||||
},
|
},
|
||||||
|
error:function(){},
|
||||||
|
timeout:function(){},
|
||||||
_ret: null // private alchemy
|
_ret: null // private alchemy
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -878,40 +893,12 @@ function replaceEditSel(value)
|
|||||||
return;
|
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)
|
function ThesauThesaurusSeeker(sbas_id)
|
||||||
{
|
{
|
||||||
this.sbas_id = sbas_id;
|
this.sbas_id = sbas_id;
|
||||||
this._ctimer = null;
|
this._ctimer = null;
|
||||||
this._xmlhttp = new crossBrowser_XMLHttpRequest();
|
this._xmlhttp = null;
|
||||||
this.tObj = { 'TH_searching':null , 'TH_P':null , 'TH_K':null };
|
this.tObj = { 'TH_searching':null , 'TH_P':null , 'TH_K':null };
|
||||||
this.search = function(txt) {
|
this.search = function(txt) {
|
||||||
if(this._ctimer)
|
if(this._ctimer)
|
||||||
@@ -921,42 +908,75 @@ function ThesauThesaurusSeeker(sbas_id)
|
|||||||
} ;
|
} ;
|
||||||
this.search_delayed = function(txt) {
|
this.search_delayed = function(txt) {
|
||||||
var me = this;
|
var me = this;
|
||||||
|
if($this._xmlttp.abort && typeof $this._xmlttp.abort == 'function')
|
||||||
|
{
|
||||||
this._xmlhttp.abort();
|
this._xmlhttp.abort();
|
||||||
|
}
|
||||||
var url = "/xmlhttp/openbranches_prod.x.php";
|
var url = "/xmlhttp/openbranches_prod.x.php";
|
||||||
var parms = "bid=" + this.sbas_id + "&lng=<?php echo $lng?>" + "&t=" + encodeURIComponent(txt);
|
var parms = {
|
||||||
parms += "&mod=TREE";
|
bid : this.sbas_id,
|
||||||
this._xmlhttp.open("POST", url, true); // yes, BEFORE setting callback
|
lng : "<?php echo $lng?>",
|
||||||
this._xmlhttp.onreadystatechange = function() { me.xmlhttpstatechanged(); } ;
|
t : txt,
|
||||||
this._xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
|
mod : "TREE"
|
||||||
this._xmlhttp.send(parms);
|
};
|
||||||
|
|
||||||
|
this._xmlhttp = $.ajax({
|
||||||
|
url: url,
|
||||||
|
type:'POST',
|
||||||
|
data: parms,
|
||||||
|
success: function(ret)
|
||||||
|
{
|
||||||
|
me.xmlhttpstatechanged(ret);
|
||||||
|
},
|
||||||
|
error:function(){
|
||||||
|
|
||||||
|
},
|
||||||
|
timeout:function(){
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
this._ctimer = null;
|
this._ctimer = null;
|
||||||
} ;
|
} ;
|
||||||
this.openBranch = function(id, thid) {
|
this.openBranch = function(id, thid) {
|
||||||
var me = this;
|
var me = this;
|
||||||
this._xmlhttp.abort();
|
if($this._xmlttp.abort && typeof $this._xmlttp.abort == 'function')
|
||||||
var url = "/xmlhttp/getterm_prod.x.php";
|
|
||||||
var parms = "bid=" + sbas_id;
|
|
||||||
parms += "&lng=<?php echo $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);
|
|
||||||
};
|
|
||||||
this.xmlhttpstatechanged = function(id) {
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
if (this._xmlhttp.readyState==4)
|
this._xmlhttp.abort();
|
||||||
|
}
|
||||||
|
var url = "/xmlhttp/getterm_prod.x.php";
|
||||||
|
var parms = {
|
||||||
|
bid : this.sbas_id,
|
||||||
|
lng : "<?php echo $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(ret, id) {
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if(!this.tObj["TH_searching"])
|
if(!this.tObj["TH_searching"])
|
||||||
this.tObj["TH_searching"] = document.getElementById("TH_searching");
|
this.tObj["TH_searching"] = document.getElementById("TH_searching");
|
||||||
this.tObj["TH_searching"].src = "/skins/icons/ftp-loader-blank.gif";
|
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))
|
if(ret) // && (typeof(ret.parsed)=="undefined" || ret.parsed))
|
||||||
{
|
{
|
||||||
var htmlnodes = ret.getElementsByTagName("html");
|
var htmlnodes = ret.getElementsByTagName("html");
|
||||||
@@ -983,8 +1003,6 @@ function ThesauThesaurusSeeker(sbas_id)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
catch(err)
|
catch(err)
|
||||||
{
|
{
|
||||||
;
|
;
|
||||||
|
Reference in New Issue
Block a user