action.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  1. <?php
  2. /*
  3. @nom: action
  4. @auteur: Idleman (http://blog.idleman.fr)
  5. @description: Page de gestion des évenements non liés a une vue particulière (appels ajax, requetes sans resultats etc...)
  6. */
  7. if(!ini_get('safe_mode')) @set_time_limit(0);
  8. require_once("common.php");
  9. ///@TODO: déplacer dans common.php?
  10. $commandLine = 'cli'==php_sapi_name();
  11. if ($commandLine) {
  12. $action = 'commandLine';
  13. } else {
  14. $action = @$_['action'];
  15. }
  16. ///@TODO: pourquoi ne pas refuser l'accès dès le début ?
  17. Plugin::callHook("action_pre_case", array(&$_,$myUser));
  18. //Execution du code en fonction de l'action
  19. switch ($action){
  20. case 'commandLine':
  21. case 'synchronize':
  22. require_once("SimplePie.class.php");
  23. $syncCode = $configurationManager->get('synchronisationCode');
  24. $syncGradCount = $configurationManager->get('syncGradCount');
  25. if ( false==$myUser
  26. && !$commandLine
  27. && !(isset($_['code'])
  28. && $configurationManager->get('synchronisationCode')!=null
  29. && $_['code']==$configurationManager->get('synchronisationCode')
  30. )
  31. ) {
  32. die(_t('YOU_MUST_BE_CONNECTED_ACTION'));
  33. }
  34. Functions::triggerDirectOutput();
  35. if (!$commandLine){
  36. echo '<html>
  37. <head>
  38. <link rel="stylesheet" href="./templates/'.$theme.'/css/style.css">
  39. <meta name="referrer" content="no-referrer" />
  40. </head>
  41. <body>
  42. <div class="sync">';
  43. }
  44. $synchronisationType = $configurationManager->get('synchronisationType');
  45. $synchronisationCustom = array();
  46. Plugin::callHook("action_before_synchronisationtype", array(&$synchronisationCustom,&$synchronisationType,&$commandLine,$configurationManager,$start));
  47. if(isset($synchronisationCustom['type'])){
  48. $feeds = $synchronisationCustom['feeds'];
  49. $syncTypeStr = _t('SYNCHRONISATION_TYPE').' : '._t($synchronisationCustom['type']);
  50. }elseif('graduate'==$synchronisationType){
  51. // sélectionne les 10 plus vieux flux
  52. $feeds = $feedManager->loadAll(null,'lastupdate', $syncGradCount);
  53. $syncTypeStr = _t('SYNCHRONISATION_TYPE').' : '._t('GRADUATE_SYNCHRONISATION');
  54. }else{
  55. // sélectionne tous les flux, triés par le nom
  56. $feeds = $feedManager->populate('name');
  57. $syncTypeStr = _t('SYNCHRONISATION_TYPE').' : '._t('FULL_SYNCHRONISATION');
  58. }
  59. if(!isset($synchronisationCustom['no_normal_synchronize'])){
  60. $feedManager->synchronize($feeds, $syncTypeStr, $commandLine, $configurationManager, $start);
  61. }
  62. break;
  63. case 'readAll':
  64. if($myUser==false) exit(_t('YOU_MUST_BE_CONNECTED_ACTION'));
  65. $whereClause = array();
  66. $whereClause['unread'] = '1';
  67. if(isset($_['feed']))$whereClause['feed'] = $_['feed'];
  68. if(isset($_['last-event-id']))$whereClause['id'] = '<= ' . $_['last-event-id'];
  69. $eventManager->change(array('unread'=>'0'),$whereClause);
  70. if(!Functions::isAjaxCall()){
  71. header('location: ./index.php');
  72. }
  73. break;
  74. case 'readFolder':
  75. if($myUser==false) exit(_t('YOU_MUST_BE_CONNECTED_ACTION'));
  76. $feeds = $feedManager->loadAllOnlyColumn('id',array('folder'=>$_['folder']));
  77. foreach($feeds as $feed){
  78. $whereClause['feed'] = $feed->getId();
  79. if(isset($_['last-event-id']))$whereClause['id'] = '<= ' . $_['last-event-id'];
  80. $eventManager->change(array('unread'=>'0'),$whereClause);
  81. }
  82. if (!Functions::isAjaxCall()){
  83. header('location: ./index.php');
  84. }
  85. break;
  86. case 'updateConfiguration':
  87. if($myUser==false) exit(_t('YOU_MUST_BE_CONNECTED_ACTION'));
  88. //Ajout des préférences et réglages
  89. $configurationManager->put('root',(substr($_['root'], strlen($_['root'])-1)=='/'?$_['root']:$_['root'].'/'));
  90. $configurationManager->put('articleDisplayAnonymous',$_['articleDisplayAnonymous']);
  91. $configurationManager->put('articlePerPages',$_['articlePerPages']);
  92. $configurationManager->put('articleDisplayLink',$_['articleDisplayLink']);
  93. $configurationManager->put('articleDisplayDate',$_['articleDisplayDate']);
  94. $configurationManager->put('articleDisplayAuthor',$_['articleDisplayAuthor']);
  95. $configurationManager->put('articleDisplayHomeSort',$_['articleDisplayHomeSort']);
  96. $configurationManager->put('articleDisplayFolderSort',$_['articleDisplayFolderSort']);
  97. $configurationManager->put('articleDisplayMode',$_['articleDisplayMode']);
  98. $configurationManager->put('synchronisationType',$_['synchronisationType']);
  99. $configurationManager->put('synchronisationEnableCache',$_['synchronisationEnableCache']);
  100. $configurationManager->put('synchronisationForceFeed',$_['synchronisationForceFeed']);
  101. $configurationManager->put('feedMaxEvents',$_['feedMaxEvents']);
  102. $configurationManager->put('language',$_['ChgLanguage']);
  103. $configurationManager->put('theme',$_['ChgTheme']);
  104. $configurationManager->put('otpEnabled',$_['otpEnabled']);
  105. if(trim($_['password'])!='') {
  106. $salt = User::generateSalt();
  107. $userManager->change(array('password'=>User::encrypt($_['password'], $salt)),array('id'=>$myUser->getId()));
  108. /* /!\ En multi-utilisateur, il faudra changer l'information au
  109. niveau du compte lui-même et non au niveau du déploiement comme
  110. ici. C'est ainsi parce que c'est plus efficace de stocker le sel
  111. dans la config que dans le fichier de constantes, difficile à
  112. modifier. */
  113. $oldSalt = $configurationManager->get('cryptographicSalt');
  114. if (empty($oldSalt))
  115. /* Pendant la migration à ce système, les déploiements
  116. ne posséderont pas cette donnée. */
  117. $configurationManager->add('cryptographicSalt', $salt);
  118. else
  119. $configurationManager->change(array('value'=>$salt), array('key'=>'cryptographicSalt'));
  120. }
  121. # Modifications dans la base de données, la portée courante et la sesssion
  122. # @TODO: gérer cela de façon centralisée
  123. $otpSecret = $_['otpSecret'];
  124. if ($myUser->isOtpSecretValid($otpSecret)) {
  125. $userManager->change(array('login'=>$_['login'], 'otpSecret'=>$otpSecret),array('id'=>$myUser->getId()));
  126. $myUser->setLogin($_['login']);
  127. $myUser->setOtpSecret($otpSecret);
  128. $_SESSION['currentUser'] = serialize($myUser);
  129. }
  130. header('location: ./settings.php#preferenceBloc');
  131. break;
  132. case 'purgeEvents':
  133. if($myUser==false) exit(_t('YOU_MUST_BE_CONNECTED_ACTION'));
  134. $eventManager->truncate();
  135. header('location: ./settings.php');
  136. break;
  137. case 'purgeCache':
  138. if($myUser==false) exit(_t('YOU_MUST_BE_CONNECTED_ACTION'));
  139. Functions::purgeRaintplCache();
  140. header('location: ./settings.php');
  141. break;
  142. case 'exportFeed':
  143. if($myUser==false) exit(_t('YOU_MUST_BE_CONNECTED_ACTION'));
  144. /*********************/
  145. /** Export **/
  146. /*********************/
  147. if(isset($_POST['exportButton'])){
  148. $opml = new Opml();
  149. $xmlStream = $opml->export();
  150. header('Content-Description: File Transfer');
  151. header('Content-Type: application/octet-stream');
  152. header('Content-Disposition: attachment; filename=leed-'.date('d-m-Y').'.opml');
  153. header('Content-Transfer-Encoding: binary');
  154. header('Expires: 0');
  155. header('Cache-Control: must-revalidate');
  156. header('Pragma: public');
  157. header('Content-Length: ' . strlen($xmlStream));
  158. /*
  159. //A decommenter dans le cas ou on a des pb avec ie
  160. if(preg_match('/msie|(microsoft internet explorer)/i', $_SERVER['HTTP_USER_AGENT'])){
  161. header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
  162. header('Pragma: public');
  163. }else{
  164. header('Pragma: no-cache');
  165. }
  166. */
  167. ob_clean();
  168. flush();
  169. echo $xmlStream;
  170. }
  171. break;
  172. case 'importForm':
  173. if($myUser==false) exit(_t('YOU_MUST_BE_CONNECTED_ACTION'));
  174. echo '<html style="height:auto;"><link rel="stylesheet" href="templates/'.$theme.'/css/style.css">
  175. <body style="height:auto;">
  176. <form action="action.php?action=importFeed" method="POST" enctype="multipart/form-data">
  177. <p>'._t('OPML_FILE').' : <input name="newImport" type="file"/> <button name="importButton">'._t('IMPORT').'</button></p>
  178. <p>'._t('IMPORT_COFFEE_TIME').'</p>
  179. </form>
  180. </body>
  181. </html>
  182. ';
  183. break;
  184. case 'synchronizeForm':
  185. if(isset($myUser) && $myUser!=false){
  186. echo '<link rel="stylesheet" href="templates/'.$theme.'/css/style.css">
  187. <a class="button" href="action.php?action=synchronize">'._t('SYNCHRONIZE_NOW').'</a>
  188. <p>'._t('SYNCHRONIZE_COFFEE_TIME').'</p>
  189. ';
  190. }else{
  191. echo _t('YOU_MUST_BE_CONNECTED_ACTION');
  192. }
  193. break;
  194. case 'changeFolderState':
  195. if($myUser==false) exit(_t('YOU_MUST_BE_CONNECTED_ACTION'));
  196. $folderManager->change(array('isopen'=>$_['isopen']),array('id'=>$_['id']));
  197. break;
  198. case 'importFeed':
  199. // On ne devrait pas mettre de style ici.
  200. echo "<html>
  201. <style>
  202. a {
  203. color:#F16529;
  204. }
  205. html,body{
  206. font-family:Verdana;
  207. font-size: 11px;
  208. }
  209. .error{
  210. background-color:#C94141;
  211. color:#ffffff;
  212. padding:5px;
  213. border-radius:5px;
  214. margin:10px 0px 10px 0px;
  215. box-shadow: 0 0 3px 0 #810000;
  216. }
  217. .error a{
  218. color:#ffffff;
  219. }
  220. </style>
  221. </style><body>
  222. \n";
  223. if($myUser==false) exit(_t('YOU_MUST_BE_CONNECTED_ACTION'));
  224. if(!isset($_POST['importButton'])) break;
  225. $opml = new Opml();
  226. echo "<h3>"._t('IMPORT')."</h3><p>"._t('PENDING')."</p>\n";
  227. try {
  228. $errorOutput = $opml->import($_FILES['newImport']['tmp_name']);
  229. } catch (Exception $e) {
  230. $errorOutput = array($e->getMessage());
  231. }
  232. if (empty($errorOutput)) {
  233. echo "<p>"._t('IMPORT_NO_PROBLEM')."</p>\n";
  234. } else {
  235. echo "<div class='error'>"._t('IMPORT_ERROR')."\n";
  236. foreach($errorOutput as $line) {
  237. echo "<p>$line</p>\n";
  238. }
  239. echo "</div>";
  240. }
  241. if (!empty($opml->alreadyKnowns)) {
  242. echo "<h3>"._t('IMPORT_FEED_ALREADY_KNOWN')." : </h3>\n<ul>\n";
  243. foreach($opml->alreadyKnowns as $alreadyKnown) {
  244. foreach($alreadyKnown as &$elt) $elt = htmlspecialchars($elt);
  245. $text = Functions::truncate($alreadyKnown->feedName, 60);
  246. echo "<li><a target='_parent' href='{$alreadyKnown->xmlUrl}'>"
  247. ."{$text}</a></li>\n";
  248. }
  249. echo "</ul>\n";
  250. }
  251. $syncLink = "action.php?action=synchronize&format=html";
  252. echo "<p>";
  253. echo "<a href='$syncLink' style='text-decoration:none;font-size:3em'>"
  254. ."↺</a>";
  255. echo "<a href='$syncLink'>"._t('CLIC_HERE_SYNC_IMPORT')."</a>";
  256. echo "<p></body></html>\n";
  257. break;
  258. case 'addFeed':
  259. if($myUser==false) exit(_t('YOU_MUST_BE_CONNECTED_ACTION'));
  260. require_once("SimplePie.class.php");
  261. if(!isset($_['newUrl'])) break;
  262. $newFeed = new Feed();
  263. $newFeed->setUrl(Functions::clean_url($_['newUrl']));
  264. if ($newFeed->notRegistered()) {
  265. $newFeed->getInfos();
  266. $newFeed->setFolder(
  267. (isset($_['newUrlCategory'])?$_['newUrlCategory']:1)
  268. );
  269. $newFeed->save();
  270. $enableCache = ($configurationManager->get('synchronisationEnableCache')=='')?0:$configurationManager->get('synchronisationEnableCache');
  271. $forceFeed = ($configurationManager->get('synchronisationForceFeed')=='')?0:$configurationManager->get('synchronisationForceFeed');
  272. $newFeed->parse(time(), $_, $enableCache, $forceFeed);
  273. Plugin::callHook("action_after_addFeed", array(&$newFeed));
  274. } else {
  275. $logger = new Logger('settings');
  276. $logger->appendLogs(_t("FEED_ALREADY_STORED"));
  277. $logger->save();
  278. }
  279. header('location: ./settings.php#manageBloc');
  280. break;
  281. case 'changeFeedFolder':
  282. if($myUser==false) exit(_t('YOU_MUST_BE_CONNECTED_ACTION'));
  283. if(isset($_['feed'])){
  284. $feedManager->change(array('folder'=>$_['folder']),array('id'=>$_['feed']));
  285. }
  286. header('location: ./settings.php');
  287. break;
  288. case 'removeFeed':
  289. if($myUser==false) exit(_t('YOU_MUST_BE_CONNECTED_ACTION'));
  290. if(isset($_GET['id'])){
  291. $feedManager->delete(array('id'=>$_['id']));
  292. $eventManager->delete(array('feed'=>$_['id']));
  293. Plugin::callHook("action_after_removeFeed", array($_['id']));
  294. }
  295. header('location: ./settings.php');
  296. break;
  297. case 'addFolder':
  298. if($myUser==false) exit(_t('YOU_MUST_BE_CONNECTED_ACTION'));
  299. if(isset($_['newFolder'])){
  300. $folder = new Folder();
  301. if($folder->rowCount(array('name'=>$_['newFolder']))==0){
  302. $folder->setParent(-1);
  303. $folder->setIsopen(0);
  304. $folder->setName($_['newFolder']);
  305. $folder->save();
  306. }
  307. }
  308. header('location: ./settings.php');
  309. break;
  310. case 'renameFolder':
  311. if($myUser==false) exit(_t('YOU_MUST_BE_CONNECTED_ACTION'));
  312. if(isset($_['id'])){
  313. $folderManager->change(array('name'=>$_['name']),array('id'=>$_['id']));
  314. }
  315. break;
  316. case 'renameFeed':
  317. if($myUser==false) exit(_t('YOU_MUST_BE_CONNECTED_ACTION'));
  318. if(isset($_['id'])){
  319. $feedManager->change(array('name'=>$_['name'],'url'=>Functions::clean_url($_['url'])),array('id'=>$_['id']));
  320. }
  321. break;
  322. case 'removeFolder':
  323. if($myUser==false) exit(_t('YOU_MUST_BE_CONNECTED_ACTION'));
  324. if(isset($_['id']) && is_numeric($_['id']) && $_['id']>0){
  325. $eventManager->customQuery('DELETE FROM `'.MYSQL_PREFIX.'event` WHERE `'.MYSQL_PREFIX.'event`.`feed` in (SELECT `'.MYSQL_PREFIX.'feed`.`id` FROM `'.MYSQL_PREFIX.'feed` WHERE `'.MYSQL_PREFIX.'feed`.`folder` =\''.intval($_['id']).'\') ;');
  326. $feedManager->delete(array('folder'=>$_['id']));
  327. $folderManager->delete(array('id'=>$_['id']));
  328. }
  329. header('location: ./settings.php');
  330. break;
  331. case 'readContent':
  332. if($myUser==false) {
  333. $response_array['status'] = 'noconnect';
  334. $response_array['texte'] = _t('YOU_MUST_BE_CONNECTED_ACTION');
  335. header('Content-type: application/json');
  336. echo json_encode($response_array);
  337. exit();
  338. }
  339. if(isset($_['id'])){
  340. $event = $eventManager->load(array('id'=>$_['id']));
  341. $eventManager->change(array('unread'=>'0'),array('id'=>$_['id']));
  342. }
  343. break;
  344. case 'unreadContent':
  345. if($myUser==false) {
  346. $response_array['status'] = 'noconnect';
  347. $response_array['texte'] = _t('YOU_MUST_BE_CONNECTED_ACTION');
  348. header('Content-type: application/json');
  349. echo json_encode($response_array);
  350. exit();
  351. }
  352. if(isset($_['id'])){
  353. $event = $eventManager->load(array('id'=>$_['id']));
  354. $eventManager->change(array('unread'=>'1'),array('id'=>$_['id']));
  355. }
  356. break;
  357. case 'addFavorite':
  358. if($myUser==false) {
  359. $response_array['status'] = 'noconnect';
  360. $response_array['texte'] = _t('YOU_MUST_BE_CONNECTED_ACTION');
  361. header('Content-type: application/json');
  362. echo json_encode($response_array);
  363. exit();
  364. }
  365. $eventManager->change(array('favorite'=>'1'),array('id'=>$_['id']));
  366. break;
  367. case 'removeFavorite':
  368. if($myUser==false) {
  369. $response_array['status'] = 'noconnect';
  370. $response_array['texte'] = _t('YOU_MUST_BE_CONNECTED_ACTION');
  371. header('Content-type: application/json');
  372. echo json_encode($response_array);
  373. exit();
  374. }
  375. $eventManager->change(array('favorite'=>'0'),array('id'=>$_['id']));
  376. break;
  377. case 'login':
  378. define('RESET_PASSWORD_FILE', 'resetPassword');
  379. if (file_exists(RESET_PASSWORD_FILE)) {
  380. /* Pour réinitialiser le mot de passe :
  381. * créer le fichier RESET_PASSWORD_FILE vide.
  382. * Le nouveau mot de passe sera celui fourni à la connexion.
  383. */
  384. @unlink(RESET_PASSWORD_FILE);
  385. if (file_exists(RESET_PASSWORD_FILE)) {
  386. $message = 'Unable to remove "'.RESET_PASSWORD_FILE.'"!';
  387. /* Pas supprimable ==> on ne remet pas à zéro */
  388. } else {
  389. $resetPassword = $_['password'];
  390. assert('!empty($resetPassword)');
  391. $tmpUser = User::get($_['login']);
  392. if (false===$tmpUser) {
  393. $message = "Unknown user '{$_['login']}'! No password reset.";
  394. } else {
  395. $tmpUser->resetPassword($resetPassword, $configurationManager->get('cryptographicSalt'));
  396. $message = "User '{$_['login']}' (id={$tmpUser->getId()}) Password reset to '$resetPassword'.";
  397. }
  398. }
  399. error_log($message);
  400. }
  401. if(isset($_['usr'])){
  402. $user = User::existAuthToken($_['usr']);
  403. if($user==false){
  404. exit("error"); //@TODO: traduire
  405. }else{
  406. $_SESSION['currentUser'] = serialize($user);
  407. header('location: ./action.php?action=addFeed&newUrl='.$_['newUrl']);
  408. exit();
  409. }
  410. }else{
  411. $salt = $configurationManager->get('cryptographicSalt');
  412. if (empty($salt)) $salt = '';
  413. $user = $userManager->exist($_['login'],$_['password'],$salt,@$_['otp']);
  414. if($user==false){
  415. error_log("Leed: wrong login for '".$_['login']."'");
  416. header('location: ./index.php?action=wrongLogin');
  417. }else{
  418. $_SESSION['currentUser'] = serialize($user);
  419. if (isset($_['rememberMe'])) $user->setStayConnected();
  420. header('location: ./index.php');
  421. }
  422. exit();
  423. }
  424. break;
  425. case 'changePluginState':
  426. if($myUser==false) exit(_t('YOU_MUST_BE_CONNECTED_ACTION'));
  427. if($_['state']=='0'){
  428. Plugin::enabled($_['plugin']);
  429. }else{
  430. Plugin::disabled($_['plugin']);
  431. }
  432. header('location: ./settings.php#pluginBloc');
  433. break;
  434. case 'logout':
  435. User::delStayConnected();
  436. $_SESSION = array();
  437. session_unset();
  438. session_destroy();
  439. header('location: ./index.php');
  440. break;
  441. case 'displayOnlyUnreadFeedFolder':
  442. if($myUser==false) {
  443. $response_array['status'] = 'noconnect';
  444. $response_array['texte'] = _t('YOU_MUST_BE_CONNECTED_ACTION');
  445. header('Content-type: application/json');
  446. echo json_encode($response_array);
  447. exit();
  448. }
  449. $configurationManager->put('displayOnlyUnreadFeedFolder',$_['displayOnlyUnreadFeedFolder']);
  450. break;
  451. case 'displayFeedIsVerbose':
  452. if($myUser==false) {
  453. $response_array['status'] = 'noconnect';
  454. $response_array['texte'] = _t('YOU_MUST_BE_CONNECTED_ACTION');
  455. header('Content-type: application/json');
  456. echo json_encode($response_array);
  457. exit();
  458. }
  459. // changement du statut isverbose du feed
  460. $feed = new Feed();
  461. $feed = $feed->getById($_['idFeed']);
  462. $feed->setIsverbose(($_['displayFeedIsVerbose']=="0"?1:0));
  463. $feed->save();
  464. break;
  465. case 'optionFeedIsVerbose':
  466. if($myUser==false) {
  467. $response_array['status'] = 'noconnect';
  468. $response_array['texte'] = _t('YOU_MUST_BE_CONNECTED_ACTION');
  469. header('Content-type: application/json');
  470. echo json_encode($response_array);
  471. exit();
  472. }
  473. // changement du statut de l'option
  474. $configurationManager = new Configuration();
  475. $conf = $configurationManager->getAll();
  476. $configurationManager->put('optionFeedIsVerbose',($_['optionFeedIsVerbose']=="0"?0:1));
  477. break;
  478. case 'articleDisplayMode':
  479. if($myUser==false) {
  480. $response_array['status'] = 'noconnect';
  481. $response_array['texte'] = _t('YOU_MUST_BE_CONNECTED_ACTION');
  482. header('Content-type: application/json');
  483. echo json_encode($response_array);
  484. exit();
  485. }
  486. // chargement du content de l'article souhaité
  487. $newEvent = new Event();
  488. $event = $newEvent->getById($_['event_id']);
  489. if ($_['articleDisplayMode']=='content'){
  490. //error_log(print_r($_SESSION['events'],true));
  491. $content = $event->getContent();
  492. } else {
  493. $content = $event->getDescription();
  494. }
  495. echo $content;
  496. break;
  497. default:
  498. require_once("SimplePie.class.php");
  499. Plugin::callHook("action_post_case", array(&$_,$myUser));
  500. //exit('0');
  501. break;
  502. //Installation d'un nouveau plugin
  503. case 'installPlugin':
  504. Plugin::install($_['zip']);
  505. break;
  506. case 'getGithubMarket':
  507. $plugin = new Plugin();
  508. $plugin->getGithubMarketRepos();
  509. break;
  510. }
  511. ?>