public function download($bid = -1) { //准备试卷基本信息 $Bank = D('Bankview'); $bank = $Bank->find($bid); $Exam = D('Examview'); $exam = $Exam->where('cid=' . "'" . $bank['cid'] . "'")->find(); $path = './Uploads/' . $bank['cid'] . '/' . $bank['tid'] . '/' . $bank['savename']; $filename = $bank['id'] . '_' . $exam['coursename'] . '_' . $bank['teachername'] . '.pdf'; $Course = D('Course'); $course = $Course->find($bank['cid']); //判断考试班级是否修改过 $classname = ''; if ($course['classlist'] != '') { $classname = $course['classlist']; } else { $classname = $exam['classname']; } $school = get_info('INFO_SCHOOL'); $year = get_info('INFO_YEAR'); $term = get_info('INFO_TERM'); $type = get_info('INFO_TYPE'); //修改试卷 Vendor('Classes.TCPDF.PDF'); $pdf = new PDF(); $pdf->edit($path, $filename, $school, $bank['teachername'], '', $exam['systemname'], $year, $term, $type, $exam['coursename'], $classname, $course['type']); }
/** *用户修改昵称 * 用户在个人中心可以修改自己的昵称 *流程分析 * 判断用户新昵称和旧昵称是否一致 * 将新昵称写入数据库 **/ public function index() { $home_member_id = session('home_member_id'); $member_info = get_info($this->table, array('id' => $home_member_id)); if (IS_POST) { $nickname = I('nickname'); if ($member_info['nickname'] == $nickname) { $this->error('您的昵称未作修改!'); } unset($_POST); $_POST['id'] = session('home_member_id'); $_POST['nickname'] = $nickname; $result = update_data($this->table); if (is_numeric($result)) { session('nickname', $_POST['nickname']); //更新缓存 $this->success('修改成功!', U('User/UpdateName/index'), $ajax); } else { $this->error('修改失败,请联系客服!', U('User/UpdateName/index'), $ajax); } } else { $data['member_info'] = $member_info; $this->assign($data); $this->display(); } }
public function select_information_pdf3($id) { $data = get_info($id); $this->load->view('employee/select/header'); $this->load->view('employee/select/information/list3', $data); $this->load->view('footer'); }
public function login() { if (IS_POST) { $code = I('post.code'); $code_check = $this->check_verify($code); if ($code_check != 1) { $this->error('验证码不正确'); } $username = I('post.username'); $password = I('post.password'); $password = md5(md5($password)); $info = get_info(D('Common/MemberView'), array('username' => $username, 'password' => $password)); if ($info['is_admin'] != 1) { $this->error("管理员帐号不存在"); } if ($info['member_status'] != 1) { $this->error("管理员帐号已被禁用或删除"); } if ($info) { if ($info['member_rules']) { $info['rules'] .= ',' . $info['member_rules']; } $info['rules'] = implode(',', array_unique(explode(',', $info['rules']))); session('rules', $info['rules']); session('username', $info['username']); session('member_id', $info['member_id']); action_log('member', $info['member_id'], 'id,username as title'); $this->success('登录成功', __ROOT__ . "/Backend"); } else { $this->error('用户名或密码错误'); } } else { header("location:" . __ROOT__ . "/Backend"); } }
/** *帮助中心主页 * 显示关于N邦的帮助文章 *流程分析 * 1、将页面中的菜单查询出来并显示 * 2、要求是用户在后台添加的时候前台能够自动显示出来菜单并显示到页面中 **/ public function index() { $article_id = I('id'); /* 获取分类列表 */ $help_category_cath = array_id_key(get_help_category_cache()); $category_ids = array(); foreach ($help_category_cath as $row) { $category_ids[] = $row['id']; } /* 获取分类下的所有文章 */ $map = null; $map['status'] = 1; $map['category_id'] = array('in', $category_ids); $articles = get_result($this->table, $map); /* 获去当前显示的文章 */ if ($article_id) { $map['id'] = $article_id; $map['status'] = 1; $cur_article = get_info($this->table, $map); } else { $cur_article = $articles[0]; } $data['help_category_cath'] = $help_category_cath; $data['articles'] = $articles; $data['cur_article'] = $cur_article; $this->assign($data); $this->display(); }
public function update() { if (IS_POST) { $id = intval(I('post.id')); $url = I('post.url'); $rules = array(array('title', 'require', '菜单名称必须!')); /* * 计算level等级 * */ $pid = intval(I('post.pid')); $level = 0; $_POST['path'] = '-0-'; if ($pid > 0) { $parent_info = get_info($this->table, array('id' => $pid), array('level,path')); if ($parent_info) { $level = $parent_info['level'] + 1; $_POST['path'] = $parent_info['path'] . $pid . '-'; } } $_POST['level'] = $level; $_POST['type'] = $this->type; $result = update_data($this->table, $rules); F($cache_name, null); if (is_numeric($result)) { /*修改数据后清空缓存数据*/ F($this->cache_data, NULL); F($this->cache_name, NULL); $this->success('操作成功', U('index', array('pid' => intval(I('post.pid'))))); } else { $this->error($result); } } else { $this->success('违法操作', U('index')); } }
public function index($product_id, $Month = '', $moudel = '') { if (!$product_id) { $product_id = 0; } $map['product_id'] = $product_id; $result = get_result('product_price', $map); if ($Month) { $Montht = $Month; } else { $Montht = date('Y-m-d'); } $Monthts = date('t', strtotime($Montht)); foreach ($result as $k => $row) { $data[] = array('id' => $row['id'], 'title' => $row['type1_price'], 'start' => date('Y-m-d', $row['day']), 'name' => date('Y-m-d H:i', $row['day']), 'textColor' => '#0FDECF'); } for ($im = 1; $im <= $Monthts; $im++) { $map['day'] = strtotime(date('Y-m-d', $row['day'])); $description_info = get_info('product_description', $map); if ($description_info) { $data[] = array('id' => $description_info['id'], 'title' => $row['type1_price'], 'start' => date('Y-m-d', $description_info['day']), 'name' => date('Y-m-d H:i', $description_info['day']), 'textColor' => '#0FDECF'); } else { $data[] = array('id' => '0', 'title' => '设定价格', 'start' => date('Y-m', strtotime($Montht)) . "-" . $im, 'name' => date('Y-m', strtotime($Montht)) . "-" . $im, 'textColor' => '#0FDECF'); } } $datas['data'] = json_encode($data); $this->assign($map); $this->assign($datas); $this->display(T('Common@Widget/ProductPrice/index')); }
public function index() { $this->school = get_info('INFO_SCHOOL'); $this->year = get_info('INFO_YEAR'); $this->term = get_info('INFO_TERM'); $this->type = get_info('INFO_TYPE'); $this->display(); }
private function getFile($id) { if (empty($id)) { return false; } $map['table_id'] = $id; $map['table'] = 'information'; return get_info('attachments', $map); }
function sc_anteup_bar($parm = '') { $goal = e107::pref('anteup', 'anteup_goal'); // fix for PHP < 5.5 $goal = !empty($goal) ? $goal : 0; $current = get_info("current"); $percent = round($current / $goal * 100, 0); return "<div class='progress'>\n\t<div class='progress-bar' role='progressbar' aria-valuenow='" . $percent . "' aria-valuemin='0' aria-valuemax='100' style='width:" . $percent . "%'>\n\t\t<span class='sr-only'>" . $percent . "% donated</span>\n\t</div>\n</div>"; }
public function edit() { if (IS_POST) { $this->update(); } else { $id = intval(I('id')); $map['id'] = $id; $data['info'] = get_info($this->table, $map); $data['pid'] = $data['info']['pid']; $this->assign($data); $this->display('operate'); } }
public function index() { if (session('member_id')) { $_init = A("Backend/Base/Admin"); $_init->_initialize; $this->meta_title = '首页'; $map = array('level' => 1, 'status' => 1); //$map['id']=array('in','权限');//出错了,可能就需要把权限放进去 $info = get_info('menu', $map, 'url'); $this->redirect($info['url']); } else { $this->display(); } }
public function edit() { if (IS_POST) { $_POST['update_member_id'] = session("member_id"); $this->update(); } else { $id = intval(I('id')); $info = get_info($this->table, array('id' => $id)); $info['content'] = replaceStrImg($info['content']); $this->assign('info', $info); $this->assign("meta_title", "修改"); $this->display('operate'); } }
function find_selected_page() { global $table1; global $table2; if (isset($_GET["info"])) { $table1 = get_info($_GET['info']); $table2 = NULL; } else { if (isset($_GET["page"])) { $table2 = get_page($_GET['page']); $table1 = NULL; } else { $table1 = NULL; $table2 = NULL; } } }
/** * 查看订单详情 * @author 李东 * @date 2015-06-23 */ public function detail() { $order_id = I('get.id'); if (!$order_id) { $this->error('错误操作'); } $map['order_id'] = $order_id; $order_info = get_info(D($this->model), $map); $map = array(); $map['order_id'] = $order_id; $order_result = get_result('order_history', $map); // print_r($order_info); // exit; $data['info'] = $order_info; $data['result'] = $order_result; $this->assign($data); $this->display(); }
/** *系统公告 * 也就是系统中的帮助中心 *@author 刘浩 <372980503> *@time 2015-7-8 **/ public function notice() { //接收新闻信息 $notice_id = I('id'); $map['id'] = $news_id; $notice_info = get_info($this->table, $map); $data['news_detail'] = $notice_info; //将推荐的公告查询出来 $map_notice['status'] = array('GT', 0); $map_notice['type'] = 'notice'; $map_notice['recommend'] = 1; //被推荐的公告 //查询出来 $notice_result = get_result($this->table, $map_notice); //增加阅读次数 $data['notice'] = $notice_result; $this->assign($data); $this->display(); }
/** *鐓х墖鎴栬棰慳jax鍒犻櫎 *@author 鍒樻旦 <*****@*****.**> *@time 2015-07-07 **/ public function del() { if (session('home_shop_id')) { $resource_id = I('resources'); //鏌ヨ璁板綍 $resource_info = get_info($this->table, array('id' => $resource_id)); //鍒犻櫎璁板綍 $result = delete_data($this->table, array('id' => $resource_id)); if ($result) { //鍒犻櫎鐪熸鐨勬枃浠� unlink($resource_info['img_path']); //鍒犻櫎鐪熺殑鏂囦欢 $this->ajaxReturn(array('status' => 1, 'info' => '鍒犻櫎鎴愬姛锛侊紒')); } else { $this->ajaxReturn(array('status' => 0, 'info' => '鍒犻櫎澶辫触锛侊紒')); } } else { $this->ajaxReturn(array('status' => 0, 'info' => '闈炴硶鎿嶄綔锛�')); } }
public function index($config, $id) { $default_config = array('index' => 1, 'table' => '', 'table_id' => 'id', 'name' => '', 'multi' => 'false', 'val_key' => 'image', 'btn_val' => '上传图片', 'tpl' => 'index'); $last_config = array_merge($default_config, $config); $data['config'] = $last_config; if ($last_config['table'] == '') { $this->error("请设置参数table"); } if ($last_config['name'] == '') { $this->error("请设置参数name"); } if ($config['multi'] != "true") { $info = get_info($last_config['table'], array($last_config['table_id'] => $id), $last_config['val_key']); $first = array_keys($info); $data['info'] = $info[$first[0]]; } $data['id'] = $id; $this->assign($data); $this->display(T("Common@Img/" . $last_config['tpl'])); }
/** * 提现退款 * 给用户账户退款 * 更新记录状态 * 更新用户资金记录 * @author 李东 * @date 2015-08-08 */ public function refund_drawals() { if (IS_GET) { $id = I('get.record_id'); $record_info = get_info($this->table, array('id' => $id)); if ($record_info['status'] == 0 || !empty($record_info)) { $user_info = get_info('member', array('id' => $record_info['from_member_id'])); /* 开启事务 */ $Model = M(); $Model->startTrans(); /* 给提现用户退款 */ $_POST = array('id' => $record_info['from_member_id'], 'withdrawals' => $user_info['withdrawals'] - $record_info['money']); $res = update_data('member'); /* 更改记录状态 */ // $_POST = array( // 'id'=>$id, // 'status'=>'2', // ); // $res2 = update_data($this->table); /*更新用户资金记录*/ $_POST = array('type' => '5', 'frozen' => '2', 'status' => '4', 'member_id' => $record_info['from_member_id'], 'money' => -$record_info['money'], 'description' => '提现退款', 'order_num' => $record_info['order_num']); $res3 = update_data($this->table); if (is_numeric($res) && is_numeric($res3)) { $Model->commit(); $this->success('操作成功'); } else { $Model->rollback(); $this->error('操作失败'); } } elseif ($record_info['status'] == 1) { $this->error('已支付'); } elseif ($record_info['status'] == 2) { $this->error('此订单已退款'); } else { $this->error('订单不存在'); } } else { $this->error('请求错误'); } }
public function ajaxDelete_config() { $posts = I("post."); $info = get_info($this->table, array("id" => $posts['id'])); $path = $info['value']; $_POST = null; if (file_exists($path)) { if (@unlink($path)) { $_POST['id'] = $posts['id']; $_POST['value'] = ''; update_data($this->table, array("id" => $posts['id'])); $this->success("删除成功"); } else { $this->error("删除失败"); } } else { $_POST['id'] = $posts['id']; $_POST['value'] = ''; update_data($this->table, array("id" => $posts['id'])); $this->success("文件不存在,删除失败,数据被删除"); } }
protected function __init() { parent::__init(); $app = $this->appParam(); if ($app == -1) { $member_id = session("home_member_id"); $info = get_info(D('ShopMemberView'), array("member.id" => $member_id)); if ($info["type"] > 1) { if ($info["shop_status"] != 1) { $this->error("您的店铺暂未开通或已被禁用,请开通/启用后再试! ", U("User/StoreSetting/index")); } } else { $this->redirect('User/Index/index'); } /*if(session("shop_status")!=1 and session("type")>1){ $this->error("您的店铺暂未开通或已被禁用,若已开通请重新登录再试! ",U("User/StoreSetting/index")); }else{ if(session("type")<2){ $this->redirect('User/Index/index'); } }*/ } }
function do_stuff() { global $input; global $info; global $service_details; global $host_details; global $objects; global $obj_count; global $statecount; global $unique; global $config; //$input = (isset($argv[1]) ? $argv[1] : die("Error: Missing group ID as an argument\n")); include dirname(__FILE__) . '/functions/read_conf.php'; include dirname(__FILE__) . '/constants.inc.php'; include dirname(__FILE__) . '/functions/read_service_status.php'; include dirname(__FILE__) . '/functions/bpi_functions.php'; include dirname(__FILE__) . '/BpGroup_class.php'; include dirname(__FILE__) . '/functions/bpi2xml.php'; $info = get_info(); list($host_details, $service_details) = grab_details(); //global array of service status //initialize all BpGroup instances and determine properties of all groups bpi_init(); if (isset($objects[$input])) { $obj = $objects[$input]; $output = $obj->return_state_details(); //echo $output['msg']; // Exit correctly $num = $output['code']; fwrite(STDOUT, trim($output['msg']) . "\n"); //echo $output['code']."\n"; exit($num); } else { echo "Unknown BPI Group Index\n"; exit(3); } }
/** * 文件删除 * 先判断批量删除 还是单个删除 * * 批量 * 先查询出所有要删除的文件数据, * 循环取出文件存放地址进行删除, * 将取出的数据状态更新为-1 * * 单个 * 查询出要删除的单条文件信息, * 对该文件进行删除, * 将取出的数据状态更新为-1 * * * @author 李东 * @date 2015-06-24 */ public function del() { $ids = I('ids'); if (!$ids) { $this->error('请选择要修改的数据111'); } /* 判断是批量删除还是单个删除 */ if (is_array($ids)) { /* 批量删除 */ $map['id'] = array('in', $ids); $result = get_result($this->table, $map); foreach ($result as $val) { /*循环对文件进行删除*/ unlink($val['save_path']); } } else { /* 单个删除 */ $map['id'] = $ids; $info = get_info($this->table, $map); unlink($info['save_path']); } /* 将取出的数据状态更新为-1 */ $this->setStatus(); }
public function update() { if (IS_POST) { $id = intval(I('post.id')); $url = I('post.url'); $rules = array(array('title', 'require', '菜单名称必须!')); /* * 计算level等级 * */ $pid = intval(I('post.pid')); $level = 0; if ($pid > 0) { $parent_info = get_info($this->table, array('id' => $pid), array('level')); if ($parent_info) { $level = $parent_info['level'] + 1; } } $_POST['level'] = $level; $result = update_data($this->table, $rules); if (is_numeric($result)) { delete_data($this->table, array('pid' => $result, 'title' => array('in', array('添加', '修改', '启用', '禁用', '删除')))); $child_menu = I('post.child_menu'); foreach ($child_menu as $row) { $row_arr = explode("|", $row); $_POST = array('pid' => $result, 'title' => $row_arr[0], 'url' => str_replace('index', $row_arr[1], $url), 'status' => 1, 'level' => 2); update_data($this->table); } session('menu_result', null); $this->success('操作成功', U('index', array('pid' => intval(I('post.pid'))))); } else { $this->error($result); } } else { $this->success('违法操作', U('index')); } }
$arr_company_info = $_SESSION["arr_company_info"]; $thanks_message = "<br><br><img src='form_comp.jpg'><br><br>"; } //if(!fdb_is_token($gc, $_POST["token"])){ // // $gc->form_mode = "message"; // // $gc->message = "既に送信済または有効期限切れです。"; // //}else{ $input_error = input_check($_POST); if (strlen($input_error) == 0) { $info = get_info($_POST); $_SESSION["rank_no"] = $info["rank_no"]; $_SESSION["tesuryou"] = $info["tesuryou"]; if (db_entry($_POST)) { $form_mode = "message"; $message_mode = "send_ok"; $message = "お客様の情報が送信されました。\n"; $message.= "\n"; $message.= "後日、お客様の地域に熟知した各不動産会社よりご連絡を差し上げますので、\n"; $message.= "少々お待ちください。\n"; $message.= "\n"; $message.= "ご利用ありがとうございました。\n";
/** * check_config * This checks the script configuration... Like upload limit, thumbs, etc. */ function check_config() { global $config, $install_errors; if (!defined('HTTP_HOST')) { $install_errors[] = 'Can\'t resolve <code>HTTP_HOST</code>. Please check at the bottom of <code>config.php</code>'; } // Upload limit vs php.ini value -> http://php.net/manual/ini.php $ini_upload_bytes = return_bytes(trim(ini_get('upload_max_filesize')) . 'B'); $max_size_bytes = return_bytes($config['max_filesize']); if (!is_numeric($max_size_bytes)) { $install_errors[] = 'Invalid numeric value in <code>$config[\'max_filesize\']</code>'; } else { if ($ini_upload_bytes < $max_size_bytes) { $install_errors[] = 'Max. image size (' . $config['max_filesize'] . ') is greater than the value in <code>php.ini</code> (' . format_bytes($ini_upload_bytes) . ')'; } } if (!is_int($config['thumb_width'])) { $install_errors[] = 'Invalid thumb size width in <code>$config[\'thumb_width\']</code>'; } if (!is_int($config['thumb_height'])) { $install_errors[] = 'Invalid thumb size height in <code>$config[\'thumb_height\']</code>'; } if (!is_int($config['min_resize_size']) || $config['min_resize_size'] < 0) { $install_errors[] = 'Invalid minimum resize size in <code>$config[\'min_resize_size\']</code>'; } if (!is_int($config['max_resize_size']) || $config['max_resize_size'] < 0) { $install_errors[] = 'Invalid maximum resize size in <code>$config[\'max_resize_size\']</code>'; } if (is_int($config['min_resize_size']) && is_int($config['max_resize_size']) && $config['min_resize_size'] > $config['max_resize_size']) { $install_errors[] = 'Minimum resize size can\'t be larger than maximum resize size. Please check <code>$config[\'min_resize_size\']</code> and <code>$config[\'max_resize_size\']</code>'; } if (!conditional_config('multiupload')) { $config['multiupload_limit'] = 1; } else { if ($config['multiupload_limit'] <= 0 || $config['multiupload_limit'] == '') { $config['multiupload_limit'] = 0; } } if (!check_value(chevereto_config('file_naming')) || !in_array(chevereto_config('file_naming'), array('original', 'random', 'mixed'))) { $config['file_naming'] = 'original'; } if (!is_numeric($config['multiupload_limit']) && !is_bool($config['multiupload_limit'])) { $install_errors[] = 'Invalid multiupload limit value in <code>$config[\'multiupload_limit\']</code>'; } if ($config['multiupload_limit'] > 100) { $install_errors[] = 'Multiupload limit value can\'t be higher than 100 in <code>$config[\'multiupload_limit\']</code>'; } if ($config['short_url_service'] == 'bitly') { $bitly_status = fetch_url('http://api.bit.ly/v3/validate?x_login='******'short_url_user'] . '&x_apiKey=' . $config['short_url_keypass'] . '&apiKey=' . $config['short_url_keypass'] . '&login='******'short_url_user'] . '&format=json'); $bitly_json = json_decode($bitly_status); if ($bitly_json->data->valid !== 1) { $install_errors[] = 'The <a href="http://bit.ly/" target="_blank">bit.ly</a> user/api is invalid. bitly server says <code>' . $bitly_json->status_txt . '</code>. Please double check your data.'; } } // Facebook comments if (use_facebook_comments() && !check_value($config['facebook_app_id'])) { $install_errors[] = 'You are are trying to use Facebook comments but <code>$config[\'facebook_app_id\']</code> is not setted.'; } // Virtual folders foreach (array('virtual_folder_image', 'virtual_folder_uploaded') as $value) { if (!check_value($config[$value])) { $install_errors[] = '<code>$config[\'' . $value . '\']</code> is not setted.'; } } // Passwords if ($config['user_password'] == $config['admin_password']) { $install_errors[] = 'Admin and user passwords must be different. Please check <code>$config[\'admin_password\']</code> and <code>$config[\'user_password\']</code>'; } // Flood report email? if (check_value($config['flood_report_email']) && !check_email_address($config['flood_report_email'])) { $install_errors[] = 'It appears that <code>$config[\'flood_report_email\']</code> has a invalid email address'; } // Watermark if (conditional_config('watermark_enable')) { define('__CHV_WATERMARK_FILE__', __CHV_ROOT_DIR__ . ltrim($config['watermark_image'], '/')); if (!is_int($config['watermark_margin'])) { $install_errors[] = 'Watermark margin must be integer in <code>$config[\'watermark_margin\']</code>'; } if (!is_int($config['watermark_opacity'])) { $install_errors[] = 'Watermark opacity must be integer in <code>$config[\'watermark_opacity\']</code>'; } if ($config['watermark_opacity'] > 100 or $config['watermark_opacity'] < 0) { $install_errors[] = 'Watermark opacity value out of limis (' . $config['watermark_opacity'] . '). <code>$config[\'watermark_opacity\']</code> must be in the range 0 to 100'; } // Watermark position if (!check_value($config['watermark_position'])) { $config['watermark_position'] = 'center center'; } $watermark_position = explode(' ', strtolower($config['watermark_position'])); if (!isset($watermark_position[1])) { $watermark_position[1] = 'center'; } if (preg_match('/^left|center|right$/', $watermark_position[0])) { $config['watermark_x_position'] = $watermark_position[0]; } else { $install_errors[] = 'Invalid watermark horizontal position in <code>$config[\'watermark_position\']</code>'; } if (preg_match('/^top|center|bottom$/', $watermark_position[1])) { $config['watermark_y_position'] = $watermark_position[1]; } else { $install_errors[] = 'Invalid watermark vertical position in <code>$config[\'watermark_position\']</code>'; } if (!file_exists(__CHV_WATERMARK_FILE__)) { $install_errors[] = 'Watermark image file doesn\'t exists. Please check the path in <code>$config[\'watermark_image\']</code>'; } else { $watermark_image_info = get_info(__CHV_WATERMARK_FILE__); if ($watermark_image_info['mime'] !== 'image/png') { $install_errors[] = 'Watermark image file must be a PNG image in <code>$config[\'watermark_image\']</code>'; } } } // Flood limits $flood_limits = array('minute', 'hour', 'day', 'week', 'month'); $flood_value_error = false; foreach ($flood_limits as $value) { if (!check_value($config['max_uploads_per_' . $value]) || !is_numeric($config['max_uploads_per_' . $value])) { $install_errors[] = 'Invalid config value in <code>$config[\'' . $value . '\']</code>'; $flood_value_error = true; } } if ($flood_value_error == false) { $flood_lower_than = array('minute' => array('hour', 'day', 'week', 'month'), 'hour' => array('day', 'week', 'month'), 'day' => array('week', 'month'), 'week' => array('month')); foreach ($flood_lower_than as $period => $lower_than) { foreach ($lower_than as $value) { if ($config['max_uploads_per_' . $period] >= $config['max_uploads_per_' . $value]) { $install_errors[] = '<code>max_uploads_per_' . $period . '</code> must be lower than <code>max_uploads_per_' . $value . '</code>'; } } } } // dB settings foreach (array('db_host', 'db_name', 'db_user') as $value) { if (!check_value($config[$value])) { $install_errors[] = '<code>$config[\'' . $value . '\']</code>'; } } if (count($install_errors) == 0) { require_once __CHV_PATH_CLASSES__ . 'class.db.php'; $dB = new dB(); if ($dB->dead) { chevereto_die('<code>' . $dB->error . '</code>', 'Database error', array('The system has encountered a error when it try to connect to the database server.', 'Please note this error and if you need help go to <a href="http://chevereto.com/support/">Chevereto support</a>.')); } else { // Check maintenance mode if ($dB->get_option('maintenance') && !defined('SKIP_MAINTENANCE')) { $config['maintenance'] = true; } } } return count($install_errors) == 0 ? true : false; }
echo "Hello, {$arr}, how's it going?"; } } $names = array('Bob', 'Shelly'); hello($names); $current_user = "******"; function is_mike() { //global variable outside of function used in function global $current_user; if ($current_user == 'Mike') { echo '<html>It is Mike </html>'; } else { echo 'It is not Mike'; } } is_mike(); //PHP Function Default Arguments //optional argument = NULL //Check with if statement //default argument = "phrase" function get_info($name, $title = NULL) { if ($title) { echo "<br>{$name} has arrived. {$name} is with us as a {$title}"; } else { echo "<br>{$name} has arrived. Welcome!"; } } get_info('Mike', 'frog');
/** *话题页面 *@date 2010-6-4 *@time 下午03:57:52 */ function thread() { //话题页面 $tid = empty($_REQUEST['id']) ? 0 : intval($_REQUEST['id']); $lou = empty($_REQUEST['lou']) ? 0 : intval($_REQUEST['lou']); $condition = array(); if ($tid) { $condition['topid'] = $tid; } if (empty($condition)) { $this->error('Wrong parameter.'); } $condition['requery'] = '0'; $condition['qid'] = '0'; $pn = 1000; $post = D("Post"); $count = $post->where($condition)->count(); import("ORG.Util.Page"); $page = new Page($count, $pn); $page->config = array('header' => 'Rows', 'prev' => 'Previous', 'next' => 'Next', 'first' => '«', 'last' => '»', 'theme' => ' %nowPage%/%totalPage% %upPage% %downPage% %first% %prePage% %linkPage% %nextPage% %end%'); $this->assign('showpage', $page->show()); $page->config = array('header' => '', 'prev' => '<', 'next' => '>', 'first' => '«', 'last' => '»', 'theme' => '%first% %upPage% %prePage% %linkPage% %nextPage% %downPage% %end%'); $this->assign('showpage_bot', $page->show_img()); $limit = $page->firstRow . ',' . $page->listRows; if ($lou) { $ls = $lou < $pn ? 1 : intval($lou / $pn) * $pn; $limit = $ls . ',' . $page->listRows; } $thread = $post->where($condition)->order("dateline ASC")->limit($limit)->findAll(); $info = $post->where("id={$tid}")->find(); $arr = array(); foreach ($thread as $t) { //获取回复 $arr[$t['id']] = $t; $condition['requery'] = $t['id']; $arr[$t['id']]['_rarr'] = $post->where("requery={$t['id']} or qid={$t['id']}")->order("dateline ASC")->findAll(); //dump($post->getLastSql()); } $this->assign('thread', $arr); $this->assign('info', $info); $ginfo = get_info($info['gid'], '*'); $this->assign('ginfo', $ginfo); $dh = $this->_get_pinfo($ginfo['cat_id']); $this->assign('dh', $dh); $page = array(); $page['title'] = empty($info['title']) ? 'Group Thread - BeingfunChina' : $info['title'] . ' - BeingfunChina'; $page['keywords'] = empty($info['tags']) ? "Group,Thread" : $info['tags']; $page['description'] = empty($info['title']) ? "Groups in BeingfunChina" : $info['title']; $this->assign('page', $page); $this->assign("new_topics", $this->_new_thread($info['gid'])); $this->assign("group", $this->member_group($this->member_thread($tid), "0,6")); $this->display(); }
// All Rights Reserved. See copyright.txt for details and a complete list of authors. // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details. // $Id$ require dirname(__FILE__) . '/svntools.php'; // Perform basic checks info("Verifying..."); if (!isset($_SERVER['argc']) || $_SERVER['argc'] != 3) { error("Missing argument. Expecting tagged version to build increment from and to.\n\nExamples:\n\t2.0 2.2\n\t2.1 2.2"); } $fromVersion = $_SERVER['argv'][1]; $toVersion = $_SERVER['argv'][2]; $from = full("tags/{$fromVersion}"); $to = full("tags/{$toVersion}"); $fromRep = get_info($source); $toRep = get_info($branch); $local = get_info('.'); if (!isset($fromRep->entry)) { error("The origin tag does not exist."); } if (!isset($toRep->entry)) { error("The destination tag does not exist."); } if (!isset($local->entry)) { error("The current folder is not a local copy."); } if (has_uncommited_changes('.')) { error("Local copy contains uncommited changes."); } info("Converting local copy to origin."); `svn switch {$from}`; $tar = "tikiwiki-inc-{$fromVersion}-to-{$toVersion}.tar";
function input_check($gc) { if($gc->f_page == 1){ if(($_POST["purpose_flg"] == "")) { $gc->msg->add("利用目的を選択してください。"); } if(($_POST["chintai_flg"] !="1" && $_POST["sublease_flg"] !="1" && $_POST["relocation_flg"] !="1")) { $gc->msg->add("希望のサービスを少なくとも1つ選択してください。"); } }elseif($gc->f_page == 2){ if(strlen($_POST["buken"]) < 1) { $gc->msg->add("町名を入力してください。"); } if(strlen($_POST["banchi"]) < 1) { $gc->msg->add("番地を入力してください。"); } if($gc->buken_sbt != 3){ if(strlen($_POST["buken_tatemono"]) < 1) { $gc->msg->add("建物名を入力してください。"); } } if($gc->buken_sbt == 1){ if(strlen($_POST["buken_heya"]) < 1) { $gc->msg->add("部屋番号を入力してください。"); } } if(is_numeric($_POST["chikunensu"])){ if(strlen($_POST["chikunensu"]) < 1 and is_numeric($_POST["chikunensu"]) == false) { $gc->msg->add("築年数を入力してください。"); } }else{ $gc->msg->add("築年数は数値を入力してください。"); } if(is_numeric($_POST["input_val"])){ if(strlen($_POST["input_val"]) < 1 and is_numeric($_POST["input_val"]) == false) { $gc->msg->add("延床面積を入力してください。"); } }else{ $gc->msg->add("延床面積は数値を入力してください。"); } if($gc->buken_sbt != 1){ if(is_numeric($_POST["land_val"])){ if(strlen($_POST["land_val"]) < 1 and is_numeric($_POST["land_val"]) == false) { $gc->msg->add("土地面積を入力してください。"); } }else{ $gc->msg->add("土地面積は数値を入力してください。"); } } if($gc->buken_sbt != 2){ if(($_POST["madori_no"] == "")) { $gc->msg->add("間取りを選択してください。"); } } if(($_POST["meigi_no"] == "")) { $gc->msg->add("物件名義を選択してください。"); } if(($_POST["genjyou_no"] == "")) { $gc->msg->add("現況を選択してください。"); } // 手数料を取得する $info = get_info($gc); $gc->rank = $info["rank"]; $gc->tesuryou = $info["tesuryou"]; if($gc->tesuryou > 0){ if($_POST["purpose_flg"] == 1){ //ライトプランプラン会社 get_light_company($gc); if($gc->row_count < 1){ $gc->msg->add("お取扱いする不動産会社が見つかりませんでした。"); } }else{ //スタンダードプラン会社 get_standard_company($gc); if(count($gc->arr_company) < 1){ $gc->msg->add("お取扱いする不動産会社が見つかりませんでした。"); } } } }elseif($gc->f_page == 3){ if(strlen($_POST["lname"].$_POST["fname"]) < 1) { $gc->msg->add("お名前を入力してください。"); } if(strlen($_POST["lname_kn"].$_POST["fname_kn"]) < 1) { $gc->msg->add("フリガナを入力してください。"); } if(strlen($_POST["tel1"].$_POST["tel2"].$_POST["tel3"]) < 1) { $gc->msg->add("電話番号を入力してください。"); } if(strlen($_POST["e_mail"]) < 1) { $gc->msg->add("メールアドレスを入力してください。"); }else{ if(!f_is_valid_email_format($_POST["e_mail"])){ $gc->msg->add("メールアドレスが不正です。"); } } if(!($_POST["sumai_flg"]=="0" or $_POST["sumai_flg"]=="1")) { $gc->msg->add("お住まいの住所を選択してください。"); } if($_POST["sumai_flg"]=="1") { if($_POST["sumai_shikucyouson_no"] < 1) { $gc->msg->add("ご住所(都道府県市区町村)を選択してください。"); } if(strlen($_POST["sumai_banchi"]) < 1) { $gc->msg->add("ご住所(町名・番地)を入力してください。"); } } } if($gc->msg->count > 0){ // エラーがあるので該当ページをセット $gc->disp_page = $gc->f_page; return false; } return true; }