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


PHP Common类代码示例

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


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

示例1: _is_auth_success

 /**
  * [_is_auth_success 验证权限是否成功]
  * @param  [type]  $auths [description]
  * @return boolean        [description]
  */
 private function _is_auth_success($auths)
 {
     $route = Common::get_route();
     //需权限
     if (array_key_exists($route, $auths)) {
         $user = isset($_SESSION[$this->login_in_session_name]) ? $_SESSION[$this->login_in_session_name] : NULL;
         $user_role = isset($user['role']) ? $user['role'] : NULL;
         //有权限
         if (strstr($auths[$route], "|{$user_role}|")) {
             return TRUE;
         } else {
             //有登录权限
             if (strstr($auths[$route], "|1|")) {
                 //已登录
                 if (!empty($user)) {
                     return TRUE;
                 } else {
                     $this->error->output('NOTLOGIN_ERROR', array('script' => 'swal({title: "请登录后再进行操作",type: "warning",showCancelButton: true,confirmButtonColor: "#DD6B55",confirmButtonText: "注册/登录",closeOnConfirm: false},function () {showsign();});'));
                 }
             }
             //没有权限
             $this->error->output('NOAUTH_ERROR', array('script' => 'window.location.href ="' . base_url() . '";'));
         }
     } else {
         return TRUE;
     }
 }
开发者ID:897475686,项目名称:vc,代码行数:32,代码来源:auth_service.php

示例2: tinlienquan

 function tinlienquan($idtloai, $datatin = null, $idtin = null)
 {
     $where = " ";
     if (isset($idtin)) {
         $where = " AND id_tintuc<>" . $idtin;
     }
     $datatin = isset($datatin) ? $datatin : null;
     $nd = new Common();
     $output = '<div class="clear more left">';
     $output .= '<div class="tinthem left"><div class="left iconleft"></div>MORE</div>';
     $data = $nd->query("SELECT tieude,id_tintuc,ngaythang, solanxem,id_theloai FROM tbltintucs WHERE id_theloai=" . $idtloai . " " . $where . "  ORDER BY ngaythang DESC LIMIT 0,5");
     foreach ($data as $item) {
         if (!$this->checkDisplay($item, $datatin)) {
             $id_tintuc = $item['tbltintucs']['id_tintuc'];
             $tieude = $item['tbltintucs']['tieude'];
             $date = $item['tbltintucs']['ngaythang'];
             $d = getdate(strtotime($date));
             $ngay = $d['mday'] . '/' . $d['mon'] . '/' . $d['year'];
             $solanxem = $item['tbltintucs']['solanxem'];
             $tt = $item['tbltintucs']['tieude'];
             $output .= '<div class="left"><span class="icontin"></span>' . $this->link($tt, array('controller' => 'Tbltintucs', 'action' => 'view', $item['tbltintucs']['id_tintuc'])) . "<p style='margin-left:10px;'><span class='bitsmall'>({$ngay})</span><span class='bitsmall'>({$solanxem} lần xem)</span></p></div>";
         }
     }
     $output .= '</div>';
     return $output;
 }
开发者ID:duyhn,项目名称:learnlaw,代码行数:26,代码来源:ContentnewsHelper.php

示例3: actionUpload

 /**
  * 上传图片
  */
 public function actionUpload()
 {
     $Common = new Common();
     $fn = $_GET['CKEditorFuncNum'];
     $url = $Common->getCompleteUrl();
     $imgTypeArr = $Common->getImageTypes();
     if (!in_array($_FILES['upload']['type'], $imgTypeArr)) {
         echo '<script type="text/javascript">
             window.parent.CKEDITOR.tools.callFunction("' . $fn . '","","图片格式错误!");
             </script>';
     } else {
         $projectPath = Wave::app()->projectPath;
         $uploadPath = $projectPath . 'data/uploadfile/substance';
         if (!is_dir($uploadPath)) {
             mkdir($uploadPath, 0777);
         }
         $ym = $Common->getYearMonth();
         $uploadPath .= '/' . $ym;
         if (!is_dir($uploadPath)) {
             mkdir($uploadPath, 0777);
         }
         $imgType = strtolower(substr(strrchr($_FILES['upload']['name'], '.'), 1));
         $imageName = time() . '_' . rand() . '.' . $imgType;
         $file_abso = $url . '/data/uploadfile/substance/' . $ym . '/' . $imageName;
         $SimpleImage = new SimpleImage();
         $SimpleImage->load($_FILES['upload']['tmp_name']);
         $SimpleImage->resizeToWidth(800);
         $SimpleImage->save($uploadPath . '/' . $imageName);
         echo '<script type="text/javascript">
             window.parent.CKEDITOR.tools.callFunction("' . $fn . '","' . $file_abso . '","上传成功");
             </script>';
     }
 }
开发者ID:mamtou,项目名称:wavephp,代码行数:36,代码来源:UsersController.php

示例4: groupsLdap

 function groupsLdap($param)
 {
     $ldap_host = $GLOBALS['phpgw_info']['server']['ldap_host'];
     $ldap_root_dn = $GLOBALS['phpgw_info']['server']['ldap_root_dn'];
     $ldap_root_pw = $GLOBALS['phpgw_info']['server']['ldap_root_pw'];
     $ldap_context = $GLOBALS['phpgw_info']['server']['ldap_context'];
     $result_groups = '';
     //Organizations Ldap
     $organization = 'ou=' . $param . "," . $ldap_context;
     if ($param == $ldap_context) {
         $organization = $ldap_context;
     }
     //Commons Functions
     $common = new Common();
     // Ldap Connection
     $ldap = $common->ldapConnect($ldap_host, $ldap_root_dn, $ldap_root_pw);
     if ($ldap) {
         $filter = "(&(phpgwAccountType=g)(cn=grupo*-im))";
         $justthese = array("cn", "gidNumber");
         $search = ldap_search($ldap, $organization, $filter, $justthese);
         $entry = ldap_get_entries($ldap, $search);
         if ($entry) {
             foreach ($entry as $tmp) {
                 if ($tmp['gidnumber'][0] != "") {
                     $result_groups[] = $tmp['cn'][0] . ";" . $tmp['gidnumber'][0];
                 }
             }
         }
         natsort($result_groups);
     }
     return $result_groups;
 }
开发者ID:cjvaz,项目名称:expressomail,代码行数:32,代码来源:functionsMessenger.inc.php

示例5: getConfirmPassword

function getConfirmPassword()
{
    $COMMON = new Common($debug);
    $sql = "SELECT * FROM `Proj2Advisors` WHERE `New` = 'true'";
    $rs = $COMMON->executeQuery($sql, "Advising Appointments");
    $row = mysql_fetch_row($rs);
    return $row[5];
}
开发者ID:mtjacks,项目名称:Project2,代码行数:8,代码来源:GetAdvisorData.php

示例6: getAdvisor

function getAdvisor()
{
    $COMMON = new Common($debug);
    $sID = $_SESSION["studID"];
    $sql = "select * from Proj2Students where `StudentID` = '{$sID}'";
    $rs = $COMMON->executeQuery($sql, $_SERVER["SCRIPT_NAME"]);
    $row = mysql_fetch_row($rs);
    return $row[7];
}
开发者ID:mtjacks,项目名称:Project2,代码行数:9,代码来源:GetStudentData.php

示例7: insertdata

 public function insertdata($url)
 {
     $common_obj = new Common();
     $set = array(CURLOPT_URL => "{$url}", CURLOPT_RETURNTRANSFER => true);
     $ch = curl_init();
     curl_setopt_array($ch, $set);
     $data1 = curl_exec($ch);
     $pattern = '/<li>(.*?)<\\/li>/is';
     preg_match_all($pattern, $data1, $str);
     $strall = $str[0];
     $listparse = parse_url($url);
     foreach ($strall as $k => $v) {
         preg_match('/<a href="(.*?)">(.*?)<\\/a><\\/div>/is', $v, $title);
         $conurl = parse_url($title[1]);
         if ($courl['scheme'] == null) {
             $scheme = 'http://';
         }
         if ($courl['host'] == null) {
             $host = $listparse['host'];
         }
         if ($courl['path'] == null) {
             $path = $listparse['path'];
         }
         $conquery = '?' . $conurl['query'];
         $contenturl = trim($scheme . $host . $path . $conquery);
         $md5url = md5("{$contenturl}");
         $csql = "select urlmd5 from " . DB_PREFIX . "gather where urlmd5='" . $md5url . "'";
         $query = $this->db->query($csql);
         $checkurl = $this->db->fetch_array($query);
         if ($checkurl) {
             continue;
         }
         //内容页preg
         curl_setopt($ch, CURLOPT_URL, $contenturl);
         $href_content = curl_exec($ch);
         preg_match('/<\\!\\-\\- m2o content start \\-\\->(.*?)<\\!\\-\\- m2o content end \\-\\->/is', $href_content, $maincontent);
         preg_match('/<div class="brief">(.*?)<\\/div>/is', $v, $brief);
         preg_match('/<div class="pubdate">(.*?)<\\/div>/is', $v, $pubdate);
         preg_match('/<div class="subtitle">(.*?)<\\/div>/is', $v, $subtitle);
         preg_match('/<div class="keywords">(.*?)<\\/div>/is', $v, $keywords);
         preg_match('/<div class="author">(.*?)<\\/div>/is', $v, $author);
         preg_match('/<img src="(.*?)" class="indexpic"\\/>/is', $v, $indexpic);
         $arr = array('title' => $title[2], 'brief' => $brief[1], 'pubdate' => $pubdate[1], 'subtitle' => $subtitle[1], 'keywords' => $keywords[1], 'author' => $author[1], 'indexpic' => $indexpic[1], 'content' => $maincontent[1], 'source_url' => $contenturl);
         $resultdata[] = array_reverse($arr);
     }
     foreach ($resultdata as $key => $value) {
         $common_obj->post_datagather($value, $this->sort_id);
         //更新接入状态
         $urlstatus = array('urlmd5' => md5($contenturl), 'url' => $contenturl, 'is_publish' => 1, 'title' => $title[2], 'create_time' => TIMENOW);
         $this->updata->creategather($urlstatus);
     }
     curl_close($ch);
     return TRUE;
 }
开发者ID:h3len,项目名称:Project,代码行数:54,代码来源:insertgather.class.php

示例8: getStudent

 function getStudent()
 {
     $debug = false;
     $COMMON = new Common($debug);
     //Use this as base for student access method
     $sql = "select * from Proj2Students where `StudentID` = '{$this->ID}'";
     $rs = $COMMON->executeQuery($sql, $_SERVER["SCRIPT_NAME"]);
     $studRow = mysql_fetch_row($rs);
     return $studRow;
     //end
 }
开发者ID:vschembari,项目名称:Project2,代码行数:11,代码来源:StudentAccess.php

示例9: modify_settings

 public static function modify_settings($settings)
 {
     $Common = new Common();
     $settings_filename = '../require/settings.php';
     $content = file_get_contents($settings_filename);
     $fh = fopen($settings_filename, 'w');
     foreach ($settings as $settingname => $value) {
         if ($value == 'TRUE' || $value == 'FALSE') {
             $pattern = '/\\$' . $settingname . " = " . '(TRUE|FALSE)' . "/";
             $replace = '\\$' . $settingname . " = " . $value . "";
         } elseif (is_array($value)) {
             $pattern = '/\\$' . $settingname . " = array\\(" . '(.*)' . "\\)/";
             if ($Common->isAssoc($value)) {
                 foreach ($value as $key => $data) {
                     if (!isset($array_value)) {
                         $array_value = "'" . $key . "' => '" . $data . "'";
                     } else {
                         $array_value .= ",'" . $key . "' => '" . $data . "'";
                     }
                 }
             } else {
                 foreach ($value as $data) {
                     if (!isset($array_value)) {
                         $array_value = "'" . $data . "'";
                     } else {
                         $array_value .= ",'" . $data . "'";
                     }
                 }
             }
             if (!isset($array_value)) {
                 $array_value = '';
             }
             $replace = '\\$' . $settingname . " = array(" . $array_value . ")";
             unset($array_value);
         } else {
             $pattern = '/\\$' . $settingname . " = '" . '(.*)' . "'/";
             $replace = '\\$' . $settingname . " = '" . $value . "'";
         }
         $rep_cnt = 0;
         $content = preg_replace($pattern, $replace, $content, 1, $rep_cnt);
         /// If setting was a string and is now an array
         if ($rep_cnt == 0 && is_array($value)) {
             $pattern = '/\\$' . $settingname . " = '" . '(.*)' . "'/";
             $content = preg_replace($pattern, $replace, $content, 1, $rep_cnt);
         }
         // If setting is not in settings.php (for update)
         if ($rep_cnt == 0) {
             $content = preg_replace('/\\?>/', $replace . ";\n?>", $content, 1, $rep_cnt);
         }
     }
     fwrite($fh, $content);
     fclose($fh);
 }
开发者ID:sysrun,项目名称:FlightAirMap,代码行数:53,代码来源:class.settings.php

示例10: __construct

 function __construct()
 {
     global $db, $common, $config;
     // connect to db
     $db = new Database();
     // get an instance of the other classes
     $common = new Common();
     // run under certain conditions
     $common->checkPaths();
     // see if all this is an authorized use of the script
     $this->checkSession();
     // load some html parts we are going to use
     require 'admin/php/content.php';
 }
开发者ID:CoryZ40,项目名称:templateblocks,代码行数:14,代码来源:Admin.php

示例11: execute

 public function execute()
 {
     GWF_Website::plaintext();
     GWF3::setConfig('store_last_url', false);
     $lat = $this->module->lat();
     $lon = $this->module->lon();
     $descr = trim(Common::getGetString('pp_descr'));
     $descr = $descr === '' ? null : $descr;
     $id = Common::getGetInt('pp_id', 0);
     $user = GWF_User::getStaticOrGuest();
     $uid = $user->getID();
     if (!GWF_ProfilePOI::changeAllowed($id, $uid)) {
         $this->module->ajaxError('Permission error!');
     }
     $count = $id === 0 ? GWF_ProfilePOI::getPOICount($uid) : 0;
     $max_pois = $this->module->cfgAllowedPOIs();
     if ($count >= $max_pois) {
         $this->module->ajaxErr('err_poi_exceed');
     }
     $poi = new GWF_ProfilePOI(array('pp_id' => $id, 'pp_uid' => $uid, 'pp_lat' => $lat, 'pp_lon' => $lon, 'pp_descr' => $descr));
     $poi->replace();
     $data = $poi->getGDOData();
     $data['user_name'] = $user->getVar('user_name');
     die(json_encode($data));
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:25,代码来源:POISAdd.php

示例12: execute

 public function execute()
 {
     if (false === Common::isFile(GWF_GESHI_PATH)) {
         return '';
         // FIXME: {gizmore} log it? GESHI_PATH is may not readable
     }
     require_once GWF_GESHI_PATH;
     $geshi = new GeSHi();
     $langs = $geshi->get_supported_languages(false);
     $key = htmlspecialchars(Common::getGetString('key', ''), ENT_QUOTES);
     sort($langs);
     //		$this->niceArray($langs, false, '-------')
     $this->niceArray($langs, 'python', 'Python');
     $this->niceArray($langs, 'perl', 'Perl');
     $this->niceArray($langs, 'cpp', 'CPP');
     $this->niceArray($langs, 'php', 'PHP');
     $back = $this->module->lang('th_lang') . ':' . PHP_EOL;
     $back .= '<select id="bb_code_lang_sel_' . $key . '">' . PHP_EOL;
     $back .= '<option value="0">' . $this->module->lang('th_lang') . '</option>' . PHP_EOL;
     foreach ($langs as $lang) {
         $back .= sprintf('<option value="%s">%s</option>', $lang, $lang) . PHP_EOL;
     }
     $back .= '</select>' . PHP_EOL;
     $back .= $this->module->lang('th_title') . ': <input type="text" id="bb_code_title_' . $key . '" size="20" value="" />' . PHP_EOL;
     $back .= '<input type="submit" value="' . $this->module->lang('btn_code') . '" onclick="return bbInsertCodeNow(\'' . $key . '\');" />' . PHP_EOL;
     return $back;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:27,代码来源:CodeLangs.php

示例13: create

 public function create($mundane_id)
 {
     if (trimlen($this->request->Action) > 0) {
         $this->request->save('Unit_create', true);
         if (!isset($this->session->user_id)) {
             header('Location: ' . UIR . 'Login/login/Unit/create/' . $mundane_id);
         } else {
             if ($_FILES['Heraldry']['size'] > 0 && Common::supported_mime_types($_FILES['Heraldry']['type'])) {
                 if (move_uploaded_file($_FILES['Heraldry']['tmp_name'], DIR_TMP . sprintf("um_%05d", $mundane_id))) {
                     $h_im = file_get_contents(DIR_TMP . sprintf("um_%05d", $mundane_id));
                     $h_imdata = base64_encode($h_im);
                 } else {
                     $Status = ['Status' => 1000, 'Error' => 'File IO Error', 'Detail' => 'File could not be moved to .../tmp'];
                 }
             }
             $r = $this->Unit->create_unit(['Heraldry' => $h_imdata, 'HeraldryMimeType' => $_FILES['Heraldry']['type'], 'Name' => $this->request->Unit_create->Name, 'Type' => $this->request->Unit_create->Type, 'Description' => $this->request->Unit_create->Description, 'History' => $this->request->Unit_create->History, 'Url' => $this->request->Unit_create->Url, 'Token' => $this->session->token, 'MundaneId' => $mundane_id]);
             if ($r['Status'] == 0) {
                 $this->request->clear('Unit_create');
                 header('Location: ' . UIR . 'Unit/index/' . $r['Detail']);
             } else {
                 if ($r['Status'] == 5) {
                     header('Location: ' . UIR . 'Login/login/Unit/create/' . $mundane_id);
                 } else {
                     $this->data['Error'] = $r['Error'] . ':<p>' . $r['Detail'];
                 }
             }
         }
     }
     if ($this->request->exists('Unit_create')) {
         $this->data['Unit_create'] = $this->request->Unit_create->Request;
     }
     $this->data['MundaneId'] = $mundane_id;
 }
开发者ID:jfefes,项目名称:ORK3,代码行数:33,代码来源:Unit.php

示例14: execute

 public function execute()
 {
     return $_SERVER['REMOTE_ADDR'];
     $ip = Common::getGetString('ip', false);
     $type = Common::getGetString('type', GWF_IP6::INT_32);
     return GWF_IP6::getIP($type, $ip);
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:7,代码来源:GetIP.php

示例15: payNotice

 public function payNotice($params = array(), $slave_url)
 {
     $output = Common::httpRequest($slave_url, $params, 'post');
     echo $output;
     Common::logGameResponse($slave_url . '|' . $output);
     exit;
 }
开发者ID:wangchong-fly123,项目名称:Platform,代码行数:7,代码来源:PayNoticeService.php


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