public function save() { $token = $this->input->post('token', TRUE); if ($token != $_SESSION['token']) { msg_url(L('edit_02'), 'javascript:history.back();'); } $userinfo['nichen'] = $this->input->post('usernichen', TRUE, TRUE); $userinfo['email'] = $this->input->post('useremail', TRUE, TRUE); $userinfo['tel'] = $this->input->post('usertel', TRUE, TRUE); $userinfo['qq'] = $this->input->post('userqq', TRUE, TRUE); $userinfo['sex'] = intval($this->input->post('usersex')); $userinfo['city'] = $this->input->post('usercity', TRUE, TRUE); $userinfo['qianm'] = $this->input->post('userqianm', TRUE); if (empty($userinfo['nichen']) || !is_username($userinfo['nichen'], 1)) { msg_url(L('edit_03'), 'javascript:history.back();'); } if (empty($userinfo['email']) || !is_email($userinfo['email'])) { msg_url(L('edit_04'), 'javascript:history.back();'); } if (empty($userinfo['tel']) || !is_tel($userinfo['tel'])) { msg_url(L('edit_05'), 'javascript:history.back();'); } if (!empty($userinfo['qq']) && !is_qq($userinfo['qq'])) { msg_url(L('edit_06'), 'javascript:history.back();'); } //判断昵称是否注册 $nichen = $this->db->query("select id from " . CS_SqlPrefix . "user where nichen='" . $userinfo['nichen'] . "' and id!=" . $_SESSION['cscms__id'] . "")->row(); if ($nichen) { msg_url(L('edit_07'), 'javascript:history.back();'); } //判断邮箱是否注册 $email = $this->db->query("select id from " . CS_SqlPrefix . "user where email='" . $userinfo['email'] . "' and id!=" . $_SESSION['cscms__id'] . "")->row(); if ($email) { msg_url(L('edit_08'), 'javascript:history.back();'); } //判断手机是否注册 $tel = $this->db->query("select id from " . CS_SqlPrefix . "user where tel='" . $userinfo['tel'] . "' and id!=" . $_SESSION['cscms__id'] . "")->row(); if ($tel) { msg_url(L('edit_09'), 'javascript:history.back();'); } //修改入库 $this->CsdjDB->get_update('user', $_SESSION['cscms__id'], $userinfo); msg_url(L('edit_10'), 'javascript:history.back();'); }
function calls() { $this->load->library('Asterisk'); $channels = $this->asterisk->get_channels(); $calls = array(); if (empty($channels) !== true) foreach ($channels as &$channel) { if (is_tel(element('CallerIDnum',$channel)) === true) { $calls[] = $channel; } } $console['body'] = $this->load->view('phone/wizard', null, TRUE); $console['body'].= $this->load->view('phone/1_calls', array('data'=>$calls), TRUE); $data['pageTitle'] = 'List'; $data['content']['body'] = $this->load->view('console', $console, true); $data['content']['side'] = $this->load->view('_sidebar', null, true); $this->load->view('main',$data); }
public function save() { //注册开关 if (User_Reg == 0) { msg_url(L('reg_35'), Web_Path); } $userinfo = array(); $token = $this->input->post('token', TRUE); if ($token != $_SESSION['token']) { msg_url(L('reg_02'), 'javascript:history.back();'); } //判断验证码开关 if (User_Code_Mode == 1) { $codes = str_checkhtml($this->input->post('usercode', TRUE)); if (empty($codes) || $this->cookie->get_cookie('codes') != strtolower($codes)) { msg_url(L('reg_03'), 'javascript:history.back();'); } } $userinfo['code'] = random_string('alnum', 6); $userinfo['name'] = $this->input->post('username', TRUE, TRUE); $userinfo['pass'] = $this->input->post('userpass', TRUE, TRUE); $userinfo['nichen'] = $this->input->post('usernichen', TRUE); $userinfo['email'] = $this->input->post('useremail', TRUE, TRUE); $userinfo['tel'] = $this->input->post('usertel', TRUE, TRUE); $userinfo['regip'] = getip(); $userinfo['cion'] = User_Cion_Reg; $userinfo['jinyan'] = User_Jinyan_Reg; $userinfo['addtime'] = time(); $userinfo['yid'] = 0; if ($userinfo['nichen'] == "0") { $userinfo['nichen'] = ''; } if (!is_username($userinfo['name'])) { msg_url(L('reg_04'), 'javascript:history.back();'); } if (!is_userpass($userinfo['pass'])) { msg_url(L('reg_05'), 'javascript:history.back();'); } if (!empty($userinfo['nichen']) && !is_username($userinfo['nichen'], 1)) { msg_url(L('reg_06'), 'javascript:history.back();'); } if (!is_email($userinfo['email'])) { msg_url(L('reg_07'), 'javascript:history.back();'); } //判断保留用户名 $ymext = explode('|', Home_Ymext); if (in_array($userinfo['name'], $ymext)) { msg_url(L('reg_08'), 'javascript:history.back();'); } //判断同一IP注册时间限制 if (User_RegIP > 0) { $row = $this->db->query("SELECT addtime FROM " . CS_SqlPrefix . "user where regip='" . $userinfo['regip'] . "' order by id desc")->row(); if ($row && $row->addtime + 3600 * User_RegIP > time()) { msg_url(L('reg_09'), 'javascript:history.back();'); } } //判断用户名是否注册 $username = $this->CsdjDB->get_row('user', 'id', $userinfo['name'], 'name'); if ($username) { msg_url(L('reg_10'), 'javascript:history.back();'); } //判断邮箱是否注册 $useremail = $this->CsdjDB->get_row('user', 'id', $userinfo['email'], 'email'); if ($useremail) { msg_url(L('reg_11'), 'javascript:history.back();'); } //下面选填字段 $userinfo['qq'] = $this->input->post('userqq', TRUE); $userinfo['sex'] = intval($this->input->post('usersex', TRUE)); $userinfo['city'] = $this->input->post('usercity', TRUE); $userinfo['skins'] = Home_Skins; $userinfo['qianm'] = ''; if (!empty($userinfo['tel'])) { if (!is_tel($userinfo['tel'])) { msg_url(L('reg_12'), 'javascript:history.back();'); } //判断手机号码是否注册 $usertel = $this->CsdjDB->get_row('user', 'id', $userinfo['tel'], 'tel'); if ($usertel) { msg_url(L('reg_13'), 'javascript:history.back();'); } } //判断手机强制验证 if (User_Tel == 1) { if (empty($userinfo['tel'])) { msg_url(L('reg_12'), 'javascript:history.back();'); } $telcode = intval($this->input->post('telcode', TRUE)); if ($telcode == 0 || $telcode != $_SESSION['tel_code']) { msg_url(L('reg_14'), 'javascript:history.back();'); } } //是否需要人工验证 if (User_RegFun == 1) { $userinfo['yid'] = 1; $title = L('reg_15'); } //是否需要邮件验证 if (User_RegEmailFun == 1) { $userinfo['yid'] = 2; $title = L('reg_16', array($userinfo['email'])); } //--------------------------- Ucenter --------------------------- if (User_Uc_Mode == 1) { include CSCMS . 'lib/Cs_Ucenter.php'; include CSCMSPATH . 'uc_client/client.php'; $uid = uc_user_register($userinfo['name'], $userinfo['pass'], $userinfo['email']); if ($uid > 0) { $userinfo['uid'] = $uid; } } //--------------------------- Ucenter End --------------------------- //密码加密 $userinfo['pass'] = md5(md5($userinfo['pass']) . $userinfo['code']); $regid = $this->CsdjDB->get_insert('user', $userinfo); if (intval($regid) == 0) { msg_url(L('reg_17'), 'javascript:history.back();'); } //摧毁token unset($_SESSION['token']); $this->load->model('CsdjEmail'); if (User_RegEmailFun == 1) { //发送激活邮件 $key = md5($regid . $userinfo['name'] . $userinfo['pass'] . $userinfo['yid']); $Msgs['username'] = $userinfo['name']; $Msgs['url'] = userurl(site_url('user/reg/verify')) . "?key=" . $key . "&username="******"user_id", $regid, time() + 86400); $this->cookie->set_cookie("user_login", $user_login, time() + 86400); msg_url(L('reg_21'), userurl(site_url('user/space')), 'ok'); } else { msg_url(L('reg_21') . $title . '~!', userurl(site_url('user/login')), 'ok'); } }
<?=basename($file['name'])?> </a> <em><?=format_filesize($file['size'])?></em> </li> <?php endforeach; ?> </ul> </p> <?php endif; ?> <div> <?php $profile = $this->profile->get($entry['source']) ?> <em>Received from <?php if ($profile->exists()) { echo profile_link($entry['source']); } elseif (is_tel($entry['source']) === true) { echo tel_format($entry['source']); } else { echo $entry['source']; } ?> <?=date_relative(strtotime($entry['timestamp']))?>.</em> </div> </div> </div> <?php if ($entry['type']=='phone' && is_array($entry['cdr'])) : ?> <div class="body mid entry phonedata"> <ul> <li><strong>Call Detail Record</strong></li>
function qrcode($qrcode_file, $qrcode_content, $qrcode_logo = '', $qrcode_width = 100, $qrcode_height = 100, $qrcode_type = 'auto') { import('@.Org.QRcode'); //import 为Thinkphp内置,使用其它框架请换成: include_once $qrcode_path = SITE_DIR . $qrcode_file; $size = round($qrcode_width / 25); //QRcode size计算 if ($size <= 0) { $size = 1; } if (!$qrcode_type or $qrcode_type = 'auto') { if (is_url($qrcode_content)) { $qrcode_type = 'url'; } else { if (is_mobile($qrcode_content) or is_tel($qrcode_content)) { $qrcode_type = 'tel'; } else { $qrcode_type = 'text'; } } } if (!in_array($qrcode_type, array('url', 'tel', 'text'))) { $qrcode_type = 'text'; } if ($qrcode_type == 'url') { $qrcode_content = htmlspecialchars_decode($qrcode_content); \QRcode::png($qrcode_content, $qrcode_path, 'L', $size, 2); //'url:'. //加上后 微信中不能打开 } else { if ($qrcode_type == 'tel') { \QRcode::png($qrcode_content, $qrcode_path, 'L', $size, 2); //'tel:'. } else { \QRcode::png($qrcode_content, $qrcode_path, 'L', $size, 2); } } if ($qrcode_logo) { //$qrcode_logo 处理网络图片 $logo = file_get_contents($qrcode_logo); //SITE_DIR.'Uploads/logo.png';//准备好的logo图片 if ($logo !== FALSE) { $QR = imagecreatefromstring(file_get_contents($qrcode_path)); $logo = imagecreatefromstring($logo); $QR_width = $qrcode_width; //imagesx($QR);//二维码图片宽度 $QR_height = $qrcode_height; //imagesy($QR);//二维码图片高度 $logo_width = imagesx($logo); //logo图片宽度 $logo_height = imagesy($logo); //logo图片高度 $logo_qr_width = $QR_width / 5; $scale = $logo_width / $logo_qr_width; $logo_qr_height = $logo_height / $scale; $from_width = ($QR_width - $logo_qr_width) / 2; //重新组合图片并调整大小 imagecopyresampled($QR, $logo, $from_width, $from_width, 0, 0, $logo_qr_width, $logo_qr_height, $logo_width, $logo_height); } //输出图片 imagepng($QR, $qrcode_path); } return true; }
function us10digit ($str) { $str = tel_convert_vanity($str); $str = preg_replace('/[^\d]/','', $str); if (is_tel(substr($str,-10))) { return substr($str,-10); } else { $this->form_validation->set_message('us10digit', 'The %s field must contain a 10-digit US fax number.'); return false; } }
protected function validate($key,$value) { switch($key) { case 'type': return true; break; case 'label': return true; break; case 'tel': if(is_tel($value)) { return true; } else { User_Notice::error($value.' is not a valid US or international phone number.'); } break; default: return false; break; } }