Ejemplo n.º 1
0
/**
 * 是否需要想論壇推送
 *
 * @param int $albumid
 */
function syncpost_check($mname, $items)
{
    global $_SGLOBAL;
    $query = DB::query("SELECT itemid, shopid FROM " . DB::table($mname . 'items') . " WHERE itemid IN ({$items})");
    while ($result = DB::fetch($query)) {
        getpanelinfo($result['shopid']);
        if (!empty($_SGLOBAL['panelinfo']['syncfid'])) {
            require_once B_ROOT . './api/bbs_syncpost.php';
            syncpost($result['itemid'], $mname);
        }
    }
    return false;
}
Ejemplo n.º 2
0
 }
 //取得信息
 $query = DB::query('SELECT * FROM ' . tname($mname . 'items') . ' i ' . ($mname == 'album' ? '' : 'INNER JOIN ' . tname($mname . 'message') . ' m ON i.itemid=m.itemid') . ' WHERE ' . $wheresql . ' ORDER BY i.itemid DESC LIMIT 1');
 $editvalue = DB::fetch($query);
 if (empty($editvalue)) {
     cpmsg('no_item', 'admin.php?action=list&m=' . $mname);
 }
 if ($mname == 'good' || $mname == 'groupbuy') {
     $relatedarr = array();
     $relatedarr = getrelatedinfo($mname, $editvalue['itemid'], $editvalue['shopid']);
 }
 $editvalue['dateline'] = sgmdate($editvalue['dateline']);
 //管理員查看基本信息&& $mname=='shop'
 if ($_GET['op'] == 'adminview') {
     if (empty($_SGLOBAL['panelinfo'])) {
         getpanelinfo($_GET['itemid']);
     }
     if ($_GET['updatepass'] == 1) {
         $updateser = DB::fetch(DB::query("SELECT * FROM " . tname("itemupdates") . " WHERE itemid='{$_GET['itemid']}' and type = '{$mname}'"));
         $update = unserialize($updateser['update']);
         $update = sstripslashes($update);
         $update['groupid'] = $_SGLOBAL['panelinfo']['group']['title'];
         $categorylist = getmodelcategory($mname);
         $update['attr_catid'] = $update['catid'];
         $update['catid'] = $categorylist[$update['catid']]['name'];
         $categorylist = getmodelcategory('region');
         $update['region'] = $categorylist[$update['region']]['name'];
         if (!empty($update['subjectimage'])) {
             $update['subjectimage'] = B_URL . '/' . getattachurl($update['subjectimage']);
         }
         if (!empty($update['banner'])) {
Ejemplo n.º 3
0
     }
     echo "\n\t\t\t</albums>\n\t\t\t<categories><category id=\"1\">cat</category></categories>\n\t\t</parameter>";
 } elseif ($_GET['op'] == 'upload' && $_POST['Upload'] == 'Submit Query') {
     $_POST['uid'] = intval($_POST['uid']);
     $_POST['albumid'] = intval($_POST['albumid']);
     $albumimg = '';
     $swfhash = md5(swfhash() . $_POST['uid']);
     if (!$_FILES['Filedata']['error'] && $_POST['hash'] == $swfhash) {
         $_G['uid'] = intval($_POST['uid']);
         $query = DB::query('SELECT * FROM ' . tname('members') . ' WHERE uid=\'' . $_G['uid'] . '\' LIMIT 1');
         $_G['member'] = DB::fetch($query);
         $_G['username'] = $_G['member']['username'];
         $_G['myshopid'] = $_G['member']['myshopid'];
         $shop_info = DB::fetch_first("select grade from " . tname('shopitems') . " where itemid=" . $_G['myshopid']);
         if (pkperm('isadmin') || $shop_info['grade'] == 3) {
             getpanelinfo();
             //現有相冊
             if (pkperm('isadmin')) {
                 $albumid = $_POST['albumid'];
                 if (empty($albumid)) {
                     //編輯器上傳默認相冊
                     $shopid = intval($_POST['shopid']);
                 } else {
                     $sql = 'SELECT shopid, subjectimage FROM ' . tname('albumitems') . " WHERE itemid='{$albumid}' LIMIT 1";
                     //非默認相冊
                     $query = DB::fetch_first($sql);
                     $shopid = $query['shopid'];
                     $albumimg = $query['subjectimage'];
                 }
             } else {
                 $shopid = $_G['myshopid'];
Ejemplo n.º 4
0
 *      This is NOT a freeware, use is subject to license terms
 *
 *      $Id: add.inc.php 4473 2010-09-15 04:04:13Z fanshengshuai $
 */
if (!defined('IN_ADMIN')) {
    exit('Acess Denied');
}
if ($mname != 'shop') {
    if (!empty($_GET['shopid'])) {
        ssetcookie('shopid', $_GET['shopid'], 3600 * 10);
        getpanelinfo($_GET['shopid']);
        if (!empty($_G['cookie']['i_referer'])) {
            header('Location: ' . $_G['cookie']['i_referer']);
        }
    } elseif (!empty($_G['cookie']['shopid'])) {
        getpanelinfo(intval($_G['cookie']['shopid']));
    }
    if (!empty($_SGLOBAL['panelinfo'])) {
        echo '<script type="text/javascript" charset="' . $_G['charset'] . '">var leftmenu = $(window.parent.document).find("#leftmenu");leftmenu.find("ul").css("display", "none");$(window.parent.document).find("#menu_paneladd").css("display", "");</script>';
        if ($_SGLOBAL['panelinfo']['enable' . $mname] < 1) {
            cpmsg('noaccess');
        }
        if (in_array($mname, array('good', 'notice', 'consume', 'album', 'brandlinks'))) {
            if (!empty($_SGLOBAL['panelinfo']['group']['maxnum' . $mname]) && $_SGLOBAL['panelinfo']['itemnum_' . $mname] >= $_SGLOBAL['panelinfo']['group']['maxnum' . $mname]) {
                if ($mname != 'album' || !empty($_POST['valuesubmit'])) {
                    cpmsg('toomuchitem');
                }
            }
        }
    }
}
Ejemplo n.º 5
0
function syncpost($itemid, $mname)
{
    if (!in_array($mname, array('album', 'good', 'notice', 'consume', 'groupbuy'))) {
        if ($mname == 'album') {
            syncalbum($itmeid);
            return false;
        }
    }
    global $_G, $_SC, $_SGLOBAL;
    $bbs_dbpre = $_SC['bbs_dbpre'];
    $db = new db_mysql(array(1 => array('tablepre' => $_SC['bbs_dbpre'], 'dbcharset' => $_SC['bbs_dbcharset'], 'dbhost' => $_SC['bbs_dbhost'], 'dbuser' => $_SC['bbs_dbuser'], 'dbpw' => $_SC['bbs_dbpw'], 'dbname' => $_SC['bbs_dbname'], 'silent' => true)));
    $db->connect();
    $item = DB::fetch_first("SELECT i.*, m.* FROM " . DB::table($mname . "items") . " i LEFT JOIN " . DB::table($mname . "message") . " m ON i.itemid = m.itemid WHERE i.itemid = '{$itemid}' AND i.grade = 3");
    if (empty($item)) {
        $db->close();
        unset($db);
        return false;
    }
    getpanelinfo($item['shopid']);
    $fid = $_SGLOBAL['panelinfo']['syncfid'];
    if (!checkbbsfid($fid)) {
        $db->close();
        unset($db);
        return false;
    }
    //插入主題信息
    $author = $_SGLOBAL['panelinfo']['username'];
    $authorid = $_SGLOBAL['panelinfo']['uid'];
    $subject = "[" . b_lang($mname) . "]" . $item['subject'];
    $message = postformat($mname, $item);
    $posttable_info = $db->result_first("SELECT svalue FROM {$bbs_dbpre}common_setting WHERE skey = 'posttable_info'");
    $posttableid = 0;
    if (!empty($posttable_info)) {
        $posttable_info = unserialize($posttable_info);
        if (is_array($posttable_info)) {
            foreach ($posttable_info as $key => $info) {
                if ($info['type'] == 'primary') {
                    $posttableid = $key;
                }
            }
        }
    }
    if (!$posttableid) {
        $tablename = 'forum_post';
    } else {
        $tablename = "forum_post_{$posttableid}";
    }
    if (empty($item['bbstid'])) {
        $db->query("INSERT INTO {$bbs_dbpre}forum_thread (fid, posttableid, author, authorid, subject, dateline, lastpost, lastposter)\n        VALUES ('{$fid}', '{$posttableid}', '{$author}', '{$authorid}', '{$subject}', '{$_G['timestamp']}', '{$_G['timestamp']}', '{$author}')");
        $tid = $db->insert_id();
        $db->query("UPDATE {$bbs_dbpre}common_member_field_home SET recentnote = '{$subject}' WHERE uid = '{$authorid}'");
        $db->query("INSERT INTO {$bbs_dbpre}forum_post_tableid (pid) values (null)");
        $pid = $db->insert_id();
        if ($pid % 1024 == 0) {
            $db->query("DELETE FROM {$bbs_dbpre}forum_post_tableid WHERE pid<{$pid}");
        }
        $db->query("REPLACE INTO {$bbs_dbpre}common_syscache (cname, ctype, dateline, data) VALUES ('max_post_id', '0', '{$_G['timestamp']}', '{$pid}')");
        if (!$posttableid) {
            $tablename = 'forum_post';
        } else {
            $tablename = "forum_post_{$posttableid}";
        }
        $db->query("INSERT INTO {$bbs_dbpre}{$tablename} SET `fid`='{$fid}',`tid`='{$tid}',`first`='1',`author`='{$author}',`authorid`='{$authorid}',`subject`='{$subject}',`dateline`='{$_G['timestamp']}',`message`='{$message} ',`useip`='unknown',`invisible`='0',`anonymous`='0',`usesig`='1',`htmlon`='0',`bbcodeoff`='0',`smileyoff`='-1',`parseurloff`='',`attachment`='0',`tags`='',`pid`='{$pid}'");
        $db->query("UPDATE {$bbs_dbpre}forum_forum SET lastpost='{$tid} {$subject} {$_G[timestamp]} {$author}', threads=threads+1, posts=posts+1, todayposts=todayposts+1 WHERE fid='{$fid}'");
        $db->query("UPDATE {$bbs_dbpre}common_stat SET `thread`=`thread`+1 WHERE daytime='" . date("Ymd", $_G[timestamp]) . "'");
        updatetable($mname . 'items', array('bbstid' => $tid), array('itemid' => $item['itemid']));
    } else {
        $tid = $item['bbstid'];
        $db->query("UPDATE {$bbs_dbpre}forum_thread SET subject='" . $subject . "' WHERE tid='{$tid}'");
        $pid = $db->result_first("SELECT pid FROM {$bbs_dbpre}{$tablename} WHERE tid = '{$tid}' AND first = 1");
        $db->query("UPDATE {$bbs_dbpre}{$tablename} SET message='{$message}' WHERE pid='{$pid}' AND tid = '{$tid}' AND first = 1");
    }
}
Ejemplo n.º 6
0
 *      This is NOT a freeware, use is subject to license terms
 *
 *      $Id: import.inc.php 4473 2010-09-15 04:04:13Z fanshengshuai $
 */
if (!defined('IN_ADMIN')) {
    exit('Acess Denied');
}
foreach (array('tid', 'page', 'maxpage', 'count', 'firstonly', 'step', 'albumid', 'minsize', 'authorid') as $value) {
    ${$value} = intval(!empty($_POST[$value]) ? $_POST[$value] : (!empty($_GET[$value]) ? $_GET[$value] : (!empty($_G['cookie']['i_' . $value]) ? $_G['cookie']['i_' . $value] : 0)));
}
$_GET['tid'] = intval($_GET['tid']);
$norepeat = intval($_G['cookie']['i_norepeat']);
$authorid = intval($_G['cookie']['i_t_authorid']);
$author = $_G['cookie']['i_t_author'];
$shopid = intval($_G['cookie']['shopid']);
getpanelinfo($_G['cookie']['shopid']);
$mycats = mymodelcategory('album');
$page = $page > 0 ? $page : 1;
$step = $step > 0 ? $step : 1;
$perpage = 24;
$sqlaids = '';
$mname = 'album';
if (empty($maxpage) && $step > 2) {
    cpmsg('import_cookie_error');
}
shownav('infomanage', 'photo_import');
showsubmenu('menu_album', array(array('menu_album_add', 'add&m=album', '0'), array('menu_photo_import', 'import&m=album', '1')));
showtips('photo_import_tips');
if ($step == 1) {
    //默認填寫基本信息頁面
    clearimportcookie();
Ejemplo n.º 7
0
function album_movecat($itemarr = array())
{
    global $_G, $_SGLOBAL, $cookie_referer;
    require_once B_ROOT . './batch.attribute.php';
    $num_ok = $num_error = 0;
    //驗證catid
    $catid = $_POST['catid'] = DB::result_first('SELECT catid FROM ' . tname('categories') . " WHERE catid='{$_POST['catid']}' AND `type`='album'");
    if ($catid && $itemarr) {
        foreach ($itemarr as $itemid) {
            $itemid = intval($itemid);
            $shopid = DB::result_first('SELECT shopid FROM ' . tname('albumitems') . " WHERE itemid='{$itemid}'");
            getpanelinfo($shopid);
            if ($_SGLOBAL['panelinfo']['group']['album_field'] != 'all' && !in_array($catid, explode(",", $_SGLOBAL['panelinfo']['group']['album_field']))) {
                $num_error++;
                continue;
            } else {
                DB::query('UPDATE ' . tname('albumitems') . " SET catid='{$catid}' WHERE itemid='{$itemid}'");
                DB::query('DELETE FROM ' . tname('itemattribute') . " WHERE itemid='{$itemid}'");
                setattributesettings($_POST['catid'], $itemid, $_POST['attr_ids']);
                $num_ok++;
            }
        }
        cpmsg(lang('mod_album_success1') . $num_ok . lang('mod_album_success2') . $num_error . lang('mod_album_success3'), $cookie_referer);
    }
    cpmsg('no_operation');
}