function zcssleedmaker_plugin_update($_)
{
    if ($_['action'] == 'zcssleedmaker_update') {
        $configurationManager = new Configuration();
        $configurationManager->getAll();
        $configurationManager->put('plugin_cssLeedMaker_css', $_['plugin_cssLeedMaker_css']);
        $configurationManager->put('plugin_cssLeedMaker_addcss', rawurlencode($_['plugin_cssLeedMaker_addcss']));
        $_SESSION['configuration'] = null;
        header('location: settings.php#CSSLeedMaker');
    }
}
function intheleed_plugin_setting_bloc(&$myUser)
{
    $configurationManager = new Configuration();
    $configurationManager->getAll();
    echo '
	<section id="pocheBloc" style="display:none;">
		<form action="action.php?action=intheleed_update" method="POST">
		<h2>' . _t('P_INTHELEED_PLUGIN_TITLE') . '</h2>
		<p class="pocheBlock">
		<label for="plugin_poche_link">' . _t('P_INTHELEED_POCHE_LINK') . '</label> 
		<input style="width:50%;" type="text" placeholder="http://poche.mondomaine.com" value="' . $configurationManager->get('plugin_poche_link') . '" id="plugin_poche_link" name="plugin_poche_link" />
		<input type="submit" class="button" value="' . _t('P_INTHELEED_SAVE') . '"><br/>
		</p>
		
		<strong>' . _t('P_INTHELEED_NB') . '</strong> ' . _t('P_INTHELEED_NB_INFO') . '
		</form>
	</section>
	';
}
function leedHomeLink_plugin_update($_)
{
    $configurationManager = new Configuration();
    $configurationManager->getAll();
    if ($_['action'] == 'leedHomeLink_update') {
        $configurationManager->put('plugin_leedHomeLink_1_name', $_['plugin_leedHomeLink_1_name']);
        $configurationManager->put('plugin_leedHomeLink_1_link', $_['plugin_leedHomeLink_1_link']);
        $configurationManager->put('plugin_leedHomeLink_2_name', $_['plugin_leedHomeLink_2_name']);
        $configurationManager->put('plugin_leedHomeLink_2_link', $_['plugin_leedHomeLink_2_link']);
        $configurationManager->put('plugin_leedHomeLink_3_name', $_['plugin_leedHomeLink_3_name']);
        $configurationManager->put('plugin_leedHomeLink_3_link', $_['plugin_leedHomeLink_3_link']);
        $configurationManager->put('plugin_leedHomeLink_4_name', $_['plugin_leedHomeLink_4_name']);
        $configurationManager->put('plugin_leedHomeLink_4_link', $_['plugin_leedHomeLink_4_link']);
        $configurationManager->put('plugin_leedHomeLink_5_name', $_['plugin_leedHomeLink_5_name']);
        $configurationManager->put('plugin_leedHomeLink_5_link', $_['plugin_leedHomeLink_5_link']);
        $_SESSION['configuration'] = null;
        header('location: settings.php#leedHomeLink');
    }
}
function shaarleed_plugin_setting_bloc(&$myUser)
{
    $configurationManager = new Configuration();
    $configurationManager->getAll();
    echo '
	<section id="shaarli" name="shaarli" class="shaarli">
		<form action="action.php?action=shaarleed_update" method="POST">
		<h2>' . _t('P_SHARLEED_PLUGIN_TITLE') . '</h2>
		<p class="shaarliBlock">
		<label for="plugin_shaarli_link">' . _t('P_SHARLEED_SHAARLI_LINK') . '</label> 
		<input style="width:50%;" type="text" placeholder="http://mon.domaine.com/shaarli/" value="' . $configurationManager->get('plugin_shaarli_link') . '" id="plugin_shaarli_link" name="plugin_shaarli_link" />
		<input type="submit" class="button" value="' . _t('P_SHARLEED_SAVE') . '"><br/>
		</p>
		
		<strong>' . _t('P_SHARLEED_NB') . '</strong> ' . _t('P_SHARLEED_NB_INFO') . '
		</form>
	</section>
	';
}
function cacheListFeed_plugin_action(&$_)
{
    if ($_['action'] == 'cacheListFeed') {
        $myUser = isset($_SESSION['currentUser']) ? unserialize($_SESSION['currentUser']) : false;
        if ($myUser == false) {
            exit;
        }
        $configurationManager = new Configuration();
        $configurationManager->getAll();
        $configurationManager->put('cacheListFeed', $_['cacher']);
    }
    if ($_['action'] == 'getCacheListFeed') {
        $myUser = isset($_SESSION['currentUser']) ? unserialize($_SESSION['currentUser']) : false;
        if ($myUser == false) {
            echo 1;
            exit;
        }
        $configurationManager = new Configuration();
        $configurationManager->getAll();
        echo $configurationManager->get('cacheListFeed');
    }
}
Example #6
0
    require_once dirname(__FILE__) . '/.tool.php';
    switch ($tool->type) {
        case 'reset_password':
            if ($tool->login != null && $tool->password != null) {
                $userManager = new User();
                $usr = $userManager->load(array('login' => $tool->login));
                $usr->setPassword($tool->password);
                $usr->save();
                unlink(dirname(__FILE__) . '/.tool.php');
            }
            break;
    }
}
$myUser = false;
$conf = new Configuration();
$conf->getAll();
//Inclusion des plugins
Plugin::includeAll($conf->get("DEFAULT_THEME"));
$userManager = new User();
if (isset($_SESSION['currentUser'])) {
    $myUser = unserialize($_SESSION['currentUser']);
} else {
    if (AUTO_LOGIN != '') {
        $myUser = $userManager->exist(AUTO_LOGIN, '', true);
        $_SESSION['currentUser'] = serialize($myUser);
    }
}
if (!$myUser && isset($_COOKIE[$conf->get('COOKIE_NAME')])) {
    $users = User::getAllUsers();
    foreach ($users as $user) {
        if ($user->getCookie() == $_COOKIE[$conf->get('COOKIE_NAME')]) {
function FS_toggleEventContent_getDefault()
{
    $config = new Configuration();
    $config->getAll();
    return $config->get('toggleEventContent_default');
}
function plugin_leedUpdateSource_messageAccueil()
{
    $configurationManager = new Configuration();
    $configurationManager->getAll();
    // afin de ne pas intéroger cinquante fois par jour et bouffer du temps de réponse, une recherche par jour est suffisante.
    if ($configurationManager->get('plugin_leedUpdateSource_date') == date('Ymd')) {
        echo '';
    } else {
        $configurationManager->put('plugin_leedUpdateSource_date', date('Ymd'));
        $message = plugin_leedUpdateSource_message('plugin_leedUpdateSource_source');
        if ($message == '') {
            $message = plugin_leedUpdateSource_message('plugin_leedUpdateSource_sourcePlugin');
        }
        $message == '' ? $return = '' : ($return = '<aside>Une mise à jour est disponible - <a href="settings.php#leedUpdateSource">Go !!!</a></aside>');
        echo $return;
    }
}
    /**

     * set_configuration

     *

     * @return void

     */

    public function setConfiguration()

    {

        $oConf = new Configuration();

        $dataCondif = $oConf->getAll();

        if (count($dataCondif)) {

            foreach ($dataCondif as $value) {

                if ($value['CFG_UID'] == 'ENVIRONMENT_SETTINGS') {

                    $query = 'INSERT INTO CONFIGURATION (CFG_UID, OBJ_UID, CFG_VALUE, PRO_UID, USR_UID, APP_UID) VALUES';

                    $query .= "('" .

                        $value['CFG_UID']   . "', '".

                        $value['OBJ_UID']   . "', '".

                        $value['CFG_VALUE'] . "', '".

                        $value['PRO_UID']   . "', '".

                        $value['USR_UID']   . "', '".

                        $value['APP_UID']   . "')";

                    mysql_select_db($this->wf_site_name, $this->connection_database);

                    $this->run_query($query, "Copy configuracion environment");

                    break;

                }

            }

        }

    }
function leedStats_plugin_setting_bloc(&$myUser)
{
    $configurationManager = new Configuration();
    $configurationManager->getAll();
    echo '
	<section id="leedStatslBloc" class="leedStatslBloc" style="display:none;">
		<h2>' . _t('P_LEEDSTATS_TITLE') . '</h2>

		<section class="preferenceBloc">
		<h3>' . _t('P_LEEDSTATS_RESUME') . '</h3>
	';
    //Nombre global d'article lus / non lus / total / favoris
    $requete = 'SELECT
                (SELECT count(1) FROM `' . MYSQL_PREFIX . 'feed`) as nbFeed,
                (SELECT count(1) FROM `' . MYSQL_PREFIX . 'event` WHERE unread = 1) as nbUnread,
                (SELECT count(1) FROM `' . MYSQL_PREFIX . 'event` WHERE unread = 0) as nbRead,
                (SELECT count(1) FROM `' . MYSQL_PREFIX . 'event`) as nbTotal,
                (SELECT count(1) FROM `' . MYSQL_PREFIX . 'event` WHERE favorite = 1) as nbFavorite
                ';
    $query = mysql_query($requete);
    if ($query != null) {
        echo '<div id="result_leedStats1" class="result_leedStats1">
                 <table>
                        <th class="leedStats_border leedStats_th">' . _t('P_LEEDSTATS_NBFEED') . '</th>
                        <th class="leedStats_border leedStats_th">' . _t('P_LEEDSTATS_NBART') . '</th>
                        <th class="leedStats_border leedStats_th">' . _t('P_LEEDSTATS_NBART_NONLU') . '</th>
                        <th class="leedStats_border leedStats_th">' . _t('P_LEEDSTATS_NBART_LU') . '</th>
                        <th class="leedStats_border leedStats_th">' . _t('P_LEEDSTATS_NBFAV') . '</th>
        ';
        while ($data = mysql_fetch_array($query)) {
            echo '
                <tr>
                    <td class="leedStats_border leedStats_textright">' . $data['nbFeed'] . '</td>
                    <td class="leedStats_border leedStats_textright">' . $data['nbTotal'] . '</td>
                    <td class="leedStats_border leedStats_textright">' . $data['nbUnread'] . '</td>
                    <td class="leedStats_border leedStats_textright">' . $data['nbRead'] . '</td>
                    <td class="leedStats_border leedStats_textright">' . $data['nbFavorite'] . '</td>
                </tr>
            ';
        }
        echo '</table>
            </div>';
    }
    echo '
            <h3>' . _t('P_LEEDSTATS_NBART_BY_FEED_TITLE') . '</h3>

    ';
    //Nombre global d'article lus / non lus / total / favoris
    $requete = 'SELECT name, count(1) as nbTotal,
                (SELECT count(1) FROM `' . MYSQL_PREFIX . 'event` le2 WHERE le2.unread=1 and le1.feed = le2.feed) as nbUnread,
                (SELECT count(1) FROM `' . MYSQL_PREFIX . 'event` le2 WHERE le2.unread=0 and le1.feed = le2.feed) as nbRead,
                (SELECT count(1) FROM `' . MYSQL_PREFIX . 'event` le2 WHERE le2.favorite=1 and le1.feed = le2.feed) as nbFavorite
                FROM `' . MYSQL_PREFIX . 'feed` lf1
                INNER JOIN `' . MYSQL_PREFIX . 'event` le1 on le1.feed = lf1.id
                GROUP BY name
                ORDER BY name
                ';
    $query = mysql_query($requete);
    if ($query != null) {
        echo '<div id="result_leedStats1" class="result_leedStats1">
                 <table>
                        <th class="leedStats_border leedStats_th">' . _t('P_LEEDSTATS_FEED') . '</th>
                        <th class="leedStats_border leedStats_th">' . _t('P_LEEDSTATS_NBART') . '</th>
                        <th class="leedStats_border leedStats_th">' . _t('P_LEEDSTATS_NBART_NONLU') . '</th>
                        <th class="leedStats_border leedStats_th">' . _t('P_LEEDSTATS_NBART_LU') . '</th>
                        <th class="leedStats_border leedStats_th">' . _t('P_LEEDSTATS_NBFAV') . '</th>
        ';
        while ($data = mysql_fetch_array($query)) {
            echo '
                <tr>
                    <td class="leedStats_border leedStats_textright">' . short_name($data['name'], 32) . '</td>
                    <td class="leedStats_border leedStats_textright">' . $data['nbTotal'] . '</td>
                    <td class="leedStats_border leedStats_textright">' . $data['nbUnread'] . '</td>
                    <td class="leedStats_border leedStats_textright">' . $data['nbRead'] . '</td>
                    <td class="leedStats_border leedStats_textright">' . $data['nbFavorite'] . '</td>
                </tr>
            ';
        }
        echo '</table>
            </div>';
    }
    echo '
        </section>
	</section>
	';
}
Example #11
0
     $feed = new Feed();
     $feed = $feed->getById($_['idFeed']);
     $feed->setIsverbose($_['displayFeedIsVerbose'] == "0" ? 1 : 0);
     $feed->save();
     break;
 case 'optionFeedIsVerbose':
     if ($myUser == false) {
         $response_array['status'] = 'noconnect';
         $response_array['texte'] = _t('YOU_MUST_BE_CONNECTED_ACTION');
         header('Content-type: application/json');
         echo json_encode($response_array);
         exit;
     }
     // changement du statut de l'option
     $configurationManager = new Configuration();
     $conf = $configurationManager->getAll();
     $configurationManager->put('optionFeedIsVerbose', $_['optionFeedIsVerbose'] == "0" ? 0 : 1);
     break;
 case 'articleDisplayMode':
     if ($myUser == false) {
         $response_array['status'] = 'noconnect';
         $response_array['texte'] = _t('YOU_MUST_BE_CONNECTED_ACTION');
         header('Content-type: application/json');
         echo json_encode($response_array);
         exit;
     }
     // chargement du content de l'article souhaité
     $newEvent = new Event();
     $event = $newEvent->getById($_['event_id']);
     if ($_['articleDisplayMode'] == 'content') {
         //error_log(print_r($_SESSION['events'],true));
function social_plugin_update($_)
{
    if ($_['action'] == 'social_update') {
        $configurationManager = new Configuration();
        $configurationManager->getAll();
        $configurationManager->put('plugin_social_twitter', $_['socialTwitter']);
        $configurationManager->put('plugin_social_googleplus', $_['socialGooglePlus']);
        $configurationManager->put('plugin_social_facebook', $_['socialFacebook']);
        $configurationManager->put('plugin_social_delicious', $_['socialDelicious']);
        $configurationManager->put('plugin_social_shaarli', $_['socialShaarli']);
        $configurationManager->put('plugin_social_shaarli_link', $_['plugin_social_shaarli_link']);
        $configurationManager->put('plugin_social_pocket', $_['socialPocket']);
        $configurationManager->put('plugin_social_instapaper', $_['socialInstapaper']);
        $configurationManager->put('plugin_social_mail', $_['socialMail']);
        $configurationManager->put('plugin_social_linkedin', $_['socialLinkedIn']);
        $configurationManager->put('plugin_social_wallabag', $_['socialwallabag']);
        $configurationManager->put('plugin_social_wallabag_link', $_['plugin_social_wallabag_link']);
        $configurationManager->put('plugin_social_diigo', $_['socialdiigo']);
        $configurationManager->put('plugin_social_diigo_apikey', $_['plugin_social_diigo_apikey']);
        $_SESSION['configuration'] = null;
        header('location: settings.php#socialBloc');
    }
}
function preference_plugin_action()
{
    global $_, $myUser, $conf;
    switch ($_['action']) {
        case 'SAVE_SETTINGS':
            $configuration = new Configuration();
            $configuration->getAll();
            foreach ($_['data'] as $key => $value) {
                $configuration->put($key, $value);
            }
            echo 'Réglages sauvegardés';
            break;
    }
}
function create_epub($title, $qry_articles, $external_content)
{
    $configManager = new Configuration();
    $configManager->getAll();
    $nbArticles = mysql_num_rows($qry_articles);
    // TODO PHP 5.5.0, remove this function to use mysqli_stmt_num_rows or PDO
    if ($nbArticles > 0) {
        // Epub initialisation
        switch ($configManager->get('epub_version')) {
            case 3:
                $book = new EPub(EPub::BOOK_VERSION_EPUB3);
                $epubbook_start = constant("EPUBBOOK_HEAD_START_v3") . $title . constant("EPUBBOOK_HEAD_END");
                break;
            case 2:
            default:
                $book = new EPub(EPub::BOOK_VERSION_EPUB2);
                $epubbook_start = constant("EPUBBOOK_HEAD_START_v2") . $title . constant("EPUBBOOK_HEAD_END");
                break;
        }
        $book->setTitle($title);
        $book->setIdentifier("http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . "/" . $title, EPub::IDENTIFIER_URI);
        $book->setLanguage("fr");
        // TODO L10N
        $book->setDescription(_t('P_EPUB_BOOK_DESCRIPTION'));
        //$book->addCSSFile("styles.css", "css1", $cssData); //TODO add Leed css ?
        //$book->setCoverImage("Cover.jpg", file_get_contents("demo/cover-image.jpg"), "image/jpeg");
        $cover = $epubbook_start . "<h1>" . $title . "</h1>\n<h2>" . _t('P_EPUB_BYLEED') . "</h2>\n" . constant("EPUBBOOK_END");
        $book->addChapter("Notices", "Cover.html", $cover);
        // Epub chapters (articles) creation
        $chapNb = 1;
        while ($data = mysql_fetch_array($qry_articles)) {
            $title_article = html_entity_decode($data['title'], ENT_QUOTES, 'UTF-8');
            $author_article = html_entity_decode($data['creator'], ENT_QUOTES, 'UTF-8');
            $html_content = $epubbook_start . '<h2 class="articleTitle">' . $title_article . '</h2>' . '<h3 class="articleDetails">' . _t('P_EPUB_BY') . ' ' . $author_article . ' ' . _t('P_EPUB_ON_DATE') . ' ' . date("d/m/Y", $data['pubdate']) . ' ' . _t('P_EPUB_AT_TIME') . ' ' . date("H:i:s", $data['pubdate']) . '</h3>' . $data['content'] . constant("EPUBBOOK_END");
            $html_content = html_entity_decode($html_content, ENT_QUOTES, 'UTF-8');
            switch ($external_content) {
                case "textonly":
                    // Replace img tags by their alt value if possible (PHPePub make it only for Epub::EXTERNAL_REF_REPLACE_IMAGES)
                    $html_content = preg_replace('/<\\s*?img.*alt="(.*?)".*?>/', '[image: ${1}]', $html_content);
                    $html_content = preg_replace('/<\\s*?br.*(.*?)".*?>/', '[image: ${1}]', $html_content);
                    $book->addChapter($title_article, _t('P_EPUB_CHAPTER') . "_" . $chapNb . ".html", $html_content, true, EPub::EXTERNAL_REF_IGNORE);
                    break;
                case "noimage":
                    $book->addChapter($title_article, _t('P_EPUB_CHAPTER') . "_" . $chapNb . ".html", $html_content, true, EPub::EXTERNAL_REF_REPLACE_IMAGES);
                    break;
                case "full":
                default:
                    $book->addChapter($title_article, _t('P_EPUB_CHAPTER') . "_" . $chapNb . ".html", $html_content, true, EPub::EXTERNAL_REF_ADD);
                    break;
            }
            $chapNb++;
        }
        // Epub finalization
        $book->buildTOC();
        $book->finalize();
        $zipData = $book->sendBook(preg_replace("( )", '_', preg_replace("([^\\w\\s\\d\\,;\\[\\]\\(\\]])", '', $title)));
        exit;
    } else {
        echo _t('P_EPUB_NOARTICLES_WARNING');
    }
}
function i18n_plugin_AddForm()
{
    $test = array();
    $configuration = new Configuration();
    $configuration->getAll();
    echo '<section id="i18n" name="i18n" class="i18n">
			<h2>' . _t('P_I18N_PREF_TITLE') . '</h2>';
    /* -------------------------------------------------------- */
    // Gestion des retours des formulaires
    /* -------------------------------------------------------- */
    // cas de changement de la langue de Leed
    if (isset($_POST['plugin_i18n_changeLngLeed'])) {
        $langue = substr(basename($_POST['plugin_i18n_changeLngLeed']), 0, 2);
        $configuration->put('language', $langue);
        $test['info'][] = _t('P_I18N_MSG_CHG_LNG_LEED');
    }
    // Cas validation de la création d'une langue sur Leed.
    $newLanguage = '';
    if (isset($_POST['plugin_i18n_newLanguage'])) {
        $newLanguage = $_POST['plugin_i18n_newLanguage'];
        if (is_file($newLanguage)) {
            $test['Erreur'][] = _t('P_I18N_NEW_LNG_FILE_EXIST') . $newLanguage;
        } else {
            file_put_contents($newLanguage, '');
            $test['Info'][] = _t('P_I18N_NEW_LNG_FILE_OK', array($newLanguage));
            $_POST['plugin_i18n_selectLanguage'] = $newLanguage;
        }
    }
    // Cas d'une copy de fichier
    if (isset($_POST['plugin_i18n_copyLanguage'])) {
        $copyLanguage = $_POST['plugin_i18n_copyLanguage'];
        $fileDest = $_POST['plugin_i18n_copyFileDest'];
        if (is_file($fileDest)) {
            $test['Erreur'][] = _t('P_I18N_NEW_LNG_FILE_EXIST') . $fileDest;
        } else {
            if (is_writable(dirname($fileDest))) {
                copy($copyLanguage, $fileDest);
                $test['Info'][] = _t('P_I18N_NEW_LNG_FILE_OK', array($fileDest));
                $_POST['plugin_i18n_selectLanguage'] = $fileDest;
            } else {
                $test['Erreur'][] = _t('P_I18N_VERIF_ERR1') . ' ' . $fileDest;
            }
        }
    }
    // Cas validation d'une MAJ d'un fichier de langue
    if (isset($_POST['0123456789MAJLanguage'])) {
        $_ = array_map('addslashes', array_merge($_GET, $_POST));
        ksort($_);
        $ModifLanguage = $_['0123456789MAJLanguage'];
        unset($_['0123456789MAJLanguage']);
        if (is_writable($ModifLanguage)) {
            file_put_contents($ModifLanguage, plugin_i18n_json_encode($_));
            $test['Info'][] = _t('P_I18N_UPD_LNG_FILE_OK', array($_POST['0123456789MAJLanguage']));
            $_POST['plugin_i18n_selectLanguage'] = $ModifLanguage;
        } else {
            $test['Erreur'][] = _t('P_I18N_UPD_LNG_FILE_ERR', array($_POST['0123456789MAJLanguage']));
        }
    }
    // Gestion des erreurs PHP possible permettant l'écriture de fichier dans les répertoires de Leed
    if (!is_writable('./locale/')) {
        $test['Erreur'][] = _t('P_I18N_VERIF_ERR1');
    }
    if (!@function_exists('file_get_contents')) {
        $test['Erreur'][] = _t('P_I18N_VERIF_ERR2');
    }
    if (!@function_exists('file_put_contents')) {
        $test['Erreur'][] = _t('P_I18N_VERIF_ERR2');
    }
    if (@version_compare(PHP_VERSION, '5.1.0') <= 0) {
        $test['Erreur'][] = _t('P_I18N_VERIF_ERR3', array(PHP_VERSION));
    }
    if (ini_get('safe_mode') && ini_get('max_execution_time') != 0) {
        $test['Erreur'][] = _t('P_I18N_VERIF_ERR4');
    }
    if (count($test) != 0) {
        echo '<div id="result_i18n" class="result_i18n">
                  <table>
                      <th class="i18n_border i18n_th">' . _t('P_I18N_MESSAGES') . '</th>';
        foreach ($test as $type => $messages) {
            echo '<tr>';
            foreach ($messages as $message) {
                echo '<td class="i18n_border ' . ($type == 'Erreur' ? 'i18n_warn' : 'i18n_info') . '">' . $message . '</td>';
            }
            echo '</tr>';
        }
        echo '    </table>
              </div>';
    }
    // Sélectionner la langue ou saisir une nouvelle langue
    echo '<h3>' . _t('P_I18N_MANAGE_LNG_TITLE') . '</h3>';
    echo '<form action="settings.php#i18n" method="POST">
              <select name="plugin_i18n_changeLngLeed">';
    $filesLeed = glob('./templates/' . $configuration->get('theme') . '/locale/*.json');
    foreach ($filesLeed as $file) {
        if ($file == './templates/' . $configuration->get('theme') . '/locale/' . $configuration->get('language') . '.json') {
            echo '<option selected=selected value="' . $file . '">' . $file . '</option>';
        } else {
            echo '<option value="' . $file . '">' . $file . '</option>';
        }
    }
    echo '     </select>
              <input type="submit" name="plugin_i18n_chgLngLeed" value="' . _t('P_I18N_BTN_CHG_LNG_LEED') . '" class="button">
          </form>
          <h3>' . _t('P_I18N_CREA_FIC_LNG') . '</h3>
          <form action="settings.php#i18n" method="POST">
              <input type="text" value="" placeholder="./templates/theme/locale/xx.json" name="plugin_i18n_newLanguage">
              <input type="submit" name="plugin_i18n_saveButton" value="' . _t('P_I18N_BTN_CREATE_FILE') . '" class="button">
          </form>
          <h3>' . _t('P_I18N_MANAGE_TEMPLATE_LNG') . '</h3>
          <form action="settings.php#i18n" method="POST">
              <select name="plugin_i18n_copyLanguage">';
    $filesLeed = glob('./templates/*/locale/*.json');
    foreach ($filesLeed as $file) {
        if (isset($_POST['plugin_i18n_selectLanguage']) && $_POST['plugin_i18n_selectLanguage'] == $file) {
            echo '<option selected=selected value="' . $file . '">' . $file . '</option>';
        } else {
            echo '<option value="' . $file . '">' . $file . '</option>';
        }
    }
    echo '    </select> ' . _t('P_I18N_COPY_TO') . '
              <input type="text" value="" placeholder="./templates/theme/locale/xx.json" name="plugin_i18n_copyFileDest">
              <input type="submit" value="' . _t('P_I18N_BTN_COPY_FILE') . '" class="button">
          </form>
          <form action="settings.php#i18n" method="POST">
              <select name="plugin_i18n_selectLanguage">';
    foreach ($filesLeed as $file) {
        if (isset($_POST['plugin_i18n_selectLanguage']) && $_POST['plugin_i18n_selectLanguage'] == $file) {
            echo '<option selected=selected value="' . $file . '">' . $file . '</option>';
        } else {
            echo '<option value="' . $file . '">' . $file . '</option>';
        }
    }
    echo '    </select>
              <input type="submit" value="' . _t('P_I18N_BTN_LOAD_FILE') . '" class="button">
          </form>';
    echo '<h3>' . _t('P_I18N_MANAGE_PLUGIN_LNG') . '</h3>
            <form action="settings.php#i18n" method="POST">
              <select name="plugin_i18n_copyLanguage">';
    $filesLeed = glob('./plugins/*/locale/*.json');
    foreach ($filesLeed as $file) {
        if (isset($_POST['plugin_i18n_selectLanguage']) && $_POST['plugin_i18n_selectLanguage'] == $file) {
            echo '<option selected=selected value="' . $file . '">' . $file . '</option>';
        } else {
            echo '<option value="' . $file . '">' . $file . '</option>';
        }
    }
    echo '    </select> ' . _t('P_I18N_COPY_TO') . '
                          <input type="text" value="" placeholder="./plugins/plug/locale/xx.json" name="plugin_i18n_copyFileDest">
                          <input type="submit" value="' . _t('P_I18N_BTN_COPY_FILE') . '" class="button">
                      </form>
                      <form action="settings.php#i18n" method="POST">
                          <select name="plugin_i18n_selectLanguage">';
    foreach ($filesLeed as $file) {
        if (isset($_POST['plugin_i18n_selectLanguage']) && $_POST['plugin_i18n_selectLanguage'] == $file) {
            echo '<option selected=selected value="' . $file . '">' . $file . '</option>';
        } else {
            echo '<option value="' . $file . '">' . $file . '</option>';
        }
    }
    echo '    </select>
              <input type="submit" value="' . _t('P_I18N_BTN_LOAD_FILE') . '" class="button">
          </form>';
    echo '<h3>Gestion des fichiers de langues de Leed</h3>
            <form action="settings.php#i18n" method="POST">
              <select name="plugin_i18n_copyLanguage">';
    $filesLeed = glob('./locale/*.json');
    foreach ($filesLeed as $file) {
        if (isset($_POST['plugin_i18n_selectLanguage']) && $_POST['plugin_i18n_selectLanguage'] == $file) {
            echo '<option selected=selected value="' . $file . '">' . $file . '</option>';
        } else {
            echo '<option value="' . $file . '">' . $file . '</option>';
        }
    }
    echo '    </select> ' . _t('P_I18N_COPY_TO') . '
                          <input type="text" value="" placeholder="ex: ./locale/xx.json" name="plugin_i18n_copyFileDest">
                          <input type="submit" value="' . _t('P_I18N_BTN_COPY_FILE') . '" class="button">
                      </form>
                      <form action="settings.php#i18n" method="POST">
                          <select name="plugin_i18n_selectLanguage">';
    foreach ($filesLeed as $file) {
        if (isset($_POST['plugin_i18n_selectLanguage']) && $_POST['plugin_i18n_selectLanguage'] == $file) {
            echo '<option selected=selected value="' . $file . '">' . $file . '</option>';
        } else {
            echo '<option value="' . $file . '">' . $file . '</option>';
        }
    }
    echo '    </select>
              <input type="submit" value="' . _t('P_I18N_BTN_LOAD_FILE') . '" class="button">
          </form>';
    // sélection d'un langage à charger
    if (isset($_POST['plugin_i18n_selectLanguage'])) {
        $selectLanguage = $_POST['plugin_i18n_selectLanguage'];
        echo '<hr><h3>' . _t('P_I18N_UPD_FILE_TITLE', array($selectLanguage)) . '</h3>
                <span>' . _t('P_I18N_MSG_ALERT') . '</span>';
        // On scan tous les tags de Leed
        $foundTags = array();
        if (stripos(dirname($selectLanguage), './') === false) {
            $foundTags = plugin_i18n_scanTags(dirname($selectLanguage) . '/../', 'plugins');
        } else {
            // on est dans le répertoire ./locale/fr.json
            $foundTags = plugin_i18n_scanTags('./', 'plugins', 'templates');
        }
        // On charge le fichier de langue existant
        $currentLanguage = json_decode(file_get_contents($selectLanguage), true);
        ksort($currentLanguage);
        echo '<hr><h4>' . _t('P_I18N_KEY_INFILE_TITLE') . '</h4>
              <form action="settings.php#i18n" method="POST">
              <input type="hidden" name="0123456789MAJLanguage" value="' . $selectLanguage . '">
              <table class="diffTab">
                <tr>
                    <th class="i18n_border i18n_th">' . _t('P_I18N_KEY_FILE_NB_KEY', array(count($currentLanguage))) . '</th>
                    <th class="i18n_border i18n_th">' . _t('P_I18N_KEY_CODE_NB_KEY', array(count($foundTags))) . '</th>
                </tr>';
        $language = substr(basename($_POST['plugin_i18n_selectLanguage']), 0, 2);
        foreach ($currentLanguage as $key => $value) {
            if (in_array($key, $foundTags, true)) {
                echo ' <tr>
                            <td class="i18n_border i18n_textcenter">' . $key . '</td>
                            <td class="i18n_border i18n_textcenter">';
                $value = htmlentities($value, ENT_COMPAT, 'UTF-8');
                if (strlen($value) > 100) {
                    echo '<textarea name="' . $key . '">' . $value . '</textarea>';
                } else {
                    echo '<input type="text" name="' . $key . '" value="' . $value . '">';
                }
                echo '      </td>
                            <td class="i18n_a">&nbsp;<a style="color:#fff" target="_blank" href="http://translate.google.fr/#auto/' . $language . '/' . $value . '" title="' . _t('P_I18N_TRANSLATE') . '">T</a></td>
                      </tr>';
            }
        }
        echo '</table>';
        echo '<hr><h4>' . _t('P_I18N_KEY_INFILE_NOTFND_TITLE') . '</h4>
              <table class="diffTab">
                <tr>
                    <th class="i18n_border i18n_th">' . _t('P_I18N_KEY_FILE_NB_KEY', array(count($currentLanguage))) . '</th>
                    <th class="i18n_border i18n_th">' . _t('P_I18N_KEY_CODE_NB_KEY', array(count($foundTags))) . '</th>
                </tr>';
        // recherche des tags existant mais non trouvé dans la recherche du code
        foreach ($currentLanguage as $key => $value) {
            if (!in_array($key, $foundTags, true)) {
                echo '<tr><td class="i18n_border i18n_textcenter">' . $key . '</td>
                          <td class="i18n_border i18n_textcenter">' . $value . '<br />' . _t('P_I18N_MSG_NOT_FND_CODE') . '</td>
                      </tr>';
            }
        }
        // Recherche des tags existants dans le code mais non trouvé dans la traduction
        foreach ($foundTags as $key => $value) {
            if (!isset($currentLanguage[$value])) {
                echo '<tr><td class="i18n_border i18n_textcenter">' . $value . '</td>
                          <td class="i18n_border i18n_textcenter"><input type="text" name="' . $value . '" value="">+</td></tr>';
            }
        }
        echo '</table>
              <input type="submit" value="' . _t('P_I18N_BTN_UPD_FILE') . '" class="button">
              </form>';
    }
    echo '</section>';
}
function rssmaker_plugin_favorite_action($_, $myUser)
{
    if ($_['action'] == 'show_favorite_rss') {
        header('Content-Type: text/xml; charset=utf-8');
        $eventManager = new Event();
        $items = $eventManager->loadAll(array("favorite" => 1));
        $ConfigManager = new Configuration();
        $ConfigManager->getAll();
        $link = $ConfigManager->get('root');
        $xml = '<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/">
	<channel>
				<title>Leed (' . _t("FAVORITES") . ')</title>
				<atom:link href="' . $link . 'action.php?action=show_unread_rss" rel="self" type="application/rss+xml"/>
				<link>' . $link . '</link>
				<description>Aggrégation des flux non lus</description>
				<language>fr-fr</language>
				<copyright>DWTFYW</copyright>
				<pubDate>' . date('r', gmstrftime(time())) . '</pubDate>
				<lastBuildDate>' . date('r', gmstrftime(time())) . '</lastBuildDate>
				<sy:updatePeriod>hourly</sy:updatePeriod>
				<sy:updateFrequency>1</sy:updateFrequency>
				<generator>Leed (LightFeed Agregator) ' . VERSION_NAME . '</generator>';
        usort($items, 'rssmaker_plugin_compare_event');
        foreach ($items as $item) {
            $xml .= '<item>
				<title><![CDATA[' . html_entity_decode($item->getTitle()) . ']]></title>
				<link>' . $item->getLink() . '</link>
				<pubDate>' . date('r', gmstrftime($item->getPubdate())) . '</pubDate>
				<guid isPermaLink="true">' . $item->getLink() . '</guid>

				<description>
				<![CDATA[' . $item->getDescription() . '
				]]>
				</description>

				<content:encoded><![CDATA[' . $item->getDescription() . ']]></content:encoded>
				<dc:creator>' . ('' == $item->getCreator() ? 'Anonyme' : $item->getCreator()) . '</dc:creator>
				</item>';
        }
        $xml .= '</channel></rss>';
        echo $xml;
    }
}