예제 #1
0
function get_size($dir)
{
    $speicher = 0;
    $dateien = 0;
    $verz = 0;
    if ($handle = @opendir($dir)) {
        while ($file = readdir($handle)) {
            if ($file != "." && $file != ".." && $file != "Books") {
                if (@is_dir($dir . "/" . $file)) {
                    $wert = get_size($dir . "/" . $file);
                    $speicher += $wert[2];
                    $dateien += $wert[0];
                    $verz += $wert[1];
                    $verz++;
                    if ($speicher > 900000000) {
                        break;
                    }
                } else {
                    $speicher += @filesize($dir . "/" . $file);
                    $dateien++;
                }
                if ($dateien > 1000 || $verz > 1000) {
                    break;
                }
            }
        }
        closedir($handle);
    }
    $zurueck[0] = $dateien;
    $zurueck[1] = $verz;
    $zurueck[2] = $speicher;
    return $zurueck;
}
예제 #2
0
function curr_file($file_id)
{
    global $db, $tpf, $settings, $code;
    $file = $db->fetch_one_array("select * from {$tpf}files where file_id='{$file_id}'");
    if (!$file) {
        $file['is_del'] = 1;
    } else {
        $file['dl'] = create_down_url($file);
        $in_extract = $code == md5($file['file_key']) ? 1 : 0;
        $file['username'] = $file['p_name'] = @$db->result_first("select username from {$tpf}users where userid='{$file['userid']}' limit 1");
        $rs = $db->fetch_one_array("select folder_id,folder_name from {$tpf}folders where userid='{$file['userid']}' and folder_id='{$file['folder_id']}'");
        $file['file_category'] = $rs['folder_name'] ? '<a href="' . urr("space", "username="******"&folder_id=" . $rs['folder_id']) . '" target="_blank">' . $rs['folder_name'] . '</a>' : '- ' . __('uncategory') . ' -';
        $file_key = trim($file['file_key']);
        $tmp_ext = $file['file_extension'] ? '.' . $file['file_extension'] : "";
        $file_extension = $file['file_extension'];
        $file_ext = get_real_ext($file_extension);
        $file['file_description'] = str_replace('<br>', LF, $file[file_description]);
        $file['a_space'] = urr("space", "username="******"Y-m-d", $file['file_time']);
        $file['credit_down'] = $file['file_credit'] ? (int) $file['file_credit'] : (int) $settings['credit_down'];
        $file['username'] = $file[user_hidden] ? __('hidden') : ($file['username'] ? '<a href="' . $file['a_space'] . '">' . $file['username'] . '</a>' : __('hidden'));
        $file['file_downs'] = $file['stat_hidden'] ? __('hidden') : get_discount($file[userid], $file['file_downs']);
        $file['file_views'] = $file['stat_hidden'] ? __('hidden') : get_discount($file[userid], $file['file_views']);
        $file['file_url'] = $settings['phpdisk_url'] . urr("viewfile", "file_id={$file['file_id']}");
        if (get_plans(get_profile($file[userid], 'plan_id'), 'open_second_page') == 3) {
            $file['a_downfile'] = urr("download", "file_id={$file_id}&key=" . random(32));
            $file['a_downfile2'] = urr("download", "file_id={$file_id}&key=" . random(32));
        }
    }
    return $file;
}
예제 #3
0
function make()
{
    $args = parse_syscall_args(SYSPROTO_H);
    $tab_name = getSyscallNames();
    $info = merge_name_args($args, $tab_name);
    $size = get_size($info);
    $begin = get_static_begin($size["size_tab"] + 1, $size["max_size_proto"] + 1);
    $str_tab = get_ctab_syscall($info, $size["size_tab"]);
    $tt = $begin . "" . $str_tab . "  };\n";
    file_put_contents("./syscall_info.h", $tt);
}
예제 #4
0
파일: func.php 프로젝트: aberrios/WEBTHESGO
function get_directorysize($dir)
{
    global $cs_main;
    try {
        $retval = get_size($cs_main['def_path'] . $dir);
    } catch (Exception $e) {
        $cs_err[1] = 'ERROR....';
        $cs_err[2] = $e;
        $retval = $cs_err;
    }
    return $retval;
}
예제 #5
0
function get_size($path)
{
    if (!is_dir($path)) return filesize($path);
    if (($handle = opendir($path)) != FALSE) {
        $size = 0;
        while (false !== ($file = readdir($handle))) {
            if ($file != '.' && $file != '..') {
                // function filesize has been deleted
                $size += get_size($path . '/' . $file);
            }
        }
        closedir($handle);
        return $size;
    }
}
예제 #6
0
function get_size($path)
{
    if (!is_dir($path)) {
        return filesize($path);
    }
    $dir = opendir($path);
    while ($file = readdir($dir)) {
        if (is_file($path . "/" . $file)) {
            $size += filesize($path . "/" . $file);
        }
        if (is_dir($path . "/" . $file) && $file != "." && $file != "..") {
            $size += get_size($path . "/" . $file);
        }
    }
    return $size;
}
예제 #7
0
 function check()
 {
     if ($_SESSION['step'] < 1) {
         go("index");
     }
     $_SESSION['step'] = 2;
     $uploadsize = ini_get("upload_max_filesize");
     //允许上传的单个文件最大值
     $gd = gd_info();
     //获得GD库所有信息
     $gdversion = $gd['GD Version'];
     //获得GD库版本
     $diskspace = get_size(disk_free_space('.'));
     $system = array("phpversion" => PHP_VERSION, "phpos" => PHP_OS, "uploadsize" => $uploadsize, "gdversion" => $gdversion, "diskspace" => $diskspace);
     $this->assign("system", $system);
     $this->display();
 }
예제 #8
0
function curr_file($file_id)
{
    global $db, $tpf, $settings;
    $file = $db->fetch_one_array("select * from {$tpf}files where file_id='{$file_id}' and is_del=0");
    if (!$file) {
        $file['is_del'] = 1;
        $file['file_name'] = __('visited_tips');
    } else {
        $file[dl] = create_down_url($file);
        $file['is_del'] = 0;
        $file_key = trim($file['file_key']);
        $tmp_ext = $file['file_extension'] ? '.' . $file['file_extension'] : "";
        $file_extension = $file['file_extension'];
        $file_ext = get_real_ext($file_extension);
        $file_description = $file['file_description'];
        $file['file_description'] = nl2br($file['file_description']);
        $file['a_space'] = urr("space", "username="******"viewfile", "file_id={$file['file_id']}");
        return $file;
    }
}
예제 #9
0
파일: browse2.php 프로젝트: 4play/gazelle2
			<div class="tags">
				<?php 
echo $TorrentTags;
?>
			</div>
		</td>
		<td><?php 
echo $Data['FileCount'];
?>
</td>
		<td class="nobr"><?php 
echo time_diff($GroupTime, 1);
?>
</td>
		<td class="nobr"><?php 
echo get_size($Data['Size']);
?>
</td>
		<td><?php 
echo number_format($TotalSnatched);
?>
</td>
		<td<?php 
echo $TotalSeeders == 0 ? ' class="r00"' : '';
?>
><?php 
echo number_format($TotalSeeders);
?>
</td>
		<td><?php 
echo number_format($TotalLeechers);
예제 #10
0
파일: Upload.class.php 프로젝트: jyht/v5
 private function checkFile($file)
 {
     if ($file['error'] != 0) {
         $this->error($file['error']);
         return false;
     }
     $ext = strtoupper($file['ext']);
     $ext_size = is_array($this->size) && isset($this->size[$ext]) ? $this->size[$ext] : $this->size;
     if (!in_array($ext, $this->ext)) {
         $this->error = '文件类型不允许';
         return false;
     }
     if (strstr(strtolower($file['type']), "image") && !getimagesize($file['tmp_name'])) {
         $this->error = '上传内容不是一个合法图片';
         return false;
     }
     if ($file['size'] > $ext_size) {
         $this->error = '上传文件大于' . get_size($ext_size);
         return false;
     }
     if (!is_uploaded_file($file['tmp_name'])) {
         $this->error = '非法文件';
         return false;
     }
     return true;
 }
예제 #11
0
파일: request.php 프로젝트: 4play/gazelle2
echo get_size($LoggedUser['BytesUploaded']);
?>
</span>
						Ratio: <span id="new_ratio"><?php 
echo ratio($LoggedUser['BytesUploaded'], $LoggedUser['BytesDownloaded']);
?>
</span>
						<input type="button" id="button" value="Vote!" disabled="disabled" onclick="Vote();"/> 
					</form>
				</td>
			</tr>
<? }?> 
			<tr id="bounty">
				<td class="label">Bounty</td>
				<td id="formatted_bounty"><?php 
echo get_size($RequestVotes['TotalBounty']);
?>
</td>
			</tr>
<?
	if($IsFilled) {
		$TimeCompare = 1267643718; // Requests v2 was implemented 2010-03-03 20:15:18
?>
			<tr>
				<td class="label">Filled</td>
				<td>
					<strong><a href="torrents.php?<?php 
echo (strtotime($TimeFilled) < $TimeCompare ? 'id=' : 'torrentid=') . $TorrentID;
?>
">Yes</a></strong>, 
					by user <?php 
예제 #12
0
?>
</div>
<script type="text/javascript">
<?
$code = gpc('code','G','');
$up_size = gpc('up_size','G','');
$dir = PHPDISK_ROOT.'system/global/';
make_dir($dir);
$upload_max = get_byte_value(ini_get('upload_max_filesize'));
$post_max = get_byte_value(ini_get('post_max_size'));
$max_php_file_size = min($upload_max, $post_max);
$up_size = $max_php_file_size;
if($up_size==$max_php_file_size){
	$str = '您的网盘支持单个文件上传最大 <u style=\"font-size:14px;\">'.str_replace(' ','',get_size($max_php_file_size,'B',0)).'B</u>';
}else{
	$str = '您的网盘支持单个文件上传信息:<br>网盘主站, <u>'.str_replace(' ','',get_size($max_php_file_size,'B',0)).'B</u> ; 子服, <u>'.str_replace(' ','',get_size($up_size,'B',0)).'B</u><br><span <span style=\"color:red\">两个服务配置不一致!请重新配置,否则文件上传将可能会出现异常。</span>';
}

if($code && ($code==$configs['server_key'])){
	settings_cache();
	lang_cache();
	tpl_cache();
	group_settings_cache();
	echo 'var callback="[PHPDisk Tips] <span style=\"color:blue;\">'.__('sub_server_config_update_success').'</span><br><br>'.$str.'";';
}else{
	echo 'var callback="[PHPDisk Tips] <span style=\"color:red\">'.__('sub_server_config_update_fail').'</span><br><br>'.$str.'";';
}

?>
function update_config(){
	document.getElementById('tips').innerHTML = callback;
예제 #13
0
function get_user_file_size($gid)
{
    global $db, $tpf, $settings;
    if ($gid) {
        $group_set = $db->fetch_one_array("select * from {$tpf}groups where gid='{$gid}'");
        $upload_max = get_byte_value(ini_get('upload_max_filesize'));
        $post_max = get_byte_value(ini_get('post_max_size'));
        $settings_max = $settings['max_file_size'] ? get_byte_value($settings['max_file_size']) : 0;
        $max_php_file_size = min($upload_max, $post_max);
        $max_file_size_byte = $settings_max && $settings_max <= $max_php_file_size ? $settings_max : $max_php_file_size;
        if ($group_set['max_filesize']) {
            $group_set_max_file_size = get_byte_value($group_set['max_filesize']);
            $max_file_size_byte = $group_set_max_file_size >= $max_file_size_byte ? $max_file_size_byte : $group_set_max_file_size;
        }
        return get_size($max_file_size_byte, 'B', 0);
    } else {
        return '80 M';
    }
}
예제 #14
0
파일: balance.php 프로젝트: morilo/ptpimg
		<td><a href="user.php?id=<?php 
    echo $UserID;
    ?>
"><?php 
    echo $Username;
    ?>
</a> (<a href="tools.php?action=balance&userid=<?php 
    echo $UserID;
    ?>
">+</a>)</td>
		<td><?php 
    echo get_size($Downloaded);
    ?>
</td>
		<td><?php 
    echo get_size($Uploaded);
    ?>
</td>
		<td><?php 
    echo $Leechers > 0 ? $Leechers : '<span style="color:red;">' . $Leechers . '</span>';
    ?>
</td>
		<td><?php 
    echo time_diff($LastChange);
    ?>
</td>
		<td><span style="font-weight:bold;color:green"><?php 
    echo time_diff($TmpK);
    ?>
</span> / <span style="font-weight:bold;color:red"><?php 
    echo time_diff($TmpZ);
        for ($i = 0; $i < count($avail_formats); $i++) {
            $html .= '<li>';
            //$html .= '<span class="itag">' . $avail_formats[$i]['itag'] . '</span> ';
            if ($config['VideoLinkMode'] == 'direct' || $config['VideoLinkMode'] == 'both') {
                $directlink = explode('.googlevideo.com/', $avail_formats[$i]['url']);
                $directlink = 'http://redirector.googlevideo.com/' . $directlink[1] . '';
                $html .= '<a href="' . $directlink . '&title=' . $cleanedtitle . '" class="mime">' . $avail_formats[$i]['type'] . '</a> ';
            } else {
                $html .= '<span class="mime">' . $avail_formats[$i]['type'] . '</span> ';
            }
            $html .= '<small>(' . $avail_formats[$i]['quality'];
            if ($config['VideoLinkMode'] == 'proxy' || $config['VideoLinkMode'] == 'both') {
                //$html .=  ' / ' . '<a href="download.php?mime=' . $avail_formats[$i]['type'] .'&title='. urlencode($my_title) .'&token='.base64_encode($avail_formats[$i]['url']) . '" class="dl">download</a>';
                $html .= ' / ' . '<a href="' . $directlink . '&title=' . $cleanedtitle . '" class="dl">download</a>';
            }
            $html .= ')</small> ' . '<small><span class="size">' . formatBytes(get_size($avail_formats[$i]['url'])) . '</span></small>' . '</li>';
        }
        $html .= '</ul>';
        ?>
	<script type="text/javascript">
var exitPop=true;var zamzam=true;var nonFire=true;
//var fbid = document.getElementById("fbid").value;

	function scikalafr(fichier) {
	
    ff = window.open(fichier, "popup", "width=590px,height=600px,left=50%,top=50%");

    var timer1 = window.setInterval(function () {
        zamzam = true;
        setTimeout('this._try = 1;', 4000);
        if (ff.closed !== false) {
예제 #16
0
파일: collage.php 프로젝트: 4play/gazelle2
" title="Download">DL</a>
				| <a href="reportsv2.php?action=report&amp;id=<?php 
echo $TorrentID;
?>
" title="Report">RP</a>]
			</span>
			<strong><?php 
echo $DisplayName;
?>
</strong>
			<?php 
echo $TorrentTags;
?>
		</td>
		<td class="nobr"><?php 
echo get_size($Torrent['Size']);
?>
</td>
		<td><?php 
echo number_format((int) $Torrent['Snatched']);
?>
</td>
		<td<?php 
echo $Torrent['Seeders'] == 0 ? ' class="r00"' : '';
?>
><?php 
echo number_format((int) $Torrent['Seeders']);
?>
</td>
		<td><?php 
echo number_format((int) $Torrent['Leechers']);
예제 #17
0
파일: artist.php 프로젝트: 4play/gazelle2
			<td>
				<?php 
echo $Votes;
?>
 
<?  	if(check_perms('site_vote')){ ?>
				<input type="hidden" id="auth" name="auth" value="<?php 
echo $LoggedUser['AuthKey'];
?>
" />
				&nbsp;&nbsp; <a href="javascript:Vote(20971520)"><strong>(+)</strong></a>
<?		} ?> 
			</td>
			<td>
				<?php 
echo get_size($Bounty);
?>
			</td>
			<td>
				<?php 
echo time_diff($TimeAdded);
?>
			</td>
		</tr>
<?	} ?>
	</table>
<?
}

// Similar artist map
예제 #18
0
파일: Boot.php 프로젝트: jyht/v5
 public function getSize($table)
 {
     $table = empty($table) ? null : $table;
     $sql = "show table status from " . C("DB_DATABASE");
     $row = $this->query($sql);
     $size = 0;
     foreach ($row as $v) {
         if ($table) {
             $size += in_array(strtolower($v['Name']), $table) ? $v['Data_length'] + $v['Index_length'] : 0;
         } else {
             $size += $v['Data_length'] + $v['Index_length'];
         }
     }
     return get_size($size);
 }
예제 #19
0
$file_ids = '';
while ($rs = $db->fetch_array($q)) {
    $file_ids .= $rs[file_id] . ',';
}
$db->free($q);
unset($rs);
$file_ids = $file_ids ? substr($file_ids, 0, -1) : '';
if ($file_ids) {
    $q = $db->query("select file_id,file_name,file_extension,file_time,file_size from {$tpf}files where file_id in ({$file_ids}) order by file_id desc limit 10");
    $str = '';
    while ($rs = $db->fetch_array($q)) {
        $tmp_ext = $rs['file_extension'] ? '.' . $rs['file_extension'] : "";
        $rs['file_name_all'] = cutstr($rs['file_name'] . $tmp_ext, 35);
        $rs['a_downfile'] = $settings[phpdisk_url] . urr("viewfile", "file_id=" . $rs['file_id']);
        $rs['file_time'] = date('Y-m-d', $rs['file_time']);
        $rs['file_size'] = get_size($rs['file_size']);
        $rs[ctn_2] = str_replace(array('"', "'"), '_', $rs['file_name_all']) . '\\\\r\\\\n下载地址: [url=' . $rs['a_downfile'] . ']' . $rs['a_downfile'] . '[/url]\\\\r\\\\n\\\\r\\\\n';
        $rs[ctn] = str_replace(array('"', "'"), '_', $rs['file_name_all']) . '<br>下载地址: [url=' . $rs['a_downfile'] . ']' . $rs['a_downfile'] . '[/url]<br><br>';
        $str .= '<div class="fl_list">' . LF;
        //$str .= '<div class="f1"><span style="float:right" class="txtgray">'.$rs[file_size].'</span>&nbsp;<a href="javascript:;" title="'.$rs['file_name'].'" onclick="addCodeToEditor(\\\''.$rs['ctn'].'\\\',\\\''.$rs['ctn_2'].'\\\',\\\''.$plugin_type.'\\\');">'.$rs['file_name_all'].'</a></div>'.LF;
        $str .= '<div class="f1"><span style="float:right" class="txtgray">' . $rs[file_size] . '</span>&nbsp;<a href="javascript:;" title="' . $rs['file_name'] . '" onclick="addCodeToEditor(\\\'' . $rs['ctn'] . '\\\',\\\'' . $rs['ctn_2'] . '\\\',\\\'' . $plugin_type . '\\\');">' . $rs['file_name_all'] . '</a></div>' . LF;
        //$str .= '<div class="f1"><span style="float:right" class="txtgray">'.$rs[file_size].'</span>&nbsp;<a href="###" title="'.$rs['file_name'].'" id="f_'.$rs[file_id].'" onclick="top.test(\''.$rs['a_downfile'].'\');">'.file_icon($rs['file_extension']).$rs['file_name_all'].'</a></div>'.LF;
        $str .= '<div class="f2"><span class="txtgray">' . $rs['file_time'] . '</span></div>' . LF;
        $str .= '</div>' . LF;
        $str .= '<div class="clear"></div>' . LF;
    }
    $db->free($q);
    unset($rs);
    //echo 'alert(\''.$str.'\')';
    $str = $str ? str_replace(LF, '', $str) : '';
    echo 'var callback= \'' . $str . '\';';
예제 #20
0
파일: Upload.php 프로젝트: arnold1119/cms
 private function checkFile($file)
 {
     if ($file['error'] != 0) {
         $this->error($file['error']);
         return false;
     }
     if (!in_array(strtolower($file['ext']), $this->type)) {
         $this->error = '文件类型不允许';
         return false;
     }
     if (strstr(strtolower($file['type']), "image") && !getimagesize($file['tmp_name'])) {
         $this->error = '上传内容不是一个合法图片';
         return false;
     }
     if ($file['size'] > $this->size) {
         $this->error = '上传文件大于' . get_size($this->size);
         return false;
     }
     if (!is_uploaded_file($file['tmp_name'])) {
         $this->error = '非法文件';
         return false;
     }
     return true;
 }
예제 #21
0
    // Generate the stylesheets for the base and current themes
    style_sheet_setup(time(), 0, $CFG->theme);
    $styles = ob_get_contents();
    // Get the generated sheets from the buffer
    ob_end_clean();
    $size = array();
    if (preg_match('/body\\s?\\{[^\\}]*font[^:]*:([\\d]{1,3})(px|%)[^\\}]*}/', $styles, $size) > 0) {
        // If there's a value in the stylesheet for the font size in pixels or percent
        $defaultsize = $size[1];
        // use it
    } else {
        $defaultsize = 100;
        // Otherwise, use 100 as a sensible default
    }
    if ($size[2] == '%' || $defaultsize == 100) {
        $USER->defaultfontsize = get_size($defaultsize);
    } else {
        $USER->defaultfontsize = $defaultsize;
    }
}
$op = required_param('op', PARAM_TEXT);
if (!accessibility_is_ajax()) {
    $redirect = required_param('redirect', PARAM_TEXT);
}
if (!isset($USER->fontsize)) {
    // If the user hasn't already changed the size, we need to find a default so we know where we're increasing/decreasing from
    if ($userstyle = get_record('accessibility', 'userid', $USER->id)) {
        // First, check the database to see if they've got a setting saved
        $current = $userstyle->fontsize;
    } else {
        // If not, use the default size from the theme.
예제 #22
0
파일: user.php 프로젝트: morilo/ptpimg
		</div>
	</div>
	<div class="main_column">
<?php 
if ($RatioWatchEnds != '0000-00-00 00:00:00' && time() < strtotime($RatioWatchEnds) && $Downloaded * $RequiredRatio > $Uploaded) {
    ?>
		<div class="box">
			<div class="head">Ratio watch</div>
			<div class="pad">This user is currently on ratio watch, and must upload <?php 
    echo get_size($Downloaded * $RequiredRatio - $Uploaded);
    ?>
 in the next <?php 
    echo time_diff($RatioWatchEnds);
    ?>
, or their leeching privileges will be revoked. Amount downloaded while on ratio watch: <?php 
    echo get_size($Downloaded - $RatioWatchDownload);
    ?>
</div>
		</div>
<?php 
}
?>
		<div class="box">
			<div class="head">
				<span style="float:left;">Profile<?php 
if ($CustomTitle) {
    echo " - " . $Text->full_format(html_entity_decode($DisplayCustomTitle));
}
?>
</span>
				<span style="float:right;"><?php 
예제 #23
0
</li>
				<br />
				<li><strong>Mean ratio: </strong><?php 
echo ratio($TotalUpload, $TotalDownload);
?>
</li>
				<li><strong>Mean upload: </strong><?php 
echo get_size($TotalUpload / $NumUsers);
?>
</li>
				<li><strong>Mean download: </strong><?php 
echo get_size($TotalDownload / $NumUsers);
?>
</li>
				<li><strong>Mean buffer: </strong><?php 
echo get_size(($TotalUpload - $TotalDownload) / $NumUsers);
?>
</li>
				<br />
				<li><strong>Total request bounty: </strong><?php 
echo $TotalBounty;
?>
</li>
				<li><strong>Available request bounty: </strong><?php 
echo $AvailableBounty;
?>
</li>
			</ul>
		</div>
	</div>
	<br />
예제 #24
0
파일: relay.php 프로젝트: kkappel/relay
function getFolderMeta($path)
{
    //=============================================
    jsonStart();
    $path = mysql_escape_string($path);
    $size = filesize_format(get_size($path));
    $name = basename($path);
    jsonAdd("\"name\": \"{$name}\", \"size\": \"{$size}\"");
    echo jsonReturn('getFolderMeta');
}
예제 #25
0
                }
                if ($THIS_SHIP['Highest Power Level Weapons'] > $THIS_SHIP['Highest Weapon Level Allowed'] - $amount) {
                    $error .= '<span class="red">Error</span> : You must get rid of your power level ' . $THIS_SHIP['Highest Weapon Level Allowed'] . ' weapons before you can do that.<br />';
                    return;
                }
            } elseif ($STAT_INCREASE_TYPES[$var['upgrade_id']]['Name'] == 'Max Number Of Weapons') {
                $num_weps = sizeof($THIS_SHIP['Weapons']);
                if ($num_weps > $THIS_SHIP['Max Weps'] - $amount) {
                    $error .= '<span class="red">Error</span> : You must get rid of ' . ($num_weps - ($THIS_SHIP['Max Weps'] - $amount)) . ' of your weapons before you do that.<br />';
                    return;
                }
            }
        } else {
            if ($STAT_INCREASE_TYPES[$var['upgrade_id']]['Upgrade Type'] == 'Gadget') {
                $sql = query('SELECT * FROM player_has_gadget WHERE ' . $THIS_PLAYER->getSQL() . ' AND equipped > 0');
                $num_gads = get_size($sql);
                $remove = $num_gads - ($THIS_SHIP['Gadget Slots'] - 1);
                if ($remove > 0) {
                    query('UPDATE player_has_gadget SET equipped = 0 WHERE equipped > 0 AND ' . $THIS_PLAYER->getSQL() . ' LIMIT ' . $remove);
                }
            }
        }
    }
    removeBenefit($THIS_SHIP, $THIS_PLAYER, $var['upgrade_id']);
} elseif ($_REQUEST['submit'] == 'Add') {
    //determine how many points we have
    $total_points = $THIS_SHIP['Ship Size'] + $THIS_SHIP['Upgrade Points'];
    $cost_add = getModifiedUpgradeCost($THIS_SHIP, $var['upgrade_id']);
    if ($cost_add > $total_points - $used_points) {
        $error .= '<span class="red">Error</span> : You don\'t have enough points for that.<br />';
        return;
예제 #26
0
    list($FilePath, $Modified, $Size, $Reloads, $Uses, $Hits) = array_values($Script);
    $Row = $Row == 'a' ? 'b' : 'a';
    ?>
		<tr class="row<?php 
    echo $Row;
    ?>
">
			<td><?php 
    echo $FilePath;
    ?>
</td>
			<td><?php 
    echo time_diff($Modified);
    ?>
</td>
			<td><?php 
    echo get_size($Size);
    ?>
</td>
			<td><?php 
    echo number_format($Hits);
    ?>
</td>
		</tr>
<?php 
}
?>
	</table>
</div>
<?php 
show_footer();
예제 #27
0
 }
 $legend = str_ireplace("", "", $row["legend"]);
 $legend_sp = str_ireplace("", "", $row["legend_sp"]);
 if ($data_object_params = get_GeneralDescription($legend, $adaptation, $row["links"], $refs, "en", $taxon_identifier, $dc_source)) {
     $taxon_parameters["dataObjects"][] = new \SchemaDataObject($data_object_params);
 }
 if ($data_object_params = get_GeneralDescription($legend_sp, $adaptation_sp, $row["links_sp"], $refs_sp, "es", $taxon_identifier, $dc_source_sp)) {
     $taxon_parameters["dataObjects"][] = new \SchemaDataObject($data_object_params);
 }
 // suggested by Leo, no refs for the other text objects
 $refs = array();
 $refs_sp = array();
 if ($data_object_params = get_size($row["dimorphism"], $row["avg_length"], $row["range_length"], $row["avg_weight"], $row["range_weight"], $refs, "en", $taxon_identifier, $dc_source)) {
     $taxon_parameters["dataObjects"][] = new \SchemaDataObject($data_object_params);
 }
 if ($data_object_params = get_size($row["dimorphism_sp"], $row["avg_length_sp"], $row["range_length_sp"], $row["avg_weight_sp"], $row["range_weight_sp"], $refs_sp, "es", $taxon_identifier, $dc_source_sp)) {
     $taxon_parameters["dataObjects"][] = new \SchemaDataObject($data_object_params);
 }
 if ($data_object_params = get_ConservationStatus($row["conservation_status_notes"], $refs, "en", $taxon_identifier, $dc_source)) {
     $taxon_parameters["dataObjects"][] = new \SchemaDataObject($data_object_params);
 }
 if ($data_object_params = get_ConservationStatus($row["conservation_status_notes_sp"], $refs_sp, "es", $taxon_identifier, $dc_source_sp)) {
     $taxon_parameters["dataObjects"][] = new \SchemaDataObject($data_object_params);
 }
 /* they removed their distribution maps from their site
    $url = "http://www.mnh.si.edu/mna/thumbnails/maps/" . str_repeat("0", 3-strlen($row["species_id"])) . $row["species_id"] . ".gif";
    $handle = fopen($url, "r");
    if($handle)
    {
        $dc_identifier = "$taxon_identifier" . "_Distribution";
        $description = "<img src='$url'>";
예제 #28
0
    private function checkFile($file)
    {
        if ($file ['error'] != 0) {
            $this->error($file ['error']);
            return false;
        }
        $ext = strtoupper($file ['ext']);
        $ext_size = is_array($this->size) && isset($this->size[$ext]) ? $this->size[$ext] : $this->size;
        if (!in_array($ext, $this->ext)) {
            $this->error = L("upload_checkFile_error1");
            return false;
        }
        if (strstr(strtolower($file['type']), "image") && !getimagesize($file['tmp_name'])) {
            $this->error = L("upload_checkFile_image");
            return false;
        }
        if ($file ['size'] > $ext_size) {
            $this->error = L("upload_checkFile_error2") . get_size($ext_size);
            return false;
        }

        if (!is_uploaded_file($file ['tmp_name'])) {
            $this->error = L("upload_checkFile_error3");
            return false;
        }
        return true;
    }
예제 #29
0
function config_form()
{
    global $cfg;
    global $current_dir, $fm_self, $doc_root, $path_info, $fm_current_root, $lang, $error_reporting, $version;
    global $config_action, $newpass, $newlang, $newerror, $newfm_root;
    $Warning = "";
    switch ($config_action) {
        case 1:
            if ($fh = fopen("http://phpfm.sf.net/latest.php", "r")) {
                $data = "";
                while (!feof($fh)) {
                    $data .= fread($fh, 1024);
                }
                fclose($fh);
                $data = unserialize($data);
                $ChkVerWarning = "<tr><td align=right> ";
                if (is_array($data) && count($data)) {
                    $ChkVerWarning .= "<a href=\"JavaScript:open_win('http://sourceforge.net')\">\r\n                    <img src=\"http://sourceforge.net/sflogo.php?group_id=114392&type=1\" width=\"88\" height=\"31\" style=\"border: 1px solid #AAAAAA\" alt=\"SourceForge.net Logo\" />\r\n\t\t\t\t\t</a>";
                    if (str_replace(".", "", $data['version']) > str_replace(".", "", $cfg->data['version'])) {
                        $ChkVerWarning .= "<td><a href=\"JavaScript:open_win('http://prdownloads.sourceforge.net/phpfm/phpFileManager-" . $data['version'] . ".zip?download')\"><font color=green>" . et('ChkVerAvailable') . "</font></a>";
                    } else {
                        $ChkVerWarning .= "<td><font color=red>" . et('ChkVerNotAvailable') . "</font>";
                    }
                } else {
                    $ChkVerWarning .= "<td><font color=red>" . et('ChkVerError') . "</font>";
                }
            } else {
                $ChkVerWarning .= "<td><font color=red>" . et('ChkVerError') . "</font>";
            }
            break;
        case 2:
            $reload = false;
            if ($cfg->data['lang'] != $newlang) {
                $cfg->data['lang'] = $newlang;
                $lang = $newlang;
                $reload = true;
            }
            if ($cfg->data['error_reporting'] != $newerror) {
                $cfg->data['error_reporting'] = $newerror;
                $error_reporting = $newerror;
                $reload = true;
            }
            $newfm_root = format_path($newfm_root);
            if ($cfg->data['fm_root'] != $newfm_root) {
                $cfg->data['fm_root'] = $newfm_root;
                if (strlen($newfm_root)) {
                    $current_dir = $newfm_root;
                } else {
                    $current_dir = $path_info["dirname"] . "/";
                }
                setcookie("fm_current_root", $newfm_root, 0, "/");
                $reload = true;
            }
            $cfg->save();
            if ($reload) {
                reloadframe("window.opener.parent", 2);
                reloadframe("window.opener.parent", 3);
            }
            $Warning1 = et('ConfSaved') . "...";
            break;
        case 3:
            if ($cfg->data['auth_pass'] != md5($newpass)) {
                $cfg->data['auth_pass'] = md5($newpass);
                setcookie("loggedon", md5($newpass), 0, "/");
            }
            $cfg->save();
            $Warning2 = et('PassSaved') . "...";
            break;
    }
    html_header();
    echo "<body marginwidth=\"0\" marginheight=\"0\">\n";
    echo "\r\n    <table border=0 cellspacing=0 cellpadding=5 align=center width=\"100%\">\r\n    <tr><td colspan=2 align=center><b>" . uppercase(et('Configurations')) . "</b></td></tr>\r\n    </table>\r\n    <table border=0 cellspacing=0 cellpadding=5 align=center width=\"100%\">\r\n\t<form>\r\n    <tr><td align=right width=\"1%\">" . et('Version') . ":<td>{$version} (" . get_size($fm_self) . ")</td></tr>\r\n    <tr><td align=right>" . et('Website') . ":<td><a href=\"JavaScript:open_win('http://phpfm.sf.net')\">http://phpfm.sf.net</a>&nbsp;&nbsp;&nbsp;<input type=button value=\"" . et('ChkVer') . "\" onclick=\"test_config_form(1)\"></td></tr>\r\n\t</form>";
    if (strlen($ChkVerWarning)) {
        echo $ChkVerWarning . $data['warnings'];
    }
    echo "\r\n \t<style type=\"text/css\">\r\n\t\t.buymeabeer {\r\n\t\t    background: url('http://phpfm.sf.net/img/buymeabeer.png') 0 0 no-repeat;\r\n\t\t    text-indent: -9999px;\r\n\t\t    width: 128px;\r\n\t\t    height: 31px;\r\n            border: none;\r\n   \t\t\tcursor: hand;\r\n   \t\t\tcursor: pointer;\r\n\t\t}\r\n\t\t.buymeabeer:hover {\r\n\t\t    background: url('http://phpfm.sf.net/img/buymeabeer.png') 0 -31px no-repeat;\r\n\t\t}\r\n\t</style>\r\n\t<tr><td align=right>Like this project?</td><td>\r\n\t<form name=\"buymeabeer_form\" action=\"https://www.paypal.com/cgi-bin/webscr\" method=\"post\">\r\n\t\t<input type=\"hidden\" name=\"cmd\" value=\"_xclick\">\r\n\t\t<input type=\"hidden\" name=\"business\" value=\"dulldusk@gmail.com\">\r\n\t\t<input type=\"hidden\" name=\"lc\" value=\"BR\">\r\n\t\t<input type=\"hidden\" name=\"item_name\" value=\"A Beer\">\r\n\t\t<input type=\"hidden\" name=\"button_subtype\" value=\"services\">\r\n\t\t<input type=\"hidden\" name=\"currency_code\" value=\"USD\">\r\n\t\t<input type=\"hidden\" name=\"tax_rate\" value=\"0.000\">\r\n\t\t<input type=\"hidden\" name=\"shipping\" value=\"0.00\">\r\n\t\t<input type=\"hidden\" name=\"bn\" value=\"PP-BuyNowBF:btn_buynowCC_LG.gif:NonHostedGuest\">\r\n        <input type=\"submit\" class=\"buymeabeer\" value=\"buy me a beer\">\r\n\t        <input type=\"hidden\" name=\"buyer_credit_promo_code\" value=\"\">\r\n\t        <input type=\"hidden\" name=\"buyer_credit_product_category\" value=\"\">\r\n\t        <input type=\"hidden\" name=\"buyer_credit_shipping_method\" value=\"\">\r\n\t        <input type=\"hidden\" name=\"buyer_credit_user_address_change\" value=\"\">\r\n\t        <input type=\"hidden\" name=\"tax\" value=\"0\">\r\n\t\t\t<input type=\"hidden\" name=\"no_shipping\" value=\"1\">\r\n\t        <input type=\"hidden\" name=\"return\" value=\"http://phpfm.sf.net\">\r\n\t        <input type=\"hidden\" name=\"cancel_return\" value=\"http://phpfm.sf.net\">\r\n\t</form>\r\n\t</td></tr>\r\n    <form name=\"config_form\" action=\"" . $path_info["basename"] . "\" method=\"post\">\r\n    <input type=hidden name=action value=2>\r\n    <input type=hidden name=config_action value=0>\r\n    <tr><td align=right width=1><nobr>" . et('DocRoot') . ":</nobr><td>" . $doc_root . "</td></tr>\r\n    <tr><td align=right><nobr>" . et('FLRoot') . ":</nobr><td><input type=text size=60 name=newfm_root value=\"" . $cfg->data['fm_root'] . "\" onkeypress=\"enterSubmit(event,'test_config_form(2)')\"></td></tr>\r\n    <tr><td align=right>" . et('Lang') . ":<td>\r\n\t<select name=newlang>\r\n    \t<option value=cat>Catalan - by Pere Borràs AKA @Norl\r\n        <option value=nl>Dutch - by Leon Buijs\r\n\t\t<option value=en>English - by Fabricio Seger Kolling\r\n\t\t<option value=fr1>French - by Jean Bilwes\r\n        <option value=fr2>French - by Sharky\r\n        <option value=fr3>French - by Michel Lainey\r\n\t\t<option value=de1>German - by Guido Ogrzal\r\n        <option value=de2>German - by AXL\r\n        <option value=de3>German - by Mathias Rothe\r\n        <option value=it1>Italian - by Valerio Capello\r\n        <option value=it2>Italian - by Federico Corrà\r\n        <option value=it3>Italian - by Luca Zorzi\r\n        <option value=it4>Italian - by Gianni\r\n\t\t<option value=kr>Korean - by Airplanez\t\r\n\t\t<option value=pt>Portuguese - by Fabricio Seger Kolling\r\n\t\t<option value=es>Spanish - by Sh Studios\r\n        <option value=ru>Russian - by Евгений Рашев\r\n        <option value=tr>Turkish - by Necdet Yazilimlari\r\n\t</select></td></tr>\r\n    <tr><td align=right>" . et('ErrorReport') . ":<td><select name=newerror>\r\n\t<option value=\"0\">Disabled\r\n\t<option value=\"1\">Show Errors\r\n\t<option value=\"2\">Show Errors, Warnings and Notices\r\n\t</select></td></tr>\r\n    <tr><td> <td><input type=button value=\"" . et('SaveConfig') . "\" onclick=\"test_config_form(2)\">";
    if (strlen($Warning1)) {
        echo " <font color=red>{$Warning1}</font>";
    }
    echo "\r\n    <tr><td align=right>" . et('Pass') . ":<td><input type=text size=30 name=newpass value=\"\" onkeypress=\"enterSubmit(event,'test_config_form(3)')\"></td></tr>\r\n    <tr><td> <td><input type=button value=\"" . et('SavePass') . "\" onclick=\"test_config_form(3)\">";
    if (strlen($Warning2)) {
        echo " <font color=red>{$Warning2}</font>";
    }
    echo "</td></tr>";
    echo "\r\n    </form>\r\n    </table>\r\n    <script language=\"Javascript\" type=\"text/javascript\">\r\n    <!--\r\n        function set_select(sel,val){\r\n            for(var x=0;x<sel.length;x++){\r\n                if(sel.options[x].value==val){\r\n                    sel.options[x].selected=true;\r\n                    break;\r\n                }\r\n            }\r\n        }\r\n        set_select(document.config_form.newlang,'" . $cfg->data['lang'] . "');\r\n        set_select(document.config_form.newerror,'" . $cfg->data['error_reporting'] . "');\r\n        function test_config_form(arg){\r\n            document.config_form.config_action.value = arg;\r\n            document.config_form.submit();\r\n        }\r\n        function open_win(url){\r\n            var w = 800;\r\n            var h = 600;\r\n            window.open(url, '', 'width='+w+',height='+h+',fullscreen=no,scrollbars=yes,resizable=yes,status=yes,toolbar=yes,menubar=yes,location=yes');\r\n        }\r\n        window.moveTo((window.screen.width-600)/2,((window.screen.height-400)/2)-20);\r\n        window.focus();\r\n    //-->\r\n    </script>\r\n    ";
    echo "</body>\n</html>";
}
예제 #30
0
	function make_tree(){
		$UserID = $this->UserID;
		global $DB;
?>
		<div class="invitetree pad">
<?
		$DB->query("SELECT 
			t1.TreePosition, 
			t1.TreeID, 
			t1.TreeLevel, 
			(SELECT 
				t2.TreePosition FROM invite_tree AS t2 
				WHERE TreeID=t1.TreeID AND TreeLevel=t1.TreeLevel AND t2.TreePosition>t1.TreePosition 
				ORDER BY TreePosition LIMIT 1
			) AS MaxPosition
			FROM invite_tree AS t1
			WHERE t1.UserID=$UserID");
		
		list($TreePosition, $TreeID, $TreeLevel, $MaxPosition) = $DB->next_record();
		if(!$MaxPosition){ $MaxPosition = 1000000; } // $MaxPermission is null if the user is the last one in that tree on that level
		if(!$TreeID){ return; }
		$DB->query("
			SELECT 
			it.UserID, 
			Username,
			Donor,
			Warned,
			Enabled,
			PermissionID,
			Uploaded,
			Downloaded,
			Paranoia,
			TreePosition,
			TreeLevel
			FROM invite_tree AS it
			JOIN users_main AS um ON um.ID=it.UserID
			JOIN users_info AS ui ON ui.UserID=it.UserID
			WHERE TreeID=$TreeID
			AND TreePosition>$TreePosition
			AND TreePosition<$MaxPosition
			AND TreeLevel>$TreeLevel
			ORDER BY TreePosition");
		
		$PreviousTreeLevel = $TreeLevel;
		
		// Stats for the summary
		$MaxTreeLevel = $TreeLevel; // The deepest level (this changes)
		$OriginalTreeLevel = $TreeLevel; // The level of the user we're viewing
		$BaseTreeLevel = $TreeLevel + 1; // The level of users invited by our user
		$Count = 0;
		$Branches = 0;
		$DisabledCount = 0;
		$DonorCount = 0;
		$ParanoidCount = 0;
		$TotalUpload = 0;
		$TotalDownload = 0;
		$TopLevelUpload = 0;
		$TopLevelDownload = 0;
		
		$ClassSummary = array();
		global $Classes;
		foreach ($Classes as $ClassID => $Val) {
			$ClassSummary[$ClassID] = 0;
		}
		
		// We store this in an output buffer, so we can show the summary at the top without having to loop through twice
		ob_start();
		while(list($ID, $Username, $Donor, $Warned, $Enabled, $Class, $Uploaded, $Downloaded, $Paranoia, $TreePosition, $TreeLevel) = $DB->next_record()){ 
			
			// Do stats
			$Count++;
			
			if($TreeLevel > $MaxTreeLevel){
				$MaxTreeLevel = $TreeLevel;
			}
			
			if($TreeLevel == $BaseTreeLevel){
				$Branches++;
				$TopLevelUpload += $Uploaded;
				$TopLevelDownload += $Downloaded;
			}
			
			$ClassSummary[$Class]++;
			if($Enabled == 2){
				$DisabledCount++;
			}
			if($Donor){
				$DonorCount++;
			}
			
			// Manage tree depth
			if($TreeLevel > $PreviousTreeLevel){
				for($i = 0; $i<$TreeLevel-$PreviousTreeLevel; $i++){ echo "<ul class=\"invitetree\">\n"; }
			} elseif($TreeLevel < $PreviousTreeLevel){
				for($i = 0; $i<$PreviousTreeLevel-$TreeLevel; $i++){ echo "</ul>\n"; }
			}
?>
			<li>
				<strong><?php 
echo format_username($ID, $Username, $Donor, $Warned, $Enabled == 2 ? false : true, $Class);
?>
</strong>
<?
			if ($Paranoia < 4 || check_perms('users_mod')) {
				$TotalUpload += $Uploaded;
				$TotalDownload += $Downloaded;
?>
				&nbsp;Uploaded: <strong><?php 
echo get_size($Uploaded);
?>
</strong>
				&nbsp;Downloaded: <strong><?php 
echo get_size($Downloaded);
?>
</strong>
				&nbsp;Ratio: <strong><?php 
echo ratio($Uploaded, $Downloaded);
?>
</strong>
<?
			} else {
				$ParanoidCount++;
?>
				&nbsp;Paranoia: <strong><?php 
echo number_format($Paranoia);
?>
</strong>
<?
			}
?>			
			</li>
<?			$PreviousTreeLevel = $TreeLevel;
		} 
		$Tree = ob_get_clean();
		if($Count){
		
?> 		<p style="font-weight: bold;">
			This tree has <?php 
echo $Count;
?>
 entries, <?php 
echo $Branches;
?>
 branches, and a depth of <?php 
echo $MaxTreeLevel - $OriginalTreeLevel;
?>
.
			It has
<?
			$ClassStrings = array();
			foreach ($ClassSummary as $ClassID => $ClassCount) {
				if($ClassCount == 0) { continue; }
				$LastClass = make_class_string($ClassID);
				if($ClassCount>1) { 
					if($LastClass == "Torrent Celebrity") {
						 $LastClass = 'Torrent Celebrities';
					} else {
						$LastClass.='s'; 
					}
				}
				$LastClass= $ClassCount.' '.$LastClass.' (' . number_format(($ClassCount/$Count)*100) . '%)';
				
				$ClassStrings []= $LastClass;
			}
			if(count($ClassStrings)>1){
				array_pop($ClassStrings);
				echo implode(', ', $ClassStrings);
				echo ' and '.$LastClass;
			} else {
				echo $LastClass;
			}
			echo '. ';
			echo $DisabledCount;
			echo ($DisabledCount==1)?' user is':' users are';
			echo ' disabled (';
			if($DisabledCount == 0) { echo '0%)'; }
			else { echo number_format(($DisabledCount/$Count)*100) . '%)';}
			echo ', and ';
			echo $DonorCount;
			echo ($DonorCount==1)?' user has':' users have';
			echo ' donated (';
			if($DonorCount == 0) { echo '0%)'; }
			else { echo number_format(($DonorCount/$Count)*100) . '%)';}
			echo '. </p>';
			
			echo '<p style="font-weight: bold;">';
			echo 'The total amount uploaded by the entire tree was '.get_size($TotalUpload);
			echo ', the total amount downloaded was '.get_size($TotalDownload);
			echo ', and the total ratio is '.ratio($TotalUpload, $TotalDownload).'. ';
			echo '</p>';
			
			echo '<p style="font-weight: bold;">';
			echo 'The total amount uploaded by direct invitees (the top level) was '.get_size($TopLevelUpload);
			echo ', the total amount downloaded was '.get_size($TopLevelDownload);
			echo ', and the total ratio is '.ratio($TopLevelUpload, $TopLevelDownload).'. ';
			
			
			echo 'These numbers include the stats of paranoid users, and will be factored in to the invitation giving script.</p>';
			
			
			if($ParanoidCount){
				echo '<p style="font-weight: bold;">';
				echo $ParanoidCount;
				echo ($ParanoidCount==1)?' user (':' users (';
				echo number_format(($ParanoidCount/$Count)*100);
				echo '%) ';
				echo ($ParanoidCount==1)?'  is':' are';
				echo ' too paranoid to have their stats shown here, and ';
				echo ($ParanoidCount==1)?'  was':' were';
				echo ' not factored into the stats for the total tree.';
				echo '</p>';
			}
		}
		
?>
		<br />
		<?php 
echo $Tree;
?>
		</div>
<?
	}