本文整理汇总了PHP中forum::get_attachment_playspace_folder方法的典型用法代码示例。如果您正苦于以下问题:PHP forum::get_attachment_playspace_folder方法的具体用法?PHP forum::get_attachment_playspace_folder怎么用?PHP forum::get_attachment_playspace_folder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类forum
的用法示例。
在下文中一共展示了forum::get_attachment_playspace_folder方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: print_header
if ($postid) {
$post = forum_post::get_from_id($postid, $cloneid);
$post->require_view();
$forum = $post->get_forum();
} else {
$forum = forum::get_from_cmid($cmid, $cloneid);
$forum->require_view(forum::NO_GROUPS);
}
print_header();
$um = $forum->get_upload_manager('file');
$um->config->allownull = false;
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$playspaceid = required_param('attachmentplayspace', PARAM_SEQUENCE);
$ok = $um->preprocess_files();
if ($ok && ($name = $um->get_new_filename())) {
$um->save_files(forum::get_attachment_playspace_folder($playspaceid));
?>
<script type="text/javascript">
window.opener.currentform.addattachment("<?php
print addslashes_js($name);
?>
");
window.close();
</script><?php
print_footer('empty');
exit;
} else {
print $um->get_errors();
}
}
$playspaceid = optional_param('attachmentplayspace', 0, PARAM_SEQUENCE);
示例2: optional_param
$draftid = optional_param('draft', 0, PARAM_INT);
if ($draftid) {
$draft = forum_draft::get_from_id($draftid);
if (!$draft->is_reply() || $draft->get_discussion_id() != $discussionid) {
print_error('draft_mismatch', 'forumng', $forum->get_url(forum::PARAM_HTML));
}
$root = $discussion->get_root_post();
$inreplyto = $root->find_child($draft->get_parent_post_id(), false);
if (!$inreplyto || !$inreplyto->can_reply($whynot) || !$discussion->can_view()) {
print_error('draft_cannotreply', 'forumng', $forum->get_url(forum::PARAM_HTML), get_string($whynot, 'forumng'));
}
$inreplyto->force_expand();
$draftplayspaceid = 0;
if ($draft->has_attachments()) {
$draftplayspaceid = forum::create_attachment_playspace();
$target = forum::get_attachment_playspace_folder($draftplayspaceid);
$source = $draft->get_attachment_folder();
foreach ($draft->get_attachment_names() as $name) {
forum_utils::copy("{$source}/{$name}", "{$target}/{$name}");
}
}
}
// Check that discussion can be viewed [Handles all other permissions]
$discussion->require_view();
// Search form for header
$buttontext = $forum->display_search_form();
// Atom header meta tag
$feedtype = $forum->get_effective_feed_option();
if ($feedtype == forum::FEEDTYPE_ALL_POSTS) {
$atomurl = $discussion->get_feed_url(forum::FEEDFORMAT_ATOM);
$meta = '<link rel="alternate" type="application/atom+xml" ' . 'title="Atom feed" href="' . htmlspecialchars($atomurl) . '" />';
示例3: delete_old_playspaces
/**
* If you add an attachment to a post then do not finish it, this will
* create a 'zombie playspace' where the attachment is stored. This function
* deletes all playspaces older than 24 hours.
*/
public static function delete_old_playspaces()
{
$start = microtime(true);
mtrace('Deleting old attachment playspaces ', '');
// Find folder used for attachment playspaces
$folder = dirname(forum::get_attachment_playspace_folder('1,1'));
if (!is_dir($folder)) {
// No playspaces at all
mtrace('[folder not found]');
return;
}
self::clear_old_folders($start, $folder);
}