本文整理汇总了PHP中get_max_file_size函数的典型用法代码示例。如果您正苦于以下问题:PHP get_max_file_size函数的具体用法?PHP get_max_file_size怎么用?PHP get_max_file_size使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_max_file_size函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_attachments
/**
* Get what we need to get attachments in a form-field interface.
*
* @param ID_TEXT The name of the field attachments are for
* @return array A pair: the attachments UI (tempcode), the hidden attachment field
*/
function get_attachments($posting_field_name)
{
$image_types = str_replace(',', ', ', get_option('valid_images'));
require_lang('javascript');
require_javascript('javascript_swfupload');
require_css('swfupload');
require_code('files2');
$max_attach_size = get_max_file_size(get_member(), $GLOBALS['SITE_DB']);
$attach_size_field = form_input_hidden('MAX_FILE_SIZE', strval($max_attach_size));
$num_attachments = post_param_integer('num_attachments', has_js() ? 1 : 3);
$attachments = new ocp_tempcode();
for ($i = 1; $i <= $num_attachments; $i++) {
$attachments->attach(do_template('ATTACHMENT', array('_GUID' => 'c3b38ca70cbd1c5f9cf91bcae9ed1134', 'POSTING_FIELD_NAME' => $posting_field_name, 'I' => strval($i))));
}
if (get_forum_type() == 'ocf') {
require_code('ocf_groups');
require_lang('ocf');
$max_attachments = ocf_get_member_best_group_property(get_member(), 'max_attachments_per_post');
} else {
$max_attachments = 100;
}
$attachment_template = do_template('ATTACHMENT', array('_GUID' => 'c3b38ca70cbd1c5f9cf91bcae9ed11dsds', 'POSTING_FIELD_NAME' => $posting_field_name, 'I' => '__num_attachments__'));
$attachments = do_template('ATTACHMENTS', array('_GUID' => '054921e7c09412be479676759accf222', 'POSTING_FIELD_NAME' => $posting_field_name, 'ATTACHMENT_TEMPLATE' => $attachment_template, 'IMAGE_TYPES' => $image_types, 'ATTACHMENTS' => $attachments, 'MAX_ATTACHMENTS' => strval($max_attachments), 'NUM_ATTACHMENTS' => strval($num_attachments)));
return array($attachments, $attach_size_field);
}
示例2: module_do_upload
/**
* The actualiser for uploading a file.
*
* @return tempcode The UI.
*/
function module_do_upload()
{
if (!has_specific_permission(get_member(), 'upload_filedump')) {
access_denied('I_ERROR');
}
$title = get_page_title('FILEDUMP_UPLOAD');
if (function_exists('set_time_limit')) {
@set_time_limit(0);
}
// Slowly uploading a file can trigger time limit, on some servers
$place = filter_naughty(post_param('place'));
require_code('uploads');
if (!is_swf_upload(true) && (!array_key_exists('file', $_FILES) || !is_uploaded_file($_FILES['file']['tmp_name']))) {
$attach_name = 'file';
$max_size = get_max_file_size();
if (isset($_FILES[$attach_name]) && ($_FILES[$attach_name]['error'] == 1 || $_FILES[$attach_name]['error'] == 2)) {
warn_exit(do_lang_tempcode('FILE_TOO_BIG', integer_format($max_size)));
} elseif (isset($_FILES[$attach_name]) && ($_FILES[$attach_name]['error'] == 3 || $_FILES[$attach_name]['error'] == 6 || $_FILES[$attach_name]['error'] == 7)) {
warn_exit(do_lang_tempcode('ERROR_UPLOADING_' . strval($_FILES[$attach_name]['error'])));
} else {
warn_exit(do_lang_tempcode('ERROR_UPLOADING'));
}
}
$file = $_FILES['file']['name'];
if (get_magic_quotes_gpc()) {
$file = stripslashes($file);
}
if (!has_specific_permission(get_member(), 'upload_anything_filedump') || get_file_base() != get_custom_file_base()) {
check_extension($file);
}
$file = str_replace('.', '-', basename($file, '.' . get_file_extension($file))) . '.' . get_file_extension($file);
if (!file_exists(get_custom_file_base() . '/uploads/filedump' . $place . $file)) {
$max_size = get_max_file_size();
if ($_FILES['file']['size'] > $max_size) {
warn_exit(do_lang_tempcode('FILE_TOO_BIG', integer_format(intval($max_size))));
}
$full = get_custom_file_base() . '/uploads/filedump' . $place . $file;
if (is_swf_upload(true)) {
@rename($_FILES['file']['tmp_name'], $full) or warn_exit(do_lang_tempcode('FILE_MOVE_ERROR', escape_html($file), escape_html('uploads/filedump' . $place)));
} else {
@move_uploaded_file($_FILES['file']['tmp_name'], $full) or warn_exit(do_lang_tempcode('FILE_MOVE_ERROR', escape_html($file), escape_html('uploads/filedump' . $place)));
}
fix_permissions($full);
sync_file($full);
$return_url = build_url(array('page' => '_SELF', 'place' => $place), '_SELF');
$test = $GLOBALS['SITE_DB']->query_value_null_ok('filedump', 'description', array('name' => $file, 'path' => $place));
if (!is_null($test)) {
delete_lang($test);
}
$GLOBALS['SITE_DB']->query_delete('filedump', array('name' => $file, 'path' => $place), '', 1);
$description = post_param('description');
$GLOBALS['SITE_DB']->query_insert('filedump', array('name' => $file, 'path' => $place, 'the_member' => get_member(), 'description' => insert_lang_comcode($description, 3)));
require_code('notifications');
$subject = do_lang('FILEDUMP_NOTIFICATION_MAIL_SUBJECT', get_site_name(), $file, $place);
$mail = do_lang('FILEDUMP_NOTIFICATION_MAIL', comcode_escape(get_site_name()), comcode_escape($file), array(comcode_escape($place), comcode_escape($description)));
dispatch_notification('filedump', $place, $subject, $mail);
log_it('FILEDUMP_UPLOAD', $file, $place);
if (has_actual_page_access($GLOBALS['FORUM_DRIVER']->get_guest_id(), get_page_name(), get_zone_name())) {
syndicate_described_activity('filedump:ACTIVITY_FILEDUMP_UPLOAD', $place . '/' . $file, '', '', '', '', '', 'filedump');
}
return redirect_screen($title, $return_url, do_lang_tempcode('SUCCESS'));
} else {
warn_exit(do_lang_tempcode('OVERWRITE_ERROR'));
}
return new ocp_tempcode();
}
示例3: upload_items
function upload_items($dir)
{
// upload file
if (($GLOBALS["permissions"] & 01) != 01) {
show_error($GLOBALS["error_msg"]["accessfunc"]);
}
// Execute
if (isset($GLOBALS['__POST']["confirm"]) && $GLOBALS['__POST']["confirm"] == "true") {
$cnt = count($GLOBALS['__FILES']['userfile']['name']);
$err = false;
$err_avaliable = isset($GLOBALS['__FILES']['userfile']['error']);
// upload files & check for errors
for ($i = 0; $i < $cnt; $i++) {
$errors[$i] = NULL;
$tmp = $GLOBALS['__FILES']['userfile']['tmp_name'][$i];
$items[$i] = stripslashes($GLOBALS['__FILES']['userfile']['name'][$i]);
if ($err_avaliable) {
$up_err = $GLOBALS['__FILES']['userfile']['error'][$i];
} else {
$up_err = file_exists($tmp) ? 0 : 4;
}
$abs = get_abs_item($dir, $items[$i]);
if ($items[$i] == "" || $up_err == 4) {
continue;
}
if ($up_err == 1 || $up_err == 2) {
$errors[$i] = $GLOBALS["error_msg"]["miscfilesize"];
$err = true;
continue;
}
if ($up_err == 3) {
$errors[$i] = $GLOBALS["error_msg"]["miscfilepart"];
$err = true;
continue;
}
if (!@is_uploaded_file($tmp)) {
$errors[$i] = $GLOBALS["error_msg"]["uploadfile"];
$err = true;
continue;
}
if (@file_exists($abs) && empty($_REQUEST['overwrite_files'])) {
$errors[$i] = $GLOBALS["error_msg"]["itemdoesexist"];
$err = true;
continue;
}
// Upload
$ok = @$GLOBALS['jx_File']->move_uploaded_file($tmp, $abs);
if ($ok === false || PEAR::isError($ok)) {
$errors[$i] = $GLOBALS["error_msg"]["uploadfile"];
if (PEAR::isError($ok)) {
$errors[$i] .= ' [' . $ok->getMessage() . ']';
}
$err = true;
continue;
} elseif (!jx_isFTPMode()) {
@$GLOBALS['jx_File']->chmod($abs, 0644);
}
}
if ($err) {
// there were errors
$err_msg = "";
for ($i = 0; $i < $cnt; $i++) {
if ($errors[$i] == NULL) {
continue;
}
$err_msg .= $items[$i] . " : " . $errors[$i] . "<BR>\n";
}
show_error($err_msg);
}
header("Location: " . make_link("list", $dir, NULL));
return;
}
show_header($GLOBALS["messages"]["actupload"]);
// List
echo "<br /><form enctype=\"multipart/form-data\" action=\"" . make_link("upload", $dir, NULL) . "\" method=\"post\">\r\n\t\t\t<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"" . get_max_file_size() . "\" />\r\n\t\t\t<input type=\"hidden\" name=\"confirm\" value=\"true\" />\r\n\t\t<table style=\"width:60%;\" border=\"1\" class=\"adminform\">\r\n\t\t\t<tr><td class=\"quote\" colspan=\"2\">Maximum File Size = <strong>" . get_max_file_size() / 1024 / 1024 . " MB</strong><br />\r\n\t\t\t\tMaximum Upload Limit = <strong>" . get_max_upload_limit() / 1024 / 1024 . " MB</strong>\r\n\t\t\t</td></tr>\r\n\t\t\t";
for ($i = 0; $i < 10; $i++) {
$class = $i % 2 ? 'row0' : 'row1';
echo "<tr class=\"{$class}\"><td colspan=\"2\">";
echo "<input name=\"userfile[]\" type=\"file\" size=\"50\" class=\"inputbox\" /></td></tr>\n";
}
echo "<tr><td colspan=\"2\">\r\n\t\t\t\t<input type=\"checkbox\" checked=\"checked\" value=\"1\" name=\"overwrite_files\" id=\"overwrite_files\" /><label for=\"overwrite_files\">" . $GLOBALS["messages"]["overwrite_files"] . "</label>\r\n\t\t\t</td>\r\n\t\t\t</tr>\r\n\t\t\t<tr>\r\n\t\t\t\t<td width=\"40%\" style=\"text-align:right;\">\r\n\t\t\t\t\t<input type=\"submit\" value=\"" . $GLOBALS["messages"]["btnupload"] . "\" class=\"button\" /> \r\n\t\t\t\t</td>\r\n\t\t\t\t<td width=\"60%\" style=\"text-align:left;\"> \r\n\t\t\t\t\t<input type=\"button\" value=\"" . $GLOBALS["messages"]["btncancel"] . "\" class=\"button\" onclick=\"javascript:location='" . make_link("list", $dir, NULL) . "';\" />\r\n\t\t\t\t</td>\r\n\t\t\t</tr>\r\n\t\t</table>\r\n\t\t</form><br />\n";
return;
}
示例4: __construct
public function __construct()
{
parent::__construct();
$GLOBALS['tmpl']->assign("max_size", get_max_file_size());
}
示例5: upload_items
function upload_items($dir)
{
if (!permissions_grant($dir, NULL, "create")) {
show_error($GLOBALS["error_msg"]["accessfunc"]);
}
// Execute
if (isset($GLOBALS['__POST']["confirm"]) && $GLOBALS['__POST']["confirm"] == "true") {
$cnt = count($GLOBALS['__FILES']['userfile']['name']);
$err = false;
$err_avaliable = isset($GLOBALS['__FILES']['userfile']['error']);
// upload files & check for errors
for ($i = 0; $i < $cnt; $i++) {
$errors[$i] = NULL;
$tmp = $GLOBALS['__FILES']['userfile']['tmp_name'][$i];
$items[$i] = stripslashes($GLOBALS['__FILES']['userfile']['name'][$i]);
if ($err_avaliable) {
$up_err = $GLOBALS['__FILES']['userfile']['error'][$i];
} else {
$up_err = file_exists($tmp) ? 0 : 4;
}
$abs = get_abs_item($dir, $items[$i]);
if ($items[$i] == "" || $up_err == 4) {
continue;
}
if ($up_err == 1 || $up_err == 2) {
$errors[$i] = $GLOBALS["error_msg"]["miscfilesize"];
$err = true;
continue;
}
if ($up_err == 3) {
$errors[$i] = $GLOBALS["error_msg"]["miscfilepart"];
$err = true;
continue;
}
if (!@is_uploaded_file($tmp)) {
$errors[$i] = $GLOBALS["error_msg"]["uploadfile"];
$err = true;
continue;
}
if (@file_exists($abs)) {
$errors[$i] = $GLOBALS["error_msg"]["itemdoesexist"];
$err = true;
continue;
}
// Upload
if (function_exists("move_uploaded_file")) {
$ok = @move_uploaded_file($tmp, $abs);
} else {
$ok = @copy($tmp, $abs);
@nlink($tmp);
// try to delete...
}
if ($ok === false) {
$errors[$i] = $GLOBALS["error_msg"]["uploadfile"];
$err = true;
continue;
}
}
if ($err) {
// there were errors
$err_msg = "";
for ($i = 0; $i < $cnt; $i++) {
if ($errors[$i] == NULL) {
continue;
}
$err_msg .= $items[$i] . " : " . $errors[$i] . "<BR>\n";
}
show_error($err_msg);
}
miwoftp_redirect(make_link("list", $dir, NULL));
return;
}
show_header($GLOBALS["messages"]["actupload"]);
?>
<script type="text/javascript">
$(document).ready(function() {
$('#file_upload').uploadify({
'uploader' : '/apps/uploadify/uploadify.swf',
'script' : '/apps/uploadify/uploadify.php',
'cancelImg' : '/apps/uploadify/cancel.png',
'folder' : '<?php
echo $GLOBALS["home_dir"] . $GLOBALS["dir"];
?>
',
'auto' : true,
'multi' : true,
'removeCompleted' : true,
'auto' : false
});
});
</script>
<?php
// List
echo "<BR><FORM enctype=\"multipart/form-data\" action=\"" . make_link("upload", $dir, NULL);
echo "\" method=\"post\">\n<INPUT type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"";
echo get_max_file_size() . "\"><INPUT type=\"hidden\" name=\"confirm\" value=\"true\"><TABLE>\n";
for ($i = 0; $i < 0; $i++) {
echo "<TR><TD nowrap align=\"center\">";
echo "<INPUT name=\"userfile[]\" id=\"file_upload\" type=\"file\" size=\"40\"></TD></TR>\n";
//.........这里部分代码省略.........
示例6: upload_items
function upload_items($dir)
{
if (!permissions_grant($dir, NULL, "create")) {
show_error($GLOBALS["error_msg"]["accessfunc"]);
}
// Execute
if (isset($GLOBALS['__POST']["confirm"]) && $GLOBALS['__POST']["confirm"] == "true") {
$cnt = count($GLOBALS['__FILES']['userfile']['name']);
$err = false;
$err_avaliable = isset($GLOBALS['__FILES']['userfile']['error']);
// upload files & check for errors
for ($i = 0; $i < $cnt; $i++) {
$errors[$i] = NULL;
$tmp = $GLOBALS['__FILES']['userfile']['tmp_name'][$i];
$items[$i] = stripslashes($GLOBALS['__FILES']['userfile']['name'][$i]);
if ($err_avaliable) {
$up_err = $GLOBALS['__FILES']['userfile']['error'][$i];
} else {
$up_err = file_exists($tmp) ? 0 : 4;
}
$abs = get_abs_item($dir, $items[$i]);
if ($items[$i] == "" || $up_err == 4) {
continue;
}
if ($up_err == 1 || $up_err == 2) {
$errors[$i] = $GLOBALS["error_msg"]["miscfilesize"];
$err = true;
continue;
}
if ($up_err == 3) {
$errors[$i] = $GLOBALS["error_msg"]["miscfilepart"];
$err = true;
continue;
}
if (!@is_uploaded_file($tmp)) {
$errors[$i] = $GLOBALS["error_msg"]["uploadfile"];
$err = true;
continue;
}
if (@file_exists($abs)) {
$errors[$i] = $GLOBALS["error_msg"]["itemdoesexist"];
$err = true;
continue;
}
// Upload
if (function_exists("move_uploaded_file")) {
$ok = @move_uploaded_file($tmp, $abs);
} else {
$ok = @copy($tmp, $abs);
@nlink($tmp);
// try to delete...
}
if ($ok === false) {
$errors[$i] = $GLOBALS["error_msg"]["uploadfile"];
$err = true;
continue;
}
}
if ($err) {
// there were errors
$err_msg = "";
for ($i = 0; $i < $cnt; $i++) {
if ($errors[$i] == NULL) {
continue;
}
$err_msg .= $items[$i] . " : " . $errors[$i] . "<BR>\n";
}
show_error($err_msg);
}
header("Location: " . make_link("list", $dir, NULL));
return;
}
show_header($GLOBALS["messages"]["actupload"]);
// List
echo "<BR><FORM enctype=\"multipart/form-data\" action=\"" . make_link("upload", $dir, NULL);
echo "\" method=\"post\">\n<INPUT type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"";
echo get_max_file_size() . "\"><INPUT type=\"hidden\" name=\"confirm\" value=\"true\"><TABLE>\n";
$filecount = 10;
for ($ii = 0; $ii < $filecount; $ii++) {
echo "<TR><TD nowrap align=\"center\">";
echo "<INPUT name=\"userfile[]\" type=\"file\" size=\"40\"></TD></TR>\n";
}
echo "</TABLE>\n<BR><TABLE><TR><TD><INPUT type=\"submit\" value=\"" . $GLOBALS["messages"]["btnupload"];
echo "\"></TD>\n<TD><input type=\"button\" value=\"" . $GLOBALS["messages"]["btncancel"];
echo "\" onClick=\"javascript:location='" . make_link("list", $dir, NULL) . "';\">\n</TD></TR></FORM></TABLE><BR>\n";
return;
}
示例7: execAction
//.........这里部分代码省略.........
echo get_cfg_var('session.name');
?>
": "<?php
echo session_id();
?>
",
"session_name": "<?php
echo session_name();
?>
",
"user_agent": "<?php
echo addslashes($_SERVER['HTTP_USER_AGENT']);
?>
",
"option": "com_extplorer",
"action": "upload",
"dir": datastore.directory,
"requestType": "xmlhttprequest",
"confirm": "true"
},
<?php
if ($_SERVER['SERVER_NAME'] == 'localhost') {
echo '"debug": "true",';
}
?>
"flash_url": "<?php
echo _EXT_URL;
?>
/scripts/extjs3-ext/ux.swfupload/swfupload.swf",
"prevent_swf_caching": "false",
"file_size_limit": "<?php
echo get_max_file_size();
?>
B",
// Custom Params
"single_file_select": false, // Set to true if you only want to select one file from the FileDialog.
"confirm_delete": false, // This will prompt for removing files from queue.
"remove_completed": false // Remove file from grid after uploaded.
},
{
"xtype": "form",
"autoScroll": "true",
"autoHeight": "true",
"id": "uploadform",
"fileUpload": true,
"labelWidth": 125,
"url":"<?php
echo basename($GLOBALS['script_name']);
?>
",
"title": "<?php
echo ext_Lang::msg('standardupload');
?>
",
"tooltip": "<?php
echo ext_Lang::msg('max_file_size') . ' = <strong>' . get_max_file_size() / 1024 / 1024 . ' MB<\\/strong><br \\/>' . ext_Lang::msg('max_post_size') . ' = <strong>' . get_max_upload_limit() / 1024 / 1024 . ' MB<\\/strong><br \\/>';
?>
",
"frame": true,
"items": [
{
"xtype": "displayfield",
"value": "<?php
echo ext_Lang::msg('max_file_size') . ' = <strong>' . get_max_file_size() / 1024 / 1024 . ' MB<\\/strong><br \\/>' . ext_Lang::msg('max_post_size') . ' = <strong>' . get_max_upload_limit() / 1024 / 1024 . ' MB<\\/strong><br \\/>';
示例8: get_url
/**
* Get URLs generated according to the specified information. It can also generate a thumbnail if required. It first tries attached upload, then URL, then fails.
*
* @param ID_TEXT The name of the POST parameter storing the URL (if '', then no POST parameter). Parameter value may be blank.
* @param ID_TEXT The name of the HTTP file parameter storing the upload (if '', then no HTTP file parameter). No file necessarily is uploaded under this.
* @param ID_TEXT The folder name in uploads/ where we will put this upload
* @param integer Whether to obfuscate file names so the URLs can not be guessed/derived (0=do not, 1=do, 2=make extension .dat as well, 3=only obfuscate if we need to)
* @set 0 1 2 3
* @param integer The type of upload it is (from an OCP_UPLOAD_* constant)
* @param boolean Make a thumbnail (this only makes sense, if it is an image)
* @param ID_TEXT The name of the POST parameter storing the thumb URL. As before
* @param ID_TEXT The name of the HTTP file parameter storing the thumb upload. As before
* @param boolean Whether to copy a URL (if a URL) to the server, and return a local reference
* @param boolean Whether to accept upload errors
* @param boolean Whether to give a (deferred?) error if no file was given at all
* @return array An array of 4 URL bits (URL, thumb URL, URL original filename, thumb original filename)
*/
function get_url($specify_name, $attach_name, $upload_folder, $obfuscate = 0, $enforce_type = 0, $make_thumbnail = false, $thumb_specify_name = '', $thumb_attach_name = '', $copy_to_server = false, $accept_errors = false, $should_get_something = false)
{
require_code('files2');
$upload_folder = filter_naughty($upload_folder);
$out = array();
$thumb = NULL;
$swf_uploaded = false;
$swf_uploaded_thumb = false;
foreach (array($attach_name, $thumb_attach_name) as $i => $_attach_name) {
if ($_attach_name == '') {
continue;
}
//check whatever it is an incoming upload
$row_id_file = 'hidFileID_' . $_attach_name;
$row_id_file_value = post_param($row_id_file, NULL);
if ($row_id_file_value == '-1') {
$row_id_file_value = NULL;
}
//id of the upload from the incoming uploads database table
if (!is_null($row_id_file_value)) {
//get the incoming uploads appropiate db table row
if (substr($row_id_file_value, -4) == '.dat' && strpos($row_id_file_value, ':') === false) {
$path = 'uploads/incoming/' . filter_naughty($row_id_file_value);
if (file_exists(get_custom_file_base() . '/' . $path)) {
$_FILES[$_attach_name] = array('type' => 'swfupload', 'name' => post_param(str_replace('hidFileID', 'hidFileName', $row_id_file)), 'tmp_name' => get_custom_file_base() . '/' . $path, 'size' => filesize(get_custom_file_base() . '/' . $path));
if ($i == 0) {
$swf_uploaded = true;
} else {
$swf_uploaded_thumb = true;
}
}
} else {
$incoming_uploads_id = intval(preg_replace('#:.*$#', '', $row_id_file_value));
$incoming_uploads_row = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . get_table_prefix() . 'incoming_uploads WHERE (i_submitter=' . strval(get_member()) . ' OR i_submitter=' . strval($GLOBALS['FORUM_DRIVER']->get_guest_id()) . ') AND id=' . strval($incoming_uploads_id), 1);
//if there is a db record proceed
if (array_key_exists(0, $incoming_uploads_row)) {
if (file_exists(get_custom_file_base() . '/' . $incoming_uploads_row[0]['i_save_url'])) {
$_FILES[$_attach_name] = array('type' => 'swfupload', 'name' => $incoming_uploads_row[0]['i_orig_filename'], 'tmp_name' => get_custom_file_base() . '/' . $incoming_uploads_row[0]['i_save_url'], 'size' => filesize(get_custom_file_base() . '/' . $incoming_uploads_row[0]['i_save_url']));
if ($i == 0) {
$swf_uploaded = true;
} else {
$swf_uploaded_thumb = true;
}
}
}
}
}
}
if ($obfuscate == 3) {
$accept_errors = true;
}
$thumb_folder = strpos($upload_folder, 'uploads/galleries') !== false ? str_replace('uploads/galleries', 'uploads/galleries_thumbs', $upload_folder) : $upload_folder . '_thumbs';
if (!file_exists(get_custom_file_base() . '/' . $upload_folder)) {
$success = @mkdir(get_custom_file_base() . '/' . $upload_folder, 0777);
if ($success === false) {
warn_exit(@strval($php_errormsg));
}
fix_permissions(get_custom_file_base() . '/' . $upload_folder, 0777);
sync_file($upload_folder);
}
if (!file_exists(get_custom_file_base() . '/' . $thumb_folder) && $make_thumbnail) {
$success = @mkdir(get_custom_file_base() . '/' . $thumb_folder, 0777);
if ($success === false) {
warn_exit(@strval($php_errormsg));
}
fix_permissions(get_custom_file_base() . '/' . $thumb_folder, 0777);
sync_file($thumb_folder);
}
// Find URL
require_code('images');
if ($enforce_type == OCP_UPLOAD_IMAGE || $enforce_type == OCP_UPLOAD_IMAGE_OR_SWF) {
$max_size = get_max_image_size();
} else {
require_code('files2');
$max_size = get_max_file_size();
}
if ($attach_name != '' && array_key_exists($attach_name, $_FILES) && (is_uploaded_file($_FILES[$attach_name]['tmp_name']) || $swf_uploaded)) {
if (!has_specific_permission(get_member(), 'exceed_filesize_limit')) {
if ($_FILES[$attach_name]['size'] > $max_size) {
if ($accept_errors) {
attach_message(do_lang_tempcode('FILE_TOO_BIG', integer_format($max_size)), 'warn');
return array('', '', '', '');
} else {
//.........这里部分代码省略.........
示例9: uploadDocument
function uploadDocument()
{
$uploadDocumentComponent=array();
$uploadDocumentComponent["xtype"]= "tabpanel";
$uploadDocumentComponent["stateId"]= "upload_tabpanel";
$uploadDocumentComponent["activeTab"]= "uploadform";
$uploadDocumentComponent["dialogtitle"]= G::LoadTranslation('ID_UPLOAD');
$uploadDocumentComponent["stateful"]= true;
$uploadDocumentComponent["stateEvents"]= array("tabchange");
$uploadDocumentComponent["getState"]= "function_getState";
$functionsToReplace['function_getState']="function() {
return {
activeTab:this.items.indexOf(this.getActiveTab())
};
}";
$uploadDocumentComponent["listeners"]["resize"]["fn"]="function_listeners_resize";
$functionsToReplace['function_listeners_resize'] = "function(panel) {
panel.items.each(function(item) { item.setHeight(500);return true });
}";
$uploadDocumentComponent["items"]=array();
$itemA=array();
$itemA["xtype"]= "swfuploadpanel";
$itemA["title"]= "flashupload";
$itemA["height"]= "300";
$itemA["id"]= "swfuploader";
$itemA["viewConfig"]["forceFit"]=true;
$itemA["listeners"]["allUploadsComplete"]["fn"]="function_listeners_allUploadsComplete";
$functionsToReplace['function_listeners_allUploadsComplete'] = "function(panel) {
datastore.reload();
panel.destroy();
Ext.getCmp('dialog').destroy();
statusBarMessage('upload_completed', false, true);
}";
// Uploader Params
$itemA["upload_url"]= "../appFolder/appFolderAjax.php";
$itemA["post_params"][session_name()]=session_id();
$itemA["post_params"]["option"]="uploadFile";
$itemA["post_params"]["action"]="upload";
$itemA["post_params"]["dir"]="datastore.directory";
$itemA["post_params"]["requestType"]="xmlhttprequest";
$itemA["post_params"]["confirm"]="true";
$itemA["flash_url"]="/scripts/extjs3-ext/ux.swfupload/swfupload.swf";
$itemA["file_size_limit"]=get_max_file_size();
// Custom Params
$itemA["single_file_select"]=false; // Set to true if you only want to select one file from the FileDialog.
$itemA["confirm_delete"]=false; // This will prompt for removing files from queue.
$itemA["remove_completed"]=false; // Remove file from grid after uploaded.
//$uploadDocumentComponent["items"][]=$itemA;
//Standard Upload
$itemA=array();
$itemA["xtype"]="form";
$itemA["autoScroll"]=true;
$itemA["autoHeight"]=true;
$itemA["id"]="uploadform";
$itemA["fileUpload"]=true;
$itemA["labelWidth"]="125";
$itemA["url"]="URL_SCRIPT";
$itemA["title"]=G::LoadTranslation('ID_UPLOAD');
//$itemA["tooltip"]="Max File Size <strong>". ((get_max_file_size() / 1024) / 1024)." MB</strong><br />
//Max Post Size<strong>". ((get_max_upload_limit() / 1024) / 1024)." MB</strong><br />";
$itemA["frame"]=true;
$itemA["items"]=array();
$itemB=array();
$itemB["xtype"]="displayfield";
$itemB["value"]="Max File Size <strong>". ((get_max_file_size() / 1024) / 1024)." MB</strong><br />
Max Post Size<strong>". ((get_max_upload_limit() / 1024) / 1024)." MB</strong><br />";
//$itemA["items"][]=$itemB;
for ($i=0; $i<7; $i++) {
$itemB=array();
$itemB["xtype"]="fileuploadfield";
$itemB["fieldLabel"]="File ".($i+1);
$itemB["id"]="uploadedFile[$i]";
$itemB["name"]="uploadedFile[$i]";
$itemB["width"]=275;
$itemB["buttonOnly"]= false;
$itemA["items"][]=$itemB;
}
$itemB=array();
$itemB["xtype"]="checkbox";
$itemB["fieldLabel"]="Overwrite";//G::LoadTranslation('ID_OVERWRITE');
$itemB["name"]="overwrite_files";
$itemB["checked"]=true;
$itemA["items"][]=$itemB;
$itemA["buttons"]=array();
$buttonA=array();
$buttonA["text"]=G::LoadTranslation('ID_SAVE');
//.........这里部分代码省略.........
示例10: _do_tags_comcode
//.........这里部分代码省略.........
}
} elseif (substr($id, 0, 4) == 'url_') {
if (!has_specific_permission($source_member, 'draw_to_server') && !$as_admin) {
break;
}
$_id = '!';
$attributes['type'] = post_param('attachmenttype' . $_id, array_key_exists('type', $attributes) ? $attributes['type'] : 'auto');
$url = remove_url_mistakes(substr($id, 4));
$_POST['_specify_url'] = $url;
// Little hack, as we need to read it from a POST
if (get_magic_quotes_gpc()) {
$_POST['_specify_url'] = addslashes($_POST['_specify_url']);
}
$urls = get_url('_specify_url', '', 'uploads/filedump', 1, OCP_UPLOAD_ANYTHING, (!array_key_exists('thumb', $attributes) || $attributes['thumb'] != '0') && $thumb_url == '', '', '', true, true);
if ($urls[0] == '') {
return new ocp_tempcode();
}
$original_filename = rawurldecode(substr($url, strrpos($url, '/') + 1));
if (url_is_local($urls[0])) {
$_size = @filesize(get_custom_file_base() . '/' . rawurldecode($urls[0]));
if ($_size === false) {
$_size = filesize(get_file_base() . '/' . rawurldecode($urls[0]));
}
} else {
$_size = 0;
}
} else {
$temp_tpl = do_template('WARNING_TABLE', array('WARNING' => do_lang_tempcode('comcode:INVALID_ATTACHMENT')));
break;
}
if ($urls[0] == '') {
require_code('images');
require_code('files2');
$temp_tpl = do_template('WARNING_TABLE', array('WARNING' => do_lang_tempcode('ATTACHMENT_WOULD_NOT_UPLOAD', float_format(get_max_file_size() / 1024 / 1024), float_format(get_max_image_size() / 1024 / 1024))));
break;
}
$url = $urls[0];
if ($connection->connection_write != $GLOBALS['SITE_DB']->connection_write) {
$url = get_custom_base_url() . '/' . $url;
}
if ($thumb_url == '') {
$thumb_url = array_key_exists(1, $urls) ? $urls[1] : '';
}
if ($thumb_url != '' && $connection != $GLOBALS['SITE_DB']) {
$thumb_url = get_custom_base_url() . '/' . $thumb_url;
}
$num_downloads = 0;
$last_downloaded_time = NULL;
$add_time = time();
$member_id = $on_behalf_of_member;
if (addon_installed('galleries')) {
require_code('images');
if (is_video($url) && $connection->connection_read == $GLOBALS['SITE_DB']->connection_read) {
require_code('transcoding');
$url = transcode_video($url, 'attachments', 'a_url', 'a_original_filename', NULL, NULL);
}
}
$attachment = array('a_member_id' => $member_id, 'a_file_size' => $_size, 'a_url' => $url, 'a_thumb_url' => $thumb_url, 'a_original_filename' => $original_filename, 'a_num_downloads' => $num_downloads, 'a_last_downloaded_time' => $last_downloaded_time, 'a_add_time' => $add_time);
$attachment['a_description'] = post_param('caption' . $_id, array_key_exists('description', $attributes) ? is_object($attributes['description']) ? '[html]' . $attributes['description']->evaluate() . '[/html]' : $attributes['description'] : '');
$attach_id = $connection->query_insert('attachments', $attachment, true);
$attachment['id'] = $attach_id;
if ($tag == 'attachment2' || $tag == 'attachment_safe' || substr($id, 0, 4) == 'url_') {
$connection->query_delete('attachment_refs', array('r_referer_type' => 'null', 'r_referer_id' => '', 'a_id' => $attachment['id']), '', 1);
$connection->query_insert('attachment_refs', array('r_referer_type' => 'null', 'r_referer_id' => '', 'a_id' => $attachment['id']));
}
// Create and document attachment
示例11: _gimp
/**
* The UI to import into a gallery.
*
* @return tempcode The UI
*/
function _gimp()
{
$cat = get_param('name', 'root');
check_specific_permission('mass_import');
if (substr($cat, 0, 7) != 'member_') {
$test = $GLOBALS['SITE_DB']->query_value_null_ok('galleries', 'name', array('name' => $cat));
if (is_null($test)) {
warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
}
}
$title = get_page_title('GALLERY_IMPORT');
require_code('form_templates');
require_lang('trackbacks');
// To choose to batch import from an attached tar or zip file (zip file only supported if zip module running on php install)
$post_url = build_url(array('page' => '_SELF', 'type' => '__gimp', 'cat' => $cat, 'uploading' => 1, 'redirect' => get_param('redirect', NULL)), '_SELF');
$fields = new ocp_tempcode();
$supported = 'tar';
if (function_exists('zip_open') || get_option('unzip_cmd') != '') {
$supported .= ', zip';
}
$fields->attach(form_input_upload_multi(do_lang_tempcode('UPLOAD'), do_lang_tempcode('DESCRIPTION_ARCHIVE_MEDIA', escape_html($supported), escape_html(str_replace(',', ', ', get_option('valid_images') . ',' . get_allowed_video_file_types()))), 'file', true, NULL, NULL, true, str_replace(' ', '', get_option('valid_images') . ',' . $supported)));
$hidden = new ocp_tempcode();
handle_max_file_size($hidden);
if (get_option('is_on_gd') == '1') {
if ($this->has_at_least_one_watermark($cat)) {
$fields->attach(form_input_tick(do_lang_tempcode('WATERMARK'), do_lang_tempcode('DESCRIPTION_WATERMARK'), 'watermark', true));
}
}
// Feedback
require_code('feedback2');
$fields->attach(feedback_fields(true, true, true, false, ''));
// Max upload limit
require_code('files2');
$max = floatval(get_max_file_size()) / floatval(1024 * 1024);
if ($max < 30.0) {
$config_url = get_upload_limit_config_url();
$text = paragraph(do_lang_tempcode(is_null($config_url) ? 'MAXIMUM_UPLOAD' : 'MAXIMUM_UPLOAD_STAFF', escape_html($max > 10.0 ? integer_format(intval($max)) : float_format($max)), escape_html(is_null($config_url) ? '' : $config_url)));
} else {
$text = new ocp_tempcode();
}
// Show form
$hidden->attach(form_input_hidden('test', '1'));
$form = do_template('FORM', array('_GUID' => '05de2bc134ed0b1ab703ac8bfbfabce4', 'TABINDEX' => strval(get_form_field_tabindex()), 'FIELDS' => $fields, 'SUBMIT_NAME' => do_lang_tempcode('BATCH_IMPORT_ARCHIVE_CONTENTS'), 'URL' => $post_url, 'TEXT' => $text, 'HIDDEN' => $hidden));
// Orphaned upload form
// To choose to batch import what already exists in gallery directory, but is orphaned
$orphaned_content = new ocp_tempcode();
if ($GLOBALS['FORUM_DRIVER']->is_staff(get_member()) && $GLOBALS['SITE_DB']->query_value('images', 'COUNT(*)') + $GLOBALS['SITE_DB']->query_value('videos', 'COUNT(*)') < 4000) {
require_code('images');
$there = array();
$_dir = opendir(get_custom_file_base() . '/uploads/galleries/');
while (false !== ($file = readdir($_dir))) {
if ($file != 'index.html' && !is_dir(get_custom_file_base() . '/uploads/galleries/' . $file) && (is_image($file) || is_video($file))) {
$there[$file] = filemtime(get_custom_file_base() . '/uploads/galleries/' . $file);
}
}
closedir($_dir);
$_dir = @opendir(get_custom_file_base() . '/uploads/galleries/' . filter_naughty($cat));
if ($_dir !== false) {
while (false !== ($file = readdir($_dir))) {
if ($file != 'index.html' && !is_dir(get_custom_file_base() . '/uploads/galleries/' . $cat . '/' . $file) && (is_image($file) || is_video($file))) {
$there[$cat . '/' . $file] = filemtime(get_custom_file_base() . '/uploads/galleries/' . $cat . '/' . $file);
}
}
closedir($_dir);
}
if (count($there) != 0) {
asort($there);
$test1 = collapse_1d_complexity('url', $GLOBALS['SITE_DB']->query_select('images', array('url')));
$test2 = collapse_1d_complexity('url', $GLOBALS['SITE_DB']->query_select('videos', array('url')));
arsort($there);
$temp_keys = array_keys($there);
$last_time = $there[$temp_keys[0]];
foreach ($there as $file => $time) {
if (!in_array('uploads/galleries/' . str_replace('%2F', '/', rawurlencode($file)), $test1) && !in_array('uploads/galleries/' . str_replace('%2F', '/', rawurlencode($file)), $test2)) {
$orphaned_content->attach(form_input_list_entry($file, $time >= $last_time - 60 * 60 * 3 || strpos($file, '/') !== false, $file));
}
}
}
$add_url = build_url(array('page' => '_SELF', 'type' => 'ss'), '_SELF');
if (!$orphaned_content->is_empty()) {
$fields_2 = new ocp_tempcode();
$hidden_2 = new ocp_tempcode();
if (get_param_integer('keep_de_orphan', 0) == 1) {
$cats = nice_get_gallery_tree($cat, NULL, false, false, false, false, NULL, true);
$fields_2->attach(form_input_list(do_lang_tempcode('GALLERY'), '', 'cat', $cats));
} else {
$hidden_2->attach(form_input_hidden('cat', $cat));
}
$fields_2->attach(form_input_multi_list(do_lang_tempcode('ENTRIES'), '', 'files', $orphaned_content));
if ($this->has_at_least_one_watermark($cat)) {
$fields_2->attach(form_input_various_ticks(array(array(do_lang_tempcode('WATERMARK'), 'watermark', true, ''), array(do_lang_tempcode('ALLOW_RATING'), 'allow_rating', true, ''), array(do_lang_tempcode('ALLOW_COMMENTS'), 'allow_comments', true, ''), array(do_lang_tempcode('ALLOW_REVIEWS'), 'allow_reviews', false, ''), array(do_lang_tempcode('ALLOW_TRACKBACKS'), 'allow_trackbacks', true, '')), '', NULL, do_lang_tempcode('OPTIONS')));
}
$radios = new ocp_tempcode();
$radios->attach(form_input_radio_entry('type', 'sa', true, do_lang_tempcode('ADD_GALLERY_SELECTION')));
$radios->attach(form_input_radio_entry('type', 'sd', false, do_lang_tempcode('DELETE_GALLERY_SELECTION')));
//.........这里部分代码省略.........
示例12: upload_items
function upload_items($dir)
{
if (!permissions_grant($dir, NULL, "create")) {
show_error($GLOBALS["error_msg"]["accessfunc"]);
}
// Execute
if (isset($GLOBALS['__POST']["confirm"]) && $GLOBALS['__POST']["confirm"] == "true") {
$cnt = count($GLOBALS['__FILES']['userfile']['name']);
$err = false;
$err_avaliable = isset($GLOBALS['__FILES']['userfile']['error']);
// upload files & check for errors
for ($i = 0; $i < $cnt; $i++) {
$errors[$i] = NULL;
$tmp = $GLOBALS['__FILES']['userfile']['tmp_name'][$i];
$items[$i] = stripslashes($GLOBALS['__FILES']['userfile']['name'][$i]);
if ($err_avaliable) {
$up_err = $GLOBALS['__FILES']['userfile']['error'][$i];
} else {
$up_err = file_exists($tmp) ? 0 : 4;
}
$abs = get_abs_item($dir, $items[$i]);
if ($items[$i] == "" || $up_err == 4) {
continue;
}
if ($up_err == 1 || $up_err == 2) {
$errors[$i] = $GLOBALS["error_msg"]["miscfilesize"];
$err = true;
continue;
}
if ($up_err == 3) {
$errors[$i] = $GLOBALS["error_msg"]["miscfilepart"];
$err = true;
continue;
}
if (!is_uploaded_file($tmp)) {
$errors[$i] = $GLOBALS["error_msg"]["uploadfile"];
$err = true;
continue;
}
if (file_exists($abs) && empty($_REQUEST['overwrite_files'])) {
$errors[$i] = $GLOBALS["error_msg"]["itemdoesexist"];
$err = true;
continue;
}
// Upload
if (function_exists("move_uploaded_file")) {
$ok = @move_uploaded_file($tmp, $abs);
} else {
$ok = @copy($tmp, $abs);
@nlink($tmp);
// try to delete...
}
if ($ok === false) {
$errors[$i] = $GLOBALS["error_msg"]["uploadfile"];
$err = true;
continue;
}
}
if ($err) {
// there were errors
$err_msg = "";
for ($i = 0; $i < $cnt; $i++) {
if ($errors[$i] == NULL) {
continue;
}
$err_msg .= $items[$i] . " : " . $errors[$i] . "<BR>\n";
}
show_error($err_msg);
}
miwoftp_redirect(make_link("list", $dir, NULL));
return;
}
//show_header($GLOBALS["messages"]["actupload"]);
echo "Nahrať súbor/súbory";
// List
echo "<br />";
echo "<form enctype=\"multipart/form-data\" action=\"" . make_link("upload", $dir, NULL) . "\" method=\"post\">";
echo "<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"\" method=\"post\">";
echo "<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"" . get_max_file_size() . "\">";
echo "<input type=\"hidden\" name=\"confirm\" value=\"true\">";
echo "<table>";
$filecount = 10;
for ($ii = 0; $ii < $filecount; $ii++) {
echo "<tr>";
echo "<td nowrap align=\"center\">";
echo "<input name=\"userfile[]\" type=\"file\" size=\"40\">";
echo "</td>";
echo "</tr>";
}
echo "</table>";
echo "<br />";
echo "<table>";
echo "<tr>";
echo "<td colspan=\"2\">";
echo "<input type=\"checkbox\" checked=\"checked\" value=\"1\" name=\"overwrite_files\" id=\"overwrite_files\" /><label for=\"overwrite_files\">Prepísať existujúci súbor/súbory?</label>";
echo "<br />";
echo "<br />";
echo "</td>";
echo "</tr>";
echo "<tr>";
//.........这里部分代码省略.........
示例13: execAction
function execAction($dir)
{
if (($GLOBALS["permissions"] & 01) != 01) {
ext_Result::sendResult('upload', false, $GLOBALS["error_msg"]["accessfunc"]);
}
// Execute
if (isset($GLOBALS['__POST']["confirm"]) && $GLOBALS['__POST']["confirm"] == "true") {
$cnt = count($GLOBALS['__FILES']['userfile']['name']);
$err = false;
$err_available = isset($GLOBALS['__FILES']['userfile']['error']);
// upload files & check for errors
for ($i = 0; $i < $cnt; $i++) {
$errors[$i] = NULL;
$tmp = $GLOBALS['__FILES']['userfile']['tmp_name'][$i];
$items[$i] = stripslashes($GLOBALS['__FILES']['userfile']['name'][$i]);
if ($err_available) {
$up_err = $GLOBALS['__FILES']['userfile']['error'][$i];
} else {
$up_err = file_exists($tmp) ? 0 : 4;
}
$abs = get_abs_item($dir, $items[$i]);
if ($items[$i] == "" || $up_err == 4) {
continue;
}
if ($up_err == 1 || $up_err == 2) {
$errors[$i] = $GLOBALS["error_msg"]["miscfilesize"];
$err = true;
continue;
}
if ($up_err == 3) {
$errors[$i] = $GLOBALS["error_msg"]["miscfilepart"];
$err = true;
continue;
}
if (!@is_uploaded_file($tmp)) {
$errors[$i] = $GLOBALS["error_msg"]["uploadfile"];
$err = true;
continue;
}
if (@file_exists($abs) && empty($_REQUEST['overwrite_files'])) {
$errors[$i] = $GLOBALS["error_msg"]["itemdoesexist"];
$err = true;
continue;
}
// Upload
$ok = @$GLOBALS['ext_File']->move_uploaded_file($tmp, $abs);
if ($ok === false || PEAR::isError($ok)) {
$errors[$i] = $GLOBALS["error_msg"]["uploadfile"];
if (PEAR::isError($ok)) {
$errors[$i] .= ' [' . $ok->getMessage() . ']';
}
$err = true;
continue;
} else {
if (!ext_isFTPMode()) {
@$GLOBALS['ext_File']->chmod($abs, 0644);
}
}
}
if ($err) {
// there were errors
$err_msg = "";
for ($i = 0; $i < $cnt; $i++) {
if ($errors[$i] == NULL) {
continue;
}
$err_msg .= $items[$i] . " : " . $errors[$i] . "\n";
}
ext_Result::sendResult('upload', false, $err_msg);
}
ext_Result::sendResult('upload', true, ext_Lang::msg('upload_completed'));
return;
}
?>
<div style="width:auto;">
<div class="x-box-tl"><div class="x-box-tr"><div class="x-box-tc"></div></div></div>
<div class="x-box-ml"><div class="x-box-mr"><div class="x-box-mc">
<h3 style="margin-bottom:5px;"><?php
echo ext_Lang::msg('actupload');
?>
</h3>
<?php
echo '<br />
' . ext_Lang::msg('max_file_size') . ' = <strong>' . get_max_file_size() / 1024 / 1024 . ' MB</strong><br />
' . ext_Lang::msg('max_post_size') . ' = <strong>' . get_max_upload_limit() / 1024 / 1024 . ' MB</strong><br />';
?>
<div id="adminForm">
<div id="uploadForm"></div>
<div id="transferForm"><h4><?php
echo ext_Lang::msg('acttransfer');
?>
</h4></div>
</div>
</div></div></div>
<div class="x-box-bl"><div class="x-box-br"><div class="x-box-bc"></div></div></div>
</div>
<script type="text/javascript">
var simple = new Ext.form.Form({
labelWidth: 125, // label settings here cascade unless overridden
//.........这里部分代码省略.........
示例14: addon_import
/**
* The UI to get an addon from some source.
*
* @return tempcode The UI
*/
function addon_import()
{
$title = get_page_title('IMPORT_ADDON');
require_code('form_templates');
$required = false;
$javascript = 'standardAlternateFields(\'file\',\'url\');';
$fields = new ocp_tempcode();
$fields->attach(form_input_upload(do_lang_tempcode('UPLOAD'), do_lang_tempcode('DESCRIPTION_UPLOAD'), 'file', $required, NULL, NULL, true, 'tar'));
$fields->attach(form_input_tree_list(do_lang_tempcode('DOWNLOAD'), do_lang_tempcode('DESCRIPTION_DOWNLOAD_OCPORTALCOM'), 'url', NULL, 'choose_ocportalcom_addon', array(), $required));
$hidden = new ocp_tempcode();
handle_max_file_size($hidden);
$submit_name = do_lang_tempcode('IMPORT_ADDON');
$post_url = build_url(array('page' => '_SELF', 'type' => '_addon_import', 'uploading' => 1), '_SELF');
breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('ADDONS'))));
$text = new ocp_tempcode();
require_code('files2');
$max = floatval(get_max_file_size()) / floatval(1024 * 1024);
if ($max < 30.0) {
$config_url = get_upload_limit_config_url();
$text->attach(paragraph(do_lang_tempcode(is_null($config_url) ? 'MAXIMUM_UPLOAD' : 'MAXIMUM_UPLOAD_STAFF', escape_html($max > 10.0 ? integer_format(intval($max)) : float_format($max)), escape_html(is_null($config_url) ? '' : $config_url))));
}
return do_template('FORM_SCREEN', array('_GUID' => '7f50130c5a46e0f6e8a95e936ce7bf47', 'SKIP_VALIDATION' => true, 'HIDDEN' => $hidden, 'TITLE' => $title, 'SUBMIT_NAME' => $submit_name, 'FIELDS' => $fields, 'TEXT' => $text, 'URL' => $post_url, 'JAVASCRIPT' => $javascript));
}
示例15: _ed
//.........这里部分代码省略.........
// SEO?
if (!is_null($this->seo_type)) {
require_code('seo2');
$fields2->attach(seo_get_fields($this->seo_type, $id));
}
// Awards?
if (addon_installed('awards')) {
if (!is_null($this->award_type)) {
require_code('awards');
$fields2->attach(get_award_fields($this->award_type, $id));
}
}
// Action fields / deletion options
$delete_permission = true;
if (!is_null($this->permissions_require)) {
$delete_permission = has_delete_permission($this->permissions_require, get_member(), $submitter, is_null($this->permission_page_name) ? get_page_name() : $this->permission_page_name, array($this->permissions_cat_require, is_null($this->permissions_cat_name) ? NULL : $this->get_cat($id), $this->permissions_cat_require_b, is_null($this->permissions_cat_name_b) ? NULL : $this->get_cat_b($id)));
}
$may_delete = (!method_exists($this, 'may_delete_this') || $this->may_delete_this($id)) && (!is_numeric($id) || intval($id) >= db_get_first_id() + $this->protect_first) && $delete_permission;
// Deletion options
$action_fields = new ocp_tempcode();
if ($may_delete) {
if (!$all_delete_fields_given) {
$action_fields->attach(form_input_tick(do_lang_tempcode('DELETE'), do_lang_tempcode('DESCRIPTION_DELETE'), 'delete', false));
}
if (addon_installed('points') && !is_null($submitter) && !is_null($date_and_time)) {
$points_test = $GLOBALS['SITE_DB']->query_value_null_ok('gifts', 'id', array('date_and_time' => $date_and_time, 'gift_to' => $submitter, 'gift_from' => $GLOBALS['FORUM_DRIVER']->get_guest_id()));
if (!is_null($points_test)) {
require_lang('points');
$action_fields->attach(form_input_tick(do_lang_tempcode('REVERSE_TITLE'), do_lang_tempcode('REVERSE_TITLE_DESCRIPTION'), 'reverse_point_transaction', false));
}
}
$action_fields->attach($delete_fields);
}
if (!$this->appended_actions_already && !$action_fields->is_empty()) {
$fields2->attach(do_template('FORM_SCREEN_FIELD_SPACER', array('TITLE' => do_lang_tempcode('ACTIONS'))));
}
$fields2->attach($action_fields);
if (!is_object($this->edit_text)) {
$this->edit_text = make_string_tempcode(is_null($this->edit_text) ? '' : $this->edit_text);
}
if (!is_null($this->upload)) {
if ($this->upload == 'image') {
require_code('images');
$max = floatval(get_max_image_size()) / floatval(1024 * 1024);
if ($max < 3.0) {
require_code('files2');
$config_url = get_upload_limit_config_url();
$this->edit_text->attach(paragraph(do_lang_tempcode(is_null($config_url) ? 'MAXIMUM_UPLOAD' : 'MAXIMUM_UPLOAD_STAFF', escape_html($max > 10.0 ? integer_format(intval($max)) : float_format($max)), escape_html(is_null($config_url) ? '' : $config_url))));
}
} else {
require_code('files2');
$max = floatval(get_max_file_size()) / floatval(1024 * 1024);
if ($max < 30.0) {
$config_url = get_upload_limit_config_url();
$this->edit_text->attach(paragraph(do_lang_tempcode(is_null($config_url) ? 'MAXIMUM_UPLOAD' : 'MAXIMUM_UPLOAD_STAFF', escape_html($max > 10.0 ? integer_format(intval($max)) : float_format($max)), escape_html(is_null($config_url) ? '' : $config_url))));
}
}
}
if (get_param('type', '_ed') == '_edit_catalogue') {
require_javascript('javascript_catalogues');
// Existing fields
$field_count = 0;
$c_name = get_param('id', false, true);
$rows = $GLOBALS['SITE_DB']->query_select('catalogue_fields', array('*'), array('c_name' => $c_name), 'ORDER BY cf_order');
$fields_existing = new ocp_tempcode();
foreach ($rows as $i => $myrow) {
$name = get_translated_text($myrow['cf_name']);
$description = get_translated_text($myrow['cf_description']);
$prefix = 'existing_field_' . strval($myrow['id']) . '_';
list($_fields_existing, $_fields_hidden) = $this->get_field_fields($i == 0 && substr($c_name, 0, 1) != '_', count($rows) + 10, $prefix, $field_count, $name, $description, $myrow['cf_type'], $myrow['cf_defines_order'], $myrow['cf_visible'], $myrow['cf_searchable'], $myrow['cf_default'], $myrow['cf_required'], $myrow['cf_put_in_category'], $myrow['cf_put_in_search']);
if (!is_ecommerce_catalogue($c_name) || $i > 9) {
$_fields_existing->attach(do_template('FORM_SCREEN_FIELD_SPACER', array('TITLE' => do_lang_tempcode('ACTIONS'))));
$_fields_existing->attach(form_input_tick(do_lang_tempcode('DELETE'), do_lang_tempcode('DESCRIPTION_DELETE'), $prefix . 'delete', false));
}
$temp = do_template('FORM_FIELD_SET_GROUPER', array('_GUID' => '1492d973db45cbecff892ad4ac1af28f' . get_class($this), 'NAME' => $name, 'ID' => 'FIELD_' . strval($i + 1), 'FIELDS' => $_fields_existing->evaluate()));
$fields_existing->attach($temp);
$hidden->attach($_fields_hidden);
$field_count++;
}
// New field
$fields_new = new ocp_tempcode();
for ($i = 0; $i < 5; $i++) {
list($_fields_new, $_fields_hidden) = $this->get_field_fields(false, count($rows) + 10, 'new_field_' . strval($i) . '_', $field_count);
$temp = do_template('FORM_FIELD_SET_GROUPER', array('_GUID' => '8b9a632eafae003ccc6b007eefb0ce3d' . get_class($this), 'NAME' => do_lang_tempcode('NEW_FIELD', strval($i + 1)), 'ID' => 'NEW_FIELD_' . strval($i + 1), 'FIELDS' => $_fields_new->evaluate()));
$fields_new->attach($temp);
$hidden->attach($_fields_hidden);
$field_count++;
}
$fields->attach($fields2);
return do_template('CATALOGUE_EDITING_SCREEN', array('_GUID' => '584d7dc7c2c13939626102374f13f508' . get_class($this), 'HIDDEN' => $hidden, 'TITLE' => $title, 'TEXT' => $this->add_text, 'URL' => $post_url, 'FIELDS' => $fields->evaluate(), 'FIELDS_EXISTING' => $fields_existing->evaluate(), 'FIELDS_NEW' => $fields_new->evaluate(), 'SUBMIT_NAME' => $submit_name, 'JAVASCRIPT' => $this->javascript));
}
list($warning_details, $ping_url) = handle_conflict_resolution();
if (!is_null($this->posting_form_title)) {
$posting_form = get_posting_form($submit_name, $this->posting_form_text, $post_url, $hidden, $fields, $this->posting_form_title, '', $fields2, $this->posting_form_text_parsed, $this->javascript, NULL, $this->posting_field_required);
return do_template('POSTING_SCREEN', array('_GUID' => '841b9af3aa80bcab86b907e4b942786a' . get_class($this), 'PREVIEW' => $this->do_preview, 'TITLE' => $title, 'SEPARATE_PREVIEW' => $this->second_stage_preview, 'PING_URL' => $ping_url, 'WARNING_DETAILS' => $warning_details, 'TEXT' => $this->add_text, 'POSTING_FORM' => $posting_form->evaluate(), 'JAVASCRIPT' => $this->javascript));
} else {
$fields->attach($fields2);
return do_template('FORM_SCREEN', array('_GUID' => '2d70be34595a16c6f170d966b894bfe2' . get_class($this), 'PREVIEW' => $this->do_preview, 'SEPARATE_PREVIEW' => $this->second_stage_preview, 'TITLE' => $title, 'SKIP_VALIDATION' => $this->skip_validation, 'PING_URL' => $ping_url, 'WARNING_DETAILS' => $warning_details, 'HIDDEN' => $hidden, 'TEXT' => $this->edit_text, 'URL' => $post_url, 'FIELDS' => $fields->evaluate(), 'SUBMIT_NAME' => $submit_name, 'JAVASCRIPT' => $this->javascript));
}
}