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


PHP file_storage::action_update_form方法代码示例

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


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

示例1:

 function action_update()
 {
     log_debug("journal_process", "Executing action_update()");
     /*
     	Start Transaction
     */
     $sql_obj = new sql_query();
     $sql_obj->trans_begin();
     /*
     	If no ID supplied, create a new journal entry first
     */
     if (empty($this->structure["id"])) {
         $mode = "create";
         if (!$this->action_create()) {
             return 0;
         }
     } else {
         $mode = "update";
     }
     /*
     	Handle some optional fields
     */
     if (!isset($this->structure["content"])) {
         $this->structure["content"] = "";
     }
     if (!isset($this->structure["userid"])) {
         // automated system user
         $this->structure["userid"] = 0;
     }
     /*
     	Update journal record
     */
     $sql_obj->string = "UPDATE `journal` SET " . "userid='" . $this->structure["userid"] . "', " . "customid='" . $this->structure["customid"] . "', " . "timestamp='" . $this->structure["timestamp"] . "', " . "title='" . $this->structure["title"] . "', " . "content='" . $this->structure["content"] . "' " . "WHERE id='" . $this->structure["id"] . "' LIMIT 1";
     $sql_obj->execute();
     /*
     	If journal entry is a file, upload the data
     
     	TODO: this currently only works for form uploads
     */
     if ($this->structure["type"] == "file") {
         if (isset($_FILES["upload"]["name"])) {
             log_write("debug", "journal_process", "Uploading file against journal entry from POST form data");
             // output file data
             $file_obj = new file_storage();
             $file_obj->data["type"] = "journal";
             $file_obj->data["customid"] = $this->structure["id"];
             if ($file_obj->load_data_bytype()) {
                 log_debug("journal_process", "Old file exists, will overwrite.");
                 // unset the title variable - otherwise the action_update_form function will retain the existing title
                 $file_obj->data["file_name"] = NULL;
             } else {
                 log_debug("journal_process", "No previous file exists, performing clean upload.");
             }
             // call the upload function
             if (!$file_obj->action_update_form("upload")) {
                 log_write("error", "journal_process", "Unable to upload file for journal entry id " . $this->structure["id"] . "");
             }
         } else {
             // not uploading
             log_write("debug", "journal_process", "No file POST data provided, not uploading file to journal - assuming manual DB upload");
         }
     }
     /*
     	Commit
     */
     if (error_check()) {
         $sql_obj->trans_rollback();
         log_write("error", "journal_process", "An error occured whilst updating the journal.");
         return 0;
     } else {
         $sql_obj->trans_commit();
         if ($this->structure["type"] != "event") {
             if ($mode == "update") {
                 log_write("notification", "journal_process", "Journal entry updated successfully.");
             } else {
                 log_write("notification", "journal_process", "New record added to the journal successfully.");
             }
         }
         return 1;
     }
     return 0;
 }
开发者ID:claybbs,项目名称:namedmanager,代码行数:82,代码来源:inc_journal.php

示例2: header

 	Update the logo file if required
 */
 if ($_FILES["COMPANY_LOGO"]["size"] > 1) {
     // set file variables
     $file_obj->data["type"] = "COMPANY_LOGO";
     $file_obj->data["customid"] = "0";
     // see if a file already exists
     if ($file_obj->load_data_bytype()) {
         log_debug("process", "Old file exists, will overwrite.");
     } else {
         log_debug("process", "No previous file exists, performing clean upload.");
     }
     // force the filename
     $file_obj->data["file_name"] = "company_logo.png";
     // call the upload function
     if (!$file_obj->action_update_form("COMPANY_LOGO")) {
         log_write("error", "process", "Unable to upload company logo");
     }
 }
 /*
 	Commit
 */
 if (error_check()) {
     $sql_obj->trans_rollback();
     log_write("error", "process", "An error occured whilst updating configuration, no changes have been applied.");
 } else {
     $sql_obj->trans_commit();
     log_write("notification", "process", "Company configuration updated successfully");
 }
 header("Location: ../index.php?page=admin/config_company.php");
 exit(0);
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:31,代码来源:config_company-process.php


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