13 |
13 |
14 |
14 |
15 /** |
15 /** |
16 * Do we already have a valid Access Token or need to go get one? |
16 * Do we already have a valid Access Token or need to go get one? |
17 */ |
17 */ |
18 if (!isset($_SESSION['TWITTER_ACCESS_TOKEN']) && isset($_GET['CONNECT']) ) { |
18 if (!isset($_SESSION['SOCIAL_ACCESS_TOKEN']) && isset($_GET['CONNECT']) ) { |
19 // /** |
19 // /** |
20 // * Guess we need to go get one! |
20 // * Guess we need to go get one! |
21 // */ |
21 // */ |
22 // $token = $consumer->getRequestToken(); |
22 // $token = $consumer->getRequestToken(); |
23 // $_SESSION['TWITTER_REQUEST_TOKEN'] = serialize($token); |
23 // $_SESSION['TWITTER_REQUEST_TOKEN'] = serialize($token); |
25 // /** |
25 // /** |
26 // * Now redirect user to Twitter site so they can log in and |
26 // * Now redirect user to Twitter site so they can log in and |
27 // * approve our access |
27 // * approve our access |
28 // */ |
28 // */ |
29 // $consumer->redirect(); |
29 // $consumer->redirect(); |
30 $get_twitter_request_token(); |
30 $socialDomain = $_GET['CONNECT']; |
|
31 $get_social_request_token($socialDomain, $config); |
31 } else { |
32 } else { |
32 if (isset($_SESSION['TWITTER_REDIRECT_URL'])) { |
33 if (isset($_SESSION['TWITTER_REDIRECT_URL'])) { |
33 unset($_SESSION['TWITTER_REDIRECT_URL']); |
34 unset($_SESSION['TWITTER_REDIRECT_URL']); |
34 } |
35 } |
35 } |
36 } |
49 $embed_video = isset($_REQUEST['embed_video']) ? |
50 $embed_video = isset($_REQUEST['embed_video']) ? |
50 boolval($_REQUEST['embed_video']) : |
51 boolval($_REQUEST['embed_video']) : |
51 (isset($config['islive_embed']) && $config['islive_embed']) || (isset($config['islive']) && $config['islive']); |
52 (isset($config['islive_embed']) && $config['islive_embed']) || (isset($config['islive']) && $config['islive']); |
52 $videoWidth = ( $embed ? 412 : 480 ); |
53 $videoWidth = ( $embed ? 412 : 480 ); |
53 $videoHeight = ( $embed ? 280 : 320 ); |
54 $videoHeight = ( $embed ? 280 : 320 ); |
54 if ($embed && !isset($_SESSION['TWITTER_ACCESS_TOKEN']) && (isset($_REQUEST['auth_redirect']) || isset($_SERVER['HTTP_REFERER']))) { |
55 if ($embed && !isset($_SESSION['SOCIAL_ACCESS_TOKEN']) && (isset($_REQUEST['auth_redirect']) || isset($_SERVER['HTTP_REFERER']))) { |
55 $_SESSION['TWITTER_REDIRECT_URL'] = isset($_REQUEST['auth_redirect']) ? $_REQUEST['auth_redirect'] : $_SERVER['HTTP_REFERER']; |
56 $_SESSION['TWITTER_REDIRECT_URL'] = isset($_REQUEST['auth_redirect']) ? $_REQUEST['auth_redirect'] : $_SERVER['HTTP_REFERER']; |
56 }; |
57 }; |
57 |
58 |
58 $defaultAnnotations = get_default_annotations_config($config, $translate); |
59 $defaultAnnotations = get_default_annotations_config($config, $translate); |
59 $annotations = array(); |
60 $annotations = array(); |
72 <html lang="<?php echo($actual); ?>"> |
73 <html lang="<?php echo($actual); ?>"> |
73 <head> |
74 <head> |
74 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
75 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
75 <title>Polemic Tweet — <?php echo($translate->_('config__title')); ?></title> |
76 <title>Polemic Tweet — <?php echo($translate->_('config__title')); ?></title> |
76 <meta http-equiv="X-UA-Compatible" content="IE=9" /> |
77 <meta http-equiv="X-UA-Compatible" content="IE=9" /> |
77 |
78 <link rel="icon" type="image/x-icon" href="<?php echo(URL_ROOT); ?>images/favico.png"> |
78 <!-- FONT --> |
79 <!-- FONT --> |
79 <link href='<?php echo(registry_url('PT-Sans_Narrow','font'))?>' rel='stylesheet' type='text/css'> |
80 <link href='<?php echo(registry_url('PT-Sans_Narrow','font'))?>' rel='stylesheet' type='text/css'> |
80 <link href='<?php echo(registry_url('PT-Sans','font'))?>' rel='stylesheet' type='text/css'> |
81 <link href='<?php echo(registry_url('PT-Sans','font'))?>' rel='stylesheet' type='text/css'> |
81 |
82 |
82 <!-- CSS --> |
83 <!-- CSS --> |
114 continue; |
115 continue; |
115 } |
116 } |
116 $hVal = intval(($annot_def['colors']['h']<1.0)?floatval($annot_def['colors']['h']) * 360.0:$annot_def['colors']['h']); |
117 $hVal = intval(($annot_def['colors']['h']<1.0)?floatval($annot_def['colors']['h']) * 360.0:$annot_def['colors']['h']); |
117 $sVal = intval(floatval($annot_def['colors']['s']) * 100.0); |
118 $sVal = intval(floatval($annot_def['colors']['s']) * 100.0); |
118 |
119 |
119 $baseColor = "hsl($hVal, ${sVal}%, 90%)"; |
120 $baseColor = "hsl($hVal, {$sVal}%, 90%)"; |
120 $borderColor = "hsl($hVal, ${sVal}%, 60%)"; |
121 $borderColor = "hsl($hVal, {$sVal}%, 60%)"; |
121 $selectedColor = "hsl($hVal, 15%, 70%)"; |
122 $selectedColor = "hsl($hVal, 15%, 70%)"; |
122 $selectedBorderColor = "hsl($hVal, 15%, 60%)"; |
123 $selectedBorderColor = "hsl($hVal, 15%, 60%)"; |
123 $gradientColor = "hsl($hVal, ${sVal}%, 50%)"; |
124 $gradientColor = "hsl($hVal, {$sVal}%, 50%)"; |
124 ?> |
125 ?> |
125 .tweetButton.<?php echo($annot_def['colors_class']) ?> { |
126 .tweetButton.<?php echo($annot_def['colors_class']) ?> { |
126 background: <?php echo($baseColor); ?>; |
127 background: <?php echo($baseColor); ?>; |
127 border: solid <?php echo($borderColor); ?> 1px; |
128 border: solid <?php echo($borderColor); ?> 1px; |
128 background-image: -webkit-linear-gradient(top, <?php echo($baseColor); ?>, <?php echo($gradientColor); ?>); |
129 background-image: -webkit-linear-gradient(top, <?php echo($baseColor); ?>, <?php echo($gradientColor); ?>); |
163 annotations[annot_cat]['keywords'] = [ new RegExp(annotations[annot_cat]['keywords']), ]; |
164 annotations[annot_cat]['keywords'] = [ new RegExp(annotations[annot_cat]['keywords']), ]; |
164 } |
165 } |
165 } |
166 } |
166 } |
167 } |
167 </script> |
168 </script> |
168 <?php if (isset($_SESSION['TWITTER_ACCESS_TOKEN'])) { ?> |
169 <?php if (isset($_SESSION['SOCIAL_ACCESS_TOKEN'])) { ?> |
169 <script type="text/javascript" src="<?php echo(registry_url('twcx-main','js'))?>"></script> |
170 <script type="text/javascript" src="<?php echo(registry_url('twcx-main','js'))?>"></script> |
170 <?php } ?> |
171 <?php } ?> |
171 |
172 |
172 <script type="text/javascript"> |
173 <script type="text/javascript"> |
173 |
174 |
180 $(document).ready(function() { |
181 $(document).ready(function() { |
181 |
182 |
182 const TWEET_LENGTH = <?php echo(TWEET_LENGTH)?>; |
183 const TWEET_LENGTH = <?php echo(TWEET_LENGTH)?>; |
183 function updateCounter() { |
184 function updateCounter() { |
184 var _v = $("#status").val(); |
185 var _v = $("#status").val(); |
|
186 if(!_v) { |
|
187 return; |
|
188 } |
185 var _tRes = twttr.txt.parseTweet(_v); |
189 var _tRes = twttr.txt.parseTweet(_v); |
186 if(_tRes.valid) { |
190 if(_tRes.valid) { |
187 $('#tweetCounter').removeClass("tweetCounterNegative"); |
191 $('#tweetCounter').removeClass("tweetCounterNegative"); |
188 $('#sendTweet').prop("disabled",false); |
192 $('#sendTweet').prop("disabled",false); |
189 $('#sendTweet').removeClass("sendTweetDisabled"); |
193 $('#sendTweet').removeClass("sendTweetDisabled"); |
487 </li> |
491 </li> |
488 </ul> |
492 </ul> |
489 </div> |
493 </div> |
490 <div id="twwWrap"> |
494 <div id="twwWrap"> |
491 <div id="tweetWriter"> |
495 <div id="tweetWriter"> |
492 <?php if (isset($_SESSION['TWITTER_ACCESS_TOKEN'])): ?> |
496 <?php if (isset($_SESSION['SOCIAL_ACCESS_TOKEN'])): ?> |
493 <div id="tweetCounter"><?php echo(TWEET_LENGTH-strlen($config['hashtag']));?></div> |
497 <div id="tweetCounter"><?php echo(TWEET_LENGTH-strlen($config['hashtag']));?></div> |
494 <?php endif;?> |
498 <?php endif;?> |
495 <h3 class="tweetWriterTitle"><?php print $translate->_("ClientTitle1 :"); ?></h3> |
499 <h3 class="tweetWriterTitle"><?php print $translate->_("ClientTitle1 :"); ?></h3> |
496 <form action="tweet.php" method="post" id="statusform" > |
500 <form action="tweet.php" method="post" id="statusform" > |
497 <?php if (!isset($_SESSION['TWITTER_ACCESS_TOKEN'])){ |
501 <?php if (!isset($_SESSION['SOCIAL_ACCESS_TOKEN'])){ |
498 echo("<div class='loginbutton'><a href='".URL_ROOT."$rep/client.php?CONNECT=true' target='_top' class='loginlink'>".$translate->_("Vous n'êtes pas connecté.")."</a></div>"); |
502 echo("<div class='loginbutton'><a href='".URL_ROOT."$rep/client.php?CONNECT=mastodon.svc.iri-research.org' target='_top' class='loginlink'>".$translate->_("Vous n'êtes pas connecté.")."</a></div>"); |
499 } else { |
503 } else { |
500 echo("<textarea name='status' id='status' rows='3' cols='50'>$config[hashtag]</textarea>"); |
504 echo("<textarea name='status' id='status' rows='3' cols='50'>$config[hashtag]</textarea>"); |
501 } |
505 } |
502 ?> |
506 ?> |
503 <div id="messageSuccess" style="background-color:lightgreen; display: none;"> |
507 <div id="messageSuccess" style="background-color:lightgreen; display: none;"> |