web/common.php
author Nicolas Sauret <nicolas.sauret@iri.centrepompidou.fr>
Thu, 18 Jun 2015 12:53:43 +0200
changeset 1285 3b97a346ac6c
parent 1278 7b0d5d59c721
parent 1280 b92c979e8667
child 1288 1763d0a21003
permissions -rwxr-xr-x
Fusion
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
4eba9c11703f first import
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
     1
<?php
4eba9c11703f first import
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
     2
4eba9c11703f first import
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
     3
/**
4eba9c11703f first import
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
     4
 * If you haven't edited php.ini to add the Zend Framework and the
4eba9c11703f first import
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
     5
 * Zend Framework Incubator to the PHP include_path, then do so here.
4eba9c11703f first import
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
     6
 * Don't use mine!
4eba9c11703f first import
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
     7
 */
4eba9c11703f first import
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
     8
set_include_path(
99
6cb4d10f0b8b NEW WEBSITE WITH : HOME / ABOUT / CLIENT.PHP
Samuel Huron <samuel.huron@centrepompidou.fr>
parents:
diff changeset
     9
    'lib'
0
4eba9c11703f first import
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    10
    . PATH_SEPARATOR . get_include_path()
4eba9c11703f first import
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    11
);
4eba9c11703f first import
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    12
233
10d6fd6ce9ab - put all in a registry
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 229
diff changeset
    13
/**
10d6fd6ce9ab - put all in a registry
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 229
diff changeset
    14
* Base configuration
10d6fd6ce9ab - put all in a registry
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 229
diff changeset
    15
*/
988
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
    16
date_default_timezone_set('UTC');
683
cd315f8c70e8 Put Platform URL in common.php. This allows me to access projects on local computer.
Raphael Velt <raph.velt@gmail.com>
parents: 659
diff changeset
    17
cd315f8c70e8 Put Platform URL in common.php. This allows me to access projects on local computer.
Raphael Velt <raph.velt@gmail.com>
parents: 659
diff changeset
    18
$project_url_base = 'ldtplatform/ldt/cljson/id/';
cd315f8c70e8 Put Platform URL in common.php. This allows me to access projects on local computer.
Raphael Velt <raph.velt@gmail.com>
parents: 659
diff changeset
    19
1278
7b0d5d59c721 update edito#6
Nicolas Sauret <nicolas.sauret@iri.centrepompidou.fr>
parents: 1274
diff changeset
    20
$C_default_rep = 'edito-1415-06-atelier-etudes';
287
3efe34a87c37 correct feedback url
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 286
diff changeset
    21
$C_feedback_form_url = 'https://spreadsheets.google.com/spreadsheet/viewform?hl=en_US&formkey=dDZILVdXVHRzd0xhWGVZXzkweHN2RGc6MQ#gid=0';
988
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
    22
$C_event_props = __DIR__ . "/event_props";
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
    23
$C_event_users = array('polemictweet' => 'polemictweet'.date('Y/m/d'));
233
10d6fd6ce9ab - put all in a registry
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 229
diff changeset
    24
994
053de9a4e738 adapt for 5.3.2
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 989
diff changeset
    25
$C_openssl_cipher_iv_length = 16; //openssl_cipher_iv_length('aes256')
053de9a4e738 adapt for 5.3.2
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 989
diff changeset
    26
294
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
    27
$archives_list = array(
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
    28
    "rsln", "rsln-opendata", "rsln-mercedes-bunz",
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
    29
    "enmi2011-technologie-confiance", "CPV", array("fens_FabLab_Design_Metadata","fablab"),
294
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
    30
array("fens_FabLab_Design_Metadata","designmd"), array("mashup","conference"), array("mashup","tableronde"),
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
    31
    "sig-chi-paris-2011", "rwd-meetup-patrimoine", "2011-2012-museo-ouverture"/*, "JaneMcGonigal-gameDesign"*/,
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
    32
    "iii-catastrophe", "edito-inaugurale", "enmi2011", "2011-2012-museo-structured-data",
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
    33
    "edito-webdoc","edito-intelligence", "2011-2012-museo-contribution",
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
    34
    "2011-2012-museo-ingenierie", "edito-serious-games", "enmi2012-seminaire-1", "2011-2012-museo-audiovisuel", "edito-reseaux-sociaux",
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
    35
    "edito-arts-numeriques",
659
44c5c0a2b6d4 Added FENS events
Raphael Velt <raph.velt@gmail.com>
parents: 656
diff changeset
    36
    'fens2012-gamestudies',
44c5c0a2b6d4 Added FENS events
Raphael Velt <raph.velt@gmail.com>
parents: 656
diff changeset
    37
    'fens2012-designmetadata',
44c5c0a2b6d4 Added FENS events
Raphael Velt <raph.velt@gmail.com>
parents: 656
diff changeset
    38
    'fens2012-museo-culture-opendata',
44c5c0a2b6d4 Added FENS events
Raphael Velt <raph.velt@gmail.com>
parents: 656
diff changeset
    39
    'fens2012-vinyl-numerique',
44c5c0a2b6d4 Added FENS events
Raphael Velt <raph.velt@gmail.com>
parents: 656
diff changeset
    40
    'fens2012-edito-datajournalisme',
770
25c156d00de6 Next event is BPI Doudou
Raphael Velt <raph.velt@gmail.com>
parents: 768
diff changeset
    41
    'fens2012-wiid',
938
db42d0bc2e19 Added video for Design Meta Data
Raphael Velt <raph.velt@gmail.com>
parents: 918
diff changeset
    42
    'museo-1213-01-inaugurale', 'edito-1213-01-contextes',
db42d0bc2e19 Added video for Design Meta Data
Raphael Velt <raph.velt@gmail.com>
parents: 918
diff changeset
    43
    'museo-1213-02-vecteurs-numerique', 'edito-1213-02-collectifs-auteurs',
db42d0bc2e19 Added video for Design Meta Data
Raphael Velt <raph.velt@gmail.com>
parents: 918
diff changeset
    44
    "enmi12", "bpidoudou", 'museo-1213-03-techniques-humanites', 'museo-1213-04-web-ingenierie-philosophie',
db42d0bc2e19 Added video for Design Meta Data
Raphael Velt <raph.velt@gmail.com>
parents: 918
diff changeset
    45
    'edito-1213-04-lire-ecrire', 'eduinov-2013',
db42d0bc2e19 Added video for Design Meta Data
Raphael Velt <raph.velt@gmail.com>
parents: 918
diff changeset
    46
    'edito-1213-05-supports-ecriture', 'edito-1213-06-modeles-economiques',
db42d0bc2e19 Added video for Design Meta Data
Raphael Velt <raph.velt@gmail.com>
parents: 918
diff changeset
    47
    'museo-1213-07-quels-outils-pour-apprendre', 'edito-1213-07-lecteur-auteur-droits',
1055
e5e01f4dfb3f add body-image-media event
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1053
diff changeset
    48
    'fens2013-design-metadata',
1038
c1597d3fe210 add museo 2014-01
Thibaut Cavalié <thibaut.cavalie@iri.centrepompidou.fr>
parents: 1033
diff changeset
    49
    'fens2013-museo-cultural-data',
c1597d3fe210 add museo 2014-01
Thibaut Cavalié <thibaut.cavalie@iri.centrepompidou.fr>
parents: 1033
diff changeset
    50
    'fens2013-edito-verite-fiction',
c1597d3fe210 add museo 2014-01
Thibaut Cavalié <thibaut.cavalie@iri.centrepompidou.fr>
parents: 1033
diff changeset
    51
    'mediapartlive-comment-combattre-le-fn',
c1597d3fe210 add museo 2014-01
Thibaut Cavalié <thibaut.cavalie@iri.centrepompidou.fr>
parents: 1033
diff changeset
    52
    'attention-1314-01-notion-attention',
c1597d3fe210 add museo 2014-01
Thibaut Cavalié <thibaut.cavalie@iri.centrepompidou.fr>
parents: 1033
diff changeset
    53
    'attention-1314-02-syndrome-saturation-cognitive',
c1597d3fe210 add museo 2014-01
Thibaut Cavalié <thibaut.cavalie@iri.centrepompidou.fr>
parents: 1033
diff changeset
    54
    'edito-1314-01-quest-ce-quun-support',
1057
c1a821eb190d Attention#3 & Edito#2 in archive
Nicolas Sauret <nicolas.sauret@iri.centrepompidou.fr>
parents: 1055
diff changeset
    55
    'enmi13', 'museo-1314-03-cognition-apprentissage', 'attention-1314-03-nouvelle-valeur-economique',
1106
1f827e73cb58 edito #5 en archive
Nicolas Sauret <nicolas.sauret@iri.centrepompidou.fr>
parents: 1102
diff changeset
    56
    'edito-1314-02-lannotation-le-savoir-dans-la-marge', 'museo-1314-04-lecture-active' , 'edito-1314-03-traduction', 'attention-1314-04-pathologies-attention-memoire', 'edito-1314-04-environnement-support', 'attention-1314-05-marche-attention-avenement-publicite','museo-1314-05-nouvelles-editions', 'edito-1314-05-algorithme',
1135
e78bbfe90a57 publication fens and update /edito/
Nicolas Sauret <nicolas.sauret@iri.centrepompidou.fr>
parents: 1125
diff changeset
    57
    'fens2014-design-metadata','fens2014-museo','fens2014-transmediamix','fens2014-edito','fens2014-attention',
1162
d39d2d68d49f archive edito
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1160
diff changeset
    58
    'pour-la-transition-une-conomie-du-partage-de-la-connaissance-et-des-biens-communs','spel-01-gout-archivage', 'edito-1415-01-hybridation-pratiques-recherche',
1184
308968a48dc8 add design attention to archive
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1182
diff changeset
    59
    'museo-1415-01-inaugurale', 'museo-1415-02-controverses', 'attention-1415-01-attention-automatisee',
1203
dfd75fc1cd4e archive attention 17/02/2015
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1201
diff changeset
    60
    'museo-1415-03-pedagogies', 'museo-1415-04-reseaux-sociaux-hermeneutiques','edito-1415-02-ressources-documentation-recherche',
1211
b9f98dab8386 update libs + unpublish museo
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1209
diff changeset
    61
    'attention-1415-02-recherche-algo-attention-hermeneutique', 'edito-1415-04-elargissement-communautes-scientifiques', /*'museo-1415-05-interfaces-design',*/
1272
82fe5cb3b55a publish edito + attention
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1270
diff changeset
    62
    'museo-1415-06-multilinguisme', 'museo-1415-07-traduction', 'attention-1415-05-reseaux-sociaux-valorisation',
82fe5cb3b55a publish edito + attention
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1270
diff changeset
    63
    'attention-1415-06-game-design', 'edito-1415-05-faire-oeuvre-epoque-numerique',
294
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
    64
);
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
    65
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
    66
233
10d6fd6ce9ab - put all in a registry
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 229
diff changeset
    67
$configuration = array(
807
877f952ae2bd update Zend and twitter oauth end point
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 804
diff changeset
    68
    'siteUrl'        => 'https://api.twitter.com/oauth',
233
10d6fd6ce9ab - put all in a registry
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 229
diff changeset
    69
    'consumerKey' 	 => '***REMOVED***',
10d6fd6ce9ab - put all in a registry
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 229
diff changeset
    70
    'consumerSecret' => '***REMOVED***'
10d6fd6ce9ab - put all in a registry
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 229
diff changeset
    71
);
10d6fd6ce9ab - put all in a registry
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 229
diff changeset
    72
10d6fd6ce9ab - put all in a registry
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 229
diff changeset
    73
10d6fd6ce9ab - put all in a registry
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 229
diff changeset
    74
$req_rep = $C_default_rep;
10d6fd6ce9ab - put all in a registry
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 229
diff changeset
    75
if(isset($config) && isset($config['rep'])) {
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
    76
    $req_rep = $config['rep'];
233
10d6fd6ce9ab - put all in a registry
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 229
diff changeset
    77
}
119
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
    78
988
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
    79
foreach (glob(dirname(__FILE__).'/traductions/*.php') as $trad_filename)
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
    80
{
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
    81
    include_once $trad_filename;
988
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
    82
}
233
10d6fd6ce9ab - put all in a registry
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 229
diff changeset
    83
if(file_exists(dirname(__FILE__)."/$req_rep/traduction.php")) {
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
    84
    include_once dirname(__FILE__)."/$req_rep/traduction.php";
220
42aeb2bfc58e publish chi07 and fens Fablab
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 219
diff changeset
    85
}
119
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
    86
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
    87
0
4eba9c11703f first import
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    88
/**
4eba9c11703f first import
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    89
 * Make sure Zend_Oauth's Consumer is loaded
4eba9c11703f first import
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    90
 */
119
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
    91
require_once dirname(__FILE__).'/lib/Zend/Oauth/Consumer.php';
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
    92
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
    93
/** Zend_Locale */
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
    94
require_once dirname(__FILE__).'/lib/Zend/Locale.php';
1198
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1196
diff changeset
    95
119
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
    96
/** Zend_Translate_Adapter */
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
    97
require_once dirname(__FILE__).'/lib/Zend/Translate/Adapter.php';
0
4eba9c11703f first import
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    98
4eba9c11703f first import
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    99
/**
4eba9c11703f first import
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
   100
 * Start up the ol' session engine
4eba9c11703f first import
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
   101
 */
4eba9c11703f first import
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
   102
session_start();
4eba9c11703f first import
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
   103
4eba9c11703f first import
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
   104
/**
4eba9c11703f first import
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
   105
 * Include the configuration data for our OAuth Client (array $configuration)
4eba9c11703f first import
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
   106
 */
119
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   107
include_once dirname(__FILE__).'/config.php';
1198
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1196
diff changeset
   108
233
10d6fd6ce9ab - put all in a registry
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 229
diff changeset
   109
10d6fd6ce9ab - put all in a registry
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 229
diff changeset
   110
$configuration['callbackUrl'] = URL_ROOT."$req_rep/callback.php";
10d6fd6ce9ab - put all in a registry
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 229
diff changeset
   111
0
4eba9c11703f first import
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
   112
4eba9c11703f first import
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
   113
/**
4eba9c11703f first import
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
   114
 * Setup an instance of the Consumer for use
4eba9c11703f first import
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
   115
 */
4eba9c11703f first import
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
   116
$consumer = new Zend_Oauth_Consumer($configuration);
119
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   117
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   118
/**
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   119
 * TRADUCTION
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   120
**/
294
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   121
function get_config_translations($config) {
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   122
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   123
    $fr = array();
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   124
    $en = array();
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   125
    $jp = array();
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   126
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   127
    $array_loop = array("fr"=>&$fr,"en"=>&$en,"jp"=>&$jp);
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   128
    /**
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   129
     * add all config key as translation.
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   130
     * translation key is "config__<config_key>"
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   131
     */
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   132
    foreach ($config as $key => $value) {
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   133
        $translation_key = "config__$key";
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   134
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   135
        foreach ($array_loop as $lang => &$lang_array) {
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   136
            if(is_array($value) && count(array_intersect_key($value,$array_loop)) > 0 ) {
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   137
                if (array_key_exists($lang, $value)) {
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   138
                    $lang_array[$translation_key] = $value[$lang];
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   139
                }
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   140
                elseif (array_key_exists('fr', $value)) {
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   141
                    $lang_array[$translation_key] = $value['fr'];
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   142
                }
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   143
            }
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   144
            else {
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   145
                $lang_array[$translation_key] = $value;
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   146
            }
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   147
        }
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   148
    }
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   149
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   150
    return $array_loop;
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   151
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   152
}
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   153
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   154
function set_config_translations(&$config, &$translate) {
1198
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1196
diff changeset
   155
294
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   156
    $config_translations = get_config_translations($config);
1198
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1196
diff changeset
   157
294
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   158
    // save the locale because it gets changed when adding translations
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   159
    $locale = $translate->getLocale();
1198
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1196
diff changeset
   160
294
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   161
    $translate->addTranslation($config_translations['en'], 'en');
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   162
    $translate->addTranslation($config_translations['jp'], 'ja_JP');
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   163
    $translate->addTranslation($config_translations['fr'], 'fr');
1198
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1196
diff changeset
   164
294
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   165
    // set the locale back
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   166
    $translate->setLocale($locale);
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   167
}
119
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   168
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   169
291
db1e6bfaa54e add translation for config data
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 287
diff changeset
   170
Zend_Loader::loadClass('Zend_Translate');
db1e6bfaa54e add translation for config data
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 287
diff changeset
   171
Zend_Loader::loadClass('Zend_Http_Cookie');
119
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   172
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   173
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   174
$client = new Zend_Http_Client();
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   175
$translate = new Zend_Translate('array', $init, 'fr');
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   176
291
db1e6bfaa54e add translation for config data
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 287
diff changeset
   177
988
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   178
$translate->addTranslation($traduction_en, 'en');
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   179
$translate->addTranslation($traduction_ja, 'ja_JP');
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   180
$translate->addTranslation($traduction_fr, 'fr');
119
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   181
291
db1e6bfaa54e add translation for config data
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 287
diff changeset
   182
if(isset($config)) {
1198
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1196
diff changeset
   183
294
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   184
    set_config_translations($config, $translate);
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   185
//     $config_translations = get_config_translations($config);
1198
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1196
diff changeset
   186
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1196
diff changeset
   187
294
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   188
//     $translate->addTranslation($config_translations['en'], 'en');
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   189
//     $translate->addTranslation($config_translations['jp'], 'ja_JP');
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   190
//     $translate->addTranslation($config_translations['fr'], 'fr');
291
db1e6bfaa54e add translation for config data
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 287
diff changeset
   191
}
1198
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1196
diff changeset
   192
119
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   193
$actual = $translate->getLocale();
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   194
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   195
//$translate->setLocale("en");
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   196
// $acceptCookie = $this->_request->getCookie('acceptCookie',0);
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   197
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   198
if(isset($_GET['lang'])==false and isset($_SESSION['lang'])==false){
1198
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1196
diff changeset
   199
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   200
    if($actual!='fr' and $actual!='en' and $actual!='ja_JP'){
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   201
        $translate->setLocale("fr");
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   202
         $_SESSION['lang']="fr";
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   203
    }
1198
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1196
diff changeset
   204
119
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   205
} else if (isset($_GET['lang'])==true){
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   206
    $translate->setLocale($_GET['lang']);
119
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   207
    $_SESSION['lang'] = $_GET['lang'];
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   208
    $actual = $_SESSION['lang'];
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   209
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   210
} else if (isset($_SESSION['lang'])==true){
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   211
    $translate->setLocale( $_SESSION['lang']);
119
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   212
    $actual = $_SESSION['lang'];
1198
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1196
diff changeset
   213
119
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   214
}
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   215
229
74c9ddc3640b a lot of changes in the web file organization.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 227
diff changeset
   216
$js_registry = array(
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   217
    'local' => array(
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   218
        'libdir'        => URL_ROOT.'res/js/',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   219
        'jquery' 		=> URL_ROOT.'res/js/jquery-1.10.2.min.js',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   220
        'raphael' 		=> URL_ROOT.'res/js/raphael-min.js',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   221
        'jquery-ui' 	=> URL_ROOT.'res/js/jquery-ui.min.js',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   222
        'niceforms' 	=> URL_ROOT.'res/js/niceforms.js',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   223
        'jquery-url' 	=> URL_ROOT.'res/js/jquery.url.js',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   224
        'ldtplayer' 	=> URL_ROOT.'res/metadataplayer/src/js/LdtPlayer.js',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   225
        'fancybox' 		=> URL_ROOT.'res/js/fancybox/jquery.fancybox.pack.js',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   226
        'jquery-tools' 	=> URL_ROOT.'res/js/jquery.tools.min.js',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   227
        'jquery-migrate' => URL_ROOT.'res/js/jquery-migrate-1.2.1.min.js',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   228
        'tw-widget' 	=> URL_ROOT.'res/js/tw_widget.js',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   229
        'jquery-mousewheel' => URL_ROOT.'res/js/jquery.mousewheel.js',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   230
        'swfobject' 	=> URL_ROOT.'res/js/swfobject.js',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   231
        'json-js' 		=> URL_ROOT.'res/js/json2.js',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   232
        'underscore'    => URL_ROOT.'res/js/underscore-min.js' ,
534
0a2505c3b547 New metadata player and big directory reorganization
Raphael Velt <raph.velt@gmail.com>
parents: 525
diff changeset
   233
        'jquery-scrollto'=>URL_ROOT.'res/js/jquery.scrollTo-1.4.2-min.js' ,
0a2505c3b547 New metadata player and big directory reorganization
Raphael Velt <raph.velt@gmail.com>
parents: 525
diff changeset
   234
        'twcx-main'     => URL_ROOT.'res/js/live-polemic.js' ,
0a2505c3b547 New metadata player and big directory reorganization
Raphael Velt <raph.velt@gmail.com>
parents: 525
diff changeset
   235
        'semanticboard' => URL_ROOT.'res/js/semanticboard.js' ,
598
d366aa22bd79 New Metadataplayer version
Raphael Velt <raph.velt@gmail.com>
parents: 597
diff changeset
   236
        'metadataplayer'=> URL_ROOT.'res/metadataplayer/LdtPlayer-core.js' ,
d366aa22bd79 New Metadataplayer version
Raphael Velt <raph.velt@gmail.com>
parents: 597
diff changeset
   237
        'ldtwidgets'    => URL_ROOT.'res/metadataplayer/' ,
656
635a86f25fe7 First tests for PT Protocol implementation
Raphael Velt <raph.velt@gmail.com>
parents: 633
diff changeset
   238
        'tracemanager'  => URL_ROOT.'res/js/tracemanager.js' ,
988
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   239
        'jwplayer-js'   => URL_ROOT.'res/js/jwplayer.js',
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   240
        'jquery-tinymce' => URL_ROOT.'res/js/tinymce/jquery.tinymce.min.js',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   241
        'tinymce'        => URL_ROOT.'res/js/tinymce/tinymce.min.js',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   242
    ),
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   243
    'cdn' => array(
534
0a2505c3b547 New metadata player and big directory reorganization
Raphael Velt <raph.velt@gmail.com>
parents: 525
diff changeset
   244
        'libdir'        => URL_ROOT.'res/js/',
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   245
        'jquery' 		=> 'http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   246
        'raphael' 		=> URL_ROOT.'res/js/raphael-min.js',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   247
        'jquery-ui' 	=> 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   248
        'niceforms' 	=> URL_ROOT.'res/js/niceforms.js',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   249
        'jquery-url' 	=> URL_ROOT.'res/js/jquery.url.js',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   250
        'ldtplayer' 	=> URL_ROOT.'res/metadataplayer/src/js/LdtPlayer.js',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   251
        'fancybox' 		=> URL_ROOT.'res/js/fancybox/jquery.fancybox.pack.js',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   252
        'jquery-tools' 	=> 'http://cdn.jquerytools.org/1.2.7/all/jquery.tools.min.js',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   253
        'jquery-migrate' => 'http://code.jquery.com/jquery-migrate-1.2.1.min.js',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   254
        'tw-widget' 	=> 'http://widgets.twimg.com/j/2/widget.js',
988
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   255
        'jquery-mousewheel' => URL_ROOT.'res/js/jquery.mousewheel.js',
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   256
        'swfobject' 	=> 'http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js',
534
0a2505c3b547 New metadata player and big directory reorganization
Raphael Velt <raph.velt@gmail.com>
parents: 525
diff changeset
   257
        'json-js'       => URL_ROOT.'res/js/json2.js',
0a2505c3b547 New metadata player and big directory reorganization
Raphael Velt <raph.velt@gmail.com>
parents: 525
diff changeset
   258
        'underscore'    => URL_ROOT.'res/js/underscore-min.js' ,
0a2505c3b547 New metadata player and big directory reorganization
Raphael Velt <raph.velt@gmail.com>
parents: 525
diff changeset
   259
        'jquery-scrollto'=>URL_ROOT.'res/js/jquery.scrollTo-1.4.2-min.js' ,
0a2505c3b547 New metadata player and big directory reorganization
Raphael Velt <raph.velt@gmail.com>
parents: 525
diff changeset
   260
        'twcx-main'     => URL_ROOT.'res/js/live-polemic.js' ,
0a2505c3b547 New metadata player and big directory reorganization
Raphael Velt <raph.velt@gmail.com>
parents: 525
diff changeset
   261
        'semanticboard' => URL_ROOT.'res/js/semanticboard.js' ,
598
d366aa22bd79 New Metadataplayer version
Raphael Velt <raph.velt@gmail.com>
parents: 597
diff changeset
   262
        'metadataplayer'=> URL_ROOT.'res/metadataplayer/LdtPlayer-core.js' ,
d366aa22bd79 New Metadataplayer version
Raphael Velt <raph.velt@gmail.com>
parents: 597
diff changeset
   263
        'ldtwidgets'    => URL_ROOT.'res/metadataplayer/' ,
656
635a86f25fe7 First tests for PT Protocol implementation
Raphael Velt <raph.velt@gmail.com>
parents: 633
diff changeset
   264
        'tracemanager'  => URL_ROOT.'res/js/tracemanager.js' ,
988
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   265
        'jwplayer-js'   => URL_ROOT.'res/js/jwplayer.js',
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   266
        'jquery-tinymce' => URL_ROOT.'res/js/tinymce/jquery.tinymce.min.js',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   267
        'tinymce'        => URL_ROOT.'res/js/tinymce/tinymce.min.js',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   268
    )
229
74c9ddc3640b a lot of changes in the web file organization.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 227
diff changeset
   269
);
143
2a3599a4b0f7 add #enmi page and some litlle corrections
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 119
diff changeset
   270
229
74c9ddc3640b a lot of changes in the web file organization.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 227
diff changeset
   271
$font_registry = array(
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   272
    'local' => array(
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   273
        'PT-Sans_Narrow' => URL_ROOT.'res/fonts/PTSansNarrow.css',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   274
        'PT-Sans' 		 => URL_ROOT.'res/fonts/PTSans.css'
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   275
    ),
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   276
    'cdn' => array(
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   277
        'PT-Sans_Narrow' => 'http://fonts.googleapis.com/css?family=PT+Sans+Narrow&subset=latin',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   278
        'PT-Sans' 		 => 'http://fonts.googleapis.com/css?family=PT+Sans&subset=latin'
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   279
    )
229
74c9ddc3640b a lot of changes in the web file organization.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 227
diff changeset
   280
);
216
d8c1b7e00533 sig chi paris 2011
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 207
diff changeset
   281
233
10d6fd6ce9ab - put all in a registry
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 229
diff changeset
   282
10d6fd6ce9ab - put all in a registry
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 229
diff changeset
   283
$css_registry = array(
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   284
    'local' => array(
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   285
       	'blueprint-screen' => URL_ROOT.'res/css/blueprint-screen.css',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   286
        'blueprint-print' => URL_ROOT.'res/css/blueprint-print.css',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   287
        'blueprint-ie' => URL_ROOT.'res/css/blueprint-ie.css',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   288
        'blueprint-plugins-fancy-type' => URL_ROOT.'res/css/blueprint-plugins/fancy-type/screen.css',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   289
        'custom' => URL_ROOT.'res/css/custom.css',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   290
        'fancybox' => URL_ROOT.'res/js/fancybox/jquery.fancybox.css',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   291
        'jquery-ui' => URL_ROOT.'res/metadataplayer/res/css/jq-css/themes/base/jquery-ui.css',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   292
        'tabs-slideshow' => URL_ROOT.'res/css/tabs-slideshow.css',
469
99d105834315 Semantic board est maintenant dans les répertoires projets
Raphael Velt <raph.velt@gmail.com>
parents: 420
diff changeset
   293
        'tweetcast' => URL_ROOT.'res/css/tweetcast.css',
99d105834315 Semantic board est maintenant dans les répertoires projets
Raphael Velt <raph.velt@gmail.com>
parents: 420
diff changeset
   294
        'semanticboard' =>  URL_ROOT.'res/css/semanticboard.css',
495
34f92d5b2acf Added an archive embed for the IRI homepage
Raphael Velt <raph.velt@gmail.com>
parents: 491
diff changeset
   295
        'archives-iframe' => URL_ROOT.'res/css/archives-iframe.css',
598
d366aa22bd79 New Metadataplayer version
Raphael Velt <raph.velt@gmail.com>
parents: 597
diff changeset
   296
        'metadataplayer' => URL_ROOT.'res/metadataplayer/LdtPlayer-core.css',
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   297
        'jquery-te' => URL_ROOT.'res/css/jquery-te.css',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   298
    ),
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   299
    'cdn' => array(
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   300
        'blueprint-screen' => URL_ROOT.'res/css/blueprint-screen.css',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   301
        'blueprint-print' => URL_ROOT.'res/css/blueprint-print.css',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   302
        'blueprint-ie' => URL_ROOT.'res/css/blueprint-ie.css',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   303
        'blueprint-plugins-fancy-type' => URL_ROOT.'res/css/blueprint-plugins/fancy-type/screen.css',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   304
        'custom' => URL_ROOT.'res/css/custom.css',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   305
        'fancybox' => URL_ROOT.'res/js/fancybox/jquery.fancybox.css',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   306
        'jquery-ui' => "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/themes/base/jquery-ui.css",
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   307
        'tabs-slideshow' => URL_ROOT.'res/css/tabs-slideshow.css',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   308
        'tweetcast' => URL_ROOT.'res/css/tweetcast.css',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   309
        'semanticboard' =>  URL_ROOT.'res/css/semanticboard.css',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   310
        'archives-iframe' => URL_ROOT.'res/css/archives-iframe.css',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   311
        'metadataplayer' => URL_ROOT.'res/metadataplayer/LdtPlayer-core.css',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   312
        'jquery-te' => URL_ROOT.'res/css/jquery-te.css',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   313
    )
233
10d6fd6ce9ab - put all in a registry
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 229
diff changeset
   314
);
10d6fd6ce9ab - put all in a registry
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 229
diff changeset
   315
229
74c9ddc3640b a lot of changes in the web file organization.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 227
diff changeset
   316
74c9ddc3640b a lot of changes in the web file organization.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 227
diff changeset
   317
function registry_url($key, $type, $registry_def=null) {
74c9ddc3640b a lot of changes in the web file organization.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 227
diff changeset
   318
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   319
    global $js_registry, $font_registry, $css_registry, $C_default_registry;
143
2a3599a4b0f7 add #enmi page and some litlle corrections
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 119
diff changeset
   320
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   321
    if($registry_def != null) {
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   322
        $registry = $registry_def;
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   323
    }
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   324
    elseif(isset($C_default_registry)) {
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   325
        $registry = $C_default_registry;
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   326
    }
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   327
    else {
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   328
        $registry = 'local';
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   329
    }
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   330
    $registry_name = $type."_registry";
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   331
    return ${
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   332
        $registry_name}[$registry][$key];
229
74c9ddc3640b a lot of changes in the web file organization.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 227
diff changeset
   333
74c9ddc3640b a lot of changes in the web file organization.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 227
diff changeset
   334
}
74c9ddc3640b a lot of changes in the web file organization.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 227
diff changeset
   335
291
db1e6bfaa54e add translation for config data
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 287
diff changeset
   336
function get_archive_box($rep, $metadata, $url_root, $basepath, &$translate) {
229
74c9ddc3640b a lot of changes in the web file organization.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 227
diff changeset
   337
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   338
    include("$basepath$rep/config.php");
1198
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1196
diff changeset
   339
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   340
    set_config_translations($config, $translate);
294
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   341
/* 	$config_translations = get_config_translations($config);
1198
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1196
diff changeset
   342
294
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   343
// 	save the locale because it gets changed when adding translations
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   344
    $locale = $translate->getLocale();
1198
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1196
diff changeset
   345
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   346
    $translate->addTranslation($config_translations['en'], 'en');
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   347
    $translate->addTranslation($config_translations['jp'], 'ja_JP');
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   348
    $translate->addTranslation($config_translations['fr'], 'fr');
1198
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1196
diff changeset
   349
294
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   350
// 	set the locale back
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   351
    $translate->setLocale($locale);
294
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   352
 */
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   353
    $id = "abox_$rep".(($metadata!=null)?"_$metadata":"");
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   354
    $hash = ($metadata!=null)?"#metadata=$metadata":"";
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   355
    $tail_img = $translate->_('config__archive_img');
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   356
    if(is_array($tail_img)) {
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   357
        $tail_img = $tail_img[$metadata];
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   358
    }
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   359
    $archive_title = $translate->_('config__archive_title');
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   360
    if(is_array($archive_title)) {
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   361
        $archive_title = $archive_title[$metadata];
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   362
    }
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   363
    $archive_description = $translate->_('config__archive_description');
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   364
    if(is_array($archive_description)) {
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   365
        $archive_description = $archive_description[$metadata];
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   366
    }
119
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   367
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   368
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   369
    $res  = "<div id=\"$id\" class=\"archivesVideoBox\">\n";
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   370
    $res .= "    <a href=\"$rep/polemicaltimeline.php$hash\">\n";
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   371
    $res .= "        <img src=\"$url_root$rep/$tail_img\" width=\"270\" height=\"150\" class=\"AVBimg\" />";
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   372
    $res .= "    </a>";
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   373
    $res .= "    <div class=\"AVBtitle\">$archive_title</div>\n";
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   374
    $res .= "    <div class=\"AVBtext\">\n";
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   375
    $res .= "        $archive_description\n";
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   376
    $res .= "    </div>\n";
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   377
    $res .= "</div>\n";
229
74c9ddc3640b a lot of changes in the web file organization.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 227
diff changeset
   378
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   379
    return $res;
229
74c9ddc3640b a lot of changes in the web file organization.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 227
diff changeset
   380
74c9ddc3640b a lot of changes in the web file organization.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 227
diff changeset
   381
}
74c9ddc3640b a lot of changes in the web file organization.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 227
diff changeset
   382
291
db1e6bfaa54e add translation for config data
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 287
diff changeset
   383
function display_archives_list($archives_list, $box_class, $url_root, $basepath, &$translate) {
1198
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1196
diff changeset
   384
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1196
diff changeset
   385
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   386
    for($i=0;$i<count($archives_list);$i++) {
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   387
        if(($i % 3)==0) {
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   388
            print("			    <div class=\"$box_class\">\n");
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   389
        }
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   390
        $archive_ref = $archives_list[$i];
1198
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1196
diff changeset
   391
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   392
        $archive_name = $archive_ref;
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   393
        $metadata = null;
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   394
        if(is_array($archive_ref)) {
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   395
            $archive_name = $archive_ref[0];
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   396
            $metadata = $archive_ref[1];
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   397
        }
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   398
        print(get_archive_box($archive_name,$metadata, $url_root, $basepath, $translate));
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   399
        if(($i % 3)==2 || $i == (count($archives_list)-1)) {
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   400
            print("			    </div>\n");
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   401
        }
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   402
    }
229
74c9ddc3640b a lot of changes in the web file organization.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 227
diff changeset
   403
}
74c9ddc3640b a lot of changes in the web file organization.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 227
diff changeset
   404
684
f59daf0830d2 less naive implementation of common LDT platform URL
Raphael Velt <raph.velt@gmail.com>
parents: 683
diff changeset
   405
function get_metadata_url($metadata) {
1244
87583b020202 put ldt platform url in config
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1242
diff changeset
   406
    global $project_url_base;
684
f59daf0830d2 less naive implementation of common LDT platform URL
Raphael Velt <raph.velt@gmail.com>
parents: 683
diff changeset
   407
    if (preg_match('/^https?:\/\//', $metadata)) {
f59daf0830d2 less naive implementation of common LDT platform URL
Raphael Velt <raph.velt@gmail.com>
parents: 683
diff changeset
   408
        return $metadata;
f59daf0830d2 less naive implementation of common LDT platform URL
Raphael Velt <raph.velt@gmail.com>
parents: 683
diff changeset
   409
    } else {
1244
87583b020202 put ldt platform url in config
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1242
diff changeset
   410
        return LDT_PLATFORM.$project_url_base.$metadata;
684
f59daf0830d2 less naive implementation of common LDT platform URL
Raphael Velt <raph.velt@gmail.com>
parents: 683
diff changeset
   411
    }
f59daf0830d2 less naive implementation of common LDT platform URL
Raphael Velt <raph.velt@gmail.com>
parents: 683
diff changeset
   412
}
229
74c9ddc3640b a lot of changes in the web file organization.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 227
diff changeset
   413
684
f59daf0830d2 less naive implementation of common LDT platform URL
Raphael Velt <raph.velt@gmail.com>
parents: 683
diff changeset
   414
function get_metadata_json_url($metadata) {
f59daf0830d2 less naive implementation of common LDT platform URL
Raphael Velt <raph.velt@gmail.com>
parents: 683
diff changeset
   415
    if (is_array($metadata)) {
f59daf0830d2 less naive implementation of common LDT platform URL
Raphael Velt <raph.velt@gmail.com>
parents: 683
diff changeset
   416
        $metadata["url"] = get_metadata_url($metadata["url"]);
f59daf0830d2 less naive implementation of common LDT platform URL
Raphael Velt <raph.velt@gmail.com>
parents: 683
diff changeset
   417
        return $metadata;
f59daf0830d2 less naive implementation of common LDT platform URL
Raphael Velt <raph.velt@gmail.com>
parents: 683
diff changeset
   418
    } else {
f59daf0830d2 less naive implementation of common LDT platform URL
Raphael Velt <raph.velt@gmail.com>
parents: 683
diff changeset
   419
        return get_metadata_url($metadata);
f59daf0830d2 less naive implementation of common LDT platform URL
Raphael Velt <raph.velt@gmail.com>
parents: 683
diff changeset
   420
    }
f59daf0830d2 less naive implementation of common LDT platform URL
Raphael Velt <raph.velt@gmail.com>
parents: 683
diff changeset
   421
}
988
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   422
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   423
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   424
$realm = 'Polemictweet restricted area';
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   425
1001
df016fc8bbdb correct authentication and put the login/password in the config template.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 994
diff changeset
   426
988
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   427
function authenticate($users, $translate) {
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   428
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   429
    global $realm;
1198
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1196
diff changeset
   430
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1196
diff changeset
   431
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   432
    if (empty($_SERVER['PHP_AUTH_DIGEST']) || !isset($_SESSION['http_digest_nonce'])) {
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   433
        $_SESSION['http_digest_nonce'] = uniqid();
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   434
        header('HTTP/1.1 401 Unauthorized');
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   435
        header('WWW-Authenticate: Digest realm="'.$realm.
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   436
        '",qop="auth",nonce="'.$_SESSION['http_digest_nonce'].'",opaque="'.md5($realm).'"');
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   437
        return array('error' => $translate->_('This area is restricted, please authenticate'));
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   438
    }
988
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   439
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   440
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   441
    //analyze the PHP_AUTH_DIGEST variable
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   442
    if (!($data = http_digest_parse($_SERVER['PHP_AUTH_DIGEST'])) ||
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   443
        !isset($users[$data['username']])) {
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   444
        $_SERVER['PHP_AUTH_DIGEST'] = '';
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   445
        unset($_SESSION['auth']);
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   446
        unset($_SESSION['http_digest_nonce']);
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   447
        return array('error' => $translate->_('Wrong Credentials!'));
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   448
    }
988
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   449
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   450
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   451
    //generate the valid response
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   452
    $A1 = md5($data['username'] . ':' . $realm . ':' . $users[$data['username']]);
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   453
    $A2 = md5($_SERVER['REQUEST_METHOD'].':'.$data['uri']);
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   454
    $valid_response = md5($A1.':'.$data['nonce'].':'.$data['nc'].':'.$data['cnonce'].':'.$data['qop'].':'.$A2);
988
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   455
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   456
    if ($data['response'] != $valid_response) {
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   457
        $_SERVER['PHP_AUTH_DIGEST'] = '';
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   458
        unset($_SESSION['http_digest_nonce']);
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   459
        unset($_SESSION['auth']);
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   460
        return array('error' => $translate->_('Wrong Credentials!'));
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   461
    }
988
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   462
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   463
    // ok, valid username & password
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   464
    $_SESSION['auth'] = $data['username'];
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   465
    return $data;
988
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   466
}
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   467
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   468
function logout() {
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   469
    global $realm;
1198
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1196
diff changeset
   470
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   471
    unset($_SESSION['auth']);
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   472
    unset($_SESSION['http_digest_nonce']);
988
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   473
}
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   474
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   475
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   476
//function to parse the http auth header
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   477
function http_digest_parse($txt)
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   478
{
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   479
    // protect against missing data
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   480
    $needed_parts = array('nonce'=>1, 'nc'=>1, 'cnonce'=>1, 'qop'=>1, 'username'=>1, 'uri'=>1, 'response'=>1);
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   481
    $data = array();
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   482
    $keys = implode('|', array_keys($needed_parts));
988
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   483
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   484
    preg_match_all('@(' . $keys . ')=(?:([\'"])([^\2]+?)\2|([^\s,]+))@', $txt, $matches, PREG_SET_ORDER);
988
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   485
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   486
    foreach ($matches as $m) {
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   487
        $data[$m[1]] = $m[3] ? $m[3] : $m[4];
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   488
        unset($needed_parts[$m[1]]);
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   489
    }
988
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   490
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   491
    return $needed_parts ? false : $data;
988
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   492
}
1006
bb98a0de3bfd sanitize filenames for hardheaded users
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1003
diff changeset
   493
bb98a0de3bfd sanitize filenames for hardheaded users
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1003
diff changeset
   494
/**
bb98a0de3bfd sanitize filenames for hardheaded users
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1003
diff changeset
   495
 * Modifies a string to remove all non ASCII characters and spaces.
bb98a0de3bfd sanitize filenames for hardheaded users
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1003
diff changeset
   496
 */
bb98a0de3bfd sanitize filenames for hardheaded users
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1003
diff changeset
   497
function slugify($text)
bb98a0de3bfd sanitize filenames for hardheaded users
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1003
diff changeset
   498
{
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   499
    // replace non letter or digits by -
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   500
    $text = preg_replace('~[^\\pL\d]+~u', '-', $text);
1006
bb98a0de3bfd sanitize filenames for hardheaded users
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1003
diff changeset
   501
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   502
    // trim
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   503
    $text = trim($text, '-');
1006
bb98a0de3bfd sanitize filenames for hardheaded users
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1003
diff changeset
   504
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   505
    // transliterate
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   506
    if (function_exists('iconv'))
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   507
    {
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   508
        $text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   509
    }
1006
bb98a0de3bfd sanitize filenames for hardheaded users
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1003
diff changeset
   510
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   511
    // lowercase
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   512
    $text = strtolower($text);
1006
bb98a0de3bfd sanitize filenames for hardheaded users
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1003
diff changeset
   513
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   514
    // remove unwanted characters
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   515
    $text = preg_replace('~[^-\w]+~', '', $text);
1006
bb98a0de3bfd sanitize filenames for hardheaded users
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1003
diff changeset
   516
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   517
    if (empty($text))
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   518
    {
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   519
        return 'n-a';
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   520
    }
1006
bb98a0de3bfd sanitize filenames for hardheaded users
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1003
diff changeset
   521
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   522
    return $text;
1006
bb98a0de3bfd sanitize filenames for hardheaded users
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1003
diff changeset
   523
}
bb98a0de3bfd sanitize filenames for hardheaded users
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1003
diff changeset
   524
bb98a0de3bfd sanitize filenames for hardheaded users
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1003
diff changeset
   525
bb98a0de3bfd sanitize filenames for hardheaded users
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1003
diff changeset
   526
// from http://www.house6.com/blog/?p=83
bb98a0de3bfd sanitize filenames for hardheaded users
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1003
diff changeset
   527
function sanitize_filename($f) {
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   528
    // a combination of various methods
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   529
    // we don't want to convert html entities, or do any url encoding
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   530
    // we want to retain the "essence" of the original file name, if possible
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   531
    // char replace table found at:
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   532
    // http://www.php.net/manual/en/function.strtr.php#98669
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   533
    $replace_chars = array(
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   534
            'Š'=>'S', 'š'=>'s', 'Ð'=>'Dj','Ž'=>'Z', 'ž'=>'z', 'À'=>'A', 'Á'=>'A', 'Â'=>'A', 'Ã'=>'A', 'Ä'=>'A',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   535
            'Å'=>'A', 'Æ'=>'A', 'Ç'=>'C', 'È'=>'E', 'É'=>'E', 'Ê'=>'E', 'Ë'=>'E', 'Ì'=>'I', 'Í'=>'I', 'Î'=>'I',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   536
            'Ï'=>'I', 'Ñ'=>'N', 'Ò'=>'O', 'Ó'=>'O', 'Ô'=>'O', 'Õ'=>'O', 'Ö'=>'O', 'Ø'=>'O', 'Ù'=>'U', 'Ú'=>'U',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   537
            'Û'=>'U', 'Ü'=>'U', 'Ý'=>'Y', 'Þ'=>'B', 'ß'=>'Ss','à'=>'a', 'á'=>'a', 'â'=>'a', 'ã'=>'a', 'ä'=>'a',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   538
            'å'=>'a', 'æ'=>'a', 'ç'=>'c', 'è'=>'e', 'é'=>'e', 'ê'=>'e', 'ë'=>'e', 'ì'=>'i', 'í'=>'i', 'î'=>'i',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   539
            'ï'=>'i', 'ð'=>'o', 'ñ'=>'n', 'ò'=>'o', 'ó'=>'o', 'ô'=>'o', 'õ'=>'o', 'ö'=>'o', 'ø'=>'o', 'ù'=>'u',
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   540
            'ú'=>'u', 'û'=>'u', 'ý'=>'y', 'ý'=>'y', 'þ'=>'b', 'ÿ'=>'y', 'ƒ'=>'f'
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   541
    );
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   542
    $f = strtr($f, $replace_chars);
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   543
    // convert & to "and", @ to "at", and # to "number"
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   544
    $f = preg_replace(array('/[\&]/', '/[\@]/', '/[\#]/'), array('-and-', '-at-', '-number-'), $f);
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   545
    $f = preg_replace('/[^(\x20-\x7F)]*/','', $f); // removes any special chars we missed
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   546
    $f = str_replace(' ', '-', $f); // convert space to hyphen
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   547
    $f = str_replace('\'', '', $f); // removes apostrophes
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   548
    $f = preg_replace('/[^\w\-\.]+/', '', $f); // remove non-word chars (leaving hyphens and periods)
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   549
    $f = preg_replace('/[\-]+/', '-', $f); // converts groups of hyphens into one
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   550
    if (function_exists('iconv'))
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   551
    {
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   552
        $f = iconv('utf-8', 'us-ascii//TRANSLIT', $f);
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   553
    }
1198
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1196
diff changeset
   554
1012
5064d9d287a0 replace jquery text editor by jquery for a better control on text clean up.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1006
diff changeset
   555
    return strtolower($f);
1006
bb98a0de3bfd sanitize filenames for hardheaded users
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1003
diff changeset
   556
}