Ignore:
Timestamp:
Jan 12, 2013, 12:57:22 PM (11 years ago)
Author:
julien1311
Message:

[piwecard] rename some variables to be coherent with core naming (authorization => permission)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/Piwecard/include/piwecard.class.php

    r20080 r20088  
    33
    44class Piwecard {
    5         var $my_config;
     5        var $config;
    66        var $user_groups = array();
    77       
     
    1919                        $row = pwg_db_fetch_row($result);
    2020                        if(is_string($row[0])) {
    21                                 $this->my_config = unserialize(($row[0]));
     21                                $this->config = unserialize(($row[0]));
    2222                        }
    2323            }
     
    2929            require(PIWECARD_INSTALL_PATH.'default_values.inc.php');
    3030            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;
    3333                }
    3434        }
     
    3636        // Save  general configuration to config_database
    3737        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)));
    3939        }
    4040       
     
    6565        }
    6666       
    67         function parse($data, $post = null, $image_element = NULL) {
    68     $_POST = $post;
     67        function parse($data, $post, $image_element) {
    6968                include (PIWECARD_PATH.'include/config_param.inc.php');
    7069
     
    187186                        }
    188187                       
    189                         if ($this->my_config['authorized_cats'] == 'user') {    // !Function only allowed on user image
     188                        if ($this->config['authorized_cats'] == 'user') {       // !Function only allowed on user image
    190189                                if (isset($cat) and !empty($cat)) {
    191190                                        $catname[0] = $cat['name'];
     
    211210                       
    212211                        // Only on available cats
    213                         if (($this->my_config['authorized_cats'] == 'all')              //Parameter : all
    214                                 OR ($this->my_config['authorized_cats'] == 'selected' AND !empty($upper_ids) AND (array_intersect($upper_ids, $this->my_config['selected_cats']) != array())) //Parameter : selected
    215                                 OR      ($this->my_config['authorized_cats'] == 'user' AND (in_array($username, $catname) OR $username == $authorname)) //Parameter : user
     212                        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
    216215                        ) {
    217216                                // Check if user is guest.
    218217                                // In this case, force mail to default mail (in configuration)
    219218                                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'];
    222221                                }
    223222                       
     
    230229                                                'recipient_name'        => l10n('piwecard_recipient_name'),
    231230                                                '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"'
    234233                                                )
    235234                                );
    236235
    237236                                // 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) {
    240239                                                $template->append('ecard_validity', array(
    241240                                                                                                                                        'id' => $validity,
    242241                                                                                                                                        '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' : '')
    244243                                                                                                                                )
    245244                                                );
     
    247246                                }
    248247
    249                                 foreach ($this->my_config['email_format_authorized'] as $email_format) {
     248                                foreach ($this->config['email_format_authorized'] as $email_format) {
    250249                                        $template->append('ecard_email_format', array(
    251250                                                                                                                                'id' => $email_format,
    252251                                                                                                                                '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' : ''),
    254253                                                                                                                        )
    255254                                        );
     
    261260                                       
    262261                                        // 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'])
    264263                                                $_POST['ecard_sender_email'] = $user['email'];
    265264                                       
     
    281280
    282281                                        // Image infos
    283                                         if ($this->my_config['show_image_infos']) {
     282                                        if ($this->config['show_image_infos']) {
    284283                                                if (isset($image_element['name'])) {
    285284                                                        $image_element['picture_infos'] = $image_element['name'];
     
    324323                                        unset_make_full_url();
    325324
    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'],
    329328                                                                                'subject'                       => $email_subject,
    330329                                                                                'content'                       => $email_message,
Note: See TracChangeset for help on using the changeset viewer.