Ejemplo n.º 1
0
 public function showrec($rec)
 {
     extract($rec);
     $top = file_get_contents($this->getDir() . "/treb.tpl");
     $middle = file_get_contents($this->getDir() . "/row.tpl");
     $bot = file_get_contents($this->getDir() . "/bottom.tpl");
     $buffer = $top;
     $buffer = str_replace("_nomer_", '', $buffer);
     $buffer = str_replace("_date_", date("d.m.Y", mktime(0, 0, 0, ceil(substr($ddate, 5, 2)), ceil(substr($ddate, 8, 2)), ceil(substr($ddate, 0, 4)))), $buffer);
     $buffer = str_replace("_cherezkogo_", multibyte::UTF_decode($cherezkogo), $buffer);
     $buffer = str_replace("_zatreb_", multibyte::UTF_decode($zatreb), $buffer);
     $buffer = str_replace("_razresh_", multibyte::UTF_decode($razresh), $buffer);
     //echo $buffer;
     foreach ($positions as $rs) {
         $buffer .= $middle;
         $buffer = str_replace("_nazv_", $rs["nazv"], $buffer);
         $buffer = str_replace("_edizm_", $rs["edizm"], $buffer);
         $buffer = str_replace("_otp_", $rs["quant"], $buffer);
     }
     $buffer .= $bot;
     $buffer = str_replace("_cherezkogo_", multibyte::UTF_decode($cherezkogo), $buffer);
     return $buffer;
 }
Ejemplo n.º 2
0
 public function storeFiles($files = false, $dir = '')
 {
     if ($files) {
         // файл если есть сохраним
         $curfile = array();
         foreach ($files as $file) {
             if (!empty($file[size])) {
                 $pathname = $_SERVER["DOCUMENT_ROOT"] . UPLOAD_FILES_DIR . "/" . multibyte::UTF_encode($dir);
                 if (!file_exists($pathname)) {
                     // содать каталог
                     @mkdir($pathname, 0777);
                 }
                 $filename = $pathname . "/" . multibyte::UTF_encode($file["name"]);
                 $i = 0;
                 while (file_exists($filename)) {
                     $i++;
                     $filename = $pathname . "/{$i}_" . multibyte::UTF_encode($file["name"]);
                 }
                 if (@move_uploaded_file($file["tmp_name"], $filename)) {
                     // переместилось удачно
                     @chmod($filename, 0777);
                     $filename = multibyte::UTF_decode($filename);
                     $curfile[$this->getFileId($filename)] = 1;
                     // сделаем структуру как уже существующие
                 } else {
                     return false;
                 }
             }
         }
         return $curfile;
     } else {
         return array();
     }
 }
Ejemplo n.º 3
0
 public function action_addfilelink()
 {
     $edit = new ajaxform_edit($this->getName());
     $edit->restore();
     $filename = multibyte::UTF_decode($_REQUEST[filename]);
     $id = $this->model->getFileId($filename);
     $values[$id] = basename($this->model->getFileNameById($id));
     $value[$id] = 1;
     $field = array("type" => AJAXFORM_TYPE_CHECKBOXES, "name" => "linkfile", "label" => '', "value" => $value, "values" => $values);
     $edit->addFieldAsArray($field);
     $edit->form->SessionSet();
     $out = $edit->getFieldOut($edit->fields[$field[name]]);
     return $out;
 }
Ejemplo n.º 4
0
 static public function sharefilelink($filename) {
     $filename = str_replace(SHARE_ROOT_DIR, "", $filename);
     $filename = self::normalizefile(str_replace(":", "", str_replace("\\", "/", $filename)));
     $filename = multibyte::UTF_decode("file://" . NETBIOS_SERVERNAME . "/{$filename}");
     return $filename;
 }