diff --git a/lib/classes/base.class.php b/lib/classes/base.class.php index bb7662463a..15d1dfa073 100644 --- a/lib/classes/base.class.php +++ b/lib/classes/base.class.php @@ -180,6 +180,12 @@ abstract class base implements cache_cacheableInterface */ public function get_data_from_cache($option = null) { + + if($this->get_base_type() == self::DATA_BOX) + { + \cache_databox::refresh($this->id); + } + return $this->get_cache()->get($this->get_cache_key($option)); } diff --git a/lib/classes/cache/databox.class.php b/lib/classes/cache/databox.class.php index 6535e19b66..1fb40d5d08 100644 --- a/lib/classes/cache/databox.class.php +++ b/lib/classes/cache/databox.class.php @@ -33,13 +33,11 @@ class cache_databox $registry = \registry::get_instance(); - $cache_appbox = $appbox->get_cache(); - $last_update = null; try { - $last_update = $cache_appbox->get('memcached_update'); + $last_update = $appbox->get_data_from_cache('memcached_update'); } catch (\Exception $e) { @@ -51,7 +49,7 @@ class cache_databox else $last_update = new \DateTime('-10 years'); - if ($date <= $last_update || !$cache_appbox->ping()) + if ($date <= $last_update || !$appbox->get_cache()->ping()) { return; } @@ -97,10 +95,19 @@ class cache_databox $stmt = $connsbas->prepare($sql); $stmt->execute($params); $stmt->closeCursor(); + + $record = new \record_adapter($sbas_id, $row['value']); + $record->get_caption()->delete_data_from_cache(); + + foreach ($record->get_caption()->get_fields() as $field) + { + $field->delete_data_from_cache(); + } + break; case 'structure': - $cache_appbox->delete(\appbox::CACHE_LIST_BASES); - $cache_appbox->delete(\appbox::CACHE_SBAS_IDS); + $appbox->delete_data_from_cache(\appbox::CACHE_LIST_BASES); + $appbox->delete_data_from_cache(\appbox::CACHE_SBAS_IDS); $sql = 'DELETE FROM memcached WHERE site_id = :site_id AND type="structure" AND value = :value'; @@ -120,7 +127,7 @@ class cache_databox $date = new \DateTime(); $now = $date->format(DATE_ISO8601); - $cache_appbox->set('memcached_update', $now); + $appbox->set_data_to_cache($now, 'memcached_update'); $conn = \connection::getPDOConnection(); diff --git a/lib/classes/eventsmanager/notify/autoregister.class.php b/lib/classes/eventsmanager/notify/autoregister.class.php index 7e4857942f..ee54a2de17 100644 --- a/lib/classes/eventsmanager/notify/autoregister.class.php +++ b/lib/classes/eventsmanager/notify/autoregister.class.php @@ -213,7 +213,7 @@ class eventsmanager_notify_autoregister extends eventsmanager_notifyAbstract function mail($to, $from, $datas) { $subject = sprintf(_('admin::register: Inscription automatique sur %s') - , $this->registry->get('GV_homeTitle')); + , GV_homeTitle); $body = "
" . _('admin::register: un utilisateur s\'est inscrit') . "
\n"; diff --git a/lib/classes/mail.class.php b/lib/classes/mail.class.php index d70cb5f3ed..ac1137ac7f 100644 --- a/lib/classes/mail.class.php +++ b/lib/classes/mail.class.php @@ -143,8 +143,6 @@ class mail public static function mail_confirm_registered($email) { - $registry = \registry::get_instance(); - $subject = _('login::register: sujet email : confirmation de votre adresse email'); $body = "
" . _('login::register: merci d\'avoir confirme votre adresse email') . "
\n"; diff --git a/lib/classes/record/adapter.class.php b/lib/classes/record/adapter.class.php index 750570ba0d..ed49528dfd 100644 --- a/lib/classes/record/adapter.class.php +++ b/lib/classes/record/adapter.class.php @@ -1934,8 +1934,6 @@ class record_adapter implements record_Interface, cache_cacheableInterface */ public function get_data_from_cache($option = null) { - \cache_databox::refresh($this->get_sbas_id()); - $databox = $this->get_databox(); return $databox->get_data_from_cache($this->get_cache_key($option)); diff --git a/lib/classes/record/preview.class.php b/lib/classes/record/preview.class.php index 11a97a4f60..ee800f8a31 100644 --- a/lib/classes/record/preview.class.php +++ b/lib/classes/record/preview.class.php @@ -86,7 +86,7 @@ class record_preview extends record_adapter * @param boolean $reload_train * @return record_preview */ - public function __construct($env, $pos, $contId, $reload_train, searchEngine_adapter $search_engine =null, $query='') + public function __construct($env, $pos, $contId, $reload_train, searchEngine_adapter $search_engine = null, $query = '') { $appbox = appbox::get_instance(); $Core = bootstrap::getCore(); @@ -96,7 +96,7 @@ class record_preview extends record_adapter switch ($env) { case "RESULT": - $results = $search_engine->query_per_offset($query, (int) ($pos), 1); + $results = $search_engine->query_per_offset($query, (int) ($pos), 1); $mypreview = array(); if ($results->get_datas()->is_empty()) @@ -105,22 +105,22 @@ class record_preview extends record_adapter } foreach ($results->get_datas() as $record) { - $number = $pos; - $sbas_id = $record->get_sbas_id(); + $number = $pos; + $sbas_id = $record->get_sbas_id(); $record_id = $record->get_record_id(); break; } break; case "REG": - $contId = explode('_', $contId); - $sbas_id = $contId[0]; + $contId = explode('_', $contId); + $sbas_id = $contId[0]; $record_id = $contId[1]; $this->container = new record_adapter($sbas_id, $record_id); if ($pos == 0) { $number = 0; - $title = _('preview:: regroupement '); + $title = _('preview:: regroupement '); } else { @@ -128,12 +128,12 @@ class record_preview extends record_adapter $children = $this->container->get_children(); foreach ($children as $child) { - $sbas_id = $child->get_sbas_id(); + $sbas_id = $child->get_sbas_id(); $record_id = $child->get_record_id(); if ($child->get_number() == $pos) break; } - $number = $pos; + $number = $pos; $this->total = $children->get_count(); } @@ -162,7 +162,7 @@ class record_preview extends record_adapter $this->name = $Basket->getName(); $number = $element->getOrd(); } - $first = false; + $first = false; if ($element->getOrd() == $pos) { @@ -178,7 +178,7 @@ class record_preview extends record_adapter $this->container = $entry; $this->total = count($entry->get_content()); - $i = 0; + $i = 0; $first = true; foreach ($entry->get_content() as $element) @@ -186,19 +186,19 @@ class record_preview extends record_adapter $i++; if ($first) { - $sbas_id = $element->get_record()->get_sbas_id(); + $sbas_id = $element->get_record()->get_sbas_id(); $record_id = $element->get_record()->get_record_id(); $this->name = $entry->get_title(); - $number = $element->get_ord(); + $number = $element->get_ord(); } - $first = false; + $first = false; if ($element->get_ord() == $pos) { - $sbas_id = $element->get_record()->get_sbas_id(); + $sbas_id = $element->get_record()->get_sbas_id(); $record_id = $element->get_record()->get_record_id(); $this->name = $entry->get_title(); - $number = $element->get_ord(); + $number = $element->get_ord(); } } break; @@ -208,18 +208,17 @@ class record_preview extends record_adapter return $this; } - public function get_train($pos = 0, $query='', searchEngine_adapter $search_engine=null) + public function get_train($pos = 0, $query = '', searchEngine_adapter $search_engine = null) { if ($this->train) - return $this->train; switch ($this->env) { case 'RESULT': $perPage = 56; - $index = ($pos - 3) < 0 ? 0 : ($pos - 3); - $page = (int) ceil($pos / $perPage); + $index = ($pos - 3) < 0 ? 0 : ($pos - 3); + $page = (int) ceil($pos / $perPage); $results = $search_engine->query_per_offset($query, $index, $perPage); $this->train = $results->get_datas(); @@ -271,10 +270,9 @@ class record_preview extends record_adapter * * @return String */ - public function get_title($highlight = '', searchEngine_adapter $search_engine=null) + public function get_title($highlight = '', searchEngine_adapter $search_engine = null) { if ($this->title) - return $this->title; $this->title = collection::getLogo($this->get_base_id()) . ' '; @@ -284,15 +282,15 @@ class record_preview extends record_adapter case "RESULT": $this->title .= sprintf( - _('preview:: resultat numero %s '), '' . ($this->number + 1) - . ' : ' + _('preview:: resultat numero %s '), '' . ($this->number + 1) + . ' : ' ); $this->title .= parent::get_title($highlight, $search_engine); break; case "BASK": $this->title .= $this->name . ' - ' . parent::get_title($highlight, $search_engine) - . ' (' . $this->get_number() . '/' . $this->total . ') '; + . ' (' . $this->get_number() . '/' . $this->total . ') '; break; case "REG": $title = parent::get_title(); @@ -331,21 +329,20 @@ class record_preview extends record_adapter public function get_short_history() { if (!is_null($this->short_history)) - return $this->short_history; $tab = array(); - $appbox = appbox::get_instance(); - $session = $appbox->get_session(); + $appbox = appbox::get_instance(); + $session = $appbox->get_session(); $registry = $appbox->get_registry(); - $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); + $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); $report = $user->ACL()->has_right_on_base($this->get_base_id(), 'canreport'); $connsbas = connection::getPDOConnection($this->get_sbas_id()); - $sql = 'SELECT d . * , l.user, l.usrid as usr_id, l.site + $sql = 'SELECT d . * , l.user, l.usrid as usr_id, l.site FROM log_docs d, log l WHERE d.log_id = l.id AND d.record_id = :record_id '; @@ -355,14 +352,14 @@ class record_preview extends record_adapter { $sql .= ' AND ((l.usrid = :usr_id AND l.site= :site) OR action="add")'; $params[':usr_id'] = $session->get_usr_id(); - $params[':site'] = $registry->get('GV_sit'); + $params[':site'] = $registry->get('GV_sit'); } $sql .= 'ORDER BY d.date, usrid DESC'; $stmt = $connsbas->prepare($sql); $stmt->execute($params); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); + $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); foreach ($rs as $row) @@ -392,24 +389,24 @@ class record_preview extends record_adapter } catch (Exception $e) { - + } $tab[$hour][$site][$action][$row['usr_id']] = - array( - 'final' => array() - , 'comment' => array() - , 'user' => $user + array( + 'final' => array() + , 'comment' => array() + , 'user' => $user ); } if (!in_array($row['final'], $tab[$hour][$site][$action][$row['usr_id']]['final'])) $tab[$hour][$site][$action][$row['usr_id']]['final'][] = - $row['final']; + $row['final']; if (!in_array($row['comment'], $tab[$hour][$site][$action][$row['usr_id']]['comment'])) $tab[$hour][$site][$action][$row['usr_id']]['comment'][] = - $row['comment']; + $row['comment']; } $this->short_history = array_reverse($tab); @@ -424,14 +421,13 @@ class record_preview extends record_adapter public function get_view_popularity() { if (!is_null($this->view_popularity)) - return $this->view_popularity; - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(); $session = $appbox->get_session(); - $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); - $report = $user->ACL()->has_right_on_base( - $this->get_base_id(), 'canreport'); + $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); + $report = $user->ACL()->has_right_on_base( + $this->get_base_id(), 'canreport'); $registry = $appbox->get_registry(); if (!$report && !$registry->get('GV_google_api')) @@ -442,16 +438,16 @@ class record_preview extends record_adapter } $views = $dwnls = array(); - $top = 1; - $day = 30; - $min = 0; + $top = 1; + $day = 30; + $min = 0; $average = 0; while ($day >= 0) { - $datetime = new DateTime('-' . $day . ' days'); - $date = date_format($datetime, 'Y-m-d'); + $datetime = new DateTime('-' . $day . ' days'); + $date = date_format($datetime, 'Y-m-d'); $views[$date] = $dwnls[$date] = 0; $day--; } @@ -464,14 +460,14 @@ class record_preview extends record_adapter GROUP BY datee ORDER BY datee ASC'; $connsbas = connection::getPDOConnection($this->get_sbas_id()); - $stmt = $connsbas->prepare($sql); + $stmt = $connsbas->prepare($sql); $stmt->execute( - array( - ':record_id' => $this->get_record_id(), - ':site' => $registry->get('GV_sit') - ) + array( + ':record_id' => $this->get_record_id(), + ':site' => $registry->get('GV_sit') + ) ); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); + $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); foreach ($rs as $row) @@ -479,8 +475,8 @@ class record_preview extends record_adapter if (isset($views[$row['datee']])) { $views[$row['datee']] = (int) $row['views']; - $top = max((int) $row['views'], $top); - $min = isset($min) ? min($row['views'], $min) : $row['views']; + $top = max((int) $row['views'], $top); + $min = isset($min) ? min($row['views'], $min) : $row['views']; $average += $row['views']; } } @@ -488,26 +484,26 @@ class record_preview extends record_adapter $topScale = round($top * 1.2); $average = $average / 30; - $max = round(($top) * 100 / ($topScale)); - $min = round($min * 100 / ($topScale)); + $max = round(($top) * 100 / ($topScale)); + $min = round($min * 100 / ($topScale)); $average = round($average * 100 / ($topScale)); - $width = 350; + $width = 350; $height = 150; - $url = 'http://chart.apis.google.com/chart?' . - 'chs=' . $width . 'x' . $height . - '&chd=t:' . implode(',', $views) . - '&cht=lc' . - '&chf=bg,s,00000000' . - '&chxt=x,y,r' . - '&chds=0,' . $topScale . - '&chls=2.0&chxtc=2,-350' . - '&chxl=0:|' . date_format(new DateTime('-30 days'), 'd M') . '|' - . date_format(new DateTime('-15 days'), 'd M') . '|' - . date_format(new DateTime(), 'd M') . '|1:|0|' - . round($top / 2, 2) . '|' . $top - . '|2:|min|average|max' . - '&chxp=2,' . $min . ',' . $average . ',' . $max; + $url = 'http://chart.apis.google.com/chart?' . + 'chs=' . $width . 'x' . $height . + '&chd=t:' . implode(',', $views) . + '&cht=lc' . + '&chf=bg,s,00000000' . + '&chxt=x,y,r' . + '&chds=0,' . $topScale . + '&chls=2.0&chxtc=2,-350' . + '&chxl=0:|' . date_format(new DateTime('-30 days'), 'd M') . '|' + . date_format(new DateTime('-15 days'), 'd M') . '|' + . date_format(new DateTime(), 'd M') . '|1:|0|' + . round($top / 2, 2) . '|' . $top + . '|2:|min|average|max' . + '&chxp=2,' . $min . ',' . $average . ',' . $max; $this->view_popularity = new media_adapter($url, $width, $height); @@ -522,14 +518,13 @@ class record_preview extends record_adapter public function get_refferer_popularity() { if (!is_null($this->refferer_popularity)) - return $this->refferer_popularity; - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(); $session = $appbox->get_session(); - $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); - $report = $user->ACL()->has_right_on_base( - $this->get_base_id(), 'canreport'); + $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); + $report = $user->ACL()->has_right_on_base( + $this->get_base_id(), 'canreport'); $registry = $appbox->get_registry(); if (!$report && !$registry->get('GV_google_api')) @@ -549,7 +544,7 @@ class record_preview extends record_adapter $stmt = $connsbas->prepare($sql); $stmt->execute(array(':record_id' => $this->get_record_id())); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); + $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); $referrers = array(); @@ -577,24 +572,24 @@ class record_preview extends record_adapter if (strpos($row['referrer'], $registry->get('GV_ServerName') . 'permalink/') !== false) { if (strpos($row['referrer'], '/view/') !== false) - $row['referrer'] = _('report::presentation page preview'); + $row['referrer'] = _('report::presentation page preview'); else - $row['referrer'] = _('report::acces direct'); + $row['referrer'] = _('report::acces direct'); } if (!isset($referrers[$row['referrer']])) $referrers[$row['referrer']] = 0; $referrers[$row['referrer']] += (int) $row['views']; } - $width = 550; + $width = 550; $height = 100; $url = 'http://chart.apis.google.com/chart?' - . 'cht=p3&chf=bg,s,00000000&chd=t:' - . implode(',', $referrers) - . '&chs=' . $width . 'x' . $height - . '&chl=' - . urlencode(implode('|', array_keys($referrers))) . ''; + . 'cht=p3&chf=bg,s,00000000&chd=t:' + . implode(',', $referrers) + . '&chs=' . $width . 'x' . $height + . '&chl=' + . urlencode(implode('|', array_keys($referrers))) . ''; $this->refferer_popularity = new media_adapter($url, $width, $height); @@ -609,15 +604,14 @@ class record_preview extends record_adapter { if (!is_null($this->download_popularity)) - return $this->download_popularity; - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(); $session = $appbox->get_session(); - $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); + $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); $registry = $appbox->get_registry(); - $report = $user->ACL()->has_right_on_base( - $this->get_base_id(), 'canreport'); + $report = $user->ACL()->has_right_on_base( + $this->get_base_id(), 'canreport'); $ret = false; if (!$report && !$registry->get('GV_google_api')) @@ -628,16 +622,16 @@ class record_preview extends record_adapter } $views = $dwnls = array(); - $top = 1; - $day = 30; - $min = 0; + $top = 1; + $day = 30; + $min = 0; $average = 0; while ($day >= 0) { - $datetime = new DateTime('-' . $day . ' days'); - $date = date_format($datetime, 'Y-m-d'); + $datetime = new DateTime('-' . $day . ' days'); + $date = date_format($datetime, 'Y-m-d'); $views[$date] = $dwnls[$date] = 0; $day--; } @@ -652,14 +646,14 @@ class record_preview extends record_adapter GROUP BY datee ORDER BY datee ASC'; $connsbas = connection::getPDOConnection($this->get_sbas_id()); - $stmt = $connsbas->prepare($sql); + $stmt = $connsbas->prepare($sql); $stmt->execute( - array( - ':record_id' => $this->get_record_id(), - ':site' => $registry->get('GV_sit') - ) + array( + ':record_id' => $this->get_record_id(), + ':site' => $registry->get('GV_sit') + ) ); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); + $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); $top = 10; @@ -669,23 +663,23 @@ class record_preview extends record_adapter if (isset($dwnls[$row['datee']])) { $dwnls[$row['datee']] = (int) $row['dwnl']; - $top = max(((int) $row['dwnl'] + 10), $top); + $top = max(((int) $row['dwnl'] + 10), $top); } } - $width = 250; + $width = 250; $height = 150; - $url = 'http://chart.apis.google.com/chart?' . - 'chs=' . $width . 'x' . $height . - '&chd=t:' . implode(',', $dwnls) . - '&cht=lc' . - '&chf=bg,s,00000000' . - '&chxt=x,y' . - '&chds=0,' . $top . - '&chxl=0:|' . date_format(new DateTime('-30 days'), 'd M') . '|' - . date_format(new DateTime('-15 days'), 'd M') . '|' - . date_format(new DateTime(), 'd M') . '|1:|0|' - . round($top / 2) . '|' . $top . ''; + $url = 'http://chart.apis.google.com/chart?' . + 'chs=' . $width . 'x' . $height . + '&chd=t:' . implode(',', $dwnls) . + '&cht=lc' . + '&chf=bg,s,00000000' . + '&chxt=x,y' . + '&chds=0,' . $top . + '&chxl=0:|' . date_format(new DateTime('-30 days'), 'd M') . '|' + . date_format(new DateTime('-15 days'), 'd M') . '|' + . date_format(new DateTime(), 'd M') . '|1:|0|' + . round($top / 2) . '|' . $top . ''; $ret = new media_adapter($url, $width, $height); $this->download_popularity = $ret; diff --git a/lib/classes/set/export.class.php b/lib/classes/set/export.class.php index 2d736e94cb..d268e2309a 100644 --- a/lib/classes/set/export.class.php +++ b/lib/classes/set/export.class.php @@ -88,7 +88,7 @@ class set_export extends set_abstract else { $tmp_lst = explode(';', $lst); - $n = 1; + $n = 1; foreach ($tmp_lst as $basrec) { $basrec = explode('_', $basrec); @@ -108,7 +108,7 @@ class set_export extends set_abstract { foreach ($record->get_children() as $child_basrec) { - $base_id = $child_basrec->get_base_id(); + $base_id = $child_basrec->get_base_id(); $record_id = $child_basrec->get_record_id(); if (!isset($remain_hd[$base_id])) @@ -116,7 +116,7 @@ class set_export extends set_abstract if ($user->ACL()->is_restricted_download($base_id)) { $remain_hd[$base_id] = - $user->ACL()->remaining_download($base_id); + $user->ACL()->remaining_download($base_id); } else { @@ -137,7 +137,7 @@ class set_export extends set_abstract } else { - $base_id = $record->get_base_id(); + $base_id = $record->get_base_id(); $record_id = $record->get_record_id(); if (!isset($remain_hd[$base_id])) @@ -145,7 +145,7 @@ class set_export extends set_abstract if ($user->ACL()->is_restricted_download($base_id)) { $remain_hd[$base_id] = - $user->ACL()->remaining_download($base_id); + $user->ACL()->remaining_download($base_id); } else { @@ -153,13 +153,13 @@ class set_export extends set_abstract } } - $current_element = - $download_list[$basrec[0] . '_' . $basrec[1]] = - new record_exportElement( - $record->get_sbas_id(), - $record_id, - '', - $remain_hd[$base_id] + $current_element = + $download_list[$basrec[0] . '_' . $basrec[1]] = + new record_exportElement( + $record->get_sbas_id(), + $record_id, + '', + $remain_hd[$base_id] ); $remain_hd[$base_id] = $current_element->get_remain_hd(); @@ -184,10 +184,10 @@ class set_export extends set_abstract if (!isset($display_download[$name])) { $display_download[$name] = array( - 'size' => 0, - 'total' => 0, - 'available' => 0, - 'refused' => array() + 'size' => 0, + 'total' => 0, + 'available' => 0, + 'refused' => array() ); } @@ -199,12 +199,12 @@ class set_export extends set_abstract $display_download[$name]['label'] = $properties['label']; $this->total_download++; $display_download[$name]['size'] += - $download_element->get_size($name); + $download_element->get_size($name); } else { $display_download[$name]['refused'][] = - $download_element->get_thumbnail(); + $download_element->get_thumbnail(); } } foreach ($download_element->get_orderable() as $name => $properties) @@ -212,9 +212,9 @@ class set_export extends set_abstract if (!isset($display_orderable[$name])) { $display_orderable[$name] = array( - 'total' => 0, - 'available' => 0, - 'refused' => array() + 'total' => 0, + 'available' => 0, + 'refused' => array() ); } @@ -228,7 +228,7 @@ class set_export extends set_abstract else { $display_orderable[$name]['refused'][] = - $download_element->get_thumbnail(); + $download_element->get_thumbnail(); } } } @@ -241,10 +241,10 @@ class set_export extends set_abstract $display_ftp = array(); $hasadminright = $user->ACL()->has_right('addrecord') - || $user->ACL()->has_right('deleterecord') - || $user->ACL()->has_right('modifyrecord') - || $user->ACL()->has_right('coll_manage') - || $user->ACL()->has_right('coll_modify_struct'); + || $user->ACL()->has_right('deleterecord') + || $user->ACL()->has_right('modifyrecord') + || $user->ACL()->has_right('coll_manage') + || $user->ACL()->has_right('coll_modify_struct'); $this->ftp_datas = array(); @@ -257,7 +257,7 @@ class set_export extends set_abstract if ($hasadminright) { - $sql = "SELECT usr.usr_id,usr_login,usr.addrFTP,usr.loginFTP,usr.sslFTP, + $sql = "SELECT usr.usr_id,usr_login,usr.addrFTP,usr.loginFTP,usr.sslFTP, usr.pwdFTP,usr.destFTP,prefixFTPfolder,usr.passifFTP, usr.retryFTP,usr.usr_mail FROM (usr INNER JOIN basusr @@ -273,7 +273,7 @@ class set_export extends set_abstract } elseif ($registry->get('GV_ftp_for_user')) { - $sql = "SELECT usr.usr_id,usr_login,usr.addrFTP,usr.loginFTP,usr.sslFTP, + $sql = "SELECT usr.usr_id,usr_login,usr.addrFTP,usr.loginFTP,usr.sslFTP, usr.pwdFTP,usr.destFTP,prefixFTPfolder, usr.passifFTP,usr.retryFTP,usr.usr_mail FROM (usr INNER JOIN basusr @@ -289,43 +289,43 @@ class set_export extends set_abstract } $datas[] = array( - 'name' => _('export::ftp: reglages manuels'), - 'usr_id' => '0', - 'addrFTP' => '', - 'loginFTP' => '', - 'pwdFTP' => '', - 'ssl' => '0', - 'destFTP' => '', - 'prefixFTPfolder' => 'Export_' . date("Y-m-d_H.i.s"), - 'passifFTP' => false, - 'retryFTP' => 5, - 'mailFTP' => '', - 'sendermail' => $user->get_email() + 'name' => _('export::ftp: reglages manuels'), + 'usr_id' => '0', + 'addrFTP' => '', + 'loginFTP' => '', + 'pwdFTP' => '', + 'ssl' => '0', + 'destFTP' => '', + 'prefixFTPfolder' => 'Export_' . date("Y-m-d_H.i.s"), + 'passifFTP' => false, + 'retryFTP' => 5, + 'mailFTP' => '', + 'sendermail' => $user->get_email() ); $stmt = $appbox->get_connection()->prepare($sql); $stmt->execute($params); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); + $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); foreach ($rs as $row) { $datas[] = array( - 'name' => $row["usr_login"], - 'usr_id' => $row['usr_id'], - 'addrFTP' => $row['addrFTP'], - 'loginFTP' => $row['loginFTP'], - 'pwdFTP' => $row['pwdFTP'], - 'ssl' => $row['sslFTP'], - 'destFTP' => $row['destFTP'], - 'prefixFTPfolder' => - (strlen(trim($row['prefixFTPfolder'])) > 0 ? - trim($row['prefixFTPfolder']) : - 'Export_' . date("Y-m-d_H.i.s")), - 'passifFTP' => ($row['passifFTP'] > 0), - 'retryFTP' => $row['retryFTP'], - 'mailFTP' => $row['usr_mail'], - 'sendermail' => $user->get_email() + 'name' => $row["usr_login"], + 'usr_id' => $row['usr_id'], + 'addrFTP' => $row['addrFTP'], + 'loginFTP' => $row['loginFTP'], + 'pwdFTP' => $row['pwdFTP'], + 'ssl' => $row['sslFTP'], + 'destFTP' => $row['destFTP'], + 'prefixFTPfolder' => + (strlen(trim($row['prefixFTPfolder'])) > 0 ? + trim($row['prefixFTPfolder']) : + 'Export_' . date("Y-m-d_H.i.s")), + 'passifFTP' => ($row['passifFTP'] > 0), + 'retryFTP' => $row['retryFTP'], + 'mailFTP' => $row['usr_mail'], + 'sendermail' => $user->get_email() ); } @@ -415,8 +415,8 @@ class set_export extends set_abstract { throw new Exception('No subdefs given'); } - $appbox = appbox::get_instance(); - $session = $appbox->get_session(); + $appbox = appbox::get_instance(); + $session = $appbox->get_session(); $registry = $appbox->get_registry(); $unicode = new unicode(); @@ -435,11 +435,11 @@ class set_export extends set_abstract $id = count($files); $files[$id] = array( - 'base_id' => $download_element->get_base_id(), - 'record_id' => $download_element->get_record_id(), - 'original_name' => '', - 'export_name' => '', - 'subdefs' => array() + 'base_id' => $download_element->get_base_id(), + 'record_id' => $download_element->get_record_id(), + 'original_name' => '', + 'export_name' => '', + 'subdefs' => array() ); $sbas_id = phrasea::sbasFromBas($download_element->get_base_id()); @@ -449,12 +449,12 @@ class set_export extends set_abstract $desc = $download_element->get_xml(); $files[$id]['original_name'] = - $files[$id]['export_name'] = - $download_element->get_original_name(); + $files[$id]['export_name'] = + $download_element->get_original_name(); $files[$id]['original_name'] = - trim($files[$id]['original_name']) != '' ? - $files[$id]['original_name'] : $id; + trim($files[$id]['original_name']) != '' ? + $files[$id]['original_name'] : $id; $infos = pathinfo($files[$id]['original_name']); @@ -466,7 +466,7 @@ class set_export extends set_abstract $title = strip_tags($download_element->get_title()); $files[$id]['export_name'] = $unicode->remove_nonazAZ09($title, true); - $rename_done = true; + $rename_done = true; } else { @@ -474,7 +474,7 @@ class set_export extends set_abstract } $sizeMaxAjout = 0; - $sizeMaxExt = 0; + $sizeMaxExt = 0; $sd = $download_element->get_subdefs(); @@ -490,7 +490,7 @@ class set_export extends set_abstract } set_time_limit(100); - $subdef_export = $subdef_alive = false; + $subdef_export = $subdef_alive = false; $n_files++; @@ -501,32 +501,32 @@ class set_export extends set_abstract case 'caption': case 'caption-yaml': $subdef_export = true; - $subdef_alive = true; + $subdef_alive = true; break; case 'thumbnail': - $tmp_pathfile = array( - 'path' => $sd[$name]->get_path() - , 'file' => $sd[$name]->get_file() + $tmp_pathfile = array( + 'path' => $sd[$name]->get_path() + , 'file' => $sd[$name]->get_file() ); $subdef_export = true; - $subdef_alive = true; + $subdef_alive = true; break; case 'document': $subdef_export = true; - $path = recordutils_image::stamp( - $download_element->get_base_id() - , $download_element->get_record_id() - , true + $path = recordutils_image::stamp( + $download_element->get_base_id() + , $download_element->get_record_id() + , true ); - $tmp_pathfile = array( - 'path' => $sd[$name]->get_path() - , 'file' => $sd[$name]->get_file() + $tmp_pathfile = array( + 'path' => $sd[$name]->get_path() + , 'file' => $sd[$name]->get_file() ); if (file_exists($path)) { $tmp_pathfile = array( - 'path' => dirname($path) - , 'file' => basename($path) + 'path' => dirname($path) + , 'file' => basename($path) ); $subdef_alive = true; } @@ -536,24 +536,24 @@ class set_export extends set_abstract $subdef_export = true; $tmp_pathfile = array( - 'path' => $sd[$name]->get_path() - , 'file' => $sd[$name]->get_file() + 'path' => $sd[$name]->get_path() + , 'file' => $sd[$name]->get_file() ); if (!$user->ACL()->has_right_on_base( - $download_element->get_base_id() - , "nowatermark" - ) - && $sd[$name]->get_type() == media_subdef::TYPE_IMAGE) + $download_element->get_base_id() + , "nowatermark" + ) + && $sd[$name]->get_type() == media_subdef::TYPE_IMAGE) { $path = recordutils_image::watermark( - $download_element->get_base_id() - , $download_element->get_record_id() + $download_element->get_base_id() + , $download_element->get_record_id() ); if (file_exists($path)) { $tmp_pathfile = array( - 'path' => dirname($path) - , 'file' => basename($path) + 'path' => dirname($path) + , 'file' => basename($path) ); $subdef_alive = true; } @@ -572,44 +572,44 @@ class set_export extends set_abstract case 'caption': if ($name == 'caption-yaml') { - $suffix = '_captionyaml'; + $suffix = '_captionyaml'; $extension = 'yml'; - $mime = 'text/x-yaml'; + $mime = 'text/x-yaml'; } else { - $suffix = '_caption'; + $suffix = '_caption'; $extension = 'xml'; - $mime = 'text/xml'; + $mime = 'text/xml'; } - $files[$id]["subdefs"][$name]["ajout"] = $suffix; + $files[$id]["subdefs"][$name]["ajout"] = $suffix; $files[$id]["subdefs"][$name]["exportExt"] = $extension; - $files[$id]["subdefs"][$name]["label"] = $properties['label']; - $files[$id]["subdefs"][$name]["path"] = null; - $files[$id]["subdefs"][$name]["file"] = null; - $files[$id]["subdefs"][$name]["size"] = 0; - $files[$id]["subdefs"][$name]["folder"] = $download_element->get_directory(); - $files[$id]["subdefs"][$name]["mime"] = $mime; + $files[$id]["subdefs"][$name]["label"] = $properties['label']; + $files[$id]["subdefs"][$name]["path"] = null; + $files[$id]["subdefs"][$name]["file"] = null; + $files[$id]["subdefs"][$name]["size"] = 0; + $files[$id]["subdefs"][$name]["folder"] = $download_element->get_directory(); + $files[$id]["subdefs"][$name]["mime"] = $mime; break; case 'document': case 'preview': case 'thumbnail': $infos = pathinfo(p4string::addEndSlash($tmp_pathfile["path"]) . - $tmp_pathfile["file"]); + $tmp_pathfile["file"]); - $files[$id]["subdefs"][$name]["ajout"] = - $properties['class'] == 'document' ? '' : "_" . $name; - $files[$id]["subdefs"][$name]["path"] = $tmp_pathfile["path"]; - $files[$id]["subdefs"][$name]["file"] = $tmp_pathfile["file"]; - $files[$id]["subdefs"][$name]["label"] = $properties['label']; - $files[$id]["subdefs"][$name]["size"] = $sd[$name]->get_size(); - $files[$id]["subdefs"][$name]["mime"] = $sd[$name]->get_mime(); - $files[$id]["subdefs"][$name]["folder"] = - $download_element->get_directory(); + $files[$id]["subdefs"][$name]["ajout"] = + $properties['class'] == 'document' ? '' : "_" . $name; + $files[$id]["subdefs"][$name]["path"] = $tmp_pathfile["path"]; + $files[$id]["subdefs"][$name]["file"] = $tmp_pathfile["file"]; + $files[$id]["subdefs"][$name]["label"] = $properties['label']; + $files[$id]["subdefs"][$name]["size"] = $sd[$name]->get_size(); + $files[$id]["subdefs"][$name]["mime"] = $sd[$name]->get_mime(); + $files[$id]["subdefs"][$name]["folder"] = + $download_element->get_directory(); $files[$id]["subdefs"][$name]["exportExt"] = - isset($infos['extension']) ? $infos['extension'] : ''; + isset($infos['extension']) ? $infos['extension'] : ''; $size += $sd[$name]->get_size(); @@ -617,12 +617,12 @@ class set_export extends set_abstract } $longueurAjoutCourant = - mb_strlen($files[$id]["subdefs"][$name]["ajout"]); - $sizeMaxAjout = max($longueurAjoutCourant, $sizeMaxAjout); + mb_strlen($files[$id]["subdefs"][$name]["ajout"]); + $sizeMaxAjout = max($longueurAjoutCourant, $sizeMaxAjout); $longueurExtCourant = - mb_strlen($files[$id]["subdefs"][$name]["exportExt"]); - $sizeMaxExt = max($longueurExtCourant, $sizeMaxExt); + mb_strlen($files[$id]["subdefs"][$name]["exportExt"]); + $sizeMaxExt = max($longueurExtCourant, $sizeMaxExt); } } @@ -632,34 +632,34 @@ class set_export extends set_abstract $start_length = mb_strlen($name); if ($start_length > $max_length) - $name = mb_substr($name, 0, $max_length); + $name = mb_substr($name, 0, $max_length); $n = 1; while (in_array(mb_strtolower($name), $file_names)) { $n++; - $suffix = "-" . $n; // pour diese si besoin - $max_length = 31 - $sizeMaxExt - $sizeMaxAjout - mb_strlen($suffix); - $name = mb_strtolower($files[$id]["export_name"]); + $suffix = "-" . $n; // pour diese si besoin + $max_length = 31 - $sizeMaxExt - $sizeMaxAjout - mb_strlen($suffix); + $name = mb_strtolower($files[$id]["export_name"]); if ($start_length > $max_length) - $name = mb_substr($name, 0, $max_length) . $suffix; + $name = mb_substr($name, 0, $max_length) . $suffix; else - $name = $name . $suffix; + $name = $name . $suffix; } - $file_names[] = mb_strtolower($name); + $file_names[] = mb_strtolower($name); $files[$id]["export_name"] = $name; - $files[$id]["export_name"] = $unicode->remove_nonazAZ09($files[$id]["export_name"]); + $files[$id]["export_name"] = $unicode->remove_nonazAZ09($files[$id]["export_name"]); $files[$id]["original_name"] = $unicode->remove_nonazAZ09($files[$id]["original_name"]); - $i = 0; - $name = utf8_decode($files[$id]["export_name"]); - $tmp_name = ""; + $i = 0; + $name = utf8_decode($files[$id]["export_name"]); + $tmp_name = ""; $good_keys = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', - 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', - 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', - '4', '5', '6', '7', '8', '9', '-', '_', '.', '#'); + 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', + 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', + '4', '5', '6', '7', '8', '9', '-', '_', '.', '#'); while (isset($name[$i])) { @@ -677,19 +677,19 @@ class set_export extends set_abstract if (in_array('caption', $subdefs)) { $caption_dir = $registry->get('GV_RootPath') . 'tmp/desc_tmp/' - . time() . $session->get_usr_id() - . $session->get_ses_id() . '/'; + . time() . $session->get_usr_id() + . $session->get_ses_id() . '/'; system_file::mkdir($caption_dir); $desc = self::get_caption( - $download_element->get_base_id() - , $download_element->get_record_id() + $download_element->get_base_id() + , $download_element->get_record_id() ); $file = $files[$id]["export_name"] - . $files[$id]["subdefs"]['caption']["ajout"] . '.' - . $files[$id]["subdefs"]['caption']["exportExt"]; + . $files[$id]["subdefs"]['caption']["ajout"] . '.' + . $files[$id]["subdefs"]['caption']["exportExt"]; $path = $caption_dir; @@ -705,22 +705,22 @@ class set_export extends set_abstract if (in_array('caption-yaml', $subdefs)) { $caption_dir = $registry->get('GV_RootPath') . 'tmp/desc_tmp/' - . time() . $session->get_usr_id() - . $session->get_ses_id() . '/'; + . time() . $session->get_usr_id() + . $session->get_ses_id() . '/'; system_file::mkdir($caption_dir); $desc = self::get_caption( - $download_element->get_base_id() - , $download_element->get_record_id() - , true - , 'yaml' + $download_element->get_base_id() + , $download_element->get_record_id() + , true + , 'yaml' ); $file = $files[$id]["export_name"] - . $files[$id]["subdefs"]['caption-yaml']["ajout"] . '.' - . $files[$id]["subdefs"]['caption-yaml']["exportExt"]; + . $files[$id]["subdefs"]['caption-yaml']["ajout"] . '.' + . $files[$id]["subdefs"]['caption-yaml']["exportExt"]; $path = $caption_dir; @@ -736,10 +736,10 @@ class set_export extends set_abstract } $this->list = array( - 'files' => $files, - 'names' => $file_names, - 'size' => $size, - 'count' => $n_files + 'files' => $files, + 'names' => $file_names, + 'size' => $size, + 'count' => $n_files ); @@ -762,7 +762,6 @@ class set_export extends set_abstract return false; } if (isset($list['complete']) && $list['complete'] === true) - return; @@ -774,13 +773,13 @@ class set_export extends set_abstract random::updateToken($token, serialize($list)); $str_in = array("à", "á", "â", "ã", "ä", "å", "ç", "è", "é", "ê", - "ë", "ì", "í", "î", "ï", "ð", "ñ", "ò", "ó", "ô", - "õ", "ö", "ù", "ú", "û", "ü", "ý", "ÿ"); + "ë", "ì", "í", "î", "ï", "ð", "ñ", "ò", "ó", "ô", + "õ", "ö", "ù", "ú", "û", "ü", "ý", "ÿ"); $str_out = array("a", "a", "a", "a", "a", "a", "c", "e", "e", "e", - "e", "i", "i", "i", "i", "o", "n", "o", "o", "o", - "o", "o", "u", "u", "u", "u", "y", "y"); + "e", "i", "i", "i", "i", "o", "n", "o", "o", "o", + "o", "o", "u", "u", "u", "u", "y", "y"); - $caption_dirs = $unlinks = array(); + $caption_dirs = $unlinks = array(); foreach ($files as $record) { @@ -792,9 +791,9 @@ class set_export extends set_abstract if (is_file($path)) { $name = $obj["folder"] - . $record["export_name"] - . $obj["ajout"] - . '.' . $obj["exportExt"]; + . $record["export_name"] + . $obj["ajout"] + . '.' . $obj["exportExt"]; $name = str_replace($str_in, $str_out, $name); @@ -804,7 +803,7 @@ class set_export extends set_abstract { if (!in_array(dirname($path), $caption_dirs)) $caption_dirs[] = dirname($path); - $unlinks[] = $path; + $unlinks[] = $path; } } } @@ -847,7 +846,7 @@ class set_export extends set_abstract $dom->encoding = 'UTF-8'; $dom_record = $dom->createElement('record'); - $dom_desc = $dom->createElement('description'); + $dom_desc = $dom->createElement('description'); $dom_record->appendChild($dom_desc); $dom->appendChild($dom_record); @@ -855,19 +854,19 @@ class set_export extends set_abstract $restrict = array(); $sbas_id = phrasea::sbasFromBas($bas); - $record = new record_adapter($sbas_id, $rec); - $desc = $record->get_xml(); - $appbox = appbox::get_instance(); + $record = new record_adapter($sbas_id, $rec); + $desc = $record->get_xml(); + $appbox = appbox::get_instance(); $session = $appbox->get_session(); $databox = databox::get_instance($sbas_id); - $struct = $databox->get_structure(); + $struct = $databox->get_structure(); $rights = true; if ($check_rights && $session->is_authenticated()) { - $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); + $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); $rights = $user->ACL()->has_right_on_base($bas, 'canmodifrecord'); if ($rights == false) @@ -880,7 +879,7 @@ class set_export extends set_abstract foreach ($z[0] as $ki => $vi) { if (isset($vi["export"]) - && ($vi["export"] == "0" || $vi["export"] == "off")) + && ($vi["export"] == "0" || $vi["export"] == "off")) $restrict[$ki] = true; } } @@ -890,36 +889,27 @@ class set_export extends set_abstract $buffer = array(); - if ($sxe = simplexml_load_string($desc)) + foreach ($record->get_caption()->get_fields() as $field) { - $z = $sxe->xpath('/record/description'); - if ($z && is_array($z)) + if (($rights || !isset($restrict[$field->get_name()]))) { - foreach ($z[0] as $ki => $vi) + switch ($format) { - if (($rights || !isset($restrict[$ki]))) - { + case 'yaml': + case 'yml': + $vi = $field->get_value(); + if (ctype_digit($vi)) + $vi = (int) $vi; - switch ($format) - { - case 'yaml': - case 'yml': - - $vi = trim($vi); - if (ctype_digit($vi)) - $vi = (int) $vi; - - $buffer[trim($ki)] = $vi; - break; - case 'xml': - default: - $dom_el = $dom->createElement($ki); - $dom_el->appendChild($dom->createTextNode(trim($vi))); - $dom_desc->appendChild($dom_el); - break; - } - } + $buffer[$field->get_name()] = $vi; + break; + case 'xml': + default: + $dom_el = $dom->createElement($field->get_name()); + $dom_el->appendChild($dom->createTextNode($field->get_value(true))); + $dom_desc->appendChild($dom_el); + break; } } } @@ -959,7 +949,7 @@ class set_export extends set_abstract $registry = registry::get_instance(); $disposition = in_array($disposition, array('inline', 'attachment')) ? - $disposition : 'attachment'; + $disposition : 'attachment'; $response = new Symfony\Component\HttpFoundation\Response(); @@ -969,17 +959,17 @@ class set_export extends set_abstract if ($registry->get('GV_modxsendfile') && strpos($file, $registry->get('GV_X_Accel_Redirect')) !== false) { $file_xaccel = str_replace( - array( - $registry->get('GV_X_Accel_Redirect'), - $registry->get('GV_RootPath') . 'tmp/download/', - $registry->get('GV_RootPath') . 'tmp/lazaret/' - ) - , array( - '/' . $registry->get('GV_X_Accel_Redirect_mount_point') . '/', - '/download/', - '/lazaret/' - ) - , $file + array( + $registry->get('GV_X_Accel_Redirect'), + $registry->get('GV_RootPath') . 'tmp/download/', + $registry->get('GV_RootPath') . 'tmp/lazaret/' + ) + , array( + '/' . $registry->get('GV_X_Accel_Redirect_mount_point') . '/', + '/download/', + '/lazaret/' + ) + , $file ); $response->headers->set('X-Sendfile', $file); $response->headers->set('X-Accel-Redirect', $file_xaccel); @@ -1040,7 +1030,7 @@ class set_export extends set_abstract header("Content-Length: " . strlen($data)); header("Cache-Control: max-age=3600, must-revalidate "); header("Content-Disposition: " . $disposition - . "; filename=" . $exportname . ";"); + . "; filename=" . $exportname . ";"); echo $data; @@ -1058,12 +1048,12 @@ class set_export extends set_abstract public static function log_download(Array $list, $type, $anonymous = false, $comment = '') { //download - $appbox = appbox::get_instance(); + $appbox = appbox::get_instance(); $session = $appbox->get_session(); - $user = false; + $user = false; if ($anonymous) { - + } else { @@ -1074,8 +1064,8 @@ class set_export extends set_abstract $files = $list['files']; $event_names = array( - 'mail-export' => Session_Logger::EVENT_EXPORTMAIL, - 'download' => Session_Logger::EVENT_EXPORTDOWNLOAD + 'mail-export' => Session_Logger::EVENT_EXPORTMAIL, + 'download' => Session_Logger::EVENT_EXPORTDOWNLOAD ); $event_name = isset($event_names[$type]) ? $event_names[$type] : Session_Logger::EVENT_EXPORTDOWNLOAD; @@ -1084,18 +1074,18 @@ class set_export extends set_abstract { foreach ($record["subdefs"] as $o => $obj) { - $sbas_id = phrasea::sbasFromBas($record['base_id']); + $sbas_id = phrasea::sbasFromBas($record['base_id']); $record_object = new record_adapter($sbas_id, $record['record_id']); $session->get_logger($record_object->get_databox()) - ->log($record_object, $event_name, $o, $comment); + ->log($record_object, $event_name, $o, $comment); if ($o != "caption") { - $log["rid"] = $record_object->get_record_id(); - $log["subdef"] = $o; - $log["poids"] = $obj["size"]; - $log["shortXml"] = $record_object->get_xml(); + $log["rid"] = $record_object->get_record_id(); + $log["subdef"] = $o; + $log["poids"] = $obj["size"]; + $log["shortXml"] = $record_object->get_xml(); $tmplog[$record_object->get_base_id()][] = $log; if (!$anonymous && $o == 'document') $user->ACL()->remove_remaining($record_object->get_base_id()); @@ -1106,9 +1096,9 @@ class set_export extends set_abstract } $export_types = array( - 'download' => 0, - 'mail-export' => 2, - 'ftp' => 4 + 'download' => 0, + 'mail-export' => 2, + 'ftp' => 4 ); $list_base = array_unique(array_keys($tmplog)); @@ -1126,9 +1116,9 @@ class set_export extends set_abstract if ($user->ACL()->is_restricted_download($base_id)) { $params = array( - ':remain_dl' => $user->ACL()->remaining_download($base_id) - , ':base_id' => $base_id - , ':usr_id' => $user->get_id() + ':remain_dl' => $user->ACL()->remaining_download($base_id) + , ':base_id' => $base_id + , ':usr_id' => $user->get_id() ); $stmt->execute($params); diff --git a/www/login/authenticate.php b/www/login/authenticate.php index 900d32e53b..15ed7c1555 100644 --- a/www/login/authenticate.php +++ b/www/login/authenticate.php @@ -112,7 +112,7 @@ if ((!is_null($parm['login']) && !is_null($parm['pwd'])) || $is_guest) return phrasea::redirect($url); } - catch (Exception $e) + catch (\Exception $e) { return phrasea::redirect("/login/?redirect=" . $parm['redirect'] . "&error=".$e->getMessage().$e->getFile().$e->getLine() ); } @@ -140,4 +140,3 @@ else { return phrasea::redirect("/login/"); } -?>