Exemple #1
0
    unset($item['password']);
    if (Users::put($item)) {
        Users::clear($item);
    }
}
// the current avatar, if any
if (isset($item['avatar_url']) && $item['avatar_url']) {
    $context['text'] .= '<p>' . sprintf(i18n::s('Current picture: %s'), BR . '<img src="' . $item['avatar_url'] . '" alt="" style="avatar" />') . '</p>' . "\n";
} else {
    $context['text'] .= '<p>' . i18n::s('No picture has been set for this profile.') . '</p>';
}
// list available avatars, except on error
if (!count($context['error']) && isset($item['id'])) {
    // upload an image
    //
    if (Images::allow_creation($item, null, 'user')) {
        // the form to post an image
        $text = '<form method="post" action="' . $context['url_to_root'] . 'images/edit.php" id="main_form" enctype="multipart/form-data"><div>' . '<input type="hidden" name="anchor" value="user:'******'id'] . '" />' . '<input type="hidden" name="action" value="set_as_avatar" />';
        $fields = array();
        // the image
        $text .= '<input type="file" name="upload" id="upload" size="30" accesskey="i" title="' . encode_field(i18n::s('Press to select a local file')) . '" />';
        $text .= ' ' . Skin::build_submit_button(i18n::s('Submit'), i18n::s('Press [s] to submit data'), 's');
        $text .= BR . '<span class="details">' . i18n::s('Select a .png, .gif or .jpeg image.') . ' (&lt;&nbsp;' . Skin::build_number($image_maximum_size, i18n::s('bytes')) . ')</span>';
        // end of the form
        $text .= '</div></form>';
        // the script used for form handling at the browser
        Page::insert_script('$("#upload").focus();');
        $context['text'] .= Skin::build_content(NULL, i18n::s('Upload an image'), $text);
    }
    // use the library
    //
Exemple #2
0
if (Comments::allow_creation($item, $anchor, 'section')) {
    Skin::define_img('COMMENTS_ADD_IMG', 'comments/add.gif');
    $context['page_tools'][] = Skin::build_link(Comments::get_url('section:' . $item['id'], 'comment'), COMMENTS_ADD_IMG . i18n::s('Post a comment'), 'basic', i18n::s('Express yourself, and say what you think.'));
}
// add a file, if upload is allowed
if (Files::allow_creation($item, $anchor, 'section')) {
    Skin::define_img('FILES_UPLOAD_IMG', 'files/upload.gif');
    $context['page_tools'][] = Skin::build_link('files/edit.php?anchor=' . urlencode('section:' . $item['id']), FILES_UPLOAD_IMG . i18n::s('Add a file'), 'basic', i18n::s('Attach related files.'));
}
// add a link
if (Links::allow_creation($item, $anchor, 'section')) {
    Skin::define_img('LINKS_ADD_IMG', 'links/add.gif');
    $context['page_tools'][] = Skin::build_link('links/edit.php?anchor=' . urlencode('section:' . $item['id']), LINKS_ADD_IMG . i18n::s('Add a link'), 'basic', i18n::s('Contribute to the web and link to relevant pages.'));
}
// post an image, if upload is allowed
if (Images::allow_creation($item, $anchor, 'section')) {
    Skin::define_img('IMAGES_ADD_IMG', 'images/add.gif');
    $context['page_tools'][] = Skin::build_link('images/edit.php?anchor=' . urlencode('section:' . $item['id']), IMAGES_ADD_IMG . i18n::s('Add an image'), 'basic', i18n::s('You can upload a camera shot, a drawing, or another image file.'));
}
// ensure that the surfer can change content
if (Sections::allow_modification($item, $anchor)) {
    // modify this page
    Skin::define_img('SECTIONS_EDIT_IMG', 'sections/edit.gif');
    if (!is_object($overlay) || !($label = $overlay->get_label('edit_command', 'sections'))) {
        $label = i18n::s('Edit this section');
    }
    $context['page_tools'][] = Skin::build_link(Sections::get_url($item['id'], 'edit'), SECTIONS_EDIT_IMG . $label, 'basic', i18n::s('Press [e] to edit'), FALSE, 'e');
}
// commands for section owners
if (Sections::is_owned($item, $anchor) || Surfer::is_associate()) {
    // access previous versions, if any
Exemple #3
0
     // use a definition list to enable customization of the detach box
     $context['text'] .= '<div class="bottom"><dl class="download detach">' . '<dt>' . $label . '</dt>' . '<dd>' . $description . '</dd></dl></div>' . "\n";
 }
 // insert anchor suffix
 if (is_object($anchor)) {
     $context['text'] .= $anchor->get_suffix();
 }
 // page tools
 //
 // update tools
 if (Files::allow_modification($item, $anchor)) {
     // modify this page
     Skin::define_img('FILES_EDIT_IMG', 'files/edit.gif');
     $context['page_tools'][] = Skin::build_link(Files::get_url($item['id'], 'edit'), FILES_EDIT_IMG . i18n::s('Update this file'), 'basic', i18n::s('Press [e] to edit'), FALSE, 'e');
     // post an image, if upload is allowed
     if (Images::allow_creation($item, $anchor, 'file')) {
         Skin::define_img('IMAGES_ADD_IMG', 'images/add.gif');
         $context['page_tools'][] = Skin::build_link('images/edit.php?anchor=' . urlencode('file:' . $item['id']), IMAGES_ADD_IMG . i18n::s('Add an image'), 'basic');
     }
 }
 // restore a previous version, if any
 if (is_object($anchor) && $anchor->is_owned() && Versions::count_for_anchor('file:' . $item['id'])) {
     Skin::define_img('FILES_VERSIONS_IMG', 'files/versions.gif');
     $context['page_tools'][] = Skin::build_link(Versions::get_url('file:' . $item['id'], 'list'), FILES_VERSIONS_IMG . i18n::s('Versions'));
 }
 // delete command provided to associates and owners
 if (is_object($anchor) && $anchor->is_owned() || Surfer::is_associate()) {
     Skin::define_img('FILES_DELETE_IMG', 'files/delete.gif');
     $context['page_tools'][] = Skin::build_link(Files::get_url($item['id'], 'delete'), FILES_DELETE_IMG . i18n::s('Delete this file'));
 }
 // the navigation sidebar
Exemple #4
0
 $fields = array();
 // display in a separate panel
 if ($text) {
     $panels[] = array('information', i18n::s('Index page'), 'information_panel', $text);
 }
 //
 // resources tab
 //
 $text = '';
 // splash message for new items
 if (!isset($item['id'])) {
     $text .= '<p>' . i18n::s('Submit the new item, and you will be able to add resources afterwards.') . '</p>';
 } else {
     // images
     $box = '';
     if (Images::allow_creation($item, $anchor, 'category')) {
         $menu = array('images/edit.php?anchor=' . urlencode('category:' . $item['id']) => i18n::s('Add an image'));
         $box .= Skin::build_list($menu, 'menu_bar');
     }
     if ($items = Images::list_by_date_for_anchor('category:' . $item['id'])) {
         $box .= Skin::build_list($items, 'decorated');
     }
     if ($box) {
         $text .= Skin::build_box(i18n::s('Images'), $box, 'folded');
     }
     // files
     $box = '';
     if (Files::allow_creation($item, $anchor, 'category')) {
         $menu = array('files/edit.php?anchor=' . urlencode('category:' . $item['id']) => i18n::s('Add a file'));
         $box .= Skin::build_list($menu, 'menu_bar');
     }
Exemple #5
0
}
// buttons to display previous and next pages, if any
if ($neighbours) {
    $context['text'] .= Skin::neighbours($neighbours, 'manual');
}
// insert anchor suffix
if (is_object($anchor)) {
    $context['text'] .= $anchor->get_suffix();
}
//
// extra panel -- most content is cached, except commands specific to current surfer
//
// page tools
//
// post an image, if upload is allowed
if (Images::allow_creation($item, $anchor)) {
    Skin::define_img('IMAGES_ADD_IMG', 'images/add.gif');
    $context['page_tools'][] = Skin::build_link('images/edit.php?anchor=' . urlencode('article:' . $item['id']), IMAGES_ADD_IMG . i18n::s('Add an image'), 'basic', i18n::s('You can upload a camera shot, a drawing, or another image file.'));
}
// modify this page
if (Articles::allow_modification($item, $anchor)) {
    Skin::define_img('ARTICLES_EDIT_IMG', 'articles/edit.gif');
    if (!is_object($overlay) || !($label = $overlay->get_label('edit_command', 'articles'))) {
        $label = i18n::s('Edit this page');
    }
    $context['page_tools'][] = Skin::build_link(Articles::get_url($item['id'], 'edit'), ARTICLES_EDIT_IMG . $label, 'basic', i18n::s('Press [e] to edit'), FALSE, 'e');
}
// access previous versions, if any
if ($has_versions && Articles::is_owned($item, $anchor)) {
    Skin::define_img('ARTICLES_VERSIONS_IMG', 'articles/versions.gif');
    $context['page_tools'][] = Skin::build_link(Versions::get_url('article:' . $item['id'], 'list'), ARTICLES_VERSIONS_IMG . i18n::s('Versions'), 'basic', i18n::s('Restore a previous version if necessary'));
Exemple #6
0
    $id = $context['arguments'][0];
}
$id = strip_tags($id);
// get the item from the database
$item = Images::get($id);
// get the related anchor, if any
$anchor = NULL;
if (isset($item['anchor'])) {
    $anchor = Anchors::get($item['anchor']);
} elseif (isset($_REQUEST['anchor'])) {
    $anchor = Anchors::get($_REQUEST['anchor']);
} elseif (isset($context['arguments'][1])) {
    $anchor = Anchors::get($context['arguments'][0] . ':' . $context['arguments'][1]);
}
// we are allowed to add a new file
if (!isset($item['id']) && Images::allow_creation($anchor)) {
    $permitted = TRUE;
} elseif (isset($item['id']) && Images::allow_modification($anchor, $item)) {
    $permitted = TRUE;
} else {
    $permitted = FALSE;
}
// do not always show the edition form
$with_form = FALSE;
// load the skin, maybe with a variant
load_skin('images', $anchor);
// clear the tab we are in, if any
if (is_object($anchor)) {
    $context['current_focus'] = $anchor->get_focus();
}
// the path to this page