Ejemplo n.º 1
0
 static function getSafeRow($row)
 {
     if ($row->position_id) {
         $position = self::_db()->select_row("select depart_id from qjr_org_position where id = ?", $row->position_id);
         if ($position['depart_id'] != $row->depart_id) {
             $row->position_id = null;
         }
     }
     $_row = array("name" => $row->name, "mobile" => $row->mobile, "tel" => $row->tel, "depart_id" => $row->depart_id, "position_id" => $row->position_id, "role_id" => $row->role_id, "inx" => strtolower(substr(CUtf8_PY::encode($row->name), 0, 1)));
     return $_row;
 }
Ejemplo n.º 2
0
 static function getSaveRow($row, $is_add = true)
 {
     $row = json_decode($row, 1);
     if (empty($row['stf_name'])) {
         _throw("姓名不能为空");
     }
     if (!Utils::is_mobile($row['mobile'])) {
         _throw("手机号不合法");
     }
     $_row = array("stf_name" => $row['stf_name'], "role_id" => empty($row['role_id']) ? null : intval($row['role_id']), "dep_id" => empty($row['dep_id']) ? null : intval($row['dep_id']), "pot_id" => empty($row['pot_id']) ? null : intval($row['pot_id']), "mobile" => empty($row['mobile']) ? null : $row['mobile'], "password" => empty($row['password']) ? null : $row['password'], "py" => \CUtf8_PY::encode($row['stf_name']));
     return array("row" => $_row);
 }
 public static function onGetDefaultSortkey($title, &$sortkey)
 {
     $sortkey = CUtf8_PY::encode($title->getText(), 'all');
     if (empty($sortkey)) {
         //put * here to walk around cases where CUtf8_PY returns an empty string.
         $sortkey = "*";
     }
 }
Ejemplo n.º 4
0
    @mkdir($targetDir);
}
// Create target dir
if (!file_exists($uploadDir)) {
    @mkdir($uploadDir);
}
// Get a file name
if (isset($_REQUEST["name"])) {
    $fileName = $_REQUEST["name"];
} elseif (!empty($_FILES)) {
    $fileName = $_FILES["file"]["name"];
} else {
    $fileName = uniqid("file_");
}
//过滤文件名的非法字符
$fileName = CUtf8_PY::encode($fileName);
//$fileName = substr($fileName, 0, strrpos($fileName, '.'));
$fileName = preg_replace("/[\\|\\?\"\\<\\>\\/\\*\\\\+\\ \\:\\-]/", '', $fileName);
$filePath = $targetDir . DIRECTORY_SEPARATOR . $fileName;
$uploadPath = $uploadDir . DIRECTORY_SEPARATOR . $fileName;
//echo "fileName:";echo $fileName;echo "</br>";
//echo "filePath:";echo $filePath;echo "</br>";
//echo "uploadPath:";echo $uploadPath;echo "</br>";
echo "{$_FILES}:";
print_r($_FILES);
echo "</br>";
// Chunking might be enabled
$chunk = isset($_REQUEST["chunk"]) ? intval($_REQUEST["chunk"]) : 0;
$chunks = isset($_REQUEST["chunks"]) ? intval($_REQUEST["chunks"]) : 1;
// Remove old temp files
if ($cleanupTargetDir) {
Ejemplo n.º 5
0
<?php

include_once 'utf2py.php';
$result = CUtf8_PY::encode('阿里巴巴科技有限公司');
// 拼音简写
echo $result;
echo "------------------------------<br>";
$result2 = CUtf8_PY::encode('阿里巴巴科技有我啊打发到沙发大沙发第三方限公司', "all");
echo $result2;