Changeset 1244

Show
Ignore:
Timestamp:
06/28/08 20:49:54 (4 months ago)
Author:
rats
Message:

GUI Update 2/5: orderpanel

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/gui/orderpanel/addon.php

    r1241 r1244  
    11<?php 
    22/** 
    3  * ispCP (OMEGA) - Virtual Hosting Control System | Omega Version 
     3 * ispCP ? (OMEGA) a Virtual Hosting Control System 
    44 * 
    5  *  @copyright  2001-2006 by moleSoftware GmbH 
    6  *  @copyright  2006-2007 by ispCP | http://isp-control.net 
    7  *  @link               http://isp-control.net 
    8  *  @author             ispCP Team (2007) 
    9  * 
    10  *  @license 
    11  *  This program is free software; you can redistribute it and/or modify it under 
    12  *  the terms of the MPL General Public License as published by the Free Software 
    13  *  Foundation; either version 1.1 of the License, or (at your option) any later 
    14  *  version. 
    15  *  You should have received a copy of the MPL Mozilla Public License along with 
    16  *  this program; if not, write to the Open Source Initiative (OSI) 
    17  *  http://opensource.org | osi@opensource.org 
    18  **/ 
     5 * @copyright 2001-2006 by moleSoftware GmbH 
     6 * @copyright 2006-2008 by ispCP | http://isp-control.net 
     7 * @version SVN: $ID$ 
     8 * @link http://isp-control.net 
     9 * @author ispCP Team 
     10 * @license This program is free software; you can redistribute it and/or modify it under 
     11 *    the terms of the MPL General Public License as published by the Free Software 
     12 *    Foundation; either version 1.1 of the License, or (at your option) any later 
     13 *    version. 
     14 *    You should have received a copy of the MPL Mozilla Public License along with 
     15 *    this program; if not, write to the Open Source Initiative (OSI) 
     16 *    http://opensource.org | osi@opensource.org 
     17 */ 
    1918 
    2019require '../include/ispcp-lib.php'; 
    2120 
    2221$tpl = new pTemplate(); 
     22$tpl->define_dynamic('page', Config::get('PURCHASE_TEMPLATE_PATH') . '/addon.tpl'); 
     23$tpl->define_dynamic('page_message', 'page'); 
     24$tpl->define_dynamic('purchase_header', 'page'); 
     25$tpl->define_dynamic('purchase_footer', 'page'); 
    2326 
    24 $tpl -> define_dynamic('page', Config::get('PURCHASE_TEMPLATE_PATH') . '/addon.tpl'); 
     27/** 
     28 * Functions start 
     29 */ 
    2530 
    26 $tpl -> define_dynamic('page_message', 'page'); 
     31function addon_domain($dmn_name) { 
     32    $dmn_name = strtolower($dmn_name); 
     33    $dmn_name = encode_idna($dmn_name); 
    2734 
    28 $tpl -> define_dynamic('purchase_header', 'page'); 
    29  
    30 $tpl -> define_dynamic('purchase_footer', 'page'); 
    31  
    32  
    33 /* 
    34 * Functions start 
    35 */ 
    36  
    37 function addon_domain($dmn_name) 
    38 
    39         $dmn_name = strtolower($dmn_name); 
    40         $dmn_name = encode_idna($dmn_name); 
    41  
    42         if (!chk_dname($dmn_name)) { 
    43  
     35    if (!chk_dname($dmn_name)) { 
    4436        set_page_message(tr('Wrong domain name syntax!')); 
    45                 return; 
    46  
     37        return; 
    4738    } else if (ispcp_domain_exists($dmn_name, 0)) { 
    48  
    4939        set_page_message(tr('Domain with that name already exists on the system!')); 
    50                 return; 
    51  
     40        return; 
    5241    } 
    5342 
    54         $_SESSION['domainname'] = $dmn_name; 
    55         header( "Location: address.php" ); 
    56         die(); 
    57  
     43    $_SESSION['domainname'] = $dmn_name; 
     44    header("Location: address.php"); 
     45    die(); 
    5846} 
    5947 
    60 /* 
    61 * Functions end 
    62 */ 
     48/** 
     49 * Functions end 
     50 */ 
    6351 
     52/** 
     53 * static page messages. 
     54 */ 
    6455 
     56if (isset($_SESSION['user_id'])) { 
     57    $user_id = $_SESSION['user_id']; 
    6558 
    66  
    67  
    68  
    69 /* 
    70 
    71 * static page messages. 
    72 
    73 */ 
    74  
    75 if (isset($_SESSION['user_id'])){ 
    76         $user_id = $_SESSION['user_id']; 
    77  
    78         if (isset($_SESSION['plan_id'])){ 
    79                 $plan_id = $_SESSION['plan_id']; 
    80         } else if(isset($_GET['id'])){ 
    81                 $plan_id = $_GET['id']; 
    82                 $_SESSION['plan_id'] = $plan_id; 
    83         } else { 
    84                 system_message(tr('You do not have permission to access this interface!')); 
    85         } 
     59    if (isset($_SESSION['plan_id'])) { 
     60        $plan_id = $_SESSION['plan_id']; 
     61    } else if (isset($_GET['id'])) { 
     62        $plan_id = $_GET['id']; 
     63        $_SESSION['plan_id'] = $plan_id; 
     64    } else { 
     65        system_message(tr('You do not have permission to access this interface!')); 
     66    } 
    8667} else { 
    87        system_message(tr('You do not have permission to access this interface!')); 
     68    system_message(tr('You do not have permission to access this interface!')); 
    8869} 
    8970 
    90 if (isset($_SESSION['domainname']))
    91        header( "Location: address.php" ); 
    92        die(); 
     71if (isset($_SESSION['domainname']))
     72    header("Location: address.php"); 
     73    die(); 
    9374} 
    9475 
    95 if (isset($_POST['domainname']) && $_POST['domainname'] != '')
    96        addon_domain($_POST['domainname']); 
     76if (isset($_POST['domainname']) && $_POST['domainname'] != '')
     77    addon_domain($_POST['domainname']); 
    9778} 
    9879 
    9980gen_purchase_haf($tpl, $sql, $user_id); 
    100  
    10181gen_page_message($tpl); 
    10282 
    103         $tpl -> assign( 
    104                 array( 
    105                         'DOMAIN_ADDON' => tr('Add On A Domain'), 
    106                                                 'TR_DOMAIN_NAME' => tr('Domain name'), 
    107                                                 'TR_CONTINUE' => tr('Continue'), 
    108                                                 'TR_EXAMPLE' => tr('(e.g. domain-of-your-choice.com)'), 
    109                                                 'THEME_CHARSET' => tr('encoding'), 
     83$tpl->assign( 
     84    array('DOMAIN_ADDON' => tr('Add On A Domain'), 
     85        'TR_DOMAIN_NAME' => tr('Domain name'), 
     86        'TR_CONTINUE' => tr('Continue'), 
     87        'TR_EXAMPLE' => tr('(e.g. domain-of-your-choice.com)'), 
     88        'THEME_CHARSET' => tr('encoding'), 
    11089 
     90        ) 
     91    ); 
    11192 
    112                                         ) 
    113                        ); 
     93$tpl->parse('PAGE', 'page'); 
     94$tpl->prnt(); 
    11495 
    115 $tpl -> parse('PAGE', 'page'); 
    116  
    117 $tpl -> prnt(); 
    118  
    119 if (Config::get('DUMP_GUI_DEBUG')) dump_gui_debug(); 
     96if (Config::get('DUMP_GUI_DEBUG')) 
     97    dump_gui_debug(); 
    12098 
    12199unset_messages(); 
     100 
    122101?> 
  • trunk/gui/orderpanel/address.php

    r1241 r1244  
    44 * 
    55 * @copyright   2001-2006 by moleSoftware GmbH 
    6  * @copyright   2006-2007 by ispCP | http://isp-control.net 
     6 * @copyright   2006-2008 by ispCP | http://isp-control.net 
     7 * @version     SVN: $ID$ 
    78 * @link                http://isp-control.net 
    8  * @author              ispCP Team (2007) 
     9 * @author              ispCP Team 
    910 * 
    1011 * @license 
     
    3132 
    3233function gen_address(&$tpl, &$sql, $user_id, $plan_id) { 
    33        if (isset($_POST['fname'])) { 
    34                $first_name = $_POST['fname']; 
    35        } else if (isset($_SESSION['fname'])) { 
    36                $first_name = $_SESSION['fname']; 
    37        } else { 
    38                $first_name = ''; 
    39        
    40  
    41        if (isset($_POST['lname'])) { 
    42                $last_name = $_POST['lname']; 
    43        } else if (isset($_SESSION['lname'])) { 
    44                $last_name = $_SESSION['lname']; 
    45        } else { 
    46                $last_name = ''; 
    47        
    48  
    49        if (isset($_POST['email'])) { 
    50                $email = $_POST['email']; 
    51        } else if (isset($_SESSION['email'])) { 
    52                $email = $_SESSION['email']; 
    53        } else { 
    54                $email = ''; 
    55        
    56  
    57        if (isset($_POST['gender'])) { 
    58                $gender = $_POST['gender']; 
    59        } else if (isset($_SESSION['gender'])) { 
    60                $gender = $_SESSION['gender']; 
    61        } else { 
    62                $gender = 'U'; 
    63        
    64  
    65        if (isset($_POST['firm'])) { 
    66                $company = $_POST['firm']; 
    67        } else if (isset($_SESSION['firm'])) { 
    68                $company = $_SESSION['firm']; 
    69        } else { 
    70                $company = ''; 
    71        
    72  
    73        if (isset($_POST['zip'])) { 
    74                $postal_code = $_POST['zip']; 
    75        } else if (isset($_SESSION['zip'])) { 
    76                $postal_code = $_SESSION['zip']; 
    77        } else { 
    78                $postal_code = ''; 
    79        
    80  
    81        if (isset($_POST['city'])) { 
    82                $city = $_POST['city']; 
    83        } else if (isset($_SESSION['city'])) { 
    84                $city = $_SESSION['city']; 
    85        } else { 
    86                $city = ''; 
    87        
    88  
    89        if (isset($_POST['country'])) { 
    90                $country = $_POST['country']; 
    91        } else if (isset($_SESSION['country'])) { 
    92                $country = $_SESSION['country']; 
    93        } else { 
    94                $country = ''; 
    95        
    96  
    97        if (isset($_POST['street1'])) { 
    98                $street1 = $_POST['street1']; 
    99        } else if (isset($_SESSION['street1'])) { 
    100                $street1 = $_SESSION['street1']; 
    101        } else { 
    102                $street1 = ''; 
    103        
    104  
    105        if (isset($_POST['street2'])) { 
    106                $street2 = $_POST['street2']; 
    107        } else if (isset($_SESSION['street2'])) { 
    108                $street2 = $_SESSION['street2']; 
    109        } else { 
    110                $street2 = ''; 
    111        
    112  
    113        if (isset($_POST['phone'])) { 
    114                $phone = $_POST['phone']; 
    115        } else if (isset($_SESSION['phone'])) { 
    116                $phone = $_SESSION['phone']; 
    117        } else { 
    118                $phone = ''; 
    119        
    120  
    121        if (isset($_POST['fax'])) { 
    122                $fax = $_POST['fax']; 
    123        } else if (isset($_SESSION['fax'])) { 
    124                $fax = $_SESSION['fax']; 
    125        } else { 
    126                $fax = ''; 
    127        
    128  
    129        $tpl->assign( 
    130                array('VL_USR_NAME' => $first_name, 
    131                        'VL_LAST_USRNAME' => $last_name, 
    132                        'VL_EMAIL' => $email, 
    133                        'VL_USR_FIRM' => $company, 
    134                        'VL_USR_POSTCODE' => $postal_code, 
    135                        'VL_USRCITY' => $city, 
    136                        'VL_COUNTRY' => $country, 
    137                        'VL_STREET1' => $street1, 
    138                        'VL_STREET2' => $street2, 
    139                        'VL_PHONE' => $phone, 
    140                        'VL_FAX' => $fax, 
    141                        'VL_MALE' => (($gender === 'M') ? 'checked' : ''), 
    142                        'VL_FEMALE' => (($gender === 'F') ? 'checked' : ''), 
    143                        'VL_UNKNOWN' => (($gender == 'U') ? 'checked' : '') 
    144                        
    145                ); 
     34    if (isset($_POST['fname'])) { 
     35        $first_name = $_POST['fname']; 
     36    } else if (isset($_SESSION['fname'])) { 
     37        $first_name = $_SESSION['fname']; 
     38    } else { 
     39        $first_name = ''; 
     40   
     41 
     42    if (isset($_POST['lname'])) { 
     43        $last_name = $_POST['lname']; 
     44    } else if (isset($_SESSION['lname'])) { 
     45        $last_name = $_SESSION['lname']; 
     46    } else { 
     47        $last_name = ''; 
     48   
     49 
     50    if (isset($_POST['email'])) { 
     51        $email = $_POST['email']; 
     52    } else if (isset($_SESSION['email'])) { 
     53        $email = $_SESSION['email']; 
     54    } else { 
     55        $email = ''; 
     56   
     57 
     58    if (isset($_POST['gender'])) { 
     59        $gender = $_POST['gender']; 
     60    } else if (isset($_SESSION['gender'])) { 
     61        $gender = $_SESSION['gender']; 
     62    } else { 
     63        $gender = 'U'; 
     64   
     65 
     66    if (isset($_POST['firm'])) { 
     67        $company = $_POST['firm']; 
     68    } else if (isset($_SESSION['firm'])) { 
     69        $company = $_SESSION['firm']; 
     70    } else { 
     71        $company = ''; 
     72   
     73 
     74    if (isset($_POST['zip'])) { 
     75        $postal_code = $_POST['zip']; 
     76    } else if (isset($_SESSION['zip'])) { 
     77        $postal_code = $_SESSION['zip']; 
     78    } else { 
     79        $postal_code = ''; 
     80   
     81 
     82    if (isset($_POST['city'])) { 
     83        $city = $_POST['city']; 
     84    } else if (isset($_SESSION['city'])) { 
     85        $city = $_SESSION['city']; 
     86    } else { 
     87        $city = ''; 
     88   
     89 
     90    if (isset($_POST['country'])) { 
     91        $country = $_POST['country']; 
     92    } else if (isset($_SESSION['country'])) { 
     93        $country = $_SESSION['country']; 
     94    } else { 
     95        $country = ''; 
     96   
     97 
     98    if (isset($_POST['street1'])) { 
     99        $street1 = $_POST['street1']; 
     100    } else if (isset($_SESSION['street1'])) { 
     101        $street1 = $_SESSION['street1']; 
     102    } else { 
     103        $street1 = ''; 
     104   
     105 
     106    if (isset($_POST['street2'])) { 
     107        $street2 = $_POST['street2']; 
     108    } else if (isset($_SESSION['street2'])) { 
     109        $street2 = $_SESSION['street2']; 
     110    } else { 
     111        $street2 = ''; 
     112   
     113 
     114    if (isset($_POST['phone'])) { 
     115        $phone = $_POST['phone']; 
     116    } else if (isset($_SESSION['phone'])) { 
     117        $phone = $_SESSION['phone']; 
     118    } else { 
     119        $phone = ''; 
     120   
     121 
     122    if (isset($_POST['fax'])) { 
     123        $fax = $_POST['fax']; 
     124    } else if (isset($_SESSION['fax'])) { 
     125        $fax = $_SESSION['fax']; 
     126    } else { 
     127        $fax = ''; 
     128   
     129 
     130    $tpl->assign( 
     131        array('VL_USR_NAME' => $first_name, 
     132            'VL_LAST_USRNAME' => $last_name, 
     133            'VL_EMAIL' => $email, 
     134            'VL_USR_FIRM' => $company, 
     135            'VL_USR_POSTCODE' => $postal_code, 
     136            'VL_USRCITY' => $city, 
     137            'VL_COUNTRY' => $country, 
     138            'VL_STREET1' => $street1, 
     139            'VL_STREET2' => $street2, 
     140            'VL_PHONE' => $phone, 
     141            'VL_FAX' => $fax, 
     142            'VL_MALE' => (($gender === 'M') ? 'checked' : ''), 
     143            'VL_FEMALE' => (($gender === 'F') ? 'checked' : ''), 
     144            'VL_UNKNOWN' => (($gender == 'U') ? 'checked' : '') 
     145           
     146        ); 
    146147} 
    147148 
    148149function check_address_data(&$tpl) { 
    149        if (isset($_GET['edit'])) 
    150                unset($_GET['edit']); 
    151        if ( 
    152                (isset($_POST['fname']) && $_POST['fname'] != '') and 
    153                        (isset($_POST['email']) && $_POST['email'] != '') and 
    154                        chk_email($_POST['email']) and 
    155                        (isset($_POST['lname']) && $_POST['lname'] != '') and 
    156                        (isset($_POST['zip']) && $_POST['zip'] != '') and 
    157                        (isset($_POST['city']) && $_POST['city'] != '') and 
    158                        (isset($_POST['country']) && $_POST['country'] != '') and 
    159                        (isset($_POST['street1']) && $_POST['street1'] != '') and 
    160                        (isset($_POST['phone']) && $_POST['phone'] != '') 
    161                        ) { 
    162                $_SESSION['fname'] = $_POST['fname']; 
    163                $_SESSION['lname'] = $_POST['lname']; 
    164                $_SESSION['email'] = $_POST['email']; 
    165                $_SESSION['zip'] = $_POST['zip']; 
    166                $_SESSION['city'] = $_POST['city']; 
    167                $_SESSION['country'] = $_POST['country']; 
    168                $_SESSION['street1'] = $_POST['street1']; 
    169                $_SESSION['phone'] = $_POST['phone']; 
    170  
    171                if (isset($_POST['firm']) && $_POST['firm'] != '') { 
    172                        $_SESSION['firm'] = $_POST['firm']; 
    173                
    174  
    175                if (isset($_POST['gender']) && get_gender_by_code($_POST['gender'], true) !== null) { 
    176                        $_SESSION['gender'] = $_POST['gender']; 
    177                } else { 
    178                        $_SESSION['gender'] = ''; 
    179                
    180  
    181                if (isset($_POST['street2']) && $_POST['street2'] != '') { 
    182                        $_SESSION['street2'] = $_POST['street2']; 
    183                
    184  
    185                if (isset($_POST['fax']) && $_POST['fax'] != '') { 
    186                        $_SESSION['fax'] = $_POST['fax']; 
    187                
    188  
    189                header("Location: chart.php"); 
    190                die(); 
    191        } else { 
    192                set_page_message(tr('Please fill out all needed fields!')); 
    193                $_GET['edit'] = "yes"; 
    194        
     150    if (isset($_GET['edit'])) 
     151        unset($_GET['edit']); 
     152    if ( 
     153        (isset($_POST['fname']) && $_POST['fname'] != '') and 
     154            (isset($_POST['email']) && $_POST['email'] != '') and 
     155            chk_email($_POST['email']) and 
     156            (isset($_POST['lname']) && $_POST['lname'] != '') and 
     157            (isset($_POST['zip']) && $_POST['zip'] != '') and 
     158            (isset($_POST['city']) && $_POST['city'] != '') and 
     159            (isset($_POST['country']) && $_POST['country'] != '') and 
     160            (isset($_POST['street1']) && $_POST['street1'] != '') and 
     161            (isset($_POST['phone']) && $_POST['phone'] != '') 
     162            ) { 
     163        $_SESSION['fname'] = $_POST['fname']; 
     164        $_SESSION['lname'] = $_POST['lname']; 
     165        $_SESSION['email'] = $_POST['email']; 
     166        $_SESSION['zip'] = $_POST['zip']; 
     167        $_SESSION['city'] = $_POST['city']; 
     168        $_SESSION['country'] = $_POST['country']; 
     169        $_SESSION['street1'] = $_POST['street1']; 
     170        $_SESSION['phone'] = $_POST['phone']; 
     171 
     172        if (isset($_POST['firm']) && $_POST['firm'] != '') { 
     173            $_SESSION['firm'] = $_POST['firm']; 
     174       
     175 
     176        if (isset($_POST['gender']) && get_gender_by_code($_POST['gender'], true) !== null) { 
     177            $_SESSION['gender'] = $_POST['gender']; 
     178        } else { 
     179            $_SESSION['gender'] = ''; 
     180       
     181 
     182        if (isset($_POST['street2']) && $_POST['street2'] != '') { 
     183            $_SESSION['street2'] = $_POST['street2']; 
     184       
     185 
     186        if (isset($_POST['fax']) && $_POST['fax'] != '') { 
     187            $_SESSION['fax'] = $_POST['fax']; 
     188       
     189 
     190        header("Location: chart.php"); 
     191        die(); 
     192    } else { 
     193        set_page_message(tr('Please fill out all needed fields!')); 
     194        $_GET['edit'] = "yes"; 
     195   
    195196} 
    196197 
     
    206207 
    207208if (isset($_SESSION['user_id']) && $_SESSION['plan_id']) { 
    208        $user_id = $_SESSION['user_id']; 
    209        $plan_id = $_SESSION['plan_id']; 
     209    $user_id = $_SESSION['user_id']; 
     210    $plan_id = $_SESSION['plan_id']; 
    210211} else { 
    211        system_message(tr('You do not have permission to access this interface!')); 
     212    system_message(tr('You do not have permission to access this interface!')); 
    212213} 
    213214 
    214215if (isset($_POST['uaction']) && $_POST['uaction'] == 'address') 
    215        check_address_data($tpl); 
     216    check_address_data($tpl); 
    216217 
    217218if ( 
    218        (isset($_SESSION['fname']) && $_SESSION['fname'] != '') and 
    219                (isset($_SESSION['email']) && $_SESSION['email'] != '') and 
    220                (isset($_SESSION['lname']) && $_SESSION['lname'] != '') and 
    221                (isset($_SESSION['zip']) && $_SESSION['zip'] != '') and 
    222                (isset($_SESSION['city']) && $_SESSION['city'] != '') and 
    223                (isset($_SESSION['country']) && $_SESSION['country'] != '') and 
    224                (isset($_SESSION['street1']) && $_SESSION['street1'] != '') and 
    225                (isset($_SESSION['phone']) && $_SESSION['phone'] != '') and 
    226                !isset($_GET['edit']) 
    227                ) { 
    228        header("Location: chart.php"); 
    229        die(); 
     219    (isset($_SESSION['fname']) && $_SESSION['fname'] != '') and 
     220        (isset($_SESSION['email']) && $_SESSION['email'] != '') and 
     221        (isset($_SESSION['lname']) && $_SESSION['lname'] != '') and 
     222        (isset($_SESSION['zip']) && $_SESSION['zip'] != '') and 
     223        (isset($_SESSION['city']) && $_SESSION['city'] != '') and 
     224        (isset($_SESSION['country']) && $_SESSION['country'] != '') and 
     225        (isset($_SESSION['street1']) && $_SESSION['street1'] != '') and 
     226        (isset($_SESSION['phone']) && $_SESSION['phone'] != '') and 
     227        !isset($_GET['edit']) 
     228        ) { 
     229    header("Location: chart.php"); 
     230    die(); 
    230231} 
    231232 
     
    236237 
    237238$tpl->assign( 
    238         array( 
    239                 'TR_ADRESS' => tr('Enter Address'), 
    240                 'TR_FIRSTNAME' => tr('First name'), 
    241                 'TR_LASTNAME' => tr('Last name'), 
    242                 'TR_COMPANY' => tr('Company'), 
    243                 'TR_POST_CODE' => tr('Zip/Postal code'), 
    244                 'TR_CITY' => tr('City'), 
    245                 'TR_COUNTRY' => tr('Country'), 
    246                 'TR_STREET1' => tr('Street 1'), 
    247                 'TR_STREET2' => tr('Street 2'), 
    248                 'TR_EMAIL' => tr('Email'), 
    249                 'TR_PHONE' => tr('Phone'), 
    250                 'TR_GENDER' => tr('Gender'), 
    251                 'TR_MALE' => tr('Male'), 
    252                 'TR_FEMALE' => tr('Female'), 
    253                 'TR_UNKNOWN' => tr('Unknown'), 
    254                 'TR_FAX' => tr('Fax'), 
    255                 'TR_CONTINUE' => tr('Continue'), 
    256                 'NEED_FILLED' => tr('* denotes mandatory field.'), 
    257                 'THEME_CHARSET' => tr('encoding') 
    258                 ) 
    259         ); 
     239    array('TR_ADRESS' => tr('Enter Address'), 
     240        'TR_FIRSTNAME' => tr('First name'), 
     241        'TR_LASTNAME' => tr('Last name'), 
     242        'TR_COMPANY' => tr('Company'), 
     243        'TR_POST_CODE' => tr('Zip/Postal code'), 
     244        'TR_CITY' => tr('City'), 
     245        'TR_COUNTRY' => tr('Country'), 
     246        'TR_STREET1' => tr('Street 1'), 
     247        'TR_STREET2' => tr('Street 2'), 
     248        'TR_EMAIL' => tr('Email'), 
     249        'TR_PHONE' => tr('Phone'), 
     250        'TR_GENDER' => tr('Gender'), 
     251        'TR_MALE' => tr('Male'), 
     252        'TR_FEMALE' => tr('Female'), 
     253        'TR_UNKNOWN' => tr('Unknown'), 
     254        'TR_FAX' => tr('Fax'), 
     255        'TR_CONTINUE' => tr('Continue'), 
     256        'NEED_FILLED' => tr('* denotes mandatory field.'), 
     257        'THEME_CHARSET' => tr('encoding') 
     258        ) 
     259    ); 
    260260 
    261261$tpl->parse('PAGE', 'page'); 
     
    263263 
    264264if (Config::get('DUMP_GUI_DEBUG')) 
    265        dump_gui_debug(); 
     265    dump_gui_debug(); 
    266266 
    267267unset_messages(); 
  • trunk/gui/orderpanel/chart.php

    r1241 r1244  
    11<?php 
    22/** 
    3  * ispCP (OMEGA) - Virtual Hosting Control System | Omega Version 
     3 * ispCP ω (OMEGA) a Virtual Hosting Control System 
    44 * 
    5  *  @copyright  2001-2006 by moleSoftware GmbH 
    6  *  @copyright  2006-2007 by ispCP | http://isp-control.net 
    7  *  @link               http://isp-control.net 
    8  *  @author             ispCP Team (2007) 
     5 * @copyright   2001-2006 by moleSoftware GmbH 
     6 * @copyright   2006-2008 by ispCP | http://isp-control.net 
     7 * @version     SVN: $ID$ 
     8 * @link                http://isp-control.net 
     9 * @author              ispCP Team 
    910 * 
    10  *  @license 
    11  *  This program is free software; you can redistribute it and/or modify it under 
    12  *  the terms of the MPL General Public License as published by the Free Software 
    13  *  Foundation; either version 1.1 of the License, or (at your option) any later 
    14  *  version. 
    15  *  You should have received a copy of the MPL Mozilla Public License along with 
    16  *  this program; if not, write to the Open Source Initiative (OSI) 
    17  *  http://opensource.org | osi@opensource.org 
    18  **/ 
    19  
    20  
     11 * @license 
     12 *   This program is free software; you can redistribute it and/or modify it under 
     13 *   the terms of the MPL General Public License as published by the Free Software 
     14 *   Foundation; either version 1.1 of the License, or (at your option) any later 
     15 *   version. 
     16 *   You should have received a copy of the MPL Mozilla Public License along with 
     17 *   this program; if not, write to the Open Source Initiative (OSI) 
     18 *   http://opensource.org | osi@opensource.org 
     19 */ 
    2120 
    2221require '../include/ispcp-lib.php'; 
    2322 
    2423$tpl = new pTemplate(); 
    25  
    26 $tpl -> define_dynamic('page', Config::get('PURCHASE_TEMPLATE_PATH') . '/chart.tpl'); 
    27  
    28 $tpl -> define_dynamic('page_message', 'page'); 
    29  
    30 $tpl -> define_dynamic('purchase_header', 'page'); 
    31  
    32 $tpl -> define_dynamic('purchase_footer', 'page'); 
    33  
     24$tpl->define_dynamic('page', Config::get('PURCHASE_TEMPLATE_PATH') . '/chart.tpl'); 
     25$tpl->define_dynamic('page_message', 'page'); 
     26$tpl->define_dynamic('purchase_header', 'page'); 
     27$tpl->define_dynamic('purchase_footer', 'page'); 
    3428 
    3529/* 
     
    3731*/ 
    3832 
    39 function gen_chart(&$tpl, &$sql, $user_id, $plan_id) 
    40 
    41 if (Config::exists('HOSTING_PLANS_LEVEL') && Config::get('HOSTING_PLANS_LEVEL') === 'admin'){ 
    42         $query = <<<SQL_QUERY 
     33function gen_chart(&$tpl, &$sql, $user_id, $plan_id) { 
     34    if (Config::exists('HOSTING_PLANS_LEVEL') && Config::get('HOSTING_PLANS_LEVEL') === 'admin') { 
     35        $query = <<<SQL_QUERY 
    4336                        select 
    4437                                * 
     
    4942SQL_QUERY; 
    5043 
    51   $rs = exec_query($sql, $query, array($plan_id)); 
    52 } else { 
    53  
    54         $query = <<<SQL_QUERY 
     44        $rs = exec_query($sql, $query, array($plan_id)); 
     45    } else { 
     46        $query = <<<SQL_QUERY 
    5547                        select 
    5648                                * 
     
    6355SQL_QUERY; 
    6456 
    65   $rs = exec_query($sql, $query, array($user_id, $plan_id)); 
    66  } 
    67   if ($rs -> RecordCount() == 0) { 
    68  
    69     header("Location: index.php"); 
    70         die(); 
    71  
    72   } else { 
    73  
    74                 $price = $rs -> fields['price']; 
    75                 $setup_fee = $rs -> fields['setup_fee']; 
    76                 $total = $price + $setup_fee; 
    77  
    78                         if ($price == 0 || $price == '') { 
    79                                 $price = tr('free of charge'); 
    80                         } else { 
    81                                 $price = $price." ".$rs -> fields['value']." ".$rs -> fields['payment']; 
    82                         } 
    83  
    84                         if ($setup_fee == 0 || $setup_fee == '') { 
    85                                 $setup_fee = tr('free of charge'); 
    86                         } else { 
    87                                 $setup_fee = $setup_fee." ".$rs -> fields['value']; 
    88                         } 
    89  
    90                         if ($total == 0 ) { 
    91                                 $total = tr('free of charge'); 
    92                         } else { 
    93                                 $total = $total." ".$rs -> fields['value']; 
    94                         } 
    95  
    96                 $tpl -> assign( 
    97                             array( 
    98                                     'PRICE' => $price, 
    99                                                                         'SETUP' => $setup_fee, 
    100                                                                         'TOTAL' => $total, 
    101                                                                         'TR_PACKAGE_NAME' => $rs -> fields['name'], 
    102  
    103  
    104                                  ) 
    105                           ); 
    106  
    107   } 
    108  
     57        $rs = exec_query($sql, $query, array($user_id, $plan_id)); 
     58    } 
     59    if ($rs->RecordCount() == 0) { 
     60        header("Location: index.php"); 
     61        die(); 
     62    } else { 
     63        $price = $rs->fields['price']; 
     64        $setup_fee = $rs->fields['setup_fee']; 
     65        $total = $price + $setup_fee; 
     66 
     67        if ($price == 0 || $price == '') { 
     68            $price = tr('free of charge'); 
     69        } else { 
     70            $price = $price . " " . $rs->fields['value'] . " " . $rs->fields['payment']; 
     71        } 
     72 
     73        if ($setup_fee == 0 || $setup_fee == '') { 
     74            $setup_fee = tr('free of charge'); 
     75        } else { 
     76            $setup_fee = $setup_fee . " " . $rs->fields['value']; 
     77        } 
     78 
     79        if ($total == 0) { 
     80            $total = tr('free of charge'); 
     81        } else { 
     82            $total = $total . " " . $rs->fields['value']; 
     83        } 
     84 
     85        $tpl->assign( 
     86            array('PRICE' => $price, 
     87                'SETUP' => $setup_fee, 
     88                'TOTAL' => $total, 
     89                'TR_PACKAGE_NAME' => $rs->fields['name'], 
     90 
     91                ) 
     92            ); 
     93    } 
    10994} 
    11095 
    111 function gen_personal_data(&$tpl) 
    112 
    113         if (isset($_SESSION['fname'])){ 
    114                 $first_name = $_SESSION['fname']; 
    115         } else { 
    116                 $first_name = ''; 
    117         } 
    118  
    119  
    120  
    121         if (isset($_SESSION['lname'])){ 
    122                 $last_name = $_SESSION['lname']; 
    123         } else { 
    124                 $last_name = ''; 
    125         } 
    126  
    127  
    128         if (isset($_SESSION['firm'])){ 
    129                 $company = $_SESSION['firm']; 
    130         } else { 
    131                 $company = ''; 
    132         } 
    133  
    134  
    135         if (isset($_SESSION['zip'])){ 
    136                 $postal_code = $_SESSION['zip']; 
    137         } else { 
    138                 $postal_code = ''; 
    139         } 
    140  
    141  
    142         if (isset($_SESSION['city'])){ 
    143                 $city = $_SESSION['city']; 
    144         } else { 
    145                 $city = ''; 
    146         } 
    147  
    148  
    149         if (isset($_SESSION['country'])){ 
    150                 $country = $_SESSION['country']; 
    151         } else { 
    152                 $country = ''; 
    153         } 
    154  
    155  
    156         if (isset($_SESSION['street1'])){ 
    157                 $street1 = $_SESSION['street1']; 
    158         } else { 
    159                 $street1 = ''; 
    160         } 
    161  
    162  
    163         if (isset($_SESSION['street2'])){ 
    164                 $street2 = $_SESSION['street2']; 
    165         } else { 
    166                 $street2 = ''; 
    167         } 
    168  
    169         if (isset($_SESSION['phone'])){ 
    170                 $phone = $_SESSION['phone']; 
    171         } else { 
    172                 $phone = ''; 
    173         } 
    174  
    175         if (isset($_SESSION['fax'])){ 
    176                 $fax = $_SESSION['fax']; 
    177         } else { 
    178                 $fax = ''; 
    179         } 
    180         if (isset($_SESSION['email'])){ 
    181                 $email = $_SESSION['email']; 
    182         } else { 
    183                 $email = ''; 
    184         } 
    185         if (isset($_SESSION['gender'])){ 
    186                 $gender = get_gender_by_code($_SESSION['gender']); 
    187         } else { 
    188                 $gender = get_gender_by_code(''); 
    189         } 
    190  
    191  
    192  
    193  
    194         $tpl -> assign( 
    195                 array( 
    196                      'VL_USR_NAME' => $first_name, 
    197                                          'VL_LAST_USRNAME' => $last_name, 
    198                      'VL_USR_FIRM' => $company, 
    199                      'VL_USR_POSTCODE' => $postal_code, 
    200                      'VL_USR_GENDER' => $gender, 
    201                      'VL_USRCITY' => $city, 
    202                      'VL_COUNTRY' => $country, 
    203                      'VL_STREET1' => $street1, 
    204                      'VL_STREET2' => $street2, 
    205                      'VL_PHONE' => $phone, 
    206                      'VL_FAX' => $fax, 
    207                                          'VL_EMAIL' => $email, 
    208  
    209  
    210                                         ) 
    211                         ); 
    212  
    213  
     96function gen_personal_data(&$tpl) { 
     97    if (isset($_SESSION['fname'])) { 
     98        $first_name = $_SESSION['fname']; 
     99    } else { 
     100        $first_name = ''; 
     101    } 
     102 
     103    if (isset($_SESSION['lname'])) { 
     104        $last_name = $_SESSION['lname']; 
     105    } else { 
     106        $last_name = ''; 
     107    } 
     108 
     109    if (isset($_SESSION['firm'])) { 
     110        $company = $_SESSION['firm']; 
     111    } else { 
     112        $company = ''; 
     113    } 
     114 
     115    if (isset($_SESSION['zip'])) { 
     116        $postal_code = $_SESSION['zip']; 
     117    } else { 
     118        $postal_code = ''; 
     119    } 
     120 
     121    if (isset($_SESSION['city'])) { 
     122        $city = $_SESSION['city']; 
     123    } else { 
     124        $city = ''; 
     125    } 
     126 
     127    if (isset($_SESSION['country'])) { 
     128        $country = $_SESSION['country']; 
     129    } else { 
     130        $country = ''; 
     131    } 
     132 
     133    if (isset($_SESSION['street1'])) { 
     134        $street1 = $_SESSION['street1']; 
     135    } else { 
     136        $street1 = ''; 
     137    } 
     138 
     139    if (isset($_SESSION['street2'])) { 
     140        $street2 = $_SESSION['street2']; 
     141    } else { 
     142        $street2 = ''; 
     143    } 
     144 
     145    if (isset($_SESSION['phone'])) { 
     146        $phone = $_SESSION['phone']; 
     147    } else { 
     148        $phone = ''; 
     149    } 
     150 
     151    if (isset($_SESSION['fax'])) { 
     152        $fax = $_SESSION['fax']; 
     153    } else { 
     154        $fax = ''; 
     155    } 
     156    if (isset($_SESSION['email'])) { 
     157        $email = $_SESSION['email']; 
     158    } else { 
     159        $email = ''; 
     160    } 
     161    if (isset($_SESSION['gender'])) { 
     162        $gender = get_gender_by_code($_SESSION['gender']); 
     163    } else { 
     164        $gender = get_gender_by_code(''); 
     165    } 
     166 
     167    $tpl->assign( 
     168        array('VL_USR_NAME' => $first_name, 
     169            'VL_LAST_USRNAME' => $last_name, 
     170            'VL_USR_FIRM' => $company, 
     171            'VL_USR_POSTCODE' => $postal_code, 
     172            'VL_USR_GENDER' => $gender, 
     173            'VL_USRCITY' => $city, 
     174            'VL_COUNTRY' => $country, 
     175            'VL_STREET1' => $street1, 
     176            'VL_STREET2' => $street2, 
     177            'VL_PHONE' => $phone, 
     178            'VL_FAX' => $fax, 
     179            'VL_EMAIL' => $email, 
     180 
     181            ) 
     182        ); 
    214183} 
    215184 
     
    217186* Functions end 
    218187*/ 
    219  
    220  
    221  
    222  
    223  
    224188 
    225189/* 
     
    229193*/ 
    230194 
    231 if (isset($_SESSION['user_id']) && $_SESSION['plan_id'])
    232        $user_id = $_SESSION['user_id']; 
    233        $plan_id = $_SESSION['plan_id']; 
     195if (isset($_SESSION['user_id']) && $_SESSION['plan_id'])