function createstructure($data, $parent, $path) { global $CONFIG, $filelist; $i = 0; $names = array_keys($data); $cat_names = array(); foreach ($data as $set) { if (is_array($set)) { $cat_names[] = $names[$i]; } $i++; } $i = 0; foreach ($cat_names as $name) { unset($aid); $base = true; foreach ($data[$name] as $lower) { if (is_array($lower)) { $base = false; break; } } if ($base) { $directory = $name; } else { $parent2 = createcategory($parent, $name); $directory = $data[$name]; } if (is_array($directory)) { createstructure($directory, $parent2, "{$path}/{$name}"); } else { if (!isset($aid)) { $aid = createalbum($parent, $name); } $contents = dir_parse("{$path}/{$name}"); foreach ($contents as $file) { if (strncmp($file, $CONFIG['thumb_pfx'], strlen($CONFIG['thumb_pfx'])) != 0 && strncmp($file, $CONFIG['normal_pfx'], strlen($CONFIG['normal_pfx'])) != 0 && strncmp($file, 'orig_', strlen('orig_')) != 0 && strncmp($file, 'mini_', strlen('mini_')) != 0 && strpos('Thumbs.db', $file) === false) { $filelist["{$path}/{$name}/{$file}"] = $aid; } } } } }
$user = get_login_user(); filter_all_post($_REQUEST); filter_all_post($_POST, FALSE, TRUE); // don't strip html *everywhere*, just strip bad tags - or we'll mutilate any html content. // TO DO: This array should be populated from the database. $sb_types = array('event' => array(array('caption' => 'Generic', 'sb_mc_type' => 'event/generic'), array('caption' => 'Conference', 'sb_mc_type' => 'event/conference'), array('caption' => 'Concert', 'sb_mc_type' => 'event/concert')), 'review' => array(array('caption' => 'Local Service', 'sb_mc_type' => 'review/localservice'), array('caption' => 'Event', 'sb_mc_type' => 'review/event'), array('caption' => 'Bar/Club', 'sb_mc_type' => 'review/club'), array('caption' => 'Restaurant', 'sb_mc_type' => 'review/restaurant'), array('caption' => 'Café', 'sb_mc_type' => 'review/cafe'), array('caption' => 'Hotel/Resort', 'sb_mc_type' => 'review/hotel'), array('caption' => 'Book', 'sb_mc_type' => 'review/book'), array('caption' => 'Album', 'sb_mc_type' => 'review/album'), array('caption' => 'Article', 'sb_mc_type' => 'review/article'), array('caption' => 'Magazine', 'sb_mc_type' => 'review/magazine'), array('caption' => 'Movie', 'sb_mc_type' => 'review/movie'), array('caption' => 'Software', 'sb_mc_type' => 'review/software'), array('caption' => 'Song', 'sb_mc_type' => 'review/song'), array('caption' => 'Website', 'sb_mc_type' => 'review/website'))); if ($_POST) { $succ_msg = NULL; // check to see if there are any errors $SbHelper = new SbHelper(); $SbHelper->set_mc_type($_REQUEST['sb_mc_type']); $error_array = $SbHelper->processForm(); // check for album creation if (@$_POST['new_album']) { // try to create new album $save_alb = createalbum(); if ($save_alb['error'] == TRUE) { array_push($error_array, $save_alb['msg']); } else { $created_album_id = $save_alb; } } if (sizeof($error_array) && $_POST['save_publish_post'] == TRUE) { $post_err = "Your post could not be saved due to the following errors:<br />"; $err = @implode('<br />', $error_array); $post_err .= $err; } } if (@$_POST['save_publish_post'] == TRUE && count($error_array) == 0) { // check if user is here for editing his post $tag_string = @$_POST['tags'];
/** * [品牌空間] (C)2001-2010 Comsenz Inc. * This is NOT a freeware, use is subject to license terms * * $Id: add_album.inc.php 4442 2010-09-14 09:43:34Z yumiao $ */ if (!defined('IN_ADMIN') && !defined('IN_STORE')) { exit('Acess Denied'); } if (empty($_SGLOBAL['panelinfo']['enablealbum'])) { cpmsg('no_perm'); } require_once B_ROOT . './source/adminfunc/album.func.php'; if (!empty($_POST['valuesubmit'])) { $albumid = createalbum($shopid, $_POST['catid'], $_G['uid'], $_G['username'], $_POST['album']['subject'], $_POST['album']['description']); if ($albumid > 0) { itemnumreset('album', $shopid); $_BCACHE->deltype('sitelist', 'album'); $_BCACHE->deltype('storelist', 'album', $shopid); $_BCACHE->deltype('storelist', 'photo', $shopid, $albumid); cpmsg('message_success', $BASESCRIPT . '?action=add&m=photo&albumid=' . $albumid); } } //添加或更改的頁面 shownav('infomanage', 'nav_album_add', $_SGLOBAL['panelinfo']['subject']); showformheader('add&m=album'); showtableheader(''); showsetting('album_subject', 'album[subject]', '', 'text'); showsetting('album_description', 'album[description]', '', 'textarea'); $mycats = mymodelcategory('album');
showtableheader('import_listresult', 'notop'); showtablefooter(); showhiddenfields(array('step' => '4')); showhiddenfields(array('page' => $page)); showattachshtml(); //圖片列表 showalbummod(); showformfooter(); //批量操作的form結束 } elseif ($step == 4) { //數據提交處理頁面 $attachs = getpostattach(); $updatesql = array(); if ($_POST['albumop'] == 'new') { require_once B_ROOT . './source/adminfunc/album.func.php'; $albumid = createalbum($shopid, $_POST['catid'], $authorid, $author, $_POST['albumname'], $_POST['albumdesc']); //更新相冊記錄為從論壇導入的相冊 $imgurl = $attachs[0]['url']; if (strpos($imgurl, 'http://') === 0) { $remoteattach = loadClass('attach')->saveremotefile($imgurl, array(320, 240)); $imgurl = $remoteattach['file']; } $updatesql[] = " `frombbs`='1', `tid`='tid', `subjectimage`='" . $imgurl . "' "; ssetcookie('i_albumid', $albumid, 900); } elseif (empty($albumid)) { cpmsg('import_albumid_error', '', '', '', true, true); } $query = DB::query('SELECT itemid, shopid, subject FROM ' . tname('albumitems') . " WHERE itemid='{$albumid}'"); list($albumid, $shopid, $albumsubject) = DB::fetch_row($query); if (empty($albumid) || empty($shopid)) { cpmsg('import_albumid_error', '', '', '', true, true);