Exemple #1
0
/**
 * 取得模型信息
 * return array
 */
function getmodelinfoall($type, $value)
{
    if ($type == 'mid') {
        $value = intval($value);
        if (empty($value)) {
            return false;
        }
    } else {
        if (empty($value) || !preg_match("/^[a-z0-9]{2,20}\$/i", $value)) {
            return false;
        }
    }
    $cachefile = S_ROOT . './cache/model/model_' . $value . '.cache.php';
    $cacheinfo = '';
    if (file_exists($cachefile)) {
        include_once $cachefile;
    }
    if (!empty($cacheinfo) && is_array($cacheinfo)) {
        return $cacheinfo;
    } else {
        include_once S_ROOT . './function/cache.func.php';
        return updatemodel($type, $value);
    }
}
Exemple #2
0
    $attachmenturlcount = count($attachmenturlarr);
    $attachmenturls = implode("\r\n", $attachmenturlarr);
    DB::query('REPLACE INTO ' . tname('settings') . ' (variable,value) values (\'attach\',\'' . serialize($_POST['attach']) . '\')');
    DB::query('REPLACE INTO ' . tname('settings') . ' (variable,value) values (\'attachmentdir\',\'' . $_POST['attachmentdir'] . '\')');
    DB::query('REPLACE INTO ' . tname('settings') . ' (variable,value) values (\'attachmenturl\',\'' . $attachmenturl . '\')');
    DB::query('REPLACE INTO ' . tname('settings') . ' (variable,value) values (\'attachmenturls\',\'' . $attachmenturls . '\')');
    DB::query('REPLACE INTO ' . tname('settings') . ' (variable,value) values (\'attachmenturlcount\',\'' . $attachmenturlcount . '\')');
    updatesettingcache();
    foreach ($_POST['thumb'] as $k => $v) {
        $v['width'] = intval($v['width']);
        $v['height'] = intval($v['height']);
        if ($v['width'] == 0 || $v['height'] == 0) {
            cpmsg('thumbsize_error');
        }
        updatetable('models', array('thumbsize' => $v['width'] . ',' . $v['height']), 'modelname=\'' . $k . '\'');
        updatemodel('modelname', $k);
    }
    cpmsg('update_success', '?action=attach');
}
//添加或更改分類的編輯頁面
shownav('global', 'nav_attach');
showsubmenu('nav_attach', array(array('settings_basic', 'global', '0'), array('nav_attach', 'attach', '1')));
showtips('attach_tips');
showformheader('attach');
showtableheader();
showsetting('settings_attach_basic_dir', 'attachmentdir', $_G['setting']['attachmentdir'], 'text');
showsetting('settings_attach_basic_urls', 'attachmenturls', $_G['setting']['attachmenturls'], 'textarea');
showsetting('settings_attach_basic_filesize', 'attach[filesize]', $_G['setting']['attach']['filesize'] / 1024 . 'K', 'text');
foreach ($_models as $_model) {
    $_mid = $_mname['mid'];
    $_mname = $_model['modelname'];
        $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname($resultmodels['modelname'] . 'items') . " i, " . tname($resultmodels['modelname'] . 'message') . " m WHERE i.catid='{$catid}' AND i.itemid = m.itemid");
        while ($value = $_SGLOBAL['db']->fetch_array($query)) {
            $value['catid'] = 0;
            $setsqlarr = array('subject' => addslashes($value['subject']), 'message' => addslashes(serialize($value)), 'dateline' => $_SGLOBAL['timestamp'], 'mid' => $resultmodels['mid'], 'folder' => 2);
            $ids[] = $value['itemid'];
            inserttable('modelfolders', $setsqlarr);
        }
        $ids = simplode($ids);
        $_SGLOBAL['db']->query("DELETE FROM " . tname($resultmodels['modelname'] . 'items') . " WHERE catid='{$catid}'");
        $_SGLOBAL['db']->query("DELETE FROM " . tname($resultmodels['modelname'] . 'message') . " WHERE itemid IN ({$ids})");
        $_SGLOBAL['db']->query('DELETE FROM ' . tname('categories') . ' WHERE catid=\'' . $catid . '\'');
    } else {
        $_SGLOBAL['db']->query('DELETE FROM ' . tname('categories') . ' WHERE catid=\'' . $catid . '\'');
        $_SGLOBAL['db']->query('UPDATE ' . tname($resultmodels['modelname'] . 'items') . ' SET catid=\'' . $newcatid . '\' WHERE catid=\'' . $catid . '\'');
    }
    updatemodel('modelname', $resultmodels['modelname']);
    showmessage('category_delete_success', $newurl);
}
$addclass = $viewclass = '';
if (empty($_GET['op'])) {
    //LIST VIEW
    $listarr = getmodelcategory($resultmodels['modelname']);
    $viewclass = ' class="active"';
} elseif ($_GET['op'] == 'edit') {
    //权限
    if (!checkperm('managemodcat') || checkperm('manageeditcat')) {
        showmessage('no_authority_management_operation');
    }
    $_GET['catid'] = intval($_GET['catid']);
    //ONE VIEW FOR UPDATE
    $query = $_SGLOBAL['db']->query('SELECT * FROM ' . tname('categories') . ' WHERE catid=\'' . $_GET['catid'] . '\' AND `type`=\'' . $resultmodels['modelname'] . '\'');
Exemple #4
0
    $query = $_SGLOBAL['db']->query('SELECT id, displayorder FROM ' . tname('modelcolumns') . ' WHERE mid = \'' . $_POST['mid'] . '\'');
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $fieldarr[$value['id']] = $value['displayorder'];
    }
    if (is_array($_POST['displayorder']) && $_POST['displayorder']) {
        foreach ($_POST['displayorder'] as $postcatid => $postdisplayorder) {
            $postcatid = intval($postcatid);
            $postdisplayorder = intval($postdisplayorder);
            if (!empty($postcatid)) {
                if ($fieldarr[$postcatid] != $postdisplayorder) {
                    updatetable('modelcolumns', array('displayorder' => $postdisplayorder), array('id' => $postcatid));
                }
            }
        }
    }
    updatemodel('mid', $_POST['mid']);
    showmessage('fieldlistsubmit_success', CPURL . '?action=models&op=field&mid=' . $_POST['mid']);
}
if (empty($_GET['op'])) {
    //Ä£Ð͹ÜÀí_ÁбíÒ³
    $modellist = '';
    $query = $_SGLOBAL['db']->query('SELECT m.*, c.status FROM ' . tname('models') . ' m LEFT JOIN ' . tname('channels') . ' c ON (m.modelname = c.nameid) ORDER BY m.mid DESC');
    while ($temp = $_SGLOBAL['db']->fetch_array($query)) {
        $tmpurl = S_URL . '/m.php?name=' . $temp['modelname'];
        $temp['status'] = $temp['status'] > 0 ? $alang['setting_allowtagshow_1'] : $alang['setting_allowtagshow_0'];
        $modellist .= <<<EOF
\t\t<tr class="darkrow" id="ns">
\t\t\t<td align="center"><a href="{$tmpurl}" target="_blank">{$temp['modelname']} ({$temp['modelalias']})</a></td>
\t\t\t<td align="center"><a href="{$cpurl}?action=channel" target="_blank">{$temp['status']}</a></td>
\t\t\t<td align="center">
\t\t\t\t<a href="?action=models&op=edit&mid={$temp['mid']}">{$alang['robot_robot_op_edit']}</a>&nbsp;|&nbsp;
Exemple #5
0
 //crons列表
 updatecroncache();
 //计划任务
 updatecategorycache();
 //分类
 updatecensorcache();
 //缓存语言屏蔽
 click_cache();
 //缓存表态
 creditrule_cache();
 //缓存积分
 postnews_cache;
 //缓存信息推送
 model_cache();
 foreach ($_SGLOBAL['updatemodel']['cache'] as $value) {
     updatemodel('mid', $value);
 }
 if (discuz_exists()) {
     updatebbssetting();
     //缓存论坛设置
     updatebbsstyle();
     //缓存论坛风格设置
     updatebbsbbcode();
     //缓存论坛bbcode/smiles
 }
 //写log
 if (@($fp = fopen($lockfile, 'w'))) {
     fwrite($fp, 'SupeSite');
     fclose($fp);
 }
 show_msg('升级完成,为了您的数据安全,避免重复升级,请登录FTP删除本文件!');
Exemple #6
0
    }
    if ($_GET['op'] == 'add') {
        $attrid = inserttable('modelcolumns', $arr_data, 1);
        $query = DB::fetch(DB::query('SELECT max(displayorder) as displayorder FROM ' . tname('modelcolumns') . ''));
        updatetable('modelcolumns', array('fieldname' => $attr_pre . $attrid, 'displayorder' => intval($query['displayorder']) + 1), 'id=' . $attrid);
        DB::query('ALTER TABLE `' . tname($table_handle) . '` ADD `' . $attr_pre . $attrid . '` ' . $arr_data['fieldtype'] . '( ' . $arr_data['fieldlength'] . ' ) ');
    } elseif ($_GET['op'] == 'edit') {
        $field_len = DB::result_first('select fieldlength from ' . tname('modelcolumns') . ' where id=' . $attrid);
        if (intval($field_len) > intval($_POST['fieldlength'])) {
            cpmsg('ext_field_length_error');
        }
        updatetable('modelcolumns', $arr_data, 'id=' . $attrid);
        DB::query('ALTER TABLE `' . tname($table_handle) . '` CHANGE `' . $attr_pre . $attrid . '` `' . $attr_pre . $attrid . '` VARCHAR( ' . $arr_data['fieldlength'] . ' ) ');
    }
    updatemodel('modelname', 'shop');
    updatemodel('modelname', 'groupbuy');
    if ($_GET['op'] == 'add') {
        cpmsg('message_success', '?action=attr&type=' . $_GET['type']);
    } else {
        cpmsg('update_success', '?action=attr&type=' . $_GET['type']);
    }
}
if ($_GET['op'] == 'add' || $_GET['op'] == 'edit') {
    shownav('global', 'attr_' . $_GET['op']);
    showsubmenu('attr_' . $_GET['op']);
    showformheader('attr&type=' . $_GET['type'] . '&op=' . $_GET['op']);
    showtableheader('');
    if ($_GET['op'] == 'edit') {
        if ($attrid > 0) {
            $query = DB::query('select * from ' . tname('modelcolumns') . ' where id=' . $attrid);
            $attritem = DB::fetch($query);