function processing() { global $sModule; global $sFfmpegPath; global $sModulesPath; global $sFilesPath; $iFilesCount = getSettingValue($sModule, "processCount"); if (!is_numeric($iFilesCount)) { $iFilesCount = 2; } $iFailedTimeout = getSettingValue($sModule, "failedTimeout"); if (!is_numeric($iFailedTimeout)) { $iFailedTimeout = 1; } $iFailedTimeout *= 86400; $sDbPrefix = DB_PREFIX . ucfirst($sModule); $iCurrentTime = time(); //remove all tokens older than 10 minutes getResult("DELETE FROM `" . $sDbPrefix . "Tokens` WHERE `Date`<'" . ($iCurrentTime - 600) . "'"); getResult("UPDATE `" . $sDbPrefix . "Files` SET `Date`='" . $iCurrentTime . "', `Status`='" . VC_STATUS_FAILED . "' WHERE `Status`='" . VC_STATUS_PROCESSING . "' AND `Date`<'" . ($iCurrentTime - $iFailedTimeout) . "'"); $rResult = getResult("SELECT * FROM `" . $sDbPrefix . "Files` WHERE `Status`='" . VC_STATUS_PENDING . "' ORDER BY `ID` LIMIT " . $iFilesCount); for ($i = 0; $i < mysql_num_rows($rResult); $i++) { $aFile = mysql_fetch_assoc($rResult); if (!_convert($aFile['ID'])) { getResult("UPDATE `" . $sDbPrefix . "Files` SET `Status`='" . VC_STATUS_FAILED . "' WHERE `ID`='" . $aFile['ID'] . "'"); } } }
/** * Convert the text in the page's charset, or in the datadase's charset * * @param mixed the text * @param string the page's encoding * @param bool is it for the database ? * @return string the encoded text */ function _convert($text, $fromencoding, $database = false) { if (is_array($text)) { $arraytext = array(); foreach ($text as $key => $value) { $arraytext[$key] = _convert($value, $fromencoding, $database); } return $arraytext; } else { $cp1252_map = array("" => "€", "" => "‚", "" => "ƒ", "" => "„", " " => "…", "" => "†", "" => "‡", "" => "ˆ", "" => "‰", "" => "Š", "" => "‹", "" => "Œ", "" => "Ž", "" => "‘", "" => "’", "" => "“", "" => "”", "" => "•", "" => "–", "" => "—", "" => "˜", "" => "™", "" => "š", "" => "›", "" => "œ", "" => "ž", "" => "Ÿ"); if ($database) { if ($fromencoding != "ISO-8859-1" && $fromencoding != "ISO-8859-15") { return mb_convert_encoding($text, TEMPLATES_DEFAULT_CHARSET, mb_detect_encoding($text, "UTF-8, ISO-8859-1, ISO-8859-15", true)); } else { return $text; } } else { if ($fromencoding != TEMPLATES_DEFAULT_CHARSET) { return mb_convert_encoding($text, "UTF-8", mb_detect_encoding($text, "UTF-8, " . TEMPLATES_DEFAULT_CHARSET . ", ISO-8859-1, ISO-8859-15", true)); } else { return $text; } } } }
/** tags() - Ajoute un élément de type mot clés (tags) * * @param mixed L'objet QuickForm du formulaire * @param mixed Le tableau des valeurs des différentes option pour l'élément texte * @param string Type d'action pour le formulaire : saisie, modification, vue,... saisie par défaut * @param mixed valeur par défaut du champs * @return void */ function tags(&$formtemplate, $tableau_template, $mode, $valeurs_fiche) { if ($mode == 'saisie') { $tags_javascript = ''; //gestion des mots cles deja entres if (isset($valeurs_fiche[$tableau_template[1]])) { $tags = explode(",", mysqli_real_escape_string($GLOBALS['wiki']->dblink, $valeurs_fiche[$tableau_template[1]])); if (is_array($tags)) { sort($tags); foreach ($tags as $tag) { $tags_javascript .= 't.add(\'' . $tag . '\');' . "\n"; } } } // on recupere tous les tags du site $response = array(); $tab_tous_les_tags = $GLOBALS['wiki']->GetAllTags(); if (is_array($tab_tous_les_tags)) { foreach ($tab_tous_les_tags as $tab_les_tags) { $response[] = _convert($tab_les_tags['value'], 'ISO-8859-15'); } } sort($response); $tagsexistants = '\'' . implode('\',\'', $response) . '\''; $script = '$(function(){ var tagsexistants = [' . $tagsexistants . ']; var pagetag = $(\'#formulaire .yeswiki-input-pagetag\'); pagetag.tagsinput({ typeahead: { afterSelect: function(val) { this.$element.val(""); }, source: tagsexistants }, confirmKeys: [13, 188] }); });' . "\n"; $GLOBALS['wiki']->AddJavascriptFile('tools/tags/libs/vendor/bootstrap-tagsinput.min.js'); $GLOBALS['wiki']->AddJavascript($script); //gestion des valeurs par defaut : d'abord on regarde s'il y a une valeur a modifier, //puis s'il y a une variable passee en GET, //enfin on prend la valeur par defaut du formulaire sinon if (isset($valeurs_fiche[$tableau_template[1]])) { $defauts = $valeurs_fiche[$tableau_template[1]]; } elseif (isset($_GET[$tableau_template[1]])) { $defauts = stripslashes($_GET[$tableau_template[1]]); } else { $defauts = stripslashes($tableau_template[5]); } $option = array('size' => $tableau_template[3], 'maxlength' => $tableau_template[4], 'id' => $tableau_template[1], 'value' => $defauts, 'class' => 'form-control yeswiki-input-pagetag'); $bulledaide = ''; if (isset($tableau_template[10]) && $tableau_template[10] != '') { $bulledaide = ' <img class="tooltip_aide" title="' . htmlentities($tableau_template[10], ENT_QUOTES, TEMPLATES_DEFAULT_CHARSET) . '" src="tools/bazar/presentation/images/aide.png" width="16" height="16" alt="image aide" />'; } $formtemplate->addElement('text', $tableau_template[1], $tableau_template[2] . $bulledaide, $option); } elseif ($mode == 'requete') { //on supprime les tags existants if (!isset($GLOBALS['delete_tags'])) { $GLOBALS['wiki']->DeleteTriple($valeurs_fiche['id_fiche'], 'http://outils-reseaux.org/_vocabulary/tag', null, '', ''); $GLOBALS['delete_tags'] = true; } //on decoupe les tags pour les mettre dans un tableau $tags = explode(",", mysqli_real_escape_string($GLOBALS['wiki']->dblink, $valeurs_fiche[$tableau_template[1]])); //on ajoute les tags postés foreach ($tags as $tag) { trim($tag); if ($tag != '') { $GLOBALS['wiki']->InsertTriple($valeurs_fiche['id_fiche'], 'http://outils-reseaux.org/_vocabulary/tag', _convert($tag, TEMPLATES_DEFAULT_CHARSET, true), '', ''); } } //on copie tout de meme dans les metadonnees //return formulaire_insertion_texte($tableau_template[1], $valeurs_fiche[$tableau_template[1]]); return array($tableau_template[1] => $valeurs_fiche[$tableau_template[1]]); } elseif ($mode == 'html') { $html = ''; if (isset($valeurs_fiche[$tableau_template[1]]) && $valeurs_fiche[$tableau_template[1]] != '') { $html = '<div class="BAZ_rubrique tags_' . $tableau_template[1] . '" data-id="' . $tableau_template[1] . '">' . "\n" . '<span class="BAZ_label">' . $tableau_template[2] . ' :</span>' . "\n"; $html .= '<div class="BAZ_texte"> '; $tabtagsexistants = explode(',', $valeurs_fiche[$tableau_template[1]]); if (count($tabtagsexistants) > 0) { sort($tabtagsexistants); $tagsexistants = ''; foreach ($tabtagsexistants as $tag) { $tagsexistants .= '<a class="tag-label label label-info" href="' . $GLOBALS['wiki']->href('listpages', $GLOBALS['wiki']->GetPageTag(), 'tags=' . urlencode(trim($tag))) . '" title="' . _t('TAGS_SEE_ALL_PAGES_WITH_THIS_TAGS') . '">' . $tag . '</a> </li>' . "\n"; } $html .= $tagsexistants . "\n"; } $html .= '</div>' . "\n" . '</div> <!-- /.BAZ_rubrique -->' . "\n"; } return $html; } }
$this->Query($sql); } // on recupere tous les tags existants $sql = 'SELECT id, value, resource FROM ' . $this->config['table_prefix'] . 'triples WHERE property="http://outils-reseaux.org/_vocabulary/tag" ORDER BY value ASC, resource ASC'; $tab_tous_les_tags = $this->LoadAll($sql); if (is_array($tab_tous_les_tags) && count($tab_tous_les_tags) > 1) { echo '<table class="table table-striped table-condensed">' . "\n"; $nb_pages = 0; $liste_page = ''; $tag_precedent = ''; $tab_tous_les_tags[] = 'fin'; // on ajoute un element au tableau pour boucler une derniere fois $tagsid = ''; foreach ($tab_tous_les_tags as $tab_les_tags) { if ($tab_les_tags != 'fin') { $tagstripped = _convert(stripslashes($tab_les_tags['value']), 'ISO-8859-1'); } else { $tagstripped = 'fin'; } if ($tagstripped != 'fin' && ($tagstripped == $tag_precedent || $tag_precedent == '')) { $nb_pages++; if ($tag_precedent == '') { $tag_precedent = $tagstripped; } if ($nb_pages == 1) { $liste_page .= '<tr><td>nbpage</td>'; } else { $liste_page .= '<tr><td></td>'; } $liste_page .= '<td class="pagewithtag"> ' . _t('TAGS_PRESENT_IN') . ' : <a class="wikipagelink" href="' . $this->href('', $tab_les_tags['resource']) . '">' . $tab_les_tags['resource'] . '</a>
Copyright 2003 Eric FELDSTEIN Copyright 2003 Charles NEPOTE This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // Vérification de sécurité if (!defined("WIKINI_VERSION")) { die("accès direct interdit"); } if ($this->HasAccess("read")) { if (!$this->page) { return; } else { header("Content-type: text/plain; charset=" . TEMPLATES_DEFAULT_CHARSET); // display raw page echo _convert($this->page["body"], TEMPLATES_DEFAULT_CHARSET); } } else { return; }
} if (!CACHER_MOTS_CLES && $this->HasAccess("write") && $this->HasAccess("read")) { $response = array(); // on recupere tous les tags du site $tab_tous_les_tags = $this->GetAllTags(); if (is_array($tab_tous_les_tags)) { foreach ($tab_tous_les_tags as $tab_les_tags) { $response[] = _convert($tab_les_tags['value'], 'ISO-8859-1'); } } sort($response); $tagsexistants = '\'' . implode('\',\'', $response) . '\''; // on recupere les tags de la page courante $tabtagsexistants = $this->GetAllTags($this->GetPageTag()); foreach ($tabtagsexistants as $tab) { $tagspage[] = _convert($tab["value"], 'ISO-8859-1'); } if (isset($tagspage) && is_array($tagspage)) { sort($tagspage); $tagspagecourante = implode(',', $tagspage); } else { $tagspagecourante = ''; } $script = '$(function(){ var tagsexistants = [' . $tagsexistants . ']; var pagetag = $(\'#ACEditor .yeswiki-input-pagetag\'); pagetag.tagsinput({ typeahead: { source: tagsexistants }, confirmKeys: [13, 188]
$squel = new SquelettePhp('tools/tags/presentation/templates/' . $template); } } else { $squel = new SquelettePhp('themes/tools/tags/presentation/templates/' . $template); } $output = ''; // creation de la liste des mots cles a filtrer $this->AddJavascriptFile('tools/tags/libs/tag.js'); $tab_selected_tags = explode(',', $tags); $selectiontags = ' AND value IN ("' . implode(",", $tab_selected_tags) . '")'; // on recupere tous les tags existants $sql = 'SELECT DISTINCT value FROM ' . $this->config['table_prefix'] . 'triples WHERE property="http://outils-reseaux.org/_vocabulary/tag" ORDER BY value ASC'; $tab_tous_les_tags = $this->LoadAll($sql); if (is_array($tab_tous_les_tags)) { foreach ($tab_tous_les_tags as $tag) { $tag['value'] = _convert(stripslashes($tag['value']), 'ISO-8859-1'); if (in_array($tag['value'], $tab_selected_tags)) { $tab_tag[] = ' <a class="tag-label label label-primary label-active" href="' . $this->href('listpages', $this->GetPageTag(), 'tags=' . urlencode($tag['value'])) . '">' . $tag['value'] . '</a>' . "\n"; } else { $tab_tag[] = ' <a class="tag-label label label-info" href="' . $this->href('listpages', $this->GetPageTag(), 'tags=' . urlencode($tag['value'])) . '">' . $tag['value'] . '</a>' . "\n"; } } $outputselecttag = ''; if (is_array($tab_tag)) { $outputselecttag .= '<strong><i class="icon icon-tags"></i> ' . _t('TAGS_FILTER') . ' : </strong>'; foreach ($tab_tag as $tag) { $outputselecttag .= $tag; } } } $text = '';
public function LoadPage($tag, $time = "", $cache = 1) { // retrieve from cache if (!$time && $cache && ($cachedPage = $this->GetCachedPage($tag)) !== false) { $page = $cachedPage; } else { $sql = "SELECT * FROM " . $this->config["table_prefix"] . "pages" . " WHERE tag = '" . mysqli_real_escape_string($this->dblink, $tag) . "' AND " . ($time ? "time = '" . mysqli_real_escape_string($this->dblink, $time) . "'" : "latest = 'Y'") . " LIMIT 1"; $page = $this->LoadSingle($sql); // the database is in ISO-8859-15, it must be converted if (isset($page['body'])) { $page['body'] = _convert($page['body'], "ISO-8859-15"); } // cache result if (!$time) { $this->CachePage($page, $tag); } } return $page; }
/** baz_affiche_flux_RSS() - affiche le flux rss a partir de parametres * @return string Le flux RSS, avec les headers et tout et tout */ function baz_afficher_flux_RSS() { $urlrss = $GLOBALS['wiki']->href('rss'); if (isset($_GET['id_typeannonce'])) { $id_typeannonce = $_GET['id_typeannonce']; $urlrss .= '&id_typeannonce=' . $id_typeannonce; } else { $id_typeannonce = ''; } if (isset($_GET['categorie_fiche'])) { $categorie_fiche = $_GET['categorie_fiche']; $urlrss .= '&categorie_fiche=' . $categorie_fiche; } else { $categorie_fiche = ''; } if (isset($_GET['nbitem'])) { $nbitem = $_GET['nbitem']; $urlrss .= '&nbitem=' . $nbitem; } else { $nbitem = BAZ_NB_ENTREES_FLUX_RSS; } if (isset($_GET['utilisateur'])) { $utilisateur = $_GET['utilisateur']; $urlrss .= '&utilisateur=' . $utilisateur; } else { $utilisateur = ''; } if (isset($_GET['statut'])) { $statut = $_GET['statut']; $urlrss .= '&statut=' . $statut; } else { $statut = 1; } if (isset($_GET['query'])) { $query = $_GET['query']; $urlrss .= '&query=' . $query; } else { $query = ''; } $tableau_flux_rss = baz_requete_recherche_fiches($query, '', $id_typeannonce, $categorie_fiche, $statut, $utilisateur, 20); require_once BAZ_CHEMIN . 'libs' . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'XML/Util.php'; // setlocale() pour avoir les formats de date valides (w3c) --julien setlocale(LC_TIME, 'C'); $xml = XML_Util::getXMLDeclaration('1.0', 'UTF-8', 'yes'); $xml .= "\r\n "; $xml .= XML_Util::createStartElement('rss', array('version' => '2.0', 'xmlns:atom' => 'http://www.w3.org/2005/Atom', 'xmlns:dc' => 'http://purl.org/dc/elements/1.1/')); $xml .= "\r\n "; $xml .= XML_Util::createStartElement('channel'); $xml .= "\r\n "; $xml .= XML_Util::createTag('title', null, html_entity_decode(_t('BAZ_DERNIERE_ACTU'), ENT_QUOTES, 'UTF-8')); $xml .= "\r\n "; $xml .= XML_Util::createTag('link', null, html_entity_decode(BAZ_RSS_ADRESSESITE, ENT_QUOTES, 'UTF-8')); $xml .= "\r\n "; $xml .= XML_Util::createTag('description', null, html_entity_decode(BAZ_RSS_DESCRIPTIONSITE, ENT_QUOTES, 'UTF-8')); $xml .= "\r\n "; $xml .= XML_Util::createTag('language', null, 'fr-FR'); $xml .= "\r\n "; $xml .= XML_Util::createTag('copyright', null, 'Copyright (c) ' . date('Y') . ' ' . html_entity_decode(BAZ_RSS_NOMSITE, ENT_QUOTES, 'UTF-8')); $xml .= "\r\n "; $xml .= XML_Util::createTag('lastBuildDate', null, strftime('%a, %d %b %Y %H:%M:%S GMT')); $xml .= "\r\n "; $xml .= XML_Util::createTag('docs', null, 'http://www.stervinou.com/projets/rss/'); $xml .= "\r\n "; $xml .= XML_Util::createTag('category', null, BAZ_RSS_CATEGORIE); $xml .= "\r\n "; $xml .= XML_Util::createTag('managingEditor', null, BAZ_RSS_MANAGINGEDITOR); $xml .= "\r\n "; $xml .= XML_Util::createTag('webMaster', null, BAZ_RSS_WEBMASTER); $xml .= "\r\n "; $xml .= XML_Util::createTag('ttl', null, '60'); $xml .= "\r\n "; $xml .= XML_Util::createStartElement('image'); $xml .= "\r\n "; $xml .= XML_Util::createTag('title', null, html_entity_decode(_t('BAZ_DERNIERE_ACTU'), ENT_QUOTES, 'UTF-8')); $xml .= "\r\n "; $xml .= XML_Util::createTag('url', null, BAZ_RSS_LOGOSITE); $xml .= "\r\n "; $xml .= XML_Util::createTag('link', null, BAZ_RSS_ADRESSESITE); $xml .= "\r\n "; $xml .= XML_Util::createEndElement('image'); if (count($tableau_flux_rss) > 0) { // Creation des items : titre + lien + description + date de publication foreach ($tableau_flux_rss as $ligne) { $ligne = json_decode($ligne['body'], true); $ligne = _convert($ligne, 'UTF-8'); $xml .= "\r\n "; $xml .= XML_Util::createStartElement('item'); $xml .= "\r\n "; $xml .= XML_Util::createTag('title', null, html_entity_decode(stripslashes($ligne['bf_titre']), ENT_QUOTES, 'UTF-8')); $xml .= "\r\n "; $lien = $GLOBALS['_BAZAR_']['url']; $lien->addQueryString(BAZ_VARIABLE_ACTION, BAZ_VOIR_FICHE); $lien->addQueryString(BAZ_VARIABLE_VOIR, BAZ_VOIR_CONSULTER); $lien->addQueryString('id_fiche', $ligne['id_fiche']); $xml .= XML_Util::createTag('link', null, '<![CDATA[' . $lien->getURL() . ']]>'); $xml .= "\r\n "; $xml .= XML_Util::createTag('guid', null, '<![CDATA[' . $lien->getURL() . ']]>'); $xml .= "\r\n "; $xml .= XML_Util::createTag('dc:creator', null, $ligne['createur']); $xml .= "\r\n "; $tab = explode('wakka.php?wiki=', $lien->getURL()); $xml .= XML_Util::createTag('description', null, '<![CDATA[' . preg_replace('/data-id=".*"/Ui', '', html_entity_decode(baz_voir_fiche(0, $ligne), ENT_QUOTES, 'UTF-8')) . ']]>'); $xml .= "\r\n "; $xml .= XML_Util::createTag('pubDate', null, strftime('%a, %d %b %Y %H:%M:%S GMT', strtotime($ligne['date_creation_fiche']))); $xml .= "\r\n "; $xml .= XML_Util::createEndElement('item'); } } else { //pas d'annonces $xml .= "\r\n "; $xml .= XML_Util::createStartElement('item'); $xml .= "\r\n "; $xml .= XML_Util::createTag('title', null, html_entity_decode(_t('BAZ_PAS_DE_FICHES'), ENT_QUOTES, 'UTF-8')); $xml .= "\r\n "; $xml .= XML_Util::createTag('link', null, '<![CDATA[' . $GLOBALS['_BAZAR_']['url']->getUrl() . ']]>'); $xml .= "\r\n "; $xml .= XML_Util::createTag('guid', null, '<![CDATA[' . $GLOBALS['_BAZAR_']['url']->getUrl() . ']]>'); $xml .= "\r\n "; $xml .= XML_Util::createTag('description', null, html_entity_decode(_t('BAZ_PAS_DE_FICHES'), ENT_QUOTES, 'UTF-8')); $xml .= "\r\n "; $xml .= XML_Util::createTag('pubDate', null, strftime('%a, %d %b %Y %H:%M:%S GMT', strtotime('01/01/%Y'))); $xml .= "\r\n "; $xml .= XML_Util::createEndElement('item'); } $xml .= "\r\n "; $xml .= XML_Util::createEndElement('channel'); $xml .= "\r\n "; $xml .= XML_Util::createEndElement('rss'); // Nettoyage de l'url $GLOBALS['_BAZAR_']['url']->removeQueryString(BAZ_VARIABLE_ACTION); $GLOBALS['_BAZAR_']['url']->removeQueryString('id_fiche'); echo str_replace('</image>', '</image>' . "\n" . '<atom:link href="' . $urlrss . '" rel="self" type="application/rss+xml" />', html_entity_decode($xml, ENT_QUOTES, 'UTF-8')); }
function liste_to_array($idliste = '') { if ($idliste != '') { list($idliste, $suffixe) = explode('*', $idliste); //on vérifie que la page en question est bien une page wiki if ($GLOBALS['wiki']->GetTripleValue($idliste, 'http://outils-reseaux.org/_vocabulary/type', '', '') == 'liste') { $valjson = $GLOBALS['wiki']->LoadPage($idliste); $valeurs_fiche = json_decode($valjson["body"], true); $valeurs_fiche['label'] = _convert($valeurs_fiche['label'], 'UTF-8'); return $valeurs_fiche['label']; } else { return false; } } else { return false; } }
$sideA->copy_whitespace($output); $output .= "@@"; $sideA->copy_word($output); $sideA->copy_until_ordinal($argument[1], $output); $output .= "@@"; } // inserted word if ($letter == 'a' || $letter == 'c') { $sideB->copy_whitespace($output); $output .= "££"; $sideB->copy_word($output); $sideB->copy_until_ordinal($argument[3], $output); $output .= "££"; } } } $sideB->copy_until_ordinal($count_total_right, $output); $sideB->copy_whitespace($output); $out = $this->Format($output); echo _convert($out, 'ISO-8859-15'); } } else { echo "<i>Vous n'êtes pas autorisé à lire cette page.</i>"; } ?> </div> <?php $content = ob_get_clean(); echo $this->Header(); echo $content; echo $this->Footer();
// only if saving: case 'Sauver': // check for overwriting if ($this->page && $this->page['id'] != $_POST['previous']) { $error = 'ALERTE : ' . "Cette page a été modifiée par quelqu'un d'autre pendant que vous l'éditiez.<br />\n" . "Veuillez copier vos changements et rééditer cette page.\n"; } else { // store $body = str_replace("\r", '', $body); // teste si la nouvelle page est differente de la précédente if (rtrim($body) == rtrim($this->page["body"])) { $this->SetMessage('Cette page n\'a pas été enregistrée car elle n\'a subi aucune modification.'); $this->Redirect($this->href()); } else { // sécurité // l'encodage de la base est en iso-8859-1, voir s'il faut convertir $body = _convert($body, TEMPLATES_DEFAULT_CHARSET, TRUE); // add page (revisions) $this->SavePage($this->tag, $body); // now we render it internally so we can write the updated link table. $this->ClearLinkTable(); $this->StartLinkTracking(); $temp = $this->SetInclusions(); // a priori, ça ne sert à rien, mais on ne sait jamais... $this->RegisterInclusion($this->GetPageTag()); // on simule totalement un affichage normal $this->Format($body); $this->SetInclusions($temp); if ($user = $this->GetUser()) { $this->TrackLinkTo($user['name']); } if ($owner = $this->GetPageOwner()) {
$mail_sender = isset($_POST['email']) ? trim($_POST['email']) : false; $mail_receiver = isset($_POST['mail']) ? trim($_POST['mail']) : false; if (!$mail_receiver) { $mail_receiver = isset($_POST['nbactionmail']) ? FindMailFromWikiPage($this->page["body"], $_POST['nbactionmail']) : false; } $name_sender = isset($_POST['name']) ? stripslashes($_POST['name']) : false; // dans le cas d'une page wiki envoyee, on formate le message en html et en txt if ($_POST['type'] == 'mail') { $subject = isset($_POST['subject']) ? stripslashes($_POST['subject']) : false; $message_html = html_entity_decode(_convert($this->Format($this->page["body"]), TEMPLATES_DEFAULT_CHARSET)); $message_txt = strip_tags(_convert($message_html, TEMPLATES_DEFAULT_CHARSET)); } else { // pour un envoi de mail classique, le message en txt $subject = (isset($_POST['entete']) ? '[' . trim($_POST['entete']) . '] ' : '') . (isset($_POST['subject']) ? stripslashes(_convert($_POST['subject'], TEMPLATES_DEFAULT_CHARSET)) : false) . ($name_sender ? ' ' . _t('CONTACT_FROM') . ' ' . $name_sender : ''); $message_html = ''; $message_txt = isset($_POST['message']) ? stripslashes(_convert($_POST['message'], TEMPLATES_DEFAULT_CHARSET)) : ''; } // on verifie si tous les parametres sont bons $message = check_parameters_mail($_POST['type'], $mail_sender, $name_sender, $mail_receiver, $subject, $message_txt); // si pas d'erreur on envoie if ($message['class'] == 'success') { if (send_mail($mail_sender, $name_sender, $mail_receiver, $subject, $message_txt, $message_html)) { if ($_POST['type'] == 'contact' || $_POST['type'] == 'mail') { $message['message'] = _t('CONTACT_MESSAGE_SUCCESSFULLY_SENT'); } elseif ($_POST['type'] == 'abonnement') { $message['message'] = _t('CONTACT_SUBSCRIBE_ORDER_SENT'); } elseif ($_POST['type'] == 'desabonnement') { $message['message'] = _t('CONTACT_UNSUBSCRIBE_ORDER_SENT'); } } else { $message['class'] = "danger";
foreach ($results as $page) { $this->tag = $page['tag']; $this->page = $page; $items .= "<item>\r\n"; $items .= "<title>" . $page['tag'] . "</title>\r\n"; $items .= "<link>" . $this->config["base_url"] . $page["tag"] . "</link>\r\n"; $items .= "<description><![CDATA["; //on enleve les actions recentchangesrssplus pour eviter les boucles infinies $page["body"] = preg_replace("/\\{\\{recentchangesrss(.*?)\\}\\}/s", '', $page["body"]); $page["body"] = preg_replace("/\\{\\{rss(.*?)\\}\\}/s", '', $page["body"]); if (strstr($page["body"], "bf_titre")) { $tab_valeurs = json_decode($page["body"], true); $tab_valeurs = _convert($tab_valeurs, 'UTF-8'); $page["body"] = '""' . baz_voir_fiche(0, $tab_valeurs) . '""'; } else { $page["body"] = _convert($page["body"], 'ISO-8859-1'); } $texteformat = htmlspecialchars($this->Format($page['body']), ENT_COMPAT, TEMPLATES_DEFAULT_CHARSET); $items .= $texteformat . "]]></description>\r\n"; $items .= "<dc:creator>by " . htmlspecialchars($page["user"], ENT_COMPAT, TEMPLATES_DEFAULT_CHARSET) . "</dc:creator>\r\n"; $items .= "<pubDate>" . gmdate('D, d M Y H:i:s \\G\\M\\T', strtotime($page['time'])) . "</pubDate>\r\n"; $itemurl = $this->href(false, $page["tag"]); $items .= '<guid>' . $itemurl . "</guid>\n"; $items .= "</item>\r\n"; } $this->tag = $oldpagetag; $this->page = $oldpage; $oldpage = $this->LoadPage($oldpagetag); $output .= $items; $output .= "</channel>\n"; $output .= "</rss>\n";
function get_title_from_body($page) { // on recupere les bf_titre ou les titres de niveau 1 et de niveau 2, on met la PageWiki sinon preg_match_all("/\"bf_titre\":\"(.*)\"/U", $page['body'], $titles); if (is_array($titles[1]) && isset($titles[1][0]) && $titles[1][0] != '') { $title = _convert(preg_replace_callback('/\\\\u([a-f0-9]{4})/', 'utf8_special_decode', $titles[1][0]), 'UTF-8'); //preg_replace("/\\\\u([a-f0-9]{4})/e", "iconv('UCS-4LE','UTF-8',pack('V', hexdec('U$1')))", $titles[1][0])); } else { preg_match_all("/\\={6}(.*)\\={6}/U", $page['body'], $titles); if (is_array($titles[1]) && isset($titles[1][0]) && $titles[1][0] != '') { $title = $GLOBALS['wiki']->Format(_convert(trim($titles[1][0]), 'ISO-8859-15')); } else { preg_match_all("/={5}(.*)={5}/U", $page['body'], $titles); if (is_array($titles[1]) && isset($titles[1][0]) && $titles[1][0] != '') { $title = $GLOBALS['wiki']->Format(_convert(trim($titles[1][0]), 'ISO-8859-15')); } else { $title = $page['tag']; } } } return $title; }
$form = preg_replace('~<div id="map".*>~Ui', "\n" . '<div id="map">', $form); echo json_encode(array('html' => $form)); } } break; case "forms": // les formulaires bazar $formval = baz_valeurs_formulaire($form); // si un seul formulaire, on cree un tableau à une entrée if (!empty($form)) { $formval = array($formval['bn_id_nature'] => $formval); } foreach ($formval as $idform => $form) { $i = 0; $prepared = array(); $form['template'] = _convert($form['template'], 'ISO-8859-15'); foreach ($form['template'] as $formelem) { if (in_array($formelem[0], array('radio', 'liste', 'checkbox', 'listefiche', 'checkboxfiche'))) { //identifiant dans la base $prepared[$i]['id'] = $formelem[0] . $formelem[1] . $formelem[6]; // type de champ if (in_array($formelem[0], array('listefiche', 'liste'))) { $prepared[$i]['type'] = 'select'; } elseif (in_array($formelem[0], array('checkboxfiche', 'checkbox'))) { $prepared[$i]['type'] = 'checkbox'; } else { $prepared[$i]['type'] = 'radio'; } // texte d'invitation à la saisie $prepared[$i]['label'] = $formelem[2]; // attributs html du champs