Beispiel #1
0
 public function doWebPost()
 {
     global $_GPC, $_W;
     $id = intval($_GPC['id']);
     if (!empty($id)) {
         $item = pdo_fetch("SELECT * FROM " . tablename($this->headtable) . " WHERE id = :id", array(':id' => $id));
         if (empty($item)) {
             message('抱歉,楼盘不存在或是已经删除!', '', 'error');
         }
     }
     if (checksubmit('submit')) {
         if (empty($_GPC['title'])) {
             message('请输入商户名称!');
         }
         $data = array('weid' => $_W['weid'], 'title' => $_GPC['title'], 'buildingintro' => htmlspecialchars_decode($_GPC['buildingintro']), 'traffic' => $_GPC['traffic'], 'projectintro' => $_GPC['projectintro'], 'phone' => $_GPC['phone'], 'province' => $_GPC['resideprovince'], 'city' => $_GPC['residecity'], 'dist' => $_GPC['residedist'], 'address' => $_GPC['address'], 'lng' => $_GPC['lng'], 'lat' => $_GPC['lat'], 'createtime' => TIMESTAMP);
         if (!empty($_FILES['thumb']['tmp_name'])) {
             file_delete($_GPC['thumb_old']);
             $upload = file_upload($_FILES['thumb']);
             if (is_error($upload)) {
                 message($upload['message'], '', 'error');
             }
             $data['thumb'] = $upload['path'];
         }
         if (empty($id)) {
             pdo_insert($this->headtable, $data);
         } else {
             unset($data['createtime']);
             pdo_update($this->headtable, $data, array('id' => $id));
         }
         message('商户信息更新成功!', create_url('site/module/display', array('name' => 'lxybuilding')), 'success');
     }
     include $this->template('post');
 }
Beispiel #2
0
 public function doWebAddshop()
 {
     global $_GPC, $_W;
     $rid = intval($_GPC['rid']);
     $id = intval($_GPC['id']);
     if (!empty($id)) {
         $item = pdo_fetch("SELECT * FROM " . tablename('hotel_shop') . " WHERE id = :id", array(':id' => $id));
         if (empty($item)) {
             message('抱歉,房型不存在或是已经删除!', '', 'error');
         }
     }
     if (checksubmit('submit')) {
         if (empty($_GPC['style'])) {
             message('请输入房型!');
         }
         $data = array('weid' => $_W['weid'], 'rid' => $rid, 'style' => $_GPC['style'], 'oprice' => $_GPC['oprice'], 'cprice' => $_GPC['cprice'], 'thumb' => $_GPC['thumb'], 'device' => htmlspecialchars_decode($_GPC['device']));
         if (!empty($_FILES['thumb']['tmp_name'])) {
             file_delete($_GPC['thumb_old']);
             $upload = file_upload($_FILES['thumb']);
             if (is_error($upload)) {
                 message($upload['message'], '', 'error');
             }
             $data['thumb'] = $upload['path'];
         }
         if (empty($id)) {
             pdo_insert('hotel_shop', $data);
         } else {
             pdo_update('hotel_shop', $data, array('id' => $id));
         }
         message('房型信息更新成功!', $this->createWebUrl('shop', array('id' => $_GPC['rid'])), 'success');
     }
     include $this->template('addshop');
 }
Beispiel #3
0
 public function fieldsFormSubmit($rid = 0)
 {
     global $_GPC, $_W;
     $id = intval($_GPC['reply_id']);
     $credit = intval($_GPC['credit']);
     $insert = array('rid' => $rid, 'start_time' => strtotime($_GPC['start_time']), 'end_time' => strtotime($_GPC['end_time']), 'awardrules' => $_GPC['awardrules'], 'awardinfo' => $_GPC['awardinfo'], 'days' => $_GPC['days'], 'credit' => $credit);
     if (!empty($_FILES['thumb']['tmp_name'])) {
         file_delete($_GPC['thumb_old']);
         $upload = file_upload($_FILES['thumb']);
         if (is_error($upload)) {
             message($upload['message'], '', 'error');
         }
         $insert['thumb'] = $upload['path'];
     } else {
         $tmp_file = array(name => "registration_top.jpg", tmp_name => "{$_SERVER['DOCUMENT_ROOT']}/source/modules/cgtsignin/template/style/images/registration_top.jpg");
         $upload = file_upload($tmp_file);
         if (is_error($upload)) {
             message($upload['message'], '', 'error');
         }
         $insert['thumb'] = $upload['path'];
     }
     if (empty($id)) {
         pdo_insert($this->tablename, $insert);
     } else {
         pdo_update($this->tablename, $insert, array('id' => $id));
     }
 }
 public function update_confirm($id)
 {
     $this->Video_model->update_video($id);
     $data = $this->Video_model->get_record_by_id($id);
     if (isset($_FILES["videoInput"])) {
         unlink('./uploads/' . $data[0]['file_name']);
         $status = file_upload();
         if ($status[0] == 0) {
             $responsePattern = $this->Video_model->update_video_attachement($id, $status[1][0], $status[1][1], $status[1][2]);
             if ($responsePattern[0] == '0') {
                 echo json_encode(array('0', "更新成功"));
                 $this->Video_model->update_video($id);
                 $data = $this->Video_model->get_record_by_id($id);
             } else {
                 echo json_encode(array('1', $responsePattern[1]));
                 return;
             }
         } else {
             echo json_encode(array('1', $responsePattern[1]));
             return;
         }
     } else {
         echo json_encode(array('0', "更新成功"));
         $this->Video_model->update_video($id);
         $data = $this->Video_model->get_record_by_id($id);
     }
 }
Beispiel #5
0
function user_update()
{
    $user = new User();
    if ($val = get('firstname')) {
        $user->firstname = $val;
    }
    if ($val = get('lastname')) {
        $user->lastname = $val;
    }
    if ($val = get('pseudonym')) {
        $user->username = $val;
    }
    if ($val = get('age')) {
        $user->age = $val;
    }
    if ($val = get('gender')) {
        $user->gender = $val;
    }
    if ($val = get('location_id')) {
        $user->location = new Location($val);
    }
    $files = file_upload($_FILES);
    if (!empty($files)) {
        $user->picture = $files[0];
    }
    $email = get('email');
    $p = get('password');
    $cp = get('cpassword');
    if ($email && $p && $cp && $p == $cp) {
        $user->email = $email;
        $user->password = md5($email . $password);
    }
    $user->save();
    redirect('/user/');
}
 public function edit($id, $request)
 {
     $fill_array = ['title' => $request->title, 'permalink' => $request->permalink, 'body' => $request->body, 'is_published' => $request->is_published];
     if ($uploaded_file = file_upload('featured_image', static::$image_upload_directory, static::$image_allowed_extension)) {
         $fill_array['featured_image'] = $uploaded_file;
     }
     return $this->update($fill_array, $id);
 }
 public function edit($id, $request)
 {
     $fill_array = ['first_name' => $request->first_name, 'last_name' => $request->last_name, 'location' => $request->location, 'arabic_full_name' => $request->arabic_full_name, 'profession' => $request->profession, 'profession_location' => $request->profession_location, 'phone_number' => $request->phone_number, 'gender' => $request->gender, 'profession' => $request->profession, 'bio' => $request->bio];
     if ($uploaded_file = file_upload('image', static::$image_upload_directory, static::$image_allowed_extension)) {
         $fill_array['image'] = $uploaded_file;
     }
     return $this->update($fill_array, $id);
 }
 public function edit($id, $request)
 {
     $fill_array = ['title' => $request->title, 'body' => $request->body, 'permalink' => $request->permalink, 'is_registration_open' => $request->is_registration_open, 'max_registrars_count' => $request->max_registrars_count, 'location' => $request->location, 'date' => $request->date, 'require_additional_fields' => $request->max_registrars_count, 'is_published' => $request->is_published, 'survey_id' => $request->survey_id, 'type' => $request->type];
     if ($uploaded_file = file_upload('featured_image', static::$image_upload_directory, static::$image_allowed_extension)) {
         $fill_array['featured_image'] = $uploaded_file;
     }
     return $this->update($fill_array, $id);
 }
Beispiel #9
0
function upload($about, $exts, $critical = 0, $dir = "", $neoname = "")
{
    $options = new FileUploadOptions();
    $options->key = $about;
    $options->extensions = $exts;
    $options->is_critical = (bool) $critical;
    $options->dir = $dir;
    $options->neoname = $neoname;
    return file_upload($options);
}
Beispiel #10
0
 public function fieldsFormSubmit($rid = 0)
 {
     global $_GPC, $_W;
     $id = intval($_GPC['reply_id']);
     $insert = array('rid' => $rid, 'weid' => $_W['weid'], 'title' => $_GPC['title'], 'description' => $_GPC['description'], 'votetype' => $_GPC['votetype'], 'votelimit' => $_GPC['votelimit'], 'votetimes' => $_GPC['votetimes'], 'votetotal' => $_GPC['votetotal'], 'isimg' => $_GPC['isimg'], 'share_title' => $_GPC['share_title'], 'share_desc' => $_GPC['share_desc'], 'share_url' => $_GPC['share_url'], 'share_txt' => $_GPC['share_txt'], 'starttime' => strtotime($_GPC['datelimit-start']), 'endtime' => strtotime($_GPC['datelimit-end']));
     if (!empty($_GPC['thumb'])) {
         $insert['thumb'] = $_GPC['thumb'];
         file_delete($_GPC['thumb-old']);
     }
     if (empty($id)) {
         if ($insert['starttime'] <= time()) {
             $insert['isshow'] = 1;
         } else {
             $insert['isshow'] = 0;
         }
         $id = pdo_insert($this->tablename, $insert);
     } else {
         pdo_update($this->tablename, $insert, array('id' => $id));
     }
     $options = array();
     $option_ids = $_POST['option_id'];
     $option_titles = $_POST['option_title'];
     $option_thumb_olds = $_POST['option_thumb_old'];
     $files = $_FILES;
     $len = count($option_ids);
     $ids = array();
     for ($i = 0; $i < $len; $i++) {
         $item_id = $option_ids[$i];
         $a = array("title" => $option_titles[$i], "rid" => $rid);
         $f = 'option_thumb_' . $item_id;
         $old = $_GPC['option_thumb_' . $item_id];
         if (!empty($files[$f]['tmp_name'])) {
             $upload = file_upload($files[$f]);
             if (is_error($upload)) {
                 message($upload['message'], '', 'error');
             }
             $a['thumb'] = $upload['path'];
         } else {
             if (!empty($old)) {
                 $a['thumb'] = $old;
             }
         }
         if ((int) $item_id == 0) {
             pdo_insert("vote_option", $a);
             $item_id = pdo_insertid();
         } else {
             pdo_update("vote_option", $a, array('id' => $item_id));
         }
         $ids[] = $item_id;
     }
     if (!empty($ids)) {
         pdo_query("delete from " . tablename('vote_option') . " where id not in ( " . implode(',', $ids) . ") and rid = " . $rid);
     }
     return true;
 }
 /**
  * 处理上传文件
  * @return unknown_type
  */
 function proc_upfiles()
 {
     import_func('file');
     if (!empty($_FILES)) {
         foreach ($_FILES as $k => $f) {
             if (!empty($_FILES[$k]['type'])) {
                 $_POST[$k] = file_upload($k);
             }
         }
     }
 }
Beispiel #12
0
/**
 * [WDL] Copyright (c) 2013 B2CTUI.COM
 * $sn: origins/source/model/fans.mod.php : v 866195d935cc : 2014/05/16 09:42:08 : veryinf $
 */
function fans_update($user, $fields)
{
    global $_W;
    $_W['weid'] && ($fields['weid'] = $_W['weid']);
    $struct = cache_load('fansfields');
    if (empty($fields)) {
        return false;
    }
    if (empty($struct)) {
        $struct = cache_build_fans_struct();
    }
    foreach ($fields as $field => $value) {
        if (!in_array($field, $struct)) {
            unset($fields[$field]);
        }
    }
    if (empty($fields['avatar']) && !empty($_FILES['avatar']['tmp_name'])) {
        $_W['uploadsetting'] = array();
        $_W['uploadsetting']['avatar']['folder'] = 'avatar';
        $_W['uploadsetting']['avatar']['extentions'] = $_W['config']['upload']['image']['extentions'];
        $_W['uploadsetting']['avatar']['limit'] = $_W['config']['upload']['image']['limit'];
        $upload = file_upload($_FILES['avatar'], 'avatar', $user);
        if (is_error($upload)) {
            message($upload['message']);
        }
        $fields['avatar'] = $upload['path'];
    } elseif (!empty($fields['avatar'])) {
        $pathinfo = pathinfo($fields['avatar']);
        $fields['avatar'] = $pathinfo['basename'];
    }
    $isexists = pdo_fetchcolumn("SELECT id FROM " . tablename('fans') . " WHERE from_user = :user", array(':user' => $user));
    if (empty($isexists)) {
        $fields['from_user'] = $user;
        $fields['createtime'] = TIMESTAMP;
        foreach ($struct as $field) {
            if ($field != 'id' && $field != 'follow' && !isset($fields[$field])) {
                $fields[$field] = '';
            }
        }
        if (empty($fields['salt'])) {
            $fields['salt'] = random(8);
        }
        return pdo_insert('fans', $fields);
    } else {
        unset($fields['from_user']);
        return pdo_update('fans', $fields, array('from_user' => $user));
    }
}
Beispiel #13
0
 public function doWebDisplay()
 {
     global $_GPC, $_W;
     $op = !empty($_GPC['op']) ? $_GPC['op'] : 'display';
     $id = intval($_GPC['id']);
     if ($op == 'post') {
         if (!empty($id)) {
             $sql = "select * from" . tablename('chax') . "where weid='{$_W['weid']}' and id=" . $id;
             $item = pdo_fetch($sql);
         }
         $data = array('weid' => $_W['weid'], 'title' => $_GPC['title'], 'url' => $_GPC['url'], 'displayorder' => intval($_GPC['displayorder']), 'status' => intval($_GPC['status']));
         if ($_W['ispost']) {
             if (!empty($_FILES['fileicon']['tmp_name'])) {
                 file_delete($_GPC['topPicture-old']);
                 $upload = file_upload($_FILES['fileicon']);
                 if (is_error($upload)) {
                     message($upload['message'], '', 'error');
                 }
                 $data['fileicon'] = $upload['path'];
             }
             if (empty($id)) {
                 pdo_insert('chax', $data);
             } else {
                 pdo_update('chax', $data, array('id' => $id));
             }
             message('更新成功', referer(), 'success');
         }
     } elseif ($op == 'display') {
         $sql = "select * from " . tablename('chax') . "where weid='{$_W['weid']}'";
         $row = pdo_fetchall($sql);
     } elseif ($op == 'delete') {
         pdo_delete('chax', array('id' => $id, 'weid' => $_W['weid']));
         message('删除成功', referer(), 'success');
     } elseif ($op == 'edit') {
         $status = intval($_GPC['status']);
         if ($status == 1) {
             $sql = "update" . tablename('chax') . " set status = 0 where weid= '{$_W['weid']}' and id=" . $id;
             pdo_query($sql);
         } else {
             $sql = "update" . tablename('chax') . " set status = 1 where weid= '{$_W['weid']}' and id=" . $id;
             pdo_query($sql);
         }
         message('更新成功', referer(), 'success');
     }
     include $this->template('display');
 }
Beispiel #14
0
 private function fileUpload($file, $type)
 {
     global $_W;
     set_time_limit(0);
     $_W['uploadsetting'] = array();
     $_W['uploadsetting']['music']['folder'] = 'music/' . $_W['weid'];
     $_W['uploadsetting']['music']['extentions'] = array('mp3', 'wma', 'wav', 'amr');
     $_W['uploadsetting']['music']['limit'] = 50000;
     $result = array();
     $upload = file_upload($file, 'music');
     if (is_error($upload)) {
         message($upload['message'], '', 'ajax');
     }
     $result['url'] = $_W['config']['upload']['attachdir'] . $upload['path'];
     $result['error'] = 0;
     $result['filename'] = $upload['path'];
     return $result;
 }
Beispiel #15
0
 function uploadFile($file = null)
 {
     global $is_API;
     if (is_null($file)) {
         $file = $_FILES;
     }
     $result = array('result' => 0, 'link' => '');
     if ($file['file']['name']) {
         $upfile = file_upload($file['file']['tmp_name'], "board_" . $_POST['id'] . "_" . $file['file']['name'], ".." . UPLOAD_PATH . "/" . date("Y") . "/" . date("m") . "/", 1);
         if ($upfile) {
             $result['result'] = 1;
             $result['link'] = UPLOAD_PATH . "/" . date("Y") . "/" . date("m") . "/" . $upfile;
         }
         //thumbnail($path."/".$upfile, $path."/thumb_".$upfile, 120, 100, 1);
     }
     if ($is_API) {
         echo json_encode($result);
     } else {
         return $upfile;
     }
 }
Beispiel #16
0
/**
 * File saver
 *
 * @param array $attr
 * @param array $item
 *
 * @return bool
 */
function saver_file(array $attr, array &$item) : bool
{
    $item[$attr['id']] = null;
    $file = http_files('data')[$item['_id']][$attr['id']] ?? null;
    // Delete old file
    if (!empty($item['_old'][$attr['id']]) && ($file || !empty($item['_delete'][$attr['id']])) && !media_delete($item['_old'][$attr['id']])) {
        $item['_error'][$attr['id']] = _('Could not delete old file %s', $item['_old'][$attr['id']]);
        return false;
    }
    // No upload
    if (!$file) {
        return true;
    }
    $value = generator_file($file['name'], project_path('media'));
    // Upload failed
    if (!file_upload($file['tmp_name'], project_path('media', $value))) {
        $item['_error'][$attr['id']] = _('File upload failed');
        return false;
    }
    $item[$attr['id']] = $value;
    return true;
}
Beispiel #17
0
function imglist_main()
{
    global $print, $x7s, $x7c, $x7p;
    $base_image_dir = "/images/";
    $image_dir = "/images/";
    if (isset($_GET['subdir']) && $_GET['subdir'] != "") {
        $image_dir .= $_GET['subdir'] . "/";
    }
    if ($x7c->permissions['admin_panic'] || authorized($image_dir, $x7p->profile['usergroup'])) {
        $basedir = dirname($_SERVER['DOCUMENT_ROOT'] . $_SERVER['PHP_SELF']);
        $file_path = $basedir . $image_dir;
        $image_root_dir = $basedir . $base_image_dir;
        $error = "<p style=\"color: red; font-weight: bold;\">";
        if (isset($_GET['file'])) {
            $error .= file_upload($file_path);
        } elseif (isset($_GET['delete'])) {
            $error .= file_delete($file_path . $_GET['delete']);
        } elseif (isset($_POST['multidel'])) {
            if ($_POST['action'] == 'delete') {
                foreach ($_POST['multidel'] as $file) {
                    $error .= file_delete($file_path . $file);
                }
            } elseif ($_POST['action'] == 'move') {
                foreach ($_POST['multidel'] as $file) {
                    $error .= file_move($file_path . $file, $image_root_dir . $_POST['dest'] . $file);
                }
            }
        }
        $error .= "</p>";
        $site_path = dirname($_SERVER['PHP_SELF']) . $image_dir;
        $output = file_list($file_path, $site_path);
        $body = $error . $output['body'];
        $head = $output['head'];
        $print->normal_window($head, $body);
    } else {
        return "Non sei autorizzato a vedere questa pagina <br>";
    }
}
Beispiel #18
0
 function uploadPage()
 {
     global $pref;
     $pref['upload_storagetype'] = "1";
     require_once e_HANDLER . "upload_handler.php";
     $uploaded = file_upload(e_IMAGE . "custom/");
 }
Beispiel #19
0
            $credit['status'] = intval($_GPC['credit']['status']);
            $credit['limit'] = intval($_GPC['credit']['limit']) ? intval($_GPC['credit']['limit']) : message('请设置积分上限');
            $credit['share'] = intval($_GPC['credit']['share']) ? intval($_GPC['credit']['share']) : message('请设置分享时赠送积分多少');
            $credit['click'] = intval($_GPC['credit']['click']) ? intval($_GPC['credit']['click']) : message('请设置阅读时赠送积分多少');
            $data['credit'] = iserializer($credit);
        } else {
            $data['credit'] = iserializer(array('status' => 0, 'limit' => 0, 'share' => 0, 'click' => 0));
        }
        if ($_GPC['bg_music_switch'] == 1) {
            $data['musicurl'] = $_GPC['musicurl'];
        } else {
            $data['musicurl'] = '';
        }
        if (!empty($_FILES['thumb']['tmp_name'])) {
            file_delete($_GPC['thumb_old']);
            $upload = file_upload($_FILES['thumb']);
            if (is_error($upload)) {
                message($upload['message'], '', 'error');
            }
            $data['thumb'] = $upload['path'];
        }
        if (empty($id)) {
            pdo_insert('fineness_article', $data);
        } else {
            unset($data['createtime']);
            pdo_update('fineness_article', $data, array('id' => $id));
        }
        message('文章更新成功!', $this->createWebUrl('paper', array('foo' => 'display')), 'success');
    }
} elseif ($op == 'delete') {
    load()->func('file');
        } else {
            $message .= EASYSHOP_UPLOAD_28 . " '" . $destination_file . "'.<br />";
        }
    }
}
if (isset($_POST['upload'])) {
    if (!$_POST['ac'] == md5(ADMINPWCHANGE)) {
        exit;
    }
    $pref['upload_storagetype'] = "1";
    require_once e_HANDLER . "upload_handler.php";
    $files = $_FILES['file_userfile'];
    foreach ($files['name'] as $key => $name) {
        if ($files['size'][$key]) {
            //$uploaded = file_upload(e_BASE.$_POST['upload_dir'][$key]);
            $uploaded = file_upload($_POST['upload_dir'][$key]);
        }
    }
}
if (isset($message)) {
    $ns->tablerender("", "<div style=\"text-align:center\"><b>" . $message . "</b></div>");
}
// EasyShop adjustment for displaying the image: exclude the ../ from showing!
if (e_QUERY != "" && substr(e_QUERY, -3) != "../") {
    echo "<iframe style=\"width:100%\" src=\"" . e_QUERY . "\" height=\"300\" scrolling=\"yes\"></iframe><br /><br />";
    if (!strpos(e_QUERY, "/")) {
        $path = "";
    } else {
        $path = substr($path, 0, strrpos(substr($path, 0, -1), "/")) . "/";
    }
}
Beispiel #21
0
		if (empty($_GPC['name'])) {
			message('抱歉,请输入分类名称!');
		}
		$data = array(
			'weid' => $_W['weid'],
			'name' => $_GPC['name'],
			'displayorder' => intval($_GPC['displayorder']),
			'enabled' => intval($_GPC['enabled']),
			'parentid' => intval($parentid),
			'description' => $_GPC['description'],
		);
		if (!empty($_FILES['icon']['tmp_name'])) {
			if (!empty($category['icon'])) {
				file_delete($category['icon']);
			}
			$upload = file_upload($_FILES['icon']);
			if (is_error($upload)) {
				message($upload['message']);
			}
			$data['icon'] = $upload['path'];
		}
		if (!empty($id)) {
			unset($data['parentid']);
			pdo_update('category', $data, array('id' => $id));
		} else {
			pdo_insert('category', $data);
		}
		cache_build_category();
		message('更新分类成功!', create_url('setting/category'), 'success');
	}
	template('setting/category_post');
Beispiel #22
0
$array = explode(',', $anglais);
//Extraire les éléments séprés par des virgule et les mettre dans un tableau
$anglais_champs = $anglais_champs . $array[count($array) - 1] . ", ";
//recuperer le dernier élément du tableau qui correspond au niveaux
//echo "tous les niveaux".utf8_encode($niveau);
$app = new iSDK();
if ($app->cfgCon("connectionName")) {
    if (find_id_by_email($email, $app) != 0) {
        $exist = true;
        $contactLeadId = '';
    } else {
        $exist = false;
        $contactLeadId = 22;
    }
    if (is_uploaded_file($_FILES['fichiercv']['tmp_name'])) {
        $url = file_upload($filename, enlever_accents($nom), enlever_accents($prenom), $telephone1);
    }
    $contact = array("FirstName" => $nom, "LastName" => $prenom, "Email" => $email, "Phone1" => $telephone1, "Phone2" => $telephone2, "State" => $province, "StreetAddress1" => $adresse, "PostalCode" => $codepostal, "City" => $ville, "ContactNotes" => $commentaire, "Website" => $url, "ContactType" => 'ANCIA Candidat', "LeadSourceId" => $contactLeadId, "_Formation" => utf8_encode(remove_underscor($f)), "_Experienceprofessionnelle" => utf8_encode($tous_dpartement), "_Niveauhirarchique" => $niveau, "_Langue" => $anglais_champs);
    //$url_cv='http://emploi.lefebvrefortier.ca/'.file_upload($filename,$nom,$prenom,$telephone1);
    //$CID=ajoutContact($contact);
    //créer le tag pour postuler
    //check si c'est un nouveau candidat ou non
    //echo "le id". $CID = $app->addCon($contact);
    echo "<b>le id<br>" . ($CID = $app->addWithDupCheck($contact, 'Email'));
    $app->optIn($email, 'Opt in par API');
    $app->optStatus($email, 'Opt in par API');
    //debut
    //echo "initialiser". $CID = 147;
    if ($CID >= !0) {
        echo "c'est !" . $CID;
        //ajout des TAGS quand le candidat est créé:
Beispiel #23
0
// +----------------------------------------------------------------------
// | WE CAN DO IT JUST FREE
// +----------------------------------------------------------------------
// | Copyright http://bbs.baijiacms.com Licensed under the Apache License, Version 2.0
// +----------------------------------------------------------------------
// | Author: 百家威信 <http://bbs.baijiacms.com>
// +----------------------------------------------------------------------
$result = array('url' => '', 'title' => '', 'original' => '', 'state' => 'SUCCESS');
$upfile = $_FILES['upfile'];
if (empty($upfile)) {
    $upfile = $_FILES['imgFile'];
}
if (!empty($upfile['name'])) {
    if ($_FILES['upfile']['error'] != 0) {
        $result['state'] = '上传失败,请重试!';
        exit(json_encode($result));
    }
    $file = file_upload($upfile, 'other');
    if (is_error($file)) {
        $result['state'] = $file['message'];
        exit(json_encode($result));
    }
    $result['url'] = $file['path'];
    $result['title'] = '';
    $result['original'] = '';
    exit(json_encode($result));
} else {
    $result['state'] = '请选择要上传的文件,仅支持gif,jpg, jpeg, png,mp3,mp4,doc格式!';
    exit(json_encode($result));
}
Beispiel #24
0
 public function doWebGoods()
 {
     global $_GPC, $_W;
     $category = pdo_fetchall("SELECT * FROM " . tablename('shopping_category') . " WHERE weid = '{$_W['weid']}' ORDER BY parentid ASC, displayorder DESC", array(), 'id');
     if (!empty($category)) {
         $children = '';
         foreach ($category as $cid => $cate) {
             if (!empty($cate['parentid'])) {
                 $children[$cate['parentid']][$cate['id']] = array($cate['id'], $cate['name']);
             }
         }
     }
     $operation = !empty($_GPC['op']) ? $_GPC['op'] : 'display';
     if ($operation == 'post') {
         $id = intval($_GPC['id']);
         if (!empty($id)) {
             $item = pdo_fetch("SELECT * FROM " . tablename('shopping_goods') . " WHERE id = :id", array(':id' => $id));
             if (empty($item)) {
                 message('抱歉,商品不存在或是已经删除!', '', 'error');
             }
             $allspecs = pdo_fetchall("select * from " . tablename('shopping_spec') . " where goodsid=:id order by displayorder asc", array(":id" => $id));
             foreach ($allspecs as &$s) {
                 $s['items'] = pdo_fetchall("select * from " . tablename('shopping_spec_item') . " where specid=:specid order by displayorder asc", array(":specid" => $s['id']));
             }
             unset($s);
             $params = pdo_fetchall("select * from " . tablename('shopping_goods_param') . " where goodsid=:id order by displayorder asc", array(':id' => $id));
             $piclist = unserialize($item['thumb_url']);
             //处理规格项
             $html = "";
             $options = pdo_fetchall("select * from " . tablename('shopping_goods_option') . " where goodsid=:id order by id asc", array(':id' => $id));
             //排序好的specs
             $specs = array();
             //找出数据库存储的排列顺序
             if (count($options) > 0) {
                 $specitemids = explode("_", $options[0]['specs']);
                 foreach ($specitemids as $itemid) {
                     foreach ($allspecs as $ss) {
                         $items = $ss['items'];
                         foreach ($items as $it) {
                             if ($it['id'] == $itemid) {
                                 $specs[] = $ss;
                                 break;
                             }
                         }
                     }
                 }
                 $html = '<table  class="tb spectable" style="border:1px solid #ccc;"><thead><tr>';
                 $len = count($specs);
                 $newlen = 1;
                 //多少种组合
                 $h = array();
                 //显示表格二维数组
                 $rowspans = array();
                 //每个列的rowspan
                 for ($i = 0; $i < $len; $i++) {
                     //表头
                     $html .= "<th>" . $specs[$i]['title'] . "</th>";
                     //计算多种组合
                     $itemlen = count($specs[$i]['items']);
                     if ($itemlen <= 0) {
                         $itemlen = 1;
                     }
                     $newlen *= $itemlen;
                     //初始化 二维数组
                     $h = array();
                     for ($j = 0; $j < $newlen; $j++) {
                         $h[$i][$j] = array();
                     }
                     //计算rowspan
                     $l = count($specs[$i]['items']);
                     $rowspans[$i] = 1;
                     for ($j = $i + 1; $j < $len; $j++) {
                         $rowspans[$i] *= count($specs[$j]['items']);
                     }
                 }
                 //   print_r($rowspans);exit();
                 $html .= '<th><div class="input-append input-prepend"><span class="add-on">库存</span><input type="text" class="span1 option_stock_all"  VALUE=""/><span class="add-on"><a href="javascript:;" class="icon-hand-down" title="批量设置" onclick="setCol(\'option_stock\');"></a></span></div></th>';
                 $html .= '<th><div class="input-append input-prepend"><span class="add-on">销售价格</span><input type="text" class="span1 option_marketprice_all"  VALUE=""/><span class="add-on"><a href="javascript:;" class="icon-hand-down" title="批量设置" onclick="setCol(\'option_marketprice\');"></a></span></div><br/></th>';
                 $html .= '<th><div class="input-append input-prepend"><span class="add-on">市场价格</span><input type="text" class="span1 option_productprice_all"  VALUE=""/><span class="add-on"><a href="javascript:;" class="icon-hand-down" title="批量设置" onclick="setCol(\'option_productprice\');"></a></span></div></th>';
                 $html .= '<th><div class="input-append input-prepend"><span class="add-on">成本价格</span><input type="text" class="span1 option_costprice_all"  VALUE=""/><span class="add-on"><a href="javascript:;" class="icon-hand-down" title="批量设置" onclick="setCol(\'option_costprice\');"></a></span></div></th>';
                 $html .= '<th><div class="input-append input-prepend"><span class="add-on">重量(克)</span><input type="text" class="span1 option_weight_all"  VALUE=""/><span class="add-on"><a href="javascript:;" class="icon-hand-down" title="批量设置" onclick="setCol(\'option_weight\');"></a></span></div></th>';
                 $html .= '</tr>';
                 for ($m = 0; $m < $len; $m++) {
                     $k = 0;
                     $kid = 0;
                     $n = 0;
                     for ($j = 0; $j < $newlen; $j++) {
                         $rowspan = $rowspans[$m];
                         //9
                         if ($j % $rowspan == 0) {
                             $h[$m][$j] = array("html" => "<td rowspan='" . $rowspan . "'>" . $specs[$m]['items'][$kid]['title'] . "</td>", "id" => $specs[$m]['items'][$kid]['id']);
                             // $k++; if($k>count($specs[$m]['items'])-1) { $k=0; }
                         } else {
                             $h[$m][$j] = array("html" => "", "id" => $specs[$m]['items'][$kid]['id']);
                         }
                         $n++;
                         if ($n == $rowspan) {
                             $kid++;
                             if ($kid > count($specs[$m]['items']) - 1) {
                                 $kid = 0;
                             }
                             $n = 0;
                         }
                     }
                 }
                 $hh = "";
                 for ($i = 0; $i < $newlen; $i++) {
                     $hh .= "<tr>";
                     $ids = array();
                     for ($j = 0; $j < $len; $j++) {
                         $hh .= $h[$j][$i]['html'];
                         $ids[] = $h[$j][$i]['id'];
                     }
                     $ids = implode("_", $ids);
                     $val = array("id" => "", "title" => "", "stock" => "", "costprice" => "", "productprice" => "", "marketprice" => "", "weight" => "");
                     foreach ($options as $o) {
                         if ($ids === $o['specs']) {
                             $val = array("id" => $o['id'], "title" => $o['title'], "stock" => $o['stock'], "costprice" => $o['costprice'], "productprice" => $o['productprice'], "marketprice" => $o['marketprice'], "weight" => $o['weight']);
                             break;
                         }
                     }
                     $hh .= '<td>';
                     $hh .= '<input name="option_stock_' . $ids . '[]"  type="text" class="span1 option_stock option_stock_' . $ids . '" value="' . $val['stock'] . '"/></td>';
                     $hh .= '<input name="option_id_' . $ids . '[]"  type="hidden" class="span1 option_id option_id_' . $ids . '" value="' . $val['id'] . '"/>';
                     $hh .= '<input name="option_ids[]"  type="hidden" class="span1 option_ids option_ids_' . $ids . '" value="' . $ids . '"/>';
                     $hh .= '<input name="option_title_' . $ids . '[]"  type="hidden" class="span1 option_title option_title_' . $ids . '" value="' . $val['title'] . '"/>';
                     $hh .= '</td>';
                     $hh .= '<td><input name="option_marketprice_' . $ids . '[]" type="text" class="span1 option_marketprice option_marketprice_' . $ids . '" value="' . $val['marketprice'] . '"/></td>';
                     $hh .= '<td><input name="option_productprice_' . $ids . '[]" type="text" class="span1 option_productprice option_productprice_' . $ids . '" " value="' . $val['productprice'] . '"/></td>';
                     $hh .= '<td><input name="option_costprice_' . $ids . '[]" type="text" class="span1 option_costprice option_costprice_' . $ids . '" " value="' . $val['costprice'] . '"/></td>';
                     $hh .= '<td><input name="option_weight_' . $ids . '[]" type="text" class="span1 option_weight option_weight_' . $ids . '" " value="' . $val['weight'] . '"/></td>';
                     $hh .= "</tr>";
                 }
                 $html .= $hh;
                 $html .= "</table>";
             }
         }
         if (empty($category)) {
             message('抱歉,请您先添加商品分类!', $this->createWebUrl('category', array('op' => 'post')), 'error');
         }
         if (checksubmit('submit')) {
             if (empty($_GPC['goodsname'])) {
                 message('请输入商品名称!');
             }
             if (empty($_GPC['pcate'])) {
                 message('请选择商品分类!');
             }
             $data = array('weid' => intval($_W['weid']), 'displayorder' => intval($_GPC['displayorder']), 'title' => $_GPC['goodsname'], 'pcate' => intval($_GPC['pcate']), 'ccate' => intval($_GPC['ccate']), 'type' => intval($_GPC['type']), 'isrecommand' => intval($_GPC['isrecommand']), 'ishot' => intval($_GPC['ishot']), 'isnew' => intval($_GPC['isnew']), 'isdiscount' => intval($_GPC['isdiscount']), 'istime' => intval($_GPC['istime']), 'timestart' => strtotime($_GPC['timestart']), 'timeend' => strtotime($_GPC['timeend']), 'description' => $_GPC['description'], 'content' => htmlspecialchars_decode($_GPC['content']), 'goodssn' => $_GPC['goodssn'], 'unit' => $_GPC['unit'], 'createtime' => TIMESTAMP, 'total' => intval($_GPC['total']), 'totalcnf' => intval($_GPC['totalcnf']), 'marketprice' => $_GPC['marketprice'], 'weight' => $_GPC['weight'], 'costprice' => $_GPC['costprice'], 'productprice' => $_GPC['productprice'], 'productsn' => $_GPC['productsn'], 'credit' => intval($_GPC['credit']), 'maxbuy' => intval($_GPC['maxbuy']), 'hasoption' => intval($_GPC['hasoption']), 'sales' => intval($_GPC['sales']), 'status' => intval($_GPC['status']));
             if (!empty($_FILES['thumb']['tmp_name'])) {
                 file_delete($_GPC['thumb_old']);
                 $upload = file_upload($_FILES['thumb']);
                 if (is_error($upload)) {
                     message($upload['message'], '', 'error');
                 }
                 $data['thumb'] = $upload['path'];
             }
             $cur_index = 0;
             if (!empty($_GPC['attachment-new'])) {
                 foreach ($_GPC['attachment-new'] as $index => $row) {
                     if (empty($row)) {
                         continue;
                     }
                     $hsdata[$index] = array('attachment' => $_GPC['attachment-new'][$index]);
                 }
                 $cur_index = $index + 1;
             }
             if (!empty($_GPC['attachment'])) {
                 foreach ($_GPC['attachment'] as $index => $row) {
                     if (empty($row)) {
                         continue;
                     }
                     $hsdata[$cur_index + $index] = array('attachment' => $_GPC['attachment'][$index]);
                 }
             }
             $data['thumb_url'] = serialize($hsdata);
             if (empty($id)) {
                 pdo_insert('shopping_goods', $data);
                 $id = pdo_insertid();
             } else {
                 unset($data['createtime']);
                 pdo_update('shopping_goods', $data, array('id' => $id));
             }
             $totalstocks = 0;
             //处理自定义参数
             $param_ids = $_POST['param_id'];
             $param_titles = $_POST['param_title'];
             $param_values = $_POST['param_value'];
             $param_displayorders = $_POST['param_displayorder'];
             $len = count($param_ids);
             $paramids = array();
             for ($k = 0; $k < $len; $k++) {
                 $param_id = "";
                 $get_param_id = $param_ids[$k];
                 $a = array("title" => $param_titles[$k], "value" => $param_values[$k], "displayorder" => $k, "goodsid" => $id);
                 if (!is_numeric($get_param_id)) {
                     pdo_insert("shopping_goods_param", $a);
                     $param_id = pdo_insertid();
                 } else {
                     pdo_update("shopping_goods_param", $a, array('id' => $get_param_id));
                     $param_id = $get_param_id;
                 }
                 $paramids[] = $param_id;
             }
             if (count($paramids) > 0) {
                 pdo_query("delete from " . tablename('shopping_goods_param') . " where goodsid={$id} and id not in ( " . implode(',', $paramids) . ")");
             } else {
                 pdo_query("delete from " . tablename('shopping_goods_param') . " where goodsid={$id}");
             }
             //                if ($totalstocks > 0) {
             //                    pdo_update("shopping_goods", array("total" => $totalstocks), array("id" => $id));
             //                }
             //处理商品规格
             $files = $_FILES;
             $spec_ids = $_POST['spec_id'];
             $spec_titles = $_POST['spec_title'];
             $specids = array();
             $len = count($spec_ids);
             $specids = array();
             $spec_items = array();
             for ($k = 0; $k < $len; $k++) {
                 $spec_id = "";
                 $get_spec_id = $spec_ids[$k];
                 $a = array("weid" => $_W['weid'], "goodsid" => $id, "displayorder" => $k, "title" => $spec_titles[$get_spec_id]);
                 if (is_numeric($get_spec_id)) {
                     pdo_update("shopping_spec", $a, array("id" => $get_spec_id));
                     $spec_id = $get_spec_id;
                 } else {
                     pdo_insert("shopping_spec", $a);
                     $spec_id = pdo_insertid();
                 }
                 //子项
                 $spec_item_ids = $_POST["spec_item_id_" . $get_spec_id];
                 $spec_item_titles = $_POST["spec_item_title_" . $get_spec_id];
                 $spec_item_shows = $_POST["spec_item_show_" . $get_spec_id];
                 $spec_item_oldthumbs = $_POST["spec_item_oldthumb_" . $get_spec_id];
                 $itemlen = count($spec_item_ids);
                 $itemids = array();
                 for ($n = 0; $n < $itemlen; $n++) {
                     $item_id = "";
                     $get_item_id = $spec_item_ids[$n];
                     $d = array("weid" => $_W['weid'], "specid" => $spec_id, "displayorder" => $n, "title" => $spec_item_titles[$n], "show" => $spec_item_shows[$n]);
                     $f = "spec_item_thumb_" . $get_item_id;
                     $old = $spec_item_oldthumbs[$k];
                     if (!empty($files[$f]['tmp_name'])) {
                         $upload = file_upload($files[$f]);
                         if (is_error($upload)) {
                             message($upload['message'], '', 'error');
                         }
                         $d['thumb'] = $upload['path'];
                     } else {
                         if (!empty($old)) {
                             $d['thumb'] = $old;
                         }
                     }
                     if (is_numeric($get_item_id)) {
                         pdo_update("shopping_spec_item", $d, array("id" => $get_item_id));
                         $item_id = $get_item_id;
                     } else {
                         pdo_insert("shopping_spec_item", $d);
                         $item_id = pdo_insertid();
                     }
                     $itemids[] = $item_id;
                     //临时记录,用于保存规格项
                     $d['get_id'] = $get_item_id;
                     $d['id'] = $item_id;
                     $spec_items[] = $d;
                 }
                 //删除其他的
                 if (count($itemids) > 0) {
                     pdo_query("delete from " . tablename('shopping_spec_item') . " where weid={$_W['weid']} and specid={$spec_id} and id not in (" . implode(",", $itemids) . ")");
                 } else {
                     pdo_query("delete from " . tablename('shopping_spec_item') . " where weid={$_W['weid']} and specid={$spec_id}");
                 }
                 //更新规格项id
                 pdo_update("shopping_spec", array("content" => serialize($itemids)), array("id" => $spec_id));
                 $specids[] = $spec_id;
             }
             //删除其他的
             if (count($specids) > 0) {
                 pdo_query("delete from " . tablename('shopping_spec') . " where weid={$_W['weid']} and goodsid={$id} and id not in (" . implode(",", $specids) . ")");
             } else {
                 pdo_query("delete from " . tablename('shopping_spec') . " where weid={$_W['weid']} and goodsid={$id}");
             }
             //保存规格
             $option_idss = $_POST['option_ids'];
             $option_productprices = $_POST['option_productprice'];
             $option_marketprices = $_POST['option_marketprice'];
             $option_costprices = $_POST['option_costprice'];
             $option_stocks = $_POST['option_stock'];
             $option_weights = $_POST['option_weight'];
             $len = count($option_idss);
             $optionids = array();
             for ($k = 0; $k < $len; $k++) {
                 $option_id = "";
                 $get_option_id = $_GPC['option_id_' . $ids][0];
                 $ids = $option_idss[$k];
                 $idsarr = explode("_", $ids);
                 $newids = array();
                 foreach ($idsarr as $key => $ida) {
                     foreach ($spec_items as $it) {
                         if ($it['get_id'] == $ida) {
                             $newids[] = $it['id'];
                             break;
                         }
                     }
                 }
                 $newids = implode("_", $newids);
                 $a = array("title" => $_GPC['option_title_' . $ids][0], "productprice" => $_GPC['option_productprice_' . $ids][0], "costprice" => $_GPC['option_costprice_' . $ids][0], "marketprice" => $_GPC['option_marketprice_' . $ids][0], "stock" => $_GPC['option_stock_' . $ids][0], "weight" => $_GPC['option_weight_' . $ids][0], "goodsid" => $id, "specs" => $newids);
                 $totalstocks += $a['stock'];
                 if (empty($get_option_id)) {
                     pdo_insert("shopping_goods_option", $a);
                     $option_id = pdo_insertid();
                 } else {
                     pdo_update("shopping_goods_option", $a, array('id' => $get_option_id));
                     $option_id = $get_option_id;
                 }
                 $optionids[] = $option_id;
             }
             if (count($optionids) > 0) {
                 pdo_query("delete from " . tablename('shopping_goods_option') . " where goodsid={$id} and id not in ( " . implode(',', $optionids) . ")");
             } else {
                 pdo_query("delete from " . tablename('shopping_goods_option') . " where goodsid={$id}");
             }
             //总库存
             if ($totalstocks > 0) {
                 pdo_update("shopping_goods", array("total" => $totalstocks), array("id" => $id));
             }
             //message('商品更新成功!', $this->createWebUrl('goods', array('op' => 'display')), 'success');
             message('商品更新成功!', $this->createWebUrl('goods', array('op' => 'post', 'id' => $id)), 'success');
         }
     } elseif ($operation == 'display') {
         $pindex = max(1, intval($_GPC['page']));
         $psize = 20;
         $condition = '';
         if (!empty($_GPC['keyword'])) {
             $condition .= " AND title LIKE '%{$_GPC['keyword']}%'";
         }
         if (!empty($_GPC['cate_2'])) {
             $cid = intval($_GPC['cate_2']);
             $condition .= " AND ccate = '{$cid}'";
         } elseif (!empty($_GPC['cate_1'])) {
             $cid = intval($_GPC['cate_1']);
             $condition .= " AND pcate = '{$cid}'";
         }
         if (isset($_GPC['status'])) {
             $condition .= " AND status = '" . intval($_GPC['status']) . "'";
         }
         $list = pdo_fetchall("SELECT * FROM " . tablename('shopping_goods') . " WHERE weid = '{$_W['weid']}' and deleted=0 {$condition} ORDER BY status DESC, displayorder DESC, id DESC LIMIT " . ($pindex - 1) * $psize . ',' . $psize);
         $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('shopping_goods') . " WHERE weid = '{$_W['weid']}'  and deleted=0 {$condition}");
         $pager = pagination($total, $pindex, $psize);
     } elseif ($operation == 'delete') {
         $id = intval($_GPC['id']);
         $row = pdo_fetch("SELECT id, thumb FROM " . tablename('shopping_goods') . " WHERE id = :id", array(':id' => $id));
         if (empty($row)) {
             message('抱歉,商品不存在或是已经被删除!');
         }
         //            if (!empty($row['thumb'])) {
         //                file_delete($row['thumb']);
         //            }
         //            pdo_delete('shopping_goods', array('id' => $id));
         //修改成不直接删除,而设置deleted=1
         pdo_update("shopping_goods", array("deleted" => 1), array('id' => $id));
         message('删除成功!', referer(), 'success');
     } elseif ($operation == 'productdelete') {
         $id = intval($_GPC['id']);
         pdo_delete('shopping_product', array('id' => $id));
         message('删除成功!', '', 'success');
     }
     include $this->template('goods');
 }
Beispiel #25
0
 public function doMobileGuanhuai()
 {
     global $_GPC, $_W;
     $op = trim($_GPC['op']) ? trim($_GPC['op']) : 'index';
     $weid = $_W['uniacid'];
     $car = pdo_fetch("SELECT * FROM " . tablename('we7car_care') . " WHERE weid = :weid AND from_user = :from_user LIMIT 1", array(':weid' => $_W['uniacid'], ':from_user' => $_W['fans']['from_user']));
     if (!empty($car)) {
         $car['brand_val'] = $car['brand_id'] . '=' . $car['brand_cn'];
         $car['series_val'] = $car['series_id'] . '=' . $car['series_cn'];
         $car['type_val'] = $car['type_id'] . '=' . $car['type_cn'];
         $car_insurance_nextDate = $car['car_insurance_lastDate'] + 86400 * 90;
         $car_care_nextDate = $car['car_care_nextDate'] + 86400 * 365;
         $insurance_days = floor(($car_insurance_nextDate - TIMESTAMP) / 86400);
         $care_days = floor(($car_insurance_nextDate - TIMESTAMP) / 86400);
         $car['car_startTime'] = $car['car_startTime'] ? date('Y-m-d', $car['car_startTime']) : date('Y-m-d');
         $car['car_insurance_lastDate'] = $car['car_insurance_lastDate'] ? date('Y-m-d', $car['car_insurance_lastDate']) : date('Y-m-d');
         $car['car_care_lastDate'] = $car['car_care_lastDate'] ? date('Y-m-d', $car['car_care_lastDate']) : date('Y-m-d');
     } else {
         $car['car_startTime'] = date('Y-m-d');
         $car['car_insurance_lastDate'] = date('Y-m-d');
         $car['car_care_lastDate'] = date('Y-m-d');
     }
     //获取车主关怀顶部图片
     $banner = pdo_fetchcolumn("SELECT guanhuai_thumb FROM " . tablename('we7car_set') . " WHERE  weid = :weid  ", array(':weid' => $_W['uniacid']));
     if ($op == 'caredit') {
         $brands = pdo_fetchall("SELECT id,title FROM " . tablename('we7car_brand') . " WHERE `weid` = :weid AND `status` = 1 AND `status` = 1 ORDER BY `listorder` DESC", array(':weid' => $_W['uniacid']));
         $eseries = pdo_fetchall('SELECT id,title FROM ' . tablename('we7car_series') . " WHERE `weid` = :weid AND `bid` = :bid AND `status` = 1 ORDER BY listorder DESC", array(':weid' => $_W['uniacid'], ':bid' => $car['brand_id']));
         $etypes = pdo_fetchall('SELECT id,title FROM ' . tablename('we7car_type') . " WHERE `weid` = :weid AND `sid` = :sid AND `status` = 1 ORDER BY listorder DESC", array(':weid' => $_W['uniacid'], ':sid' => $car['series_id']));
         if (checksubmit('submit')) {
             $brand = explode('=', $_GPC['brand']);
             $series = explode('=', $_GPC['serie']);
             $types = explode('=', $_GPC['types']);
             $insert = array('weid' => $_W['uniacid'], 'from_user' => $_W['fans']['from_user'], 'brand_id' => intval($brand[0]), 'brand_cn' => trim($brand[1]), 'series_id' => trim($series[0]), 'series_cn' => trim($series[1]), 'type_id' => trim($types[0]), 'type_cn' => trim($types[1]), 'car_note' => trim($_GPC['car_note']), 'car_no' => trim($_GPC['car_no']), 'car_userName' => trim($_GPC['car_userName']), 'car_mobile' => trim($_GPC['car_mobile']), 'car_startTime' => strtotime($_GPC['car_startTime']), 'car_insurance_lastDate' => strtotime($_GPC['car_insurance_lastDate']), 'car_insurance_lastCost' => trim($_GPC['car_insurance_lastCost']), 'car_care_mileage' => trim($_GPC['car_care_mileage']), 'car_care_lastDate' => strtotime($_GPC['car_care_lastDate']), 'car_care_lastCost' => trim($_GPC['car_care_lastCost']), 'car_insurance_lastDate' => strtotime($_GPC['car_insurance_lastDate']), 'createtime' => TIMESTAMP);
             if (!empty($_FILES['car_photo']['tmp_name'])) {
                 load()->func('file');
                 $upload = file_upload($_FILES['car_photo']);
                 if (is_error($upload)) {
                     message($upload['message']);
                 }
                 $insert['car_photo'] = $upload['path'];
             }
             if (empty($car['id'])) {
                 $temp = pdo_insert('we7car_care', $insert);
             } else {
                 $temp = pdo_update('we7car_care', $insert, array('id' => $car['id']));
             }
             if ($temp == false) {
                 message('抱歉,更新爱车数据失败!', $this->createMobileUrl('guanhuai', array('op' => 'caredit', 'from_user' => $_W['fans']['from_user'])), 'error');
             } else {
                 message('更新爱车数据成功!', $this->createMobileUrl('guanhuai', array('op' => 'index', 'weid' => $weid, 'from_user' => $_W['fans']['from_user'])), 'success');
             }
         }
         load()->func('tpl');
         include $this->template('guanhuai_caredit');
     }
     if ($op == 'index') {
         include $this->template('guanhuai_index');
     }
 }
Beispiel #26
0
 function uploadFile($file = null)
 {
     global $is_API;
     if (is_null($file)) {
         $file = $_FILES;
     }
     $result = array('result' => 0, 'link' => '');
     if ($file['file']['name']) {
         $file_check = explode(".", $file['file']['name']);
         $ext = strtolower($file_check[count($file_check) - 1]);
         // 파일 확장자 구하기
         $upfile = file_upload($file['file']['tmp_name'], "board_" . date("YmdHis") . rand(1000, 9999), $ext, ".." . UPLOAD_PATH . "/" . date("Y") . "/" . date("m") . "/", 1);
         if ($upfile) {
             $result['result'] = 1;
             $result['link'] = UPLOAD_PATH . "/" . date("Y") . "/" . date("m") . "/" . $upfile;
             $result['filename'] = $upfile;
         }
         //thumbnail($path."/".$upfile, $path."/thumb_".$upfile, 120, 100, 1);
         $post_id = isset($_POST['id']) ? $_POST['id'] : "";
         $is_thumbnail = isset($_POST['is_thumbnail']) ? $_POST['is_thumbnail'] : "N";
         if (!$this->addAttachment($post_id, $is_thumbnail, $file, $upfile, $result['link'])) {
             $result['result'] = 0;
             $result['message'] = "file information update failed!";
         }
     }
     if ($is_API) {
         echo json_encode($result);
     } else {
         return $result;
     }
 }
Beispiel #27
0
        load()->model('setting');
        $uploadsetting = setting_load('upload');
        $uploadsetting = $uploadsetting['upload'];
        $thumb = empty($uploadsetting['image']['thumb']) ? 0 : 1;
        $width = intval($uploadsetting['image']['width']);
        load()->func('file');
        if (!empty($_FILES['file']['name'])) {
            if ($_FILES['file']['error'] != 0) {
                $result['error']['message'] = '上传失败,请重试!';
                die(json_encode($result));
            }
            $_W['uploadsetting'] = array();
            $_W['uploadsetting']['image']['folder'] = 'images/' . $_W['uniacid'];
            $_W['uploadsetting']['image']['extentions'] = $_W['config']['upload']['image']['extentions'];
            $_W['uploadsetting']['image']['limit'] = $_W['config']['upload']['image']['limit'];
            $file = file_upload($_FILES['file']);
            if (is_error($file)) {
                $result['error']['message'] = $file['message'];
                die(json_encode($result));
            }
            $result['result'] = $file['path'];
            $result['id'] = $file['path'];
            pdo_insert('core_attachment', array('uniacid' => $_W['uniacid'], 'uid' => $_W['uid'], 'filename' => $_FILES['file']['name'], 'attachment' => $file['path'], 'type' => 1, 'createtime' => TIMESTAMP));
            unset($result['error']);
            die(json_encode($result));
        } else {
            $result['error']['message'] = '请选择要上传的图片!';
            die(json_encode($result));
        }
    }
}
Beispiel #28
0
 private function fileUpload($file, $type)
 {
     global $_W;
     set_time_limit(0);
     $_W['uploadsetting'] = array();
     $_W['uploadsetting']['images']['folder'] = 'image';
     $_W['uploadsetting']['images']['extentions'] = array('jpg', 'png', 'gif');
     $_W['uploadsetting']['images']['limit'] = 50000;
     $result = array();
     $upload = file_upload($file, 'image');
     if (is_error($upload)) {
         message($upload['message'], '', 'ajax');
     }
     $result['url'] = $upload['url'];
     $result['error'] = 0;
     $result['filename'] = $upload['path'];
     return $result;
 }
Beispiel #29
0
     $acid = account_create($uniacid, $insert);
     if (!empty($_FILES['qrcode']['tmp_name'])) {
         $_W['uploadsetting'] = array();
         $_W['uploadsetting']['image']['folder'] = $acid;
         //file be save in attachment/$acid
         $_W['uploadsetting']['image']['extentions'] = array('jpg', 'jpeg', 'png');
         $_W['uploadsetting']['image']['limit'] = $_W['config']['upload']['image']['limit'];
         $upload = file_upload($_FILES['qrcode'], 'image', "qrcode_{$acid}");
     }
     if (!empty($_FILES['headimg']['tmp_name'])) {
         $_W['uploadsetting'] = array();
         $_W['uploadsetting']['image']['folder'] = $acid;
         //file be save in attachment/$acid
         $_W['uploadsetting']['image']['extentions'] = array('jpg', 'jpeg', 'png');
         $_W['uploadsetting']['image']['limit'] = $_W['config']['upload']['image']['limit'];
         $upload = file_upload($_FILES['headimg'], 'image', "headimg_{$acid}");
     }
 }
 if ($state && $uniacid && $acid) {
     $result = '公众号<strong style="color:#8DDD1E">' . $_GPC['name'] . '</strong>提交成功';
 } else {
     $result = '公众号<strong style="color:#8DDD1E">' . $_GPC['name'] . '</strong>提交失败';
 }
 $script = <<<EOT
                 \$('body').append('<div class="rs-overlay" />');
                 \$("a[rel='rs-dialog']").each(function(){
                         var trigger \t= \$(this);
                         var rs_dialog \t= \$('#' + trigger.data('target'));
                         var rs_box \t\t= rs_dialog.find('.rs-dialog-box');
                         var rs_close \t= rs_dialog.find('.close');
                         var rs_overlay \t= \$('.rs-overlay');
Beispiel #30
0
 public function doMobileRegister()
 {
     global $_GPC, $_W;
     $title = '微信墙登记';
     /**** 0.6 ****/
     load()->model('mc');
     load()->func('tpl');
     // 验证用户注册, 注册后方能进如活动
     checkauth();
     if (!empty($_GPC['submit'])) {
         $data = array('nickname' => $_GPC['nickname']);
         if (empty($data['nickname'])) {
             die('<script>alert("请填写您的昵称!");location.reload();</script>');
         }
         if (!empty($_FILES['avatar']['tmp_name'])) {
             /**** 0.6 ****/
             load()->func('file');
             $upload = file_upload($_FILES['avatar']);
             if (is_error($upload)) {
                 die('<script>alert("登记失败!请重试!");location.reload();</script>');
             }
             $data['avatar'] = $upload['path'];
         } else {
             $data['avatar'] = $_GPC['avatar'];
         }
         if (empty($data['avatar'])) {
             $data['avatar'] = 'images/global/noavatar_middle.gif';
         }
         mc_update($_W['member']['uid'], $data);
         message('登记成功,系统会自动跳转,如果未成功请手动退回微信界面。<script type="text/javascript">wx.ready(function(){wx.closeWindow();});</script>');
     }
     /**** 0.6 ****/
     $member = mc_fetch($_W['member']['uid'], array('nickname', 'avatar'));
     if (empty($member['avatar'])) {
         //mc_oauth_userinfo();
         $member['avatar'] = 'images/global/noavatar_middle.gif';
         include $this->template('register');
     } else {
         message('个人信息已经自动获取到,系统会自动跳转,如果未成功请手动退回微信界面。<script type="text/javascript">wx.ready(function(){wx.closeWindow();});</script>', '', 'success');
     }
 }