}
}
+ public static function SNCFCodes() {
+ //commonDroits::min(1);
+ global $core;
+ $res = commonPage::barre();
+ $res .= commonPage::tMain();
+ $res .= commonPage::bh();
+ $res .= '<form action="' . SITE_PATH . 'tools/makeSNCFCodes" method="post" class="notajax" enctype="multipart/form-data">';
+ $res .= '<table class="liste">';
+ $res .= '<tr><th colspan="2"><strong>' . __('Générer dictionnaires de liens pour fluidbook SNCF') . '</strong></th></tr>';
+ $res .= '<tr><td>' . __("Email") . '</td><td><input type="file" name="file" /></td></tr>';
+ $res .= '<tr><td class="right" colspan="2"><a href="#" class="submit">' . $core->typo->BoutonOK(__('Générer les dictionnaires')) . '</a></td></td>';
+ $res .= '</table>';
+ $res .= '</form>';
+ $res .= commonPage::bf();
+
+ $res .= commonPage::bMain();
+ return $res;
+ $res .= commonPage::bMain();
+ return $res;
+ }
+
+ public static function makeSNCFCodes() {
+ $list = explode("\n", file_get_contents($_FILES['file']['tmp_name']));
+ $labels = [];
+ $links = [];
+
+ foreach ($list as $item) {
+ $item = trim($item);
+ if ($item == '') {
+ continue;
+ }
+ $labels[] = ['word' => $item, 'action' => ['type' => 'definelabel', 'action' => $item]];
+ $links[] = ['word' => $item, 'action' => ['type' => 'gotolabel', 'action' => $item]];
+ }
+
+ ob_end_clean();
+
+ header('Content-type: application/zip');
+ header('Content-Disposition: attachment; filename="sncf.zip"');
+
+ $zip = new ZipArchive();
+ $zip->open('/tmp/sncf', ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE);
+ $zip->addFromString('labels.ald', self::_listToALD($labels));
+ $zip->addFromString('links.ald', self::_listToALD($links));
+ $zip->close();
+
+ echo file_get_contents('/tmp/sncf');
+
+ exit;
+ }
+
+ public static function _listToALD($list) {
+ $res = '<</Link [/c << /Desc [/t (AutoBookmark Link Dictionary File)]
+ /Entries [/c << ';
+ foreach ($list as $k => $item) {
+ $res .= '/' . $k . ' [/c << /code [/t (' . self::_actionToALDCode($item['action']) . ')]
+ /word [/t (' . addcslashes($item['word'], "\\") . ')]
+>>]
+ ';
+ }
+
+
+ $res .= '
+>>]
+ /Name [/t (Dictionary)]
+>>]
+>>';
+
+ return $res;
+ }
+
+ public static function _actionToALDCode($action) {
+ if ($action['type'] == 'gotolabel') {
+ return '@' . $action['action'];
+ } elseif ($action['type'] == 'uri') {
+ return 'uri:' . $action['action'];
+ } else if ($action['type'] == 'definelabel') {
+ return 'uri:pagelabel:' . $action['action'];
+ } else if ($action['type'] == 'page') {
+ return $action['action'] . ',InheritZoom';
+ }
+ }
+
public static function proxy() {
ob_end_clean();
echo file_get_contents($_GET['url']);
$this->fields['tooltipTimer'] = array('type' => 'float', 'default' => 3, "editable" => true, 'label' => __("Temps maximum d'apparition des infos-bulles (en secondes)"));
$this->forms['general'] = array('label' => __('Fonctionnalités générales'),
- 'fieldsnames' => array('navOrder', 'tooltipTimer','preload', 'pages', 'width', 'height'));
+ 'fieldsnames' => array('navOrder', 'tooltipTimer', 'preload', 'pages', 'width', 'height'));
//.
//
$this->fields['secureURL'] = array('type' => 'text', 'default' => 'http://', 'editable' => true, 'label' => __('URL de sécurisation'), 'grade' => 5, 'hint' => __('URL intérrogé pour vérifier si le visiteur à les droits pour consulter la publication'));
$this->fields['secureURLRedirect'] = array('type' => 'text', 'default' => 'http://', 'editable' => true, 'label' => __('Redirection'), 'grade' => 5, 'hint' => __("Si l'authentification échoue, redirection vers cette adresse"));
+ $this->fields['preventRightClick'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __("Essayer d'empêcher le clic droit"), 'grade' => 1);
$this->forms['secure'] = array('label' => __('Sécurisation'),
- 'fieldsnames' => array('secureURL', 'secureURLRedirect'));
+ 'fieldsnames' => array('secureURL', 'secureURLRedirect', '|', 'preventRightClick'));
$this->fields['seoVersion'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Générer une version pour les moteurs de recherche'));
$this->fields['seoRobots'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Autoriser le parcours par les moteurs de recherche'));