当前位置: 首页>>代码示例>>PHP>>正文


PHP cls_image::upload_image方法代码示例

本文整理汇总了PHP中cls_image::upload_image方法的典型用法代码示例。如果您正苦于以下问题:PHP cls_image::upload_image方法的具体用法?PHP cls_image::upload_image怎么用?PHP cls_image::upload_image使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cls_image的用法示例。


在下文中一共展示了cls_image::upload_image方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: wxch_upload_file

function wxch_upload_file($upload)
{
    $image = new cls_image();
    $res = $image->upload_image($upload);
    if ($res) {
        return $res;
    } else {
        return false;
    }
}
开发者ID:seanguo166,项目名称:microdistribution,代码行数:10,代码来源:wxch-ent.php

示例2: trim

 } else {
     $ad_link = !empty($_POST['ad_link2']) ? trim($_POST['ad_link2']) : '';
 }
 /* 获得广告的开始时期与结束日期 */
 $start_time = local_strtotime($_POST['start_time']);
 $end_time = local_strtotime($_POST['end_time']);
 /* 查看广告名称是否有重复 */
 $sql = "SELECT COUNT(*) FROM " . $ecs->table('ad') . " WHERE ad_name = '{$ad_name}'";
 if ($db->getOne($sql) > 0) {
     $link[] = array('text' => $_LANG['go_back'], 'href' => 'javascript:history.back(-1)');
     sys_msg($_LANG['ad_name_exist'], 0, $link);
 }
 /* 添加图片类型的广告 */
 if ($_POST['media_type'] == '0') {
     if (isset($_FILES['ad_img']['error']) && $_FILES['ad_img']['error'] == 0 || !isset($_FILES['ad_img']['error']) && isset($_FILES['ad_img']['tmp_name']) && $_FILES['ad_img']['tmp_name'] != 'none') {
         $ad_code = basename($image->upload_image($_FILES['ad_img'], 'afficheimg'));
     }
     if (!empty($_POST['img_url'])) {
         $ad_code = $_POST['img_url'];
     }
     if ((isset($_FILES['ad_img']['error']) && $_FILES['ad_img']['error'] > 0 || !isset($_FILES['ad_img']['error']) && isset($_FILES['ad_img']['tmp_name']) && $_FILES['ad_img']['tmp_name'] == 'none') && empty($_POST['img_url'])) {
         $link[] = array('text' => $_LANG['go_back'], 'href' => 'javascript:history.back(-1)');
         sys_msg($_LANG['js_languages']['ad_photo_empty'], 0, $link);
     }
 } elseif ($_POST['media_type'] == '1') {
     if (isset($_FILES['upfile_flash']['error']) && $_FILES['upfile_flash']['error'] == 0 || !isset($_FILES['upfile_flash']['error']) && isset($_FILES['ad_img']['tmp_name']) && $_FILES['upfile_flash']['tmp_name'] != 'none') {
         /* 检查文件类型 */
         if ($_FILES['upfile_flash']['type'] != "application/x-shockwave-flash") {
             $link[] = array('text' => $_LANG['go_back'], 'href' => 'javascript:history.back(-1)');
             sys_msg($_LANG['upfile_flash_type'], 0, $link);
         }
开发者ID:Ryan007,项目名称:mybb,代码行数:31,代码来源:ads.php

示例3: array

         if (!$image->check_img_type($_FILES['goods_img']['type'])) {
             sys_msg($_LANG['invalid_goods_img'], 1, array(), false);
         }
     }
 }
 $goods_img = '';
 // 初始化商品图片
 $goods_thumb = '';
 // 初始化商品缩略图
 $original_img = '';
 // 初始化原始图片
 $old_original_img = '';
 // 初始化原始图片旧图
 // 如果上传了商品图片,相应处理
 if ($_FILES['goods_img']['tmp_name'] != '' && $_FILES['goods_img']['tmp_name'] != 'none') {
     $original_img = $image->upload_image($_FILES['goods_img']);
     // 原始图片
     if ($original_img === false) {
         sys_msg($image->error_msg(), 1, array(), false);
     }
     $goods_img = $original_img;
     // 商品图片
     /* 复制一份相册图片 */
     $img = $original_img;
     // 相册图片
     $pos = strpos(basename($img), '.');
     $newname = dirname($img) . '/' . $image->random_filename() . substr(basename($img), $pos);
     if (!copy('../' . $img, '../' . $newname)) {
         sys_msg('fail to copy file: ' . realpath('../' . $img), 1, array(), false);
     }
     $img = $newname;
开发者ID:BGCX261,项目名称:zishashop-svn-to-git,代码行数:31,代码来源:index.php

示例4: array

    $smarty->assign('card', $card);
    $smarty->assign('ur_here', $_LANG['card_add']);
    $smarty->assign('action_link', array('text' => $_LANG['07_card_list'], 'href' => 'card.php?act=list'));
    $smarty->assign('form_action', 'insert');
    assign_query_info();
    $smarty->display('card_info.htm');
} elseif ($_REQUEST['act'] == 'insert') {
    /* 权限判断 */
    admin_priv('card_manage');
    /*检查包装名是否重复*/
    $is_only = $exc->is_only('card_name', $_POST['card_name']);
    if (!$is_only) {
        sys_msg(sprintf($_LANG['cardname_exist'], stripslashes($_POST['card_name'])), 1);
    }
    /*处理图片*/
    $img_name = basename($image->upload_image($_FILES['card_img'], "cardimg"));
    /*插入数据*/
    $sql = "INSERT INTO " . $ecs->table('card') . "(card_name, card_fee, free_money, card_desc, card_img)\r\n            VALUES ('{$_POST['card_name']}', '{$_POST['card_fee']}', '{$_POST['free_money']}', '{$_POST['card_desc']}', '{$img_name}')";
    $db->query($sql);
    admin_log($_POST['card_name'], 'add', 'card');
    /*添加链接*/
    $link[0]['text'] = $_LANG['continue_add'];
    $link[0]['href'] = 'card.php?act=add';
    $link[1]['text'] = $_LANG['back_list'];
    $link[1]['href'] = 'card.php?act=list';
    sys_msg($_POST['card_name'] . $_LANG['cardadd_succeed'], 0, $link);
} elseif ($_REQUEST['act'] == 'edit') {
    /* 权限判断 */
    admin_priv('card_manage');
    $sql = "SELECT card_id, card_name, card_fee, free_money, card_desc, card_img FROM " . $ecs->table('card') . " WHERE card_id='{$_REQUEST['id']}'";
    $card = $db->GetRow($sql);
开发者ID:duynhan07,项目名称:ecshop-vietnam,代码行数:31,代码来源:card.php

示例5: array

 $status = $_POST['status'];
 $users =& init_users();
 if (!$users->edit_user(array('username' => $username, 'password' => $password, 'email' => $email, 'gender' => $sex, 'bday' => $birthday), 1)) {
     if ($users->error == ERR_EMAIL_EXISTS) {
         $msg = $_LANG['email_exists'];
     } else {
         $msg = $_LANG['edit_user_failed'];
     }
     sys_msg($msg, 1);
 }
 if (!empty($password)) {
     $sql = "UPDATE " . $ecs->table('users') . "SET `ec_salt`='0' WHERE user_name= '" . $username . "'";
     $db->query($sql);
 }
 if (isset($_FILES['face_card']) && $_FILES['face_card']['tmp_name'] != '') {
     $face_card = $image->upload_image($_FILES['face_card']);
     if ($face_card === false) {
         sys_msg($image->error_msg(), 1, array(), false);
     }
 }
 if (isset($_FILES['back_card']) && $_FILES['back_card']['tmp_name'] != '') {
     $back_card = $image->upload_image($_FILES['back_card']);
     if ($back_card === false) {
         sys_msg($image->error_msg(), 1, array(), false);
     }
 }
 $sql = "update " . $ecs->table('users') . " set `real_name`='{$real_name}',`card`='{$card}',`country`='{$country}',`province`='{$province}',`city`='{$city}',`district`='{$district}',`address`='{$address}',`status`='{$status}' where user_name = '" . $username . "'";
 $db->query($sql);
 if ($face_card != '') {
     $sql = "update " . $ecs->table('users') . " set `face_card` = '{$face_card}' where user_name = '" . $username . "'";
     $db->query($sql);
开发者ID:moonlight-wang,项目名称:feilun,代码行数:31,代码来源:distributor.php

示例6: intval

 $cat['cat_id'] = !empty($_POST['cat_id']) ? intval($_POST['cat_id']) : 0;
 $cat['parent_id'] = !empty($_POST['parent_id']) ? intval($_POST['parent_id']) : 0;
 $cat['sort_order'] = !empty($_POST['sort_order']) ? intval($_POST['sort_order']) : 0;
 $cat['keywords'] = !empty($_POST['keywords']) ? trim($_POST['keywords']) : '';
 $cat['cat_desc'] = !empty($_POST['cat_desc']) ? $_POST['cat_desc'] : '';
 $cat['measure_unit'] = !empty($_POST['measure_unit']) ? trim($_POST['measure_unit']) : '';
 $cat['cat_name'] = !empty($_POST['cat_name']) ? trim($_POST['cat_name']) : '';
 $cat['show_in_nav'] = !empty($_POST['show_in_nav']) ? intval($_POST['show_in_nav']) : 0;
 $cat['style'] = !empty($_POST['style']) ? trim($_POST['style']) : '';
 $cat['style_moban'] = !empty($_POST['style_moban']) ? trim($_POST['style_moban']) : '';
 $cat['is_show'] = !empty($_POST['is_show']) ? intval($_POST['is_show']) : 0;
 $cat['grade'] = !empty($_POST['grade']) ? intval($_POST['grade']) : 0;
 $cat['filter_attr'] = !empty($_POST['filter_attr']) ? implode(',', array_unique(array_diff($_POST['filter_attr'], array(0)))) : 0;
 $cat['cat_recommend'] = !empty($_POST['cat_recommend']) ? $_POST['cat_recommend'] : array();
 if (isset($_FILES['cat_img']) && $_FILES['cat_img']['tmp_name'] != '') {
     $cat['cat_img'] = $image->upload_image($_FILES['cat_img']);
 }
 if (cat_exists($cat['cat_name'], $cat['parent_id'])) {
     /* 同级别下不能有重复的分类名称 */
     $link[] = array('text' => $_LANG['go_back'], 'href' => 'javascript:history.back(-1)');
     sys_msg($_LANG['catname_exist'], 0, $link);
 }
 if ($cat['grade'] > 10 || $cat['grade'] < 0) {
     /* 价格区间数超过范围 */
     $link[] = array('text' => $_LANG['go_back'], 'href' => 'javascript:history.back(-1)');
     sys_msg($_LANG['grade_error'], 0, $link);
 }
 /* 入库的操作 */
 if ($db->autoExecute($hhs->table('category'), $cat) !== false) {
     $cat_id = $db->insert_id();
     insert_cat_recommend($cat['cat_recommend'], $cat_id);
开发者ID:shiruolin,项目名称:hzzshop,代码行数:31,代码来源:category.php

示例7: elseif

     }
     if ($row['goods_img'] != '' && is_file('../' . $row['goods_img'])) {
         @unlink('../' . $row['goods_img']);
     }
     if ($row['original_img'] != '' && is_file('../' . $row['original_img'])) {
         /* 先不处理,以防止程序中途出错停止 */
         //$old_original_img = $row['original_img']; //记录旧图路径
     }
     /* 清除原来商品图片 */
     if ($proc_thumb === false) {
         get_image_path($_REQUEST[goods_id], $row['goods_img'], false, 'goods', true);
         get_image_path($_REQUEST[goods_id], $row['goods_thumb'], true, 'goods', true);
     }
 }
 if (empty($is_url_goods_img)) {
     $original_img = $image->upload_image($_FILES['goods_img']);
     // 原始图片
 } elseif (copy(trim($_POST['goods_img_url']), ROOT_PATH . 'temp/' . basename($_POST['goods_img_url']))) {
     $original_img = 'temp/' . basename($_POST['goods_img_url']);
 }
 if ($original_img === false) {
     sys_msg($image->error_msg(), 1, array(), false);
 }
 $goods_img = $original_img;
 // 商品图片
 /* 复制一份相册图片 */
 /* 添加判断是否自动生成相册图片 */
 if ($_CFG['auto_generate_gallery']) {
     $img = $original_img;
     // 相册图片
     $pos = strpos(basename($img), '.');
开发者ID:jinjiang2009,项目名称:exiao_online,代码行数:31,代码来源:goods.php

示例8: elseif

    } else {
        sys_msg('删除菜单失败!', 0, $link);
    }
} elseif ($_REQUEST['act'] == 'add') {
    $smarty->assign('from_act', 'add_menu');
    $smarty->assign('action_link', array('text' => '菜单列表', 'href' => 'menu.php?act=list'));
    $smarty->display('menu_info.htm');
} elseif ($_REQUEST['act'] == 'add_menu') {
    include_once ROOT_PATH . '/includes/cls_image.php';
    $image = new cls_image($_CFG['bgcolor']);
    $menu_name = $_REQUEST['menu_name'];
    $menu_url = $_REQUEST['menu_url'];
    $sort = $_REQUEST['sort'];
    if (isset($_FILES['menu_img']) && $_FILES['menu_img']['tmp_name'] != '' && isset($_FILES['menu_img']['tmp_name']) && $_FILES['menu_img']['tmp_name'] != 'none') {
        // 上传了,直接使用,原始大小
        $menu_img = $image->upload_image($_FILES['menu_img']);
        if ($menu_img === false) {
            show_message($image->error_msg());
        }
    }
    if ($menu_img == '') {
        sys_msg('菜单图片不能为空!', 0, $link);
    }
    $sql = "insert into " . $GLOBALS['ecs']->table('ecsmart_menu') . "(`menu_name`,`menu_img`,`menu_url`,`sort`) values('{$menu_name}','{$menu_img}','{$menu_url}','{$sort}')";
    $num = $GLOBALS['db']->query($sql);
    if ($num > 0) {
        sys_msg('添加菜单成功!', 0, $link);
    } else {
        sys_msg('添加菜单失败!', 0, $link);
    }
}
开发者ID:seanguo166,项目名称:yinoos,代码行数:31,代码来源:menu.php

示例9: end

         if (!$image->check_img_type($_FILES['avatar']['type'])) {
             show_message("图片格式不正确!");
         }
     }
 }
 //会员头像 by neo
 if (!empty($_FILES['avatar']['name'])) {
     /* 更新会员头像之前先删除旧的头像 */
     $sql = "SELECT avatar " . " FROM " . $GLOBALS['ecs']->table('users') . " WHERE user_id = '{$user_id}'";
     $row = $GLOBALS['db']->getRow($sql);
     if ($row['avatar'] != '') {
         @unlink($row['avatar']);
     }
     $img_name = $user_id . '.' . end(explode('.', $_FILES['avatar']['name']));
     $target = ROOT_PATH . DATA_DIR . '/avatar/';
     $original_img = $image->upload_image($_FILES['avatar'], 'avatar', $img_name);
     // 原始图片
     $avatar = $image->make_thumb($original_img, 55, 55, $target);
     if ($avatar === false) {
         show_message("图片保存出错!");
     }
 }
 $profile = array('user_id' => $user_id, 'email' => isset($_POST['email']) ? trim($_POST['email']) : '', 'sex' => isset($_POST['sex']) ? intval($_POST['sex']) : 0, 'birthday' => $birthday, 'avatar' => $avatar, 'other' => isset($other) ? $other : array());
 if (edit_profile($profile)) {
     show_message($_LANG['edit_profile_success'], $_LANG['profile_lnk'], 'user.php?act=profile', 'info');
 } else {
     if ($user->error == ERR_EMAIL_EXISTS) {
         $msg = sprintf($_LANG['email_exist'], $profile['email']);
     } else {
         $msg = $_LANG['edit_profile_failed'];
     }
开发者ID:naliduo,项目名称:ecshop,代码行数:31,代码来源:user.php

示例10: elseif

            if ($row['original_img'] != '' && is_file('../' . $row['original_img']))
            {
                /* 先不处理,以防止程序中途出错停止 */
                //$old_original_img = $row['original_img']; //记录旧图路径
            }
            /* 清除原来商品图片 */
            if ($proc_thumb === false)
            {
                get_image_path($_REQUEST[goods_id], $row['goods_img'], false, 'goods', true);
                get_image_path($_REQUEST[goods_id], $row['goods_thumb'], true, 'goods', true);
            }
        }

        if (empty($is_url_goods_img))
        {
            $original_img   = $image->upload_image($_FILES['goods_img']); // 原始图片
        }
        elseif ($_POST['goods_img_url'])
        {
            
            if(preg_match('/(.jpg|.png|.gif|.jpeg)$/',$_POST['goods_img_url']) && copy(trim($_POST['goods_img_url']), ROOT_PATH . 'temp/' . basename($_POST['goods_img_url'])))
            {
                  $original_img = 'temp/' . basename($_POST['goods_img_url']);
            }
            
        }

        if ($original_img === false)
        {
            sys_msg($image->error_msg(), 1, array(), false);
        }
开发者ID:blowfishJ,项目名称:galaxyCode,代码行数:31,代码来源:goods.php

示例11: strpos

         $img = $original_img;
         // 相册图片
         $pos = strpos(basename($img), '.');
         $newname = dirname($img) . '/' . $image->random_filename() . substr(basename($img), $pos);
         if (!copy('../' . $img, '../' . $newname)) {
             sys_msg('fail to copy file: ' . realpath('../' . $img), 1, array(), false);
         }
         $img = $newname;
         $gallery_img = $img;
         $gallery_thumb = $img;
     }
 }
 // 是否上传商品缩略图
 if (isset($_FILES['goods_thumb']) && $_FILES['goods_thumb']['tmp_name'] != '' && isset($_FILES['goods_thumb']['tmp_name']) && $_FILES['goods_thumb']['tmp_name'] != 'none') {
     // 上传了,直接使用,原始大小
     $goods_thumb = $image->upload_image($_FILES['goods_thumb']);
     if ($goods_thumb === false) {
         sys_msg($image->error_msg(), 1, array(), false);
     }
 } else {
     // 未上传,如果自动选择生成,且上传了商品图片,生成所略图
     if ($proc_thumb && isset($_POST['auto_thumb']) && !empty($original_img)) {
         // 如果设置缩略图大小不为0,生成缩略图
         if ($_CFG['thumb_width'] != 0 || $_CFG['thumb_height'] != 0) {
             $goods_thumb = $image->make_thumb('../' . $original_img, $GLOBALS['_CFG']['thumb_width'], $GLOBALS['_CFG']['thumb_height']);
             if ($goods_thumb === false) {
                 sys_msg($image->error_msg(), 1, array(), false);
             }
         } else {
             $goods_thumb = $original_img;
         }
开发者ID:dlpc,项目名称:ecshop,代码行数:31,代码来源:goods_supplier.php

示例12: array

    $smarty->assign('cat_info', array('is_show' => 1));
    /* 显示页面 */
    $smarty->display('category_flashimg_info.htm');
}
/*------------------------------------------------------ */
//-- 商品分类轮播图片添加时的处理
/*------------------------------------------------------ */
if ($_REQUEST['act'] == 'insert') {
    /* 权限检查 */
    admin_priv('cat_manage');
    /* 初始化变量 */
    $flashimg['cat_id'] = !empty($_POST['cat_id']) ? intval($_POST['cat_id']) : 0;
    $flashimg['sort_order'] = !empty($_POST['sort_order']) ? intval($_POST['sort_order']) : 0;
    $flashimg['href_url'] = !empty($_POST['href_url']) ? trim($_POST['href_url']) : '';
    /*处理图片*/
    $flashimg['img_url'] = basename($image->upload_image($_FILES['img_url'], 'catflashimg'));
    /*处理URL*/
    $flashimg['href_url'] = sanitize_url($flashimg['href_url']);
    $flashimg['img_title'] = !empty($_POST['img_title']) ? trim($_POST['img_title']) : '';
    $flashimg['img_desc'] = !empty($_POST['img_desc']) ? trim($_POST['img_desc']) : '';
    /* 入库的操作 */
    if ($db->autoExecute($ecs->table('cat_flashimg'), $flashimg) !== false) {
        clear_cache_files();
        // 清除缓存
        /*添加链接*/
        $link[0]['text'] = "继续添加";
        $link[0]['href'] = 'category_flashimg.php?act=add&cat_id=' . $cat_id;
        $link[1]['text'] = "返回轮播图片列表";
        $link[1]['href'] = 'category_flashimg.php?act=list&cat_id=' . $cat_id;
        sys_msg("添加成功", 0, $link);
    }
开发者ID:firsteam,项目名称:falcons,代码行数:31,代码来源:category_flashimg.php

示例13: isset

 $link = 'pay.php?act=edit_show_bank&id=' . $id;
 if (!$id) {
     sys_msg('参数错误', 1);
 }
 if (!empty($_POST)) {
     $image = new cls_image($_CFG['bgcolor']);
     //实例化图片处理函数
     $bank_name = isset($_POST['bank_name']) ? $_POST['bank_name'] : '';
     $bank_code = isset($_POST['bank_code']) ? $_POST['bank_code'] : '';
     $bank_image = isset($_FILES['bank_image']) ? $_FILES['bank_image'] : '';
     $payment = isset($_POST['payment']) ? $_POST['payment'] : '';
     $status = isset($_POST['status']) ? $_POST['status'] : '0';
     $bank_img_name = '';
     if (isset($bank_image['error']) && $bank_image['error'] == 0) {
         if ($image->check_img_type($bank_image['type'])) {
             $bank_img_name = $image->upload_image($bank_image, '');
         }
         if (!$bank_img_name) {
             sys_msg('上传图片失败', 1);
         }
     }
     if ($bank_img_name) {
         $bank_img = ',bank_img = "' . $bank_img_name . '"';
     }
     $res = $db->query("update " . $ecs->table('show_bank') . " set bank_name = '{$bank_name}', bank_code = '{$bank_code}',state='{$status}',payment='{$payment}' {$bank_img} where id = {$id}");
     if ($res) {
         sys_msg('修改成功', 0, array(array('href' => 'pay.php?act=show_bank', 'text' => '返回')));
     } else {
         sys_msg('修改失败', 1, array(array('href' => $link, 'text' => '返回')));
     }
 } else {
开发者ID:dlpc,项目名称:ecshop,代码行数:31,代码来源:pay.php

示例14: array

    $smarty->assign('brand', array('sort_order' => 50, 'is_show' => 1));
    $smarty->display('brand_info.htm');
} elseif ($_REQUEST['act'] == 'insert') {
    /*检查品牌名是否重复*/
    admin_priv('brand_manage');
    $is_show = isset($_REQUEST['is_show']) ? intval($_REQUEST['is_show']) : 0;
    $is_only = $exc->is_only('brand_name', $_POST['brand_name']);
    if (!$is_only) {
        sys_msg(sprintf($_LANG['brandname_exist'], stripslashes($_POST['brand_name'])), 1);
    }
    /*对描述处理*/
    if (!empty($_POST['brand_desc'])) {
        $_POST['brand_desc'] = $_POST['brand_desc'];
    }
    /*处理图片*/
    $img_name = basename($image->upload_image($_FILES['brand_logo'], 'brandlogo'));
    /*处理图片*/
    $brand_img = basename($image->upload_image($_FILES['brand_img'], 'brandimg'));
    /*处理URL*/
    $site_url = sanitize_url($_POST['site_url']);
    /*插入数据*/
    $sql = "INSERT INTO " . $ecs->table('brand') . "(brand_name, site_url, wap_brand_desc, brand_logo, brand_img,is_show, sort_order) " . "VALUES ('{$_POST['brand_name']}', '{$site_url}', '{$_POST['brand_desc']}', '{$img_name}','{$brand_img}', '{$is_show}', '{$_POST['sort_order']}')";
    $db->query($sql);
    admin_log($_POST['brand_name'], 'add', 'brand');
    /* 清除缓存 */
    clear_cache_files();
    $link[0]['text'] = $_LANG['continue_add'];
    $link[0]['href'] = 'brand.php?act=add';
    $link[1]['text'] = $_LANG['back_list'];
    $link[1]['href'] = 'brand.php?act=list';
    sys_msg($_LANG['brandadd_succed'], 0, $link);
开发者ID:seanguo166,项目名称:yinoos,代码行数:31,代码来源:brand.php

示例15: intval

 $cat['is_show'] = !empty($_POST['is_show']) ? intval($_POST['is_show']) : 0;
 $cat['grade'] = !empty($_POST['grade']) ? intval($_POST['grade']) : 0;
 $cat['filter_attr'] = !empty($_POST['filter_attr']) ? implode(',', array_unique(array_diff($_POST['filter_attr'], array(0)))) : 0;
 $cat['cat_recommend'] = !empty($_POST['cat_recommend']) ? $_POST['cat_recommend'] : array();
 if (cat_exists($cat['cat_name'], $cat['parent_id'])) {
     /* 同级别下不能有重复的分类名称 */
     $link[] = array('text' => $_LANG['go_back'], 'href' => 'javascript:history.back(-1)');
     sys_msg($_LANG['catname_exist'], 0, $link);
 }
 if ($cat['grade'] > 10 || $cat['grade'] < 0) {
     /* 价格区间数超过范围 */
     $link[] = array('text' => $_LANG['go_back'], 'href' => 'javascript:history.back(-1)');
     sys_msg($_LANG['grade_error'], 0, $link);
 }
 /* 处理图片 */
 $img_name = basename($image->upload_image($_FILES['cat_ico'], 'cat_ico'));
 $cat['cat_ico'] = empty($img_name) ? '' : $img_name;
 /* 入库的操作 */
 if ($db->autoExecute($ecs->table('category'), $cat) !== false) {
     $cat_id = $db->insert_id();
     if ($cat['show_in_nav'] == 1) {
         $vieworder = $db->getOne("SELECT max(vieworder) FROM " . $ecs->table('touch_nav') . " WHERE type = 'middle'");
         $vieworder += 2;
         //显示在自定义导航栏中
         $sql = "INSERT INTO " . $ecs->table('touch_nav') . " (name,ctype,cid,ifshow,vieworder,opennew,url,type)" . " VALUES('" . $cat['cat_name'] . "', 'c', '" . $db->insert_id() . "','1','{$vieworder}','0', '" . build_uri('category', array('cid' => $cat_id), $cat['cat_name']) . "','middle')";
         $db->query($sql);
     }
     insert_cat_recommend($cat['cat_recommend'], $cat_id);
     admin_log($_POST['cat_name'], 'add', 'category');
     // 记录管理员操作
     clear_cache_files();
开发者ID:will0306,项目名称:bianli100,代码行数:31,代码来源:category.php


注:本文中的cls_image::upload_image方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。