Beispiel #1
0
/**
 * formatPhone 
 * 
 * Will attempt to format a phone number correctly for the given country.
 * 
 * @param string $number
 * @param string $country
 * 
 * @return string
 */
function formatPhone($number, $country = '')
{
    // Must have a country
    $country = !empty($country) ? strtoupper($country) : getDefaultCountry();
    switch ($country) {
        case 'US':
            $number = formatPhoneUs($number);
    }
    return $number;
}
Beispiel #2
0
/**
 * formatAddress 
 * 
 * Will attempt to format an address based on the given country.
 * If not enough address info is provided will return empty string.
 *
 * Address param can contain any of the following:
 * 
 *     country, address, city, state, zip
 * 
 * @param array $address 
 * 
 * @return string
 */
function formatAddress($address)
{
    $str = '';
    // Must have a country
    $country = isset($address['country']) ? $address['country'] : getDefaultCountry();
    switch ($country) {
        case 'US':
        default:
            $str = formatAddressUs($address);
            break;
    }
    return $str;
}
    $rootpath = './';
}
require_once './lib/common.inc.php';
$ocWP = $GLOBALS['oc_waypoint'];
$no_tpl_build = false;
//Preprocessing
if ($error == false) {
    if ($usr == false) {
        //user logged in?
        $target = urlencode(tpl_get_current_page());
        tpl_redirect('login.php?target=' . $target);
    } else {
        $db = \lib\Database\DataBaseSingleton::Instance();
        $user = new \lib\Objects\User\User(array('userId' => $usr['userid']));
        $user->loadExtendedSettings();
        $default_country = getDefaultCountry($usr, $lang);
        if (isset($_REQUEST['newcache_info'])) {
            $newcache_info = $_REQUEST['newcache_info'];
        } else {
            $newcache_info = 1;
        }
        if ($newcache_info == 1) {
            // display info about register new cache
            $tplname = 'newcache_info';
        } else {
            //set here the template to process
            $tplname = 'newcache';
        }
        require_once $rootpath . '/lib/caches.inc.php';
        require_once $stylepath . '/newcache.inc.php';
        $rs = sql("SELECT `hide_flag` as hide_flag, `verify_all` as verify_all FROM `user` WHERE `user_id` =  " . $user->getUserId());
Beispiel #4
0
 /**
  * displayAddForm
  *
  * Displays the form for adding an address.
  *
  * @return void
  */
 function displayAddForm()
 {
     $country_list = buildCountryList();
     $selected = getDefaultCountry();
     $country_options = buildHtmlSelectOptions($country_list, $selected);
     $validator = new FormValidator();
     // TODO
     // Make this a removable alert message (part of Alerts table)
     echo '
         <form id="addressbook_form" action="addressbook.php" method="post">
             <p class="info-alert">
                 ' . T_('Please only add addresses for Non-members. Anyone who is a member of this website must add/update their own address.') . '
             </p>
             <fieldset>
                 <legend><span>' . T_('Add Address') . '</span></legend>
                 <div class="field-row">
                     <div class="field-label"><label for="fname"><b>' . T_('First Name') . '</b></label></div>
                     <div class="field-widget"><input class="frm_text" type="text" name="fname" id="fname" size="25"/></div>
                 </div>
                 <div class="field-row">
                     <div class="field-label"><label for="lname"><b>' . T_('Last Name') . '</b></label></div>
                     <div class="field-widget"><input class="frm_text" type="text" name="lname" id="lname" size="25"/></div>
                 </div>
                 <div class="field-row">
                     <div class="field-label"><label for="email"><b>' . T_('Email') . '</b></label></div>
                     <div class="field-widget"><input class="frm_text" type="text" name="email" id="email" size="50"/></div>
                 </div>
                 <div class="field-row">
                     <div class="field-label"><label for="country"><b>' . T_('Country') . '</b></label></div>
                     <div class="field-widget">
                         <select name="country" id="country">
                             <option></option>
                             <option value="US">' . T_('UNITED STATES') . '</option>
                             <option>------</option>
                             ' . $country_options . '
                         </select>
                     </div>
                 </div>
                 <div class="field-row">
                     <div class="field-label"><label for="address"><b>' . T_('Street Address') . '</b></label></div>
                     <div class="field-widget"><input class="frm_text" type="text" name="address" id="address" size="25"/></div>
                 </div>
                 <div class="field-row">
                     <div class="field-label"><label for="city"><b>' . T_('City') . '</b></label></div>
                     <div class="field-widget"><input class="frm_text" type="text" name="city" id="city" size="50"/></div>
                 </div>
                 <div class="field-row">
                     <div class="field-label"><label for="state"><b>' . T_('State') . '</b></label></div>
                     <div class="field-widget"><input class="frm_text" type="text" name="state" id="state" size="50"/></div>
                 </div>
                 <div class="field-row">
                     <div class="field-label"><label for="zip"><b>' . T_('Zip Code') . '</b></label></div>
                     <div class="field-widget"><input class="frm_text" type="text" name="zip" id="zip" size="10"/></div>
                 </div>
                 <div class="field-row">
                     <div class="field-label"><label for="home"><b>' . T_('Home Phone') . '</b></label></div>
                     <div class="field-widget"><input class="frm_text" type="text" name="home" id="home" size="20"/></div>
                 </div>
                 <div class="field-row">
                     <div class="field-label"><label for="work"><b>' . T_('Work Phone') . '</b></label></div>
                     <div class="field-widget"><input class="frm_text" type="text" name="work" id="work" size="20"/></div>
                 </div>
                 <div class="field-row">
                     <div class="field-label"><label for="cell"><b>' . T_('Cell Phone') . '</b></label></div>
                     <div class="field-widget"><input class="frm_text" type="text" name="cell" id="cell" size="20"/></div>
                 </div>
                 <div class="field-row">
                     <div class="field-label"><label for="private"><b>' . T_('Private') . '</b></label></div>
                     <div class="field-widget"><input type="checkbox" name="private" id="private"/></div>
                 </div>
                 <p>
                     <input class="sub1" type="submit" name="addsubmit" value="' . T_('Add') . '"/> 
                     ' . T_('or') . ' 
                     <a href="addressbook.php">' . T_('Cancel') . '</a>
                 </p>
             </fieldset>
             ' . $validator->getJsValidation($this->getProfile('add')) . '
         </form>';
 }