Ejemplo n.º 1
0
 }
 $searchtext = " AND uid={$_G['uid']} AND catid=" . $catid;
 $count = C::t('#sanree_brand#sanree_brand_album')->count_by_where($searchtext);
 $maxalbum = getmaxalbumbycatid($catid, $_G[uid]);
 if ($count >= $maxalbum) {
     $msg = str_replace("{maxalbum}", $maxalbum, srlang('maxalbumtip'));
 } else {
     $picdata = array();
     if ($_FILES['Filedata']) {
         if ($_FILES['Filedata']['error'] == 0) {
             if ($albumfilesize > 0) {
                 if ($_FILES['Filedata']['size'] > $albumfilesize * 1024) {
                     showmessage(str_replace('{size}', $albumfilesize, srlang('error_maxpic')));
                 }
             }
             $picdata = mypic_save($_FILES['Filedata'], $albumid);
         }
     }
     if (empty($picdata['filepath'])) {
         showmessage(srlang('error_pictip'));
     }
     $setarr['pic'] = $picdata['filepath'];
     $setarr['albumname'] = empty($albumname) ? $picdata['filename'] : $albumname;
     $setarr['catid'] = $catid;
     $setarr['depict'] = dhtmlspecialchars(trim($_G['sr_depict']));
     $setarr['displayorder'] = intval(trim($_G['sr_displayorder']));
     $setarr['dateline'] = TIMESTAMP;
     $setarr['uid'] = $_G['uid'];
     $setarr['bid'] = $bid;
     $setarr['username'] = $_G['username'];
     C::t('#sanree_brand#sanree_brand_album')->insert($setarr);
Ejemplo n.º 2
0
 $setarr['depict'] = dhtmlspecialchars(trim($_G['sr_depict']));
 $setarr['displayorder'] = intval(trim($_G['sr_displayorder']));
 $brand = C::t('#sanree_brand#sanree_brand_album_category')->get_by_catid($catid);
 if (!$brand) {
     cpmsg_error($langs['error_bid']);
 }
 $setarr['bid'] = $brand['bid'];
 $setarr['uid'] = $brand[uid];
 $setarr['username'] = $brand[username];
 if ($albumid) {
     C::t('#sanree_brand#sanree_brand_album')->update($albumid, $setarr);
 } else {
     $picdata = array();
     if ($_FILES['pic']) {
         if ($_FILES['pic']['error'] == 0) {
             $picdata = mypic_save($_FILES['pic'], $albumid);
         }
     }
     if (empty($picdata['filepath'])) {
         cpmsg_error($langs['error_pictip']);
     }
     $setarr['pic'] = $picdata['filepath'];
     $setarr['dateline'] = TIMESTAMP;
     $albumid = C::t('#sanree_brand#sanree_brand_album')->insert($setarr, TRUE);
     fixalbumpic($catid, $setarr);
 }
 if (intval($_G['sr_istop']) == 1) {
     $data = C::t('#sanree_brand#sanree_brand_album')->get_by_albumid($albumid);
     C::t('#sanree_brand#sanree_brand_album_category')->update($data['catid'], array('pic' => $data['pic']));
 }
 cpmsg($langs['succeed'], $gotourl . 'album', 'succeed');