Changeset 96982 in spip-zone
- Timestamp:
- May 3, 2016, 12:26:30 PM (5 years ago)
- Location:
- _plugins_/shortcut_url/trunk/formulaires
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
_plugins_/shortcut_url/trunk/formulaires/editer_shortcut_url.php
r96859 r96982 6 6 * @copyright 2015 7 7 * @author cyp 8 * @licen ce GNU/GPL8 * @license GNU/GPL 9 9 * @package SPIP\formulaires\shortcut_url 10 10 */ 11 11 12 12 /** 13 * Gestion du formulaire de shortcut_url des sites 13 * Gestion du formulaire de shortcut_url des sites 14 14 * 15 15 * @package SPIP\Formulaires 16 **/ 17 if (!defined('_ECRIRE_INC_VERSION')) return; 16 **/ 17 if (!defined('_ECRIRE_INC_VERSION')) { 18 return; 19 } 20 21 include_spip('inc/actions'); 22 include_spip('inc/editer'); 23 include_spip('action/editer_objet'); 18 24 19 25 /** … … 22 28 * @return array 23 29 * Environnement du formulaire 24 **/ 25 if (!defined('_ECRIRE_INC_VERSION')) return; 26 27 include_spip('inc/actions'); 28 include_spip('inc/editer'); 29 include_spip('action/editer_objet'); 30 31 function formulaires_editer_shortcut_url_charger_dist($id_shortcut_url='new', $objet='', $id_objet='', $retour='', $ajaxload='oui', $options=''){ 32 $valeurs = formulaires_editer_objet_charger('shortcut_url',$id_shortcut_url, '', '', $retour, ''); 30 **/ 31 function formulaires_editer_shortcut_url_charger_dist($id_shortcut_url = 'new', $objet = '', $id_objet = '', $retour = '', $ajaxload = 'oui', $options = '') { 32 $valeurs = formulaires_editer_objet_charger('shortcut_url', $id_shortcut_url, '', '', $retour, ''); 33 33 34 34 if (defined('_TAILLE_RACCOURCI')) { 35 if (_TAILLE_RACCOURCI >= 5) {35 if (_TAILLE_RACCOURCI >= 5) { 36 36 $valeurs['taille_raccourci'] = _TAILLE_RACCOURCI; 37 } else {37 } else { 38 38 $valeurs['taille_raccourci'] = 8; 39 39 } 40 40 } else { 41 41 $valeurs['taille_raccourci'] = 8; 42 42 } 43 43 return $valeurs; 44 44 } 45 function formulaires_editer_shortcut_url_verifier_dist($id_shortcut_url = 'new', $objet = '', $id_objet = '', $retour = '', $ajaxload = 'oui', $options = '') { 46 $erreurs = formulaires_editer_objet_verifier('shortcut_url', $id_shortcut_url, array( 47 'url' 48 )); 45 49 46 function formulaires_editer_shortcut_url_verifier_dist($id_shortcut_url='new', $objet='', $id_objet='', $retour='', $ajaxload='oui', $options=''){ 47 $erreurs = formulaires_editer_objet_verifier('shortcut_url',$id_shortcut_url,array('url')); 48 49 if (!$url = _request('url')){ 50 if (!$url = _request('url')) { 50 51 $erreurs['url'] = _T('info_obligatoire'); 51 52 } else { … … 54 55 if (filter_var($url, FILTER_VALIDATE_URL) === false) { 55 56 $erreurs['url'] = _T('shortcut_url:erreur_url_invalide'); 56 } 57 else{ 57 } else { 58 58 // On supprime ?var_mode=recalcul et autres var_mode (cf traiter aussi) 59 $url = parametre_url($url, 'var_mode','');59 $url = parametre_url($url, 'var_mode', ''); 60 60 // Check si l'URL existe deja 61 if (($id_shortcut_url == 'oui') && ($id_shortcut_url_existe = sql_getfetsel('id_shortcut_url', 'spip_shortcut_urls', 'url=' . sql_quote($url)))){62 set_request('id_shortcut_url_existe', $id_shortcut_url_existe);61 if (($id_shortcut_url == 'oui') && ($id_shortcut_url_existe = sql_getfetsel('id_shortcut_url', 'spip_shortcut_urls', 'url=' . sql_quote($url)))) { 62 set_request('id_shortcut_url_existe', $id_shortcut_url_existe); 63 63 $erreurs['url'] = _T('shortcut_url:erreur_url_exist'); 64 64 } … … 66 66 } 67 67 // On vérifie que l'URL raccourcie n'existe pas 68 if (_request('titre')) {68 if (_request('titre')) { 69 69 $id_shortcut_url_existe = sql_getfetsel('id_shortcut_url', 'spip_shortcut_urls', 'titre=' . sql_quote(_request('titre'))); 70 if ($id_shortcut_url_existe){71 set_request('id_shortcut_url_existe', $id_shortcut_url_existe);70 if ($id_shortcut_url_existe) { 71 set_request('id_shortcut_url_existe', $id_shortcut_url_existe); 72 72 $erreurs['titre'] = _T('shortcut_url:erreur_url_raccourcis_exist'); 73 73 } … … 78 78 79 79 // http://doc.spip.org/@inc_editer_shortcut_url_dist 80 function formulaires_editer_shortcut_url_traiter_dist($id_shortcut_url='new', $objet='', $id_objet='', $retour='', $ajaxload='oui', $options=''){ 81 80 function formulaires_editer_shortcut_url_traiter_dist($id_shortcut_url = 'new', $objet = '', $id_objet = '', $retour = '', $ajaxload = 'oui', $options = '') { 82 81 include_spip('inc/distant'); 83 82 $recup = recuperer_page(_request('url'), true); 84 if (preg_match(',<title[^>]*>(.*),i', $recup, $regs)) 83 if (preg_match(',<title[^>]*>(.*),i', $recup, $regs)) { 85 84 $result['nom_site'] = filtrer_entites(supprimer_tags(preg_replace(',</title>.*,i', '', $regs[1]))); 85 } 86 86 87 87 if (defined('_TAILLE_RACCOURCI')) { 88 if (_TAILLE_RACCOURCI >= 5) {88 if (_TAILLE_RACCOURCI >= 5) { 89 89 $taille_raccourci = _TAILLE_RACCOURCI; 90 90 } else { … … 96 96 97 97 $set = array(); 98 if (_request('titre')) {98 if (_request('titre')) { 99 99 $set['titre'] = _request('titre'); 100 100 } else { … … 103 103 $set['description'] = $result['nom_site']; 104 104 // On supprime ?var_mode=recalcul et autres var_mode 105 $set['url'] = parametre_url(_request('url'), 'var_mode','');105 $set['url'] = parametre_url(_request('url'), 'var_mode', ''); 106 106 $set['ip_address'] = $_SERVER['REMOTE_ADDR']; 107 107 $set['date_modif'] = date('Y-m-d H:i:s'); 108 109 if (intval($id_shortcut_url) > 0) {110 sql_delete('spip_urls', 'type='.sql_quote('shortcut_url'). ' AND id_objet=' .intval($id_shortcut_url));108 109 if (intval($id_shortcut_url) > 0) { 110 sql_delete('spip_urls', 'type=' . sql_quote('shortcut_url') . ' AND id_objet=' . intval($id_shortcut_url)); 111 111 } 112 $editer_objet = charger_fonction('editer_objet','action'); 113 $action = $editer_objet($id_shortcut_url, 'shortcut_url' , $set); 114 115 //$res = array('redirect' => self(), 'id_shortcut_url' => $id_shortcut_url); 116 $res = array('editable' => true, 'message_ok' => _T('shortcut_url:message_confirmation_shortcut_url')); 117 if(_request('exec') == 'accueil'){ 118 set_request('id_shortcut_url',false); 119 set_request('url',false); 120 set_request('titre',false); 112 $editer_objet = charger_fonction('editer_objet', 'action'); 113 $action = $editer_objet($id_shortcut_url, 'shortcut_url', $set); 114 115 // $res = array('redirect' => self(), 'id_shortcut_url' => $id_shortcut_url); 116 $res = array( 117 'editable' => true, 118 'message_ok' => _T('shortcut_url:message_confirmation_shortcut_url') 119 ); 120 if (_request('exec') == 'accueil') { 121 set_request('id_shortcut_url', false); 122 set_request('url', false); 123 set_request('titre', false); 121 124 } 122 125 $res['message_ok'] .= "<script type='text/javascript'>if (window.jQuery) $('.liste-objets.shortcut_url').ajaxReload();</script>"; -
_plugins_/shortcut_url/trunk/formulaires/shortcut_url_export_logs.php
r96613 r96982 1 1 <?php 2 2 /** 3 * shortcut_url3 * Gestion du formulaire d'export des shortcut_url des sites 4 4 * 5 5 * @plugin shortcut_url 6 6 * @copyright 2015 7 7 * @author cyp 8 * @licen ce GNU/GPL8 * @license GNU/GPL 9 9 * @package SPIP\formulaires\shortcut_url_export_logs 10 10 */ 11 11 12 /** 13 * Gestion du formulaire d'export des shortcut_url des sites 14 * 15 * @package SPIP\Formulaires 16 **/ 17 if (!defined('_ECRIRE_INC_VERSION')) return; 12 13 if (!defined('_ECRIRE_INC_VERSION')) { 14 return; 15 } 18 16 19 17 /** … … 22 20 * @return array 23 21 * Environnement du formulaire 24 **/ 25 function formulaires_shortcut_url_export_logs_charger_dist(){ 26 22 */ 23 function formulaires_shortcut_url_export_logs_charger_dist() { 27 24 $valeurs = array(); 28 25 return $valeurs; 29 30 26 } 31 27 … … 35 31 * @return array 36 32 * Tableau des erreurs 37 **/ 38 function formulaires_shortcut_url_export_logs_verifier_dist(){ 39 33 */ 34 function formulaires_shortcut_url_export_logs_verifier_dist() { 40 35 $erreurs = array(); 41 36 return $erreurs; 42 43 37 } 44 38 … … 48 42 * @return array 49 43 * Retours du traitement 50 **/ 51 function formulaires_shortcut_url_export_logs_traiter_dist(){ 52 44 */ 45 function formulaires_shortcut_url_export_logs_traiter_dist() { 53 46 include_spip('inc/exporter_csv'); 54 47 $donnees = ''; … … 77 70 echo $donnees; 78 71 79 // $telecharger = recuperer_fond('inclure/export_csv', array('date' => $date, 'date_jour' => $date_jour, 'nom_fichier_csv' => $nom_fichier_csv, 'id_shortcut_url' => $valeur['id_shortcut_url']), array('ajax' => false));80 // spip_log($telecharger, 'test.' . _LOG_ERREUR);81 82 72 return array('editable' => false, 'message_ok'=>_T('shortcut_url:config_export_ok')); 83 84 73 }
Note: See TracChangeset
for help on using the changeset viewer.