Esempio n. 1
0
             message_die(GENERAL_ERROR, $lang['Not_Authorized']);
         }
     }
 }
 /*
 +----------------------------------------------------------
 | Main work here...
 +----------------------------------------------------------
 */
 if ($thispic['pic_user_id'] == ALBUM_GUEST or $thispic['username'] == '') {
     $poster = $thispic['pic_username'] == '' ? $lang['Guest'] : $thispic['pic_username'];
 } else {
     $poster = '<a href="' . append_sid(CMS_PAGE_PROFILE . '?mode=viewprofile&amp;' . POST_USERS_URL . '=' . $thispic['user_id']) . '">' . $thispic['username'] . '</a>';
 }
 //decide how user wants to show their rating
 $image_rating = ImageRating($thispic['rating']);
 //hot or not rating
 if (CanRate($pic_id, $user->data['user_id'])) {
     $template->assign_block_vars('hon_rating', array());
     for ($i = 0; $i < $album_config['rate_scale']; $i++) {
         $template->assign_block_vars('hon_rating.hon_row', array('VALUE' => $i + 1));
     }
 } else {
     $template->assign_block_vars('hon_rating_cant', array());
 }
 $template->assign_vars(array('L_PLEASE_RATE_IT' => $lang['Please_Rate_It'], 'L_ALREADY_RATED' => $lang['Already_rated'], 'L_PIC_ID' => $lang['Pic_ID'], 'L_RATING' => $lang['Rating'], 'L_PIC_TITLE' => $lang['Pic_Title'] . $album_config['clown_rateType'], 'L_PIC_DESC' => $lang['Pic_Desc'], 'L_POSTER' => $lang['Pic_Poster'], 'L_POSTED' => $lang['Posted'], 'L_VIEW' => $lang['View'], 'L_COMMENTS' => $lang['Comments'], 'CAT_TITLE' => $thiscat['cat_title'], 'U_VIEW_CAT' => append_sid(album_append_uid('album_cat.' . PHP_EXT . '?cat_id=' . $cat_id)), 'U_PIC' => append_sid(album_append_uid('album_pic.' . PHP_EXT . '?pic_id=' . $pic_id)), 'U_COMMENT' => append_sid(album_append_uid('album_showpage.' . PHP_EXT . '?pic_id=' . $pic_id)), 'S_ACTION' => append_sid(album_append_uid('album_hotornot.' . PHP_EXT)), 'PIC_TITLE' => $thispic['pic_title'], 'PIC_DESC' => nl2br($thispic['pic_desc']), 'POSTER' => $poster, 'PIC_TIME' => create_date($config['default_dateformat'], $thispic['pic_time'], $config['board_timezone']), 'PIC_VIEW' => $thispic['pic_view_count'], 'PIC_RATING' => $image_rating, 'PIC_COMMENTS' => $thispic['comments'], 'PIC_ID' => $pic_id, 'PICTURE_ID' => $pic_id));
 if ($album_config['rate']) {
     $template->assign_block_vars('rate_switch', array());
 }
 if ($album_config['comment']) {
     $template->assign_block_vars('comment_switch', array());
function album_build_detail_vars(&$result, $data, $page_params = '', $auth_rights = false)
{
    global $config, $user, $lang, $album_config;
    album_build_column_vars($result, $data, $page_params);
    $rating = '';
    if ($album_config['rate'] == 1) {
        $image_rating = ImageRating($data['rating']);
        $image_rating_link_class = $image_rating == $lang['Not_rated'] ? '' : 'class="rated"';
        $rating = $lang['Rating'] . ' : <a href="' . append_sid(album_append_uid('album_showpage.' . PHP_EXT . '?pic_id=' . $data['pic_id'] . $page_params)) . '" ' . $image_rating_link_class . '>' . $image_rating . '</a>';
    }
    $comments = '';
    if ($album_config['comment'] == 1) {
        $image_comment = $data['comments'] == 0 ? $lang['Not_commented'] : $data['comments'];
        $image_comment_link_class = $image_comment == $lang['Not_commented'] ? '' : 'class="commented"';
        $comments = $lang['Comments'] . ' : <a href="' . append_sid(album_append_uid('album_showpage.' . PHP_EXT . '?pic_id=' . $data['pic_id'] . $page_params)) . '" ' . $image_comment_link_class . '>' . $image_comment . '</a>';
    }
    $result['PIC_ID'] = $data['pic_id'];
    $result['TITLE'] = '<a href = "' . append_sid(album_append_uid('album_showpage.' . PHP_EXT . '?pic_id=' . $data['pic_id'] . $page_params)) . '">' . htmlspecialchars($data['pic_title']) . '</a>';
    $result['TIME'] = create_date($config['default_dateformat'], $data['pic_time'], $config['board_timezone']);
    $result['VIEW'] = $data['pic_view_count'];
    $result['RATING'] = $rating;
    $result['COMMENTS'] = $comments;
    if (empty($auth_rights)) {
        $auth_rights = array('edit' => true, 'delete' => true, 'admin' => true);
    }
    $can_edit = ($user->data['user_level'] == ADMIN or $user->data['user_id'] == $data['pic_user_id']);
    $result['EDIT'] = $can_edit && $auth_rights['edit'] ? '<a href="' . append_sid(album_append_uid('album_edit.' . PHP_EXT . '?pic_id=' . $data['pic_id'])) . '">' . $lang['Edit_pic'] . '</a>' : '';
    $result['DELETE'] = $can_edit && $auth_rights['delete'] ? '<a href="' . append_sid(album_append_uid('album_delete.' . PHP_EXT . '?pic_id=' . $data['pic_id'])) . '">' . $lang['Delete_pic'] . '</a>' : '';
    $is_admin = $user->data['user_level'] == ADMIN;
    $result['LOCK'] = $is_admin && $auth_rights['admin'] ? '<a href="' . append_sid(album_append_uid('album_modcp.' . PHP_EXT . '?mode=lock&amp;pic_id=' . $data['pic_id'])) . '">' . $lang['Lock'] . '</a>' : '';
    $result['MOVE'] = $is_admin && $auth_rights['admin'] ? '<a href="' . append_sid(album_append_uid('album_modcp.' . PHP_EXT . '?mode=move&amp;pic_id=' . $data['pic_id'])) . '">' . $lang['Move'] . '</a>' : '';
    $result['COPY'] = $is_admin && $auth_rights['admin'] ? '<a href="' . append_sid(album_append_uid('album_modcp.' . PHP_EXT . '?mode=copy&amp;pic_id=' . $data['pic_id'])) . '">' . $lang['Copy'] . '</a>' : '';
    $result['IP'] = $is_admin ? $lang['IP_Address'] . ': <a href="http://whois.sc/' . htmlspecialchars(urlencode($data['pic_user_ip'])) . '" target="_blank">' . htmlspecialchars($data['pic_user_ip']) . '</a>' : '';
}