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


PHP forum::get_attachment_playspace_files方法代码示例

本文整理汇总了PHP中forum::get_attachment_playspace_files方法的典型用法代码示例。如果您正苦于以下问题:PHP forum::get_attachment_playspace_files方法的具体用法?PHP forum::get_attachment_playspace_files怎么用?PHP forum::get_attachment_playspace_files使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在forum的用法示例。


在下文中一共展示了forum::get_attachment_playspace_files方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: required_param

$cmid = required_param('id', PARAM_INT);
$cloneid = optional_param('clone', 0, PARAM_INT);
$file = required_param('file', PARAM_FILE);
$playspaceid = optional_param('attachmentplayspace', 0, PARAM_SEQUENCE);
$postid = optional_param('p', 0, PARAM_INT);
try {
    // Security check
    if ($postid) {
        $post = forum_post::get_from_id($postid, $cloneid);
        $post->require_view();
    } else {
        $forum = forum::get_from_cmid($cmid, $cloneid);
        $forum->require_view(forum::NO_GROUPS);
    }
    if (!$playspaceid) {
        $playspaceid = forum::create_attachment_playspace($postid ? $post : null);
    }
    // Delete the file (if not present, ignore)
    $files = forum::get_attachment_playspace_files($playspaceid, false);
    foreach ($files as $existing) {
        if (basename($existing) == $file) {
            forum_utils::unlink($existing);
        }
    }
    // Print out the playspace id in case they don't already have it
    header('Content-Type: text/plain');
    print $playspaceid;
} catch (forum_exception $e) {
    header('Content-Type: text/plain', true, 500);
    print $e->getMessage();
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:31,代码来源:deleteattachment.php

示例2: array

 if (trim($fromform->subject) === '') {
     $fromform->subject = null;
 }
 if (!isset($fromform->mailnow)) {
     $fromform->mailnow = false;
 }
 if (!isset($fromform->setimportant)) {
     $fromform->setimportant = false;
 }
 if (!isset($fromform->format)) {
     $fromform->format = 0;
 }
 $attachments = array();
 if (!empty($fromform->attachmentplayspace)) {
     $deleteattachments = true;
     $attachments = forum::get_attachment_playspace_files($fromform->attachmentplayspace, optional_param('keepplayspace', 0, PARAM_INT));
 } else {
     // Attachments are saved initially into a temp folder, then
     // moved into place
     $uploadfolder = $CFG->dataroot . '/moddata/forumng/uploads/' . $USER->id . ',' . mt_rand();
     $mform->save_files($uploadfolder);
     if (is_dir($uploadfolder)) {
         $handle = opendir($uploadfolder);
         while (false !== ($item = readdir($handle))) {
             if ($item != '.' && $item != '..') {
                 $attachments[] = $uploadfolder . '/' . $item;
             }
         }
         closedir($handle);
     }
     // Get list of attachments to delete
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:31,代码来源:editpost.php


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