query($sql); unset($destination); unset($mymps_image); } else { write_msg('', '?m=album&type=corp&ac=upload&error=29'); } write_msg('', '?m=album&type=corp&ac=upload&success=12'); } else if ($ac == 'edit') { if (empty($id)) { write_msg('', '?m=album&type=corp&ac=list&error=1'); } if (empty($title)) { write_msg('', '?m=album&type=corp&ac=edit&error=28&id=' . $id); } if ($_FILES[$name_file]['name']) { check_upimage($name_file); $destination = '/album/' . date('Ym') . '/'; $mymps_image = start_upload($name_file, $destination, 1, $mymps_mymps['cfg_memberalbum_limit']['width'], $mymps_mymps['cfg_memberalbum_limit']['height'], $path, $prepath); $path = $mymps_image[0]; $prepath = $mymps_image[1]; unset($destination); unset($mymps_image); } $db->query('UPDATE `' . $db_mymps . 'member_album` SET title = \'' . $title . '\',path = \'' . $path . '\', prepath = \'' . $prepath . '\',pubtime = \'' . $timestamp . '\' ' . $where . ' AND id = \'' . $id . '\''); write_msg('', '?m=album&type=corp&ac=edit&success=8&id=' . $id); } } else { if ($ac == 'upload') { $album_maxpost = $group['album_maxpost']; $cur_album = mymps_count('member_album', ' WHERE userid = \'' . $s_uid . '\''); if ($album_maxpost <= $cur_album) { write_msg('', '?m=album&type=corp&error=49'); exit(); } } else if ($ac == 'list') { $sql = 'SELECT * FROM ' . $db_mymps . 'member_album ' . $where . ' ORDER BY id DESC'; $rows_num = mymps_count('member_album', $where); $param = setParam(array('m', 'type', 'ac')); $album = page1($sql); } else if ($ac == 'edit') { if (empty($id)) { write_msg('', '?m=album&type=corp&error=1'); } $edit = $db->getRow('SELECT id,title,path,prepath FROM `' . $db_mymps . 'member_album` ' . $where . ' AND id = \'' . $id . '\''); if (empty($edit['id'])) { write_msg('', '?m=album&type=corp&ac=list&error=27'); } } else if ($ac == 'delete') { if (empty($id)) { write_msg('', '?m=album&type=corp&error=1'); } if (!($row = $db->getRow('SELECT path,prepath FROM `' . $db_mymps . 'member_album` ' . $where . ' AND id = \'' . $id . '\''))) { write_msg('', '?m=album&type=corp&ac=list&error=27'); } else { @unlink(MYMPS_ROOT . $row['path']); @unlink(MYMPS_ROOT . $row['prepath']); $res = $db->query('DELETE FROM `' . $db_mymps . 'member_album` ' . $where . ' AND id = \'' . $id . '\''); } write_msg('', '?m=album&type=corp&ac=list&success=8'); } $location = location('corp'); include mymps_tpl('album_' . (in_array($ac, array('upload', 'edit')) ? 'upload' : $ac)); unset($album); } ?>