Changeset 20088 for extensions/Piwecard/include/piwecard.class.php
- Timestamp:
- Jan 12, 2013, 12:57:22 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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,
Note: See TracChangeset
for help on using the changeset viewer.