set_filenames( array( 'plugin_admin_content' => dirname(__FILE__).'/admin_pendings.tpl' ) ); // +-----------------------------------------------------------------------+ // | pending photos list | // +-----------------------------------------------------------------------+ $list = array(); $query = ' SELECT image_id, added_on, i.id, path, tn_ext, date_creation, name, comment, added_by, file, name, filesize, width, height, has_high, high_filesize, '.$conf['user_fields']['username'].' AS username FROM '.COMMUNITY_PENDINGS_TABLE.' AS cp INNER JOIN '.IMAGES_TABLE.' AS i ON i.id = cp.image_id LEFT JOIN '.USERS_TABLE.' AS u ON u.'.$conf['user_fields']['id'].' = i.added_by WHERE state = \'moderation_pending\' ORDER BY image_id DESC ;'; $result = pwg_query($query); $rows = array(); $image_ids = array(); while ($row = pwg_db_fetch_assoc($result)) { array_push($rows, $row); array_push($image_ids, $row['id']); } $category_for_image = array(); if (count($image_ids) > 0) { $query = ' SELECT id, image_id, uppercats FROM '.IMAGE_CATEGORY_TABLE.' JOIN '.CATEGORIES_TABLE.' ON id = category_id WHERE image_id IN ('.implode(',', $image_ids).') ;'; $result = pwg_query($query); while ($row = pwg_db_fetch_assoc($result)) { $category_for_image[ $row['image_id'] ] = get_cat_display_name_cache( $row['uppercats'], 'admin.php?page=cat_modify&cat_id=', false, true, 'externalLink' ); } } foreach ($rows as $row) { $thumb = get_thumbnail_url( array( 'id' => $row['image_id'], 'path' => $row['path'], 'tn_ext' => @$row['tn_ext'] ) ); // file properties $dimensions = null; $websize_props = $row['width'].'x'.$row['height'].' '.l10n('pixels').', '.sprintf(l10n('%d Kb'), $row['filesize']); if (!empty($row['has_high']) and get_boolean($row['has_high'])) { $high_path = get_high_path($row); list($high_width, $high_height) = getimagesize($high_path); $high_props = $high_width.'x'.$high_height.' '.l10n('pixels').', '.sprintf(l10n('%d Kb'), $row['high_filesize']); $dimensions = $high_props.' ('.l10n('web size').' '.$websize_props.')'; } else { $dimensions = $websize_props; } $album = null; if (isset($category_for_image[ $row['id'] ])) { $album = $category_for_image[ $row['id'] ]; } else { $album = ''.l10n('No album, this photo is orphan').''; } $template->append( 'photos', array( 'U_EDIT' => get_root_url().'admin.php?page=picture_modify&image_id='.$row['image_id'], 'ID' => $row['image_id'], 'TN_SRC' => $thumb, 'WEBSIZE_SRC' => $row['path'], 'ADDED_BY' => $row['username'], 'ADDED_ON' => format_date($row['added_on'], true), 'NAME' => get_image_name($row['name'], $row['file']), 'DIMENSIONS' => $dimensions, 'FILE' => $row['file'], 'DATE_CREATION' => format_date($row['date_creation']), 'ALBUM' => $album, ) ); } // +-----------------------------------------------------------------------+ // | form options | // +-----------------------------------------------------------------------+ // image level options $selected_level = isset($_POST['level']) ? $_POST['level'] : 0; $template->assign( array( 'level_options'=> get_privacy_level_options(), 'level_options_selected' => array($selected_level) ) ); // +-----------------------------------------------------------------------+ // | sending html code | // +-----------------------------------------------------------------------+ $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); ?>