function widget($args, $instance)
 {
     global $wppa;
     global $wppa_opt;
     global $wpdb;
     require_once dirname(__FILE__) . '/wppa-links.php';
     require_once dirname(__FILE__) . '/wppa-styles.php';
     require_once dirname(__FILE__) . '/wppa-functions.php';
     require_once dirname(__FILE__) . '/wppa-thumbnails.php';
     require_once dirname(__FILE__) . '/wppa-boxes-html.php';
     require_once dirname(__FILE__) . '/wppa-slideshow.php';
     wppa_initialize_runtime();
     extract($args);
     $instance = wp_parse_args((array) $instance, array('title' => '', 'album' => '0'));
     $title = apply_filters('widget_title', $instance['title']);
     $album = $instance['album'];
     if (!$wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM `" . WPPA_ALBUMS . "` WHERE `id` = %d", $album))) {
         $album = '0';
         // Album vanished
     }
     wppa_user_upload();
     // Do the upload if required
     $wppa['in_widget'] = 'upload';
     $wppa['mocc']++;
     $wppa['out'] = '';
     if (wppa_switch('wppa_user_upload_login') && !is_user_logged_in()) {
         return;
     }
     // Not logged in while login req'd for upload, no create also
     wppa_user_create_html($album, $wppa_opt['wppa_widget_width'], 'widget');
     wppa_user_upload_html($album, $wppa_opt['wppa_widget_width'], 'widget');
     if (!$wppa['out']) {
         return;
     }
     // No possibility to upload or create, skip the widget
     $text = '<div class="wppa-upload-widget" style="margin-top:2px; margin-left:2px;" >' . $wppa['out'] . '</div>';
     $wppa['out'] = '';
     echo $before_widget;
     if (!empty($title)) {
         echo $before_title . $title . $after_title;
     }
     echo $text;
     echo '<div style="clear:both"></div>';
     echo $after_widget;
     $wppa['in_widget'] = false;
 }
Exemplo n.º 2
0
function wppa_thumb_area($action)
{
    // Init
    $result = '';
    $mocc = wppa('mocc');
    $alt = wppa('alt');
    // Open thumbnail area box
    if ($action == 'open') {
        if (is_feed()) {
            $result .= '<div' . ' id="wppa-thumb-area-' . $mocc . '"' . ' class="wppa-thumb-area"' . ' style="' . __wcs('wppa-box') . __wcs('wppa-' . $alt) . '"' . ' >';
        } else {
            $result .= "\n";
            $result .= '<div' . ' id="wppa-thumb-area-' . $mocc . '"' . ' class="' . 'wppa-thumb-area ' . 'wppa-thumb-area-' . $mocc . ' ' . 'wppa-box wppa-' . $alt . '"' . ' style="' . __wcs('wppa-box') . __wcs('wppa-' . $alt) . 'width:' . wppa_get_thumbnail_area_width() . 'px;' . '"' . ' >';
            if (wppa_is_int(wppa('start_album'))) {
                wppa_bump_viewcount('album', wppa('start_album'));
            }
        }
        // Toggle alt/even
        wppa_toggle_alt();
    } elseif ($action == 'close') {
        // Display create subalbum and upload photo links conditionally
        if (!wppa('is_upldr') && !wppa('searchstring') && !wppa('supersearch') && !wppa('calendar')) {
            $alb = wppa('current_album');
            wppa_user_create_html($alb, wppa_get_container_width('netto'), 'thumb');
            wppa_user_upload_html($alb, wppa_get_container_width('netto'), 'thumb');
        }
        // Clear both
        $result .= '<div class="wppa-clear" style="' . __wis('clear:both;') . '" ></div>';
        // Close the thumbnail box
        $result .= '</div>';
    } else {
        $result .= '<span style="color:red;">' . 'Error, wppa_thumb_area() called with wrong argument: ' . $action . '. Possible values: \'open\' or \'close\'' . '</span>';
    }
    // Output result
    wppa_out($result);
}
function wppa_albumcover_sublinks($id, $width, $rsp)
{
    wppa_subalbumlinks_html($id);
    wppa_user_destroy_html($id, $width, 'cover', $rsp);
    wppa_user_create_html($id, $width, 'cover', $rsp);
    wppa_user_upload_html($id, $width, 'cover', $rsp);
    wppa_user_albumedit_html($id, $width, 'cover', $rsp);
    wppa_album_download_link($id);
    wppa_the_album_cats($id);
}
Exemplo n.º 4
0
function wppa_upload_box()
{
    // Init
    $alb = wppa('start_album');
    // Feature enabled?
    if (!wppa_switch('user_upload_on')) {
        return;
    }
    // Must login ?
    if (wppa_switch('user_upload_login')) {
        if (!is_user_logged_in()) {
            return;
        }
    }
    // Have i access?
    if ($alb) {
        // Access to this album ?
        if (!wppa_have_access($alb)) {
            return;
        }
    } else {
        // Access to any album ?
        if (!wppa_have_access('0')) {
            return;
        }
    }
    // Open container
    wppa_container('open');
    // Open div
    wppa_out('<div' . ' id="wppa-upload-box-' . wppa('mocc') . '"' . ' class="wppa-box wppa-upload"' . ' style="' . __wcs('wppa-box') . __wcs('wppa-upload') . '"' . ' >');
    // Do the dirty work
    wppa_user_create_html($alb, wppa_get_container_width('netto'), 'uploadbox');
    wppa_user_upload_html($alb, wppa_get_container_width('netto'), 'uploadbox');
    // Clear
    wppa_out('<div style="clear:both;"></div></div>');
    // Close container
    wppa_container('close');
}