public function dateselect($label, $fieldname, $section, $seq=NULL, $show_access_list=true) { global $_PA; $monthnames = $_PA->months; $years = $_PA->years; $f = @$this->user->{$section}[$fieldname]; if ($seq) { $f = $f[$seq]; // we have a collection here $fieldname = $fieldname."[$seq]"; // to properly pass in HTML } $v = @$f['value']; $vyear = $vmonth = $vday = 0; if ($v) { list($vyear, $vmonth, $vday) = explode('-', $v); } ?> <div class="field_medium"> <h4><label for="<?=$fieldname.'[value]'?>"><?=$label?></label></h4> <div class="center"> <select name="<?=$fieldname.'_day[value]'?>" id="<?=$fieldname.'_day[value]'?>" class="select-txt"> <option value=""></option> <?php for ($i=1; $i<=31; $i++) { if($i == (int)$vday) { $selected = " selected=\"selected\" "; } else { $selected = ""; } ?> <option <?=$selected;?> value="<?=$i?>"><?=$i?></option> <?php } ?> </select> <select name="<?=$fieldname.'_month[value]'?>" id="<?=$fieldname.'_month[value]'?>" class="select-txt"> <?php for ($i=1; $i<=12; $i++) { if($i == (int)$vmonth) { $selected = " selected=\"selected\" "; } else { $selected = ""; } ?> <option <?=$selected;?> value="<?=$i?>"><?=$monthnames[$i]?></option> <?php } ?> </select> <select name="<?=$fieldname.'_year[value]'?>" id="<?=$fieldname.'_year[value]'?>" class="select-txt"> <option value=""></option> <?php foreach ($years as $k=>$year) { if($year == (int)$vyear) { $selected = " selected=\"selected\" "; } else { $selected = ""; } ?> <option <?=$selected?> value="<?=$year?>"><?=$year?></option> <?php } ?> </select> </div> <?php if ($show_access_list) { ?> <div> <?php print uihelper_get_user_access_list($fieldname."[perm]", $f["perm"]); ?> </div> <?php } ?> <br /> </div> <? }
function configure_persona($persona) { global $base_url; $c = NULL; $c = isset($persona->configuration_data) ? $persona->configuration_data : $persona; echo '<div id="' . $c->service . @$c->persona_id . '" ' . 'style="display:none;">'; echo '<input type="hidden" name="' . $c->service . '_persona_id' . '" ' . 'value="' . @$c->persona_id . '" />'; echo '<input type="hidden" name="' . $c->service . '_persona_service_id' . '" ' . 'value="' . $c->persona_service_id . '" />'; $submit_id = 'configure_' . $c->service; echo '<div class="field_big"><input type="submit" name="' . $submit_id . '" value="Save Settings" /></div>'; if ($c->service == 'Facebook') { // Facebook key defined in default_config.php, can be overridden by local_config.php global $facebook_api_key; // we need to check if the Scraper has encoutered an error with the TOS $json = new Services_JSON(); if (!empty($persona->persona_id)) { //Avoid errors if no persona_id yet $properties =& PersonaProperty::load_persona_properties($persona->persona_id); if (!empty($properties)) { $content = $json->decode($properties[0]->content); } if (!empty($content) && !empty($content->code)) { $code = $content->code; //Avoid error if not set } } if (!isset($code) || $code == 'mustagreetotos') { // signal for UI and // reset the user's checkbox $c->agreetotos = 'no'; } if (!$c->agreetotos || $c->agreetotos == 'no') { $fbtos = "http://api.facebook.com/login.php?api_key={$facebook_api_key}&v=1.0"; //v now mandatory $fbtostext = 'Agree to Facebook TOS'; } else { $fbtos = 'http://www.facebook.com/privacy.php?view=platform&tab=ext'; //Show all FB perms. $fbtostext = 'Review your Facebook permissions'; } $fn = $c->service . '_agreetotos'; echo '<div class="field_big"><h4><label for="' . $fn . '">I agree to the Facebook.com Terms of Service</label></h4>' . '<div class="center">'; echo '<input type="checkbox" name="' . $fn . '" id="' . $fn . '" value="yes"'; if ($c->agreetotos && $c->agreetotos == 'yes') { echo ' checked="checked"'; } echo '/>'; echo '</div>'; echo '<div class="buttonbar"><ul><li>'; echo '<a href="' . $fbtos . '" target="facebook" onclick="$(this).hide();">' . $fbtostext . '</a>'; echo '</li></ul></div>'; echo '</div>'; echo '<br clear="all" />'; } // end facebook code if ($c->service == 'Flickr') { // we need to check if the Scraper has encoutered an error with the TOS $json = new Services_JSON(); if (!empty($persona->persona_id)) { //Avoid errors if no persona_id yet $properties =& PersonaProperty::load_persona_properties(@$persona->persona_id); if (!empty($properties)) { $content = $json->decode($properties[0]->content); } if (!empty($content)) { $code = $content->code; } } if (!isset($code) || $code == 'mustagreetotos') { // signal for UI and // reset the user's checkbox $c->agreetotos = 'no'; } input($c->service . '_flickr_username_email', @$c->flickr_username_email, 'Your Flickr username or e-mail address', 'text'); echo '<div class="field_big"><p>To display your public photos on your personal page, please enter your Flickr username or e-mail address above.</p> <p>For full Flickr integration, please also fill out the rest of this form.</p></div>'; $fn = $c->service . '_agreetotos'; echo '<div class="field_big"><h4><label for="' . $fn . '">I agree to the Flickr.com Terms of Service</label></h4>' . '<div class="center">'; echo '<input type="checkbox" name="' . $fn . '" id="' . $fn . '" value="yes"'; if ($c->agreetotos && $c->agreetotos == 'yes') { echo ' checked="checked"'; } echo '/></div>'; // if (!$c->agreetotos || $c->agreetotos == 'no') { $fltos = BASE_URL_REL . "/ajax/flickr_login.php"; $fltostext = 'Agree to Flickr TOS'; } else { $fltos = 'http://www.flickr.com/services/auth/list.gne'; $fltostext = 'Review your Flickr permissions'; } echo '<div class="buttonbar"><ul><li>'; echo '<a href="' . $fltos . '" target="flickr" onclick="$(this).hide();">' . $fltostext . '</a>'; echo '</li></ul></div>'; echo '</div>'; echo '<br clear="all" />'; } // end flickr code // the given name is always editable input($c->service . '_name', @$c->name, 'Your label for this account', 'text'); // select for Persona privacy setting echo '<div class="field_big"><h4><label>' . 'Who may see data from this Service?</label></h4>'; echo '<div>' . uihelper_get_user_access_list($c->service . '_perm', !empty($c->perm) ? $c->perm : NONE) . '</div>'; //Fix case where perm not defined yet echo '</div>'; if ($c->service == 'AIM' || $c->service == 'YouTube' || $c->service == 'Google') { // plain username $fieldLabel = "username"; } else { if ($c->service == 'Flickr') { $fieldLabel = "Yahoo! ID"; } else { // MySpace use email adress $fieldLabel = "email address"; } } input($c->service . '_userName', @$c->userName, "Your {$fieldLabel}", 'text'); input($c->service . '_password', @$c->password, 'Your password', 'password'); echo '<input type="submit" name="' . $submit_id . '" value="Save Settings" />'; echo "</div>"; }