[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/admin/includes/modules/ -> account_details.php (source)

   1  <?php
   2  /*

   3  $Id: account_details.php 3 2006-05-27 04:59:07Z user $

   4  

   5    osCMax Power E-Commerce

   6    http://oscdox.com

   7  

   8    Copyright 2006 osCMax2005 osCMax, 2002 osCommerce

   9  

  10    Released under the GNU General Public License

  11     

  12    Step-By-Step Manual Order Entry Verion 0.5

  13    Customer Entry through Admin

  14  */
  15  
  16    $newsletter_array = array(array('id' => '1',
  17                                    'text' => ENTRY_NEWSLETTER_YES),
  18                              array('id' => '0',
  19                                    'text' => ENTRY_NEWSLETTER_NO));
  20  
  21  function sbs_get_zone_name($country_id, $zone_id) {
  22      $zone_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . $country_id . "' and zone_id = '" . $zone_id . "'");
  23      if (tep_db_num_rows($zone_query)) {
  24        $zone = tep_db_fetch_array($zone_query);
  25        return $zone['zone_name'];
  26      } else {
  27        return $default_zone;
  28      }
  29    }
  30   
  31   // Returns an array with countries

  32  // TABLES: countries

  33    function sbs_get_countries($countries_id = '', $with_iso_codes = false) {
  34      $countries_array = array();
  35      if ($countries_id) {
  36        if ($with_iso_codes) {
  37          $countries = tep_db_query("select countries_name, countries_iso_code_2, countries_iso_code_3 from " . TABLE_COUNTRIES . " where countries_id = '" . $countries_id . "' order by countries_name");
  38          $countries_values = tep_db_fetch_array($countries);
  39          $countries_array = array('countries_name' => $countries_values['countries_name'],
  40                                   'countries_iso_code_2' => $countries_values['countries_iso_code_2'],
  41                                   'countries_iso_code_3' => $countries_values['countries_iso_code_3']);
  42        } else {
  43          $countries = tep_db_query("select countries_name from " . TABLE_COUNTRIES . " where countries_id = '" . $countries_id . "'");
  44          $countries_values = tep_db_fetch_array($countries);
  45          $countries_array = array('countries_name' => $countries_values['countries_name']);
  46        }
  47      } else {
  48        $countries = tep_db_query("select countries_id, countries_name from " . TABLE_COUNTRIES . " order by countries_name");
  49        while ($countries_values = tep_db_fetch_array($countries)) {
  50          $countries_array[] = array('countries_id' => $countries_values['countries_id'],
  51                                     'countries_name' => $countries_values['countries_name']);
  52        }
  53      }
  54  
  55      return $countries_array;
  56    } 
  57    ////

  58  function sbs_get_country_list($name, $selected = '', $parameters = '') { 
  59     $countries_array = array(array('id' => '', 'text' => PULL_DOWN_DEFAULT)); 
  60     $countries = sbs_get_countries(); 
  61     $size = sizeof($countries); 
  62     for ($i=0; $i<$size; $i++) { 
  63       $countries_array[] = array('id' => $countries[$i]['countries_id'], 'text' => $countries[$i]['countries_name']); 
  64     } 
  65  
  66     return tep_draw_pull_down_menu($name, $countries_array, $selected, $parameters); 
  67  }
  68  
  69  
  70  ////

  71  // Alias function to tep_get_countries, which also returns the countries iso codes

  72   /* function tep_get_countries_with_iso_codes($countries_id) {

  73      return tep_get_countries($countries_id, true);

  74    }*/
  75  ?>
  76  <table border="0" width="100%" cellspacing="0" cellpadding="2">
  77    <tr>
  78      <td class="formAreaTitle"><?php echo CATEGORY_PERSONAL; ?></td>
  79    </tr>
  80    <tr>
  81      <td class="main"><table border="0" width="100%" cellspacing="0" cellpadding="2" class="formArea">
  82        <tr>
  83          <td class="main"><table border="0" cellspacing="0" cellpadding="2">
  84  <?php
  85    if (ACCOUNT_GENDER == 'true') {
  86      $male = ($account['customers_gender'] == 'm') ? true : false;
  87      $female = ($account['customers_gender'] == 'f') ? true : false;
  88  ?>
  89            <tr>
  90              <td class="main">&nbsp;<?php echo ENTRY_GENDER; ?></td>
  91              <td class="main">&nbsp;
  92  <?php
  93      if ($is_read_only) {
  94        echo ($account['customers_gender'] == 'm') ? MALE : FEMALE;
  95      } elseif ($error) {
  96        if ($entry_gender_error) {
  97          echo tep_draw_radio_field('gender', 'm', $male) . '&nbsp;&nbsp;' . MALE . '&nbsp;&nbsp;' . tep_draw_radio_field('gender', 'f', $female) . '&nbsp;&nbsp;' . FEMALE . '&nbsp;' . ENTRY_GENDER_ERROR;
  98        } else {
  99          echo ($gender == 'm') ? MALE : FEMALE;
 100          echo tep_draw_hidden_field('gender');
 101        }
 102      } else {
 103        echo tep_draw_radio_field('gender', 'm', $male) . '&nbsp;&nbsp;' . MALE . '&nbsp;&nbsp;' . tep_draw_radio_field('gender', 'f', $female) . '&nbsp;&nbsp;' . FEMALE . '&nbsp;' . ENTRY_GENDER_TEXT;
 104      }
 105  ?></td>
 106            </tr>
 107  <?php
 108    }
 109  ?>
 110            <tr>
 111              <td class="main">&nbsp;<?php echo ENTRY_FIRST_NAME; ?></td>
 112              <td class="main">&nbsp;
 113  <?php
 114    if ($is_read_only) {
 115      echo $account['customers_firstname'];
 116    } elseif ($error) {
 117      if ($entry_firstname_error) {
 118        echo tep_draw_input_field('firstname') . '&nbsp;' . ENTRY_FIRST_NAME_ERROR;
 119      } else {
 120        echo $firstname . tep_draw_hidden_field('firstname');
 121      }
 122    } else {
 123      echo tep_draw_input_field('firstname', $account['customers_firstname']) . '&nbsp;' . ENTRY_FIRST_NAME_TEXT;
 124    }
 125  ?></td>
 126            </tr>
 127            <tr>
 128              <td class="main">&nbsp;<?php echo ENTRY_LAST_NAME; ?></td>
 129              <td class="main">&nbsp;
 130  <?php
 131    if ($is_read_only) {
 132      echo $account['customers_lastname'];
 133    } elseif ($error) {
 134      if ($entry_lastname_error) {
 135        echo tep_draw_input_field('lastname') . '&nbsp;' . ENTRY_LAST_NAME_ERROR;
 136      } else {
 137        echo $lastname . tep_draw_hidden_field('lastname');
 138      }
 139    } else {
 140      echo tep_draw_input_field('lastname', $account['customers_lastname']) . '&nbsp;' . ENTRY_LAST_NAME_TEXT;
 141    }
 142  ?></td>
 143            </tr>
 144  <?php
 145    if (ACCOUNT_DOB == 'true') {
 146  ?>
 147            <tr>
 148              <td class="main">&nbsp;<?php echo ENTRY_DATE_OF_BIRTH; ?></td>
 149              <td class="main">&nbsp;
 150  <?php
 151      if ($is_read_only) {
 152        echo tep_date_short($account['customers_dob']);
 153      } elseif ($error) {
 154        if ($entry_date_of_birth_error) {
 155          echo tep_draw_input_field('dob') . '&nbsp;' . ENTRY_DATE_OF_BIRTH_ERROR;
 156        } else {
 157          echo $dob . tep_draw_hidden_field('dob');
 158        }
 159      } else {
 160        echo tep_draw_input_field('dob', tep_date_short($account['customers_dob'])) . '&nbsp;' . ENTRY_DATE_OF_BIRTH_TEXT;
 161      }
 162  ?></td>
 163            </tr>
 164  <?php
 165    }
 166  ?>
 167            <tr>
 168              <td class="main">&nbsp;<?php echo ENTRY_EMAIL_ADDRESS; ?></td>
 169              <td class="main">&nbsp;
 170  <?php
 171    if ($is_read_only) {
 172      echo $account['customers_email_address'];
 173    } elseif ($error) {
 174      if ($entry_email_address_error) {
 175        echo tep_draw_input_field('email_address') . '&nbsp;' . ENTRY_EMAIL_ADDRESS_ERROR;
 176      } elseif ($entry_email_address_check_error) {
 177        echo tep_draw_input_field('email_address') . '&nbsp;' . ENTRY_EMAIL_ADDRESS_CHECK_ERROR;
 178      } elseif ($entry_email_address_exists) {
 179        echo tep_draw_input_field('email_address') . '&nbsp;' . ENTRY_EMAIL_ADDRESS_ERROR_EXISTS;
 180      } else {
 181        echo $email_address . tep_draw_hidden_field('email_address');
 182      }
 183    } else {
 184      echo tep_draw_input_field('email_address', $account['customers_email_address']) . '&nbsp;' . ENTRY_EMAIL_ADDRESS_TEXT;
 185    }
 186  ?></td>
 187            </tr>
 188          </table></td>
 189        </tr>
 190      </table></td>
 191    </tr>
 192  <?php
 193    if (ACCOUNT_COMPANY == 'true') {
 194  ?>  
 195    <tr>
 196      <td class="formAreaTitle"><br><?php echo CATEGORY_COMPANY; ?></td>
 197    </tr>
 198    <tr>
 199      <td class="main"><table border="0" width="100%" cellspacing="0" cellpadding="2" class="formArea">
 200        <tr>
 201          <td class="main"><table border="0" cellspacing="0" cellpadding="2">
 202            <tr>
 203              <td class="main">&nbsp;<?php echo ENTRY_COMPANY; ?></td>
 204              <td class="main">&nbsp;
 205  <?php
 206      if ($is_read_only) {
 207        echo $account['entry_company'];
 208      } elseif ($error) {
 209        if ($entry_company_error) {
 210          echo tep_draw_input_field('company') . '&nbsp;' . ENTRY_COMPANY_ERROR;
 211        } else {
 212          echo $company . tep_draw_hidden_field('company');
 213        }
 214      } else {
 215        echo tep_draw_input_field('company', $account['entry_company']) . '&nbsp;' . ENTRY_COMPANY_TEXT;
 216      }
 217  ?></td>
 218            </tr>
 219          </table></td>
 220        </tr>
 221      </table></td>
 222    </tr>
 223  <?php
 224    }
 225  ?>
 226    <tr>
 227      <td class="formAreaTitle"><br><?php echo CATEGORY_ADDRESS; ?></td>
 228    </tr>
 229    <tr>
 230      <td class="main"><table border="0" width="100%" cellspacing="0" cellpadding="2" class="formArea">
 231        <tr>
 232          <td class="main"><table border="0" cellspacing="0" cellpadding="2">
 233            <tr>
 234              <td class="main">&nbsp;<?php echo ENTRY_STREET_ADDRESS; ?></td>
 235              <td class="main">&nbsp;
 236  <?php
 237    if ($is_read_only) {
 238      echo $account['entry_street_address'];
 239    } elseif ($error) {
 240      if ($entry_street_address_error) {
 241        echo tep_draw_input_field('street_address') . '&nbsp;' . ENTRY_STREET_ADDRESS_ERROR;
 242      } else {
 243        echo $street_address . tep_draw_hidden_field('street_address');
 244      }
 245    } else {
 246      echo tep_draw_input_field('street_address', $account['entry_street_address']) . '&nbsp;' . ENTRY_STREET_ADDRESS_TEXT;
 247    }
 248  ?></td>
 249            </tr>
 250  <?php
 251    if (ACCOUNT_SUBURB == 'true') {
 252  ?>
 253            <tr>
 254              <td class="main">&nbsp;<?php echo ENTRY_SUBURB; ?></td>
 255              <td class="main">&nbsp;
 256  <?php
 257      if ($is_read_only) {
 258        echo $account['entry_suburb'];
 259      } elseif ($error) {
 260        if ($entry_suburb_error) {
 261          echo tep_draw_input_field('suburb') . '&nbsp;' . ENTRY_SUBURB_ERROR;
 262        } else {
 263          echo $suburb . tep_draw_hidden_field('suburb');
 264        }
 265      } else {
 266        echo tep_draw_input_field('suburb', $account['entry_suburb']) . '&nbsp;' . ENTRY_SUBURB_TEXT;
 267      }
 268  ?></td>
 269            </tr>
 270  <?php
 271    }
 272  ?>
 273            <tr>
 274              <td class="main">&nbsp;<?php echo ENTRY_POST_CODE; ?></td>
 275              <td class="main">&nbsp;
 276  <?php
 277    if ($is_read_only) {
 278      echo $account['entry_postcode'];
 279    } elseif ($error) {
 280      if ($entry_post_code_error) {
 281        echo tep_draw_input_field('postcode') . '&nbsp;' . ENTRY_POST_CODE_ERROR;
 282      } else {
 283        echo $postcode . tep_draw_hidden_field('postcode');
 284      }
 285    } else {
 286      echo tep_draw_input_field('postcode', $account['entry_postcode']) . '&nbsp;' . ENTRY_POST_CODE_TEXT;
 287    }
 288  ?></td>
 289            </tr>
 290            <tr>
 291              <td class="main">&nbsp;<?php echo ENTRY_CITY; ?></td>
 292              <td class="main">&nbsp;
 293  <?php
 294    if ($is_read_only) {
 295      echo $account['entry_city'];
 296    } elseif ($error) {
 297      if ($entry_city_error) {
 298        echo tep_draw_input_field('city') . '&nbsp;' . ENTRY_CITY_ERROR;
 299      } else {
 300        echo $city . tep_draw_hidden_field('city');
 301      }
 302    } else {
 303      echo tep_draw_input_field('city', $account['entry_city']) . '&nbsp;' . ENTRY_CITY_TEXT;
 304    }
 305  ?></td>
 306            </tr>
 307  <?php
 308    if (ACCOUNT_STATE == 'true') {
 309  ?>
 310            <tr>
 311              <td class="main">&nbsp;<?php echo ENTRY_STATE; ?></td>
 312              <td class="main">&nbsp;
 313  <?php
 314      $state = sbs_get_zone_name($country, $zone_id);
 315      if ($is_read_only) {
 316        echo sbs_get_zone_name($account['entry_country_id'], $account['entry_zone_id']);
 317      } elseif ($error) {
 318        if ($entry_state_error) {
 319          if ($entry_state_has_zones) {
 320            $zones_array = array();
 321            $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . tep_db_input($country) . "' order by zone_name");
 322            while ($zones_values = tep_db_fetch_array($zones_query)) {
 323              $zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']);
 324            }
 325            echo tep_draw_pull_down_menu('state', $zones_array) . '&nbsp;' . ENTRY_STATE_ERROR;
 326          } else {
 327            echo tep_draw_input_field('state') . '&nbsp;' . ENTRY_STATE_ERROR;
 328          }
 329        } else {
 330          echo $state . tep_draw_hidden_field('zone_id') . tep_draw_hidden_field('state');
 331        }
 332      } else {
 333        echo tep_draw_input_field('state', sbs_get_zone_name($account['entry_country_id'], $account['entry_zone_id'], $account['entry_state'])) . '&nbsp;' . ENTRY_STATE_TEXT;
 334      }
 335  ?></td>
 336               </tr>
 337  <?php
 338       }
 339  ?>
 340               <tr>
 341                 <td class="main">&nbsp;<?php echo ENTRY_COUNTRY; ?></td>
 342                 <td class="main">&nbsp;
 343  <?php
 344        $account['entry_country_id'] = STORE_COUNTRY;
 345       if ($is_read_only) {       echo tep_get_country_name($account['entry_country_id']);     } 
 346  elseif 
 347  ($error) {
 348         if ($entry_country_error) {
 349          
 350           echo sbs_get_country_list('country') . '&nbsp;' . ENTRY_COUNTRY_ERROR;
 351         } else {
 352           echo tep_get_country_name($country) . tep_draw_hidden_field('country');
 353         }
 354       } else {
 355         echo sbs_get_country_list('country', $account['entry_country_id']) . '&nbsp;' . ENTRY_COUNTRY_TEXT;
 356       }
 357  ?></td>
 358            </tr>
 359          </table></td>
 360        </tr>
 361      </table></td>
 362    </tr>
 363    <tr>
 364      <td class="formAreaTitle"><br><?php echo CATEGORY_CONTACT; ?></td>
 365    </tr>
 366    <tr>
 367      <td class="main"><table border="0" width="100%" cellspacing="0" cellpadding="2" class="formArea">
 368        <tr>
 369          <td class="main"><table border="0" cellspacing="0" cellpadding="2">
 370            <tr>
 371              <td class="main">&nbsp;<?php echo ENTRY_TELEPHONE_NUMBER; ?></td>
 372              <td class="main">&nbsp;
 373  <?php
 374    if ($is_read_only) {
 375      echo $account['customers_telephone'];
 376    } elseif ($error) {
 377      if ($entry_telephone_error) {
 378        echo tep_draw_input_field('telephone') . '&nbsp;' . ENTRY_TELEPHONE_NUMBER_ERROR;
 379      } else {
 380        echo $telephone . tep_draw_hidden_field('telephone');
 381      }
 382    } else {
 383      echo tep_draw_input_field('telephone', $account['customers_telephone']) . '&nbsp;' . ENTRY_TELEPHONE_NUMBER_TEXT;
 384    }
 385  ?></td>
 386            </tr>
 387            <tr>
 388              <td class="main">&nbsp;<?php echo ENTRY_FAX_NUMBER; ?></td>
 389              <td class="main">&nbsp;
 390  <?php
 391    if ($is_read_only) {
 392      echo $account['customers_fax'];
 393    } elseif ($processed) {
 394      echo $fax . tep_draw_hidden_field('fax');
 395    } else {
 396      echo tep_draw_input_field('fax', $account['customers_fax']) . '&nbsp;' . ENTRY_FAX_NUMBER_TEXT;
 397    }
 398  ?></td>
 399            </tr>
 400          </table></td>
 401        </tr>
 402      </table></td>
 403    </tr>
 404    <tr>
 405      <td class="formAreaTitle"><br><?php echo CATEGORY_OPTIONS; ?></td>
 406    </tr>
 407    <tr>
 408      <td class="main"><table border="0" width="100%" cellspacing="0" cellpadding="2" class="formArea">
 409        <tr>
 410          <td class="main"><table border="0" cellspacing="0" cellpadding="2">
 411            <tr>
 412              <td class="main">&nbsp;<?php echo ENTRY_NEWSLETTER; ?></td>
 413              <td class="main">&nbsp;
 414  <?php
 415    if ($is_read_only) {
 416      if ($account['customers_newsletter'] == '1') {
 417        echo ENTRY_NEWSLETTER_YES;
 418      } else {
 419        echo ENTRY_NEWSLETTER_NO;
 420      }
 421    } elseif ($processed) {
 422      if ($newsletter == '1') {
 423        echo ENTRY_NEWSLETTER_YES;
 424      } else {
 425        echo ENTRY_NEWSLETTER_NO;
 426      }
 427      echo tep_draw_hidden_field('newsletter');  
 428    } else {
 429      echo tep_draw_pull_down_menu('newsletter', $newsletter_array, $account['customers_newsletter']) . '&nbsp;' . ENTRY_NEWSLETTER_TEXT;
 430    }
 431  ?></td>
 432            </tr>
 433          </table></td>
 434        </tr>
 435      </table></td>
 436    </tr>
 437  <?php/*

 438  <?php

 439    if (!$is_read_only) {

 440  ?>

 441    <tr>

 442      <td class="formAreaTitle"><br><?php echo CATEGORY_PASSWORD; ?></td>

 443    </tr>

 444    <tr>

 445      <td class="main"><table border="0" width="100%" cellspacing="0" cellpadding="2" class="formArea">

 446        <tr>

 447          <td class="main"><table border="0" cellspacing="0" cellpadding="2">

 448            <tr>

 449              <td class="main">&nbsp;<?php echo ENTRY_PASSWORD; ?></td>

 450              <td class="main">&nbsp;

 451  <?php

 452      if ($error) {

 453        if ($entry_password_error) {

 454          echo tep_draw_password_field('password') . '&nbsp;' . ENTRY_PASSWORD_ERROR;

 455        } else {

 456          echo PASSWORD_HIDDEN . tep_draw_hidden_field('password') . tep_draw_hidden_field('confirmation');

 457        }

 458      } else {

 459        echo tep_draw_password_field('password') . '&nbsp;' . ENTRY_PASSWORD_TEXT;

 460      }

 461  ?></td>

 462           </tr>

 463  <?php

 464      if ( (!$error) || ($entry_password_error) ) {

 465  ?>

 466            <tr>

 467              <td class="main">&nbsp;<?php echo ENTRY_PASSWORD_CONFIRMATION; ?></td>

 468              <td class="main">&nbsp;

 469  <?php

 470        echo tep_draw_password_field('confirmation') . '&nbsp;' . ENTRY_PASSWORD_CONFIRMATION_TEXT;

 471  ?></td>

 472            </tr>

 473  <?php

 474      }

 475  ?>

 476          </table></td>

 477        </tr>

 478      </table></td>

 479    </tr>

 480  */ ?>
 481  
 482  <?php
 483   // }

 484  ?>
 485  </table>


Generated: Fri Jan 1 13:43:16 2010 Cross-referenced by PHPXref 0.7