/** * build the list of fields for this overlay * * @see overlays/overlay.php * * @param the hosting attributes * @return a list of ($label, $input, $hint) */ function get_fields($host, $field_pos = NULL) { global $context; $fields = array(); // the file itself $label = i18n::s('Share'); $input = ''; // a surfer is sharing something if (!isset($host['id'])) { // share a link Skin::define_img('EMBED_HREF_IMG', 'thumbnails/video.gif'); $cell1 = '<div style="text-align: center"><a href="#" onclick="$(\'#share_href\').attr(\'checked\', \'checked\').trigger(\'change\'); return false;">' . EMBED_HREF_IMG . '</a>' . BR . '<input type="radio" name="embed_type" id="share_href" value="href" checked="checked" />' . i18n::s('a web address') . '</div>'; // share a file $cell2 = ''; if (Surfer::may_upload()) { Skin::define_img('EMBED_UPLOAD_IMG', 'thumbnails/download.gif'); $cell2 = '<div style="text-align: center"><a href="#" onclick="$(\'#share_upload\').attr(\'checked\', \'checked\').trigger(\'change\'); return false;">' . EMBED_UPLOAD_IMG . '</a>' . BR . '<input type="radio" name="embed_type" id="share_upload" value="upload" />' . i18n::s('a file') . '</div>'; } // share an idea Skin::define_img('EMBED_NONE_IMG', 'thumbnails/information.gif'); $cell3 = '<div style="text-align: center"><a href="#" onclick="$(\'#share_none\').attr(\'checked\', \'checked\').trigger(\'change\'); return false;">' . EMBED_NONE_IMG . '</a>' . BR . '<input type="radio" name="embed_type" id="share_none" value="none" />' . i18n::s('some information') . '</div>'; // three controls in a row $input = Skin::layout_horizontally($cell1, $cell2, $cell3); // sharing a web address $input .= '<div id="embed_a_link" style="padding: 1em 0 1em 0;">' . i18n::s('Paste the address of a web page that you have visited') . BR . '<input type="text" name="embed_href" id="embed_href" size="60" width="100%" value="" maxlength="255" />' . '<p class="details">' . sprintf(i18n::s('Some sites are recognized automatically: %s'), '<span id="provider_ticker" style="">' . '<span>YouTube</span>' . '<span>DailyMotion</span>' . '<span>Vimeo</span>' . '<span>Slideshare</span>' . '<span>Scribd</span>' . '<span>Flickr</span>' . '<span>PhotoBucket</span>' . '<span>DeviantArt</span>' . '<span>blip.tv</span>' . '<span>Viddler</span>' . '<span>revision3</span>' . '<span>5min.com</span>' . '<span>dotsub</span>' . '<span>hulu</span>' . '<span>yfrog</span>' . '<span>smugmug</span>' . '<span>soundcloud</span>' . '<span>official.fm</span>' . '<span>rd.io</span>' . '</span>') . '</p>' . '</div>'; Page::insert_script('$(function() {' . "\n" . ' var obj = $("#provider_ticker");' . "\n" . ' var list = obj.children();' . "\n" . ' list.not(":first").hide();' . "\n" . ' setInterval(function(){' . "\n" . ' list = obj.children();' . "\n" . ' list.not(":first").hide();' . "\n" . ' var first_li = list.eq(0);' . "\n" . ' var second_li = list.eq(1);' . "\n" . ' first_li.fadeOut(function(){' . "\n" . ' obj.css("height",second_li.height());' . "\n" . ' second_li.fadeIn();' . "\n" . ' first_li.remove().appendTo(obj);' . "\n" . ' });' . "\n" . ' }, 2000);' . "\n" . '});' . "\n"); // uploading a file if (Surfer::may_upload()) { $input .= '<div id="embed_a_file" style="display: none; padding: 1em 0 1em 0;">' . '<input type="file" name="upload" id="upload" size="30" />' . '<p class="details">' . sprintf(i18n::s('Select a file of less than %s'), $context['file_maximum_size'] . i18n::s('bytes')) . '</p>' . '</div>'; } // change the display on selection Page::insert_script('$(function() {' . "\n" . ' $("input[name=embed_type]").change(function() {' . "\n" . ' if($("#share_href").attr("checked")) {' . "\n" . ' $("#embed_a_link").slideDown();' . "\n" . ' $("#embed_a_file").slideUp();' . "\n" . ' }' . "\n" . ' if($("#share_upload").attr("checked")) {' . "\n" . ' $("#embed_a_link").slideUp();' . "\n" . ' $("#embed_a_file").slideDown();' . "\n" . ' }' . "\n" . ' if($("#share_none").attr("checked")) {' . "\n" . ' $("#embed_a_link").slideUp();' . "\n" . ' $("#embed_a_file").slideUp();' . "\n" . ' }' . "\n" . ' });' . "\n" . '});' . "\n"); // nothing to do } elseif (!isset($this->attributes['embed_type'])) { } elseif ($this->attributes['embed_type'] == 'href' && trim($this->attributes['embed_href'])) { $input .= $this->attributes['embed_href']; } // a complex field if ($input) { $fields[] = array($label, $input); } return $fields; }
} } // the form to link additional users $form = '<form method="post" action="' . $context['script_url'] . '" id="main_form">'; // horizontal layout $cells = array(); // users only have followers if (!strncmp($anchor->get_reference(), 'user:'******'category:', 9)) { } elseif (!$anchor->is_hidden()) { $cells[] = '<span class="small">' . '<input type="radio" name="assignment" value="watcher" checked="checked" /> ' . i18n::s('notify on update (watcher)') . BR . '<input type="radio" name="assignment" value="editor" /> ' . i18n::s('moderate content (editor)') . '</span>'; } // capture a new name with auto completion $cells[] = '<input type="text" name="assigned_name" id="assigned_name" size="45" maxlength="255" />' . ' <input type="submit" id="submit_button" value="' . i18n::s('Submit') . '" style="display: none;" />' . '<p class="details">' . i18n::s('To add a person, type some letters to look for a name, then select one profile at a time.') . '</p>'; // finalize the capture form $form .= Skin::layout_horizontally($cells) . '<input type="hidden" name="member" value="' . encode_field($anchor->get_reference()) . '">' . '<input type="hidden" name="action" value="assign">' . '</form>' . "\n"; // enable autocompletion Page::insert_script('$(function() {' . "\n" . ' // set the focus on first form field' . "\n" . ' $("#assigned_name").focus();' . "\n" . ' // enable name autocompletion' . "\n" . ' Yacs.autocomplete_names("assigned_name",true, "", function(data) { Yacs.startWorking(); $("#submit_button").show().click(); });' . "\n" . '}); ' . "\n"); // title says it all if (!strncmp($anchor->get_reference(), 'user:'******'Who do you want to follow?'); } else { $title = sprintf(i18n::s('Persons followed by %s'), $anchor->get_title()); } } elseif (!strncmp($anchor->get_reference(), 'category:', 9)) { $title = sprintf(i18n::s('Add a member to %s'), $anchor->get_title()); } else { $title = i18n::s('Add a participant'); } // finalize the box
} else { $followers .= '<p>' . sprintf(i18n::s('Persons who follow %s:'), $item['full_name']) . '</p>' . $items; } } // connect to people if (Surfer::get_id() && Surfer::get_id() != $item['id']) { // suggest a new connection if (!Members::check('user:'******'id'], 'user:'******'USERS_WATCH_IMG', 'users/watch.gif'); $link = Users::get_url('user:'******'id'], 'track'); $followers .= '<p style="margin: 1em 0;">' . Skin::build_link($link, USERS_WATCH_IMG . sprintf(i18n::s('Follow %s'), $item['full_name']), 'basic', i18n::s('Be notified of additions from this person')) . '</p>'; } } // put followers in a sidebar if ($followers) { $output .= Skin::layout_horizontally($watched, Skin::build_block($followers, 'sidecolumn')); } else { $output .= $watched; } // actual transmission except on a HEAD request if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'HEAD') { echo $output; } // the post-processing hook, then exit finalize_page(TRUE); // invalid action selector } else { Safe::header('Status: 400 Bad Request', TRUE, 400); die('Request is invalid.'); } // render the skin
$checked = ''; } $cell2 = '<div style="text-align: center"><a href="#" onclick="$(\'#3_2_1\').attr(\'checked\', \'checked\'); return false;"><img src="configuration/3_2_1.gif" /></a>' . BR . '<input type="radio" name="flexible_columns"' . $checked . ' id="3_2_1" value="3_2_1" />' . BR . i18n::s('3-2-1') . '</div>'; if (isset($context['flexible_columns']) && $context['flexible_columns'] == '2_3_1') { $checked = ' checked="checked"'; } else { $checked = ''; } $cell3 = '<div style="text-align: center"><a href="#" onclick="$(\'#2_3_1\').attr(\'checked\', \'checked\'); return false;"><img src="configuration/2_3_1.gif" /></a>' . BR . '<input type="radio" name="flexible_columns"' . $checked . ' id="2_3_1" value="2_3_1" />' . BR . i18n::s('2-3-1') . '</div>'; if (isset($context['flexible_columns']) && $context['flexible_columns'] == '2_1_3') { $checked = ' checked="checked"'; } else { $checked = ''; } $cell4 = '<div style="text-align: center"><a href="#" onclick="$(\'#2_1_3\').attr(\'checked\', \'checked\'); return false;"><img src="configuration/2_1_3.gif" /></a>' . BR . '<input type="radio" name="flexible_columns"' . $checked . ' id="2_1_3" value="2_1_3" />' . BR . i18n::s('2-1-3') . '</div>'; $input = Skin::layout_horizontally($cell1, $cell2, $cell3, $cell4); $fields[] = array($label, $input); // add to the form $text .= Skin::build_form($fields); $fields = array(); // text sample $text .= '<div id="b_sample" style="height:200px; width: 98%; border: 1px solid #ccc; padding: 0; margin: 0 0 1em 0; position:relative; overflow: hidden;"><div id="bp_sample" style="margin: 80px 80px 0; height: 118px"> </div></div>'; // body background $text .= Skin::build_folded_box(i18n::s('Body background'), background_helper('flexible_body_bg', 'b_sample', 'skins/flexible/headers') . '<br style="clear: left" />' . Skin::build_link('skins/flexible/upload.php?directory=headers', i18n::s('Add a file'), 'span')); // page background $text .= Skin::build_folded_box(i18n::s('Page background'), background_helper('flexible_page_bg', 'bp_sample', 'skins/flexible/pages') . '<br style="clear: left" />' . Skin::build_link('skins/flexible/upload.php?directory=pages', i18n::s('Add a file'), 'span')); // finalize this panel $panels[] = array('p', i18n::s('Page'), 'p_panel', $text); // // header parameters //////////////////////////////////////////// //
$main_column .= '</div></form>'; // offer a self-registration, if allowed $side_column = ''; if (!isset($context['users_without_registration']) || $context['users_without_registration'] != 'Y') { if (isset($_REQUEST['url'])) { $link = 'users/edit.php?forward=' . htmlentities(urlencode($_REQUEST['url'])); } elseif (isset($_SERVER['HTTP_REFERER'])) { $link = 'users/edit.php?forward=' . htmlentities(urlencode($_SERVER['HTTP_REFERER'])); } else { $link = 'users/edit.php'; } $side_column .= Skin::build_block(Skin::build_block(i18n::s('Create your profile'), 'title') . sprintf(i18n::s('%s if you have not yet a profile for yourself at %s.'), Skin::build_link($link, i18n::s('Click here to register'), 'shortcut'), $context['site_name']), 'sidecolumn'); } // layout the columns if ($side_column) { $context['text'] .= Skin::layout_horizontally($main_column, $side_column); } elseif ($main_column) { $context['text'] .= $main_column; } // the script used for data checking on the browser Page::insert_script('func' . 'tion validateDocumentPost(container) {' . "\n" . ' if(!container.login_name.value) {' . "\n" . ' alert("' . i18n::s('You must provide a nick name or an email address.') . '");' . "\n" . ' Yacs.stopWorking();' . "\n" . ' return false;' . "\n" . ' }' . "\n" . ' return true;' . "\n" . '}' . "\n" . '$("#login_name").focus();' . "\n" . "\n"); // a place holder for cookies activation $context['text'] .= '<p id="ask_for_cookies" style="display: none; color: red; text-decoration: blink;"></p>'; // the script used to check that cookies are activated Page::insert_script('document.cookie = \'CookiesEnabled=1\';' . "\n" . 'if((document.cookie == "") && document.getElementById) {' . "\n" . "\t" . '$("#ask_for_cookies").html("' . i18n::s('Your browser must accept cookies in order to successfully register and log in.') . '");' . "\n" . "\t" . '$("#ask_for_cookies").style.display = \'block\';' . "\n" . "\t" . '$("#login_button").disabled = true;' . "\n" . '}' . "\n"); // the help panel $help = '<p>' . i18n::s('Your browser must accept cookies in order to successfully register and log in.') . '</p>' . '<p>' . sprintf(i18n::s('If you already are a registered member, but do not remember your username and/or password, %s.'), Skin::build_link('users/password.php', i18n::s('click here'))) . '</p>'; $context['components']['boxes'] = Skin::build_box(i18n::s('Help'), $help, 'boxes', 'help'); } else { if (isset($_REQUEST['url'])) { if (!strncmp($_REQUEST['url'], 'http', 4)) {