本文整理汇总了PHP中map::get_images方法的典型用法代码示例。如果您正苦于以下问题:PHP map::get_images方法的具体用法?PHP map::get_images怎么用?PHP map::get_images使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类map
的用法示例。
在下文中一共展示了map::get_images方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepare
public function prepare()
{
$this->template = "map";
$this->tab = 'map';
global $SITE;
$SITE['head'] .= '<script type="text/javascript" src="https://www.google.com/jsapi"></script>';
require_once 'classes/map.php';
$map = new map($this->request[0]);
$i = $map->get_info();
$s = $map->get_stats();
$stats[] = array('key' => 'Players', 'now' => $i['players'], 'average' => $s['avg_players']);
$stats[] = array('key' => 'Servers', 'now' => $i['servers'], 'average' => $s['avg_servers']);
$stats[] = array('key' => 'Saturation', 'now' => $i['players'] > 0 ? $i['servers'] / $i['players'] : 0, 'average' => $s['saturation']);
$this->title = htmlspecialchars($this->request[0]);
$this->params['info'] = $i;
$this->params['servers'] = $map->get_servers(25);
$this->params['images'] = $map->get_images();
$this->params['extra'] = $map->get_extra();
$this->params['stats'] = $stats;
}
示例2: prepare
//.........这里部分代码省略.........
$db->query("INSERT INTO tf2stats_map_to_player(player_id, map_id, type) VALUES(%s, %s, %s)", array($player->id(), $map_info['id'], 'A'));
$this->params['success'] = $player_id . ' has been added to the author list.';
} else {
$this->params['error'] = "Could not find a player by '" . $_REQUEST['search'] . "'. Please refine your search.";
}
} else {
$this->template = "manage_map_author";
$this->title = sprintf("Adding author for %s", htmlspecialchars($map_info['name']));
return;
}
}
if ($this->request[1] == 'delauthor') {
$id = $this->request[2];
$db->query("DELETE FROM tf2stats_map_to_player WHERE player_id=%s AND map_id = %s", array($id, $map_info['id']));
$this->params['success'] = "Deleted author";
}
// handle file uploads.
if ($this->request[1] == 'upload') {
$this->template = "manage_map_upload";
$this->title = sprintf("Upload image for %s", htmlspecialchars($map_info['name']));
$this->params['allowed_images'] = implode(', ', $settings['upload']['allowed_images']);
if ($_FILES['image']) {
if (!$_FILES['image']['tmp_name']) {
$this->params['error'] = 'Upload failed. (This usually happens when you try to upload a file larger than 1MB!)';
return;
}
// check extension.
$ext = end(explode(".", strtolower($_FILES['image']['name'])));
if (!in_array($ext, $settings['upload']['allowed_images'])) {
$this->params['error'] = 'Unsupported file extension ' . $ext . '. Please convert your image to one of these formats: ' . implode(', ', $settings['upload']['allowed_images']);
return;
}
// rename if already exists
$filename = sprintf("%s_%s", $map_info['id'], str_replace(array('(', ')', ' '), '_', basename($_FILES['image']['name'])));
$target_path = $settings['upload']['folder']['maps'] . $filename;
while (file_exists($target_path)) {
$filename = md5(time() . rand()) . '.' . $ext;
$target_path = $settings['upload']['folder']['maps'] . $filename;
}
//var_dump($target_path);
if (filesize($_FILES['image']['tmp_name']) > 2097152) {
$this->params['error'] = 'Uploaded file cannot exceed 1MB.';
return;
}
if (move_uploaded_file($_FILES['image']['tmp_name'], $target_path)) {
$db->query("INSERT INTO tf2stats_map_images (map_id, player_id, image) VALUES(%s, %s, %s)", array($map_info['id'], $user->id(), $filename));
$this->params['success'] = basename($_FILES['image']['name']) . ' uploaded successfully.';
} else {
echo $_FILES['image']['tmp_name'];
echo $target_path;
$this->params['error'] = 'Unknown error. Please nag FireSlash until he fixes it.';
}
}
return;
}
// tinyMCE setup
$this->head .= '<script type="text/javascript" src="/static/js/tiny_mce/jquery.tinymce.js"></script>
<script type="text/javascript">
$().ready(function() {
$(\'textarea.tinymce\').tinymce({
// Location of TinyMCE script
script_url : "/static/js/tiny_mce/tiny_mce.js",
theme : "advanced",
mode : "none",
plugins : "bbcode",
theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,styleselect,removeformat,cleanup,code",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_styles : "Code=codeStyle;Quote=quoteStyle",
content_css : "css/bbcode.css",
entity_encoding : "raw",
add_unload_trigger : false,
remove_linebreaks : false,
inline_styles : false,
convert_fonts_to_spans : false,
apply_source_formatting : false
});
});
</script>
';
// map info
$this->template = "manage_map";
require_once 'classes/map.php';
$m = new map($this->request[0]);
$this->params['images'] = $m->get_images('xy165');
$this->params['has_images'] = $this->params['images'];
$this->params['can_set_official'] = IsUserAdmin();
// associated peoples
$db->query("SELECT p.id, p.name, mp.type from tf2stats_map_to_player mp LEFT JOIN tf2_players p ON mp.player_id = p.id WHERE mp.map_id = %s", array($map_info['id']));
while ($row = $db->fetch_array()) {
$row['del_link'] = sprintf('/manage_map/%s/delauthor/%s/', $this->request[0], $row['id']);
$p[] = $row;
}
$this->title = sprintf("Managing %s", htmlspecialchars($this->request[0]));
$this->params['people'] = $p;
}