Changeset 20032 for extensions/Piwecard/include/piwecard.class.php
- Timestamp:
- Jan 10, 2013, 12:59:07 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Piwecard/include/piwecard.class.php
r20013 r20032 8 8 // Class constructor 9 9 function __construct() { 10 $this-> load_config();10 $this->get_config(); 11 11 } 12 12 13 13 // Load general configuration from config_database 14 function load_config() {14 function get_config() { 15 15 $query = 'SELECT value FROM '.CONFIG_TABLE.' WHERE param="piwecard";'; 16 16 $result = pwg_query($query); … … 22 22 } 23 23 } 24 $this-> load_default_config();24 $this->get_default_config(); 25 25 } 26 26 27 27 // Initialize default values of params 28 private function load_default_config() {28 private function get_default_config() { 29 29 require(ECARD_INSTALL_PATH.'default_values.inc.php'); 30 30 foreach ($ecard_default_values as $key => $value) { … … 35 35 36 36 // Save general configuration to config_database 37 function s ave_config() {37 function set_config() { 38 38 conf_update_param('piwecard', pwg_db_real_escape_string(serialize($this->my_config))); 39 39 } … … 50 50 51 51 if (isset($page['section']) and $page['section'] == 'ecard') { 52 include( ECARD_PATH . 'publish.php');52 include('publish.inc.php'); 53 53 } 54 54 } … … 173 173 $upper_ids = null; 174 174 } else { 175 foreach ($cat as $k => $v) {176 // If the field is true or false, the variable is transformed into a177 // boolean value.178 if ($cat[$k] == 'true' or $cat[$k] == 'false') {179 $cat[$k] = get_boolean($cat[$k]);180 }181 }182 175 $upper_ids = explode(',', $cat['uppercats']); 183 176 } 184 177 } 185 178 186 if ($this->my_config['authorizations'] == 'user_cats') { // !Function only allowed on user image 187 // Check the category name, user name et img author 188 // Get all name for upper categories and current category 179 if ($this->my_config['authorized_cats'] == 'user') { // !Function only allowed on user image 189 180 if (isset($cat) and !empty($cat)) { 190 181 $catname[0] = $cat['name']; … … 192 183 $nb=1; 193 184 foreach ($upper_ids as $upper_cat) { 194 // Get upper cat info and store the name195 185 $cat_info = get_cat_info($upper_cat); 196 186 $catname[$nb++] = $cat_info['name']; … … 211 201 212 202 // Only on available cats 213 if (($this->my_config['authoriz ations'] == 'all_cats') //Parameter : all_cats214 OR ($this->my_config['authoriz ations'] == 'selected_cats' AND isset($upper_ids) AND (array_intersect($upper_ids, $this->my_config['selected_cats']) != array())) //Parameter : selected_cats and recursive215 OR ($this->my_config['authoriz ations'] == 'user_cats' AND (in_array($username, $catname) OR $username == $authorname)) //Parameter : user_cats203 if (($this->my_config['authorized_cats'] == 'all') //Parameter : all 204 OR ($this->my_config['authorized_cats'] == 'selected' AND !empty($upper_ids) AND (array_intersect($upper_ids, $this->my_config['selected_cats']) != array())) //Parameter : selected 205 OR ($this->my_config['authorized_cats'] == 'user' AND (in_array($username, $catname) OR $username == $authorname)) //Parameter : user 216 206 ) { 217 207 // Check if user is guest. 218 // In this case, force mail to default mail (in params)208 // In this case, force mail to default mail (in configuration) 219 209 if (is_a_guest()) { 220 210 if (!empty($this->my_config['default_guest_email'])) … … 224 214 // Template informations 225 215 $template->assign('ecard', array( 226 'subject' => l10n('ecard_s end_title'),227 'message' => l10n('ecard_ send_message'),216 'subject' => l10n('ecard_subject'), 217 'message' => l10n('ecard_message'), 228 218 'sender_name' => $user['username'], 229 219 'sender_email' => $user['email'], 230 'recipient_name' => l10n('ecard_ send_dest_name'),231 'recipient_email' => l10n('ecard_ send_dest_mail'),220 'recipient_name' => l10n('ecard_recipient_name'), 221 'recipient_email' => l10n('ecard_recipient_email'), 232 222 'copy' => $this->my_config['sender_copy'] ? 'checked="checked"' : '', 233 223 'changemail' => (!isset($user['email']) OR $this->my_config['sender_email_change']) ? '' : 'disabled="disabled"' … … 248 238 249 239 foreach ($this->my_config['email_format'] as $email_format) { 250 $template->append('ecard_ send_method', array(240 $template->append('ecard_email_format', array( 251 241 'id' => $email_format, 252 242 'name' => l10n('ecard_mail_format_'.$email_format), … … 258 248 // Send the card 259 249 if (isset($_POST['ecard_submit'])) { 260 $ send_method = $_POST['ecard_send_method'];261 262 // If conf doesn't allow to modify the % votremailparam, force it to user mail250 $email_format = $_POST['ecard_email_format']; 251 252 // If conf doesn't allow to modify the %yourmail% param, force it to user mail 263 253 if (!$this->my_config['sender_email_change']) 264 254 $_POST['ecard_sender_email'] = $user['email']; … … 321 311 322 312 $email_subject = htmlspecialchars_decode($this->parse( $this->my_config['email_subject'], $_POST)); 323 $email_message = htmlspecialchars_decode($this->parse($this->my_config['email_message'][$ send_method], $_POST, $image_element));313 $email_message = htmlspecialchars_decode($this->parse($this->my_config['email_message'][$email_format], $_POST, $image_element)); 324 314 $email_arg=array( 'from' => $_POST['ecard_sender_email'], 325 315 'subject' => $email_subject, … … 327 317 ); 328 318 329 switch($ send_method) {319 switch($email_format) { 330 320 case 'text': // text 331 $email_arg=array( 'content_format' => "text/plain", 332 'email_format' => "text/plain" 333 ); 321 $email_arg = array_merge($email_arg, array( 322 'content_format' => "text/plain", 323 'email_format' => "text/plain" 324 ) 325 ); 334 326 break; 335 327 case 'html': // html 336 $email_arg=array( 'content_format' => "text/html", 337 'email_format' => "text/html" 338 ); 339 break; 328 $email_arg = array_merge($email_arg, array( 329 'content_format' => "text/html", 330 'email_format' => "text/html" 331 ) 332 ); 340 333 default: 341 334 break;
Note: See TracChangeset
for help on using the changeset viewer.