Changeset 20088 for extensions/Piwecard/include
- Timestamp:
- Jan 12, 2013, 12:57:22 PM (12 years ago)
- Location:
- extensions/Piwecard/include
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Piwecard/include/config_param.inc.php
r20080 r20088 5 5 // Fichier contenant les parametres du plugin (pour le parser) 6 6 $ecard_parse = array( 7 '%yourname%' => isset($ _POST['ecard_sender_name']) ? $_POST['ecard_sender_name'] : '' ,8 '%youremail%' => isset($ _POST['ecard_sender_email']) ? $_POST['ecard_sender_email'] : '' ,9 '%recipientname%' => isset($ _POST['ecard_recipient_name']) ? $_POST['ecard_recipient_name'] : '' ,10 '%recipientemail%' => isset($ _POST['ecard_recipient_email']) ? $_POST['ecard_recipient_email'] : '' ,7 '%yourname%' => isset($post['ecard_sender_name']) ? $post['ecard_sender_name'] : '' , 8 '%youremail%' => isset($post['ecard_sender_email']) ? $post['ecard_sender_email'] : '' , 9 '%recipientname%' => isset($post['ecard_recipient_name']) ? $post['ecard_recipient_name'] : '' , 10 '%recipientemail%' => isset($post['ecard_recipient_email']) ? $post['ecard_recipient_email'] : '' , 11 11 '%website%' => isset($conf['gallery_title']) ? $conf['gallery_title'] : '' , 12 12 '%websiteurl%' => get_absolute_root_url() , 13 13 '%ecardurl%' => isset($image_element['ecard_url']) ? $image_element['ecard_url'] : '' , 14 '%ecardsubject%' => isset($ _POST['ecard_title']) ? $_POST['ecard_title'] : '' ,15 '%ecardmessage%' => isset($ _POST['ecard_message']) ? $_POST['ecard_message'] : '' ,14 '%ecardsubject%' => isset($post['ecard_title']) ? $post['ecard_title'] : '' , 15 '%ecardmessage%' => isset($post['ecard_message']) ? $post['ecard_message'] : '' , 16 16 '%pictureurl%' => DerivativeImage::thumb_url($image_element) , 17 17 '%pictureinfos%' => isset($image_element['picture_infos']) ? $image_element['picture_infos'] : '' , -
extensions/Piwecard/include/piwecard.class.php
r20080 r20088 3 3 4 4 class Piwecard { 5 var $ my_config;5 var $config; 6 6 var $user_groups = array(); 7 7 … … 19 19 $row = pwg_db_fetch_row($result); 20 20 if(is_string($row[0])) { 21 $this-> my_config = unserialize(($row[0]));21 $this->config = unserialize(($row[0])); 22 22 } 23 23 } … … 29 29 require(PIWECARD_INSTALL_PATH.'default_values.inc.php'); 30 30 foreach ($ecard_default_values as $key => $value) { 31 if (!isset($this-> my_config[$key]))32 $this-> my_config[$key] = $value;31 if (!isset($this->config[$key])) 32 $this->config[$key] = $value; 33 33 } 34 34 } … … 36 36 // Save general configuration to config_database 37 37 function set_config() { 38 conf_update_param('piwecard', pwg_db_real_escape_string(serialize($this-> my_config)));38 conf_update_param('piwecard', pwg_db_real_escape_string(serialize($this->config))); 39 39 } 40 40 … … 65 65 } 66 66 67 function parse($data, $post = null, $image_element = NULL) { 68 $_POST = $post; 67 function parse($data, $post, $image_element) { 69 68 include (PIWECARD_PATH.'include/config_param.inc.php'); 70 69 … … 187 186 } 188 187 189 if ($this-> my_config['authorized_cats'] == 'user') { // !Function only allowed on user image188 if ($this->config['authorized_cats'] == 'user') { // !Function only allowed on user image 190 189 if (isset($cat) and !empty($cat)) { 191 190 $catname[0] = $cat['name']; … … 211 210 212 211 // Only on available cats 213 if (($this-> my_config['authorized_cats'] == 'all') //Parameter : all214 OR ($this-> my_config['authorized_cats'] == 'selected' AND !empty($upper_ids) AND (array_intersect($upper_ids, $this->my_config['selected_cats']) != array())) //Parameter : selected215 OR ($this-> my_config['authorized_cats'] == 'user' AND (in_array($username, $catname) OR $username == $authorname)) //Parameter : user212 if (($this->config['authorized_cats'] == 'all') //Parameter : all 213 OR ($this->config['authorized_cats'] == 'selected' AND !empty($upper_ids) AND (array_intersect($upper_ids, $this->config['selected_cats']) != array())) //Parameter : selected 214 OR ($this->config['authorized_cats'] == 'user' AND (in_array($username, $catname) OR $username == $authorname)) //Parameter : user 216 215 ) { 217 216 // Check if user is guest. 218 217 // In this case, force mail to default mail (in configuration) 219 218 if (is_a_guest()) { 220 if (!empty($this-> my_config['default_guest_email']))221 $user['email'] = $this-> my_config['default_guest_email'];219 if (!empty($this->config['default_guest_email'])) 220 $user['email'] = $this->config['default_guest_email']; 222 221 } 223 222 … … 230 229 'recipient_name' => l10n('piwecard_recipient_name'), 231 230 'recipient_email' => l10n('piwecard_recipient_email'), 232 'copy' => $this-> my_config['sender_copy'] ? 'checked="checked"' : '',233 'changemail' => (!isset($user['email']) OR $this-> my_config['sender_email_change']) ? '' : 'disabled="disabled"'231 'copy' => $this->config['sender_copy'] ? 'checked="checked"' : '', 232 'changemail' => (!isset($user['email']) OR $this->config['sender_email_change']) ? '' : 'disabled="disabled"' 234 233 ) 235 234 ); 236 235 237 236 // Template add for the active parameter choice by the user 238 if ($this-> my_config['validity_choice']) {239 foreach($this-> my_config['validity'] as $validity) {237 if ($this->config['validity_choice']) { 238 foreach($this->config['validity'] as $validity) { 240 239 $template->append('ecard_validity', array( 241 240 'id' => $validity, 242 241 'name' => ($validity == 0) ? l10n('piwecard_nolimit') : $validity.' '.l10n('piwecard_days'), 243 'selected' => ($this-> my_config['validity_default'] == $validity ? 'checked' : '')242 'selected' => ($this->config['validity_default'] == $validity ? 'checked' : '') 244 243 ) 245 244 ); … … 247 246 } 248 247 249 foreach ($this-> my_config['email_format_authorized'] as $email_format) {248 foreach ($this->config['email_format_authorized'] as $email_format) { 250 249 $template->append('ecard_email_format', array( 251 250 'id' => $email_format, 252 251 'name' => l10n('piwecard_email_format_'.$email_format), 253 'selected' => (($this-> my_config['email_format_default'] == $email_format) ? 'checked' : ''),252 'selected' => (($this->config['email_format_default'] == $email_format) ? 'checked' : ''), 254 253 ) 255 254 ); … … 261 260 262 261 // If conf doesn't allow to modify the %yourmail% param, force it to user mail 263 if (!$this-> my_config['sender_email_change'])262 if (!$this->config['sender_email_change']) 264 263 $_POST['ecard_sender_email'] = $user['email']; 265 264 … … 281 280 282 281 // Image infos 283 if ($this-> my_config['show_image_infos']) {282 if ($this->config['show_image_infos']) { 284 283 if (isset($image_element['name'])) { 285 284 $image_element['picture_infos'] = $image_element['name']; … … 324 323 unset_make_full_url(); 325 324 326 $email_subject = htmlspecialchars_decode($this->parse( $this->my_config['email_subject'], $_POST));327 $email_message = htmlspecialchars_decode($this->parse($this-> my_config['email_message'][$email_format], $_POST, $image_element));328 $email_arg=array( 'from' => $_POST['ecard_sender_email'],325 $email_subject = htmlspecialchars_decode($this->parse($this->config['email_subject'], $_POST, $image_element)); 326 $email_message = htmlspecialchars_decode($this->parse($this->config['email_message'][$email_format], $_POST, $image_element)); 327 $email_arg=array( 'from' => $_POST['ecard_sender_email'], 329 328 'subject' => $email_subject, 330 329 'content' => $email_message, -
extensions/Piwecard/include/publish.inc.php
r20080 r20088 4 4 global $template; 5 5 6 $ ecard = new Piwecard();6 $piwecard = new Piwecard(); 7 7 8 8 $ecard_id = explode('ecard/', $_SERVER['REQUEST_URI']); 9 9 $ecard_id = $ecard_id[1]; 10 10 11 if (isset($ecard_id) and $ecard_id != '' and $ ecard->is_valid($ecard_id)) {11 if (isset($ecard_id) and $ecard_id != '' and $piwecard->is_valid($ecard_id)) { 12 12 $query = 'SELECT * FROM '.PIWECARD_TABLE.' WHERE id = "'.$ecard_id.'";'; 13 13 $result = pwg_query($query); … … 40 40 'sender_email' => $result_array['sender_email'], 41 41 'sender_name' => $result_array['sender_name'], 42 'image_title' => (($ ecard->my_config['show_image_infos'] == '1') ? $row['name'] : null),43 'image_author' => (($ ecard->my_config['show_image_infos'] == '1') ? $row['author'] : null),42 'image_title' => (($piwecard->config['show_image_infos'] == '1') ? $row['name'] : null), 43 'image_author' => (($piwecard->config['show_image_infos'] == '1') ? $row['author'] : null), 44 44 )); 45 45
Note: See TracChangeset
for help on using the changeset viewer.