function mydeletealbums($albumids) { global $_G; $pics = array(); $allowmanage = checkperm('managealbum'); $haveforumpic = false; $query = C::t('#sanree_brand#sanree_brand_album_category')->fetch_all($albumids); foreach ($query as $value) { if ($allowmanage || $value['uid'] == $_G['uid']) { $pics[] = $value['catid']; } } if (empty($pics)) { return array(); } $picsstr = ' AND catid IN (\'' . implode($pics, ',') . '\')'; C::t('#sanree_brand#sanree_brand_album_category')->delete($pics); $delids = C::t('#sanree_brand#sanree_brand_album')->fetch_albumid_by_searchkey($picsstr, 20); $picids = array(); foreach ($delids as $value) { $picids[] = $value['albumid']; } if (empty($picids)) { return array(); } mydeletepics($picids); }
if (!$_G['sr_delete'][$id]) { $setarr = array('displayorder' => $_G['sr_album_displayorder'][$id], 'albumname' => $_G['sr_album_title'][$id], 'ishome' => intval($_G['sr_album_ishome'][$id])); C::t('#sanree_brand#sanree_brand_album')->update($id, $setarr); } } } if (is_array($_G['sr_newtitle'])) { foreach ($_G['sr_newtitle'] as $k => $v) { if ($v) { $setarr = array('albumname' => $v, 'displayorder' => $_G['sr_newdisplayorder'][$k], 'pic' => $_G['sr_newurl'][$k], 'dateline' => TIMESTAMP); C::t('#sanree_brand#sanree_brand_album')->insert($setarr); } } } if ($_G['sr_delete']) { mydeletepics($_G['sr_delete']); } cpmsg($langs['succeed'], $gotourl . 'album', 'succeed'); } else { showsubmenu($menustr); showtableheader('', 'nobottom'); showtablerow('', array(), array('<ul class="tab1">' . '<li><a href="' . ADMINSCRIPT . '?action=plugins&operation=config&act=album_category&identifier=sanree_brand&pmod=admincp"><span>' . $langs['albumcate'] . '</span></a></li>' . '<li class="current"><a href="' . ADMINSCRIPT . '?action=plugins&operation=config&act=album&identifier=sanree_brand&pmod=admincp"><span>' . $langs['piclist'] . '</span></a></li></ul>')); showtablefooter(); $skeyword = $_G['sr_skeyword']; showformheader($thisurl); showtableheader($langs['searchbar'], '', 'style="border:1px solid #F0F7FD"'); showtablerow('', '', $langs['skeyword'] . '<input type="text" name="skeyword" value="' . $skeyword . '" class="txt" style="width:200px;" /> <input type="submit" value="' . $langs['search'] . '" class="btn" name="searchsubmit"/>'); showtablefooter(); showformfooter(); showformheader($thisurl); showtableheader($langs['album'], 'nobottom');
$do = $_G['sr_do']; $doarray = array('album'); if (!in_array($do, $doarray)) { showmessage(srlang('unknowact')); } if ($do == 'album') { $bid = intval($_G['sr_bid']); $brandresult = C::t('#sanree_brand#sanree_brand_businesses')->getbusinesses_by_bid($bid); if (!$brandresult) { showmessage(srlang('nodengji')); } $brandgroup = C::t('#sanree_brand#sanree_brand_group')->get_by_groupid($brandresult['groupid']); if (intval($brandgroup['allowdeletealbum']) != 1) { showmessage(srlang('notallowdeletealbum')); } $albumid = intval($_G['sr_albumid']); $albumresult = C::t('#sanree_brand#sanree_brand_album')->userget_by_albumid($albumid, intval($_G['uid'])); if (!$albumresult) { showmessage(srlang('nopic')); } if ($_G['uid'] != $albumresult['uid']) { showmessage(srlang('erroruser')); } $result = C::t('#sanree_brand#sanree_brand_album_category')->get_by_catid(intval($albumresult['catid'])); if (md5($result['pic']) == md5($albumresult['pic'])) { fixalbumpic(intval($albumresult['catid']), array('pic' => NULL)); } mydeletepics($albumid); $rurl = 'plugin.php?id=sanree_brand&mod=mybrand&view=myalbum&st=album&bid=' . $bid . '&catid=' . intval($albumresult['catid']); showmessage(srlang('succeed'), $rurl); }