예제 #1
0
     $folderhash[$foldername] = $res;
 } elseif ($r->isFile()) {
     if (uploadAllowed($r->getFilename())) {
         //remove the extension to the name
         /*if (substr_count($name, '.') > 0) {
               $name = substr($r->getFilename(), 0, strrpos($r->getFilename(), '.'));
           }*/
         echo "Uploading " . $name . " ..... ";
         $fileName = basename($r->getPathname());
         $fileSize = filesize($r->getPathname());
         $fileType = shell_exec('file -bi "' . escapeshellcmd($r->getPathname()) . '"');
         try {
             $itemId = $soap->createDocmanFile($hash, $project_id, $folderhash[$folderpath], $name, '', 'end', 100, 0, array(), array(), $fileSize, $fileName, $fileType, '', 0, $chunkSize);
             if ($itemId) {
                 $offset = 0;
                 while ($chunk = getChunk($r->getPathname(), $offset, $chunkSize)) {
                     $soap->appendDocmanFileChunk($hash, $project_id, $itemId, $chunk, $offset, $chunkSize);
                     $offset++;
                 }
             }
             $uploadedMd5 = $soap->getDocmanFileMD5sum($hash, $project_id, $itemId, 1);
             if ($uploadedMd5 !== md5_file($r->getPathname())) {
                 echo "ERROR: md5 differs" . PHP_EOL;
             } else {
                 echo "OK" . PHP_EOL;
             }
         } catch (Exception $e) {
             echo 'ERROR (' . $e->getMessage() . ')' . PHP_EOL;
         }
     }
 }
예제 #2
0
     }
 }
 if (count($tmp) > 1) {
     $sql = "SELECT * FROM modx_items_images WHERE item_code_1c='" . $stuff_code_1c . "'";
     $result_img = getQuery($sql, $path);
     $stuff_img_html = $modx->getChunk("stuff_images_rows", array());
     unset($stuff_images);
     //если фотография одна, то избавляемся от слайдера
     $num_imgs = count($result_img);
     foreach ($result_img as $img) {
         $url = $modx->getOption("upload_dir") . $img['name'];
         $r['url'] = $url;
         if ($num_imgs == 1) {
             $stuff_images = $url;
         } else {
             $stuff_images .= getChunk($stuff_img_html, $r);
         }
     }
     if ($num_imgs == 1) {
         $stuff_images = "<div class=\"item-photo-one\"><img src=\"" . $stuff_images . "\" alt=\"" . htmlspecialchars($result[0]['name']) . "\" class=\"im\"></div>";
     } else {
         $stuff_images = "<div class=\"item-photos\">" . $stuff_images . "</div>";
     }
     $query_material = "SELECT `value` FROM `modx_items_prop` WHERE `key` = 'Материал' AND `item_code_1c`='" . $stuff_code_1c . "' ";
     $result_material = getQuery($query_material, $path);
     $keywords = htmlspecialchars($result[0]['keywords']);
     $description = htmlspecialchars($result[0]['description']);
     $title = $result[0]['title'];
     if (!$title) {
         $title = $result[0]['name'];
     }