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


PHP CFile::secure_tmpname方法代码示例

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


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

示例1: saveFile

 /**
  * Сохраняем документ на сайте.
  * 
  * @return \CFile
  */
 public function saveFile()
 {
     $login = 'admin';
     $content = $this->getOutput();
     $file = new CFile();
     $file->path = 'users/' . substr($login, 0, 2) . "/{$login}/upload/";
     $file->name = basename($file->secure_tmpname($file->path, '.odt'));
     $file->size = strlen($content);
     if ($file->putContent($file->path . $file->name, $content)) {
         return $file;
     }
 }
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:17,代码来源:ODTDocument.php

示例2: billingOperation


//.........这里部分代码省略.........
             }
             if ($project['country'] == null) {
                 $project['country'] = 'null';
             }
             if ($project['city'] == null) {
                 $project['city'] = 'null';
             }
             $project['name'] = addslashes($project['name']);
             $project['descr'] = addslashes($project['descr']);
             if ($project['logo_id'] <= 0) {
                 $project['logo_id'] = 'null';
             }
             $project['folder_id'] = 'null';
             $items = array();
             switch ($option['option']) {
                 case 'top':
                     $project['top_days'] = $option['op_count'];
                     break;
                 case 'color':
                     $is_pay = $project['payed_items'] & '010';
                     if ($is_pay != '010') {
                         $project['payed_items'] = $project['payed_items'] | '010';
                         $project['is_color'] = 't';
                         $items['color'] = true;
                         if (is_pro()) {
                             $is_payed = true;
                             $prj->SavePayedInfo($items, $project['id'], null, $project['top_days']);
                             $prj->editPrj($project, false);
                         }
                     } else {
                         $is_payed = true;
                     }
                     break;
                 case 'bold':
                     $is_pay = $project['payed_items'] & '001';
                     if ($is_pay != '001') {
                         $project['payed_items'] = $project['payed_items'] | '001';
                         $project['is_bold'] = 't';
                         $items['bold'] = true;
                     } else {
                         $is_payed = true;
                     }
                     break;
                 case 'logo':
                     $is_pay = $project['payed_items'] & '100';
                     if ($is_pay != '100') {
                         $key = md5(microtime());
                         $prj = new tmp_project($key);
                         $prj->init(1);
                         $fu = new CFile($option['src_id']);
                         $ext = $fu->getext();
                         $tmp_dir = $prj->getDstAbsDir();
                         $tmp_name = $fu->secure_tmpname($tmp_dir, '.' . $ext);
                         $tmp_name = substr_replace($tmp_name, "", 0, strlen($tmp_dir));
                         $fu->table = 'file_projects';
                         $r = $fu->_remoteCopy($tmp_dir . $tmp_name);
                         $project['payed_items'] = $project['payed_items'] | '100';
                         $project['logo_id'] = $fu->id;
                         $items['logo'] = true;
                         if ($option['extra']) {
                             $project['link'] = $option['extra'];
                         }
                     } else {
                         $is_payed = true;
                     }
                     break;
             }
             if (!$is_payed) {
                 $error = $account->Buy($bill_id, $transaction_id, $option['op_code'], $this->uid, $option['descr'], $option['comment'], $option['ammount'], 0);
                 $ok = $bill_id > 0;
                 $project['billing_id'] = $bill_id;
                 $prj->SavePayedInfo($items, $project['id'], $bill_id, $project['top_days']);
                 $prj->editPrj($project, false);
             } else {
                 $ok = true;
             }
             break;
             // Платные ответы на проекты
         // Платные ответы на проекты
         case 61:
             $answers = new projects_offers_answers();
             $error = $answers->BuyByFM($this->uid, $option['op_count'], $transaction_id, 0);
             if (!$error) {
                 $ok = true;
                 $_SESSION['answers_ammount'] = $option['op_count'];
                 // Публикуем ответы
                 $step_frl = new step_freelancer();
                 $offers = $step_frl->getWizardOffers($this->uid, $option['op_count']);
                 if ($offers) {
                     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/users.php";
                     $step_frl->log = $this->log;
                     $step_frl->user = new users();
                     $step_frl->user->GetUserByUID($this->uid);
                     $step_frl->transferOffers($offers);
                 }
             }
             break;
     }
     return $ok;
 }
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:101,代码来源:wizard_billing.php

示例3: trim

 $path = __paramInit("string", null, "path");
 $path = trim($path, '/');
 $info = '';
 $old_link = '';
 $rename_name = '';
 $name = '';
 $link = '';
 $error_folder = '';
 $cf = new CFile($_FILES['document'], dav_file_upload::FILE_TABLE);
 if ($cf->CheckPath($path)) {
     $destname = dav_file_upload_createDestName($cf);
     //check existing file
     $existingFile = new CFile("{$path}/{$destname}");
     if ($existingFile->id > 0) {
         $ext = $existingFile->getext($existingFile->name);
         $tmp = $existingFile->secure_tmpname($path . '/', '.' . $ext);
         $rename_name = substr_replace($tmp, "", 0, strlen($path) + 1);
         $s = preg_replace("#\\." . $ext . "\$#", "", $destname);
         $length = strlen($s . '_' . $rename_name);
         if ($length > 64 && strlen($rename_name) < 64) {
             $s = substr($s, 0, 63 - strlen($rename_name));
             $rename_name = $s . "_" . $rename_name;
         }
         $existingFile->Rename("{$path}/{$rename_name}");
         $info = 'Файл был заменен';
         $old_link = WDCPREFIX . '/' . $path . '/' . $rename_name;
     }
     $cf->server_root = 1;
     $cf->max_size = dav_file_upload::MAX_FILE_SIZE;
     $cf->MoveUploadedFile($path . '/', true, $destname);
     $err = is_string($cf->error[0]) ? $cf->error : $cf->error[0];
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:31,代码来源:index.php

示例4: Update

 /**
  * Редактирование личного сообщения.
  * 
  * @param int    $from_id            UID пользователя-отправителя 
  * @param int    $modified_id        UID пользователя изменявшего сообщение
  * @param int    $id                 ID сообщения
  * @param string $msg_text           текст сообщения
  * @param array  $attachedfiles_file приаттаченные файлы
  * @param string $modified_reason    причина редактирования
  *
  * @return bool true - успех, false - провал
  */
 public function Update($from_id = 0, $modified_id = 0, $id = 0, $msg_text = '', $attachedfiles_file = array(), $modified_reason = '')
 {
     $bRet = false;
     if ($from_id && $id && $msg_text) {
         require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
         $users = new users();
         $login = $users->GetName($from_id, $err);
         $files = array();
         if ($login) {
             if ($attachedfiles_file) {
                 foreach ($attachedfiles_file as $file) {
                     switch ($file['status']) {
                         case 1:
                             // добавляем файл
                             $cFile = new CFile($file['id']);
                             $cFile->table = 'file';
                             $ext = $cFile->getext();
                             $tmp_dir = 'users/' . substr($login['login'], 0, 2) . '/' . $login['login'] . '/contacts/';
                             $tmp_name = $cFile->secure_tmpname($tmp_dir, '.' . $ext);
                             $tmp_name = substr_replace($tmp_name, '', 0, strlen($tmp_dir));
                             $cFile->_remoteCopy($tmp_dir . $tmp_name, true);
                             $files[] = $cFile->id;
                             break;
                         case 3:
                             // ранее добавленный
                             $files[] = $file['id'];
                             break;
                         case 4:
                             // удаляем файл
                             $cFile = new CFile();
                             $cFile->Delete($file['id']);
                             break;
                     }
                 }
             }
             $DB = new DB();
             $DB->val('SELECT message_update(?i, ?i, ?, ?a, ?)', $id, $modified_id, $msg_text, $files, $modified_reason);
             $bRet = empty($DB->error);
         }
     }
     return $bRet;
 }
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:54,代码来源:messages.php

示例5: header

 **/
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stdf.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/CFile.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/dav_file_upload.php';
if (!hasPermissions('admin')) {
    header('Location: /404.php');
    exit;
}
$srcdir = $_SERVER['DOCUMENT_ROOT'] . '/about';
$ls = scandir($srcdir);
foreach ($ls as $item) {
    if ($item != '.' && $item !== '..' && !is_dir("{$srcdir}/{$item}")) {
        $filedata = array('name' => $item, 'tmp_name' => "{$srcdir}/{$item}", 'size' => filesize("{$srcdir}/{$item}"));
        $srcfile = new CFile($filedata);
        $srcfile->unlinkOff = true;
        $path = 'about/documents';
        $destfile = new CFile("{$path}/{$item}", dav_file_upload::FILE_TABLE);
        $rename_name = '';
        if ($destfile->id) {
            $ext = $destfile->getext($destfile->name);
            $tmp = $destfile->secure_tmpname($path . '/', '.' . $ext);
            $rename_name = substr_replace($tmp, '', 0, strlen($path) + 1);
            $destfile->Rename("{$path}/{$rename_name}");
        }
        $srcfile->server_root = 1;
        $srcfile->max_size = dav_file_upload::MAX_FILE_SIZE;
        $r = $srcfile->MoveUploadedFile($path . '/', true, $item);
        dav_file_upload::addRecord($srcfile->id, $srcfile->name, $rename_name);
        echo "Copy {$srcdir}/{$item} " . WDCPREFIX . '/' . $path . '/' . $item . '<br><br>';
    }
}
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:31,代码来源:copy_about_documents.php

示例6: addAttachedFiles

 /**
  * Связывает файлы загруженные ассинхронно с проектом и добавляет информацию о них в массив $this->_attach
  *
  * @param   array     $files         Список добавляемых файлов
  * @param   boolean   $from_draft    Файлы из черновика
  */
 function addAttachedFiles($files, $from_draft = false)
 {
     global $DB;
     $old_files = array();
     if ($this->_attach) {
         foreach ($this->_attach as $f) {
             array_push($old_files, $f['file_id']);
         }
     }
     if ($from_draft) {
         if ($this->_attach) {
             foreach ($this->_attach as $attach_id => $attach) {
                 if (!in_array($attach['file_id'], $old_files)) {
                     $this->delAttach($attach_id, true);
                 }
             }
         }
     }
     if ($files) {
         foreach ($files as $file) {
             switch ($file['status']) {
                 case 4:
                     // Удаляем файл
                     if ($this->_attach) {
                         foreach ($this->_attach as $attach_id => $attach) {
                             if ($attach['file_id'] == $file['id']) {
                                 $this->delAttach($attach_id, true);
                             }
                         }
                     }
                     break;
                 case 1:
                 case 3:
                     // Добавляем файл
                     if (!in_array($file['id'], $old_files)) {
                         if (in_array($file['id'], $old_files)) {
                             $need_copy = false;
                         } else {
                             $need_copy = true;
                         }
                         $cFile = new CFile($file['id']);
                         $cFile->table = 'file_projects';
                         $ext = $cFile->getext();
                         if ($need_copy) {
                             $tmp_dir = $this->_tmpAbsDir;
                             $tmp_name = $cFile->secure_tmpname($tmp_dir, '.' . $ext);
                             $tmp_name = substr_replace($tmp_name, "", 0, strlen($tmp_dir));
                             $cFile->_remoteCopy($tmp_dir . $tmp_name, true);
                         }
                         $this->_attach[] = array('file_id' => $cFile->id, 'path' => $cFile->path, 'name' => $cFile->name, 'size' => $cFile->size, 'ftype' => $cFile->getext(), 'is_new' => true);
                         $this->_tmpFiles[] = $cFile->name;
                     }
                     break;
             }
         }
     }
 }
开发者ID:amage,项目名称:fl-ru-damp,代码行数:63,代码来源:projects.php

示例7: addAttachedFiles

 /**
  *  Добавление/удаление файлов к рассылке
  * @param array   $files   Список файлов
  * @param integer $id      Ид рассылки
  */
 public function addAttachedFiles($files, $id)
 {
     if ($files) {
         foreach ($files as $file) {
             switch ($file['status']) {
                 case 4:
                     // Удаляем файл
                     $this->delAttach($file['id']);
                     break;
                 case 1:
                     // Добавляем файл
                     $cFile = new CFile($file['id']);
                     $cFile->table = 'file_mailer';
                     $ext = $cFile->getext();
                     $tmp_name = $cFile->secure_tmpname(self::FILE_DIR, '.' . $ext);
                     $tmp_name = substr_replace($tmp_name, "", 0, strlen(self::FILE_DIR));
                     $cFile->_remoteCopy(self::FILE_DIR . $tmp_name, true);
                     $this->insertAttachedFile($cFile->id, $id);
                     break;
             }
         }
     }
 }
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:28,代码来源:mailer.php

示例8: addAttachedFiles

 /**
  * Связывает файлы загруженные ассинхронно с комментарием
  *
  * @param  array $files Список загруженных файлов @see attachedfiles::getFiles
  * @param  string $login Логин пользователя
  * @param  integer $msg_id ID комментария
  * @return bool
  */
 function addAttachedFiles($files = array(), $msg_id = 0, $login = '')
 {
     global $DB;
     $model = $this->model();
     if (!isset($model['attaches'])) {
         return false;
     }
     if (!$login) {
         $login = $_SESSION['login'];
     }
     $sql = 'SELECT ' . $model['attaches']['fields']['file'] . ' AS fid FROM ' . $model['attaches']['table'] . ' WHERE ' . $model['attaches']['fields']['comment'] . ' = ?i AND ' . $model['attaches']['fields']['inline'] . ' != TRUE';
     $attaches = $DB->rows($sql, $msg_id);
     $old_files = array();
     if ($attaches) {
         foreach ($attaches as $f) {
             array_push($old_files, $f['fid']);
         }
     }
     $max_image_size = array('width' => 390, 'height' => 1000, 'less' => 0);
     if ($files) {
         $num = 0;
         foreach ($files as $file) {
             switch ($file['status']) {
                 case 4:
                     // Удаляем файл
                     $cFile = new CFile($file['id']);
                     $cFile->table = $model['attaches']['file_table'];
                     if ($cFile->id) {
                         $sql = 'DELETE FROM ' . $model['attaches']['table'] . ' WHERE ' . $model['attaches']['fields']['file'] . ' = ?i';
                         $DB->query($sql, $cFile->id);
                         $cFile->Delete($cFile->id);
                     }
                     break;
                 case 1:
                     $num++;
                     if (in_array($file['id'], $old_files)) {
                         $need_copy = false;
                     } else {
                         $need_copy = true;
                     }
                     // Добавляем файл
                     $cFile = new CFile($file['id']);
                     $cFile->proportional = 1;
                     $cFile->table = $model['attaches']['file_table'];
                     $ext = $cFile->getext();
                     if ($need_copy) {
                         $tmp_dir = 'users/' . substr($login, 0, 2) . '/' . $login . '/upload/';
                         $tmp_name = $cFile->secure_tmpname($tmp_dir, '.' . $ext);
                         $tmp_name = substr_replace($tmp_name, '', 0, strlen($tmp_dir));
                         $cFile->_remoteCopy($tmp_dir . $tmp_name, true);
                     }
                     if (in_array($ext, $GLOBALS['graf_array'])) {
                         $is_image = TRUE;
                     } else {
                         $is_image = FALSE;
                     }
                     if ($is_image && $ext != 'swf' && $ext != 'flv') {
                         if ($cFile->image_size['width'] > $max_image_size['width'] || $cFile->image_size['height'] > $max_image_size['height']) {
                             if ($need_copy) {
                                 if ($cFile->resizeImage($cFile->path . 'sm_' . $cFile->name, $max_image_size['width'], $cFile->image_size['height'], 'landscape')) {
                                     $cFile->small = true;
                                 }
                             } else {
                                 $cFile->small = true;
                             }
                         } else {
                             $cFile->small = false;
                         }
                     } else {
                         $cFile->small = false;
                     }
                     $aData = array($model['attaches']['fields']['comment'] => $msg_id, $model['attaches']['fields']['file'] => $cFile->id);
                     if (isset($model['attaches']['fields']['small'])) {
                         $aData[$model['attaches']['fields']['small']] = $cFile->small;
                     }
                     if (isset($model['attaches']['fields']['sort'])) {
                         $aData[$model['attaches']['fields']['sort']] = $num;
                     }
                     $DB->insert($model['attaches']['table'], $aData);
                     break;
             }
         }
     }
     return true;
 }
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:93,代码来源:Comments.php

示例9: CFile

 /**
  * Сохраняет контент документа в файл.
  * 
  * @param string $content   текст файла.
  * @param string $ext   расширение файла.
  * @return CFile   загруженный файл.
  */
 function _saveDocFile($content, $ext = '.pdf')
 {
     if (trim($content) == "") {
         return NULL;
     }
     $file = new CFile();
     $file->table = 'file_sbr';
     $file->path = $this->getUploadDir();
     $file->name = basename($file->secure_tmpname($file->path, '.pdf'));
     $file->size = strlen($content);
     if ($file->putContent($file->path . $file->name, $content)) {
         return $file;
     }
     return NULL;
 }
开发者ID:amage,项目名称:fl-ru-damp,代码行数:22,代码来源:sbr.php

示例10: generateExcel

 /**
  * Генерация Exсel таблицы на основе шаблона 
  * 
  * @param type $cellnames - массив ячеек где искать шаблоны подстановки
  * @return boolean|\CFile
  */
 public function generateExcel($cellnames = array('A1'))
 {
     if (empty($cellnames) || empty($this->data)) {
         return false;
     }
     $objReader = PHPExcel_IOFactory::createReader('Excel5');
     $objPHPExcel = $objReader->load(ABS_PATH . $this->template_path . $this->template);
     $data = array();
     foreach ($this->data as $key => $value) {
         $value = iconv("windows-1251", "utf-8", $value);
         $data['{' . $key . '}'] = $value;
     }
     $keys = array_keys($data);
     $vals = array_values($data);
     foreach ($cellnames as $cellname) {
         $content = (string) $objPHPExcel->getActiveSheet()->getCell($cellname);
         if (!empty($content)) {
             $content = str_replace($keys, $vals, $content);
             $objPHPExcel->getActiveSheet()->setCellValue($cellname, $content);
         }
     }
     if (!file_exists($this->tmp_path)) {
         mkdir($this->tmp_path, 0777);
     }
     $tmpFilename = tempnam($this->tmp_path, 'tmp');
     //$tmpFilename = $this->tmp_path . substr(md5(microtime()), 0, 6) . '.xls';
     $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
     $objWriter->save($tmpFilename);
     $content = file_get_contents($tmpFilename);
     unlink($tmpFilename);
     $file = new CFile();
     $file->path = $this->getFilePath();
     $file->table = $this->file_table;
     $file->size = strlen($content);
     $file->src_id = $this->file_src_id;
     $file->name = basename($file->secure_tmpname($file->path, '.xls'));
     $file->original_name = change_q_x($this->file_original_name);
     if (!$file->putContent($file->path . $file->name, $content)) {
         return false;
     }
     Events::trigger('generate_file', $file);
     return $file;
 }
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:49,代码来源:DocGen.php

示例11: generateInvoice

 /**
  * НЕ ИСПОЛЬЗОВАТЬ - УСТАРЕЛ СМ generateInvoice2.
  * 
  * Генерация счета
  *
  * @todo: может перенести генерацию в очереди?
  * @todo: но тогда нужно организовать обратную связь.
  * 
  * @param type $user_info
  *
  * @return bool|\CFile
  */
 public function generateInvoice($user_info)
 {
     extract($this->options);
     $file = new CFile();
     $file_path = $this->getFilePath();
     $reserve_id = @$this->data['reserve_id'];
     if (!$file_path || !$reserve_id || empty($this->data)) {
         return false;
     }
     $data = $this->getCheckByReserveId($reserve_id);
     if (isset($data['payed_date']) && !empty($data['payed_date'])) {
         return false;
     }
     if (isset($data['check_file_id']) && $data['check_file_id'] > 0) {
         $file->Delete($data['check_file_id']);
     }
     if (!$data) {
         $data = array();
     }
     $this->data = array_merge($data, $this->data, $user_info);
     $data = $this->data;
     $bill_num = sprintf($bill_num_format, $data['reserve_id']);
     $data['bill_num'] = $bill_num;
     $data['date'] = date_text($data['date'], 'd');
     $data['price_txt'] = num2str(intval($data['price']));
     $data['price'] = number_format($data['price'], 2, ',', '');
     $data['title'] = sprintf($check_title, $bill_num);
     foreach ($data as $key => $value) {
         $data['$' . $key] = $value;
         unset($data[$key]);
     }
     $pdf = new odt2pdf($invoice_template);
     $pdf->setFolder(ABS_PATH . $templates_path);
     $pdf->convert($data);
     $content = $pdf->output(null, 'S');
     $len = strlen($content);
     if (!$len) {
         return false;
     }
     $file->path = $file_path;
     $file->table = $table_files;
     $file->size = $len;
     $file->src_id = $src_id;
     $file->name = basename($file->secure_tmpname($file->path, '.pdf'));
     $file->original_name = change_q_x(sprintf($check_org_filename, $bill_num));
     if (!$file->putContent($file->path . $file->name, $content)) {
         return false;
     }
     $this->data['check_file_id'] = $file->id;
     return $this->addCheck() ? $file : false;
 }
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:63,代码来源:ReservesBank.php

示例12: updateDocument


//.........这里部分代码省略.........
         $data['letters_doc_frm_user2_status_date_data'] = null;
     }
     if (!$data['letters_doc_frm_user1_status_date_data']) {
         $data['letters_doc_frm_user1_status_date_data'] = null;
     }
     if (!$data['letters_doc_frm_user3_status_data']) {
         $data['letters_doc_frm_user3_status_data'] = null;
     }
     if (!$data['letters_doc_frm_user2_status_data']) {
         $data['letters_doc_frm_user2_status_data'] = null;
     }
     if (!$data['letters_doc_frm_user1_status_data']) {
         $data['letters_doc_frm_user1_status_data'] = null;
     }
     if (!$data['letters_doc_frm_parent_db_id'] || $data['letters_doc_frm_parent_db_id'] == 'null') {
         $data['letters_doc_frm_parent_db_id'] = null;
     }
     if (!$data['letters_doc_frm_group'] || $data['letters_doc_frm_group'] == 'null') {
         $data['letters_doc_frm_group'] = null;
     }
     if (!$data['letters_doc_frm_group_db_id'] || $data['letters_doc_frm_group_db_id'] == 'null') {
         $data['letters_doc_frm_group_db_id'] = null;
     }
     if (!$data['letters_doc_frm_group_db_id'] && !empty($data['letters_doc_frm_group'])) {
         $data['letters_doc_frm_group_db_id'] = letters::checkCreateGroup($data['letters_doc_frm_group']);
     }
     if ($data['letters_doc_frm_user_1_section'] == '1') {
         $data['letters_doc_frm_user_1_section'] = true;
     } else {
         $data['letters_doc_frm_user_1_section'] = false;
     }
     if ($data['letters_doc_frm_user_2_section'] == '1') {
         $data['letters_doc_frm_user_2_section'] = true;
     } else {
         $data['letters_doc_frm_user_2_section'] = false;
     }
     if ($data['letters_doc_frm_user_3_section'] == '1') {
         $data['letters_doc_frm_user_3_section'] = true;
     } else {
         $data['letters_doc_frm_user_3_section'] = false;
     }
     if ($data['letters_doc_frm_withoutourdoc'] == '1') {
         $data['letters_doc_frm_withoutourdoc'] = true;
     } else {
         $data['letters_doc_frm_withoutourdoc'] = false;
     }
     $doc = self::getDocument($id);
     $doc_data['title'] = $data['letters_doc_frm_title'];
     $doc_data['user_1'] = $data['letters_doc_frm_user_1_db_id'];
     $doc_data['user_2'] = $data['letters_doc_frm_user_2_db_id'];
     $doc_data['user_3'] = $data['letters_doc_frm_user_3_db_id'];
     $doc_data['group_id'] = $data['letters_doc_frm_group_db_id'];
     $doc_data['parent'] = $data['letters_doc_frm_parent_db_id'];
     $doc_data['user_status_1'] = $data['letters_doc_frm_user1_status_data'];
     $doc_data['user_status_2'] = $data['letters_doc_frm_user2_status_data'];
     $doc_data['user_status_3'] = $data['letters_doc_frm_user3_status_data'];
     $doc_data['user_status_date_1'] = $data['letters_doc_frm_user1_status_date_data'];
     $doc_data['user_status_date_2'] = $data['letters_doc_frm_user2_status_date_data'];
     $doc_data['user_status_date_3'] = $data['letters_doc_frm_user3_status_date_data'];
     $doc_data['is_user_1_company'] = $data['letters_doc_frm_user_1_section'] ? 't' : 'f';
     $doc_data['is_user_2_company'] = $data['letters_doc_frm_user_2_section'] ? 't' : 'f';
     $doc_data['is_user_3_company'] = $data['letters_doc_frm_user_3_section'] ? 't' : 'f';
     $doc_data['withoutourdoc'] = $data['withoutourdoc'] ? 't' : 'f';
     if (isset($data['letters_doc_frm_comment']) && $data['letters_doc_frm_comment']) {
         $doc_data['comment'] = $data['letters_doc_frm_comment'];
     } else {
         $data['letters_doc_frm_comment'] = $doc['comment'];
     }
     if ($doc_data['user_status_1'] != $doc['user_status_1'] || $doc_data['user_status_2'] != $doc['user_status_2'] || $doc_data['user_status_3'] != $doc['user_status_3']) {
         letters::updateDateStatusChange($id);
     }
     letters::saveHistory($id, $doc_data);
     $sql = "UPDATE letters SET\n                                     date_add = " . ($data['letters_doc_frm_dateadd_eng_format'] ? "'{$data['letters_doc_frm_dateadd_eng_format']}'" : "NOW()") . ",\n                                     title = ?,\n                                     user_1 = ?,\n                                     user_2 = ?,\n                                     user_3 = ?,\n                                     group_id = ?,\n                                     parent = ?,\n                                     user_status_1 = ?, \n                                     user_status_2 = ?, \n                                     user_status_3 = ?, \n                                     user_status_date_1 = ?, \n                                     user_status_date_2 = ?, \n                                     user_status_date_3 = ?,\n                                     is_user_1_company = ?,  \n                                     is_user_2_company = ?, \n                                     is_user_3_company = ?, \n                                     withoutourdoc = ?,\n                                     comment = ?\n                WHERE id = ?i;";
     $DB->query($sql, $data['letters_doc_frm_title'], $data['letters_doc_frm_user_1_db_id'], $data['letters_doc_frm_user_2_db_id'], $data['letters_doc_frm_user_3_db_id'], $data['letters_doc_frm_group_db_id'], $data['letters_doc_frm_parent_db_id'], $data['letters_doc_frm_user1_status_data'], $data['letters_doc_frm_user2_status_data'], $data['letters_doc_frm_user3_status_data'], $data['letters_doc_frm_user1_status_date_data'], $data['letters_doc_frm_user2_status_date_data'], $data['letters_doc_frm_user3_status_date_data'], $data['letters_doc_frm_user_1_section'], $data['letters_doc_frm_user_2_section'], $data['letters_doc_frm_user_3_section'], $data['letters_doc_frm_withoutourdoc'], $data['letters_doc_frm_comment'], $id);
     $sql = "UPDATE letters SET is_out=false WHERE (user_status_1 IS DISTINCT FROM 1 AND user_status_2 IS DISTINCT FROM 1 AND user_status_3 IS DISTINCT FROM 1) AND id=?i";
     $DB->query($sql, $id);
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/attachedfiles.php";
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/CFile.php";
     $attachedfiles = new attachedfiles($data['attachedfiles_session']);
     $attachedfiles_files = $attachedfiles->getFiles();
     if ($attachedfiles_files) {
         foreach ($attachedfiles_files as $attachedfiles_file) {
             $cFile = new CFile();
             $cFile->table = 'file';
             $cFile->GetInfoById($attachedfiles_file['id']);
             if ($cFile->id != $doc['file_id']) {
                 $ext = $cFile->getext();
                 $tmp_dir = "letters/";
                 $tmp_name = $cFile->secure_tmpname($tmp_dir, '.' . $ext);
                 $tmp_name = substr_replace($tmp_name, "", 0, strlen($tmp_dir));
                 $cFile->_remoteCopy($tmp_dir . $tmp_name, true);
                 $sql = "UPDATE letters SET file_id = ?i WHERE id = ?i";
                 $DB->query($sql, $cFile->id, intval($id));
                 $cFile->delete($doc['file_id']);
             }
         }
     }
     $attachedfiles->clear();
     return $id;
 }
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:101,代码来源:letters.php

示例13: addAttachedFiles

 /**
  * Связывает файлы загруженные ассинхронно с сообщением
  *
  * @param   array     $files              Список загруженных файлов
  * @param   string    $login              Логин пользователя
  * @param   integer   $msg_id             ID сообщения
  * @param   boolean   $from_draft         Файлы из черновика
  */
 function addAttachedFiles($files, $msg_id, $login, $from_draft = false)
 {
     global $DB;
     if (!$login) {
         $login = $_SESSION['login'];
     }
     $bModeration = false;
     $where = " inline != TRUE";
     $attaches = CFile::selectFilesBySrc(self::FILE_TABLE, $msg_id, NULL, $where);
     //$DB->rows($sql, $msg_id);
     $old_files = array();
     if ($attaches) {
         foreach ($attaches as $f) {
             array_push($old_files, $f['fid']);
         }
     }
     if ($from_draft) {
         $notdeleted_files = array();
         if ($files) {
             foreach ($files as $f) {
                 if ($f['status'] == 3) {
                     array_push($notdeleted_files, $f['id']);
                 }
             }
         }
         if ($attaches) {
             $cfile = new CFile();
             foreach ($attaches as $attach) {
                 if (in_array($attach['id'], $notdeleted_files)) {
                     continue;
                 }
                 $cfile->Delete(0, "users/" . substr($login, 0, 2) . "/" . $login . "/upload/", $attach['fname']);
                 //if ($attach['small'] == 't') {
                 //    $cfile->Delete(0, "users/" . substr($login, 0, 2) . "/" . $login . "/upload/", "sm_" . $attach['fname']);
                 //}
             }
         }
     }
     $max_image_size = array('width' => 470, 'height' => 1000, 'less' => 0);
     if ($files) {
         $cfile = new CFile();
         $num = 0;
         foreach ($files as $file) {
             switch ($file['status']) {
                 case 3:
                     $num++;
                     break;
                 case 4:
                     // Удаляем файл
                     $cFile = new CFile($file['id']);
                     $cFile->table = self::FILE_TABLE;
                     if ($cFile->id) {
                         $cFile->updateFileParams(array('src_id' => null), false);
                         // Удаляем связь
                         $cFile->Delete($cFile->id);
                     }
                     break;
                 case 1:
                     $num++;
                     if (in_array($file['id'], $old_files)) {
                         $need_copy = false;
                     } else {
                         $bModeration = true;
                         $need_copy = true;
                     }
                     // Добавляем файл
                     $cFile = new CFile($file['id']);
                     $cFile->proportional = 1;
                     $cFile->table = self::FILE_TABLE;
                     $ext = $cFile->getext();
                     if ($need_copy) {
                         $tmp_dir = "users/" . substr($login, 0, 2) . "/" . $login . "/upload/";
                         $tmp_name = $cFile->secure_tmpname($tmp_dir, '.' . $ext);
                         $tmp_name = substr_replace($tmp_name, "", 0, strlen($tmp_dir));
                         $cFile->_remoteCopy($tmp_dir . $tmp_name, true);
                     }
                     if (in_array($ext, $GLOBALS['graf_array'])) {
                         $is_image = TRUE;
                     } else {
                         $is_image = FALSE;
                     }
                     if ($is_image && $ext != 'swf' && $ext != 'flv') {
                         if ($cFile->image_size['width'] > $max_image_size['width'] || $cFile->image_size['height'] > $max_image_size['height']) {
                             if ($need_copy) {
                                 if ($cFile->resizeImage($cFile->path . 'sm_' . $cFile->name, $max_image_size['width'], $cFile->image_size['height'], 'landscape')) {
                                     $cFile->small = true;
                                 }
                             } else {
                                 $cFile->small = true;
                             }
                         } else {
                             $cFile->small = false;
//.........这里部分代码省略.........
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:101,代码来源:commune.php

示例14: Table

                   </table:table-cell>
                   <table:table-cell office:value-type="string">
                     <text:p>An online map</text:p>
                   </table:table-cell>
                   <table:table-cell office:value-type="string">
                     <text:p>
                       <text:a xlink:type="simple" xlink:href="http://maps.google.com/"
                         >http://maps.google.com</text:a>
                     </text:p>
                   </table:table-cell>
                 </table:table-row>
               </table:table>
';
*/
$descr_tz = '
               111
               <text:h text:outline-level="1"> A Table (Heading 1)</text:h>
               <text:p>222</text:p>
               <text:a xlink:type="simple" xlink:href="http://www.flickr.com/services/api/">http://www.flickr.com/services/api/</text:a>
';
$act_new = array('$sbr_num' => "СБР-109-Б/О-1", '$date_act' => "12.09.2012", '$date_sbr' => "12.09.2012", '$efio' => "Резидент Республики Беларусь", '$ffio' => "Александр Сергеевич Буров", '$sum_frl' => num2strEx($sum_frl, 'рублей Российской Федерации'), '$sum_emp' => num2strEx($sum_emp, 'рублей Российской Федерации'), '$tz_descr' => $descr_tz, '$work_time' => '3 дня на этап', '$work_type' => 'Промежуточной стоимости Работы', '$work_cost' => num2strEx($work_cost, 'рублей Российской Федерации'), '$is_arb_emp' => false, '$is_arb_frl' => false, '$user_arb' => 'Заказчик', '$result_arb' => 'Результат арбитража вынес потому что не работал такой то человек');
$t = new odt2pdf('arb_frl_soglashenie.odt');
$t->convert($act_new);
$content = $t->Output(NULL, 'S');
$file = new CFile();
//$file->table = 'file_sbr';
$file->path = 'uploader/';
$file->name = basename($file->secure_tmpname($file->path, '.pdf'));
$file->size = strlen($content);
$file->putContent($file->path . $file->name, $content);
//echo strlen($t->output);
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:31,代码来源:odt2pdf.php

示例15: addAttachedFiles

 /**
  * Связывает файлы загруженные ассинхронно с сообщением
  *
  * @param   array     $files              Список загруженных файлов
  * @param   string    $login              Логин пользователя
  * @param   integer   $msg_id             ID сообщения
  * @param   boolean   $from_draft         Файлы из черновика
  */
 function addAttachedFiles($files, $msg_id, $login = NULL, $from_draft = false)
 {
     global $DB;
     if (!$login) {
         $login = $_SESSION['login'];
     }
     $bModeration = false;
     $old_files = $this->getAttachedFiles($msg_id);
     if ($from_draft) {
         $notdeleted_files = array();
         if ($files) {
             foreach ($files as $f) {
                 if ($f['status'] == 3 || in_array($f['id'], $old_files)) {
                     array_push($notdeleted_files, $f['id']);
                 }
             }
         }
         $attaches = CFile::selectFilesBySrc(self::FILE_TABLE, $msg_id);
         if ($attaches) {
             foreach ($attaches as $attach) {
                 if (in_array($attach['id'], $notdeleted_files)) {
                     continue;
                 }
                 $cFile = new CFile($attach['id']);
                 $cFile->table = self::FILE_TABLE;
                 if ($cFile->id) {
                     $cFile->Delete($cFile->id);
                 }
             }
         }
     }
     $max_image_size = array('width' => blogs::MAX_IMAGE_WIDTH, 'height' => blogs::MAX_IMAGE_HEIGHT, 'less' => 0);
     if ($files) {
         foreach ($files as $file) {
             switch ($file['status']) {
                 case 4:
                     // Удаляем файл
                     $cFile = new CFile($file['id']);
                     $cFile->table = self::FILE_TABLE;
                     if ($cFile->id) {
                         $cFile->Delete($cFile->id);
                     }
                     break;
                 case 1:
                     if (in_array($file['id'], $old_files)) {
                         $need_copy = false;
                     } else {
                         $bModeration = true;
                         $need_copy = true;
                     }
                     // Добавляем файл
                     $cFile = new CFile($file['id']);
                     $cFile->proportional = 1;
                     $cFile->table = self::FILE_TABLE;
                     $ext = $cFile->getext();
                     if ($need_copy) {
                         $tmp_dir = "users/" . substr($login, 0, 2) . "/" . $login . "/upload/";
                         $tmp_name = $cFile->secure_tmpname($tmp_dir, '.' . $ext);
                         $tmp_name = substr_replace($tmp_name, "", 0, strlen($tmp_dir));
                         $cFile->_remoteCopy($tmp_dir . $tmp_name, true);
                     }
                     if (in_array($ext, $GLOBALS['graf_array'])) {
                         $is_image = TRUE;
                     } else {
                         $is_image = FALSE;
                     }
                     if ($is_image && $ext != 'swf' && $ext != 'flv') {
                         if ($cFile->image_size['width'] > $max_image_size['width'] || $cFile->image_size['height'] > $max_image_size['height']) {
                             if ($need_copy) {
                                 if ($cFile->resizeImage($cFile->path . 'sm_' . $cFile->name, $max_image_size['width'], $cFile->image_size['height'], 'landscape')) {
                                     $cFile->small = 2;
                                 }
                             } else {
                                 $cFile->small = 2;
                             }
                         } else {
                             $cFile->small = 1;
                         }
                     } else {
                         $cFile->small = $ext == 'flv' ? 2 : 0;
                     }
                     $cFile->updateFileParams(array('src_id' => $msg_id, 'small' => $cFile->small), false);
                     break;
             }
         }
     }
     if ($bModeration && $login == $_SESSION['login'] && !hasPermissions('blogs')) {
         // отравляем сообщение на модерирование сразу по факту создания или редактирования
         // появились новые файлы и это правит автор, и он не админ и не ПРО - отправить на модерирование
         /*require_once( $_SERVER['DOCUMENT_ROOT'] . '/classes/user_content.php' );
           $DB->query( 'UPDATE blogs_msgs SET moderator_status = 0 WHERE id = ?i', $msg_id );
           $DB->insert( 'moderation', array('rec_id' => $msg_id, 'rec_type' => user_content::MODER_BLOGS) );*/
//.........这里部分代码省略.........
开发者ID:amage,项目名称:fl-ru-damp,代码行数:101,代码来源:blogs.php


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