<?php define('IN_ECS', true); require dirname(__FILE__) . '/includes/init.php'; if ($_REQUEST['act'] == 'list') { $album_types = get_album_types(); $smarty->assign("album_types", $album_types); $smarty->display('album_list.htm'); exit; } elseif ($_REQUEST['act'] == 'ajax_list') { $list = album_list(); make_json($list); } elseif ($_REQUEST['act'] == 'upload') { //获取文件上传的目录 $targetPath = '../resource/data/album/' . $_REQUEST['atype_id']; $verifyToken = md5('unique_salt' . $_REQUEST['timestamp']); if (!empty($_FILES) && $_REQUEST['token'] == $verifyToken) { $tempFile = $_FILES['Filedata']['tmp_name']; $image_name = unique_name($targetPath . '/') . '.' . get_prefix($_FILES['Filedata']['name']); $targetFile = rtrim($targetPath, '/') . '/' . $image_name; move_uploaded_file($tempFile, $targetFile); $sql = "insert into " . $ecs->table("album") . " (class_code, type, name, path, filesize, creator, created) \r\n\t\tvalues ('" . $_SESSION['class_code'] . "','" . $_REQUEST['atype_id'] . "', '" . $_REQUEST['Filename'] . "',\r\n\t\t\t'" . $targetFile . "','" . $_FILES['Filedata']['size'] . "','" . $_SESSION['admin_id'] . "',now()) "; $db->query($sql); admin_log(addslashes($_REQUEST['Filename']), 'upload', "album_picture"); make_json_result("上传“" . $_REQUEST['Filename'] . "”成功!"); } make_json_error("上传" . $_REQUEST['Filename'] . "失败!"); } elseif ($_REQUEST['act'] == 'ajax_save') { $id = !empty($_REQUEST['album_id']) ? intval($_REQUEST['album_id']) : 0; $sql = "update " . $ecs->table("album") . " set name='" . $_REQUEST["name"] . "',\r\n\t\t\tsort='" . $_REQUEST["sort"] . "'\r\n\t\t\twhere album_id=" . $id; $db->query($sql);
$np1 = $np + 1; $current_index_text = "<span id='picindex'>{$np1}</span> of {$my_numpics}"; echo "\r\n\t<h3 style='margin-left:3px'>\r\n\t\t<a class='standard' href='?'>相册首页</a> > <a class='standard' href='?albumid={$albumid}'>{$albumname}</a> > {$current_index_text}\r\n\t</h3>\r\n \r\n <table style='margin:0 auto;border:1px solid #ccc;width:99%'>\r\n\t\t<tr valign=top>\r\n\t\t\t<td width='20%' align='left'>\r\n\t\t\t\t<a href='?albumid={$albumid}'>«View Album</a>\r\n\t\t\t</td>\r\n\t\t\t<td width='30%' align='right'>\r\n\t\t\t\t<a onclick='navi(-1);return false;' href='javascript:;' >\t\t\t\r\n\t\t\t\t\t<img border=0 alt='Previous item' src='/images/left.gif'>\r\n\t\t\t\t</a>\r\n\t\t\t</td>\r\n \t\t<td> \r\n\t\t\t</td>\r\n\t\t\t<td width='30%' align='left'> \r\n\t\t\t\t<a onclick='navi(1);return false;' href='javascript:;'>\r\n\t\t\t\t\t<img border=0 alt='Next item' src='/images/right.gif'>\r\n\t\t\t\t</a>\r\n\t\t\t</td>\r\n\t\t\t<td width='20%' align='right'>\r\n\t\t\t\t<a id='zoom' href='{$img_base}' target='_blank' title='察看原图'>\r\n\t\t\t\t\t<img src='/images/zoom_normal.gif' alt='view original'/>\r\n\t\t\t\t</a>\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t</table>"; $display_height = $max_height; if ($img_height < $display_height) { $display_height = $img_height; } echo "\r\n\t<div id='picbox' style='text-align:center'>\r\n\t\t<span id='imgdes' style='margin-left:2px'>\r\n\t\t\t{$photofeed->media_group->media_description->_t}\r\n\t\t</span>\r\n\t\t<p>\r\n\t\t\t<a border=0 href='javascript:;' onclick='navi(1);return false;' title='点击显示下一张'>\r\n\t\t\t\t<img id='picture' height='{$display_height}px' src='{$img_base}{$smallsize}' class='pwimages' />\r\n\t\t\t</a>\r\n\t\t</p>\r\n\t</div>"; } if ($np >= 0) { show_photo(); } else { if ($albumid) { photo_list(); } else { album_list(); } } function get_json_content($echo = true) { global $photosfeed, $pwa_directory; $album_md5 = md5($albumid) . ".js"; if (true || !is_file($pwa_directory . $album_md5)) { //if ($photosfeed) $photosfeed = get_rss_content(); $src = array(); $des = array(); $total = count($photosfeed->feed->entry); for ($i = 0; $i < $total; $i++) { $src[$i] = $photosfeed->feed->entry[$i]->content->src; $des[$i] = $photosfeed->feed->entry[$i]->media_group->media_description->_t;
<?php define('IN_ECS', true); require dirname(__FILE__) . '/includes/init.php'; if ($_REQUEST['act'] == 'list') { $album_types = get_album_types(); $smarty->assign("album_types", $album_types); $smarty->display('album_show_type.htm'); exit; } elseif ($_REQUEST['act'] == 'show') { $album_type = empty($_REQUEST['type']) ? '' : trim($_REQUEST['type']); //编号 $list = album_list($album_type, $class_code); $smarty->assign("albums", $list); $smarty->display('album_show.htm'); exit; } function album_list($album_type, $class_code) { $sql = "SELECT * FROM " . $GLOBALS['ecs']->table("album") . " where type='" . $album_type . "' and class_code='" . $class_code . "' ORDER by sort "; return $GLOBALS['db']->getAll($sql); }