mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 06:53:15 +00:00
version 3.1.20
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
<?php
|
||||
require_once dirname( __FILE__ ) . "/../lib/bootstrap_task.php";
|
||||
phrasea::start(); // because it's not done in bootstrap_task.php anymore to low the number of actives cnx
|
||||
$session = session::getInstance(); // because it's not done in bootstrap_task.php anymore to low the number of actives cnx
|
||||
|
||||
$argt = array(
|
||||
"--help" => array("set"=>false, "values"=>array(), "usage"=>"[={task_id|classname}] : this help | help of task {task_id} | help of {classname}"),
|
||||
"--display_errors" => array("set"=>false, "values"=>array(), "usage"=>" : force php ini_set('display_errors', 1)"),
|
||||
@@ -212,10 +215,11 @@ if(!parse_cmdargs($ztask->argt, $err, true) ) // || $argt["--help"]["set"])
|
||||
{
|
||||
print($err);
|
||||
// print("parsing argt\n");
|
||||
print(getUsage($argt));
|
||||
// print(getUsage($argt, false));
|
||||
// printf("parsing ztask->argt (%s)\n", var_export($ztask->argt, true));
|
||||
print(getUsage($ztask->argt, false));
|
||||
flush();
|
||||
die;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
require_once dirname( __FILE__ ) . "/../lib/bootstrap_task.php";
|
||||
phrasea::start();
|
||||
$session = session::getInstance();
|
||||
|
||||
|
||||
require_once(GV_RootPath."lib/index_utils2.php");
|
||||
|
||||
$argt = array(
|
||||
|
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
require_once dirname(__FILE__) . "/../lib/bootstrap_task.php";
|
||||
|
||||
|
||||
define('TASKDELAYTOQUIT', 20); // allow 20 sec for never-ending tasks before sending SIGKILL
|
||||
?>
|
||||
#!/usr/bin/php
|
||||
@@ -176,7 +178,7 @@ while ($schedstatus == 'started' || $runningtask > 0)
|
||||
$conn->query($sql);
|
||||
|
||||
// if scheduler is stopped, stop the tasks
|
||||
$sql = 'UPDATE task2 SET status=\'tostop\' WHERE status!="stopped" and status!="manual"';
|
||||
$sql = 'UPDATE task2 SET status=\'tostop\', last_change=NOW() WHERE status!="stopped" and status!="manual"';
|
||||
$conn->query($sql);
|
||||
|
||||
$msg = sprintf("schedstatus == 'stopping', waiting tasks to end");
|
||||
@@ -283,7 +285,7 @@ while ($schedstatus == 'started' || $runningtask > 0)
|
||||
$ttask[$tkey]["process"] = null;
|
||||
if($schedstatus == 'started')
|
||||
{
|
||||
$sql = 'UPDATE task2 SET status=\'tostart\' WHERE task_id="' . $conn->escape_string($ttask[$tkey]["tid"]) . '"';
|
||||
$sql = 'UPDATE task2 SET status=\'tostart\', last_change=NOW() WHERE task_id="' . $conn->escape_string($ttask[$tkey]["tid"]) . '"';
|
||||
$conn->query($sql);
|
||||
}
|
||||
break;
|
||||
@@ -318,7 +320,7 @@ while ($schedstatus == 'started' || $runningtask > 0)
|
||||
}
|
||||
if ($ttask[$tkey]['pid'] !== NULL)
|
||||
{
|
||||
$sql = 'UPDATE task2 SET status=\'started\' WHERE task_id="' . $conn->escape_string($ttask[$tkey]['tid']) . '"';
|
||||
$sql = 'UPDATE task2 SET status=\'started\', last_change=NOW() WHERE task_id="' . $conn->escape_string($ttask[$tkey]['tid']) . '"';
|
||||
$conn->query($sql);
|
||||
$msg = sprintf("Task %s '%s' started (pid=%s)", $ttask[$tkey]["tid"], $cmd, $ttask[$tkey]['pid']);
|
||||
my_syslog(LOG_INFO, $msg);
|
||||
@@ -336,9 +338,9 @@ while ($schedstatus == 'started' || $runningtask > 0)
|
||||
$msg = sprintf("Task %s '%s' failed to start %d times", $ttask[$tkey]["tid"], $cmd, $ttask[$tkey]["crashed"]);
|
||||
my_syslog(LOG_INFO, $msg);
|
||||
if ($ttask[$tkey]["crashed"] >= 5)
|
||||
$sql = "UPDATE task2 SET status='stopped', pid=0, crashed=crashed+1 WHERE task_id='" . $conn->escape_string($ttask[$tkey]['tid']) . "'";
|
||||
$sql = "UPDATE task2 SET status='stopped', last_change=NOW(), pid=0, crashed=crashed+1 WHERE task_id='" . $conn->escape_string($ttask[$tkey]['tid']) . "'";
|
||||
else
|
||||
$sql = "UPDATE task2 SET status='tostart', pid=0, crashed=crashed+1 WHERE task_id='" . $conn->escape_string($ttask[$tkey]['tid']) . "'";
|
||||
$sql = "UPDATE task2 SET status='tostart', last_change=NOW(), pid=0, crashed=crashed+1 WHERE task_id='" . $conn->escape_string($ttask[$tkey]['tid']) . "'";
|
||||
$conn->query($sql);
|
||||
}
|
||||
}
|
||||
@@ -392,9 +394,9 @@ while ($schedstatus == 'started' || $runningtask > 0)
|
||||
$msg = sprintf("Task %s crashed %d times", $ttask[$tkey]["tid"], $ttask[$tkey]["crashed"]);
|
||||
my_syslog(LOG_INFO, $msg);
|
||||
if ($ttask[$tkey]["crashed"] >= 5)
|
||||
$sql = "UPDATE task2 SET status='stopped', pid=0, crashed=crashed+1 WHERE task_id='" . $conn->escape_string($ttask[$tkey]['tid']) . "'";
|
||||
$sql = "UPDATE task2 SET status='stopped', last_change=NOW(), pid=0, crashed=crashed+1 WHERE task_id='" . $conn->escape_string($ttask[$tkey]['tid']) . "'";
|
||||
else
|
||||
$sql = "UPDATE task2 SET status='tostart', pid=0, crashed=crashed+1 WHERE task_id='" . $conn->escape_string($ttask[$tkey]['tid']) . "'";
|
||||
$sql = "UPDATE task2 SET status='tostart', last_change=NOW(), pid=0, crashed=crashed+1 WHERE task_id='" . $conn->escape_string($ttask[$tkey]['tid']) . "'";
|
||||
$conn->query($sql);
|
||||
}
|
||||
break;
|
||||
|
@@ -1,3 +1,6 @@
|
||||
3.7.1.1
|
||||
fix some bad types (long/int)
|
||||
|
||||
3.7.1.0
|
||||
candidates terms can be filtered using the property 'candidates="str"' in structure/field :
|
||||
"str" is a string of characters (flags, in any order) to allow candidates for different kind of terms
|
||||
|
@@ -3,7 +3,7 @@
|
||||
|
||||
AC_PREREQ([2.60])
|
||||
|
||||
AC_INIT([phraseanet_indexer], [3.6.1.1])
|
||||
AC_INIT([phraseanet_indexer], [3.7.1.1])
|
||||
|
||||
AM_INIT_AUTOMAKE(no-dependencies no-define no-dist no-installinfo)
|
||||
|
||||
@@ -21,11 +21,11 @@ XTRAINCPATHS="-I/usr/include/libxml2/"
|
||||
# Checks for MySQL lib
|
||||
AC_MSG_CHECKING([MySQL client library])
|
||||
for i in / /usr /usr/local /opt/local; do
|
||||
if test -r $i/lib/libmysqlclient.a; then
|
||||
if test -r $i/lib/libmysqlclient.so -o -r $i/lib/libmysqlclient.dylib; then
|
||||
MYSQL_LIBDIR=$i/lib/
|
||||
elif test -r $i/lib/mysql/libmysqlclient.a; then
|
||||
elif test -r $i/lib/mysql/libmysqlclient.so -o -r $i/lib/mysql/libmysqlclient.dylib; then
|
||||
MYSQL_LIBDIR=$i/lib/mysql/
|
||||
elif test -r $i/lib/mysql5/mysql/libmysqlclient.a; then
|
||||
elif test -r $i/lib/mysql5/mysql/libmysqlclient.so -o -r $i/lib/mysql5/mysql/libmysqlclient.dylib; then
|
||||
MYSQL_LIBDIR=$i/lib/mysql5/mysql/
|
||||
fi
|
||||
done
|
||||
|
@@ -20,7 +20,7 @@
|
||||
//
|
||||
|
||||
#ifndef PHDOTVERSION
|
||||
#define PHDOTVERSION 3.7.1.0
|
||||
#define PHDOTVERSION 3.7.1.1
|
||||
#endif
|
||||
//
|
||||
//=======================================================================
|
||||
|
@@ -27,7 +27,7 @@
|
||||
// prototypes local fcts
|
||||
void evt_start(CDOMDocument *xmlparser, const char *name, const char *path, const char *upath);
|
||||
void evt_end(CDOMDocument *xmlparser);
|
||||
void evt_keyword(CDOMDocument *xmlparser, const char *lowKeyword, unsigned int lowKeywordLen, UINT32 pos, UINT32 len, UINT32 index);
|
||||
void evt_keyword(CDOMDocument *xmlparser, const char *lowKeyword, unsigned int lowKeywordLen, unsigned int pos, unsigned int len, unsigned int index);
|
||||
|
||||
// prototypes external fcts
|
||||
extern CSyslog zSyslog; // , LOG_PID, LOG_DAEMON);
|
||||
@@ -527,7 +527,7 @@ void evt_end(CDOMDocument *xmlparser)
|
||||
// ----------------------------------------------
|
||||
// the parser met a keyword
|
||||
// ----------------------------------------------
|
||||
void evt_keyword(CDOMDocument *xmlparser, const char *lowKeyword, unsigned int lowKeywordLen, UINT32 pos, UINT32 len, UINT32 index)
|
||||
void evt_keyword(CDOMDocument *xmlparser, const char *lowKeyword, unsigned int lowKeywordLen, unsigned int pos, unsigned int len, unsigned int index)
|
||||
{
|
||||
CIndexer *indexer = (CIndexer *)(xmlparser->userData);
|
||||
|
||||
|
@@ -5,6 +5,7 @@
|
||||
#include "_syslog.h"
|
||||
|
||||
#include "trace_memory.h"
|
||||
#include "phrasea_clock_t.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
@@ -302,6 +303,7 @@ unsigned int CMysqlStmt::errNo()
|
||||
|
||||
int CMysqlStmt::execute()
|
||||
{
|
||||
CHRONO chrono;
|
||||
int r;
|
||||
if(this->connbas->crashed)
|
||||
{
|
||||
@@ -311,10 +313,12 @@ int CMysqlStmt::execute()
|
||||
}
|
||||
try
|
||||
{
|
||||
startChrono(chrono);
|
||||
if((r = mysql_stmt_execute(this->stmt)) != 0)
|
||||
{
|
||||
if(this->debug)
|
||||
zSyslog.log(CSyslog::LOGL_ERR, CSyslog::LOGC_SQLERR, "CMysqlStmt::execute : mysql_stmt_execute error (%d) : '%s', return(%d)", this->errNo(), this->error(), r);
|
||||
|
||||
switch(this->errNo())
|
||||
{
|
||||
// erreurs non fatales
|
||||
@@ -340,6 +344,11 @@ int CMysqlStmt::execute()
|
||||
// this->connbas->crashed = 1;
|
||||
return(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(this->debug)
|
||||
zSyslog.log(CSyslog::LOGL_ERR, CSyslog::LOGC_SQLERR, "CMysqlStmt::execute : %s : %f sec", this->sql, stopChrono(chrono));
|
||||
}
|
||||
return(r);
|
||||
}
|
||||
catch(...)
|
||||
|
@@ -232,7 +232,7 @@ int CConnbas_dbox::updatePref_cterms(char *cterms, unsigned long cterms_size, ch
|
||||
// ---------------------------------------------------------------
|
||||
// SELECT CAST(value AS UNSIGNED), updated_on<created_on AS k FROM pref WHERE prop='indexes' LIMIT 1
|
||||
// ---------------------------------------------------------------
|
||||
int CConnbas_dbox::selectPrefsIndexes(long *value, long *toReindex)
|
||||
int CConnbas_dbox::selectPrefsIndexes(int *value, int *toReindex)
|
||||
{
|
||||
int ret = 0;
|
||||
if(this->cstmt_needReindex == NULL)
|
||||
@@ -250,8 +250,6 @@ int CConnbas_dbox::selectPrefsIndexes(long *value, long *toReindex)
|
||||
}
|
||||
if(this->cstmt_needReindex)
|
||||
{
|
||||
// long value, k;
|
||||
|
||||
this->cstmt_needReindex->bindo[0].buffer = value;
|
||||
this->cstmt_needReindex->bindo[1].buffer = toReindex;
|
||||
|
||||
@@ -652,7 +650,7 @@ unsigned int CConnbas_dbox::getID(const char *name, unsigned int n )
|
||||
this->cstmt_selectUid->bindi[0].buffer_length = lencpy;
|
||||
this->cstmt_selectUid->bindi[0].length = &lencpy;
|
||||
|
||||
unsigned long uid;
|
||||
unsigned int uid;
|
||||
this->cstmt_selectUid->bindo[0].buffer = (void *)(&uid);
|
||||
|
||||
if (this->cstmt_selectUid->bind_param() == 0)
|
||||
@@ -1151,8 +1149,8 @@ int CConnbas_dbox::scanRecords(void (*callBack)(CConnbas_dbox *connbas, unsigned
|
||||
unsigned int record_id;
|
||||
int ret = -1;
|
||||
|
||||
long prefsIndexes_value = 1;
|
||||
long prefsIndexes_toReindex = 0;
|
||||
int prefsIndexes_value = 1;
|
||||
int prefsIndexes_toReindex = 0;
|
||||
|
||||
//printf("-- 1\n");
|
||||
if(!this->cstmt_selectRecords)
|
||||
@@ -1238,290 +1236,6 @@ int CConnbas_dbox::scanRecords(void (*callBack)(CConnbas_dbox *connbas, unsigned
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/*
|
||||
// ---------------------------------------------------------------
|
||||
// SELECT record_id, xml FROM record ORDER BY record_id
|
||||
// ---------------------------------------------------------------
|
||||
int CConnbas_dbox::scanRecords(void (*callBack)(CConnbas_dbox *connbas, unsigned long record_id, char *xml, unsigned long len), int *running )
|
||||
{
|
||||
// static char *sql = "SELECT record_id, xml FROM record WHERE record_id>=5313 LIMIT 10";
|
||||
// static char *sql = "SELECT record_id, xml FROM record WHERE record_id>=18573 LIMIT 50";
|
||||
static char *sql = "SELECT record_id, xml FROM record WHERE (status & 7) IN (4,5,6) ORDER BY record_id ASC"; // LIMIT 10";
|
||||
// static char *sql = "SELECT record_id, xml FROM record WHERE record_id=100077"; // LIMIT 10";
|
||||
MYSQL_STMT *stmt;
|
||||
unsigned long record_id;
|
||||
char *xml=NULL;
|
||||
unsigned long xmlbuffer_length = 0;
|
||||
|
||||
unsigned long xml_length;
|
||||
MYSQL_BIND bindo[2];
|
||||
int ret = 0;
|
||||
|
||||
if(!this->cstmt_selectRecords)
|
||||
{
|
||||
if(this->cstmt_selectRecords = this->newStmt("SELECT record_id, xml FROM record WHERE (status & 7) IN (4,5,6) ORDER BY record_id ASC", 0, 2))
|
||||
{
|
||||
this->cstmt_selectRecords->bindo[0].buffer_type = MYSQL_TYPE_LONG;
|
||||
|
||||
this->cstmt_selectRecords->bindo[1].buffer_type = MYSQL_TYPE_STRING;
|
||||
}
|
||||
}
|
||||
|
||||
if(this->cstmt_selectRecords)
|
||||
{
|
||||
this->cstmt_selectRecords->bindo[0].buffer = (void *)(&record_id);
|
||||
|
||||
this->cstmt_selectRecords->bindo[1].buffer = (void *)(&xml);
|
||||
this->cstmt_selectRecords->bindo[1].buffer_length = 150;
|
||||
this->cstmt_selectRecords->bindo[1].length = &xpath_length;
|
||||
|
||||
// static my_ulonglong last_numr = 123465;
|
||||
printf("-- 1\n");
|
||||
if( (xml = (char *)(_MALLOC_WHY(xmlbuffer_length = 4096, "connbas_dbox.cpp:scanRecords:xml"))) == NULL)
|
||||
{
|
||||
// malloc error
|
||||
return(2);
|
||||
}
|
||||
|
||||
if( (stmt = mysql_stmt_init(this->mysqlCnx)) != NULL)
|
||||
{
|
||||
printf("-- 2\n");
|
||||
if(mysql_stmt_prepare(stmt, sql, strlen(sql)) == 0)
|
||||
{
|
||||
printf("-- 3\n");
|
||||
if(mysql_stmt_execute(stmt) == 0)
|
||||
{
|
||||
printf("-- 4\n");
|
||||
memset(bindo, 0, sizeof(bindo));
|
||||
|
||||
bindo[0].buffer_type = MYSQL_TYPE_LONG;
|
||||
bindo[0].buffer = (void *)(&record_id);
|
||||
// bind[0].length = ; // ignored for numeric types
|
||||
// bind[0].buffer_length = ; // ignored for numeric types
|
||||
bindo[0].is_null = (my_bool*)0; // data is always not null
|
||||
bindo[0].is_unsigned = 1;
|
||||
|
||||
bindo[1].buffer_type = MYSQL_TYPE_STRING;
|
||||
bindo[1].buffer = (void *)(xml);
|
||||
bindo[1].buffer_length = xmlbuffer_length;
|
||||
bindo[1].length = &xml_length;
|
||||
bindo[1].is_null = (my_bool*)0; // data is always not null
|
||||
// bind[1].is_unsigned = 1; // ignored for string type
|
||||
|
||||
// Bind the result buffers
|
||||
if(mysql_stmt_bind_result(stmt, bindo) == 0)
|
||||
{
|
||||
printf("-- 5\n");
|
||||
if(mysql_stmt_store_result(stmt) == 0)
|
||||
{
|
||||
int row_count = 0;
|
||||
// my_ulonglong num_rows = mysql_stmt_num_rows(stmt);
|
||||
// if(num_rows > 0 || last_numr != 0)
|
||||
printf("----------- scanRecords found %ld ---------\n", 666);
|
||||
//last_numr = num_rows;
|
||||
while(!this->crashed && *running && ret==0 && mysql_stmt_fetch(stmt) == 0)
|
||||
{
|
||||
// printf("rid=%ld, xml_length=%ld\n", record_id, xml_length);
|
||||
if(xml_length > xmlbuffer_length)
|
||||
{
|
||||
if(xml = (char *)_REALLOC((void *)xml, xmlbuffer_length = xml_length+1024))
|
||||
{
|
||||
bindo[1].buffer = (void *)(xml);
|
||||
bindo[1].buffer_length = xmlbuffer_length;
|
||||
mysql_stmt_bind_result(stmt, bindo);
|
||||
// printf("buffer reallocated to %ld\n", xmlbuffer_length);
|
||||
|
||||
mysql_stmt_data_seek(stmt, row_count);
|
||||
}
|
||||
else
|
||||
{
|
||||
// realloc error
|
||||
ret = 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// printf("xml(%ld) read\n", xml_length);
|
||||
(*callBack)(this, record_id, xml, xml_length);
|
||||
row_count++;
|
||||
}
|
||||
// if(keyword_length > 64)
|
||||
// keyword_length = 64;
|
||||
// keyword[keyword_length] = '\0';
|
||||
}
|
||||
mysql_stmt_free_result(stmt);
|
||||
}
|
||||
else
|
||||
{
|
||||
// mysql_stmt_store_result error
|
||||
ret = 6;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// mysql_stmt_bind_result error
|
||||
ret = 5;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// mysql_stmt_execute error
|
||||
zSyslog.log(CSyslog::LOGL_ERR, CSyslog::LOGC_SQLERR, "%s", mysql_stmt_error(stmt));
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// mysql_stmt_prepare error
|
||||
ret = 4;
|
||||
}
|
||||
mysql_stmt_close(stmt);
|
||||
}
|
||||
else
|
||||
{
|
||||
// mysql_stmt_init error
|
||||
ret = 3;
|
||||
}
|
||||
//_FREE(xml);
|
||||
_FREE(xml);
|
||||
return(ret);
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
// ---------------------------------------------------------------
|
||||
// SELECT record_id, xml FROM record ORDER BY record_id
|
||||
// ---------------------------------------------------------------
|
||||
int CConnbas_dbox::scanRecords(void (*callBack)(CConnbas_dbox *connbas, unsigned long record_id, char *xml, unsigned long len), int *running )
|
||||
{
|
||||
// static char *sql = "SELECT record_id, xml FROM record WHERE record_id>=5313 LIMIT 10";
|
||||
// static char *sql = "SELECT record_id, xml FROM record WHERE record_id>=18573 LIMIT 50";
|
||||
static char *sql = "SELECT record_id, xml FROM record WHERE (status & 7) IN (4,5,6) ORDER BY record_id ASC"; // LIMIT 10";
|
||||
// static char *sql = "SELECT record_id, xml FROM record WHERE record_id=100077"; // LIMIT 10";
|
||||
MYSQL_STMT *stmt;
|
||||
unsigned long record_id;
|
||||
char *xml=NULL;
|
||||
unsigned long xmlbuffer_length = 0;
|
||||
|
||||
unsigned long xml_length;
|
||||
MYSQL_BIND bindo[2];
|
||||
int ret = 0;
|
||||
|
||||
// static my_ulonglong last_numr = 123465;
|
||||
printf("-- 1\n");
|
||||
if( (xml = (char *)(_MALLOC_WHY(xmlbuffer_length = 4096, "connbas_dbox.cpp:scanRecords:xml"))) == NULL)
|
||||
{
|
||||
// malloc error
|
||||
return(2);
|
||||
}
|
||||
|
||||
if( (stmt = mysql_stmt_init(this->mysqlCnx)) != NULL)
|
||||
{
|
||||
printf("-- 2\n");
|
||||
if(mysql_stmt_prepare(stmt, sql, strlen(sql)) == 0)
|
||||
{
|
||||
printf("-- 3\n");
|
||||
if(mysql_stmt_execute(stmt) == 0)
|
||||
{
|
||||
printf("-- 4\n");
|
||||
memset(bindo, 0, sizeof(bindo));
|
||||
|
||||
bindo[0].buffer_type = MYSQL_TYPE_LONG;
|
||||
bindo[0].buffer = (void *)(&record_id);
|
||||
// bind[0].length = ; // ignored for numeric types
|
||||
// bind[0].buffer_length = ; // ignored for numeric types
|
||||
bindo[0].is_null = (my_bool*)0; // data is always not null
|
||||
bindo[0].is_unsigned = 1;
|
||||
|
||||
bindo[1].buffer_type = MYSQL_TYPE_STRING;
|
||||
bindo[1].buffer = (void *)(xml);
|
||||
bindo[1].buffer_length = xmlbuffer_length;
|
||||
bindo[1].length = &xml_length;
|
||||
bindo[1].is_null = (my_bool*)0; // data is always not null
|
||||
// bind[1].is_unsigned = 1; // ignored for string type
|
||||
|
||||
// Bind the result buffers
|
||||
if(mysql_stmt_bind_result(stmt, bindo) == 0)
|
||||
{
|
||||
printf("-- 5\n");
|
||||
if(mysql_stmt_store_result(stmt) == 0)
|
||||
{
|
||||
int row_count = 0;
|
||||
// my_ulonglong num_rows = mysql_stmt_num_rows(stmt);
|
||||
// if(num_rows > 0 || last_numr != 0)
|
||||
printf("----------- scanRecords found %ld ---------\n", 666);
|
||||
//last_numr = num_rows;
|
||||
while(!this->crashed && *running && ret==0 && mysql_stmt_fetch(stmt) == 0)
|
||||
{
|
||||
// printf("rid=%ld, xml_length=%ld\n", record_id, xml_length);
|
||||
if(xml_length > xmlbuffer_length)
|
||||
{
|
||||
if(xml = (char *)_REALLOC((void *)xml, xmlbuffer_length = xml_length+1024))
|
||||
{
|
||||
bindo[1].buffer = (void *)(xml);
|
||||
bindo[1].buffer_length = xmlbuffer_length;
|
||||
mysql_stmt_bind_result(stmt, bindo);
|
||||
// printf("buffer reallocated to %ld\n", xmlbuffer_length);
|
||||
|
||||
mysql_stmt_data_seek(stmt, row_count);
|
||||
}
|
||||
else
|
||||
{
|
||||
// realloc error
|
||||
ret = 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// printf("xml(%ld) read\n", xml_length);
|
||||
(*callBack)(this, record_id, xml, xml_length);
|
||||
row_count++;
|
||||
}
|
||||
//if(keyword_length > 64)
|
||||
// keyword_length = 64;
|
||||
//keyword[keyword_length] = '\0';
|
||||
|
||||
}
|
||||
mysql_stmt_free_result(stmt);
|
||||
}
|
||||
else
|
||||
{
|
||||
// mysql_stmt_store_result error
|
||||
ret = 6;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// mysql_stmt_bind_result error
|
||||
ret = 5;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// mysql_stmt_execute error
|
||||
zSyslog.log(CSyslog::LOGL_ERR, CSyslog::LOGC_SQLERR, "%s", mysql_stmt_error(stmt));
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// mysql_stmt_prepare error
|
||||
ret = 4;
|
||||
}
|
||||
mysql_stmt_close(stmt);
|
||||
}
|
||||
else
|
||||
{
|
||||
// mysql_stmt_init error
|
||||
ret = 3;
|
||||
}
|
||||
//_FREE(xml);
|
||||
_FREE(xml);
|
||||
return(ret);
|
||||
}
|
||||
*/
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// INSERT INTO thit (record_id, xpath_id, name, value, hitstart, hitlen) VALUES (?, ?, ?, ?, ?, ?)
|
||||
@@ -1703,121 +1417,11 @@ int CConnbas_dbox::updateRecord_unlock(unsigned int record_id)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
int CConnbas_dbox::lockRecord(unsigned int record_id)
|
||||
{
|
||||
this->parms_updateRecord_xlock.id = record_id;
|
||||
return(mysql_stmt_execute(this->stmt_updateRecord_lock));
|
||||
}
|
||||
|
||||
int CConnbas_dbox::unlockRecord(unsigned int record_id)
|
||||
{
|
||||
this->parms_updateRecord_xlock.id = record_id;
|
||||
return(mysql_stmt_execute(this->stmt_updateRecord_unlock));
|
||||
}
|
||||
|
||||
|
||||
int CConnbas_dbox::addTHit(unsigned int record_id, unsigned int xpath_id, unsigned char *name, unsigned char *value, unsigned int hitstart, unsigned int hitlen)
|
||||
{
|
||||
int ret;
|
||||
this->parms_insertTHit.record_id = record_id;
|
||||
this->parms_insertTHit.xpath_id = xpath_id;
|
||||
if( (this->parms_insertTHit.name_length = strlen((char *)name)) > 32)
|
||||
this->parms_insertTHit.name_length = 32;
|
||||
memcpy(this->parms_insertTHit.name, name, this->parms_insertTHit.name_length);
|
||||
if( (this->parms_insertTHit.value_length = strlen((char *)value)) > 100)
|
||||
this->parms_insertTHit.value_length = 100;
|
||||
memcpy(this->parms_insertTHit.value, value, this->parms_insertTHit.value_length);
|
||||
this->parms_insertTHit.hitstart = hitstart;
|
||||
this->parms_insertTHit.hitlen = hitlen;
|
||||
ret = mysql_stmt_execute(this->stmt_insertTHit);
|
||||
if(ret != 0)
|
||||
printf("%s \n", mysql_stmt_error(this->stmt_insertTHit) );
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
int CConnbas_dbox::addProp(unsigned int record_id, unsigned int xpath_id, unsigned char *name, unsigned char *value)
|
||||
{
|
||||
this->parms_insertProp.record_id = record_id;
|
||||
this->parms_insertProp.xpath_id = xpath_id;
|
||||
if( (this->parms_insertProp.name_length = strlen((char *)name)) > 32)
|
||||
this->parms_insertProp.name_length = 32;
|
||||
memcpy(this->parms_insertProp.name, name, this->parms_insertProp.name_length);
|
||||
if( (this->parms_insertProp.value_length = strlen((char *)value)) > 100)
|
||||
this->parms_insertProp.value_length = 100;
|
||||
memcpy(this->parms_insertProp.value, value, this->parms_insertProp.value_length);
|
||||
return(mysql_stmt_execute(this->stmt_insertProp) == 0);
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
void CConnbas_dbox::close()
|
||||
{
|
||||
this->isok = false;
|
||||
/*
|
||||
CMysqlStmt *stmt;
|
||||
while(stmt = this->firstStmt)
|
||||
{
|
||||
this->firstStmt = stmt->next;
|
||||
delete stmt;
|
||||
}
|
||||
*/
|
||||
/*
|
||||
if(this->cstmt_updatePref_cterms)
|
||||
{
|
||||
delete(this->cstmt_updatePref_cterms);
|
||||
this->cstmt_updatePref_cterms = NULL;
|
||||
}
|
||||
if(this->cstmt_selectPref_moddates)
|
||||
{
|
||||
delete(this->cstmt_selectPref_moddates);
|
||||
this->cstmt_selectPref_moddates = NULL;
|
||||
}
|
||||
if(this->cstmt_insertKword)
|
||||
{
|
||||
delete(this->cstmt_insertKword);
|
||||
this->cstmt_insertKword = NULL;
|
||||
}
|
||||
if(this->cstmt_selectKword)
|
||||
{
|
||||
delete(this->cstmt_selectKword);
|
||||
this->cstmt_selectKword = NULL;
|
||||
}
|
||||
if(this->cstmt_insertIdx)
|
||||
{
|
||||
delete(this->cstmt_insertIdx);
|
||||
this->cstmt_insertIdx = NULL;
|
||||
}
|
||||
if(this->cstmt_selectXPath)
|
||||
{
|
||||
delete(this->cstmt_selectXPath);
|
||||
this->cstmt_selectXPath = NULL;
|
||||
}
|
||||
if(this->cstmt_insertXPath)
|
||||
{
|
||||
delete(this->cstmt_insertXPath);
|
||||
this->cstmt_insertXPath = NULL;
|
||||
}
|
||||
if(this->cstmt_updateUids)
|
||||
{
|
||||
delete(this->cstmt_updateUids);
|
||||
this->cstmt_updateUids = NULL;
|
||||
}
|
||||
if(this->cstmt_selectUid)
|
||||
{
|
||||
delete(this->cstmt_selectUid);
|
||||
this->cstmt_selectUid = NULL;
|
||||
}
|
||||
if(this->cstmt_selectPrefs)
|
||||
{
|
||||
delete(this->cstmt_selectPrefs);
|
||||
this->cstmt_selectPrefs = NULL;
|
||||
}
|
||||
*/
|
||||
|
||||
if(this->struct_buffer)
|
||||
{
|
||||
_FREE(this->struct_buffer);
|
||||
@@ -1843,34 +1447,6 @@ void CConnbas_dbox::close()
|
||||
this->xml_buffer_size = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
if(this->stmt_insertTHit)
|
||||
{
|
||||
mysql_stmt_close(this->stmt_insertTHit);
|
||||
this->stmt_insertTHit = NULL;
|
||||
}
|
||||
if(this->stmt_insertProp)
|
||||
{
|
||||
mysql_stmt_close(this->stmt_insertProp);
|
||||
this->stmt_insertProp = NULL;
|
||||
}
|
||||
|
||||
|
||||
if(this->stmt_updateRecord_lock)
|
||||
{
|
||||
mysql_stmt_close(this->stmt_updateRecord_lock);
|
||||
this->stmt_updateRecord_lock = NULL;
|
||||
}
|
||||
|
||||
if(this->stmt_updateRecord_unlock)
|
||||
{
|
||||
mysql_stmt_close(this->stmt_updateRecord_unlock);
|
||||
this->stmt_updateRecord_unlock = NULL;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
CConnbas::close();
|
||||
}
|
||||
|
||||
|
@@ -185,7 +185,7 @@ class CConnbas_dbox:public CConnbas
|
||||
int updateRecord_unlock(unsigned int record_id);
|
||||
int updateRecord_unlock2(char *lrid, unsigned long lrid_len);
|
||||
|
||||
int selectPrefsIndexes(long *value, long *toReindex);
|
||||
int selectPrefsIndexes(int *value, int *toReindex);
|
||||
void reindexAll();
|
||||
// int sql_connect();
|
||||
// int getPrefsDates(unsigned long *struct_moddate, unsigned long *thesaurus_moddate, unsigned long *cterms_moddate);
|
||||
|
@@ -161,7 +161,7 @@ void XMLCALL CDOMDocument::charHandler(void *userData, const XML_Char *xmls, int
|
||||
{
|
||||
int i;
|
||||
unsigned char c0, c;
|
||||
UINT32 u, msk;
|
||||
unsigned int u, msk;
|
||||
unsigned char nBytes;
|
||||
unsigned char nLowBytes;
|
||||
unsigned char *s = (unsigned char *)xmls;
|
||||
@@ -219,14 +219,14 @@ void XMLCALL CDOMDocument::charHandler(void *userData, const XML_Char *xmls, int
|
||||
// 11xxxxxx : multi bytes character
|
||||
unsigned char flags = CFLAG_NORMALCHAR;
|
||||
_this->tokBin[_this->tokBinLen++] = c0;
|
||||
u = ((UINT32) c0) & 0x0000001F;
|
||||
u = ((unsigned int) c0) & 0x0000001F;
|
||||
msk = 0xFFFFFF7F;
|
||||
nBytes = 1;
|
||||
// read max 6 bytes
|
||||
while(len && ((c0 <<= 1) & 0x80) && (((c = *s) & 0xC0) == 0x80) && ++nBytes <= 6)
|
||||
{
|
||||
_this->tokBin[_this->tokBinLen++] = c;
|
||||
u = (u<<6 & (msk = (msk<<5) | 0x1F)) | (UINT32)(c & 0x3F);
|
||||
u = (u<<6 & (msk = (msk<<5) | 0x1F)) | (unsigned int)(c & 0x3F);
|
||||
len--;
|
||||
i++;
|
||||
s++;
|
||||
@@ -327,7 +327,7 @@ void XMLCALL CDOMDocument::charHandler(void *userData, const XML_Char *xmls, int
|
||||
// _this->currentNode->index_start = index+i;
|
||||
// _this->currentNode->index_end = index+i;
|
||||
}
|
||||
u = (UINT32) c0;
|
||||
u = (unsigned int) c0;
|
||||
nLowBytes = nBytes = 1;
|
||||
|
||||
}
|
||||
@@ -390,84 +390,10 @@ CDOMDocument::CDOMDocument()
|
||||
XML_SetElementHandler(this->parser, this->start, this->end );
|
||||
XML_SetCharacterDataHandler(this->parser, this->charHandler);
|
||||
XML_SetCdataSectionHandler(this->parser, this->startCdata, this->endCdata);
|
||||
/*
|
||||
// unsigned char t[] = "\t\r\n !\"#$%&'()+,-./:;<=>@[\\]^_`{|}~<7E><><EFBFBD><EFBFBD>" ;
|
||||
unsigned char t[] = "\t\r\n !\"#$%&'()+,-./:;=@[\\]^_`{|}~<7E><><EFBFBD><EFBFBD>" ;
|
||||
size_t i;
|
||||
for(i=0; i<256; i++)
|
||||
{
|
||||
this->charFlags[i] = 0;
|
||||
}
|
||||
for(i=0; i<strlen((const char *)t); i++)
|
||||
{
|
||||
this->charFlags[t[i]] |= 1;
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
/*
|
||||
bool CDOMDocument::load(char *filename)
|
||||
{
|
||||
FILE *fp;
|
||||
long filesize;
|
||||
int bytes_read;
|
||||
void *buff;
|
||||
bool ret = TRUE;
|
||||
|
||||
if(!this->parser)
|
||||
return(FALSE);
|
||||
|
||||
if( fp=fopen(filename, "rb" ) )
|
||||
{
|
||||
fseek(fp, 0, SEEK_END);
|
||||
filesize = ftell(fp);
|
||||
rewind(fp);
|
||||
|
||||
this->depth = -1;
|
||||
this->State = CDOMDocument::INTO_UNKNOWN;
|
||||
this->indexStart = 0;
|
||||
this->indexEnd = 0;
|
||||
this->tokBinLen = 0;
|
||||
this->lowtokBinLen = 0;
|
||||
this->wordIndex = 0;
|
||||
this->parseText = true;
|
||||
|
||||
buff = XML_GetBuffer(this->parser, filesize);
|
||||
|
||||
if (buff != NULL)
|
||||
{
|
||||
bytes_read = fread(buff, 1, filesize, fp);
|
||||
if (bytes_read > 0)
|
||||
{
|
||||
if(XML_ParseBuffer(this->parser, bytes_read, TRUE) != XML_STATUS_ERROR)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
// handle parse error
|
||||
zSyslog.log(CSyslog::LOGL_WARNING, CSyslog::LOGC_XMLERR, "Parse error at line %u:\n%s\n",
|
||||
XML_GetCurrentLineNumber(this->parser),
|
||||
XML_ErrorString(XML_GetErrorCode(this->parser)));
|
||||
ret = FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// handle error
|
||||
ret = FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// handle error
|
||||
ret = FALSE;
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
return(ret);
|
||||
}
|
||||
*/
|
||||
|
||||
bool CDOMDocument::loadXML(char *xml, unsigned long len)
|
||||
{
|
||||
bool ret = TRUE;
|
||||
|
@@ -33,7 +33,6 @@ typedef unsigned long XML_Size;
|
||||
#include "lownodiacritics_utf8.h"
|
||||
|
||||
/*
|
||||
*/
|
||||
#ifndef UINT8
|
||||
#define UINT8 unsigned char
|
||||
#endif
|
||||
@@ -41,8 +40,9 @@ typedef unsigned long XML_Size;
|
||||
#define UINT16 unsigned short
|
||||
#endif
|
||||
#ifndef UINT32
|
||||
#define UINT32 unsigned long
|
||||
#define UINT32 unsigned int
|
||||
#endif
|
||||
*/
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
@@ -327,7 +327,7 @@ class CDOMDocument
|
||||
bool load(char *filename);
|
||||
bool loadXML(char *xml, unsigned long len);
|
||||
void dump();
|
||||
void (*onKeyword)(CDOMDocument *xmlparser, const char *lowKeyword, unsigned int lowKeywordLen, UINT32 pos, UINT32 len, UINT32 idx);
|
||||
void (*onKeyword)(CDOMDocument *xmlparser, const char *lowKeyword, unsigned int lowKeywordLen, unsigned int pos, unsigned int len, unsigned int idx);
|
||||
void (*onStart)(CDOMDocument *xmlparser, const char *name, const char *path, const char *upath);
|
||||
void (*onEnd)(CDOMDocument *xmlparser);
|
||||
void *userData; // to pass/get data to/from callback
|
||||
@@ -361,9 +361,9 @@ class CDOMDocument
|
||||
int freepathoffset;
|
||||
int freeupathoffset;
|
||||
|
||||
UINT32 indexStart;
|
||||
UINT32 indexEnd;
|
||||
UINT32 wordIndex;
|
||||
unsigned int indexStart;
|
||||
unsigned int indexEnd;
|
||||
unsigned int wordIndex;
|
||||
char tokBin[400+4];
|
||||
int tokBinLen;
|
||||
|
||||
|
@@ -149,7 +149,7 @@ void CIndexer::flush()
|
||||
if(nNewXPath > 0)
|
||||
{
|
||||
// there is some unknown, we get a uid and we write
|
||||
unsigned long xpath_new_uid;
|
||||
unsigned int xpath_new_uid;
|
||||
xpath_new_uid = this->connbas->getID("XPATH", nNewXPath);
|
||||
|
||||
for(xp = this->tXPaths; !this->connbas->crashed && xp; xp = xp->next)
|
||||
@@ -256,7 +256,7 @@ void CIndexer::flush()
|
||||
|
||||
|
||||
// --------------------------------------------------- flush kword and idx
|
||||
unsigned long kword_new_uid = 0;
|
||||
unsigned int kword_new_uid = 0;
|
||||
if(this->nNewKeywords > 0)
|
||||
kword_new_uid = this->connbas->getID("KEYWORDS", this->nNewKeywords);
|
||||
|
||||
|
@@ -463,13 +463,13 @@ class CIndexer
|
||||
CStructField *tStructField; // table of fields in the structure
|
||||
|
||||
CKword *tKeywords[KWORD_HASHSIZE]; // chained list(s) of keywords
|
||||
unsigned long nNewKeywords; // number of NEW (unknown id) keywords in this list
|
||||
unsigned int nNewKeywords; // number of NEW (unknown id) keywords in this list
|
||||
|
||||
CXPath *tXPaths; // chained liste of xpath
|
||||
CXPath *tXPaths; // chained list of xpath
|
||||
CXPath *current_xpath;
|
||||
|
||||
unsigned int current_rid; // current record_id
|
||||
unsigned long nrecsIndexed; // nbr of records treated by this indexer
|
||||
unsigned int nrecsIndexed; // nbr of records treated by this indexer
|
||||
|
||||
|
||||
// dates of the first changing of prefs
|
||||
|
@@ -113,57 +113,6 @@ CSyslog zSyslog; // , LOG_PID, LOG_DAEMON);
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
void dumpk()
|
||||
{
|
||||
CKword *k;
|
||||
// CHit *h;
|
||||
for(unsigned int hash=0; hash<1024; hash++)
|
||||
{
|
||||
int nk=0;
|
||||
for(k=tKeywords[hash]; k; k=k->next)
|
||||
{
|
||||
// printf("%s : ", k->kword);
|
||||
// for(h=k->firsthit; h; h=h->next)
|
||||
// printf("[%ld, %ld, %ld, %ld] ", h->record_id, h->pos, h->len, h->index);
|
||||
// printf("\r\n");
|
||||
nk++;
|
||||
}
|
||||
printf("tKeywords[%i] = %i\n", hash, nk);
|
||||
}
|
||||
}
|
||||
void freek()
|
||||
{
|
||||
CKword *k;
|
||||
CHit *h;
|
||||
for(unsigned int hash=0; hash<1024; hash++)
|
||||
{
|
||||
while( (k = tKeywords[hash]) )
|
||||
{
|
||||
while( (h = k->firsthit) )
|
||||
{
|
||||
k->firsthit = h->next;
|
||||
delete h;
|
||||
}
|
||||
tKeywords[hash] = k->next;
|
||||
delete k;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// callback appel<65>e par fetchAllKWords, <20> chaque kword
|
||||
void callbackKWord(unsigned long kword_id, char *keyword)
|
||||
{
|
||||
// printf("keyword %ld : '%s'\n", kword_id, keyword);
|
||||
// t_keywords[keyword]["kword_id"] = kword_id;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
//===================================================================================================================
|
||||
// MAIN
|
||||
//===================================================================================================================
|
||||
@@ -1149,7 +1098,7 @@ void cbScanXpaths(CConnbas_dbox *connbas, unsigned int xpath_id, char *xpath, un
|
||||
THREAD_ENTRYPOINT thread_index(void *parm)
|
||||
{
|
||||
CSbas *sbas = (CSbas *)parm;
|
||||
long prefsIndexes_value, prefsIndexes_toReindex=0;
|
||||
int prefsIndexes_value, prefsIndexes_toReindex=0;
|
||||
|
||||
zSyslog.log(CSyslog::LOGL_INFO, CSyslog::LOGC_THREAD_START, "#%ld : thread_index START (%s:%ld:%s)", sbas->sbas_id, sbas->host, sbas->port, sbas->dbname);
|
||||
|
||||
|
@@ -1,37 +1,44 @@
|
||||
#include <memory.h>
|
||||
#include <sys/time.h>
|
||||
#include "phrasea_clock_t.h"
|
||||
|
||||
/*
|
||||
#ifndef WIN32
|
||||
void phrasea_get_ticks ( clock_t *nbticks )
|
||||
|
||||
# ifdef PHP_WIN32
|
||||
|
||||
void startChrono(CHRONO &chrono)
|
||||
{
|
||||
*nbticks = clock();
|
||||
chrono = GetTickCount();
|
||||
}
|
||||
double stopChrono(CHRONO &chrono)
|
||||
{
|
||||
return((double)(GetTickCount()-chrono) / 1000.0);
|
||||
}
|
||||
|
||||
int phrasea_getclockinterval ( clock_t * timestart, clock_t * timeend )
|
||||
|
||||
# else
|
||||
|
||||
void startChrono(CHRONO &chrono)
|
||||
{
|
||||
return (int)(((double)( *timeend - *timestart ) / CLOCKS_PER_SEC ) * 1000 );
|
||||
gettimeofday(&chrono, NULL);
|
||||
return;
|
||||
}
|
||||
float stopChrono(CHRONO &chrono)
|
||||
{
|
||||
struct timeval t;
|
||||
gettimeofday(&t, NULL);
|
||||
t.tv_sec -= chrono.tv_sec;
|
||||
t.tv_usec -= chrono.tv_usec;
|
||||
if(t.tv_usec < 0)
|
||||
{
|
||||
t.tv_sec--;
|
||||
t.tv_usec += 1000000;
|
||||
}
|
||||
return((float)(t.tv_sec) + ((float)(t.tv_usec))/1000000);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
int millisec_diff(PHRASEA_TIMEB *timestart, PHRASEA_TIMEB *timeend)
|
||||
{
|
||||
// time_t t;
|
||||
return((1000 * (timeend->time - timestart->time)) + (timeend->millitm - timestart->millitm));
|
||||
}
|
||||
|
||||
void resetclock(PHRASEA_TIMEB * timeref)
|
||||
{
|
||||
timeref->time = timeref->millitm = 0;
|
||||
}
|
||||
|
||||
|
||||
# ifndef WIN32
|
||||
void resetclock(clock_t * timeref)
|
||||
{
|
||||
*timeref = 0;
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
|
||||
#ifndef WIN32
|
||||
char *_strupr( char *string )
|
||||
|
@@ -1,35 +1,30 @@
|
||||
/* d<>finition portable des structures syst<73>me <20> d<>nomination variable */
|
||||
#ifndef PHRASEA_CLOCK_T__INCLUDED
|
||||
#define PHRASEA_CLOCK_T__INCLUDED 1
|
||||
/*
|
||||
* phrasea_clock_t.h
|
||||
*
|
||||
* Created on: 4 mars 2010
|
||||
* Author: gaulier
|
||||
*/
|
||||
|
||||
#ifndef PHRASEA_CLOCK_T_H_
|
||||
#define PHRASEA_CLOCK_T_H_
|
||||
|
||||
|
||||
#include <sys/timeb.h>
|
||||
|
||||
/*
|
||||
#ifndef PHRASEA_TIMEB
|
||||
//# ifdef WIN32
|
||||
# define PHRASEA_TIMEB struct _timeb
|
||||
# define PHRASEA_FTIME ftime
|
||||
# define PHRASEA_GET_MS millisec_diff
|
||||
//# else
|
||||
//# define PHRASEA_TIMEB clock_t
|
||||
//# define PHRASEA_FTIME phrasea_get_ticks
|
||||
//# define PHRASEA_GET_MS phrasea_getclockinterval
|
||||
// ******* tosee : ligne mise en remarque pour warning win32
|
||||
//void PHRASEA_FTIME(PHRASEA_TIMEB *);
|
||||
//# endif
|
||||
#ifdef PHP_WIN32
|
||||
typedef DWORD CHRONO;
|
||||
#else
|
||||
typedef struct timeval CHRONO;
|
||||
#endif
|
||||
|
||||
void startChrono(CHRONO &chrono);
|
||||
float stopChrono(CHRONO &chrono);
|
||||
|
||||
|
||||
int PHRASEA_GET_MS(PHRASEA_TIMEB *, PHRASEA_TIMEB *);
|
||||
// ******* tosee : resetclock est impl<70>ment<6E> en void
|
||||
void resetclock(PHRASEA_TIMEB *);
|
||||
*/
|
||||
|
||||
#ifndef WIN32
|
||||
char *_strupr( char *string );
|
||||
#endif
|
||||
|
||||
#endif // PHRASEA_CLOCK_T__INCLUDED
|
||||
#endif /* PHRASEA_CLOCK_T_H_ */
|
||||
|
||||
|
||||
|
@@ -18,8 +18,8 @@ require_once __DIR__ . '/version.inc';
|
||||
require_once __DIR__ . '/../config/_GV.php';
|
||||
|
||||
spl_autoload_register('phrasea_autoload');
|
||||
phrasea::start();
|
||||
$session = session::getInstance();
|
||||
//phrasea::start(); // done in schedtask.php and runtask.exe.php
|
||||
//$session = session::getInstance(); // done in schedtask.php and runtask.exe.php
|
||||
|
||||
if(defined('GV_timezone'))
|
||||
date_default_timezone_set(GV_timezone);
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* File: Browser.php
|
||||
* Author: Chris Schuld (http://chrisschuld.com/)
|
||||
@@ -99,8 +100,9 @@
|
||||
* + Added support for IceCat
|
||||
* + Added support for Shiretoko
|
||||
*/
|
||||
class Browser
|
||||
{
|
||||
|
||||
class Browser {
|
||||
private $_agent = '';
|
||||
private $_browser_name = '';
|
||||
private $_version = '';
|
||||
@@ -114,7 +116,6 @@
|
||||
private $_aol_version = '';
|
||||
private $_chrome_frame = false;
|
||||
private $_chrome_frame_version = false;
|
||||
|
||||
private static $_instance;
|
||||
|
||||
const BROWSER_UNKNOWN = 'unknown';
|
||||
@@ -164,7 +165,6 @@
|
||||
|
||||
const OPERATING_SYSTEM_UNKNOWN = 'unknown';
|
||||
|
||||
|
||||
/**
|
||||
* @return browser
|
||||
*/
|
||||
@@ -178,15 +178,17 @@
|
||||
return self::$_instance;
|
||||
}
|
||||
|
||||
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
$this->reset();
|
||||
$this->determine();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset all properties
|
||||
*/
|
||||
public function reset() {
|
||||
public function reset()
|
||||
{
|
||||
$this->_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "";
|
||||
$this->_browser_name = self::BROWSER_UNKNOWN;
|
||||
$this->_version = self::VERSION_UNKNOWN;
|
||||
@@ -203,112 +205,190 @@
|
||||
* @param string $browserName
|
||||
* @return True if the browser is the specified browser
|
||||
*/
|
||||
function isBrowser($browserName) { return( 0 == strcasecmp($this->_browser_name, trim($browserName))); }
|
||||
function isBrowser($browserName)
|
||||
{
|
||||
return( 0 == strcasecmp($this->_browser_name, trim($browserName)));
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the browser. All return types are from the class contants
|
||||
* @return string Name of the browser
|
||||
*/
|
||||
public function getBrowser() { return $this->_browser_name; }
|
||||
public function getBrowser()
|
||||
{
|
||||
return $this->_browser_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* The IP address of the client.
|
||||
* @return string IP address the browser
|
||||
*/
|
||||
public function getIP() { return $this->_ip; }
|
||||
public function getIP()
|
||||
{
|
||||
return $this->_ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is new generation of Browser ? (Chrome, Safari, Webkit, Firefox, Opera ).
|
||||
* @return boolean
|
||||
*/
|
||||
public function isNewGeneration() { return $this->_is_new_generation; }
|
||||
public function isNewGeneration()
|
||||
{
|
||||
return $this->_is_new_generation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the Browser very old ?
|
||||
* @return boolean
|
||||
*/
|
||||
public function isOldBrowser() { return $this->_is_old; }
|
||||
public function isOldBrowser()
|
||||
{
|
||||
return $this->_is_old;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the Browser using chrome frame ?
|
||||
* @return boolean
|
||||
*/
|
||||
public function isChromeFrame() { return $this->_chrome_frame; }
|
||||
public function isChromeFrame()
|
||||
{
|
||||
return $this->_chrome_frame;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the name of the browser
|
||||
* @param $browser The name of the Browser
|
||||
*/
|
||||
public function setBrowser($browser) { return $this->_browser_name = $browser; }
|
||||
public function setBrowser($browser)
|
||||
{
|
||||
return $this->_browser_name = $browser;
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the platform. All return types are from the class contants
|
||||
* @return string Name of the browser
|
||||
*/
|
||||
public function getPlatform() { return $this->_platform; }
|
||||
public function getPlatform()
|
||||
{
|
||||
return $this->_platform;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the name of the platform
|
||||
* @param $platform The name of the Platform
|
||||
*/
|
||||
public function setPlatform($platform) { return $this->_platform = $platform; }
|
||||
public function setPlatform($platform)
|
||||
{
|
||||
return $this->_platform = $platform;
|
||||
}
|
||||
|
||||
/**
|
||||
* The version of the browser.
|
||||
* @return string Version of the browser (will only contain alpha-numeric characters and a period)
|
||||
*/
|
||||
public function getVersion() { return $this->_version; }
|
||||
public function getVersion()
|
||||
{
|
||||
return $this->_version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the version of the browser
|
||||
* @param $version The version of the Browser
|
||||
*/
|
||||
public function setVersion($version) { $this->_version = preg_replace('[^0-9,.,a-z,A-Z]','',$version); }
|
||||
public function setVersion($version)
|
||||
{
|
||||
$this->_version = preg_replace('[^0-9,.,a-z,A-Z]', '', $version);
|
||||
}
|
||||
|
||||
/**
|
||||
* The version of AOL.
|
||||
* @return string Version of AOL (will only contain alpha-numeric characters and a period)
|
||||
*/
|
||||
public function getAolVersion() { return $this->_aol_version; }
|
||||
public function getAolVersion()
|
||||
{
|
||||
return $this->_aol_version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the version of AOL
|
||||
* @param $version The version of AOL
|
||||
*/
|
||||
public function setAolVersion($version) { $this->_aol_version = preg_replace('[^0-9,.,a-z,A-Z]','',$version); }
|
||||
public function setAolVersion($version)
|
||||
{
|
||||
$this->_aol_version = preg_replace('[^0-9,.,a-z,A-Z]', '', $version);
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the browser from AOL?
|
||||
* @return boolean True if the browser is from AOL otherwise false
|
||||
*/
|
||||
public function isAol() { return $this->_is_aol; }
|
||||
public function isAol()
|
||||
{
|
||||
return $this->_is_aol;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the browser from a mobile device?
|
||||
* @return boolean True if the browser is from a mobile device otherwise false
|
||||
*/
|
||||
public function isMobile() { return $this->_is_mobile; }
|
||||
public function isMobile()
|
||||
{
|
||||
return $this->_is_mobile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the browser from a robot (ex Slurp,GoogleBot)?
|
||||
* @return boolean True if the browser is from a robot otherwise false
|
||||
*/
|
||||
public function isRobot() { return $this->_is_robot; }
|
||||
public function isRobot()
|
||||
{
|
||||
return $this->_is_robot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the browser to be from AOL
|
||||
* @param $isAol
|
||||
*/
|
||||
public function setAol($isAol) { $this->_is_aol = $isAol; }
|
||||
public function setAol($isAol)
|
||||
{
|
||||
$this->_is_aol = $isAol;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the user agent value in use to determine the browser
|
||||
* @return string The user agent from the HTTP header
|
||||
*/
|
||||
public function getUserAgent() { return $this->_agent; }
|
||||
public function getUserAgent()
|
||||
{
|
||||
return $this->_agent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the user agent value (the construction will use the HTTP header value - this will overwrite it)
|
||||
* @param $agent_string The value for the User Agent
|
||||
*/
|
||||
public function setUserAgent($agent_string) {
|
||||
public function setUserAgent($agent_string)
|
||||
{
|
||||
$this->reset();
|
||||
$this->_agent = $agent_string;
|
||||
$this->determine();
|
||||
}
|
||||
protected function setMobile($value=true) {
|
||||
|
||||
protected function setMobile($value=true)
|
||||
{
|
||||
$this->_is_mobile = $value;
|
||||
}
|
||||
protected function setRobot($value=true) {
|
||||
|
||||
protected function setRobot($value=true)
|
||||
{
|
||||
$this->_is_robot = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Protected routine to calculate and determine what the browser is in use (including platform)
|
||||
*/
|
||||
protected function determine() {
|
||||
protected function determine()
|
||||
{
|
||||
$this->checkPlatform();
|
||||
$this->checkBrowsers();
|
||||
$this->checkForAol();
|
||||
@@ -322,10 +402,12 @@
|
||||
* Protected routine to determine if the browser is chrome frame enabled
|
||||
* @return boolean True if the browser was detected otherwise false
|
||||
*/
|
||||
protected function checkChromeFrame() {
|
||||
protected function checkChromeFrame()
|
||||
{
|
||||
|
||||
$this->_chrome_frame = false;
|
||||
if( preg_match('/chromeframe/i',$this->_agent) ) {
|
||||
if (preg_match('/chromeframe/i', $this->_agent))
|
||||
{
|
||||
$this->_chrome_frame = true;
|
||||
$aresult = explode('/', stristr($this->_agent, 'chromeframe'));
|
||||
$aversion = explode(' ', $aresult[1]);
|
||||
@@ -340,7 +422,8 @@
|
||||
* Protected routine to determine the browser type
|
||||
* @return boolean True if the browser was detected otherwise false
|
||||
*/
|
||||
protected function checkBrowsers() {
|
||||
protected function checkBrowsers()
|
||||
{
|
||||
return (
|
||||
$this->checkBrowserGoogleBot() ||
|
||||
$this->checkBrowserSlurp() ||
|
||||
@@ -376,9 +459,11 @@
|
||||
* Determine if the user is using a BlackBerry
|
||||
* @return boolean True if the browser is the BlackBerry browser otherwise false
|
||||
*/
|
||||
protected function checkBrowserBlackBerry() {
|
||||
protected function checkBrowserBlackBerry()
|
||||
{
|
||||
$retval = false;
|
||||
if( preg_match('/blackberry/i',$this->_agent) ) {
|
||||
if (preg_match('/blackberry/i', $this->_agent))
|
||||
{
|
||||
$aresult = explode("/", stristr($this->_agent, "BlackBerry"));
|
||||
$aversion = explode(' ', $aresult[1]);
|
||||
$this->setVersion($aversion[0]);
|
||||
@@ -393,15 +478,18 @@
|
||||
* Determine if the user is using an AOL User Agent
|
||||
* @return boolean True if the browser is from AOL otherwise false
|
||||
*/
|
||||
protected function checkForAol() {
|
||||
protected function checkForAol()
|
||||
{
|
||||
$retval = false;
|
||||
if( preg_match('/aol/i', $this->_agent) ) {
|
||||
if (preg_match('/aol/i', $this->_agent))
|
||||
{
|
||||
$aversion = explode(' ', stristr($this->_agent, 'AOL'));
|
||||
$this->setAol(true);
|
||||
$this->setAolVersion(preg_replace('/[^0-9\.a-z]/i', '', $aversion[1]));
|
||||
$retval = true;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
$this->setAol(false);
|
||||
$this->setAolVersion(self::VERSION_UNKNOWN);
|
||||
$retval = true;
|
||||
@@ -413,9 +501,11 @@
|
||||
* Determine if the browser is the GoogleBot or not
|
||||
* @return boolean True if the browser is the GoogletBot otherwise false
|
||||
*/
|
||||
protected function checkBrowserGoogleBot() {
|
||||
protected function checkBrowserGoogleBot()
|
||||
{
|
||||
$retval = false;
|
||||
if( preg_match('/googlebot/i',$this->_agent) ) {
|
||||
if (preg_match('/googlebot/i', $this->_agent))
|
||||
{
|
||||
$aresult = explode('/', stristr($this->_agent, 'googlebot'));
|
||||
$aversion = explode(' ', $aresult[1]);
|
||||
$this->setVersion(str_replace(';', '', $aversion[0]));
|
||||
@@ -430,9 +520,11 @@
|
||||
* Determine if the browser is the W3C Validator or not
|
||||
* @return boolean True if the browser is the W3C Validator otherwise false
|
||||
*/
|
||||
protected function checkBrowserW3CValidator() {
|
||||
protected function checkBrowserW3CValidator()
|
||||
{
|
||||
$retval = false;
|
||||
if( preg_match('/W3C-checklink/i',$this->_agent) ) {
|
||||
if (preg_match('/W3C-checklink/i', $this->_agent))
|
||||
{
|
||||
$aresult = explode('/', stristr($this->_agent, 'W3C-checklink'));
|
||||
$aversion = explode(' ', $aresult[1]);
|
||||
$this->setVersion($aversion[0]);
|
||||
@@ -446,9 +538,11 @@
|
||||
* Determine if the browser is the W3C Validator or not
|
||||
* @return boolean True if the browser is the W3C Validator otherwise false
|
||||
*/
|
||||
protected function checkBrowserSlurp() {
|
||||
protected function checkBrowserSlurp()
|
||||
{
|
||||
$retval = false;
|
||||
if( preg_match('/Slurp/i',$this->_agent) ) {
|
||||
if (preg_match('/Slurp/i', $this->_agent))
|
||||
{
|
||||
$aresult = explode('/', stristr($this->_agent, 'Slurp'));
|
||||
$aversion = explode(' ', $aresult[1]);
|
||||
$this->setVersion($aversion[0]);
|
||||
@@ -463,37 +557,44 @@
|
||||
* Determine if the browser is Internet Explorer or not
|
||||
* @return boolean True if the browser is Internet Explorer otherwise false
|
||||
*/
|
||||
protected function checkBrowserInternetExplorer() {
|
||||
protected function checkBrowserInternetExplorer()
|
||||
{
|
||||
$retval = false;
|
||||
|
||||
// Test for v1 - v1.5 IE
|
||||
if( preg_match('/microsoft internet explorer/i', $this->_agent) ) {
|
||||
if (preg_match('/microsoft internet explorer/i', $this->_agent))
|
||||
{
|
||||
$this->setBrowser(self::BROWSER_IE);
|
||||
$this->setVersion('1.0');
|
||||
$aresult = stristr($this->_agent, '/');
|
||||
if( preg_match('/308|425|426|474|0b1/i', $aresult) ) {
|
||||
if (preg_match('/308|425|426|474|0b1/i', $aresult))
|
||||
{
|
||||
$this->setVersion('1.5');
|
||||
}
|
||||
$retval = true;
|
||||
}
|
||||
// Test for versions > 1.5
|
||||
else if( preg_match('/msie/i',$this->_agent) && !preg_match('/opera/i',$this->_agent) ) {
|
||||
else if (preg_match('/msie/i', $this->_agent) && !preg_match('/opera/i', $this->_agent))
|
||||
{
|
||||
$aresult = explode(' ', stristr(str_replace(';', '; ', $this->_agent), 'msie'));
|
||||
$this->setBrowser(self::BROWSER_IE);
|
||||
$this->setVersion(str_replace(array('(', ')', ';'), '', $aresult[1]));
|
||||
$retval = true;
|
||||
}
|
||||
// Test for Pocket IE
|
||||
else if( preg_match('/mspie/i',$this->_agent) || preg_match('/pocket/i', $this->_agent) ) {
|
||||
else if (preg_match('/mspie/i', $this->_agent) || preg_match('/pocket/i', $this->_agent))
|
||||
{
|
||||
$aresult = explode(' ', stristr($this->_agent, 'mspie'));
|
||||
$this->setPlatform(self::PLATFORM_WINDOWS_CE);
|
||||
$this->setBrowser(self::BROWSER_POCKET_IE);
|
||||
$this->setMobile();
|
||||
|
||||
if( preg_match('/mspie/i', $this->_agent) ) {
|
||||
if (preg_match('/mspie/i', $this->_agent))
|
||||
{
|
||||
$this->setVersion($aresult[1]);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
$aversion = explode('/', $this->_agent);
|
||||
$this->setVersion($aversion[1]);
|
||||
}
|
||||
@@ -506,11 +607,14 @@
|
||||
* Determine if the browser is Opera or not
|
||||
* @return boolean True if the browser is Opera otherwise false
|
||||
*/
|
||||
protected function checkBrowserOpera() {
|
||||
protected function checkBrowserOpera()
|
||||
{
|
||||
$retval = false;
|
||||
if( preg_match('/opera mini/i',$this->_agent) ) {
|
||||
if (preg_match('/opera mini/i', $this->_agent))
|
||||
{
|
||||
$resultant = stristr($this->_agent, 'opera mini');
|
||||
if( preg_match('/\//',$resultant) ) {
|
||||
if (preg_match('/\//', $resultant))
|
||||
{
|
||||
$aresult = explode('/', $resultant);
|
||||
$aversion = explode(' ', $aresult[1]);
|
||||
$this->setVersion($aversion[0]);
|
||||
@@ -518,7 +622,8 @@
|
||||
$this->setMobile();
|
||||
$retval = true;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
$aversion = explode(' ', stristr($resultant, 'opera mini'));
|
||||
$this->setVersion($aversion[1]);
|
||||
$this->_browser_name = self::BROWSER_OPERA_MINI;
|
||||
@@ -526,21 +631,25 @@
|
||||
$retval = true;
|
||||
}
|
||||
}
|
||||
else if( preg_match('/opera/i',$this->_agent) ) {
|
||||
else if (preg_match('/opera/i', $this->_agent))
|
||||
{
|
||||
$resultant = stristr($this->_agent, 'opera');
|
||||
if( preg_match('/Version\/(10.*)$/',$resultant,$matches) ) {
|
||||
if (preg_match('/Version\/([0-9]{2}.*)$/', $resultant, $matches))
|
||||
{
|
||||
$this->setVersion($matches[1]);
|
||||
$this->_browser_name = self::BROWSER_OPERA;
|
||||
$retval = true;
|
||||
}
|
||||
else if( preg_match('/\//',$resultant) ) {
|
||||
else if (preg_match('/\//', $resultant))
|
||||
{
|
||||
$aresult = explode('/', $resultant);
|
||||
$aversion = explode(' ', $aresult[1]);
|
||||
$this->setVersion($aversion[0]);
|
||||
$this->_browser_name = self::BROWSER_OPERA;
|
||||
$retval = true;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
$aversion = explode(' ', stristr($resultant, 'opera'));
|
||||
$this->setVersion($aversion[1]);
|
||||
$this->_browser_name = self::BROWSER_OPERA;
|
||||
@@ -554,9 +663,11 @@
|
||||
* Determine if the browser is WebTv or not
|
||||
* @return boolean True if the browser is WebTv otherwise false
|
||||
*/
|
||||
protected function checkBrowserWebTv() {
|
||||
protected function checkBrowserWebTv()
|
||||
{
|
||||
$retval = false;
|
||||
if( preg_match('/webtv/i',$this->_agent) ) {
|
||||
if (preg_match('/webtv/i', $this->_agent))
|
||||
{
|
||||
$aresult = explode('/', stristr($this->_agent, 'webtv'));
|
||||
$aversion = explode(' ', $aresult[1]);
|
||||
$this->setVersion($aversion[0]);
|
||||
@@ -570,9 +681,11 @@
|
||||
* Determine if the browser is NetPositive or not
|
||||
* @return boolean True if the browser is NetPositive otherwise false
|
||||
*/
|
||||
protected function checkBrowserNetPositive() {
|
||||
protected function checkBrowserNetPositive()
|
||||
{
|
||||
$retval = false;
|
||||
if( preg_match('/NetPositive/i',$this->_agent) ) {
|
||||
if (preg_match('/NetPositive/i', $this->_agent))
|
||||
{
|
||||
$aresult = explode('/', stristr($this->_agent, 'NetPositive'));
|
||||
$aversion = explode(' ', $aresult[1]);
|
||||
$this->setVersion(str_replace(array('(', ')', ';'), '', $aversion[0]));
|
||||
@@ -587,9 +700,11 @@
|
||||
* Determine if the browser is Galeon or not
|
||||
* @return boolean True if the browser is Galeon otherwise false
|
||||
*/
|
||||
protected function checkBrowserGaleon() {
|
||||
protected function checkBrowserGaleon()
|
||||
{
|
||||
$retval = false;
|
||||
if( preg_match('/galeon/i',$this->_agent) ) {
|
||||
if (preg_match('/galeon/i', $this->_agent))
|
||||
{
|
||||
$aresult = explode(' ', stristr($this->_agent, 'galeon'));
|
||||
$aversion = explode('/', $aresult[0]);
|
||||
$this->setVersion($aversion[1]);
|
||||
@@ -603,9 +718,11 @@
|
||||
* Determine if the browser is Konqueror or not
|
||||
* @return boolean True if the browser is Konqueror otherwise false
|
||||
*/
|
||||
protected function checkBrowserKonqueror() {
|
||||
protected function checkBrowserKonqueror()
|
||||
{
|
||||
$retval = false;
|
||||
if( preg_match('/Konqueror/i',$this->_agent) ) {
|
||||
if (preg_match('/Konqueror/i', $this->_agent))
|
||||
{
|
||||
$aresult = explode(' ', stristr($this->_agent, 'Konqueror'));
|
||||
$aversion = explode('/', $aresult[0]);
|
||||
$this->setVersion($aversion[1]);
|
||||
@@ -619,9 +736,11 @@
|
||||
* Determine if the browser is iCab or not
|
||||
* @return boolean True if the browser is iCab otherwise false
|
||||
*/
|
||||
protected function checkBrowserIcab() {
|
||||
protected function checkBrowserIcab()
|
||||
{
|
||||
$retval = false;
|
||||
if( preg_match('/icab/i',$this->_agent) ) {
|
||||
if (preg_match('/icab/i', $this->_agent))
|
||||
{
|
||||
$aversion = explode(' ', stristr(str_replace('/', ' ', $this->_agent), 'icab'));
|
||||
$this->setVersion($aversion[1]);
|
||||
$this->setBrowser(self::BROWSER_ICAB);
|
||||
@@ -634,9 +753,11 @@
|
||||
* Determine if the browser is OmniWeb or not
|
||||
* @return boolean True if the browser is OmniWeb otherwise false
|
||||
*/
|
||||
protected function checkBrowserOmniWeb() {
|
||||
protected function checkBrowserOmniWeb()
|
||||
{
|
||||
$retval = false;
|
||||
if( preg_match('/omniweb/i',$this->_agent) ) {
|
||||
if (preg_match('/omniweb/i', $this->_agent))
|
||||
{
|
||||
$aresult = explode('/', stristr($this->_agent, 'omniweb'));
|
||||
$aversion = explode(' ', $aresult[1]);
|
||||
$this->setVersion($aversion[0]);
|
||||
@@ -650,9 +771,11 @@
|
||||
* Determine if the browser is Phoenix or not
|
||||
* @return boolean True if the browser is Phoenix otherwise false
|
||||
*/
|
||||
protected function checkBrowserPhoenix() {
|
||||
protected function checkBrowserPhoenix()
|
||||
{
|
||||
$retval = false;
|
||||
if( preg_match('/Phoenix/i',$this->_agent) ) {
|
||||
if (preg_match('/Phoenix/i', $this->_agent))
|
||||
{
|
||||
$aversion = explode('/', stristr($this->_agent, 'Phoenix'));
|
||||
$this->setVersion($aversion[1]);
|
||||
$this->setBrowser(self::BROWSER_PHOENIX);
|
||||
@@ -665,9 +788,11 @@
|
||||
* Determine if the browser is Firebird or not
|
||||
* @return boolean True if the browser is Firebird otherwise false
|
||||
*/
|
||||
protected function checkBrowserFirebird() {
|
||||
protected function checkBrowserFirebird()
|
||||
{
|
||||
$retval = false;
|
||||
if( preg_match('/Firebird/i',$this->_agent) ) {
|
||||
if (preg_match('/Firebird/i', $this->_agent))
|
||||
{
|
||||
$aversion = explode('/', stristr($this->_agent, 'Firebird'));
|
||||
$this->setVersion($aversion[1]);
|
||||
$this->setBrowser(self::BROWSER_FIREBIRD);
|
||||
@@ -680,9 +805,11 @@
|
||||
* Determine if the browser is Netscape Navigator 9+ or not (http://browser.netscape.com/ - Official support ended on March 1st, 2008)
|
||||
* @return boolean True if the browser is Netscape Navigator 9+ otherwise false
|
||||
*/
|
||||
protected function checkBrowserNetscapeNavigator9Plus() {
|
||||
protected function checkBrowserNetscapeNavigator9Plus()
|
||||
{
|
||||
$retval = false;
|
||||
if( preg_match('/Firefox/i',$this->_agent) && preg_match('/Navigator\/([^ ]*)/i',$this->_agent,$matches) ) {
|
||||
if (preg_match('/Firefox/i', $this->_agent) && preg_match('/Navigator\/([^ ]*)/i', $this->_agent, $matches))
|
||||
{
|
||||
$this->setVersion($matches[1]);
|
||||
$this->setBrowser(self::BROWSER_NETSCAPE_NAVIGATOR);
|
||||
$retval = true;
|
||||
@@ -694,9 +821,11 @@
|
||||
* Determine if the browser is Shiretoko or not (https://wiki.mozilla.org/Projects/shiretoko)
|
||||
* @return boolean True if the browser is Shiretoko otherwise false
|
||||
*/
|
||||
protected function checkBrowserShiretoko() {
|
||||
protected function checkBrowserShiretoko()
|
||||
{
|
||||
$retval = false;
|
||||
if( preg_match('/Mozilla/i',$this->_agent) && preg_match('/Shiretoko\/([^ ]*)/i',$this->_agent,$matches) ) {
|
||||
if (preg_match('/Mozilla/i', $this->_agent) && preg_match('/Shiretoko\/([^ ]*)/i', $this->_agent, $matches))
|
||||
{
|
||||
$this->setVersion($matches[1]);
|
||||
$this->setBrowser(self::BROWSER_SHIRETOKO);
|
||||
$retval = true;
|
||||
@@ -708,9 +837,11 @@
|
||||
* Determine if the browser is Ice Cat or not (http://en.wikipedia.org/wiki/GNU_IceCat)
|
||||
* @return boolean True if the browser is Ice Cat otherwise false
|
||||
*/
|
||||
protected function checkBrowserIceCat() {
|
||||
protected function checkBrowserIceCat()
|
||||
{
|
||||
$retval = false;
|
||||
if( preg_match('/Mozilla/i',$this->_agent) && preg_match('/IceCat\/([^ ]*)/i',$this->_agent,$matches) ) {
|
||||
if (preg_match('/Mozilla/i', $this->_agent) && preg_match('/IceCat\/([^ ]*)/i', $this->_agent, $matches))
|
||||
{
|
||||
$this->setVersion($matches[1]);
|
||||
$this->setBrowser(self::BROWSER_ICECAT);
|
||||
$retval = true;
|
||||
@@ -722,9 +853,11 @@
|
||||
* Determine if the browser is Firefox or not
|
||||
* @return boolean True if the browser is Firefox otherwise false
|
||||
*/
|
||||
protected function checkBrowserFirefox() {
|
||||
protected function checkBrowserFirefox()
|
||||
{
|
||||
$retval = false;
|
||||
if( preg_match('/Firefox/i',$this->_agent) ) {
|
||||
if (preg_match('/Firefox/i', $this->_agent))
|
||||
{
|
||||
$aresult = explode('/', stristr($this->_agent, 'Firefox'));
|
||||
$aversion = explode(' ', $aresult[1]);
|
||||
$this->setVersion($aversion[0]);
|
||||
@@ -738,9 +871,11 @@
|
||||
* Determine if the browser is Iceweasel or not
|
||||
* @return boolean True if the browser is Iceweasel otherwise false
|
||||
*/
|
||||
protected function checkBrowserIceweasel() {
|
||||
protected function checkBrowserIceweasel()
|
||||
{
|
||||
$retval = false;
|
||||
if( preg_match('/Iceweasel/i',$this->_agent) ) {
|
||||
if (preg_match('/Iceweasel/i', $this->_agent))
|
||||
{
|
||||
$aresult = explode('/', stristr($this->_agent, 'Iceweasel'));
|
||||
$aversion = explode(' ', $aresult[1]);
|
||||
$this->setVersion($aversion[0]);
|
||||
@@ -754,16 +889,19 @@
|
||||
* Determine if the browser is Mozilla or not
|
||||
* @return boolean True if the browser is Mozilla otherwise false
|
||||
*/
|
||||
protected function checkBrowserMozilla() {
|
||||
protected function checkBrowserMozilla()
|
||||
{
|
||||
$retval = false;
|
||||
if( preg_match('/mozilla/i',$this->_agent) && preg_match('/rv:[0-9].[0-9][a-b]?/i',$this->_agent) && !preg_match('/netscape/i',$this->_agent)) {
|
||||
if (preg_match('/mozilla/i', $this->_agent) && preg_match('/rv:[0-9].[0-9][a-b]?/i', $this->_agent) && !preg_match('/netscape/i', $this->_agent))
|
||||
{
|
||||
$aversion = explode(' ', stristr($this->_agent, 'rv:'));
|
||||
preg_match('/rv:[0-9].[0-9][a-b]?/i', $this->_agent, $aversion);
|
||||
$this->setVersion(str_replace('rv:', '', $aversion[0]));
|
||||
$this->setBrowser(self::BROWSER_MOZILLA);
|
||||
$retval = true;
|
||||
}
|
||||
else if( preg_match('/mozilla/i',$this->_agent) && preg_match('/rv:[0-9]\.[0-9]/i',$this->_agent) && !preg_match('/netscape/i',$this->_agent) ) {
|
||||
else if (preg_match('/mozilla/i', $this->_agent) && preg_match('/rv:[0-9]\.[0-9]/i', $this->_agent) && !preg_match('/netscape/i', $this->_agent))
|
||||
{
|
||||
$aversion = explode('', stristr($this->_agent, 'rv:'));
|
||||
preg_match('/rv:[0-9]\.[0-9]\.[0-9]/i', $this->_agent, $aversion);
|
||||
echo
|
||||
@@ -778,9 +916,11 @@
|
||||
* Determine if the browser is Lynx or not
|
||||
* @return boolean True if the browser is Lynx otherwise false
|
||||
*/
|
||||
protected function checkBrowserLynx() {
|
||||
protected function checkBrowserLynx()
|
||||
{
|
||||
$retval = false;
|
||||
if( preg_match('/libwww/i',$this->_agent) && preg_match('/lynx/i', $this->_agent) ) {
|
||||
if (preg_match('/libwww/i', $this->_agent) && preg_match('/lynx/i', $this->_agent))
|
||||
{
|
||||
$aresult = explode('/', stristr($this->_agent, 'Lynx'));
|
||||
$aversion = explode(' ', $aresult[1]);
|
||||
$this->setVersion($aversion[0]);
|
||||
@@ -794,9 +934,11 @@
|
||||
* Determine if the browser is Amaya or not
|
||||
* @return boolean True if the browser is Amaya otherwise false
|
||||
*/
|
||||
protected function checkBrowserAmaya() {
|
||||
protected function checkBrowserAmaya()
|
||||
{
|
||||
$retval = false;
|
||||
if( preg_match('/libwww/i',$this->_agent) && preg_match('/amaya/i', $this->_agent) ) {
|
||||
if (preg_match('/libwww/i', $this->_agent) && preg_match('/amaya/i', $this->_agent))
|
||||
{
|
||||
$aresult = explode('/', stristr($this->_agent, 'Amaya'));
|
||||
$aversion = explode(' ', $aresult[1]);
|
||||
$this->setVersion($aversion[0]);
|
||||
@@ -810,9 +952,11 @@
|
||||
* Determine if the browser is Chrome or not
|
||||
* @return boolean True if the browser is Chrome otherwise false
|
||||
*/
|
||||
protected function checkBrowserChrome() {
|
||||
protected function checkBrowserChrome()
|
||||
{
|
||||
$retval = false;
|
||||
if( preg_match('/Chrome/i',$this->_agent) ) {
|
||||
if (preg_match('/Chrome/i', $this->_agent))
|
||||
{
|
||||
$aresult = explode('/', stristr($this->_agent, 'Chrome'));
|
||||
$aversion = explode(' ', $aresult[1]);
|
||||
$this->setVersion($aversion[0]);
|
||||
@@ -826,15 +970,19 @@
|
||||
* Determine if the browser is Safari or not
|
||||
* @return boolean True if the browser is Safari otherwise false
|
||||
*/
|
||||
protected function checkBrowserSafari() {
|
||||
protected function checkBrowserSafari()
|
||||
{
|
||||
$retval = false;
|
||||
if( preg_match('/Safari/i',$this->_agent) && ! preg_match('/iPhone/i',$this->_agent) && ! preg_match('/iPod/i',$this->_agent) ) {
|
||||
if (preg_match('/Safari/i', $this->_agent) && !preg_match('/iPhone/i', $this->_agent) && !preg_match('/iPod/i', $this->_agent))
|
||||
{
|
||||
$aresult = explode('/', stristr($this->_agent, 'Version'));
|
||||
if( isset($aresult[1]) ) {
|
||||
if (isset($aresult[1]))
|
||||
{
|
||||
$aversion = explode(' ', $aresult[1]);
|
||||
$this->setVersion($aversion[0]);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
$this->setVersion(self::VERSION_UNKNOWN);
|
||||
}
|
||||
$this->setBrowser(self::BROWSER_SAFARI);
|
||||
@@ -847,15 +995,19 @@
|
||||
* Determine if the browser is iPhone or not
|
||||
* @return boolean True if the browser is iPhone otherwise false
|
||||
*/
|
||||
protected function checkBrowseriPhone() {
|
||||
protected function checkBrowseriPhone()
|
||||
{
|
||||
$retval = false;
|
||||
if( preg_match('/iPhone/i',$this->_agent) ) {
|
||||
if (preg_match('/iPhone/i', $this->_agent))
|
||||
{
|
||||
$aresult = explode('/', stristr($this->_agent, 'Version'));
|
||||
if( isset($aresult[1]) ) {
|
||||
if (isset($aresult[1]))
|
||||
{
|
||||
$aversion = explode(' ', $aresult[1]);
|
||||
$this->setVersion($aversion[0]);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
$this->setVersion(self::VERSION_UNKNOWN);
|
||||
}
|
||||
$this->setMobile();
|
||||
@@ -869,15 +1021,19 @@
|
||||
* Determine if the browser is iPod or not
|
||||
* @return boolean True if the browser is iPod otherwise false
|
||||
*/
|
||||
protected function checkBrowseriPod() {
|
||||
protected function checkBrowseriPod()
|
||||
{
|
||||
$retval = false;
|
||||
if( preg_match('/iPod/i',$this->_agent) ) {
|
||||
if (preg_match('/iPod/i', $this->_agent))
|
||||
{
|
||||
$aresult = explode('/', stristr($this->_agent, 'Version'));
|
||||
if( isset($aresult[1]) ) {
|
||||
if (isset($aresult[1]))
|
||||
{
|
||||
$aversion = explode(' ', $aresult[1]);
|
||||
$this->setVersion($aversion[0]);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
$this->setVersion(self::VERSION_UNKNOWN);
|
||||
}
|
||||
$this->setMobile();
|
||||
@@ -891,15 +1047,19 @@
|
||||
* Determine if the browser is Android or not
|
||||
* @return boolean True if the browser is Android otherwise false
|
||||
*/
|
||||
protected function checkBrowserAndroid() {
|
||||
protected function checkBrowserAndroid()
|
||||
{
|
||||
$retval = false;
|
||||
if( preg_match('/Android/i',$this->_agent) ) {
|
||||
if (preg_match('/Android/i', $this->_agent))
|
||||
{
|
||||
$aresult = explode('/', stristr($this->_agent, 'Version'));
|
||||
if( isset($aresult[1]) ) {
|
||||
if (isset($aresult[1]))
|
||||
{
|
||||
$aversion = explode(' ', $aresult[1]);
|
||||
$this->setVersion($aversion[0]);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
$this->setVersion(self::VERSION_UNKNOWN);
|
||||
}
|
||||
$this->setMobile();
|
||||
@@ -912,29 +1072,38 @@
|
||||
/**
|
||||
* Determine the user's platform
|
||||
*/
|
||||
protected function checkPlatform() {
|
||||
if( preg_match('/iPhone/i', $this->_agent) ) {
|
||||
protected function checkPlatform()
|
||||
{
|
||||
if (preg_match('/iPhone/i', $this->_agent))
|
||||
{
|
||||
$this->_platform = self::PLATFORM_IPHONE;
|
||||
}
|
||||
else if( preg_match('/iPod/i', $this->_agent) ) {
|
||||
else if (preg_match('/iPod/i', $this->_agent))
|
||||
{
|
||||
$this->_platform = self::PLATFORM_IPOD;
|
||||
}
|
||||
else if( preg_match('/BlackBerry/i', $this->_agent) ) {
|
||||
else if (preg_match('/BlackBerry/i', $this->_agent))
|
||||
{
|
||||
$this->_platform = self::PLATFORM_BLACKBERRY;
|
||||
}
|
||||
else if( preg_match('/win/i', $this->_agent) ) {
|
||||
else if (preg_match('/win/i', $this->_agent))
|
||||
{
|
||||
$this->_platform = self::PLATFORM_WINDOWS;
|
||||
}
|
||||
elseif( preg_match('/mac/i', $this->_agent) ) {
|
||||
elseif (preg_match('/mac/i', $this->_agent))
|
||||
{
|
||||
$this->_platform = self::PLATFORM_APPLE;
|
||||
}
|
||||
elseif( preg_match('/linux/i', $this->_agent) ) {
|
||||
elseif (preg_match('/linux/i', $this->_agent))
|
||||
{
|
||||
$this->_platform = self::PLATFORM_LINUX;
|
||||
}
|
||||
elseif( preg_match('/OS\/2/i', $this->_agent) ) {
|
||||
elseif (preg_match('/OS\/2/i', $this->_agent))
|
||||
{
|
||||
$this->_platform = self::PLATFORM_OS2;
|
||||
}
|
||||
elseif( preg_match('/BeOS/i', $this->_agent) ) {
|
||||
elseif (preg_match('/BeOS/i', $this->_agent))
|
||||
{
|
||||
$this->_platform = self::PLATFORM_BEOS;
|
||||
}
|
||||
}
|
||||
@@ -1026,4 +1195,5 @@
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -483,7 +483,8 @@ class export
|
||||
$name = mb_substr($name, 0, $max_length);
|
||||
|
||||
$n = 1;
|
||||
while (in_array($name, $file_names))
|
||||
|
||||
while (in_array(mb_strtolower($name), $file_names))
|
||||
{
|
||||
$n++;
|
||||
$suffix = "-" . $n; // pour diese si besoin
|
||||
@@ -494,7 +495,8 @@ class export
|
||||
else
|
||||
$name = $name . $suffix;
|
||||
}
|
||||
$file_names[] = $name;
|
||||
|
||||
$file_names[] = mb_strtolower($name);
|
||||
$files[$id]["export_name"] = $name;
|
||||
|
||||
$files[$id]["export_name"] = noaccent_utf8($files[$id]["export_name"], UNPARSED);
|
||||
|
@@ -270,7 +270,7 @@ class p4file
|
||||
}
|
||||
|
||||
|
||||
public static function check_file_error($filename, $sbas_id)
|
||||
public static function check_file_error($filename, $sbas_id, $originalname='')
|
||||
{
|
||||
require_once GV_RootPath.'lib/index_utils2.php';
|
||||
$infos = giveMimeExt($filename);
|
||||
@@ -295,6 +295,23 @@ class p4file
|
||||
{
|
||||
switch($name)
|
||||
{
|
||||
case 'name':
|
||||
$fn = $originalname;
|
||||
// fn can contain single quotes, but NO doubles
|
||||
// if( count($fn=explode('"', $fn)) == 1)
|
||||
// $fn = '\\"' . $fn[0] . '\\"';
|
||||
// else
|
||||
// $fn = 'concat(\\"' . implode('\\",\'\\"\',\\"', $fn) . '\\")';
|
||||
$fn = '\\"'.str_replace('"', '"', $fn).'\\"'; // in fact xquey does LITERAL search on attributes, so '"' does REALLY MEANS """ !
|
||||
$connbas = connection::getInstance($sbas_id);
|
||||
$sql = 'SELECT record_id FROM record WHERE EXTRACTVALUE(xml, "count(/record/doc[@originalname='.$fn.'])")>0 LIMIT 1';
|
||||
if( ($rs=$connbas->query($sql)) )
|
||||
{
|
||||
if($connbas->num_rows($rs)>0)
|
||||
$errors[] = sprintf(_('Le fichier \'%s\' existe deja'), $originalname);
|
||||
$connbas->free_result($rs);
|
||||
}
|
||||
break;
|
||||
case 'size':
|
||||
$min = min($datas['Image Height'], $datas['Image Width']);
|
||||
if($min < (int)$value)
|
||||
|
@@ -1793,7 +1793,7 @@ class task_archive extends phraseatask
|
||||
|
||||
$uuid = $file_uuid->write_uuid($uuid);
|
||||
|
||||
$error_file = p4file::check_file_error($path.'/'.$file, $sbas_id);
|
||||
$error_file = p4file::check_file_error($path.'/'.$file, $sbas_id, $file);
|
||||
$status = status::or_operation($stat0, $stat1);
|
||||
|
||||
if($meta['status'])
|
||||
|
@@ -589,7 +589,7 @@ class task_ftp extends phraseatask
|
||||
if ($loop > 2 || memory_get_usage() >> 20 >= 15)
|
||||
{
|
||||
$conn->close();
|
||||
unset($conn);
|
||||
$conn = null;
|
||||
sleep(20);
|
||||
$ret = 'torestart';
|
||||
$running = false;
|
||||
|
@@ -2770,10 +2770,24 @@ function make_mp4_progressive($mp4_file)
|
||||
{
|
||||
if ($debug)
|
||||
echo "\nmp4 box OK, doing it\n";
|
||||
|
||||
$cmd = GV_mp4box . ' -inter 0.5 ' . escapeshellarg($mp4_file);
|
||||
$tmp_file = $mp4_file . 'non-inter.mp4';
|
||||
rename($mp4_file, $tmp_file);
|
||||
$cmd = GV_mp4box . ' -inter 0.5 ' . escapeshellarg($tmp_file) . ' -out ' . escapeshellarg($mp4_file);
|
||||
$errArr = '';
|
||||
|
||||
if ($debug)
|
||||
echo $cmd . "\n\n ";
|
||||
|
||||
@exec($cmd, $errArr);
|
||||
if (is_file($mp4_file) && filesize($mp4_file) > 0)
|
||||
{
|
||||
unlink($tmp_file);
|
||||
}
|
||||
else
|
||||
{
|
||||
rename($tmp_file, $mp4_file);
|
||||
}
|
||||
|
||||
|
||||
$ret = true;
|
||||
}
|
||||
|
@@ -1,2 +1,2 @@
|
||||
<?php
|
||||
define('GV_version','3.1.17');
|
||||
define('GV_version','3.1.19');
|
||||
|
@@ -68,7 +68,7 @@ function sylk($tableau,$nomfic,$typ="SYLK")
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
header("Content-Type: text/plain");
|
||||
header("Content-Type: text/csv");
|
||||
header("Cache-Control: max-age=3600, must-revalidate ");
|
||||
header("Content-Disposition: attachment; filename=export.csv;");
|
||||
|
||||
|
@@ -88,6 +88,9 @@ else
|
||||
|
||||
}
|
||||
|
||||
$conn = connection::getInstance();
|
||||
$conn->close();
|
||||
|
||||
|
||||
function my_syslog($level, $msg)
|
||||
{
|
||||
|
@@ -336,6 +336,7 @@ phrasea::headers();
|
||||
<script type="text/javascript" language="javascript" src="/include/minify/f=include/jslibs/jquery-1.4.4.js"></script>
|
||||
<script type="text/javascript" language="javascript" src="/include/minify/f=include/jslibs/jquery.validate.js"></script>
|
||||
<script type="text/javascript" language="javascript" src="/include/minify/f=include/jslibs/jquery.validate.password.js"></script>
|
||||
<script type="text/javascript" language="javascript" src="/include/minify/f=include/jslibs/jquery.validate.login.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
<?php
|
||||
@@ -363,6 +364,7 @@ phrasea::headers();
|
||||
$msg .= ' ,equalTo: "'._('forms::les mots de passe ne correspondent pas').'"';
|
||||
if($ar == 'form_email')
|
||||
$msg .= ',email:"'.(str_replace('"','\"',_('forms::l\'email semble invalide'))).'"';
|
||||
$msg .= ',login:"'.(str_replace('"','\"',_('login invalide (8 caracteres sans accents ni espaces)'))).'"';
|
||||
|
||||
$msg .= '}';
|
||||
}
|
||||
@@ -397,9 +399,11 @@ phrasea::headers();
|
||||
|
||||
$('#form_email').rules("add",{email:true});
|
||||
|
||||
$('#form_login').rules("add",{
|
||||
minlength: 5
|
||||
});
|
||||
// $('#form_login').rules("add",{
|
||||
// minlength: 5
|
||||
// });
|
||||
|
||||
$('#form_login').rules("add",{login : true});
|
||||
|
||||
$('#form_password').rules("add",{password: "#form_login"});
|
||||
$('#form_password_confirm').rules("add",{equalTo: "#form_password"});
|
||||
|
@@ -1788,10 +1788,13 @@ function preset_load(preset_id)
|
||||
{
|
||||
if(p4.edit.T_fields[f].multi)
|
||||
{
|
||||
p4.edit.T_records[r].fields[""+f] = {
|
||||
"value":p4.edit.T_fields[f].preset,
|
||||
"dirty":true
|
||||
};
|
||||
p4.edit.T_records[r].fields[""+f] = {value:[], dirty:true};// = {
|
||||
var n = 0;
|
||||
for(val in p4.edit.T_fields[f].preset)
|
||||
{
|
||||
p4.edit.T_records[r].fields[""+f].value[n] = p4.edit.T_fields[f].preset[val];
|
||||
n++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -16,8 +16,6 @@ $parm = $request->get_parms(
|
||||
, 'piv'
|
||||
, "id"
|
||||
, 't'
|
||||
, 'dlk' // supprimer les liens des champs (tbranch)
|
||||
, 'rdx' // r�indexer apr�s
|
||||
, 'dlg'
|
||||
);
|
||||
|
||||
@@ -77,8 +75,6 @@ if($parm["bid"] !== null)
|
||||
}
|
||||
|
||||
if (!$err)
|
||||
{
|
||||
if($parm['dlk']) // delete links from fields to thesaurus ('tbranch')
|
||||
{
|
||||
$sql = 'SELECT value AS struct FROM pref WHERE prop="structure"';
|
||||
if (($rsbas = $connbas->query($sql)))
|
||||
@@ -106,11 +102,7 @@ if($parm["bid"] !== null)
|
||||
}
|
||||
$connbas->free_result($rsbas);
|
||||
}
|
||||
}
|
||||
|
||||
if($parm['rdx']) // reindex
|
||||
{
|
||||
// clear cterms
|
||||
$sql = 'SELECT value AS cterms FROM pref WHERE prop="cterms"';
|
||||
if (($rsbas = $connbas->query($sql)))
|
||||
{
|
||||
@@ -139,7 +131,6 @@ if($parm["bid"] !== null)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($parm["dlg"])
|
||||
{
|
||||
@@ -149,7 +140,6 @@ else
|
||||
{
|
||||
$opener = "opener";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<html lang="<?php echo $session->usr_i18n; ?>">
|
||||
@@ -159,7 +149,6 @@ else
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
function checkEncoding($string, $string_encoding)
|
||||
{
|
||||
$fs = $string_encoding == 'UTF-8' ? 'UTF-32' : $string_encoding;
|
||||
@@ -169,8 +158,6 @@ function checkEncoding ( $string, $string_encoding )
|
||||
return $string === mb_convert_encoding(mb_convert_encoding($string, $fs, $ts), $ts, $fs);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function importFile($dom, $node)
|
||||
{
|
||||
global $parm;
|
||||
@@ -311,7 +298,6 @@ function importFile($dom, $node)
|
||||
return($err);
|
||||
}
|
||||
|
||||
|
||||
function no_dof($dom, $node)
|
||||
{
|
||||
global $parm;
|
||||
@@ -460,11 +446,9 @@ function no_dof($dom, $node)
|
||||
$sy->setAttribute('lng', $lng);
|
||||
|
||||
$nsy++;
|
||||
|
||||
}
|
||||
|
||||
$te->setAttribute('nextid', (string) $nsy);
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
@@ -413,7 +413,7 @@ if (count($avBases) == 0)
|
||||
<li><a id="quarantine-tab" href="/upload/uploadFeedback.php?action=get_lazaret_html"><?php echo _('Quarantaine'); ?><span id="quarantine_size">(<?php echo (int) $count; ?>)</span></a></li>
|
||||
</ul>
|
||||
<div id="manager">
|
||||
<form id="form1" action="upload.php" method="post" enctype="multipart/form-data" onsubmit="return false;" target="classic_upload">
|
||||
<form id="form1" action="upload.php" method="post" enctype="multipart/form-data" target="classic_upload">
|
||||
<div style="height:60px;margin:20px 0;">
|
||||
<div id="step1" style="cursor:pointer;xwidth:800px;height:30px;"><span id="spanButtonPlaceHolder"></span>
|
||||
<div>
|
||||
|
@@ -113,6 +113,15 @@ function do_global_action()
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
$('#form1').bind('submit', function(event){
|
||||
var classic = !!$('#step2classic').is(':visible');
|
||||
if(!classic)
|
||||
{
|
||||
event.stopPropagation();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$.each($('#status_wrapper .slider_status'),function(){
|
||||
activeSliders(this);
|
||||
});
|
||||
|
@@ -136,7 +136,7 @@ try
|
||||
|
||||
$uuid = $file_uuid->write_uuid($uuid);
|
||||
|
||||
$error_file = p4file::check_file_error($_FILES['Filedata']["tmp_name"], $sbas_id);
|
||||
$error_file = p4file::check_file_error($_FILES['Filedata']["tmp_name"], $sbas_id, $_FILES['Filedata']["name"]);
|
||||
$status_2 = status::and_operation($mask_oui,$mask_non);
|
||||
if( ($uuid !== false && !$file_uuid->is_new_in_base(phrasea::sbasFromBas($base_id))) || count($error_file) > 0)
|
||||
{
|
||||
|
Reference in New Issue
Block a user