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


PHP FileManager::update_db_info方法代码示例

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


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

示例1: change_name

/**
This function changes the name of a certain file.
It needs no global variables, it takes all info from parameters.
It returns nothing.
@todo check if this function is used
*/
function change_name($base_work_dir, $source_file, $rename_to, $dir, $doc)
{
    $file_name_for_change = $base_work_dir . $dir . $source_file;
    //api_display_debug_info("call FileManager::my_rename: params $file_name_for_change, $rename_to");
    $rename_to = FileManager::disable_dangerous_file($rename_to);
    // Avoid renaming to .htaccess file
    $rename_to = FileManager::my_rename($file_name_for_change, stripslashes($rename_to));
    // fileManage API
    if ($rename_to) {
        if (isset($dir) && $dir != '') {
            $source_file = $dir . $source_file;
            $new_full_file_name = dirname($source_file) . '/' . $rename_to;
        } else {
            $source_file = '/' . $source_file;
            $new_full_file_name = '/' . $rename_to;
        }
        FileManager::update_db_info('update', $source_file, $new_full_file_name);
        // fileManage API
        $name_changed = get_lang('ElRen');
        $info_message = get_lang('fileModified');
        $GLOBALS['file_name'] = $rename_to;
        $GLOBALS['doc'] = $rename_to;
        return $info_message;
    } else {
        $dialogBox = get_lang('FileExists');
        // TODO: This variable is not used.
        /* Return to step 1 */
        $rename = $source_file;
        unset($source_file);
    }
}
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:37,代码来源:edit_document.php

示例2: api_not_allowed

         api_not_allowed();
     }
 }
 $document_to_move = DocumentManager::get_document_data_by_id($_POST['move_file'], api_get_course_id());
 // Security fix: make sure they can't move files that are not in the document table
 if (!empty($document_to_move)) {
     $real_path_target = $base_work_dir . $_POST['move_to'] . '/' . basename($document_to_move['path']);
     $fileExist = false;
     if (file_exists($real_path_target)) {
         $fileExist = true;
     }
     if (FileManager::move($base_work_dir . $document_to_move['path'], $base_work_dir . $_POST['move_to'])) {
         //if (1) {
         //$contents = DocumentManager::replace_urls_inside_content_html_when_moving_file(basename($document_to_move['path']), $base_work_dir.dirname($document_to_move['path']), $base_work_dir.$_POST['move_to']);
         //exit;
         FileManager::update_db_info('update', $document_to_move['path'], $_POST['move_to'] . '/' . basename($document_to_move['path']));
         //update database item property
         $doc_id = $_POST['move_file'];
         if (is_dir($real_path_target)) {
             api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'FolderMoved', api_get_user_id(), $to_group_id, null, null, null, $session_id);
             Display::display_confirmation_message(get_lang('DirMv'));
         } elseif (is_file($real_path_target)) {
             api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentMoved', api_get_user_id(), $to_group_id, null, null, null, $session_id);
             Display::display_confirmation_message(get_lang('DocMv'));
         }
         // Set the current path
         $curdirpath = $_POST['move_to'];
         $curdirpathurl = urlencode($_POST['move_to']);
     } else {
         if ($fileExist) {
             if (is_dir($real_path_target)) {
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:document_lite.php

示例3: switch

     Security::clear_token();
 }
 if (!empty($hpchoice)) {
     switch ($hpchoice) {
         case 'delete':
             // deletes an exercise
             $imgparams = array();
             $imgcount = 0;
             GetImgParams($file, $documentPath, $imgparams, $imgcount);
             $fld = GetFolderName($file);
             for ($i = 0; $i < $imgcount; $i++) {
                 FileManager::my_delete($documentPath . $uploadPath . "/" . $fld . "/" . $imgparams[$i]);
                 FileManager::update_db_info("delete", $uploadPath . "/" . $fld . "/" . $imgparams[$i]);
             }
             if (FileManager::my_delete($documentPath . $file)) {
                 FileManager::update_db_info("delete", $file);
             }
             // hotpotatoes folder may contains several tests so don't delete folder if not empty : #2165
             if (!(strstr($uploadPath, DIR_HOTPOTATOES) && !FileManager::folder_is_empty($documentPath . $uploadPath . "/" . $fld . "/"))) {
                 FileManager::my_delete($documentPath . $uploadPath . "/" . $fld . "/");
             }
             break;
         case 'enable':
             // enables an exercise
             $newVisibilityStatus = "1";
             //"visible"
             $query = "SELECT id FROM {$TBL_DOCUMENT} WHERE c_id = {$course_id} AND path='" . Database::escape_string($file) . "'";
             $res = Database::query($query);
             $row = Database::fetch_array($res, 'ASSOC');
             api_item_property_update($_course, TOOL_DOCUMENT, $row['id'], 'visible', $_user['user_id']);
             break;
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:exercice.php

示例4: api_item_property_update

     api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'FolderCreated', api_get_user_id());
 } else {
     // It is not the first step... get the filename directly from the system params.
     $filename = $_FILES['userFile']['name'];
 }
 $allow_output_on_success = false;
 if (FileManager::handle_uploaded_document($_course, $_FILES['userFile'], $document_sys_path, $uploadPath . '/' . $fld, api_get_user_id(), null, null, $unzip, '', $allow_output_on_success)) {
     if ($finish == 2) {
         $imgparams = $_POST['imgparams'];
         $checked = CheckImageName($imgparams, $filename);
         if ($checked) {
             $imgcount = $imgcount - 1;
         } else {
             $dialogBox .= $filename . ' ' . get_lang('NameNotEqual');
             FileManager::my_delete($document_sys_path . $uploadPath . '/' . $fld . '/' . $filename);
             FileManager::update_db_info('delete', $uploadPath . '/' . $fld . '/' . $filename);
         }
         if ($imgcount == 0) {
             // all image uploaded
             $finish = 1;
         }
     } else {
         // If we are (still) on the first step of the upload process.
         if ($finish == 0) {
             $finish = 2;
             // Get number and name of images from the files contents.
             GetImgParams('/' . $filename, $document_sys_path . $uploadPath . '/' . $fld, $imgparams, $imgcount);
             if ($imgcount == 0) {
                 $finish = 1;
             } else {
                 $dialogBox .= get_lang('DownloadEnd');
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:31,代码来源:hotpotatoes.php


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