本文整理汇总了PHP中MyTextSanitizer::makeTboxData4Save方法的典型用法代码示例。如果您正苦于以下问题:PHP MyTextSanitizer::makeTboxData4Save方法的具体用法?PHP MyTextSanitizer::makeTboxData4Save怎么用?PHP MyTextSanitizer::makeTboxData4Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MyTextSanitizer
的用法示例。
在下文中一共展示了MyTextSanitizer::makeTboxData4Save方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: submit_file
/**
* Add a file to the submission queue
*
* Most of the code in this function has been lifted from the File Management
* plugin's submit.php
*
*/
function submit_file($submitter, $filename, $title, $desc, $version, $homepage, $cid = 0)
{
global $_CONF, $_USER, $_FM_TABLES, $_FMDOWNLOAD, $filemgmt_FileStore;
$myts = new MyTextSanitizer();
// MyTextSanitizer object
$name = basename($filename);
$url = rawurlencode($name);
$name = $myts->makeTboxData4Save($name);
$url = $myts->makeTboxData4Save($url);
if (DB_count($_FM_TABLES['filemgmt_filedetail'], 'url', $name) > 0) {
COM_errorLog("FM submit_file: file '" . $name . "' already exists in DB");
return false;
}
$title = $myts->makeTboxData4Save($title);
$homepage = $myts->makeTboxData4Save($homepage);
$version = $myts->makeTboxData4Save($version);
$size = sprintf('%u', filesize($filename));
$description = $myts->makeTareaData4Save($desc);
//$comments = ($_CONF['comment_code'] == 0) ? 1 : 0;
$comments = 0;
// prefer no comments on Geeklog tarballs
$date = time();
$tmpfilename = randomfilename();
$uploadfilename = basename($filename);
$pos = strrpos($uploadfilename, '.') + 1;
$fileExtension = strtolower(substr($uploadfilename, $pos));
if (array_key_exists($fileExtension, $_FMDOWNLOAD)) {
if ($_FMDOWNLOAD[$fileExtension] == 'reject') {
COM_errorLog("FM submit_file: file extension '" . $fileExtension . "' not allowed.");
return false;
}
$fileExtension = $_FMDOWNLOAD[$fileExtension];
$tmpfilename = $tmpfilename . '.' . $fileExtension;
$pos = strrpos($url, '.') + 1;
$url = strtolower(substr($url, 0, $pos)) . $fileExtension;
} else {
$tmpfilename = $tmpfilename . '.' . $fileExtension;
}
// would have preferred rename (i.e. move), but ran into file permission
// problems on www.geeklog.net ...
copy($filename, $filemgmt_FileStore . 'tmp/' . $tmpfilename);
$logourl = '';
DB_query("INSERT INTO {$_FM_TABLES['filemgmt_filedetail']} (cid, title, url, homepage, version, size, platform, logourl, submitter, status, date, hits, rating, votes, comments) VALUES ('{$cid}', '{$title}', '{$url}', '{$homepage}', '{$version}', '{$size}', '{$tmpfilename}', '{$logourl}', '{$submitter}', 0, '{$date}', 0, 0, 0, '{$comments}')");
$newid = DB_insertId();
DB_query("INSERT INTO {$_FM_TABLES['filemgmt_filedesc']} (lid, description) VALUES ({$newid}, '{$description}')");
return true;
}
示例2: rawurlencode
}
if (isset($_POST['submit']) && SEC_checkToken()) {
if (!COM_isAnonUser()) {
$submitter = (int) $_USER['uid'];
} else {
$submitter = 1;
}
// Check if Title entered
if (!isset($_POST['title']) || $_POST["title"] == '') {
$eh->show("1001");
}
// Check if filename entered
if ($_FILES['newfile']['name'] != '') {
$name = $_FILES['newfile']['name'];
$url = rawurlencode($name);
$name = $myts->makeTboxData4Save($name);
$url = $myts->makeTboxData4Save($url);
} else {
$eh->show("1016");
}
// Check if Description entered
if ($_POST['description'] == '') {
$eh->show("1008");
}
$uploadfilename = $myts->makeTboxData4Save($_FILES['newfile']['name']);
// Check if file is already on file
if (DB_COUNT($_TABLES['filemgmt_filedetail'], 'url', $uploadfilename) > 0) {
$eh->show("1108");
}
if (!empty($_POST['cid'])) {
$cid = (int) COM_applyFilter($_POST['cid'], true);