本文整理汇总了PHP中cmsCore::fileDownloadCount方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsCore::fileDownloadCount方法的具体用法?PHP cmsCore::fileDownloadCount怎么用?PHP cmsCore::fileDownloadCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmsCore
的用法示例。
在下文中一共展示了cmsCore::fileDownloadCount方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDownLoadLink
function getDownLoadLink($file){
$file = preg_replace('/\.+\//', '', trim($file));
$file = htmlspecialchars($file);
$filefull = PATH.$file;
global $_LANG;
if (file_exists($filefull)){
$downloaded = cmsCore::fileDownloadCount($file);
$filesize = round(filesize($filefull)/1024, 2);
$link = '<span class="filelink">';
$link .= '<a href="/load/url=-'.base64_encode($file).'" alt="'.$_LANG['FILE_DOWNLOAD'].'">'.basename($file).'</a> ';
$link .= '<span>| '.$filesize.' '.$_LANG['SIZE_KB'].'</span> ';
$link .= '<span>| '.$_LANG['FILE_DOWNLOADED'].': '.cmsCore::spellCount($downloaded, $_LANG['TIME1'], $_LANG['TIME2'], $_LANG['TIME1']).'</span>';
$link .= '</span>';
} else {
$link = $_LANG['FILE'].' "'.$file.'" '.$_LANG['NOT_FOUND'];
}
return $link;
}
示例2: increaseDownloadCount
public function increaseDownloadCount($fileurl)
{
$downloads = cmsCore::fileDownloadCount($fileurl);
if ($downloads == 0) {
$sql = "INSERT INTO cms_downloads (fileurl, hits) VALUES ('{$fileurl}', '1')";
} else {
$sql = "UPDATE cms_downloads SET hits = hits + 1 WHERE fileurl = '{$fileurl}'";
}
$this->inDB->query($sql);
return true;
}
示例3: files
function files()
{
$inDB = cmsDatabase::getInstance();
global $_LANG;
$do = cmsCore::getInstance()->do;
//============================================================================//
// Скачивание
if ($do == 'view') {
$fileurl = cmsCore::request('fileurl', 'str', '');
if (!$fileurl) {
cmsCore::error404();
}
$fileurl = mb_strpos($fileurl, '-') === 0 ? htmlspecialchars_decode(base64_decode(ltrim($fileurl, '-'))) : $fileurl;
if (mb_strstr($fileurl, '..')) {
cmsCore::error404();
}
if (mb_strstr($fileurl, 'http:/')) {
if (!mb_strstr($fileurl, 'http://')) {
$fileurl = str_replace('http:/', 'http://', $fileurl);
}
}
$downloads = cmsCore::fileDownloadCount($fileurl);
if ($downloads == 0) {
$sql = "INSERT INTO cms_downloads (fileurl, hits) VALUES ('{$fileurl}', '1')";
$inDB->query($sql);
} else {
$sql = "UPDATE cms_downloads SET hits = hits + 1 WHERE fileurl = '{$fileurl}'";
$inDB->query($sql);
}
if (mb_strstr($fileurl, 'http:/')) {
cmsCore::redirect($fileurl);
}
if (file_exists(PATH . $fileurl)) {
header('Content-Disposition: attachment; filename=' . basename($fileurl) . "\n");
header('Content-Type: application/x-force-download; name="' . $fileurl . '"' . "\n");
header('Location:' . $fileurl);
cmsCore::halt();
} else {
cmsCore::halt($_LANG['FILE_NOT_FOUND']);
}
}
//============================================================================//
if ($do == 'redirect') {
$url = str_replace(array('--q--', ' '), array('?', '+'), cmsCore::request('url', 'str', ''));
if (!$url) {
cmsCore::error404();
}
$url = mb_strpos($url, '-') === 0 ? htmlspecialchars_decode(base64_decode(ltrim($url, '-'))) : $url;
if (mb_strstr($url, '..')) {
cmsCore::error404();
}
if (mb_strstr($url, 'http:/')) {
if (!mb_strstr($url, 'http://')) {
$url = str_replace('http:/', 'http://', $url);
}
}
if (mb_strstr($url, 'https:/')) {
if (!mb_strstr($url, 'https://')) {
$url = str_replace('https:/', 'https://', $url);
}
}
// кириллические домены
$url_host = parse_url($url, PHP_URL_HOST);
if (preg_match('/^[а-яё]+/iu', $url_host)) {
cmsCore::loadClass('idna_convert');
$IDN = new idna_convert();
$host = $IDN->encode($url_host);
$url = str_ireplace($url_host, $host, $url);
}
cmsCore::redirect($url);
}
//============================================================================//
}
示例4: getFileValue
private function getFileValue($form_field)
{
$link = '';
if (array_key_exists($form_field['id'], $this->values)) {
$field_value = $this->values[$form_field['id']];
global $_LANG;
if (is_file(PATH . $field_value['url'])) {
$downloaded = cmsCore::fileDownloadCount($field_value['url']);
$filesize = round(filesize(PATH . $field_value['url']) / 1024, 2);
$link = '<span class="filelink">';
$link .= '<a href="/load/url=-' . base64_encode($field_value['url']) . '" alt="' . $_LANG['FILE_DOWNLOAD'] . '">' . $field_value['name'] . '</a> ';
$link .= '<span>| ' . $filesize . ' ' . $_LANG['SIZE_KB'] . '</span> ';
$link .= '<span>| ' . $_LANG['FILE_DOWNLOADED'] . ': ' . cmsCore::spellCount($downloaded, $_LANG['TIME1'], $_LANG['TIME2'], $_LANG['TIME1']) . '</span>';
$link .= '</span>';
}
}
return $link;
}