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


PHP MyTextSanitizer::makeTboxData4Save方法代码示例

本文整理汇总了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;
}
开发者ID:Geeklog-Core,项目名称:tools,代码行数:54,代码来源:submit-local-file.php

示例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);
开发者ID:spacequad,项目名称:glfusion,代码行数:31,代码来源:submit.php


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