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


PHP phorum_api_file_delete函数代码示例

本文整理汇总了PHP中phorum_api_file_delete函数的典型用法代码示例。如果您正苦于以下问题:PHP phorum_api_file_delete函数的具体用法?PHP phorum_api_file_delete怎么用?PHP phorum_api_file_delete使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: array

// Update attachments in the meta data, link active attachments
// to the message and delete stale attachments.
$dbmessage["meta"]["attachments"] = array();
foreach ($message["attachments"] as $info) {
    if ($info["keep"]) {
        // Because there might be inconsistencies in the list due to going
        // backward in the browser after deleting attachments, a check is
        // needed to see if the attachments are really in the database.
        if (!phorum_api_file_exists($info["file_id"])) {
            continue;
        }
        $dbmessage["meta"]["attachments"][] = array("file_id" => $info["file_id"], "name" => $info["name"], "size" => $info["size"]);
        $PHORUM['DB']->file_link($info["file_id"], $message["message_id"], PHORUM_LINK_MESSAGE);
    } else {
        if (phorum_api_file_check_delete_access($info["file_id"])) {
            phorum_api_file_delete($info["file_id"]);
        }
    }
}
if (!count($dbmessage["meta"]["attachments"])) {
    unset($dbmessage["meta"]["attachments"]);
}
/*
 * [hook]
 *     before_edit
 *
 * [description]
 *     This hook can be used to change the edited message before it is stored in
 *     the database.
 *
 * [category]
开发者ID:samuell,项目名称:Core,代码行数:31,代码来源:action_edit.php

示例2: phorum_api_user_delete

/**
 * Delete a Phorum user.
 *
 * @param integer $user_id
 *     The user_id of the user that has to be deleted.
 */
function phorum_api_user_delete($user_id)
{
    settype($user_id, "int");
    /**
     * [hook]
     *     user_delete
     *
     * [description]
     *     Modules can use this hook to run some additional user cleanup
     *     tasks or or to keep some external system in sync with the Phorum
     *     user data.
     *
     * [category]
     *     User data handling
     *
     * [when]
     *     Just before a user is deleted.
     *
     * [input]
     *     The user_id of the user that will be deleted.
     *
     * [output]
     *     The same user_id as the one that was used for the hook
     *     call argument.
     *
     * [example]
     *     <hookcode>
     *     function phorum_mod_foo_user_delete($user_id)
     *     {
     *         // Get user info
     *         $user = phorum_api_user_get($user_id);
     *
     *         // Log user delete through syslog.
     *         openlog("Phorum", LOG_PID | LOG_PERROR, LOG_LOCAL0);
     *         syslog(LOG_NOTICE, "Delete user registration: $user[username]");
     *
     *         return $user_id;
     *     }
     *     </hookcode>
     */
    if (isset($GLOBALS['PHORUM']['hooks']['user_delete'])) {
        phorum_hook('user_delete', $user_id);
    }
    // If user caching is enabled, we remove the user from the cache.
    if (!empty($GLOBALS['PHORUM']['cache_users'])) {
        phorum_cache_remove('user', $user_id);
    }
    // Remove the user and user related data from the database.
    phorum_db_user_delete($user_id);
    // Delete the personal user files for this user.
    require_once dirname(__FILE__) . '/file_storage.php';
    $files = phorum_api_file_list(PHORUM_LINK_USER, $user_id, 0);
    foreach ($files as $file_id => $file) {
        phorum_api_file_delete($file_id);
    }
}
开发者ID:mgs2,项目名称:kw-forum,代码行数:62,代码来源:user.php

示例3: list

        // A hook to allow modules to implement extra or different
        // delete functionality.
        if ($doit && isset($mod_forums[$delete_messages[$msgthd_id]['forum_id']])) {
            $delete_handled = 0;
            if (isset($PHORUM["hooks"]["before_delete"])) {
                list($delete_handled, $msg_ids, $msgthd_id, $delete_messages[$msgthd_id], $delete_mode) = phorum_hook("before_delete", array(0, 0, $msgthd_id, $delete_messages[$msgthd_id], PHORUM_DELETE_MESSAGE));
            }
            // Handle the delete action, unless a module already handled it.
            if (!$delete_handled) {
                // Delete the message from the database.
                phorum_db_delete_message($msgthd_id, PHORUM_DELETE_MESSAGE);
                // Delete the message attachments from the database.
                $files = phorum_db_get_message_file_list($msgthd_id);
                foreach ($files as $file_id => $data) {
                    if (phorum_api_file_check_delete_access($file_id)) {
                        phorum_api_file_delete($file_id);
                    }
                }
            }
            // Run a hook for performing custom actions after cleanup.
            if (isset($PHORUM["hooks"]["delete"])) {
                phorum_hook("delete", array($msgthd_id));
            }
        }
    }
}
$PHORUM['DATA']['PREPOST'] = array();
if ($gotforums) {
    $foruminfo = phorum_db_get_forums($mod_forums, NULL, $PHORUM['vroot']);
} else {
    $foruminfo = array();
开发者ID:mgs2,项目名称:kw-forum,代码行数:31,代码来源:messages.php

示例4: phorum_api_file_purge_stale

/**
 * This function is used for purging stale files from the Phorum system.
 *
 * @param boolean $do_purge
 *     If this parameter is set to a false value (the default), then no
 *     actual purging will take place. The function will only return an
 *     array of stale files. If the parameter is set to a true value,
 *     then the stale files will be purged for real.
 *
 * @return array
 *     An array of stale Phorum files, indexed by file_id. Every item in
 *     this array is an array on its own, containing the fields:
 *     - file_id: the file id of the stale file
 *     - filename: the name of the stale file
 *     - filesize: the size of the file in bytes
 *     - add_datetime: the time (epoch) at which the file was added
 *     - reason: the reason why it's a stale file
 *     This array will be returned, regardless of the $do_purge parameter.
 */
function phorum_api_file_purge_stale($do_purge)
{
    $stale_files = phorum_db_list_stale_files();
    /**
     * [hook]
     *     file_purge_stale
     *
     * [description]
     *     This hook can be used to feed the file storage API function
     *     phorum_api_file_purge_stale() extra stale files. This can be
     *     useful for modules that handle their own files, using a
     *     custom link type.
     *
     * [category]
     *     File storage
     *
     * [when]
     *     Right after Phorum created its own list of stale files.
     *
     * [input]
     *     An array containing stale files, indexed by file_id. Each item
     *     in this array is an array on its own, containing the following
     *     fields:
     *     <ul>
     *     <li>file_id:
     *         the file id of the stale file</li>
     *     <li>filename:
     *         the name of the stale file</li>
     *     <li>filesize:
     *         the size of the file in bytes</li>
     *     <li>add_datetime:
     *         the time (epoch) at which the file was added</li>
     *     <li>reason:
     *         the reason why it's a stale file</li>
     *     </ul>
     *
     * [output]
     *     The same array as the one that was used for the hook call
     *     argument, possibly extended with extra files that are
     *     considered to be stale.
     */
    if (isset($GLOBALS['PHORUM']['hooks']['file_purge_stale'])) {
        $stale_files = phorum_hook('file_purge_stale', $stale_files);
    }
    // Delete the files if requested.
    if ($do_purge) {
        foreach ($stale_files as $file) {
            phorum_api_file_delete($file);
        }
    }
    return $stale_files;
}
开发者ID:sheldon,项目名称:dejavu,代码行数:71,代码来源:file_storage.php


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