function index() { //验证权限,跳转提示页面 if (!in_array(parent::visite_access, $this->admin_access)) { http::skip('message/login/forbid'); } //接收请求参数 $category = rq(2); //类型(1,已读/0,未读/全部) $page = rq(3, 1); //页码 //获取删除和回复权限 $del_access = in_array(parent::del_access, $this->admin_access); $reply_access = in_array(parent::reply_access, $this->admin_access); //调用查询模型 $message = self::message_model($category, $page, 10); //处理分页导航 $page_url = dc_url . 'manage/' . $category . '/'; $page_nav = s_page::mark($page_url, $message['info'][0], $page, 3); //视图赋值 $tpl = smarty('admin'); $head['frame'] = '_self'; $head['title'] = '留言管理_EQPHP案例留言本'; $tpl->assign('head', $head); $tpl->assign('del_access', $del_access); $tpl->assign('reply_access', $reply_access); $tpl->assign('rs_count', $message['num']); $tpl->assign('message', $message['info'][1]); $tpl->assign('page_nav', $page_nav); //渲染视图模板 $tpl->display('message/manage'); }
/** * 重置密码 * @return [type] [description] */ public function reset_password() { $token = rq('token'); $done = false; $errors = []; $expire = true; if (!$token) { abort(404); } $log = ILog::where('memo', $token)->first(); if (!$log) { abort(404); } $at = Carbon::parse($log->at); $diff = $at->diffInHours(Carbon::now()); if ($diff < 24) { $expire = false; } if (rq('reset') && Request::method() == 'POST' && !$expire) { $res = $this->reset($token, $log); if ($res['status']) { $done = true; } else { $errors = $res['errors']; } } return view('reset')->with(compact('token', 'log', 'errors', 'done', 'expire')); }
public function doctor($p = null) { if (!he_is('doctor') && !rq()) { return view('page.doctor_login'); } if (rq() && $p == 'login_check') { if (rq('user_type') == 'doctor') { $he = M('doctor')->where('cust_id', rq('cust_id'))->first(); if (!$he) { Session::flash('input_error', ['识别码有误']); return redirect('doctor/login'); } else { log_him_in(['uid' => $he->id]); add_chara(rq('user_type')); return redirect('doctor/home'); } } } $d = []; $appId = env('WECHAT_APPID'); $secret = env('WECHAT_SECRET'); $js = new Js($appId, $secret); $d['js'] = $js; switch ($p) { case 'history': $d['his_history'] = M('doctor')->get_his_history(); break; } return view('page.doctor_' . $p, $d); }
/** * 登入方法 * @param null $input * @return array */ public function login($input = null) { $input = $input ? $input : rq(); if (!empty($input['user_type']) && $input['user_type'] == 'doctor' && !empty($input['cust_id'])) { $d = M('doctor'); $d = $d->where('cust_id', $input['cust_id'])->first(); if ($d) { log_him_in(['uid' => $d->id]); add_chara($input['user_type']); return ss(); } return $d ? ss($d) : ee(2); } if (!empty($input['user_type']) && !empty($input['username']) && !empty($input['password'])) { $input['password'] = hash_password($input['password']); $user = $this->user_exists($input['user_type'], array_only($input, ['username', 'password'])); if ($user) { log_him_in(['username' => $user->username, 'uid' => $user->id]); add_chara($input['user_type']); return ss(); } } else { return ee(2); } return ee(2); }
public function sync($params = '') { $rq = rq(); $fields = ['address' => '', 'helpdeskNumber' => '1234567', "reportedDate" => 201501012020.0, "event" => 'CREATE', "customerName" => "Test Customer", "customerAccountNumber" => "995", "customerHelpdeskNumber" => '', "customerTimezone" => "UTC", "project" => '', "projectNumber" => '', "productSerialNumber" => "SN123123", "productTag" => "Store12Device5", "productSystem" => '', "productDescription" => "POS", "productCustomerSerialnumber" => '', "installedAddress1" => "Heinz-Nixdorf-Ring 1", "installedAddress2" => '', "installedAddress3" => '', "installedAddress4" => '', "installedCity" => "Paderborn", "installedState" => '', "installedPostalcode" => "33106", "installedCountry" => "DE", "installedContact" => '', 'installedPhone' => '', 'installedFax' => '', 'installedEmail' => '', "callerFirstName" => "John", "callerLastName" => "Doe", "callerPhone" => "+49525169330", "callerPhoneType" => "PHONE", "callerEmail" => "*****@*****.**", 'callerPreferredLanguage' => '', 'callerPreferredComm' => '', "errorType" => "Partial Failure", "urgency" => "High", "summary" => "Display does not work", "customerErrorCode" => "ERROR12", 'problemCode' => '', "ordertext1" => "Device does not start and display is black.", "ordertext2" => "Further analysis required.", "customerKey" => "INT_WN", "status" => "New", "channel" => "HTTP", "replyAddress" => "http://customer.com/servlet", "ownerName" => "PL1 AGT IFSO", 'serviceRequestNumber' => '', 'transactionNumber' => '', "targetDate" => "201501031200", 'plannedEndCallback' => '', 'plannedStartFieldService' => '', 'plannedEndFieldService' => '', 'sparepartProposal' => '', 'preferredEngineer' => '', 'ServiceProviderID' => '', 'noteType' => '', 'noteContent' => '']; // 创建 ticket $xml = Formatter::make($fields, Formatter::XML)->toXml(); return Response::make($xml, 200)->header('Content-Type', 'text/xml'); }
/** * 更新 */ public function u($rq = NULL) { $this->guarded = arr_except_vals($this->guarded, ['password']); if (!$rq) { $rq = rq(); } return parent::u($rq); }
public function r() { if (!intval(rq('id'))) { ss('无效ID', 0); } $data = $this->find(rq('id')); $this->eventFire('r', $data); return ss($data); }
public function delete() { $coso = self::$model->firstOrNew(rq('id')); if ($coso->exists) { $coso->update(); } else { } self::response($coso); }
function label_read() { //验证权限,跳转提示页面 if (!in_array(parent::visite_access, $this->admin_access)) { http::skip('login/forbid'); } $message_id = rq(3, 1); $data['is_view'] = 1; db::mod(parent::table, $data, $message_id); http::script(null, 'back_refresh'); }
public function read() { $id = rq('id'); $data = $this->find($id); $res = 0; if ($data->recipientid == uid()) { $data->read = 1; $res = $data->save(); } return ss($res); }
/** * 更新 */ public function u($rq = null) { $this->guarded = arr_except_vals($this->guarded, ['password']); if (!$rq) { $rq = rq(); } if (isset($rq['password'])) { $rq['password'] = hash_password($rq['password']); } return parent::u($rq); }
public function recover() { if (rq('id')) { $row = $this->find(rq('id')); $row->update(['status' => 1, 'wechat_id' => null]); $this->eventFire('recover', $row); return ss($row); } else { ee(2); } }
static function index() { $tpl = smarty(); $head['title'] = 'EQPHP 文件上传(file upload)'; $tpl->assign('head', $head); $lie = 1; $param['type'] = rq($lie); $param['dir'] = rq($lie + 1); $param['id'] = rq($lie + 2); $tpl->assign('up', $param); $tpl->display('plugin/upload'); }
public function c($rq = NULL, $rules = NULL, $messages = NULL) { $rq = rq(); $new = parent::c($rq, $this->createRule); if ($new['status'] == 1) { // 设置 $query = $this->where('robot_id', $rq['robot_id']); $query->update(['recent' => 0]); $query->where('id', $new['d']['id'])->update(['recent' => 1]); } $new['rq'] = $rq; return $new; }
/** * 请求 * @param [type] $ctrl [description] * @param [type] $action [description] * @param string $params [description] * @return [type] [description] */ public function cook($ctrl, $action, $params = '') { // If exists model in univ, use it. if (class_exists(MName($ctrl, 'v')) && !rq('write_data')) { $ins = new M($ctrl, 'v'); } else { if (class_exists(MName($ctrl, 'i'))) { $ins = M($ctrl, 'i'); } else { return ee(2); } } // 权限检查 // 方法调用 是否存在 check guard return call_user_func_array([$ins, $action], explode('/', $params)); }
public function check_signature() { //dd(env('WECHAT_TOKEN')); $rq = rq(); $signature = $rq["signature"]; $timestamp = $rq["timestamp"]; $nonce = $rq["nonce"]; $token = env('WECHAT_TOKEN'); $tmpArr = array($token, $timestamp, $nonce); sort($tmpArr, SORT_STRING); $tmpStr = implode($tmpArr); $tmpStr = sha1($tmpStr); if ($tmpStr == $signature) { return true; } else { return false; } }
/** * 登入方法 * @param null $input * @return array */ public function login($input = null) { $input = $input ? $input : rq(); if (!empty($input['user_type']) && $input['user_type'] == 'doctor' && !empty($input['cust_id'])) { $d = M('doctor'); $d = $d->where('cust_id', $input['cust_id'])->first(); if ($d) { log_him_in(['uid' => $d->id]); add_chara($input['user_type']); return ss(); } return $d ? ss($d) : ee(2); } if (!empty($input['user_type']) && !empty($input['username']) && !empty($input['password'])) { $input['password'] = hash_password($input['password']); $user = $this->user_exists($input['user_type'], array_only($input, ['username', 'password'])); if ($user) { $lifetime = 6000; log_him_in(['username' => $user->username, 'uid' => $user->id], $lifetime); add_chara($input['user_type']); if ($input['user_type'] == 'employee') { sess('permission', $user->permissions); } else { sess('permission', []); } if ($input['user_type'] == 'agency') { sess('org', $user->name); sess('name_in_charge', $user->name_in_charge); } if ($input['user_type'] == 'department') { sess('org', $user->hospital_name . ':' . $user->name); } if ($input['user_type'] == 'employee') { sess('org', $user->name); } // 添加日志 ILog::login($input['user_type'], $user); return ss($user); } } else { return ee(2); } return ee(2); }
/** * 保存设置 * @param [type] $rq [description] * @return [type] [description] */ public function c($rq = NULL) { // add pattern $rq = rq('data'); $res = []; $cache = []; if ($rq) { foreach ($rq as $key => $value) { $item = $this->firstOrNew(['k' => $key]); $item->k = $key; $item->v = $value; $item->save(); $res[] = $item; $cache[$item->k] = $value; } } // reset cache Cache::forever('i_settings', $cache); return ss($res); }
public function auth_leader() { $rq = rq(); $auth_type = $rq['auth_type']; $user_type = $rq['user_type']; $form_vals = $rq['form_vals']; switch ($auth_type) { case 'login': $form_vals['user_type'] = $user_type; return $this->login($form_vals); break; case 'signup': if (!$user_type === 'agency') { return ee(2); } // 开始注册... return M('agency')->c($form_vals); break; } }
/** * 自定义查询 * @return [type] [description] */ public function r() { $builder = $this; if (Input::has('where.start')) { $builder = $builder->where('at', '>', Input::get('where.start')); } if (Input::has('where.end')) { $builder = $builder->where('at', '<', Input::get('where.end')); } if (Input::has('where.memo')) { $builder = $builder->where('memo', 'like', '%' . Input::get('where.memo') . '%'); } $page = rq('pagination') ? rq('pagination') : 1; $per_page = rq('limit') ? rq('limit') : $this->default_limit; $skip = ($page - 1) * $per_page; $count = $builder->count(); $builder = $builder->skip($skip)->take($per_page)->orderBy('at', 'desc'); $data = $builder->get(); return ss(['main' => $data, 'count' => $count, 'per_page' => $per_page, 'start' => Input::get('where.start')]); }
/** * 主方法 * @param [type] $p1 用户类型 * @param [type] $p2 model名 * @return [type] [description] */ public function leader($p1 = null, $p2 = null, $p3 = null) { if (empty($p1)) { return ee(2); } $ins_name = $p1; $action_name = $p2; if (!$this->has_permission($ins_name, $action_name)) { abort(403, d(403)); } // If exists model in univ, use it. if (class_exists(MName($ins_name, 'v')) && !rq('write_data')) { $ins = M($ins_name, 'v'); } else { if (class_exists(MName($ins_name, 'i'))) { $ins = M($ins_name, 'i'); } else { return ee(2, 'ins_not_exists' . MName($ins_name, 'i')); } } return $ins->{$action_name}(); }
$date1 = date('Y-m-d', strtotime('-6 days', strtotime(date('Y-m-d')))); $date2 = date('Y-m-d'); $arr_dates = getDatesBetween($date1, $date2); $conv = rq('conv'); $type = rq('type', 0, 'daily_stats'); $subtype = rq('subtype'); // XSS ОПАСНО!!! //$mode = rq('mode'); $limited_to = rq('limited_to'); $group_by = rq('group_by', 0, $subtype); $part = rq('part', 0, 'all'); $from = rq('from', 4, ''); $to = rq('to', 4, ''); // Нижние кнопки $currency = rq('currency', 0, 'usd'); $col = rq('col', 0, 'act'); if ($params['conv'] == 'lead') { $col == 'leads'; } $option_leads_type = array('act' => 'Все действия', 'sale' => 'Продажи', 'lead' => 'Лиды'); // Проверяем на соответствие существующим типам if (empty($option_leads_type[$col])) { $col = 'act'; } if (empty($option_currency[$currency])) { $currency = 'usd'; } if ($part == 'all') { ?> <style><?php switch ($col) {
/** * 获取关联的医生数据 */ public function getDoctor() { $ret = $this->findOrFail(rq('id'))->doctor; return ss($ret); }
?> > <?php // echo type_subpanel2($params, 'basic', ''); ?> <li class="active"><a href="?act=reports&type=basic">Все</a></li> <li class=""><a href="#" onclick="return refresh_report('range_type||report_period', 'daily||lastweek');">По дням</a></li> <li class=""><a href="#" onclick="return refresh_report('range_type||report_period', 'monthly||lastquarter');">По месяцам</a></li> <li class=""><a href="#" onclick="return refresh_report('range_type', 'hourly');">По часам</a></li> <li class=""><a href="#" onclick="return refresh_report('range_type', 'weekday');">По дням недели</a></li> </ul> </li> <?php $active = $_REQUEST['type'] == 'sales'; $subtype = rq('subtype'); ?> <li <?php if ($active) { echo 'class="active"'; } ?> ><a href="?act=reports&type=sales&subtype=daily">Продажи</a> <ul class="submenu" <?php if ($active) { ?> style="display: block;"<?php } ?> >
/** * */ public function userSignup($event) { $input = rq(); $input['form_vals']['user_type'] = rq('user_type'); return M(rq('user_type'))->login($input['form_vals']); }
/** * Update a kv record or create new kv record * * @param string $kvs * @param string $kv_id * @param string $kName * @param string $vName * * @return array */ function u_($kvs = 'kvs', $kv_id = 'kv_id', $kName = 'k', $vName = 'v') { // dd(rq()); $insName = rq('insName'); $insId = rq('insId'); $k = rq('k'); $v = rq('v'); $tableType = rq('tt'); $ins = M($insName); // dd(rq()); if ($insName && $k && is_string($v) || is_numeric($v)) { if (rq('datatype') === 'date' || rq('datatype') === 'datetime') { $v = \Carbon\Carbon::parse($v); } if (rq('datatype') === 'number') { if (!is_numeric($v)) { return ee(2, 'is_not_numeric'); } } $idName = $kv_id; $insId = rq($kv_id); if ($tableType === 'kv') { // dd($idName, $insId); $idName = 'kv_id'; $ins = M($insName, 'kv')->where($idName, $insId)->firstOrFail(); // dd($ins->toArray()); $ins->{$vName} = $v; $r = $ins->save(); return $r ? ss() : ee('db_insert_failed'); } } else { if ($insId) { } } return ee(2); // $r = $ins->fill($data)->save(); // $ins->touch(); // // if ($r) // return $r ? ss(['id' => $id]) : ee('db_insert_failed'); // dd($ins->toArray()); // $kv = $ins->$kvs() //// ->where(idName('user'), $insId) // ->where(idName('user'), $insId) // ->whereHas('kvs', function($q) use ($data) // { // $q->where($kName, '') // }) // ->firstOrNew($data); // $kv->$vName = $v; // $r = $kv->save(); // }
public function change_password($row = null) { $row = $row ? $row : rq(); $ins = $this->find($row['id']); $ins->password = hash_password($row['password']); $r = $ins->save(); return $r ? ss($r) : ee(1); }
function report_options() { global $group_types; // Дешифруем фильтры $tmp_filters = rq('filter'); $filter = array(0 => array(), 1 => array()); $filter_str = array(); if (!empty($tmp_filters)) { $tmp_filters = explode(';', $tmp_filters); foreach ($tmp_filters as $tmp_filter) { list($k, $v, $type) = explode(':', $tmp_filter); $type = intval($type); if (array_key_exists($k, $group_types)) { $filter[$type][$k] = $v; $filter_str[$k] = $v . ':' . $type; } } } $part = rq('part', 0, 'day'); // Устанавливаем даты по умолчанию switch ($part) { case 'month': $from = date('Y-m-01', strtotime(get_current_day('-6 months'))); $to = date('Y-m-t', strtotime(get_current_day())); break; default: $from = get_current_day('-6 days'); $to = get_current_day(); break; } $group_by = rq('group_by', 0, 'out_id'); $subgroup_by = rq('subgroup_by', 0, $group_by); $conv = rq('conv', 0, 'all'); $mode = rq('mode', 0, ''); $col = rq('col', 0, 'act'); // Если эта группировка уже затронута фильтром - выбираем следующую по приоритету // Примечание: в отчёте по целевым можно не выбирать if ($mode != 'lp') { $i = 0; $group_types_keys = array_keys($group_types); while (!empty($filter) and array_key_exists($group_by, $filter)) { $group_by = $group_types_keys[$i]; $i++; } } /* for($i = 0; empty($filter) or array_key_exists($group_by, $filter); $i++) { $group_by = $group_types_keys[$i]; } */ // Готовим параметры для отдачи $v = array('type' => rq('type', 0, 'basic'), 'part' => rq('part', 0, 'all'), 'filter' => $filter, 'filter_str' => $filter_str, 'group_by' => $group_by, 'subgroup_by' => $subgroup_by, 'conv' => $conv, 'mode' => $mode, 'col' => $col, 'from' => rq('from', 4, $from), 'to' => rq('to', 4, $to), 'no_other' => rq('no_other', 2), 'cache' => (_CLICKS_SPOT_SIZE > 0 and empty($_GET['nocache'])) ? 1 : 0); return $v; }
<?php if (!$include_flag) { exit; } $days = getDatesBetween($from, $to); $group_by = rq('group_by', 0, 'out_id'); $limited_to = rq('limited_to', 2); // При некоторых группировках необходимо искать значения в других таблицах $group_join = array('out_id' => array('offer_name', 'tbl_offers', 'out_id', 'id')); $rows = array(); // все клики за период $data = array(); // сгруппированные данные $parent_clicks = array(); // массив для единичного зачёта дочерних кликов (иначе у нас LP CTR больше 100% может быть) $q = "SELECT " . (empty($group_join[$group_by]) ? mysql_real_escape_string($group_by) : 't2.' . $group_join[$group_by][0]) . " as `name`, t1.*\n\tFROM `tbl_clicks` t1\n\t" . (empty($group_join[$group_by]) ? '' : "LEFT JOIN `" . $group_join[$group_by][1] . "` t2 ON " . $group_join[$group_by][2] . " = t2." . $group_join[$group_by][3]) . "\n\tWHERE t1.`date_add_day` BETWEEN '" . $from . "' AND '" . $to . "'"; $rs = mysql_query($q) or die(mysql_error()); while ($r = mysql_fetch_assoc($rs)) { $rows[$r['id']] = $r; } foreach ($rows as $id => &$r) { // Если группировка по рефереру - обрезаем до домена if ($r['parent_id'] == 0) { $k = $r[$group_by]; $r['out'] = 0; $r['cnt'] = 1; } else { // подчинённая ссылка // не будем считать более одного исходящего с лэндинга $out_calc = isset($parent_clicks[$r['parent_id']]) ? 0 : 1;
Route::any('logout', function () { return M('employee')->logout(); }); Route::any('doctor', function () { if (!is_logged_in()) { return V('page/doctor_login'); } return V('page/doctor_home'); }); //Common routes. Route::any('$/{p1?}/{p2?}/{p3?}', 'CookController@leader'); Route::any('_/{p1?}/{p2?}/{p3?}/{p4?}/{p5?}', 'ShotController@leader'); if (debugging()) { Route::any('c/{ins_name}/{type?}', function ($ins_name, $type = null) { $ins = M($ins_name, $type); $ins->fill(rq()); $ins->save(); }); Route::get('signup/{type}', function ($ins_name) { $ins = M($ins_name); return $ins->c(); }); Route::get('he_is/{p}', function ($chara) { dd(he_is($chara)); }); Route::get('t/{p}/{p2?}', function ($p, $p2 = null) { switch ($p) { case 't': return base_url(); break; case 'cache_in':