本文整理汇总了PHP中CValue::POST方法的典型用法代码示例。如果您正苦于以下问题:PHP CValue::POST方法的具体用法?PHP CValue::POST怎么用?PHP CValue::POST使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CValue
的用法示例。
在下文中一共展示了CValue::POST方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doStore
/**
* @see parent::doStore()
*/
function doStore()
{
$upload = null;
if (CValue::POST("_from_yoplet") == 1) {
/** @var CFile $obj */
$obj = $this->_obj;
$array_file_name = array();
$path = CAppUI::conf("dPfiles yoplet_upload_path");
if (!$path) {
$path = "tmp";
}
// On retire les backslashes d'escape
$file_name = stripslashes($this->request['_file_path']);
// Récupération du nom de l'image en partant de la fin de la chaîne
// et en rencontrant le premier \ ou /
preg_match('@[\\\\/]([^\\\\/]*)$@i', $file_name, $array_file_name);
$file_name = $array_file_name[1];
$extension = strrchr($file_name, '.');
$_rename = $this->request['_rename'] ? $this->request['_rename'] : 'upload';
$file_path = "{$path}/" . $this->request['_checksum'];
$obj->file_name = $_rename == 'upload' ? $file_name : $_rename . $extension;
$obj->_old_file_path = $this->request['_file_path'];
$obj->doc_size = filesize($file_path);
$obj->author_id = CAppUI::$user->_id;
if (CModule::getActive("cda")) {
$obj->type_doc = $this->request["type_doc"];
}
$obj->fillFields();
$obj->updateFormFields();
$obj->file_type = CMbPath::guessMimeType($file_name);
if ($msg = $obj->store()) {
CAppUI::setMsg($msg, UI_MSG_ERROR);
} else {
$obj->forceDir();
$obj->moveFile($file_path);
}
return parent::doStore();
}
$_file_category_id = CValue::post("_file_category_id");
$language = CValue::post("language");
$type_doc = CValue::post("type_doc");
$named = CValue::post("named");
$rename = CValue::post("_rename");
CValue::setSession("_rename", $rename);
if (isset($_FILES["formfile"])) {
$aFiles = array();
$upload =& $_FILES["formfile"];
foreach ($upload["error"] as $fileNumber => $etatFile) {
if (!$named) {
$rename = $rename ? $rename . strrchr($upload["name"][$fileNumber], '.') : "";
}
if ($upload["name"][$fileNumber]) {
$aFiles[] = array("_mode" => "file", "name" => $upload["name"][$fileNumber], "type" => CMbPath::guessMimeType($upload["name"][$fileNumber]), "tmp_name" => $upload["tmp_name"][$fileNumber], "error" => $upload["error"][$fileNumber], "size" => $upload["size"][$fileNumber], "language" => $language, "type_doc" => $type_doc, "file_category_id" => $_file_category_id, "object_id" => CValue::post("object_id"), "object_class" => CValue::post("object_class"), "_rename" => $rename);
}
}
// Pasted images, via Data uri
if (!empty($_POST["formdatauri"])) {
$data_uris = $_POST["formdatauri"];
$data_names = $_POST["formdatauri_name"];
foreach ($data_uris as $fileNumber => $fileContent) {
$parsed = $this->parseDataUri($fileContent);
$_name = $data_names[$fileNumber];
if (!$named) {
$ext = strrchr($_name, '.');
if ($ext === false) {
$ext = "." . substr(strrchr($parsed["mime"], '/'), 1);
$_name .= $ext;
}
$rename = $rename ? $rename . $ext : "";
}
$temp = tempnam(sys_get_temp_dir(), "up_");
file_put_contents($temp, $parsed["data"]);
if ($data_names[$fileNumber]) {
$aFiles[] = array("_mode" => "datauri", "name" => $_name, "type" => $parsed["mime"], "tmp_name" => $temp, "error" => 0, "size" => strlen($parsed["data"]), "language" => $language, "type_doc" => $type_doc, "file_category_id" => $_file_category_id, "object_id" => CValue::post("object_id"), "object_class" => CValue::post("object_class"), "_rename" => $rename);
}
}
}
$merge_files = CValue::post("_merge_files");
if ($merge_files) {
$pdf = new CMbPDFMerger();
$this->_obj = new $this->_obj->_class();
/** @var CFile $obj */
$obj = $this->_obj;
$file_name = "";
$nb_converted = 0;
foreach ($aFiles as $key => $file) {
$converted = 0;
if ($file["error"] == UPLOAD_ERR_NO_FILE) {
continue;
}
if ($file["error"] != 0) {
CAppUI::setMsg(CAppUI::tr("CFile-msg-upload-error-" . $file["error"]), UI_MSG_ERROR);
continue;
}
// Si c'est un pdf, on le rajoute sans aucun traitement
if (substr(strrchr($file["name"], '.'), 1) == "pdf") {
$file_name .= substr($file["name"], 0, strpos($file["name"], '.'));
//.........这里部分代码省略.........