Ignore:
Timestamp:
Jan 11, 2013, 12:44:10 AM (11 years ago)
Author:
julien1311
Message:

[piwecard] some updates (almost 2.4.a.b2)

File:
1 edited

Legend:

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

    r20047 r20059  
    2727        // Initialize default values of params
    2828        private function get_default_config() {
    29             require(ECARD_INSTALL_PATH.'default_values.inc.php');
     29            require(PIWECARD_INSTALL_PATH.'default_values.inc.php');
    3030            foreach ($ecard_default_values as $key => $value) {
    3131                    if (!isset($this->my_config[$key]))
     
    6666       
    6767        function parse($data, $_POST = NULL, $image_element = NULL) {
    68                 include (ECARD_PATH.'include/config_param.inc.php');
     68                include (PIWECARD_PATH.'include/config_param.inc.php');
    6969
    7070                $patterns = array();
     
    8080        // Get the number of ecard in the database
    8181        function get_nb_ecard() {
    82                 $query = 'SELECT COUNT(DISTINCT id) AS nb FROM '.ECARD_TABLE.' ORDER BY date_creation;';
     82                $query = 'SELECT COUNT(DISTINCT id) AS nb FROM '.PIWECARD_TABLE.' ORDER BY date_creation;';
    8383                $result = pwg_query($query);
    8484               
     
    9292        // Get the number of valid ecard in the database
    9393        function get_nb_valid_ecard() {
    94                 $query = 'SELECT COUNT(DISTINCT id) AS nb FROM '.ECARD_TABLE.' WHERE date_validity IS NULL OR date_validity > NOW();';
     94                $query = 'SELECT COUNT(DISTINCT id) AS nb FROM '.PIWECARD_TABLE.' WHERE date_validity IS NULL OR date_validity > NOW();';
    9595                $result = pwg_query($query);
    9696               
     
    106106        function get_ecard($ecard_id = null) {
    107107                if ($ecard_id!== null) {
    108                         $query = 'SELECT * FROM ' . ECARD_TABLE .' WHERE id ="' . $ecard_id . '" LIMIT 1;';
     108                        $query = 'SELECT * FROM ' . PIWECARD_TABLE .' WHERE id ="' . $ecard_id . '" LIMIT 1;';
    109109
    110110                        $result = pwg_query($query);
     
    144144        function delete_ecard($ecard_id = null) {
    145145                if (isset($ecard_id)) {
    146                         $query = 'DELETE FROM ' . ECARD_TABLE .' WHERE id="' . $ecard_id  . '";';
     146                        $query = 'DELETE FROM ' . PIWECARD_TABLE .' WHERE id="' . $ecard_id  . '";';
    147147                        pwg_query($query);
    148148                } else
     
    152152        // Delete all invalid ecard
    153153        function delete_allinvalid_ecard() {
    154                 $query = 'DELETE FROM ' . ECARD_TABLE .' WHERE date_validity < NOW();';
     154                $query = 'DELETE FROM ' . PIWECARD_TABLE .' WHERE date_validity < NOW();';
    155155                pwg_query($query);
    156156        }
     
    223223                                // Template informations
    224224                                $template->assign('ecard', array(
    225                                                 'subject'                       => l10n('piwecard_subject'),
     225                                                'title'                         => l10n('Title'),
    226226                                                'message'                       => l10n('piwecard_message'),
    227227                                                'sender_name'           => $user['username'],
     
    249249                                        $template->append('ecard_email_format', array(
    250250                                                                                                                                'id' => $email_format,
    251                                                                                                                                 'name' => l10n('piwecard_mail_format_'.$email_format),
     251                                                                                                                                'name' => l10n('piwecard_email_format_'.$email_format),
    252252                                                                                                                                'selected' => (($this->my_config['email_format_default'] == $email_format) ?  '' : 'checked'),
    253253                                                                                                                        )
     
    290290                                                                'sender_email'          => $_POST['ecard_sender_email'],
    291291                                                                'recipient_email'       => $_POST['ecard_recipient_email'],
    292                                                                 'subject'                       => $_POST['ecard_subject'],
     292                                                                'title'                         => $_POST['ecard_title'],
    293293                                                                'message'                       => $_POST['ecard_message'],
    294294                                                                'image'                         => $image_element['id'],
     
    300300                                                $insert['date_validity'] = $date->format('Y-m-d H:i:s');
    301301                                        }
    302                                         single_insert(ECARD_TABLE, $insert);
     302                                        single_insert(PIWECARD_TABLE, $insert);
    303303                                       
    304304                                        // Complete the image_element array with Link for the ecard url to be added in the mail
     
    352352                                }
    353353                               
    354                                 $template->set_filenames(array('ecard_template' =>  ECARD_ROOT.'/template/ecard.tpl'));
     354                                $template->set_filenames(array('ecard_template' =>  PIWECARD_ROOT.'/template/ecard.tpl'));
    355355                                $template->concat('COMMENT_IMG', $template->parse('ecard_template', true));
    356356                        }
Note: See TracChangeset for help on using the changeset viewer.