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


PHP tool::secureFiles方法代码示例

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


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

示例1: insert

 function insert()
 {
     global $dbInst, $loginInst, $toolInst;
     if (!$loginInst->hasAccess("request.insert")) {
         return false;
     }
     if (!$this->check()) {
         return false;
     }
     $query = "insert into " . $dbInst->config['table_request'] . " " . "(subject,body,time,priority_id,poster_id,type_id,project_id) " . "values (" . "'" . $this->subject . "'," . "'" . $this->body . "'," . "'" . $toolInst->getTime("U") . "'," . "'" . $this->priorityId . "'," . "'" . $this->posterId . "'," . "'" . $this->typeId . "'," . "'" . $this->projectId . "')";
     $result = $dbInst->query($query);
     $id = $dbInst->getValue("select distinct last_insert_id() from " . $dbInst->config['table_request']);
     $dbInst->status($result[1], "i");
     if ($result[1] == 1 || $result[1] == 0) {
         $this->id = $id;
         $this->mail("there's a NEW request for you. Please assign this to a developer:");
         // logging
         $projectInst = new project($this->projectId);
         $this->logger->info("added request (" . $this->subject . ") to project " . $projectInst->name);
         if (tool::secureFiles('userfile', 'name') && @file_exists(tool::secureFiles('userfile', 'tmp_name'))) {
             // attachment successfully uploaded, we can save it
             $attach = new attachment();
             $attach->taskId = $this->id;
             $attach->insert();
             $this->logger->info("added attachment (" . $this->file . ") to request " . $this->subject);
         }
         return $id;
     } else {
         return false;
     }
 }
开发者ID:pmtool,项目名称:pmtool,代码行数:31,代码来源:request.inc.php

示例2: update

 /**
  * boolean update()
  * updates a task in database
  * @return true on success, else false
  * @access public
  */
 function update()
 {
     global $dbInst, $config, $toolInst, $loginInst;
     if (!$loginInst->hasAccess("task.update")) {
         return false;
     }
     if (!$this->check()) {
         return false;
     }
     if ($this->id == $this->mountId) {
         $toolInst->errorStatus("recursion error: unable to mount task into itself");
         return false;
     }
     if (in_array($this->id, $this->treeId($this->mountId))) {
         $toolInst->errorStatus("recursion error: unable to mount task into one of its members");
         return false;
     }
     $query = "update " . $dbInst->config['table_task'] . " set " . "finish = '" . $this->finish . "'," . "plannedhours = '" . $this->plannedHours . "',";
     if ($loginInst->hasAccess("task.fixedPrice")) {
         $query .= "fixedprice = '" . str_replace(',', '.', $this->fixedPrice) . "',";
     }
     $query .= "body = '" . $this->body . "'," . "type_id = '" . $this->typeId . "'," . "user_id = '" . $this->userId . "'," . "subject = '" . $this->subject . "'," . "mount_id = '" . $this->mountId . "'," . "status_id = '" . $this->statusId . "'," . "poster_id = '" . $this->posterId . "'," . "project_id = '" . $this->projectId . "'," . "priority_id = '" . $this->priorityId . "' where id = '" . $this->id . "'";
     $result = $dbInst->query($query);
     $dbInst->status($result[1], "u");
     if ($result[1] == 1 || $result[1] == 0) {
         // notification mail to manager, if task set to done
         if ($result[1] == 1 && $this->isDone()) {
             $projectInst = new project($this->projectId);
             $this->mail($projectInst->managerId, " --== TASK DONE ==--\n\nused time: " . $toolInst->formatTime($this->getSummary()));
         }
         // logging
         $userInst = new user($this->userId);
         $this->logger->info("changed task (" . $this->subject . ") for " . $userInst->name);
         if (tool::secureFiles('userfile', 'name') && @file_exists(tool::secureFiles('userfile', 'tmp_name'))) {
             // attachment successfully uploaded, we can save it
             $attach = new attachment();
             $attach->taskId = $this->id;
             $attach->insert();
             $this->logger->info("added attachment (" . $this->file . ") to task " . $this->subject);
             unset($_FILES['userfile']);
         }
         // process all childs
         $childs = $this->childs();
         while ($element = current($childs)) {
             $child = new task($element);
             // we need to update the project id in all child tasks
             $child->projectId = $this->projectId;
             // task is set to status "done", we should start all child tasks now
             if ($this->isDone()) {
                 $child->start();
                 $child->mail($child->userId, "There's an automatically started task for you:");
             }
             $child->update();
             next($childs);
         }
         return true;
     }
     return false;
 }
开发者ID:pmtool,项目名称:pmtool,代码行数:65,代码来源:task.inc.php

示例3: insert

 function insert()
 {
     global $config, $dbInst, $toolInst, $loginInst;
     $this->created = $toolInst->getTime("U");
     // set the name of the attachment
     $this->name = tool::secureFiles('userfile', 'name');
     if (!$this->check()) {
         return false;
     }
     if (!$loginInst->hasAccess("attachment.insert")) {
         return false;
     }
     if (!@file_exists(tool::secureFiles('userfile', 'tmp_name'))) {
         $toolInst->errorStatus("file was not successfully uploaded to the server.");
         return false;
     }
     // create a new directory based on the current time.
     // this is needed to attach multiple files with the same name
     $dir = $config['attach_dir'] . "/" . $this->created;
     mkdir($dir, 0755);
     // copy the file from the temporary server location into the pmtool
     // attachment directory
     $file = $dir . "/" . $this->name;
     if (!@move_uploaded_file(tool::secureFiles('userfile', 'tmp_name'), $file)) {
         $toolInst->errorStatus("unable to move the file from temporary server location into pmtool dir.");
         return false;
     }
     $query = "insert into " . $dbInst->config['table_attachment'] . " " . "(task_id,name,created) " . "values (" . "'" . $this->taskId . "'," . "'" . $this->name . "'," . "'" . $this->created . "')";
     $result = $dbInst->query($query);
     $id = $dbInst->getValue("select distinct last_insert_id() from " . $dbInst->config['table_attachment']);
     $dbInst->status($result[1], "i");
     if ($result[1] == 1 || $result[1] == 0) {
         // logging
         $this->logger->info("added attachment " . $file);
         return $id;
     } else {
         return false;
     }
 }
开发者ID:pmtool,项目名称:pmtool,代码行数:39,代码来源:attachment.inc.php


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