Пример #1
0
function validate_customer_ims(&$customerdata, &$contacts, &$error)
{
    foreach ($customerdata['ims'] as $idx => &$val) {
        $im = trim($val['contact']);
        $name = trim($val['name']);
        $type = !empty($val['type']) ? array_sum($val['type']) : 0;
        $type |= $val['typeselector'];
        $val['type'] = $type;
        $imtype = $type & CONTACT_IM;
        if ($im != '' && ($imtype == CONTACT_IM_GG && !check_gg($im) || $imtype == CONTACT_IM_YAHOO && !check_yahoo($im) || $imtype == CONTACT_IM_SKYPE && !check_skype($im) || $imtype == CONTACT_IM_FACEBOOK && !check_facebook($im))) {
            $error['im' . $idx] = trans('Incorrect IM uin!');
        } elseif ($name && !$im) {
            $error['im' . $idx] = trans('IM uid is required!');
        } elseif ($im) {
            $contacts[] = array('name' => $name, 'contact' => $im, 'type' => $type);
        }
    }
}
Пример #2
0
function fb_filter_pagelink($pagelink) {
  if(check_facebook()) {
    $my_offset = strlen(get_option('home'));
		$my_options = wpbook_getAdminOptions();
		$app_url = $my_options['fb_app_url'];
		$my_link = 'http://apps.facebook.com/' . $app_url 
    . substr($pagelink,$my_offset); 
		return $my_link;
	} else {
		return $pagelink; 
  }
}
Пример #3
0
function fb_filter_postlink_no_qs($postlink)
{
    if (check_facebook()) {
        $my_offset = strlen(get_option('home'));
        $my_options = wpbook_getAdminOptions();
        if ($my_options['proto'] == "https") {
            $my_offset++;
        }
        $app_url = $my_options['fb_app_url'];
        $my_link = $my_options['proto'] . '://apps.facebook.com/' . $app_url . substr($postlink, $my_offset);
        $my_new_link_pieces = parse_url($my_link);
        return parse_url($my_link, PHP_URL_SCHEME) . '://' . parse_url($my_link, PHP_URL_HOST) . parse_url($my_link, PHP_URL_PATH);
        // ignoring port
    } else {
        return $postlink;
    }
}
Пример #4
0
 function display($tpl = null)
 {
     // type:- catch | spot | trip | hatch
     $model =& $this->getModel();
     $lists = array();
     $states = $model->getField('jr_state');
     // add empty default item
     $states = array_merge(array((object) array('text' => JText::_('CHOOSE STATE'), 'value' => '')), $states);
     $lists['states'] = JHTML::_('select.genericlist', $states, 'states');
     $spotTags = $model->getField('jr_fspottags');
     $favorites = $model->getFavorites();
     $favorites = array_merge(array((object) array('id' => '', 'title' => '')), $favorites);
     $lists['favorites'] = JHTML::_('select.genericlist', $favorites, 'favoritesList', '', 'id', 'title');
     $species = $model->getSpecies();
     $species = array_merge(array((object) array('id' => '', 'title' => '')), $species);
     $lists['species'] = JHTML::_('select.genericlist', $species, 'related[species]', 'class="validate"', 'id', 'title');
     $equip = $model->getEquipment();
     $equip = array_merge(array((object) array('id' => '', 'title' => '')), $equip);
     $lists['equip'] = JHTML::_('select.genericlist', $equip, 'related[equipment]', '', 'id', 'title');
     $bait = $model->getBait();
     $bait = array_merge(array((object) array('id' => '', 'title' => '')), $bait);
     $lists['bait'] = JHTML::_('select.genericlist', $bait, 'related[bait]', '', 'id', 'title');
     $insects = $model->getInsects();
     $lists['insects'] = $this->optgroupselect($insects, 'relatedinsects', 'related[insects]', 'validate');
     $hatchdegree = $model->getField('jr_hatchdegree');
     $hatchdegree = $this->addstars($hatchdegree);
     $hatchdegree = array_merge(array((object) array('text' => '', 'value' => '')), $hatchdegree);
     $lists['hatchdegree'] = JHTML::_('select.genericlist', $hatchdegree, 'fields[jr_hatchdegree]', '', 'value', 'text');
     $hatchweather = $model->getField('jr_weatherinfo');
     $hatchweather = $this->addstars($hatchweather);
     $hatchweather = array_merge(array((object) array('text' => '', 'value' => '')), $hatchweather);
     $lists['hatchweather'] = JHTML::_('select.genericlist', $hatchweather, 'fields[jr_weatherinfo]', '', 'value', 'text');
     $listing_type = JRequest::getVar('type', 'catch');
     // => {'catch' | 'spot' | 'trip' | 'hatch'}
     $getSpots = $listing_type != 'spot' ? true : false;
     $locations = $model->getLocations($getSpots);
     // pick album that is created by the current user
     // select from pre-created albums based on new content type (catches, trips, etc.)
     $album_name = '';
     switch ($listing_type) {
         case 'catch':
             $album_name = 'Fangstrapporter';
             break;
         case 'spot':
             $album_name = 'Fiskeplasser';
             break;
         case 'trip':
             $album_name = 'Turer';
             break;
         case 'hatch':
             $album_name = 'Klekker';
             break;
     }
     $user =& JFactory::getUser();
     $db =& JFactory::getDBO();
     $q = "SELECT id FROM #__community_photos_albums " . "WHERE name = '" . $album_name . "' AND creator = '" . $user->id . "' ";
     $db->setQuery($q);
     $albumId = $db->loadResult();
     $privacySettings = $model->getField('jr_privacy');
     // get google maps api key from jreviews config
     $q = "SELECT value FROM #__jreviews_config WHERE id = 'geomaps.google_key'";
     $db->setQuery($q);
     $gapi_key = $db->loadResult();
     if ($location_id = JRequest::getVar('id')) {
         $q = "SELECT id, title, catid FROM #__content WHERE id='{$location_id}'";
         $db->setQuery($q);
         $location = $db->loadObject();
         $this->assignRef('location', $location);
     }
     // check if user is logged in with a facebook connect account
     $isFbConnect = check_facebook();
     $this->assignRef('isFbConnect', $isFbConnect);
     $this->assignRef('listing_type', $listing_type);
     $this->assignRef('lists', $lists);
     $this->assignRef('spotTags', $spotTags);
     $this->assignRef('locations', $locations);
     $this->assignRef('albumId', $albumId);
     $this->assignRef('privacySettings', $privacySettings);
     $this->assignRef('gapi_key', $gapi_key);
     parent::display($tpl);
 }