[ Index ] |
|
Code source de IMP H3 (4.1.5) |
1 <?php 2 /** 3 * $Horde: imp/stationery.php,v 2.1.2.4 2007/01/02 13:54:54 jan Exp $ 4 * 5 * Copyright 2005-2007 Jan Schneider <jan@horde.org> 6 * 7 * See the enclosed file COPYING for license information (GPL). If you did 8 * not receive this file, see http://www.fsf.org/copyleft/gpl.html. 9 */ 10 11 @define('IMP_BASE', dirname(__FILE__)); 12 $authentication = OP_HALFOPEN; 13 require_once IMP_BASE . '/lib/base.php'; 14 require_once 'Horde/Prefs/UI.php'; 15 16 $compose_url = Util::addParameter(Horde::url($registry->get('webroot', 'horde') . '/services/prefs.php', true), 'app', 'imp', false); 17 18 /* Is the preference locked? */ 19 if ($prefs->isLocked('stationery')) { 20 header('Location: ' . $compose_url); 21 exit; 22 } 23 24 /* Retrieve stationery. */ 25 $stationery_list = @unserialize($prefs->getValue('stationery', false)); 26 if (is_array($stationery_list)) { 27 $stationery_list = String::convertCharset($stationery_list, $prefs->getCharset()); 28 } else { 29 $stationery_list = array(); 30 } 31 $stationery = null; 32 33 /* Get form data. */ 34 $id = Util::getFormData('id'); 35 if (!is_null($id)) { 36 $id = (int)$id; 37 } 38 $selected = Util::getFormData('stationery'); 39 if (strlen($selected)) { 40 $selected = (int)$selected; 41 } 42 43 /* Run through the action handlers. */ 44 $actionID = Util::getFormData('actionID'); 45 $updated = false; 46 switch ($actionID) { 47 case 'update': 48 if (Util::getFormData('edit')) { 49 /* Stationery has been switched. */ 50 if (strlen($selected)) { 51 /* Edit existing. */ 52 $stationery = array('n' => $stationery_list[$selected]['n'], 53 't' => $stationery_list[$selected]['t'], 54 'c' => $stationery_list[$selected]['c']); 55 $id = $selected; 56 } else { 57 /* Create new. */ 58 $stationery = array('n' => '', 't' => 'plain', 'c' => ''); 59 } 60 } elseif (Util::getFormData('delete')) { 61 /* Delete stationery. */ 62 if (isset($stationery_list[$id])) { 63 $updated = sprintf(_("The stationery \"%s\" has been deleted."), $stationery_list[$id]['n']); 64 unset($stationery_list[$id]); 65 } 66 } else { 67 $last_type = Util::getFormData('last_type'); 68 $type = Util::getFormData('type', 'plain'); 69 $name = Util::getFormData('name', ''); 70 $content = Util::getFormData('content', ''); 71 $stationery = array('n' => $name, 't' => $type, 'c' => $content); 72 if (!empty($last_type)) { 73 if ($last_type != $type) { 74 /* Switching text format. */ 75 if ($type == 'plain') { 76 require_once 'Horde/Text/Filter.php'; 77 $content = Text_Filter::filter($content, 'html2text'); 78 } 79 $stationery['c'] = $content; 80 } else { 81 /* Saving stationery. */ 82 if (is_null($id)) { 83 $id = count($stationery_list); 84 $stationery_list[] = $stationery; 85 $updated = sprintf(_("The stationery \"%s\" has been added."), $stationery['n']); 86 } else { 87 $stationery_list[$id] = $stationery; 88 $updated = sprintf(_("The stationery \"%s\" has been updated."), $stationery['n']); 89 } 90 } 91 } elseif (!is_null($id)) { 92 $stationery = $stationery_list[$id]; 93 } 94 } 95 96 break; 97 } 98 99 if ($updated) { 100 $prefs->setValue('stationery', serialize(String::convertCharset($stationery_list, NLS::getCharset(), $prefs->getCharset())), false); 101 $notification->push($updated, 'horde.success'); 102 } 103 104 if (!is_null($stationery) && $stationery['t'] == 'html') { 105 require_once 'Horde/Editor.php'; 106 $editor = &Horde_Editor::singleton('xinha', array('id' => 'content')); 107 } 108 109 /* Show the header. */ 110 require_once 'Horde/Prefs/UI.php'; 111 require IMP_BASE . '/config/prefs.php'; 112 $app = 'imp'; 113 $group = 'compose'; 114 115 Prefs_UI::generateHeader(); 116 require IMP_TEMPLATES . '/stationery/prefs.inc'; 117 118 require $registry->get('templates', 'horde') . '/common-footer.inc';
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Nov 29 12:30:07 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |