web/common.php
author ymh <ymh.work@gmail.com>
Mon, 20 Nov 2023 18:10:58 +0100
changeset 1557 7c67caaafdeb
parent 1555 942d10136be5
child 1558 761ba7426984
permissions -rwxr-xr-x
enmi 22
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
1427
8b3d57a519eb remove dependency to Zend 1. Use composer to reduce the number of dependencies
ymh <ymh.work@gmail.com>
parents: 1425
diff changeset
     3
// composer autoload files
8b3d57a519eb remove dependency to Zend 1. Use composer to reduce the number of dependencies
ymh <ymh.work@gmail.com>
parents: 1425
diff changeset
     4
require __DIR__ . '/vendor/autoload.php';
8b3d57a519eb remove dependency to Zend 1. Use composer to reduce the number of dependencies
ymh <ymh.work@gmail.com>
parents: 1425
diff changeset
     5
8b3d57a519eb remove dependency to Zend 1. Use composer to reduce the number of dependencies
ymh <ymh.work@gmail.com>
parents: 1425
diff changeset
     6
use Abraham\TwitterOAuth\TwitterOAuth;
1557
7c67caaafdeb enmi 22
ymh <ymh.work@gmail.com>
parents: 1555
diff changeset
     7
use Fundevogel\Mastodon\Api;
0
4eba9c11703f first import
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
     8
233
10d6fd6ce9ab - put all in a registry
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 229
diff changeset
     9
/**
10d6fd6ce9ab - put all in a registry
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 229
diff changeset
    10
* Base configuration
10d6fd6ce9ab - put all in a registry
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 229
diff changeset
    11
*/
988
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
    12
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
    13
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
    14
$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
    15
1549
f21b84c64daa Update img and infofor enmi 2021
ymh <ymh.work@gmail.com>
parents: 1546
diff changeset
    16
$C_default_rep = 'enmi21';
287
3efe34a87c37 correct feedback url
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 286
diff changeset
    17
$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
    18
$C_event_props = __DIR__ . "/event_props";
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
    19
$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
    20
994
053de9a4e738 adapt for 5.3.2
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 989
diff changeset
    21
$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
    22
294
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
    23
$archives_list = array(
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
    24
    "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
    25
    "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
    26
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
    27
    "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
    28
    "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
    29
    "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
    30
    "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
    31
    "edito-arts-numeriques",
659
44c5c0a2b6d4 Added FENS events
Raphael Velt <raph.velt@gmail.com>
parents: 656
diff changeset
    32
    'fens2012-gamestudies',
44c5c0a2b6d4 Added FENS events
Raphael Velt <raph.velt@gmail.com>
parents: 656
diff changeset
    33
    'fens2012-designmetadata',
44c5c0a2b6d4 Added FENS events
Raphael Velt <raph.velt@gmail.com>
parents: 656
diff changeset
    34
    'fens2012-museo-culture-opendata',
44c5c0a2b6d4 Added FENS events
Raphael Velt <raph.velt@gmail.com>
parents: 656
diff changeset
    35
    'fens2012-vinyl-numerique',
44c5c0a2b6d4 Added FENS events
Raphael Velt <raph.velt@gmail.com>
parents: 656
diff changeset
    36
    'fens2012-edito-datajournalisme',
770
25c156d00de6 Next event is BPI Doudou
Raphael Velt <raph.velt@gmail.com>
parents: 768
diff changeset
    37
    'fens2012-wiid',
938
db42d0bc2e19 Added video for Design Meta Data
Raphael Velt <raph.velt@gmail.com>
parents: 918
diff changeset
    38
    '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
    39
    '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
    40
    "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
    41
    'edito-1213-04-lire-ecrire', 'eduinov-2013',
db42d0bc2e19 Added video for Design Meta Data
Raphael Velt <raph.velt@gmail.com>
parents: 918
diff changeset
    42
    '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
    43
    '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
    44
    'fens2013-design-metadata',
1038
c1597d3fe210 add museo 2014-01
Thibaut Cavalié <thibaut.cavalie@iri.centrepompidou.fr>
parents: 1033
diff changeset
    45
    'fens2013-museo-cultural-data',
c1597d3fe210 add museo 2014-01
Thibaut Cavalié <thibaut.cavalie@iri.centrepompidou.fr>
parents: 1033
diff changeset
    46
    'fens2013-edito-verite-fiction',
c1597d3fe210 add museo 2014-01
Thibaut Cavalié <thibaut.cavalie@iri.centrepompidou.fr>
parents: 1033
diff changeset
    47
    'mediapartlive-comment-combattre-le-fn',
c1597d3fe210 add museo 2014-01
Thibaut Cavalié <thibaut.cavalie@iri.centrepompidou.fr>
parents: 1033
diff changeset
    48
    'attention-1314-01-notion-attention',
c1597d3fe210 add museo 2014-01
Thibaut Cavalié <thibaut.cavalie@iri.centrepompidou.fr>
parents: 1033
diff changeset
    49
    'attention-1314-02-syndrome-saturation-cognitive',
c1597d3fe210 add museo 2014-01
Thibaut Cavalié <thibaut.cavalie@iri.centrepompidou.fr>
parents: 1033
diff changeset
    50
    '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
    51
    '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
    52
    '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
    53
    '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
    54
    '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
    55
    'museo-1415-01-inaugurale', 'museo-1415-02-controverses', 'attention-1415-01-attention-automatisee',
1304
10974bff4dae upgrade metadataplayer + publish enmi 14and 15
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1301
diff changeset
    56
    'museo-1415-03-pedagogies', 'museo-1415-04-reseaux-sociaux-hermeneutiques','edito-1415-02-ressources-documentation-recherche', 'enmi14',
1211
b9f98dab8386 update libs + unpublish museo
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1209
diff changeset
    57
    '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
    58
    'museo-1415-06-multilinguisme', 'museo-1415-07-traduction', 'attention-1415-05-reseaux-sociaux-valorisation',
1288
1763d0a21003 museo 06/16 + attention 06/17 publications
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1285
diff changeset
    59
    'attention-1415-06-game-design', 'edito-1415-05-faire-oeuvre-epoque-numerique', 'museo-1415-08-histoire-critique',
1319
b92490ef8f9c continuation pub edito 15/16 4
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1315
diff changeset
    60
    'attention-1415-07-design-pluralisation', 'edito-1516-01-profil-collectif', 'edito-1516-02-corps-profil', 'enmi15', 'edito-1516-03-editorialisation-universitaire',
1341
97038e1a13a3 publish edito 15/16 7
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1339
diff changeset
    61
    'edito-1516-04-detournements-creation', 'edito-1516-05-production-reel', 'edito-1516-06-confession-confiscation-de-soi',
1390
03e71226531e add cnsad to archive
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1382
diff changeset
    62
    'edito-1516-07-architecture-savoir', 'edito-1516-08-desir-profilage', 'edito-1516-09-cloture', 'journee-omnsh-2016-10-patrimoine-numerique', 'enmi16',
1526
e4662bc99fec Archive enmi19
Riwad Salim <riwad.salim@yahoo.fr>
parents: 1514
diff changeset
    63
    'cnsad-ateliers-2017', 'crypto-party-camp-rouxteur-10-2017', 'cnsad-seminaire-telepresence-11-2017', 'enmi17', /*'enmi18-preparatoire',*/'marathon-serpentine-2018', 'enmi18', 'enmi19-preparatoire', 'enmi19',
1555
942d10136be5 publish enmi2021 archive
ymh <ymh.work@gmail.com>
parents: 1549
diff changeset
    64
    'enmi20', 'enmi21',
294
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
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
    67
233
10d6fd6ce9ab - put all in a registry
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 229
diff changeset
    68
$req_rep = $C_default_rep;
10d6fd6ce9ab - put all in a registry
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 229
diff changeset
    69
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
    70
    $req_rep = $config['rep'];
233
10d6fd6ce9ab - put all in a registry
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 229
diff changeset
    71
}
119
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
    72
988
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
    73
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
    74
{
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
    75
    include_once $trad_filename;
988
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
    76
}
233
10d6fd6ce9ab - put all in a registry
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 229
diff changeset
    77
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
    78
    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
    79
}
119
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
    80
1557
7c67caaafdeb enmi 22
ymh <ymh.work@gmail.com>
parents: 1555
diff changeset
    81
$appCacheHandle = new SQLite3(dirname(__FILE__)."/data/app_cache.db");
7c67caaafdeb enmi 22
ymh <ymh.work@gmail.com>
parents: 1555
diff changeset
    82
$appCacheHandle->query("CREATE TABLE IF NOT EXISTS apps (id INTEGER PRIMARY KEY, domain TEXT UNIQUE NOT NULL, app_key TEXT UNIQUE NOT NULL, app_secret TEXT NOT NULL)");
7c67caaafdeb enmi 22
ymh <ymh.work@gmail.com>
parents: 1555
diff changeset
    83
7c67caaafdeb enmi 22
ymh <ymh.work@gmail.com>
parents: 1555
diff changeset
    84
119
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
    85
0
4eba9c11703f first import
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    86
/**
4eba9c11703f first import
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    87
 * Start up the ol' session engine
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
session_start();
4eba9c11703f first import
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    90
4eba9c11703f first import
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    91
/**
4eba9c11703f first import
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    92
 * 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
    93
 */
119
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
    94
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
    95
233
10d6fd6ce9ab - put all in a registry
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 229
diff changeset
    96
1557
7c67caaafdeb enmi 22
ymh <ymh.work@gmail.com>
parents: 1555
diff changeset
    97
$get_social_request_token = function ($loginDomain, $config) use ($req_rep, $appCacheHandle) {
7c67caaafdeb enmi 22
ymh <ymh.work@gmail.com>
parents: 1555
diff changeset
    98
7c67caaafdeb enmi 22
ymh <ymh.work@gmail.com>
parents: 1555
diff changeset
    99
    $socialNetwork = $config['social_network'];
7c67caaafdeb enmi 22
ymh <ymh.work@gmail.com>
parents: 1555
diff changeset
   100
7c67caaafdeb enmi 22
ymh <ymh.work@gmail.com>
parents: 1555
diff changeset
   101
    if($socialNetwork == "Twitter") {
233
10d6fd6ce9ab - put all in a registry
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 229
diff changeset
   102
1557
7c67caaafdeb enmi 22
ymh <ymh.work@gmail.com>
parents: 1555
diff changeset
   103
        $twitterClient = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);
7c67caaafdeb enmi 22
ymh <ymh.work@gmail.com>
parents: 1555
diff changeset
   104
        $token = $twitterClient->oauth('oauth/request_token', array('oauth_callback' => URL_ROOT."callback.php?rep=$req_rep"));
7c67caaafdeb enmi 22
ymh <ymh.work@gmail.com>
parents: 1555
diff changeset
   105
7c67caaafdeb enmi 22
ymh <ymh.work@gmail.com>
parents: 1555
diff changeset
   106
        $_SESSION['TWITTER_REQUEST_TOKEN'] = serialize($token);
1427
8b3d57a519eb remove dependency to Zend 1. Use composer to reduce the number of dependencies
ymh <ymh.work@gmail.com>
parents: 1425
diff changeset
   107
1557
7c67caaafdeb enmi 22
ymh <ymh.work@gmail.com>
parents: 1555
diff changeset
   108
        /**
7c67caaafdeb enmi 22
ymh <ymh.work@gmail.com>
parents: 1555
diff changeset
   109
        * Now redirect user to Twitter site so they can log in and
7c67caaafdeb enmi 22
ymh <ymh.work@gmail.com>
parents: 1555
diff changeset
   110
        * approve our access
7c67caaafdeb enmi 22
ymh <ymh.work@gmail.com>
parents: 1555
diff changeset
   111
        */
0
4eba9c11703f first import
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
   112
1557
7c67caaafdeb enmi 22
ymh <ymh.work@gmail.com>
parents: 1555
diff changeset
   113
        $url = $twitterClient->url('oauth/authorize', array('oauth_token' => $token['oauth_token']));
7c67caaafdeb enmi 22
ymh <ymh.work@gmail.com>
parents: 1555
diff changeset
   114
        header("Location: ".$url);
7c67caaafdeb enmi 22
ymh <ymh.work@gmail.com>
parents: 1555
diff changeset
   115
        die();
7c67caaafdeb enmi 22
ymh <ymh.work@gmail.com>
parents: 1555
diff changeset
   116
    } else if($socialNetwork == "Mastodon") {
7c67caaafdeb enmi 22
ymh <ymh.work@gmail.com>
parents: 1555
diff changeset
   117
        $mastodonApi = new Api($loginDomain);
7c67caaafdeb enmi 22
ymh <ymh.work@gmail.com>
parents: 1555
diff changeset
   118
7c67caaafdeb enmi 22
ymh <ymh.work@gmail.com>
parents: 1555
diff changeset
   119
        $cachedApp = $appCacheHandle->querySingle("");
7c67caaafdeb enmi 22
ymh <ymh.work@gmail.com>
parents: 1555
diff changeset
   120
        $statement = $cachedApp->prepare('SELECT * FROM apps WHERE domain = :domain;');
7c67caaafdeb enmi 22
ymh <ymh.work@gmail.com>
parents: 1555
diff changeset
   121
        $statement->bindValue(':domain', $loginDomain);
7c67caaafdeb enmi 22
ymh <ymh.work@gmail.com>
parents: 1555
diff changeset
   122
7c67caaafdeb enmi 22
ymh <ymh.work@gmail.com>
parents: 1555
diff changeset
   123
$result = $statement->execute();
7c67caaafdeb enmi 22
ymh <ymh.work@gmail.com>
parents: 1555
diff changeset
   124
            // Create app
7c67caaafdeb enmi 22
ymh <ymh.work@gmail.com>
parents: 1555
diff changeset
   125
        $appsDef = $mastodonApi->apps()->create("PolemicToot", URL_ROOT."callback.php?rep=$req_rep", 'read write push');
7c67caaafdeb enmi 22
ymh <ymh.work@gmail.com>
parents: 1555
diff changeset
   126
        var_dump($appsDef);
7c67caaafdeb enmi 22
ymh <ymh.work@gmail.com>
parents: 1555
diff changeset
   127
        //$mastodonApi->logIn();
7c67caaafdeb enmi 22
ymh <ymh.work@gmail.com>
parents: 1555
diff changeset
   128
    }
1427
8b3d57a519eb remove dependency to Zend 1. Use composer to reduce the number of dependencies
ymh <ymh.work@gmail.com>
parents: 1425
diff changeset
   129
};
119
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   130
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   131
/**
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   132
 * TRADUCTION
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   133
**/
294
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   134
function get_config_translations($config) {
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   135
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   136
    $fr = array();
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   137
    $en = array();
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   138
    $jp = array();
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
    $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
   141
    /**
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   142
     * 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
   143
     * 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
   144
     */
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   145
    foreach ($config as $key => $value) {
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   146
        $translation_key = "config__$key";
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
        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
   149
            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
   150
                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
   151
                    $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
   152
                }
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   153
                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
   154
                    $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
   155
                }
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   156
            }
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   157
            else {
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   158
                $lang_array[$translation_key] = $value;
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   159
            }
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   160
        }
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   161
    }
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   162
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   163
    return $array_loop;
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   164
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   165
}
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   166
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   167
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
   168
294
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   169
    $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
   170
294
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   171
    // 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
   172
    $locale = $translate->getLocale();
1198
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1196
diff changeset
   173
294
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   174
    $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
   175
    $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
   176
    $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
   177
294
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   178
    // set the locale back
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   179
    $translate->setLocale($locale);
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   180
}
119
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   181
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   182
1427
8b3d57a519eb remove dependency to Zend 1. Use composer to reduce the number of dependencies
ymh <ymh.work@gmail.com>
parents: 1425
diff changeset
   183
// use Translator;
8b3d57a519eb remove dependency to Zend 1. Use composer to reduce the number of dependencies
ymh <ymh.work@gmail.com>
parents: 1425
diff changeset
   184
include './Translator.php';
8b3d57a519eb remove dependency to Zend 1. Use composer to reduce the number of dependencies
ymh <ymh.work@gmail.com>
parents: 1425
diff changeset
   185
$translate = new Translator();
119
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   186
291
db1e6bfaa54e add translation for config data
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 287
diff changeset
   187
988
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   188
$translate->addTranslation($traduction_en, 'en');
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   189
$translate->addTranslation($traduction_ja, 'ja_JP');
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   190
$translate->addTranslation($traduction_fr, 'fr');
119
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   191
291
db1e6bfaa54e add translation for config data
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 287
diff changeset
   192
if(isset($config)) {
294
106c4ec894aa new version for todai forum
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 291
diff changeset
   193
    set_config_translations($config, $translate);
291
db1e6bfaa54e add translation for config data
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 287
diff changeset
   194
}
1198
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1196
diff changeset
   195
119
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   196
$actual = $translate->getLocale();
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
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   199
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
   200
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
   201
    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
   202
        $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
   203
         $_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
   204
    }
1198
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1196
diff changeset
   205
119
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   206
} 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
   207
    $translate->setLocale($_GET['lang']);
119
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   208
    $_SESSION['lang'] = $_GET['lang'];
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   209
    $actual = $_SESSION['lang'];
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   210
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   211
} 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
   212
    $translate->setLocale( $_SESSION['lang']);
119
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   213
    $actual = $_SESSION['lang'];
1198
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1196
diff changeset
   214
119
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   215
}
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   216
229
74c9ddc3640b a lot of changes in the web file organization.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 227
diff changeset
   217
$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
   218
    '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
   219
        '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
   220
        '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
   221
        '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
   222
        '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
   223
        '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
   224
        '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
   225
        '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
   226
        '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
   227
        'jquery-tools' 	=> URL_ROOT.'res/js/jquery.tools.min.js',
1514
5869151a1f2f Upgrade various js dependencies
ymh <ymh.work@gmail.com>
parents: 1509
diff changeset
   228
        'jquery-migrate' => URL_ROOT.'res/js/jquery-migrate-1.4.1.min.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
   229
        '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
   230
        '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
   231
        '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
   232
        '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
   233
        'underscore'    => URL_ROOT.'res/js/underscore-min.js' ,
1514
5869151a1f2f Upgrade various js dependencies
ymh <ymh.work@gmail.com>
parents: 1509
diff changeset
   234
        'jquery-scrollto'=>URL_ROOT.'res/js/jquery.scrollTo-2.1.2-min.js' ,
534
0a2505c3b547 New metadata player and big directory reorganization
Raphael Velt <raph.velt@gmail.com>
parents: 525
diff changeset
   235
        '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
   236
        'semanticboard' => URL_ROOT.'res/js/semanticboard.js' ,
598
d366aa22bd79 New Metadataplayer version
Raphael Velt <raph.velt@gmail.com>
parents: 597
diff changeset
   237
        'metadataplayer'=> URL_ROOT.'res/metadataplayer/LdtPlayer-core.js' ,
d366aa22bd79 New Metadataplayer version
Raphael Velt <raph.velt@gmail.com>
parents: 597
diff changeset
   238
        'ldtwidgets'    => URL_ROOT.'res/metadataplayer/' ,
656
635a86f25fe7 First tests for PT Protocol implementation
Raphael Velt <raph.velt@gmail.com>
parents: 633
diff changeset
   239
        'tracemanager'  => URL_ROOT.'res/js/tracemanager.js' ,
988
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   240
        '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
   241
        '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
   242
        'tinymce'        => URL_ROOT.'res/js/tinymce/tinymce.min.js',
1368
0ae5202742bd change flash to dash
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1366
diff changeset
   243
        'dashjs'         => URL_ROOT.'res/js/dashjs/dash.min.js',
0ae5202742bd change flash to dash
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1366
diff changeset
   244
        'videojs-dash'   => URL_ROOT.'res/js/dashjs/videojs-dash.min.js',
0ae5202742bd change flash to dash
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1366
diff changeset
   245
        'videojs'        => URL_ROOT.'res/js/videojs/video.min.js',
1499
641ced48fd5a Improve counter display in client by using twitter-text
ymh <ymh.work@gmail.com>
parents: 1494
diff changeset
   246
        'twitter-text'   => URL_ROOT.'res/js/twitter-text-3.0.1.min.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
   247
    ),
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
    'cdn' => array(
534
0a2505c3b547 New metadata player and big directory reorganization
Raphael Velt <raph.velt@gmail.com>
parents: 525
diff changeset
   249
        '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
   250
        '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
   251
        'raphael' 		=> URL_ROOT.'res/js/raphael-min.js',
1514
5869151a1f2f Upgrade various js dependencies
ymh <ymh.work@gmail.com>
parents: 1509
diff changeset
   252
        'jquery-ui' 	=> 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.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
   253
        '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
   254
        '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
   255
        '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
   256
        '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
   257
        'jquery-tools' 	=> 'http://cdn.jquerytools.org/1.2.7/all/jquery.tools.min.js',
1514
5869151a1f2f Upgrade various js dependencies
ymh <ymh.work@gmail.com>
parents: 1509
diff changeset
   258
        'jquery-migrate' => 'http://code.jquery.com/jquery-migrate-1.4.1.min.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
   259
        '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
   260
        '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
   261
        '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
   262
        '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
   263
        'underscore'    => URL_ROOT.'res/js/underscore-min.js' ,
1514
5869151a1f2f Upgrade various js dependencies
ymh <ymh.work@gmail.com>
parents: 1509
diff changeset
   264
        'jquery-scrollto'=>URL_ROOT.'res/js/jquery.scrollTo-2.1.2-min.js' ,
534
0a2505c3b547 New metadata player and big directory reorganization
Raphael Velt <raph.velt@gmail.com>
parents: 525
diff changeset
   265
        '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
   266
        'semanticboard' => URL_ROOT.'res/js/semanticboard.js' ,
598
d366aa22bd79 New Metadataplayer version
Raphael Velt <raph.velt@gmail.com>
parents: 597
diff changeset
   267
        'metadataplayer'=> URL_ROOT.'res/metadataplayer/LdtPlayer-core.js' ,
d366aa22bd79 New Metadataplayer version
Raphael Velt <raph.velt@gmail.com>
parents: 597
diff changeset
   268
        'ldtwidgets'    => URL_ROOT.'res/metadataplayer/' ,
656
635a86f25fe7 First tests for PT Protocol implementation
Raphael Velt <raph.velt@gmail.com>
parents: 633
diff changeset
   269
        'tracemanager'  => URL_ROOT.'res/js/tracemanager.js' ,
988
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   270
        '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
   271
        '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
   272
        'tinymce'        => URL_ROOT.'res/js/tinymce/tinymce.min.js',
1368
0ae5202742bd change flash to dash
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1366
diff changeset
   273
        'dashjs'         => "http://cdn.dashjs.org/latest/dash.all.min.js",
0ae5202742bd change flash to dash
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1366
diff changeset
   274
        'videojs-dash'   => 'https://cdnjs.cloudflare.com/ajax/libs/videojs-contrib-dash/2.5.2/videojs-dash.min.js',
0ae5202742bd change flash to dash
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1366
diff changeset
   275
        'videojs'        => 'http://vjs.zencdn.net/5.12.6/video.js',
1499
641ced48fd5a Improve counter display in client by using twitter-text
ymh <ymh.work@gmail.com>
parents: 1494
diff changeset
   276
        'twitter-text'   => URL_ROOT.'res/js/twitter-text-3.0.1.min.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
   277
    )
229
74c9ddc3640b a lot of changes in the web file organization.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 227
diff changeset
   278
);
143
2a3599a4b0f7 add #enmi page and some litlle corrections
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 119
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
$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
   281
    '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
   282
        '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
   283
        '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
   284
    ),
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
    '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
   286
        '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
   287
        '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
   288
    )
229
74c9ddc3640b a lot of changes in the web file organization.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 227
diff changeset
   289
);
216
d8c1b7e00533 sig chi paris 2011
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 207
diff changeset
   290
233
10d6fd6ce9ab - put all in a registry
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 229
diff changeset
   291
10d6fd6ce9ab - put all in a registry
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 229
diff changeset
   292
$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
   293
    '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
   294
       	'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
   295
        '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
   296
        '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
   297
        '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
   298
        '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
   299
        '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
   300
        '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
   301
        '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
   302
        '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
   303
        '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
   304
        'archives-iframe' => URL_ROOT.'res/css/archives-iframe.css',
598
d366aa22bd79 New Metadataplayer version
Raphael Velt <raph.velt@gmail.com>
parents: 597
diff changeset
   305
        '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
   306
        'jquery-te' => URL_ROOT.'res/css/jquery-te.css',
1368
0ae5202742bd change flash to dash
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1366
diff changeset
   307
        'videojs' => URL_ROOT.'res/js/videojs/video-js.min.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
   308
    ),
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
    '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
   310
        '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
   311
        '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
   312
        '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
   313
        '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
   314
        '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
   315
        '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
   316
        '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
   317
        '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
   318
        '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
   319
        '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
   320
        '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
   321
        '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
   322
        'jquery-te' => URL_ROOT.'res/css/jquery-te.css',
1368
0ae5202742bd change flash to dash
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1366
diff changeset
   323
        'videojs' => "http://vjs.zencdn.net/5.12.6/video-js.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
   324
    )
233
10d6fd6ce9ab - put all in a registry
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 229
diff changeset
   325
);
10d6fd6ce9ab - put all in a registry
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 229
diff changeset
   326
229
74c9ddc3640b a lot of changes in the web file organization.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 227
diff changeset
   327
74c9ddc3640b a lot of changes in the web file organization.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 227
diff changeset
   328
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
   329
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
   330
    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
   331
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
   332
    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
   333
        $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
   334
    }
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
   335
    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
   336
        $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
   337
    }
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
    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
   339
        $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
   340
    }
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
   341
    $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
   342
    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
   343
        $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
   344
74c9ddc3640b a lot of changes in the web file organization.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 227
diff changeset
   345
}
74c9ddc3640b a lot of changes in the web file organization.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 227
diff changeset
   346
1295
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   347
function get_default_annotations_config($config, $translate) {
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   348
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   349
    $default_protocol_annotations = array(
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   350
        "1" => array(
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   351
            "default" => array(
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   352
                "colors" => array(
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   353
                    "h" => 0,
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   354
                    "s" => 0
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   355
                )
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   356
            ),
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   357
            "positive" => array(
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   358
                "display_name" => "++ | Agree",
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   359
                "keywords" => "\\+\\+",
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   360
                "colors" => array(
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   361
                    "h" => .3,
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   362
                    "s" => .65
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   363
                ),
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   364
                "colors_class" => "twbGreen",
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   365
                "polemic_cat" => 'OK',
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   366
                "polemic_keywords" => array("++"),
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   367
                "polemic_color" => "#1D973D"
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   368
            ),
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   369
            "negative" => array(
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   370
                "display_name" => "-- | Disagree",
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   371
                "keywords" => "\\-\\-",
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   372
                "colors" => array(
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   373
                    "h" => 0,
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   374
                    "s" => .8
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   375
                ),
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   376
                "colors_class" => "twbRed",
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   377
                "polemic_cat" => 'KO',
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   378
                "polemic_keywords" => array("--"),
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   379
                "polemic_color" => "#CE0A15"
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   380
            ),
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   381
            "reference" => array(
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   382
                "display_name" => "== | Reference",
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   383
                "keywords" => "\\=\\=",
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   384
                "colors" => array(
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   385
                    "h" => .16,
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   386
                    "s" => .8
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   387
                ),
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   388
                "colors_class" => "twbYellow",
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   389
                "polemic_cat" => 'REF',
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   390
                "polemic_keywords" => array("==","http://"),
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   391
                "polemic_color" => "#C5A62D"
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   392
            ),
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   393
            "question" => array(
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   394
                "display_name" => "?? | Question",
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   395
                "keywords" => "\\?\\?",
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   396
                "colors" => array(
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   397
                    "h" => .6,
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   398
                    "s" => .8
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   399
                ),
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   400
                "colors_class" => "twbBlue",
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   401
                "polemic_cat" => 'Q',
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   402
                "polemic_keywords" => array("?","??"),
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   403
                "polemic_color" => "#036AAE"
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   404
            )
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   405
        ),
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   406
        "2" => array(
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   407
            "default" => array(
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   408
                "colors" => array(
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   409
                    "h" => 0,
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   410
                    "s" => 0
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   411
                )
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   412
            ),
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   413
            "positive" => array(
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   414
                "display_name" => "++ | Remember",
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   415
                "keywords" => "\\+\\+",
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   416
                "colors" => array(
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   417
                    "h" => .3,
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   418
                    "s" => .65
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   419
                ),
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   420
                "colors_class" => "twbGreen",
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   421
                "polemic_cat" => 'OK',
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   422
                "polemic_keywords" => array("++"),
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   423
                "polemic_color" => "#1D973D"
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   424
            ),
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   425
            "negative" => array(
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   426
                "display_name" => "!! | Discuss",
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   427
                "keywords" => "\\!\\!",
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   428
                "colors" => array(
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   429
                    "h" => 0,
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   430
                    "s" => .8
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   431
                ),
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   432
                "colors_class" => "twbRed",
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   433
                "polemic_cat" => 'KO',
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   434
                "polemic_keywords" => array("!!"),
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   435
                "polemic_color" => "#CE0A15"
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   436
            ),
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   437
            "reference" => array(
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   438
                "display_name" => "== | Reference",
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   439
                "keywords" => "\\=\\=",
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   440
                "colors" => array(
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   441
                    "h" => .16,
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   442
                    "s" => .8
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   443
                ),
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   444
                "colors_class" => "twbYellow",
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   445
                "polemic_cat" => 'REF',
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   446
                "polemic_keywords" => array("==","http://"),
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   447
                "polemic_color" => "#C5A62D"
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   448
            ),
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   449
            "question" => array(
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   450
                "display_name" => "?? | Question",
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   451
                "keywords" => "\\?\\?",
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   452
                "colors" => array(
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   453
                    "h" => .6,
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   454
                    "s" => .8
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   455
                ),
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   456
                "colors_class" => "twbBlue",
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   457
                "polemic_cat" => 'Q',
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   458
                "polemic_keywords" => array("?","??"),
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   459
                "polemic_color" => "#036AAE"
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   460
            )
1436
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   461
        ),
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   462
        "3" => array(
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   463
            "default" => array(
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   464
                "colors" => array(
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   465
                    "h" => 0,
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   466
                    "s" => 0
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   467
                )
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   468
            ),
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   469
            "important" => array( // blue
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   470
                "display_name" => "++ | Important",
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   471
                "keywords" => "\\+\\+",
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   472
                "colors" => array(
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   473
                    "h" => .6,
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   474
                    "s" => .8
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   475
                ),
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   476
                "polemic_cat" => 'OK',
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   477
                "polemic_keywords" => array("++"),
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   478
                "polemic_color" => "#196be6"
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   479
            ),
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   480
            "trouble" => array( // orange
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   481
                "display_name" => "?? | Trouble", 
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   482
                "keywords" => "\\?\\?",
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   483
                "colors" => array(
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   484
                    "h" => .13,
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   485
                    "s" => .8
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   486
                ),
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   487
                "polemic_cat" => 'KO',
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   488
                "polemic_keywords" => array("??"),
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   489
                "polemic_color" => "#e6b919"
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   490
            ),
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   491
            "index" => array( // violet
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   492
                "display_name" => "** | Index",
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   493
                "keywords" => "\\*\\*",
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   494
                "colors" => array(
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   495
                    "h" => .83,
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   496
                    "s" => .8
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   497
                ),
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   498
                "polemic_cat" => 'REF',
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   499
                "polemic_keywords" => array("**","http://"),
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   500
                "polemic_color" => "#e619e6"
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   501
            ),
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   502
            "comments" => array( // green
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   503
                "display_name" => "== | Comment",
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   504
                "keywords" => "\\=\\=",
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   505
                "colors" => array(
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   506
                    "h" => .3,
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   507
                    "s" => .65
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   508
                ),
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   509
                "polemic_cat" => 'Q',
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   510
                "polemic_keywords" => array("=="),
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   511
                "polemic_color" => "#42e619"
b3d23c1b791e Add hypothes.is protocol
ymh <ymh.work@gmail.com>
parents: 1435
diff changeset
   512
            )
1295
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   513
        )
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   514
    );
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   515
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   516
    $annotation_protocol_version = isset($config['annotation_protocol_version'])?$config['annotation_protocol_version']:"1";
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   517
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   518
    $annotations_def = (isset($config['annotations']) && !empty($config['annotations']))?$config['annotations']:$default_protocol_annotations[$annotation_protocol_version];
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   519
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   520
    $annotations = array();
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   521
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   522
    foreach ($annotations_def as $annot_cat => $annot_def) {
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   523
        if(isset($annot_def['display_name'])) {
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   524
            $disp_parts = array_map('trim',explode("|",$annot_def['display_name']));
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   525
            if(count($disp_parts) > 1) {
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   526
                $disp_parts[1] = $translate->_($disp_parts[1]);
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   527
            }
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   528
            $annot_def['display_name'] = implode(" | ", $disp_parts);
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   529
        }
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   530
        $annotations[$annot_cat] = $annot_def;
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   531
    }
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   532
    return $annotations;
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   533
}
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   534
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   535
291
db1e6bfaa54e add translation for config data
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 287
diff changeset
   536
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
   537
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
   538
    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
   539
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
   540
    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
   541
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
   542
    $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
   543
    $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
   544
    $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
   545
    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
   546
        $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
   547
    }
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
    $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
   549
    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
   550
        $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
   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
    $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
   553
    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
   554
        $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
   555
    }
119
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   556
4c86151704e9 -TRADUCTION
Samuel Huron <samuel.huron@centrepompidou.fr>
parents: 99
diff changeset
   557
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
   558
    $res  = "<div id=\"$id\" class=\"archivesVideoBox\">\n";
1412
8e51c6b8815f publish enmi17 sessions
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1408
diff changeset
   559
    $res .= "    <a href=\"$rep/polemicaltimeline.php$hash\" title=\"$archive_title\">\n";
8e51c6b8815f publish enmi17 sessions
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1408
diff changeset
   560
    $res .= "        <img src=\"$url_root$rep/$tail_img\" width=\"270\" height=\"150\" class=\"AVBimg\" title=\"$archive_title\" />";
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
   561
    $res .= "    </a>";
1412
8e51c6b8815f publish enmi17 sessions
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1408
diff changeset
   562
    $res .= "    <div class=\"AVBtitle\" title=\"$archive_title\">$archive_title</div>\n";
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
   563
    $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
   564
    $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
   565
    $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
   566
    $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
   567
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
   568
    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
   569
74c9ddc3640b a lot of changes in the web file organization.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 227
diff changeset
   570
}
74c9ddc3640b a lot of changes in the web file organization.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 227
diff changeset
   571
291
db1e6bfaa54e add translation for config data
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 287
diff changeset
   572
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
   573
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1196
diff changeset
   574
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
   575
    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
   576
        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
   577
            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
   578
        }
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
   579
        $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
   580
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
   581
        $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
   582
        $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
   583
        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
   584
            $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
   585
            $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
   586
        }
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
   587
        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
   588
        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
   589
            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
   590
        }
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
   591
    }
229
74c9ddc3640b a lot of changes in the web file organization.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 227
diff changeset
   592
}
74c9ddc3640b a lot of changes in the web file organization.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 227
diff changeset
   593
684
f59daf0830d2 less naive implementation of common LDT platform URL
Raphael Velt <raph.velt@gmail.com>
parents: 683
diff changeset
   594
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
   595
    global $project_url_base;
684
f59daf0830d2 less naive implementation of common LDT platform URL
Raphael Velt <raph.velt@gmail.com>
parents: 683
diff changeset
   596
    if (preg_match('/^https?:\/\//', $metadata)) {
f59daf0830d2 less naive implementation of common LDT platform URL
Raphael Velt <raph.velt@gmail.com>
parents: 683
diff changeset
   597
        return $metadata;
f59daf0830d2 less naive implementation of common LDT platform URL
Raphael Velt <raph.velt@gmail.com>
parents: 683
diff changeset
   598
    } else {
1244
87583b020202 put ldt platform url in config
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1242
diff changeset
   599
        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
   600
    }
f59daf0830d2 less naive implementation of common LDT platform URL
Raphael Velt <raph.velt@gmail.com>
parents: 683
diff changeset
   601
}
229
74c9ddc3640b a lot of changes in the web file organization.
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 227
diff changeset
   602
684
f59daf0830d2 less naive implementation of common LDT platform URL
Raphael Velt <raph.velt@gmail.com>
parents: 683
diff changeset
   603
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
   604
    if (is_array($metadata)) {
f59daf0830d2 less naive implementation of common LDT platform URL
Raphael Velt <raph.velt@gmail.com>
parents: 683
diff changeset
   605
        $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
   606
        return $metadata;
f59daf0830d2 less naive implementation of common LDT platform URL
Raphael Velt <raph.velt@gmail.com>
parents: 683
diff changeset
   607
    } else {
f59daf0830d2 less naive implementation of common LDT platform URL
Raphael Velt <raph.velt@gmail.com>
parents: 683
diff changeset
   608
        return get_metadata_url($metadata);
f59daf0830d2 less naive implementation of common LDT platform URL
Raphael Velt <raph.velt@gmail.com>
parents: 683
diff changeset
   609
    }
f59daf0830d2 less naive implementation of common LDT platform URL
Raphael Velt <raph.velt@gmail.com>
parents: 683
diff changeset
   610
}
988
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   611
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   612
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   613
$realm = 'Polemictweet restricted area';
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   614
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
   615
988
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   616
function authenticate($users, $translate) {
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   617
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
   618
    global $realm;
1198
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1196
diff changeset
   619
1295
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   620
    $_SESSION['auth'] = 'polemictweet';
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   621
    return array('username'=>'polemictweet');
1198
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1196
diff changeset
   622
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
   623
    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
   624
        $_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
   625
        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
   626
        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
   627
        '",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
   628
        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
   629
    }
988
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   630
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   631
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
   632
    //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
   633
    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
   634
        !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
   635
        $_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
   636
        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
   637
        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
   638
        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
   639
    }
988
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   640
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   641
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
   642
    //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
   643
    $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
   644
    $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
   645
    $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
   646
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
   647
    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
   648
        $_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
   649
        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
   650
        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
   651
        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
   652
    }
988
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   653
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
   654
    // 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
   655
    $_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
   656
    return $data;
988
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   657
}
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   658
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   659
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
   660
    global $realm;
1198
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1196
diff changeset
   661
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
   662
    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
   663
    unset($_SESSION['http_digest_nonce']);
988
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   664
}
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   665
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   666
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   667
//function to parse the http auth header
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   668
function http_digest_parse($txt)
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   669
{
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
   670
    // 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
   671
    $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
   672
    $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
   673
    $keys = implode('|', array_keys($needed_parts));
988
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   674
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
   675
    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
   676
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
   677
    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
   678
        $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
   679
        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
   680
    }
988
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   681
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
   682
    return $needed_parts ? false : $data;
988
954019f62866 update lib,
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 985
diff changeset
   683
}
1006
bb98a0de3bfd sanitize filenames for hardheaded users
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1003
diff changeset
   684
bb98a0de3bfd sanitize filenames for hardheaded users
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1003
diff changeset
   685
/**
bb98a0de3bfd sanitize filenames for hardheaded users
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1003
diff changeset
   686
 * 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
   687
 */
bb98a0de3bfd sanitize filenames for hardheaded users
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1003
diff changeset
   688
function slugify($text)
bb98a0de3bfd sanitize filenames for hardheaded users
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1003
diff changeset
   689
{
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
   690
    // replace non letter or digits by -
1423
a6ed32f6dbcf add 2018 preparatoire
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1414
diff changeset
   691
    $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
   692
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
   693
    // 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
   694
    $text = trim($text, '-');
1006
bb98a0de3bfd sanitize filenames for hardheaded users
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1003
diff changeset
   695
1423
a6ed32f6dbcf add 2018 preparatoire
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1414
diff changeset
   696
    $transliterator = Transliterator::create(
a6ed32f6dbcf add 2018 preparatoire
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1414
diff changeset
   697
        'NFD; [:Nonspacing Mark:] Remove; NFC;'
a6ed32f6dbcf add 2018 preparatoire
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1414
diff changeset
   698
    );
a6ed32f6dbcf add 2018 preparatoire
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1414
diff changeset
   699
    $text = $transliterator->transliterate($text);
1006
bb98a0de3bfd sanitize filenames for hardheaded users
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1003
diff changeset
   700
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
   701
    // 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
   702
    $text = strtolower($text);
1006
bb98a0de3bfd sanitize filenames for hardheaded users
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1003
diff changeset
   703
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
   704
    // 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
   705
    $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
   706
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
   707
    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
   708
    {
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
   709
        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
   710
    }
1006
bb98a0de3bfd sanitize filenames for hardheaded users
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1003
diff changeset
   711
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
   712
    return $text;
1006
bb98a0de3bfd sanitize filenames for hardheaded users
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1003
diff changeset
   713
}
bb98a0de3bfd sanitize filenames for hardheaded users
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1003
diff changeset
   714
bb98a0de3bfd sanitize filenames for hardheaded users
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1003
diff changeset
   715
bb98a0de3bfd sanitize filenames for hardheaded users
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1003
diff changeset
   716
// 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
   717
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
   718
    // 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
   719
    // 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
   720
    // 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
   721
    // 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
   722
    // 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
   723
    $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
   724
            'Š'=>'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
   725
            'Å'=>'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
   726
            'Ï'=>'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
   727
            'Û'=>'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
   728
            'å'=>'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
   729
            'ï'=>'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
   730
            'ú'=>'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
   731
    );
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
   732
    $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
   733
    // 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
   734
    $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
   735
    $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
   736
    $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
   737
    $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
   738
    $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
   739
    $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
   740
    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
   741
    {
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
   742
        $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
   743
    }
1198
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1196
diff changeset
   744
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
   745
    return strtolower($f);
1006
bb98a0de3bfd sanitize filenames for hardheaded users
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1003
diff changeset
   746
}
1295
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   747
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   748
function rgb2hex($rgb) {
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   749
   $hex = "#";
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   750
   $hex .= str_pad(dechex($rgb[0]), 2, "0", STR_PAD_LEFT);
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   751
   $hex .= str_pad(dechex($rgb[1]), 2, "0", STR_PAD_LEFT);
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   752
   $hex .= str_pad(dechex($rgb[2]), 2, "0", STR_PAD_LEFT);
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   753
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   754
   return $hex; // returns the hex value including the number sign (#)
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   755
}
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   756
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   757
function hsl2Rgb( $h, $s, $l ){
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   758
    $r;
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   759
    $g;
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   760
    $b;
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   761
	$c = ( 1 - abs( 2 * $l - 1 ) ) * $s;
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   762
	$x = $c * ( 1 - abs( fmod( ( $h / 60 ), 2 ) - 1 ) );
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   763
	$m = $l - ( $c / 2 );
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   764
	if ( $h < 60 ) {
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   765
		$r = $c;
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   766
		$g = $x;
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   767
		$b = 0;
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   768
	} else if ( $h < 120 ) {
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   769
		$r = $x;
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   770
		$g = $c;
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   771
		$b = 0;
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   772
	} else if ( $h < 180 ) {
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   773
		$r = 0;
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   774
		$g = $c;
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   775
		$b = $x;
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   776
	} else if ( $h < 240 ) {
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   777
		$r = 0;
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   778
		$g = $x;
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   779
		$b = $c;
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   780
	} else if ( $h < 300 ) {
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   781
		$r = $x;
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   782
		$g = 0;
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   783
		$b = $c;
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   784
	} else {
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   785
		$r = $c;
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   786
		$g = 0;
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   787
		$b = $x;
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   788
	}
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   789
	$r = ( $r + $m ) * 255;
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   790
	$g = ( $g + $m ) * 255;
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   791
	$b = ( $b + $m  ) * 255;
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   792
    return array( floor( $r ), floor( $g ), floor( $b ) );
03d2aa7b4967 change default protocol
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 1293
diff changeset
   793
}