$month = date("Ym", $_SGLOBAL['timestamp']); $week = date("YW", $_SGLOBAL['timestamp']); if ($time == "month") { $setwhere = "WHERE month='{$month}'"; } else { if ($time == "week") { $setwhere = "WHERE week='{$week}'"; } else { $setwhere = ""; } } $order = $time == "total" ? "credit" : "credit_{$time}"; $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('members') . " {$setwhere} ORDER BY {$order} DESC, lastlogin DESC LIMIT 20"); $i = 1; while ($value = $_SGLOBAL['db']->fetch_array($query)) { $value['i'] = $i++; $value['creditname'] = get_credit($value[credit]); $list[] = $value; } $timearr = array($time => ' class="current"'); } $title = $lang['hottop'] . ' - ' . $_SCONFIG['sitename']; $keywords = $lang['hottop']; $description = $lang['hottop']; $title = strip_tags($title); $keywords = strip_tags($keywords); $description = strip_tags($description); $guidearr = array(); $guidearr[] = array('url' => geturl('action/news'), 'name' => $channels['menus']['news']['name']); include template('top'); ob_out();
$page = 1; } $start = ($page - 1) * $perpage; //©©©©© ckstart($start, $perpage); $list = array(); $multi = ''; $count = $_SGLOBAL['db']->result($_SGLOBAL['db']->query("SELECT COUNT(*) FROM " . tname('members')), 0); $multi = multi($count, $perpage, $page, $mpurl); if ($count) { $query = $_SGLOBAL['db']->query("SELECT uid, username, experience, credit, dateline, lastlogin FROM " . tname('members') . " ORDER BY credit DESC LIMIT {$start},{$perpage}"); $i = 0; while ($value = $_SGLOBAL['db']->fetch_array($query)) { $list[$i] = $value; $list[$i]['index'] = $i + 1 + $perpage * ($page - 1); $list[$i]['creditname'] = get_credit($list[$i]['credit']); $list[$i]['dateline'] = date("Y-m-d H:i:s", $list[$i]['dateline']); $list[$i]['lastlogin'] = date("Y-m-d H:i:s", $list[$i]['lastlogin']); $i++; } } } elseif ($op == 'rule') { $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('creditrule')); while ($value = $_SGLOBAL['db']->fetch_array($query)) { $list[] = $value; } } elseif ($op == 'exchange') { //х╗оч if (!checkperm('allowtransfer')) { showmessage('no_permission'); }
function get_photos($post_id, $num = 0, $sizes = null, $ret = null, $landscape = null) { // save the image with the highest priority // to use when returing only one image $top_priority['priority'] = 9999; // check if there are attachments if ($images = get_children(array('post_parent' => $post_id, 'post_type' => 'attachment', 'order' => 'ASC', 'orderby' => 'menu_order', 'post_mime_type' => 'image'))) { // loop through each image foreach ($images as $image) { $image->attachment_metadata = wp_get_attachment_metadata($image->ID); if (isset($photo['photos'])) { $i = count($photo['photos']); } else { $i = 0; } // store image information $photo['photos'][$i]['id'] = get_id($image); $photo['photos'][$i]['caption'] = get_caption($image); $photo['photos'][$i]['credit'] = get_credit($image); $photo['photos'][$i]['priority'] = get_priority($image); $photo['photos'][$i]['width'] = get_width($image); $photo['photos'][$i]['height'] = get_height($image); // return requested sizes if ($sizes) { foreach ($sizes as $size) { $photo['photos'][$i]['src'][$size] = get_src($image, $size); } } else { // return all sizes when none are specified $photo['photos'][$i]['src']['full'] = get_src($image, 'full'); $photo['photos'][$i]['src']['large'] = get_src($image, 'large'); $photo['photos'][$i]['src']['thumbnail'] = get_src($image, 'thumbnail'); $photo['photos'][$i]['src']['medium'] = get_src($image, 'medium'); $photo['photos'][$i]['src']['single-inline'] = get_src($image, 'single-inline'); $photo['photos'][$i]['src']['alt-thumbnail'] = get_src($image, 'alt-thumbnail'); $photo['photos'][$i]['src']['custom-495'] = get_src($image, 'custom-495'); $photo['photos'][$i]['src']['custom-165'] = get_src($image, 'custom-165'); $photo['photos'][$i]['src']['custom-260'] = get_src($image, 'custom-260'); $photo['photos'][$i]['src']['custom-75x75-crop'] = get_src($image, 'custom-75x75-crop'); } // store the photo with the highest priority in wordpress. // photos with high priorities are given low numbers. // photos with priority of -1 are ignored. if ($num === 1 && $photo['photos'][$i]['priority'] < $top_priority['priority'] && $photo['photos'][$i]['priority'] >= 0) { // if user wants a landscape photo, check // to make sure it is landscape if ($landscape && !is_landscape($image)) { continue; } $top_priority = $photo['photos'][$i]; } // determine image position based on priority if (!isset($photo['display']['feature']) && get_priority($image) === 1) { // feature photo - below headline $photo['display']['feature'] = $i; $photo['photos'][$i]['src']['single-feature'] = get_src($image, 'single-feature'); } elseif (!isset($photo['display']['inline']) && get_priority($image) === 2) { // inline photo - thumbnail w/in post $photo['display']['inline'] = $i; $photo['photos'][$i]['src']['single-inline'] = get_src($image, 'single-inline'); } else { if (!isset($photo['display']['inline'])) { // inline photo has not been set $photo['display']['inline'] = $i; $photo['photos'][$i]['src']['single-inline'] = get_src($image, 'single-inline'); } else { // gallery photo - appears in post photo gallery if (isset($photo['display']['gallery'])) { $photo['display']['gallery'][count($photo['display']['gallery'])] = $i; } else { $photo['display']['gallery'][0] = $i; } } } // return first photo when one is requested and there is only one if ($num === 1 && count($images) == 1) { return $photo['photos'][$i]; } } // returns top photo when one is requested. // if user only wants one landscape photo, // but the top_priority is not landscape, don't // return anything. if ($num === 1) { if ($landscape && !is_landscape($image)) { return false; } return $top_priority; } // return all of the requested photos return $photo; } else { // check if the image is from the archives. images on our old // websites (custom CMS for some time then College Publisher) // were not saved as attachments, but were stored as custom // fields. $meta = get_post_custom($post_id); if ($meta && isset($meta['_image1'])) { $meta['_image1'] = get_image($meta['_image1']); // needed to make legacy photo output look like current photos $photo['photos'][0] = $meta['_image1']; $photo['photos'][0]['priority'] = 0; $photo['display']['inline'] = 0; if ($num === 1) { return $photo['photos'][0]; } return $photo; } } // no images were found return false; }