public function getPdfPreviewImage()
 {
     $pdfFile = Director::getAbsFile($this->owner->getFileName());
     $pathInfo = pathinfo($pdfFile);
     if (strtolower($pathInfo['extension']) != 'pdf') {
         //@Todo if dev then exception? else fail silently
         return null;
     }
     $fileName = $pathInfo['filename'];
     $savePath = __DIR__ . '/../../';
     $saveImage = $this->imagePrefix . '-' . $fileName . '.jpg';
     // Fix illegal characters
     $filter = FileNameFilter::create();
     $saveImage = $filter->filter($saveImage);
     $saveTo = $savePath . $this->folderToSave . $saveImage;
     $image = DataObject::get_one('Image', "`Name` = '{$saveImage}'");
     if (!$image) {
         $folderObject = DataObject::get_one("Folder", "`Filename` = '{$this->folderToSave}'");
         if ($folderObject) {
             if ($this->generator->generatePreviewImage($pdfFile, $saveTo)) {
                 $image = new Image();
                 $image->ParentID = $folderObject->ID;
                 $image->setName($saveImage);
                 $image->write();
             }
         }
     } else {
         //check LastEdited to update
         $cacheInValid = false;
         if (strtotime($image->LastEdited) < strtotime($this->owner->LastEdited)) {
             $cacheInValid = true;
         }
         if ($cacheInValid) {
             $this->generator->generatePreviewImage($pdfFile, $saveTo);
             $image->setName($saveImage);
             $image->write(false, false, true);
         }
     }
     return $image;
 }
 /**
  * Upload new Images
  *
  * Also updates Category & Album modification times
  *
  * @param int $categoryId
  * @param int $albumId
  */
 public function create($categoryId, $albumId)
 {
     $category = $this->getCategoryFinder()->findOneBy('id', $categoryId);
     $album = $this->getAlbumFinder()->findOneBy('id', $albumId);
     if ($this->slim->request->isGet()) {
         $this->slim->render('image/create.html.twig', ['category' => $category, 'album' => $album, 'sessionUser' => $this->getSessionUser(), 'allowedExtensions' => Image::getAllowedExtensions(true)]);
     } elseif ($this->slim->request->isPost()) {
         $uploadHandler = new CustomUploadHandler(['upload_dir' => ROOT . '/files/', 'upload_url' => null, 'access_control_allow_methods' => ['POST'], 'accept_file_types' => '/\\.(' . Image::getAllowedExtensions(true) . ')$/i', 'image_library' => 0, 'image_versions' => ['' => ['auto_orient' => false], 'thumb' => ['upload_dir' => ROOT . '/files/thumbs/', 'upload_url' => null, 'crop' => true, 'max_width' => 252, 'max_height' => 252]]]);
         $newImage = new Image($this->slim->db);
         $newImage->setAlbumId($album->getId());
         $newImage->setName($uploadHandler->getUploadedFileName());
         $newImage->insert();
         $album->update();
         $category->update();
     }
 }
 private function getFileByURL($url, $fileName)
 {
     $folder = Folder::find_or_make(self::$media_upload_folder);
     // relative to assets
     // create the file in database (sets title and safely names)
     $file = new Image();
     $file->ParentID = $folder->ID;
     $file->setName($fileName);
     $file->write();
     // download the file
     $fp = fopen($file->getFullPath(), 'w');
     $ch = curl_init($url);
     curl_setopt($ch, CURLOPT_FILE, $fp);
     $data = curl_exec($ch);
     curl_close($ch);
     fclose($fp);
     return $file;
 }
Ejemplo n.º 4
0
 private function req()
 {
     $files = array_unique(array_filter($_FILES[$this->varname]['name']));
     $this->filenums = count($files);
     if ($files) {
         foreach ($files as $k => $v) {
             $img = new Image();
             $img->setName($v);
             $img->setSize($_FILES[$this->varname]['size'][$k]);
             $img->setTmp_name($_FILES[$this->varname]['tmp_name'][$k]);
             $img->setType($_FILES[$this->varname]['type'][$k]);
             $img->setErr($_FILES[$this->varname]['error'][$k]);
             array_push($this->container, $img);
             if ($_FILES[$this->varname]['error'][$k] != 0) {
                 $this->err[$k] = $_FILES[$this->varname]['error'][$k];
             }
             if (!$img->verifSuffix()) {
                 $this->err[$k] = 20001;
             }
         }
     }
 }
Ejemplo n.º 5
0
 public function createImageFile($photo, $url, $item)
 {
     $tmpImage = tmpfile();
     $fileContents = file_get_contents($url);
     fwrite($tmpImage, $fileContents);
     // check if this is a valid image
     $metaData = stream_get_meta_data($tmpImage);
     $imageSizeInfo = getimagesize($metaData['uri']);
     if (!$imageSizeInfo) {
         continue;
     }
     $imageFolder = Folder::find_or_make($this->folder . '/' . $item->getId());
     $name = basename($url);
     $fileSize = filesize($metaData['uri']);
     $tmpName = $metaData['uri'];
     $relativeImagePath = $imageFolder->getRelativePath() . $name;
     $imagePath = BASE_PATH . '/' . $relativeImagePath;
     fclose($tmpImage);
     if (file_exists($imagePath)) {
         $pathInfo = pathinfo($url);
         if (isset($pathInfo['extension'])) {
             $name = basename($tmpName) . '.' . $pathInfo['extension'];
             $relativeImagePath = $imageFolder->getRelativePath() . $name;
             $imagePath = BASE_PATH . '/' . $relativeImagePath;
         }
     }
     $image = fopen($imagePath, 'w');
     fwrite($image, $fileContents);
     fclose($image);
     $image = new Image();
     $image->setParentID($imageFolder->ID);
     $image->setName($name);
     $image->Title = $photo->getAlt();
     $image->setFilename($relativeImagePath);
     $image->write();
     return $image;
 }
Ejemplo n.º 6
0
 public function executeImportRestApi(sfWebRequest $request)
 {
     $qa_generic = sfConfig::get("app_table_qa_generic");
     $qa_core = sfConfig::get("app_table_qa_core");
     // Retrieve $_GET (main parameters)
     $get_params['auth_token'] = $request->getGetParameter("auth_token");
     $get_params['release_version'] = $request->getGetParameter("release_version");
     $get_params['target'] = $request->getGetParameter("target");
     $get_params['testtype'] = $request->getGetParameter("testtype");
     $get_params['testset'] = $request->getGetParameter("testset");
     $get_params['hwproduct'] = $request->getGetParameter("hwproduct");
     $get_params['product'] = $request->getGetParameter("product");
     $get_params['hardware'] = $request->getGetParameter("hardware");
     $get_params['image'] = $request->getGetParameter("image");
     $get_params['build_id'] = $request->getGetParameter("build_id");
     // Retrieve $_GET (additional parameters)
     $get_params['tested_at'] = $request->getGetParameter("tested_at");
     $get_params['report_title'] = $request->getGetParameter("title");
     $get_params['objective_txt'] = $request->getGetParameter("objective_txt");
     $get_params['build_txt'] = $request->getGetParameter("build_txt");
     $get_params['environment_txt'] = $request->getGetParameter("environment_txt");
     $get_params['qa_summary_txt'] = $request->getGetParameter("qa_summary_txt");
     $get_params['issue_summary_txt'] = $request->getGetParameter("issue_summary_txt");
     $get_params['status'] = $request->getGetParameter("status");
     // Retrieve $_GET (hwproduct additional fields)
     $get_params['te_desc'] = $request->getGetParameter("te_desc");
     $get_params['te_cpu'] = $request->getGetParameter("te_cpu");
     $get_params['te_board'] = $request->getGetParameter("te_board");
     $get_params['te_gpu'] = $request->getGetParameter("te_gpu");
     $get_params['te_hw'] = $request->getGetParameter("te_hw");
     // Retrieve $_GET (image additional fields)
     $get_params['img_desc'] = $request->getGetParameter("img_desc");
     $get_params['img_os'] = $request->getGetParameter("img_os");
     $get_params['img_dist'] = $request->getGetParameter("img_dist");
     $get_params['img_vers'] = $request->getGetParameter("img_vers");
     $get_params['img_kernel'] = $request->getGetParameter("img_kernel");
     $get_params['img_arch'] = $request->getGetParameter("img_arch");
     $get_params['img_other'] = $request->getGetParameter("img_other");
     $get_params['img_bin'] = $request->getGetParameter("img_bin");
     $get_params['img_src'] = $request->getGetParameter("img_src");
     // Old parameters support about test_environment (testtype)
     if (!isset($get_params['testtype'])) {
         $get_params['testtype'] = $get_params['testset'];
     }
     // Old parameters support about image (hwproduct)
     if (!isset($get_params['hwproduct'])) {
         if (!isset($get_params['product'])) {
             $get_params['hwproduct'] = $get_params['hardware'];
         } else {
             $get_params['hwproduct'] = $get_params['product'];
         }
     }
     // Check if auth_token parameter is empty
     if (empty($get_params['auth_token'])) {
         echo "{\"ok\":\"0\",\"errors\":{\"Parameters error\":\"Missing auth_token parameter\"}}\n";
         exit;
     }
     // Check if release_version parameter is empty
     if (empty($get_params['release_version'])) {
         echo "{\"ok\":\"0\",\"errors\":{\"Parameters error\":\"Missing release_version parameter\"}}\n";
         exit;
     }
     // Check if target parameter is empty
     if (empty($get_params['target'])) {
         echo "{\"ok\":\"0\",\"errors\":{\"Parameters error\":\"Missing target parameter\"}}\n";
         exit;
     }
     // Check if hwproduct parameter is empty
     if (empty($get_params['hwproduct'])) {
         echo "{\"ok\":\"0\",\"errors\":{\"Parameters error\":\"Missing hwproduct parameter\"}}\n";
         exit;
     }
     // Check if image parameter is empty
     if (empty($get_params['image'])) {
         $get_params['image'] = "Empty_image";
     }
     // Retrieve project_id relying on project name (if it doesn't exist, return an error)
     $query = "SELECT proj.id AS project_id\n\t\t\t\t\tFROM " . $qa_generic . ".project proj\n\t\t\t\t\tWHERE proj.name = '" . $get_params['release_version'] . "'";
     $result = Doctrine_Manager::getInstance()->getCurrentConnection()->execute($query)->fetch(PDO::FETCH_ASSOC);
     if (empty($result["project_id"])) {
         echo "{\"ok\":\"0\",\"errors\":{\"release_version\":\"Incorrect release_version '" . $get_params['release_version'] . "'\"}}\n";
         exit;
     }
     $project_id = $result["project_id"];
     // Retrieve project_group_id relying on project_group_name (if it doesn't exist, return an error)
     $query = "SELECT pg.id AS project_group_id\n\t\t\t\t\tFROM " . $qa_core . ".sf_guard_group pg\n\t\t\t\t\tWHERE pg.name = '" . sfConfig::get("app_project_group") . "'";
     $result = Doctrine_Manager::getInstance()->getCurrentConnection()->execute($query)->fetch(PDO::FETCH_ASSOC);
     if (empty($result["project_group_id"])) {
         echo "{\"ok\":\"0\",\"errors\":{\"project_group_name\":\"Incorrect project_group_name '" . sfConfig::get("app_project_group") . "'\"}}\n";
         exit;
     }
     $project_group_id = $result["project_group_id"];
     // Retrieve product_id relying on product formfactor (if it doesn't exist, return an error)
     $query = "SELECT pt.id AS product_id\n\t\t\t\t\tFROM " . $qa_core . ".product_type pt\n\t\t\t\t\tWHERE pt.name = '" . $get_params['target'] . "'";
     $result = Doctrine_Manager::getInstance()->getCurrentConnection()->execute($query)->fetch(PDO::FETCH_ASSOC);
     if (empty($result["product_id"])) {
         echo "{\"ok\":\"0\",\"errors\":{\"target\":\"Incorrect target '" . $get_params['target'] . "'\"}}\n";
         exit;
     }
     $product_id = $result["product_id"];
     // Retrieve project_to_product_id, relying on project_id, project_group_id, and product_id
     $query = "SELECT ptp.id AS ptp_id\n\t\t\t\t\tFROM " . $qa_generic . ".project_to_product ptp\n\t\t\t\t\tWHERE ptp.project_id = " . $project_id . "\n\t\t\t\t\t\tAND ptp.project_group_id = " . $project_group_id . "\n\t\t\t\t\t\tAND ptp.product_id = " . $product_id;
     $result = Doctrine_Manager::getInstance()->getCurrentConnection()->execute($query)->fetch(PDO::FETCH_ASSOC);
     if (empty($result["ptp_id"])) {
         echo "{\"ok\":\"0\",\"errors\":{\"project_to_product\":\"Cannot find project_to_product_id\"}}\n";
         exit;
     }
     $project_to_product_id = $result["ptp_id"];
     // Retrieve user_id, relying on auth_token
     $query = "SELECT up.user_id\n\t\t\t\t\tFROM " . $qa_core . ".sf_guard_user_profile up\n\t\t\t\t\tWHERE up.token = '" . $get_params['auth_token'] . "'";
     $result = Doctrine_Manager::getInstance()->getCurrentConnection()->execute($query)->fetch(PDO::FETCH_ASSOC);
     if (empty($result["user_id"])) {
         echo "{\"ok\":\"0\",\"errors\":{\"auth_token\":\"Authorized token is not valid\"}}\n";
         exit;
     }
     $user_id = $result["user_id"];
     // Customize database connection to begin a transactionnal query
     $conn = Doctrine_Manager::getInstance()->getConnection("qa_generic");
     $conn->setAttribute(Doctrine_Core::ATTR_AUTOCOMMIT, FALSE);
     $conn->beginTransaction();
     // If test_environment_name exists, retrieve id, else, create new entry and retrieve id
     $query = "SELECT te.id AS test_environment_id\n\t\t\t\t\tFROM " . $qa_generic . ".test_environment te\n\t\t\t\t\tWHERE te.name = '" . $get_params['hwproduct'] . "'";
     $result = Doctrine_Manager::getInstance()->getCurrentConnection()->execute($query)->fetch(PDO::FETCH_ASSOC);
     if (empty($result["test_environment_id"])) {
         // Check if creation of a new entry is allowed
         if (sfConfig::get("app_rest_configuration_creation", false) == false) {
             $conn->rollback();
             $conn->setAttribute(Doctrine_Core::ATTR_AUTOCOMMIT, TRUE);
             echo "{\"ok\":\"0\",\"errors\":{\"test_environment\":\"Creation of new test environment is forbidden\"}}\n";
             exit;
         } else {
             // Add new environment
             $environment = new TestEnvironment();
             $environment->setName($get_params['hwproduct']);
             $environment->setNameSlug(MiscUtils::slugify($get_params['hwproduct']));
             // Add hwproduct additional fields if given as parameters
             if (isset($get_params['te_desc'])) {
                 $environment->setDescription($get_params['te_desc']);
             }
             if (isset($get_params['te_cpu'])) {
                 $environment->setCpu($get_params['te_cpu']);
             }
             if (isset($get_params['te_board'])) {
                 $environment->setBoard($get_params['te_board']);
             }
             if (isset($get_params['te_gpu'])) {
                 $environment->setGpu($get_params['te_gpu']);
             }
             if (isset($get_params['te_hw'])) {
                 $environment->setOtherHardware($get_params['te_hw']);
             }
             // Save new environment
             $environment->save($conn);
             $environmentId = $environment->getId();
         }
     } else {
         $environmentId = $result["test_environment_id"];
     }
     // If image_name exists, retrieve id, else, create new entry and retrieve id
     $query = "SELECT i.id AS image_id\n\t\t\t\t\tFROM " . $qa_generic . ".image i\n\t\t\t\t\tWHERE i.name = '" . $get_params['image'] . "'";
     $result = Doctrine_Manager::getInstance()->getCurrentConnection()->execute($query)->fetch(PDO::FETCH_ASSOC);
     if (empty($result["image_id"])) {
         // Check if creation of a new entry is allowed
         if (sfConfig::get("app_rest_configuration_creation", false) == false) {
             $conn->rollback();
             $conn->setAttribute(Doctrine_Core::ATTR_AUTOCOMMIT, TRUE);
             echo "{\"ok\":\"0\",\"errors\":{\"image\":\"Creation of new image is forbidden\"}}\n";
             exit;
         } else {
             // Add new image
             $image = new Image();
             $image->setName($get_params['image']);
             $image->setNameSlug(MiscUtils::slugify($get_params['image']));
             // Add image additional fields if given as parameters
             if (isset($get_params['img_desc'])) {
                 $image->setDescription($get_params['img_desc']);
             }
             if (isset($get_params['img_os'])) {
                 $image->setOs($get_params['img_os']);
             }
             if (isset($get_params['img_dist'])) {
                 $image->setDistribution($get_params['img_dist']);
             }
             if (isset($get_params['img_vers'])) {
                 $image->setVersion($get_params['img_vers']);
             }
             if (isset($get_params['img_kernel'])) {
                 $image->setKernel($get_params['img_kernel']);
             }
             if (isset($get_params['img_arch'])) {
                 $image->setArchitecture($get_params['img_arch']);
             }
             if (isset($get_params['img_other'])) {
                 $image->setOtherFw($get_params['img_other']);
             }
             if (isset($get_params['img_bin'])) {
                 $image->setBinaryLink($get_params['img_bin']);
             }
             if (isset($get_params['img_src'])) {
                 $image->setSourceLink($get_params['img_src']);
             }
             // Save new image
             $image->save($conn);
             $imageId = $image->getId();
         }
     } else {
         $imageId = $result["image_id"];
     }
     // If configuration exists, retrieve id, else, create new entry and retrieve id
     $query = "SELECT c.id AS configuration_id\n\t\t\t\t\tFROM " . $qa_generic . ".configuration c\n\t\t\t\t\tWHERE c.project_to_product_id = " . $project_to_product_id . "\n\t\t\t\t\t\tAND c.test_environment_id = " . $environmentId . "\n\t\t\t\t\t\tAND c.image_id = " . $imageId;
     $result = Doctrine_Manager::getInstance()->getCurrentConnection()->execute($query)->fetch(PDO::FETCH_ASSOC);
     if (empty($result["configuration_id"])) {
         $configuration = new Configuration();
         $configuration->setProjectToProductId($project_to_product_id);
         $configuration->setTestEnvironmentId($environmentId);
         $configuration->setImageId($imageId);
         $configuration->save($conn);
         $configurationId = $configuration->getId();
     } else {
         $configurationId = $result["configuration_id"];
     }
     $date_now = date("Y-m-d H:i:s");
     $date_now_wo_sec = date("Y-m-d H:i");
     $testSession = new TestSession();
     $testSession->setName($get_params['target'] . " " . $get_params['testtype'] . " " . $get_params['hwproduct'] . " " . $date_now_wo_sec . " " . $get_params['build_id']);
     $testSession->setUserId($user_id);
     $testSession->setCreatedAt($date_now);
     $testSession->setUpdatedAt($date_now);
     $testSession->setStatus(2);
     $testSession->setPublished(1);
     $testSession->setConfigurationId($configurationId);
     // Fill in the build_id if it is given
     if (!empty($get_params['build_id'])) {
         $testSession->setBuildId($get_params['build_id']);
         $testSession->setBuildSlug(MiscUtils::slugify($get_params['build_id']));
     }
     // Fill in the testset if it is given
     if (!empty($get_params['testtype'])) {
         $testSession->setTestset($get_params['testtype']);
         $testSession->setTestsetSlug(MiscUtils::slugify($get_params['testtype']));
     }
     if (isset($get_params['report_title'])) {
         $testSession->setName($get_params['report_title']);
     }
     if (isset($get_params['objective_txt'])) {
         $testSession->setTestObjective($get_params['objective_txt']);
     }
     if (isset($get_params['environment_txt'])) {
         $testSession->setNotes($get_params['environment_txt']);
     }
     if (isset($get_params['qa_summary_txt'])) {
         $testSession->setQaSummary($get_params['qa_summary_txt']);
     }
     if (isset($get_params['issue_summary_txt'])) {
         $testSession->setIssueSummary($get_params['issue_summary_txt']);
     }
     if (isset($get_params['status'])) {
         $testSession->setStatus($get_params['status']);
     }
     $testSession->save($conn);
     $testSessionId = $testSession->getId();
     // Retrieve table_name_test_session_id from table_name
     $query = "SELECT tn.id AS table_name_id\n\t\t\t\t\tFROM " . $qa_generic . ".table_name tn\n\t\t\t\t\tWHERE tn.name = 'test_session'";
     $result = Doctrine_Manager::getInstance()->getCurrentConnection()->execute($query)->fetch(PDO::FETCH_ASSOC);
     $tableNameTestSessionId = $result["table_name_id"];
     // Concatenate directory path
     $dir_path = sfConfig::get('sf_upload_dir') . "/testsession_" . $testSessionId;
     // Get all files sent
     $files = $request->getFiles();
     // Check if there is any report file to import
     if (empty($files)) {
         $conn->rollback();
         $conn->setAttribute(Doctrine_Core::ATTR_AUTOCOMMIT, TRUE);
         echo "{\"ok\":\"0\",\"errors\":\"Missing report file\"}\n";
         exit;
     }
     // Import each report file and register attachment files
     $report_file_found = false;
     foreach ($files as $key => $file) {
         $reportType = false;
         $fileName = $file['name'];
         $fileSize = $file['size'];
         $fileType = $file['type'];
         $fileError = $file['error'];
         $fileChecksum = sha1_file($file["tmp_name"]);
         // Check file error and file size
         if (!$fileError and $fileSize <= sfConfig::get('app_max_file_size', '10000000')) {
             if (!is_dir($dir_path)) {
                 mkdir($dir_path, 0777, true);
             }
             $dest_path = $dir_path . "/" . $fileName;
             // Move file to uploads directory
             move_uploaded_file($file['tmp_name'], $dest_path);
             $web_path = "/uploads" . "/testsession_" . $testSessionId . "/" . $fileName;
             $fileAttachment = new FileAttachment();
             $fileAttachment->setName($fileName);
             $fileAttachment->setUserId($user_id);
             $fileAttachment->setUploadedAt(date("Y-m-d H:i:s"));
             $fileAttachment->setFilename($fileName);
             $fileAttachment->setFileSize($fileSize);
             $fileAttachment->setFileMimeType($fileType);
             $fileAttachment->setLink($web_path);
             $fileAttachment->setChecksum($fileChecksum);
             $fileAttachment->setTableNameId($tableNameTestSessionId);
             $fileAttachment->setTableEntryId($testSessionId);
             if ((preg_match("#\\.xml\$#i", $fileName) | preg_match("#\\.csv\$#i", $fileName)) & !preg_match("#attachment.?[0-9]*#i", $key)) {
                 $report_file_found = true;
                 $reportType = true;
                 $fileAttachment->setCategory(1);
             } else {
                 if (preg_match("#attachment.?[0-9]*#i", $key)) {
                     $fileAttachment->setCategory(2);
                 } else {
                     $conn->rollback();
                     $conn->setAttribute(Doctrine_Core::ATTR_AUTOCOMMIT, TRUE);
                     echo "{\"ok\":\"0\",\"errors\":\"Only upload files with the extension .xml or .csv\"}\n";
                     exit;
                 }
             }
             $fileAttachment->save($conn);
             // If it is an XML or CSV file, parse it and fill qa_generic database
             if ($reportType) {
                 if ($err_code = Import::file($dest_path, $testSessionId, $configurationId, $conn)) {
                     $error_message = Import::getImportErrorMessage($err_code);
                     MiscUtils::deleteDir($dir_path);
                     $conn->rollback();
                     $conn->setAttribute(Doctrine_Core::ATTR_AUTOCOMMIT, TRUE);
                     echo "{\"ok\":\"0\",\"errors\":\"File " . $fileName . " is not valid = " . $error_message . "\"}\n";
                     exit;
                 }
             }
         } else {
             MiscUtils::deleteDir($dir_path);
             $conn->rollback();
             $conn->setAttribute(Doctrine_Core::ATTR_AUTOCOMMIT, TRUE);
             echo "{\"ok\":\"0\",\"errors\":\"File " . $fileName . " exceed maximum size\"}\n";
             exit;
         }
     }
     // If only attachment files have been found, cancel the new test session
     if (!$report_file_found) {
         $conn->rollback();
         $conn->setAttribute(Doctrine_Core::ATTR_AUTOCOMMIT, TRUE);
         echo "{\"ok\":\"0\",\"errors\":\"Missing report file\"}\n";
         exit;
     }
     $conn->commit();
     $conn->setAttribute(Doctrine_Core::ATTR_AUTOCOMMIT, TRUE);
     // Retrieve project name_slug, product name_slug, test environment name_slug and image name_slug
     $query = "SELECT i.name_slug image_name_slug, te.name_slug test_environment_name_slug, p.name_slug project_name_slug, pt.name_slug product_name_slug\n\t\t\t\t\tFROM " . $qa_generic . ".test_session ts\n\t\t\t\t\tJOIN " . $qa_generic . ".configuration c ON c.id = ts.configuration_id\n\t\t\t\t\tJOIN " . $qa_generic . ".image i ON i.id = c.image_id\n\t\t\t\t\tJOIN " . $qa_generic . ".test_environment te ON te.id = c.test_environment_id\n\t\t\t\t\tJOIN " . $qa_generic . ".project_to_product ptp ON ptp.id = c.project_to_product_id\n\t\t\t\t\tJOIN " . $qa_generic . ".project p ON p.id = ptp.project_id\n\t\t\t\t\tJOIN " . $qa_core . ".product_type pt ON pt.id = ptp.product_id\n\t\t\t\t\tWHERE ts.id = " . $testSessionId;
     $configInfo = Doctrine_Manager::getInstance()->getCurrentConnection()->execute($query)->fetch(PDO::FETCH_ASSOC);
     $projectNameSlug = $configInfo['project_name_slug'];
     $productNameSlug = $configInfo['product_name_slug'];
     $testEnvironmentNameSlug = $configInfo['test_environment_name_slug'];
     $imageNameSlug = $configInfo['image_name_slug'];
     // Return datas to CATS
     $url_to_return = $request->getUriPrefix() . $this->generateUrl("test_session", array('project' => $projectNameSlug, 'product' => $productNameSlug, 'environment' => $testEnvironmentNameSlug, 'image' => $imageNameSlug, 'id' => $testSessionId));
     echo "{\"ok\":\"1\",\"url\":\"" . $url_to_return . "\"}\n";
     // Return is done (with echo) so make sure nothing else will be sent
     exit;
 }
Ejemplo n.º 7
0
 /**
  * Process the form to edit an existing test session.
  *
  * @param sfWebRequest $request
  * @param SessionForm $form
  */
 protected function processEdit(sfWebRequest $request, SessionForm $form)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $qa_generic = sfConfig::get("app_table_qa_generic");
         // Get sent values and uploaded files
         $values = $form->getValues();
         $files = $request->getFiles();
         // Retrieve values from form
         $projectGroupId = $values["project_group_id"];
         $projectId = $values["project"];
         $productId = $values["product"];
         // Get test environment and image names
         $environmentForm = $form->getValue("environmentForm");
         $imageForm = $form->getValue("imageForm");
         // Create a new relationship between project group, project and product if needed
         $projectToProductId = Doctrine_Core::getTable("ProjectToProduct")->getProjectToProductId($projectGroupId, $projectId, $productId);
         if ($projectToProductId == null) {
             $projectToProduct = new ProjectToProduct();
             $projectToProduct->setProjectGroupId($projectGroupId);
             $projectToProduct->setProjectId($projectId);
             $projectToProduct->setProductId($productId);
             $projectToProduct->save($conn);
             $projectToProductId = $projectToProduct->getId();
         }
         // Create a new environment if needed
         $environment = Doctrine_Core::getTable("TestEnvironment")->findByArray($environmentForm);
         if ($environment == null) {
             // Add new environment
             $environment = new TestEnvironment();
             $environment->setName($environmentForm["name"]);
             $environment->setDescription($environmentForm["description"]);
             $environment->setCpu($environmentForm["cpu"]);
             $environment->setBoard($environmentForm["board"]);
             $environment->setGpu($environmentForm["gpu"]);
             $environment->setOtherHardware($environmentForm["other_hardware"]);
             // Check if its slug does not already exist and generate a new one if needed
             $slug = MiscUtils::slugify($environmentForm["name"]);
             $size = 1;
             while (Doctrine_Core::getTable("TestEnvironment")->checkSlug($slug)) {
                 $slug = MiscUtils::slugify($environmentForm["name"]) . substr(microtime(), -$size);
                 $size++;
             }
             $environment->setNameSlug($slug);
             $environment->save($conn);
             // Convert object into associative array
             $environment = $environment->toArray();
         }
         // Create a new image if needed
         $image = Doctrine_Core::getTable("Image")->findByArray($imageForm);
         if ($image == null) {
             // Add new image
             $image = new Image();
             $image->setName($imageForm["name"]);
             $image->setDescription($imageForm["description"]);
             $image->setOs($imageForm["os"]);
             $image->setDistribution($imageForm["distribution"]);
             $image->setVersion($imageForm["version"]);
             $image->setKernel($imageForm["kernel"]);
             $image->setArchitecture($imageForm["architecture"]);
             $image->setOtherFw($imageForm["other_fw"]);
             $image->setBinaryLink($imageForm["binary_link"]);
             $image->setSourceLink($imageForm["source_link"]);
             // Check if its slug does not already exist and generate a new one if needed
             $slug = MiscUtils::slugify($imageForm["name"]);
             $size = 1;
             while (Doctrine_Core::getTable("Image")->checkSlug($slug)) {
                 $slug = MiscUtils::slugify($imageForm["name"]) . substr(microtime(), -$size);
                 $size++;
             }
             $image->setNameSlug(MiscUtils::slugify($slug));
             $image->save($conn);
             // Convert object into associative array
             $image = $image->toArray();
         }
         // Create a new configuration relationship if needed
         $configurationId = Doctrine_Core::getTable("Configuration")->getConfigurationId($projectToProductId, $environment["id"], $image["id"]);
         if ($configurationId == null) {
             $configuration = new Configuration();
             $configuration->setProjectToProductId($projectToProductId);
             $configuration->setTestEnvironmentId($environment["id"]);
             $configuration->setImageId($image["id"]);
             $configuration->save($conn);
             $configurationId = $configuration->getId();
         }
         // Edit the session into DB
         $testSession = Doctrine_Core::getTable("TestSession")->find($values["id"]);
         $testSession->setId($values["id"]);
         $testSession->setBuildId($values["build_id"]);
         $testSession->setTestset($values["testset"]);
         $testSession->setName($values["name"]);
         $testSession->setTestObjective($values["test_objective"]);
         $testSession->setQaSummary($values["qa_summary"]);
         $testSession->setUserId($values["user_id"]);
         $testSession->setCreatedAt($values["created_at"]);
         $testSession->setEditorId($values["editor_id"]);
         $testSession->setUpdatedAt($values["updated_at"]);
         $testSession->setProjectRelease($values["project_release"]);
         $testSession->setProjectMilestone($values["project_milestone"]);
         $testSession->setIssueSummary($values["issue_summary"]);
         $testSession->setStatus($values["status"]);
         $testSession->setPublished($values["published"]);
         $testSession->setConfigurationId(intval($configurationId));
         $testSession->setCampaignChecksum($values["campaign_checksum"]);
         $testSession->setBuildSlug(MiscUtils::slugify($values["build_id"]));
         $testSession->setTestsetSlug(MiscUtils::slugify($values["testset"]));
         $testSession->setNotes($values["notes"]);
         $testSession->save();
         $testSessionId = $values["id"];
         // Get all results (and add associative key for each result)
         $array = array();
         foreach (Doctrine_Core::getTable("TestSession")->getSessionResults($this->currentSession["id"]) as $key => $value) {
             $array[MiscUtils::slugify($value["label"]) . $value["id"]] = $value;
         }
         $results = $array;
         // Get all measures (and add associative key for each measure)
         $array = array();
         foreach (Doctrine_Core::getTable("TestSession")->getSessionMeasures($this->currentSession["id"]) as $key => $value) {
             $array[MiscUtils::slugify($value["label"]) . $value["id"]] = $value;
         }
         $measures = $array;
         // Save test results
         foreach ($results as $key => $result) {
             if (array_key_exists($key, $values)) {
                 $resultForm = Doctrine_Core::getTable("TestResult")->find($result["id"]);
                 $resultForm->setId($result["id"]);
                 $resultForm->setDecisionCriteriaId($values[$key]["decision_criteria_id"]);
                 $resultForm->setComment($values[$key]["comment"]);
                 $resultForm->save();
             }
         }
         // Save measures
         foreach ($measures as $key => $measure) {
             if (array_key_exists($key, $values)) {
                 $resultForm = Doctrine_Core::getTable("TestResult")->find($measure["id"]);
                 $resultForm->setId($measure["id"]);
                 $resultForm->setDecisionCriteriaId($values[$key]["decision_criteria_id"]);
                 $resultForm->setComment($values[$key]["comment"]);
                 $resultForm->save();
             }
         }
         // Get project and product name slug
         $projectSlug = Doctrine_Core::getTable("Project")->getSlugById($projectId);
         $productSlug = Doctrine_Core::getTable("ProductType")->getSlugById($productId);
         // Retrieve table_name_test_session_id from table_name
         $tableName = Doctrine_Core::getTable("TableName")->findOneByName("test_session");
         $tableNameTestSessionId = $tableName->getId();
         // Import attachments and result files
         foreach ($files["attachments"] as $key => $file) {
             if ($file["error"] != UPLOAD_ERR_NO_FILE) {
                 $fileName = $file['name'];
                 $fileSize = $file['size'];
                 $fileType = $file['type'];
                 $fileError = $file['error'];
                 $fileChecksum = sha1_file($file["tmp_name"]);
                 // Check file error and file size (5Mo max)
                 if (!$fileError and $fileSize <= 5000000) {
                     // Concatenate destination path
                     $dest_path = sfConfig::get('sf_upload_dir') . "/testsession_" . $testSessionId;
                     if (!is_dir($dest_path)) {
                         mkdir($dest_path, 0777, true);
                     }
                     $dest_path .= "/" . $fileName;
                     // Move file to uploads directory
                     move_uploaded_file($file['tmp_name'], $dest_path);
                     $web_path = "/uploads" . "/testsession_" . $testSessionId . "/" . $fileName;
                     $fileAttachment = new FileAttachment();
                     $fileAttachment->setName($fileName);
                     $fileAttachment->setUserId($this->getUser()->getGuardUser()->getId());
                     $fileAttachment->setUploadedAt(date("Y-m-d H:i:s"));
                     $fileAttachment->setFilename($fileName);
                     $fileAttachment->setFileSize($fileSize);
                     $fileAttachment->setFileMimeType($fileType);
                     $fileAttachment->setLink($web_path);
                     $fileAttachment->setChecksum($fileChecksum);
                     $fileAttachment->setTableNameId($tableNameTestSessionId);
                     $fileAttachment->setTableEntryId($testSessionId);
                     $fileAttachment->setCategory(2);
                     $fileAttachment->save();
                 }
             }
         }
         // Customize database connection to begin a transactionnal query
         $conn = Doctrine_Manager::getInstance()->getConnection("qa_generic");
         $conn->setAttribute(Doctrine_Core::ATTR_AUTOCOMMIT, FALSE);
         $conn->beginTransaction();
         // Get file attachments id into an array
         $fileAttachmentIdList = array();
         $query = "SELECT fa.id\n\t\t\t\t\tFROM " . $qa_generic . ".file_attachment fa\n\t\t\t\t\tWHERE fa.table_entry_id = " . $testSessionId . "\n\t\t\t\t\t\tAND fa.table_name_id = " . $tableNameTestSessionId;
         $results = Doctrine_Manager::getInstance()->getCurrentConnection()->execute($query)->fetchAll(PDO::FETCH_ASSOC);
         foreach ($results as $result) {
             $fileAttachmentIdList[] = $result["id"];
         }
         $fileAttachmentIdStringList = implode(",", $fileAttachmentIdList);
         // Concatenate directory path
         $dir_path = sfConfig::get('sf_upload_dir') . "/testsession_" . $testSessionId;
         $fileAttachmentResultIds = array();
         $similarFileFound = false;
         foreach ($files["result_files"] as $key => $file) {
             if ($file["error"] != UPLOAD_ERR_NO_FILE) {
                 $reportType = false;
                 $fileName = $file['name'];
                 $fileSize = $file['size'];
                 $fileType = $file['type'];
                 $fileError = $file['error'];
                 $fileChecksum = sha1_file($file["tmp_name"]);
                 $query = "SELECT fa.id\n\t\t\t\t\t\t\tFROM " . $qa_generic . ".file_attachment fa\n\t\t\t\t\t\t\tWHERE fa.table_entry_id = " . $testSessionId . "\n\t\t\t\t\t\t\t\tAND fa.table_name_id = " . $tableNameTestSessionId . "\n\t\t\t\t\t\t\t\tAND fa.checksum = '" . $fileChecksum . "'";
                 $result = Doctrine_Manager::getInstance()->getCurrentConnection()->execute($query)->fetch(PDO::FETCH_ASSOC);
                 if (!empty($result["id"])) {
                     $fileAttachmentResultIds[] = $result["id"];
                     $similarFileFound = true;
                 }
                 // Check file error and file size
                 if (!$fileError and $fileSize <= sfConfig::get('app_max_file_size', '10000000')) {
                     if (!is_dir($dir_path)) {
                         mkdir($dir_path, 0777, true);
                     }
                     $dest_path = $dir_path . "/" . $fileName;
                     $idx = 0;
                     while (is_file($dest_path)) {
                         $idx++;
                         $dest_path = $dir_path . "/" . "(" . $idx . ")" . $fileName;
                     }
                     // Move file to uploads directory
                     move_uploaded_file($file['tmp_name'], $dest_path);
                     if ($idx == 0) {
                         $web_path = "/uploads" . "/testsession_" . $testSessionId . "/" . $fileName;
                     } else {
                         $web_path = "/uploads" . "/testsession_" . $testSessionId . "/" . "(" . $idx . ")" . $fileName;
                     }
                     $fileAttachment = new FileAttachment();
                     $fileAttachment->setName($fileName);
                     $fileAttachment->setUserId($this->getUser()->getGuardUser()->getId());
                     $fileAttachment->setUploadedAt(date("Y-m-d H:i:s"));
                     $fileAttachment->setFilename($fileName);
                     $fileAttachment->setFileSize($fileSize);
                     $fileAttachment->setFileMimeType($fileType);
                     $fileAttachment->setLink($web_path);
                     $fileAttachment->setChecksum($fileChecksum);
                     $fileAttachment->setTableNameId($tableNameTestSessionId);
                     $fileAttachment->setTableEntryId($testSessionId);
                     if (preg_match("#\\.xml\$#i", $fileName) | preg_match("#\\.csv\$#i", $fileName)) {
                         $reportType = true;
                         $fileAttachment->setCategory(1);
                     } else {
                         $fileAttachment->setCategory(2);
                     }
                     $fileAttachment->save($conn);
                     // If it is an XML or CSV file, parse it and fill qa_generic database
                     if ($reportType) {
                         if ($err_code = Import::file($dest_path, $testSessionId, $configurationId, $conn, true)) {
                             // Delete new files
                             $query = "SELECT fa.link\n\t\t\t\t\t\t\t\t\t\tFROM " . $qa_generic . ".file_attachment fa\n\t\t\t\t\t\t\t\t\t\tWHERE fa.table_entry_id = " . $testSessionId . "\n\t\t\t\t\t\t\t\t\t\t\tAND fa.table_name_id = " . $tableNameTestSessionId . "\n\t\t\t\t\t\t\t\t\t\t\tAND fa.id NOT IN (" . $fileAttachmentIdStringList . ")";
                             $results = Doctrine_Manager::getInstance()->getCurrentConnection()->execute($query)->fetchAll(PDO::FETCH_ASSOC);
                             foreach ($results as $result) {
                                 unlink(sfConfig::get('sf_web_dir') . $result["link"]);
                             }
                             $error_message = Import::getImportErrorMessage($err_code);
                             $conn->rollback();
                             $conn->setAttribute(Doctrine_Core::ATTR_AUTOCOMMIT, TRUE);
                             $this->getUser()->setFlash("error", "Invalid file content on " . $fileName . " : " . $error_message);
                             $this->redirect("edit_report", array("project" => $projectSlug, "product" => $productSlug, "environment" => $environment["name_slug"], "image" => $image["name_slug"], "id" => $testSessionId));
                         }
                     }
                 } else {
                     // Delete new files
                     $query = "SELECT fa.link\n\t\t\t\t\t\t\t\tFROM " . $qa_generic . ".file_attachment fa\n\t\t\t\t\t\t\t\tWHERE fa.table_entry_id = " . $testSessionId . "\n\t\t\t\t\t\t\t\t\tAND fa.table_name_id = " . $tableNameTestSessionId . "\n\t\t\t\t\t\t\t\t\tAND fa.id NOT IN (" . $fileAttachmentIdStringList . ")";
                     $results = Doctrine_Manager::getInstance()->getCurrentConnection()->execute($query)->fetchAll(PDO::FETCH_ASSOC);
                     foreach ($results as $result) {
                         unlink(sfConfig::get('sf_web_dir') . $result["link"]);
                     }
                     $conn->rollback();
                     $conn->setAttribute(Doctrine_Core::ATTR_AUTOCOMMIT, TRUE);
                     $this->getUser()->setFlash("error", "File size limit reached");
                     $this->redirect("edit_report", array("project" => $projectSlug, "product" => $productSlug, "environment" => $environment["name_slug"], "image" => $image["name_slug"], "id" => $testSessionId));
                 }
             }
         }
         if ($similarFileFound) {
             $fileAttachmentStringResultIds = implode(",", $fileAttachmentResultIds);
             // Delete similar files and attachment entries
             $query = "SELECT fa.id, fa.link\n\t\t\t\t\t\tFROM " . $qa_generic . ".file_attachment fa\n\t\t\t\t\t\tWHERE fa.table_entry_id = " . $testSessionId . "\n\t\t\t\t\t\t\tAND fa.table_name_id = " . $tableNameTestSessionId . "\n\t\t\t\t\t\t\tAND fa.id IN (" . $fileAttachmentStringResultIds . ")";
             $results = Doctrine_Manager::getInstance()->getCurrentConnection()->execute($query)->fetchAll(PDO::FETCH_ASSOC);
             foreach ($results as $result) {
                 unlink(sfConfig::get('sf_web_dir') . $result["link"]);
                 Doctrine_Core::getTable("FileAttachment")->deleteFileAttachmentById($result["id"], $conn);
             }
         }
         $conn->commit();
         $conn->setAttribute(Doctrine_Core::ATTR_AUTOCOMMIT, TRUE);
         // 			// Clear cache for actions related to this test session
         // 			$cacheManager = $this->getContext()->getViewCacheManager();
         // 			$cacheManager->remove("reports/session?project=".$projectSlug."&product=".$productSlug."&environment=".$environment["name_slug"]."&image=".$image["name_slug"]."?id=".$testSession["id"]);
         // Set flash for user and redirect to session display
         $this->getUser()->setFlash("notice", "Test session was updated successfully");
         if (!empty($testSession["build_slug"])) {
             $this->redirect("build_session", array("project" => $projectSlug, "product" => $productSlug, "build" => $testSession["build_slug"], "environment" => $environment["name_slug"], "image" => $image["name_slug"], "id" => $request->getParameter("id")));
         } else {
             $this->redirect("test_session", array("project" => $projectSlug, "product" => $productSlug, "environment" => $environment["name_slug"], "image" => $image["name_slug"], "id" => $request->getParameter("id")));
         }
     }
 }
 public function store_files($file_path, $file)
 {
     $is_image = getimagesize($file_path);
     $gallery_data = $this->options['gallery_data'];
     $base = new Base();
     if ($is_image != 0 and $gallery_data['id'] != null) {
         $image_entity = new Image();
         $image_entity->setName($file->name);
         $image_entity->setTitle($file->name);
         $image_entity->setPath($file_path);
         $base->audit_fields($image_entity, 'create');
         $image_entity->save();
         $gallery_image = new GalleryImage();
         $gallery_image->setGalleryid($gallery_data['id']);
         $gallery_image->setImageid($image_entity->id);
         $base->audit_fields($gallery_image, 'create');
         $gallery_image->save();
     } else {
         $this->save_file_data($file->name, $file->type, $file->size, $file_path);
     }
 }
 /**
  * creates test data on /dev/build or by adding test data in ModelAdmin.
  *
  * @return bool
  *
  * @author Sebastian Diel <*****@*****.**>
  * @since 02.07.2011
  */
 public static function createTestData()
 {
     if (self::$enableTestData === true) {
         if (SiteTree::get_by_link(_t('SilvercartTestData.PRODUCTGROUPPAYMENT_URLSEGMENT'))) {
             // test data already created
             return false;
         }
         self::createTestTaxRates();
         // get SilvercartProductGroupHolder and tax rate
         $silvercartProductGroupHolder = SilvercartProductGroupHolder::get()->first();
         $taxRateID = SilvercartTax::get()->filter('Rate', '19')->first()->ID;
         //create a manufacturer
         $manufacturer = new SilvercartManufacturer();
         $manufacturer->Title = 'pixeltricks GmbH';
         $manufacturer->URL = 'http://www.pixeltricks.de/';
         $manufacturer->write();
         //create product groups
         $productGroupPayment = new SilvercartProductGroupPage();
         $productGroupPayment->Title = _t('SilvercartTestData.PRODUCTGROUPPAYMENT_TITLE');
         $productGroupPayment->URLSegment = _t('SilvercartTestData.PRODUCTGROUPPAYMENT_URLSEGMENT');
         $productGroupPayment->Content = _t('SilvercartTestData.PRODUCTGROUP_CONTENT');
         $productGroupPayment->Status = "Published";
         $productGroupPayment->IdentifierCode = 'SilvercartProductGroupPayment';
         $productGroupPayment->ParentID = $silvercartProductGroupHolder->ID;
         $productGroupPayment->ShowInMenus = true;
         $productGroupPayment->ShowInSearch = true;
         $productGroupPayment->Sort = 1;
         $productGroupPayment->write();
         $productGroupPayment->publish("Live", "Stage");
         $productGroupMarketing = new SilvercartProductGroupPage();
         $productGroupMarketing->Title = _t('SilvercartTestData.PRODUCTGROUPMARKETING_TITLE');
         $productGroupMarketing->URLSegment = _t('SilvercartTestData.PRODUCTGROUPMARKETING_URLSEGMENT');
         $productGroupMarketing->Content = _t('SilvercartTestData.PRODUCTGROUP_CONTENT');
         $productGroupMarketing->Status = "Published";
         $productGroupMarketing->IdentifierCode = 'SilvercartproductGroupMarketing';
         $productGroupMarketing->ParentID = $silvercartProductGroupHolder->ID;
         $productGroupMarketing->ShowInMenus = true;
         $productGroupMarketing->ShowInSearch = true;
         $productGroupMarketing->Sort = 2;
         $productGroupMarketing->write();
         $productGroupMarketing->publish("Live", "Stage");
         $productGroupOthers = new SilvercartProductGroupPage();
         $productGroupOthers->Title = _t('SilvercartTestData.PRODUCTGROUPOTHERS_TITLE');
         $productGroupOthers->URLSegment = _t('SilvercartTestData.PRODUCTGROUPOTHERS_URLSEGMENT');
         $productGroupOthers->Content = _t('SilvercartTestData.PRODUCTGROUP_CONTENT');
         $productGroupOthers->Status = "Published";
         $productGroupOthers->IdentifierCode = 'SilvercartproductGroupOthers';
         $productGroupOthers->ParentID = $silvercartProductGroupHolder->ID;
         $productGroupOthers->ShowInMenus = true;
         $productGroupOthers->ShowInSearch = true;
         $productGroupOthers->Sort = 3;
         $productGroupOthers->write();
         $productGroupOthers->publish("Live", "Stage");
         // Define products
         $products = array(array('en_US' => array('Title' => 'Paypal', 'ShortDescription' => 'The world' . "'" . 's most loved way to pay and get paid.', 'LongDescription' => 'PayPal works behind the scenes to help protect you and your customers. Your customers will love the speed of PayPal streamlined checkout experience. And you will love the sales boost PayPal can deliver. PayPal is ideal for selling overseas. You can accept payments in 22 currencies from 190 countries and markets worldwide. Source: www.paypal.com', 'MetaDescription' => 'The world' . "'" . 's most loved way to pay and get paid.', 'MetaKeywords' => 'SilverCart, modules, PayPal, payment', 'MetaTitle' => 'Paypal'), 'en_GB' => array('Title' => 'Paypal', 'ShortDescription' => 'The world' . "'" . 's most loved way to pay and get paid.', 'LongDescription' => 'PayPal works behind the scenes to help protect you and your customers. Your customers will love the speed of PayPal streamlined checkout experience. And you will love the sales boost PayPal can deliver. PayPal is ideal for selling overseas. You can accept payments in 22 currencies from 190 countries and markets worldwide. Source: www.paypal.com', 'MetaDescription' => 'The world' . "'" . 's most loved way to pay and get paid.', 'MetaKeywords' => 'SilverCart, modules, PayPal, payment', 'MetaTitle' => 'Paypal'), 'de_DE' => array('Title' => 'Paypal', 'ShortDescription' => 'PayPal ist sicherererer. Für Daten, für Einkäufe - Für alles', 'LongDescription' => 'PayPal für Ihren Shop Sie haben einen Online-Shop und fragen sich, warum Sie PayPal anbieten sollen? Ganz einfach: Ihre Kunden bezahlen mit nur zwei Klicks. Sie schließen den Kauf zufrieden ab, kommen gerne wieder - und Sie steigern Ihren Umsatz! Das kann PayPal für Sie tun – und mehr!', 'MetaDescription' => 'PayPal ist sicherererer. Für Daten, für Einkäufe - Für alles', 'MetaKeywords' => 'SilverCart, Modul, PayPal, Zahlart', 'MetaTitle' => 'Paypal'), 'PriceGrossAmount' => 9.99, 'PriceGrossCurrency' => _t('SilvercartTestData.CURRENCY'), 'PriceNetAmount' => 9.99 / 119 * 100, 'PriceNetCurrency' => _t('SilvercartTestData.CURRENCY'), 'MSRPriceAmount' => 9.99 / 100 * 120, 'MSRPriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'PurchasePriceAmount' => 9.99, 'PurchasePriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'Weight' => 250, 'StockQuantity' => 5, 'ProductNumberShop' => '10001', 'ProductNumberManufacturer' => 'SC_Mod_100', 'SilvercartProductGroupID' => $productGroupPayment->ID, 'productImage' => 'logopaypal.jpg'), array('en_US' => array('Title' => 'iPayment', 'ShortDescription' => 'iPayment is one of the largest providers of credit and debit card-based payment processing services in the country, processing more than $30 billion in credit and debit card volume annually.', 'LongDescription' => '<p>Receive best in class service no matter what size your business is, with iPayment. We’re committed to making your business more successful by delivering credit and debit card-based payment processing services that are customized to suit your needs.</p><ul><li>Major credit cards: MasterCard®, Visa®, American Express®, Discover® and JCB®</li><li>PIN-secured and signature debit cards</li><li>Gift and loyalty cards</li><li>Petroleum services</li><li>Paper and electronic check services</li><li>Cash advance funding program</li></ul><p><small>Source: www.ipaymentinc.com/</small></p>', 'MetaDescription' => 'iPayment is one of the largest providers of credit and debit card-based payment processing services in the country, processing more than $30 billion in credit and debit card volume annually.', 'MetaKeywords' => 'SilverCart, modules, iPayment, payment', 'MetaTitle' => 'iPayment'), 'en_GB' => array('Title' => 'iPayment', 'ShortDescription' => 'iPayment is one of the largest providers of credit and debit card-based payment processing services in the country, processing more than $30 billion in credit and debit card volume annually.', 'LongDescription' => '<p>Receive best in class service no matter what size your business is, with iPayment. We’re committed to making your business more successful by delivering credit and debit card-based payment processing services that are customized to suit your needs.</p><ul><li>Major credit cards: MasterCard®, Visa®, American Express®, Discover® and JCB®</li><li>PIN-secured and signature debit cards</li><li>Gift and loyalty cards</li><li>Petroleum services</li><li>Paper and electronic check services</li><li>Cash advance funding program</li></ul><p><small>Source: www.ipaymentinc.com/</small></p>', 'MetaDescription' => 'iPayment is one of the largest providers of credit and debit card-based payment processing services in the country, processing more than $30 billion in credit and debit card volume annually.', 'MetaKeywords' => 'SilverCart, modules, iPayment, payment', 'MetaTitle' => 'iPayment'), 'de_DE' => array('Title' => 'iPayment', 'ShortDescription' => 'iPayment unterstützt Ihren Geschäftserfolg im Internet, indem es Ihren Kunden die sichere Bezahlung per Kreditkarte, internetbasiertem elektronischen Lastschriftverfahren und weiteren Zahlungsmedien ermöglicht.', 'LongDescription' => 'ipayment unterstützt Ihren Geschäftserfolg im Internet, indem es Ihren Kunden die sichere Bezahlung per Kreditkarte, internetbasiertem elektronischen Lastschriftverfahren und weiteren Zahlungsmedien ermöglicht. Je nach genutztem Zahlungsanbieter können Sie Ihren Kunden über ipayment die Bezahlung mit folgenden Zahlungsmedien anbieten: Visa MasterCard Maestro American Express JCB Diners Club Visa Electron Solo Internetbasiertes Elektronisches Lastschriftverfahren (ELV) paysafecard Das Unternehmen, über das Sie Ihre Onlinezahlungen abwickeln möchten, können Sie dabei selbst auswählen - ipayment verfügt über Schnittstellen zu den wichtigsten Zahlungsanbietern. Sie schließen den Akzeptanzvertrag mit dem Anbieter Ihrer Wahl - ipayment sorgt für die reibungslose und sichere Abwicklung! Dazu nimmt ipayment die Zahlungsvorgänge direkt aus Ihrem System auf und verarbeitet sie im Hochleistungsrechenzentrum von 1&1 in Karlsruhe. Selbstverständlich erfüllt ipayment dabei die Zertifizierungsanforderungen gemäß dem PCI DSS (Payment Card Industry Data Security Standard). ', 'MetaDescription' => 'iPayment unterstützt Ihren Geschäftserfolg im Internet, indem es Ihren Kunden die sichere Bezahlung per Kreditkarte, internetbasiertem elektronischen Lastschriftverfahren und weiteren Zahlungsmedien ermöglicht.', 'MetaKeywords' => 'SilverCart, Module, iPayment, Zahlart', 'MetaTitle' => 'iPayment'), 'PriceGrossAmount' => 18.99, 'PriceGrossCurrency' => _t('SilvercartTestData.CURRENCY'), 'PriceNetAmount' => 18.99 / 119 * 100, 'PriceNetCurrency' => _t('SilvercartTestData.CURRENCY'), 'MSRPriceAmount' => 18.99 / 100 * 120, 'MSRPriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'PurchasePriceAmount' => 18.99, 'PurchasePriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'Weight' => 260, 'StockQuantity' => 3, 'ProductNumberShop' => '10002', 'ProductNumberManufacturer' => 'SC_Mod_101', 'SilvercartProductGroupID' => $productGroupPayment->ID, 'productImage' => 'logoipayment.gif'), array('en_US' => array('Title' => 'Saferpay', 'ShortDescription' => 'Saferpay has set the standard for e-payment solutions in German-speaking Europe.', 'LongDescription' => '<h3>Saferpay e-payment solutions for professionals and beginners</h3><p>Saferpay integrates all popular payment means in your Web shop through a single interface. This makes it easy to make adaptations and upgrades. What’s more, Saferpay enables the secure online processing of written and phone orders.</p><h3>More payment means – more turnover!</h3><p>Boost your turnover by offering a variety of payment means! With Saferpay you can offer your customers all popular payment means through a single interface, flexibly, easily & securely! You can accept all popular credit cards and debit cards with Saferpay and can activate new payment means at any time or deactivate existing ones and thus can flexibly react to your e-commerce requirements.</p><h3>More profit with security!</h3><p>SIX Card Solutions offers you comprehensive solutions from a single source to handle cashless, electronic payment processing as a merchant in e-commerce or in the phone/mail-order business as securely and conveniently as possible. The e-payment solution supports all current security standards. Increase confidence among your customers!</p>', 'MetaDescription' => 'Saferpay has set the standard for e-payment solutions in German-speaking Europe.', 'MetaKeywords' => 'SilverCart, modules, Saferpay, payment', 'MetaTitle' => 'Saferpay'), 'en_GB' => array('Title' => 'Saferpay', 'ShortDescription' => 'Saferpay has set the standard for e-payment solutions in German-speaking Europe.', 'LongDescription' => '<h3>Saferpay e-payment solutions for professionals and beginners</h3><p>Saferpay integrates all popular payment means in your Web shop through a single interface. This makes it easy to make adaptations and upgrades. What’s more, Saferpay enables the secure online processing of written and phone orders.</p><h3>More payment means – more turnover!</h3><p>Boost your turnover by offering a variety of payment means! With Saferpay you can offer your customers all popular payment means through a single interface, flexibly, easily & securely! You can accept all popular credit cards and debit cards with Saferpay and can activate new payment means at any time or deactivate existing ones and thus can flexibly react to your e-commerce requirements.</p><h3>More profit with security!</h3><p>SIX Card Solutions offers you comprehensive solutions from a single source to handle cashless, electronic payment processing as a merchant in e-commerce or in the phone/mail-order business as securely and conveniently as possible. The e-payment solution supports all current security standards. Increase confidence among your customers!</p>', 'MetaDescription' => 'Saferpay has set the standard for e-payment solutions in German-speaking Europe.', 'MetaKeywords' => 'SilverCart, modules, Saferpay, payment', 'MetaTitle' => 'Saferpay'), 'de_DE' => array('Title' => 'Saferpay', 'ShortDescription' => 'Saferpay hat im deutschsprachigen Europa den Standard für E-Payment-Lösungen gesetzt und steht damit als Synonym für "sicheres Bezahlen im Internet."', 'LongDescription' => '<h3>Saferpay E-Payment-Lösungen für Profis und Einsteiger</h3><p>Saferpay hat im deutschsprachigen Europa den Standard für E-Payment-Lösungen gesetzt und steht damit als Synonym für "sicheres Bezahlen im Internet." Dank Saferpay müssen sich Online-Händler wie Karteninhaber über die Sicherheit beim Einkaufen im Internet keine Sorgen mehr machen. Händler kennen und schätzen das sichere Bezahlen im Internet über Saferpay weltweit.</p><p>Saferpay integriert alle gängigen Zahlungsmittel in Ihren Webshop - über eine einzige Schnittstelle. Dadurch sind Anpassungen und Erweiterungen problemlos umsetzbar. Darüber hinaus ermöglicht Saferpay die sichere Onlineabwicklung von schriftlichen und telefonischen Bestellungen.</p><h3>Mehr Zahlungsmittel – mehr Umsatz!</h3><p>Steigern Sie Ihren Umsatz durch das Angebot einer Vielzahl an Zahlungsmitteln! Mit Saferpay bieten Sie Ihren Kunden alle gängigen Zahlungsmittel über eine einzige Schnittstelle – flexibel, einfach & sicher! Mit Saferpay können Sie alle gängigen Kreditkarten und Debitkarten akzeptieren. Sie können jederzeit neue Zahlungsmittel aufschalten oder bestehende wieder abschalten und somit flexibel auf die Bedürfnisse im E-Commerce reagieren.</p><h3>Mit Sicherheit mehr Gewinn!</h3><p>Um die bargeldlose, elektronische Zahlungsabwicklung für Sie als Händler im E-Commerce oder Phone-/Mail-Order Business so sicher und bequem wie möglich zu machen, bietet die SIX Card Solutions Ihnen als Händler Komplettlösungen aus einer Hand. Die E-Payment-Lösung unterstützt alle heutigen Sicherheitsstandards. Stärken Sie das Vertrauen Ihrer Kunden !</p>', 'MetaDescription' => 'Saferpay hat im deutschsprachigen Europa den Standard für E-Payment-Lösungen gesetzt und steht damit als Synonym für "sicheres Bezahlen im Internet."', 'MetaKeywords' => 'SilverCart, Module, Saferpay, Zahlart', 'MetaTitle' => 'Saferpay'), 'PriceGrossAmount' => 36.99, 'PriceGrossCurrency' => _t('SilvercartTestData.CURRENCY'), 'PriceNetAmount' => 36.99 / 119 * 100, 'PriceNetCurrency' => _t('SilvercartTestData.CURRENCY'), 'MSRPriceAmount' => 36.99 / 100 * 120, 'MSRPriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'PurchasePriceAmount' => 36.99, 'PurchasePriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'Weight' => 270, 'StockQuantity' => 12, 'ProductNumberShop' => '10003', 'ProductNumberManufacturer' => 'SC_Mod_102', 'SilvercartProductGroupID' => $productGroupPayment->ID, 'productImage' => 'logosaferpay.jpg'), array('en_US' => array('Title' => 'Prepayment', 'ShortDescription' => 'Flexible payment system for all payment systems which don' . "'" . 't need any automated logic.', 'LongDescription' => 'Flexible payment system for all payment systems which don' . "'" . 't need any automated logic. This module provides beside prepayment also payment via invoice.', 'MetaDescription' => 'Flexible payment system for all payment systems which don' . "'" . 't need any automated logic.', 'MetaKeywords' => 'SilverCart, modules, Prepayment, payment', 'MetaTitle' => 'Prepayment'), 'en_GB' => array('Title' => 'Prepayment', 'ShortDescription' => 'Flexible payment system for all payment systems which don' . "'" . 't need any automated logic.', 'LongDescription' => 'Flexible payment system for all payment systems which don' . "'" . 't need any automated logic. This module provides beside prepayment also payment via invoice.', 'MetaDescription' => 'Flexible payment system for all payment systems which don' . "'" . 't need any automated logic.', 'MetaKeywords' => 'SilverCart, modules, Prepayment, payment', 'MetaTitle' => 'Prepayment'), 'de_DE' => array('Title' => 'Vorkasse', 'ShortDescription' => 'Flexibles Zahlungs-Modul für alle Zahlungsarten, die keine automatisierte Logik erfordern.', 'LongDescription' => 'Flexibles Zahlungs-Modul für alle Zahlungsarten, die keine automatisierte Logik erfordern. Dieses Modul bietet neben der Vorkasse auch Rechnung als Zahlungsart.', 'MetaDescription' => 'Flexibles Zahlungs-Modul für alle Zahlungsarten, die keine automatisierte Logik erfordern.', 'MetaKeywords' => 'SilverCart, Module, Prepayment, Zahlart', 'MetaTitle' => 'Vorkasse'), 'PriceGrossAmount' => 27.99, 'PriceGrossCurrency' => _t('SilvercartTestData.CURRENCY'), 'PriceNetAmount' => 27.99 / 119 * 100, 'PriceNetCurrency' => _t('SilvercartTestData.CURRENCY'), 'MSRPriceAmount' => 27.99 / 100 * 120, 'MSRPriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'PurchasePriceAmount' => 27.99, 'PurchasePriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'Weight' => 290, 'StockQuantity' => 9, 'ProductNumberShop' => '10004', 'ProductNumberManufacturer' => 'SC_Mod_103', 'SilvercartProductGroupID' => $productGroupPayment->ID, 'productImage' => 'logoprepayment.png'), array('en_US' => array('Title' => 'Cross selling', 'ShortDescription' => 'Cross selling is a practice of suggesting related products or services to a customer who is considering buying something.', 'LongDescription' => 'It is a practice of suggesting related products or services to a customer who is considering buying something. Encourage established customers to buy different but related products. Getting a computer buyer to purchase a printer, for example. Source: www.procopytips.com', 'MetaDescription' => 'Cross selling is a practice of suggesting related products or services to a customer who is considering buying something.', 'MetaKeywords' => 'SilverCart, module, Cross selling, marketing', 'MetaTitle' => 'Cross selling'), 'en_GB' => array('Title' => 'Cross selling', 'ShortDescription' => 'Cross selling is a practice of suggesting related products or services to a customer who is considering buying something.', 'LongDescription' => 'It is a practice of suggesting related products or services to a customer who is considering buying something. Encourage established customers to buy different but related products. Getting a computer buyer to purchase a printer, for example. Source: www.procopytips.com', 'MetaDescription' => 'Cross selling is a practice of suggesting related products or services to a customer who is considering buying something.', 'MetaKeywords' => 'SilverCart, module, Cross selling, marketing', 'MetaTitle' => 'Cross selling'), 'de_DE' => array('Title' => 'Cross-Selling', 'ShortDescription' => 'Kreuzverkauf bezeichnet im Marketing den Verkauf von sich ergänzenden Produkten oder Dienstleistungen.', 'LongDescription' => 'Verkaufs- bzw. Marketinginstrument, bei dem Informationen über bereits existierende Kunden oder über bekanntes Konsumentenverhalten genutzt wird, um zusätzliche Käufe anderer Produkte zu begünstigen. Quelle: www.desig-n.de ', 'MetaDescription' => 'Kreuzverkauf bezeichnet im Marketing den Verkauf von sich ergänzenden Produkten oder Dienstleistungen.', 'MetaKeywords' => 'SilverCart, Modul, Cross-Selling, Marketing', 'MetaTitle' => 'Cross-Selling'), 'PriceGrossAmount' => 12.99, 'PriceGrossCurrency' => _t('SilvercartTestData.CURRENCY'), 'PriceNetAmount' => 12.99 / 119 * 100, 'PriceNetCurrency' => _t('SilvercartTestData.CURRENCY'), 'MSRPriceAmount' => 12.99 / 100 * 120, 'MSRPriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'PurchasePriceAmount' => 12.99, 'PurchasePriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'Weight' => 145, 'StockQuantity' => 26, 'ProductNumberShop' => '10006', 'ProductNumberManufacturer' => 'SC_Mod_104', 'SilvercartProductGroupID' => $productGroupMarketing->ID, 'productImage' => 'logocrossselling.png'), array('en_US' => array('Title' => 'eKomi', 'ShortDescription' => 'Increase sales with eKomi’s trusted independent customer review system!', 'LongDescription' => 'eKomi – The Feedback Company, helps companies through their web-based social SaaS technology with authentic and valuable reviews from customers and helps increasing the customer satisfaction and sales. Generate valuable customer reviews with eKomi' . "'" . 's intelligent, easy to install software and increase sales, trust and customer loyalty. <small>Source: www.ekomi.co.uk</small>', 'MetaDescription' => 'Increase sales with eKomi’s trusted independent customer review system!', 'MetaKeywords' => 'SilverCart, module, Ekomi, marketing', 'MetaTitle' => 'eKomi'), 'en_GB' => array('Title' => 'eKomi', 'ShortDescription' => 'Increase sales with eKomi’s trusted independent customer review system!', 'LongDescription' => 'eKomi – The Feedback Company, helps companies through their web-based social SaaS technology with authentic and valuable reviews from customers and helps increasing the customer satisfaction and sales. Generate valuable customer reviews with eKomi' . "'" . 's intelligent, easy to install software and increase sales, trust and customer loyalty. <small>Source: www.ekomi.co.uk</small>', 'MetaDescription' => 'Increase sales with eKomi’s trusted independent customer review system!', 'MetaKeywords' => 'SilverCart, module, Ekomi, marketing', 'MetaTitle' => 'eKomi'), 'de_DE' => array('Title' => 'eKomi', 'ShortDescription' => 'Mehr Umsatz und Vertrauen durch unabhängige Kunden- und Produktbewertungen!', 'LongDescription' => 'Beginnen Sie noch heute, durch intelligente Kundenbefragung authentisches und wertvolles Kundenfeedback zu gewinnen und damit Ihre Kundenzufriedenheit und Ihren Umsatz zu steigern. ', 'MetaDescription' => 'Mehr Umsatz und Vertrauen durch unabhängige Kunden- und Produktbewertungen!', 'MetaKeywords' => 'SilverCart, Modul, Ekomi, Marketing', 'MetaTitle' => 'eKomi'), 'Title' => _t('SilvercartTestData.PRODUCTMARKETINGEKOMI_TITLE'), 'PriceGrossAmount' => 32.99, 'PriceGrossCurrency' => _t('SilvercartTestData.CURRENCY'), 'PriceNetAmount' => 32.99 / 119 * 100, 'PriceNetCurrency' => _t('SilvercartTestData.CURRENCY'), 'MSRPriceAmount' => 32.99 / 100 * 120, 'MSRPriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'PurchasePriceAmount' => 32.99, 'PurchasePriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'ShortDescription' => _t('SilvercartTestData.PRODUCTMARKETINGEKOMI_SHORTDESC'), 'LongDescription' => _t('SilvercartTestData.PRODUCTMARKETINGEKOMI_LONGDESC'), 'MetaDescription' => _t('SilvercartTestData.PRODUCTMARKETINGEKOMI_SHORTDESC'), 'MetaTitle' => _t('SilvercartTestData.PRODUCTMARKETINGEKOMI_TITLE'), 'MetaKeywords' => _t('SilvercartTestData.PRODUCTMARKETINGEKOMI_KEYWORDS'), 'Weight' => 345, 'StockQuantity' => 146, 'ProductNumberShop' => '10007', 'ProductNumberManufacturer' => 'SC_Mod_105', 'SilvercartProductGroupID' => $productGroupMarketing->ID, 'productImage' => 'logoekomi.jpg'), array('en_US' => array('Title' => 'Protected Shops', 'ShortDescription' => 'Make your online shop more secure! Try the Protected Shops quality rating system to boost your sales!', 'LongDescription' => 'In the online business you will be confronted with unmanageable specifications which can be very expensive if you breach the conditions. Protected Shops offers a quality rating system to boost your sales. 67% of customers trust in a indepented shop ratings. Use the Vote connect interface of Protected Shops to integrate the quality rating system provided by Protected Shops into SilverCart.', 'MetaDescription' => 'Make your online shop more secure! Try the Protected Shops quality rating system to boost your sales!', 'MetaKeywords' => 'SilverCart, modules, ProtectedShops, marketing', 'MetaTitle' => 'Protected Shops'), 'en_GB' => array('Title' => 'Protected Shops', 'ShortDescription' => 'Make your online shop more secure! Try the Protected Shops quality rating system to boost your sales!', 'LongDescription' => 'In the online business you will be confronted with unmanageable specifications which can be very expensive if you breach the conditions. Protected Shops offers a quality rating system to boost your sales. 67% of customers trust in a indepented shop ratings. Use the Vote connect interface of Protected Shops to integrate the quality rating system provided by Protected Shops into SilverCart.', 'MetaDescription' => 'Make your online shop more secure! Try the Protected Shops quality rating system to boost your sales!', 'MetaKeywords' => 'SilverCart, modules, ProtectedShops, marketing', 'MetaTitle' => 'Protected Shops'), 'de_DE' => array('Title' => 'Protected Shops', 'ShortDescription' => 'Machen Sie Ihr Online-Business sicherer! Wer im Internet handelt, kann seinen Umsatz durch das Protected Shops Bewertungssystem steigern. ', 'LongDescription' => 'Wer im Internet handelt, ist mit einer unüberschaubaren Menge rechtlicher Vorgaben konfrontiert, die bei Nichteinhaltung zu einem teuren Unterfangen werden können. Gerade von Konkurrenten, die ihren Mitbewerb durch teuere Abmahnungen zu schädigen versuchen, geht für Ihr Unternehmen eine große Gefahr aus. Wer im Internet handelt, kann seinen Umsatz durch das Protected Shops Bewertungssystem steigern. 67% der Online Käufer vertrauen auf Online-Konsumentenbewertungen (Quelle: www.nielsen.com vom 24.07.2009). Mit unserer Vote Connect Schnittstelle integrieren Sie das Protected Shops Kundenbewertungssystem in Ihren Shop. ', 'MetaDescription' => 'Machen Sie Ihr Online-Business sicherer! Wer im Internet handelt, kann seinen Umsatz durch das Protected Shops Bewertungssystem steigern. ', 'MetaKeywords' => 'SilverCart, Module, ProtectedShops, Marketing', 'MetaTitle' => 'Protected Shops'), 'PriceGrossAmount' => 49.99, 'PriceGrossCurrency' => _t('SilvercartTestData.CURRENCY'), 'PriceNetAmount' => 49.99 / 119 * 100, 'PriceNetCurrency' => _t('SilvercartTestData.CURRENCY'), 'MSRPriceAmount' => 49.99 / 100 * 120, 'MSRPriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'PurchasePriceAmount' => 49.99, 'PurchasePriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'Weight' => 75, 'StockQuantity' => 101, 'ProductNumberShop' => '10008', 'ProductNumberManufacturer' => 'SC_Mod_106', 'SilvercartProductGroupID' => $productGroupMarketing->ID, 'productImage' => 'logoprotectedshops.jpg'), array('en_US' => array('Title' => 'DHL', 'ShortDescription' => 'Packet interface for the shipping provider DHL (EasyLog)', 'LongDescription' => 'Packet interface for the shipping provider DHL. Interface to export ordernumbers into Easylog and import tracking numbers back into SilverCart.', 'MetaDescription' => 'Packet interface for the shipping provider DHL (EasyLog)', 'MetaKeywords' => 'SilverCart, modules, shipping, DHL', 'MetaTitle' => 'DHL'), 'en_GB' => array('Title' => 'DHL', 'ShortDescription' => 'Packet interface for the shipping provider DHL (EasyLog)', 'LongDescription' => 'Packet interface for the shipping provider DHL. Interface to export ordernumbers into Easylog and import tracking numbers back into SilverCart.', 'MetaDescription' => 'Packet interface for the shipping provider DHL (EasyLog)', 'MetaKeywords' => 'SilverCart, modules, shipping, DHL', 'MetaTitle' => 'DHL'), 'de_DE' => array('Title' => 'DHL', 'ShortDescription' => 'Paketschnittstelle zum Versandanbieter DHL (Easylog)', 'LongDescription' => 'Paketschnittstelle zum Versandanbieter DHL für den Export von Bestellungen nach Easylog und den Import von Sendungsnachverfolgungsnummern in SilverCart.', 'MetaDescription' => 'Paketschnittstelle zum Versandanbieter DHL (Easylog)', 'MetaKeywords' => 'SilverCart, Module, Versand, DHL', 'MetaTitle' => 'DHL'), 'PriceGrossAmount' => 27.99, 'PriceGrossCurrency' => _t('SilvercartTestData.CURRENCY'), 'PriceNetAmount' => 27.99 / 119 * 100, 'PriceNetCurrency' => _t('SilvercartTestData.CURRENCY'), 'MSRPriceAmount' => 27.99 / 100 * 120, 'MSRPriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'PurchasePriceAmount' => 27.99, 'PurchasePriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'Weight' => 95, 'StockQuantity' => 12, 'ProductNumberShop' => '10009', 'ProductNumberManufacturer' => 'SC_Mod_107', 'SilvercartProductGroupID' => $productGroupOthers->ID, 'productImage' => 'logodhl.jpg'), array('en_US' => array('Title' => 'PDF Invoice', 'ShortDescription' => 'Automatically generate PDF invoices', 'LongDescription' => 'Automatically generated purchase order as PDF file.', 'MetaDescription' => 'Automatically generate PDF invoices', 'MetaKeywords' => 'SilverCart, modules, PDF invoice', 'MetaTitle' => 'PDF Invoice'), 'en_GB' => array('Title' => 'PDF Invoice', 'ShortDescription' => 'Automatically generate PDF invoices', 'LongDescription' => 'Automatically generated purchase order as PDF file.', 'MetaDescription' => 'Automatically generate PDF invoices', 'MetaKeywords' => 'SilverCart, modules, PDF invoice', 'MetaTitle' => 'PDF Invoice'), 'de_DE' => array('Title' => 'PDF-Rechnung', 'ShortDescription' => 'Automatische Generierung von PDF-Rechnungen', 'LongDescription' => 'Erstellt automatisiert PDF-Rechnungen bei Bestellungen.', 'MetaDescription' => 'Automatische Generierung von PDF-Rechnungen', 'MetaKeywords' => 'SilverCart, Module, PDF-Rechnung', 'MetaTitle' => 'PDF-Rechnung'), 'PriceGrossAmount' => 18.99, 'PriceGrossCurrency' => _t('SilvercartTestData.CURRENCY'), 'PriceNetAmount' => 18.99 / 119 * 100, 'PriceNetCurrency' => _t('SilvercartTestData.CURRENCY'), 'MSRPriceAmount' => 18.99 / 100 * 120, 'MSRPriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'PurchasePriceAmount' => 18.99, 'PurchasePriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'Weight' => 173, 'StockQuantity' => 14, 'ProductNumberShop' => '10011', 'ProductNumberManufacturer' => 'SC_Mod_109', 'SilvercartProductGroupID' => $productGroupOthers->ID, 'productImage' => 'logopdfinvoice.jpg'), array('en_US' => array('Title' => 'Vouchers', 'ShortDescription' => 'Create various vouchers with percentage or absolute price discount plus coupons for products.', 'LongDescription' => 'Create various vouchers with percentage or absolute price discount plus coupons for products.', 'MetaDescription' => 'Create various vouchers with percentage or absolute price discount plus coupons for products.', 'MetaKeywords' => 'SilverCart, modules, vouchers', 'MetaTitle' => 'Vouchers'), 'en_GB' => array('Title' => 'Vouchers', 'ShortDescription' => 'Create various vouchers with percentage or absolute price discount plus coupons for products.', 'LongDescription' => 'Create various vouchers with percentage or absolute price discount plus coupons for products.', 'MetaDescription' => 'Create various vouchers with percentage or absolute price discount plus coupons for products.', 'MetaKeywords' => 'SilverCart, modules, vouchers', 'MetaTitle' => 'Vouchers'), 'de_DE' => array('Title' => 'Gutscheine', 'ShortDescription' => 'Gutscheinerstellung mit prozentualem oder absolutem Rabatt sowie Warengutscheinen.', 'LongDescription' => 'Gutscheinerstellung mit prozentualem oder absolutem Rabatt sowie Warengutscheinen.', 'MetaDescription' => 'Gutscheinerstellung mit prozentualem oder absolutem Rabatt sowie Warengutscheinen.', 'MetaKeywords' => 'Silvercart, Module, Gutscheine', 'MetaTitle' => 'Gutscheine'), 'PriceGrossAmount' => 32.99, 'PriceGrossCurrency' => _t('SilvercartTestData.CURRENCY'), 'PriceNetAmount' => 32.99 / 119 * 100, 'PriceNetCurrency' => _t('SilvercartTestData.CURRENCY'), 'MSRPriceAmount' => 32.99 / 100 * 120, 'MSRPriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'PurchasePriceAmount' => 32.99, 'PurchasePriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'Weight' => 373, 'StockQuantity' => 24, 'ProductNumberShop' => '10012', 'ProductNumberManufacturer' => 'SC_Mod_110', 'SilvercartProductGroupID' => $productGroupOthers->ID, 'productImage' => 'logovouchers.png'));
         // Create folder for product images
         $exampleDataDir = Director::baseFolder() . '/assets/test-images/';
         $imageFolder = new Folder();
         $imageFolder->setName('test-images');
         $imageFolder->write();
         if (!file_exists($exampleDataDir)) {
             mkdir($exampleDataDir);
         }
         $locales = array('de_DE', 'en_GB', 'en_US');
         $fallbackLocale = false;
         if (!in_array(Translatable::get_current_locale(), $locales)) {
             $locales[] = Translatable::get_current_locale();
             $fallbackLocale = Translatable::get_current_locale();
         }
         // Create products
         foreach ($products as $product) {
             $productItem = new SilvercartProduct();
             $productItem->SilvercartTaxID = $taxRateID;
             $productItem->SilvercartManufacturerID = $manufacturer->ID;
             $productItem->Weight = $product['Weight'];
             $productItem->StockQuantity = $product['StockQuantity'];
             $productItem->ProductNumberShop = $product['ProductNumberShop'];
             $productItem->ProductNumberManufacturer = $product['ProductNumberManufacturer'];
             $productItem->SilvercartProductGroupID = $product['SilvercartProductGroupID'];
             $productItem->PriceGrossAmount = $product['PriceGrossAmount'];
             $productItem->PriceGrossCurrency = $product['PriceGrossCurrency'];
             $productItem->PriceNetAmount = $product['PriceNetAmount'];
             $productItem->PriceNetCurrency = $product['PriceNetCurrency'];
             $productItem->MSRPriceAmount = $product['MSRPriceAmount'];
             $productItem->MSRPriceCurrency = $product['MSRPriceCurrency'];
             $productItem->PurchasePriceAmount = $product['PurchasePriceAmount'];
             $productItem->PurchasePriceCurrency = $product['PurchasePriceCurrency'];
             $productItem->write();
             if ($fallbackLocale !== false) {
                 $product[$fallbackLocale] = $product['en_US'];
             }
             //create the language objects for the locales
             foreach ($locales as $locale) {
                 /*
                  * We need to check if a language object exists alredy because
                  * a hook of SilvercartProduct defaultly creates one.
                  */
                 $language = SilvercartProductLanguage::get()->filter(array('SilvercartProductID' => $productItem->ID, 'Locale' => $locale))->first();
                 if (!$language) {
                     $language = new SilvercartProductLanguage();
                     $language->Locale = $locale;
                 }
                 $language->SilvercartProductID = $productItem->ID;
                 if (array_key_exists($locale, $product)) {
                     foreach ($product[$locale] as $attribute => $value) {
                         $language->{$attribute} = $value;
                     }
                 }
                 $language->write();
             }
             // Add product image
             if (array_key_exists('productImage', $product)) {
                 copy(Director::baseFolder() . '/silvercart/img/exampledata/' . $product['productImage'], $exampleDataDir . $product['productImage']);
                 $productImage = new Image();
                 $productImage->setName($product['productImage']);
                 $productImage->setFilename($exampleDataDir . '/' . $product['productImage']);
                 $productImage->setParentID($imageFolder->ID);
                 $productImage->write();
                 $silvercartImage = new SilvercartImage();
                 $silvercartImage->SilvercartProductID = $productItem->ID;
                 $silvercartImage->ImageID = $productImage->ID;
                 $silvercartImage->write();
             }
         }
         // create widget sets
         $widgetSetFrontPageContentArea = new WidgetArea();
         $widgetSetFrontPageContentArea->write();
         $widgetSetFrontPageContent = new WidgetSet();
         $widgetSetFrontPageContent->setField('Title', _t('SilvercartTestData.WIDGETSET_FRONTPAGE_CONTENT_TITLE'));
         $widgetSetFrontPageContent->setField('WidgetAreaID', $widgetSetFrontPageContentArea->ID);
         $widgetSetFrontPageContent->write();
         $widgetSetFrontPageSidebarArea = new WidgetArea();
         $widgetSetFrontPageSidebarArea->write();
         $widgetSetFrontPageSidebar = new WidgetSet();
         $widgetSetFrontPageSidebar->setField('Title', _t('SilvercartTestData.WIDGETSET_FRONTPAGE_SIDEBAR_TITLE'));
         $widgetSetFrontPageSidebar->setField('WidgetAreaID', $widgetSetFrontPageSidebarArea->ID);
         $widgetSetFrontPageSidebar->write();
         $widgetSetProductGroupPagesSidebarArea = new WidgetArea();
         $widgetSetProductGroupPagesSidebarArea->write();
         $widgetSetProductGroupPagesSidebar = new WidgetSet();
         $widgetSetProductGroupPagesSidebar->setField('Title', _t('SilvercartTestData.WIDGETSET_PRODUCTGROUPPAGES_SIDEBAR_TITLE'));
         $widgetSetProductGroupPagesSidebar->setField('WidgetAreaID', $widgetSetProductGroupPagesSidebarArea->ID);
         $widgetSetProductGroupPagesSidebar->write();
         // Attribute widget sets to pages
         $frontPage = SilvercartPage_Controller::PageByIdentifierCode('SilvercartFrontPage');
         if ($frontPage) {
             $frontPage->WidgetSetContent()->add($widgetSetFrontPageContent);
             $frontPage->WidgetSetSidebar()->add($widgetSetFrontPageSidebar);
         }
         $productGroupHolderPage = SilvercartPage_Controller::PageByIdentifierCode('SilvercartProductGroupHolder');
         if ($productGroupHolderPage) {
             $productGroupHolderPage->WidgetSetSidebar()->add($widgetSetProductGroupPagesSidebar);
         }
         // Create Widgets
         $widgetFrontPageContent1 = new SilvercartProductGroupItemsWidget();
         $widgetFrontPageContent1->setField('FrontTitle', _t('SilvercartTestData.WIDGETSET_FRONTPAGE_CONTENT1_TITLE'));
         $widgetFrontPageContent1->setField('FrontContent', _t('SilvercartTestData.WIDGETSET_FRONTPAGE_CONTENT1_CONTENT'));
         $widgetFrontPageContent1->setField('numberOfProductsToShow', 4);
         $widgetFrontPageContent1->setField('SilvercartProductGroupPageID', $productGroupPayment->ID);
         $widgetFrontPageContent1->setField('GroupView', 'tile');
         $widgetFrontPageContent1->setField('isContentView', 1);
         $widgetFrontPageContent1->setField('useSlider', 0);
         $widgetFrontPageContent1->setField('buildArrows', 0);
         $widgetFrontPageContent1->setField('buildNavigation', 1);
         $widgetFrontPageContent1->setField('buildStartStop', 0);
         $widgetFrontPageContent1->setField('slideDelay', 6000);
         $widgetFrontPageContent1->setField('transitionEffect', 'fade');
         $widgetFrontPageContent1->setField('Sort', 2);
         $widgetFrontPageContent1->write();
         $widgetSetFrontPageContentArea->Widgets()->add($widgetFrontPageContent1);
         $widgetFrontPageContent2 = new SilvercartProductGroupItemsWidget();
         $widgetFrontPageContent2->setField('FrontTitle', _t('SilvercartTestData.WIDGETSET_FRONTPAGE_CONTENT2_TITLE'));
         $widgetFrontPageContent2->setField('FrontContent', _t('SilvercartTestData.WIDGETSET_FRONTPAGE_CONTENT2_CONTENT'));
         $widgetFrontPageContent2->setField('numberOfProductsToShow', 1);
         $widgetFrontPageContent2->setField('numberOfProductsToFetch', 4);
         $widgetFrontPageContent2->setField('SilvercartProductGroupPageID', $productGroupOthers->ID);
         $widgetFrontPageContent2->setField('GroupView', 'list');
         $widgetFrontPageContent2->setField('isContentView', 1);
         $widgetFrontPageContent2->setField('useSlider', 1);
         $widgetFrontPageContent2->setField('buildArrows', 0);
         $widgetFrontPageContent2->setField('buildNavigation', 1);
         $widgetFrontPageContent2->setField('buildStartStop', 0);
         $widgetFrontPageContent2->setField('slideDelay', 6000);
         $widgetFrontPageContent2->setField('transitionEffect', 'horizontalSlide');
         $widgetFrontPageContent2->setField('Sort', 3);
         $widgetFrontPageContent2->write();
         $widgetSetFrontPageContentArea->Widgets()->add($widgetFrontPageContent2);
         $widgetFrontPageContent3 = new SilvercartImageSliderWidget();
         $widgetFrontPageContent3->setField('buildArrows', 0);
         $widgetFrontPageContent3->setField('buildNavigation', 1);
         $widgetFrontPageContent3->setField('buildStartStop', 0);
         $widgetFrontPageContent3->setField('slideDelay', 10000);
         $widgetFrontPageContent3->setField('transitionEffect', 'fade');
         $widgetFrontPageContent3->setField('Sort', 0);
         $widgetFrontPageContent3->write();
         $widgetSetFrontPageContentArea->Widgets()->add($widgetFrontPageContent3);
         copy(Director::baseFolder() . '/silvercart/img/exampledata/silvercart_teaser.jpg', $exampleDataDir . '/silvercart_teaser.jpg');
         $teaserImage = new Image();
         $teaserImage->setFilename($exampleDataDir . '/silvercart_teaser.jpg');
         $teaserImage->setParentID($imageFolder->ID);
         $teaserImage->write();
         $slideImage = new SilvercartImageSliderImage();
         #$slideImage->setField('Title',   'Silvercart Teaser');
         $slideImage->setField('ImageID', $teaserImage->ID);
         $slideImage->write();
         $sliderImageTranslations = array('en_GB' => 'SilverCart Teaser', 'en_US' => 'SilverCart Teaser', 'de_DE' => 'SilverCart Teaser');
         $locales = array('de_DE', 'en_GB', 'en_US');
         $fallbackLocale = false;
         if (!in_array(Translatable::get_current_locale(), $locales)) {
             $locales[] = Translatable::get_current_locale();
             $fallbackLocale = Translatable::get_current_locale();
         }
         if ($fallbackLocale !== false) {
             $sliderImageTranslations[$fallbackLocale] = $sliderImageTranslations['en_US'];
         }
         foreach ($sliderImageTranslations as $locale => $translation) {
             $translationObj = SilvercartImageSliderImageLanguage::get()->filter('Locale', $locale)->first();
             if (!$translationObj) {
                 $translationObj = new SilvercartImageSliderImageLanguage();
                 $translationObj->Locale = $locale;
                 $translationObj->SilvercartImageSliderImageID = $slideImage->ID;
             }
             $translationObj->Title = $translation;
             $translationObj->write();
         }
         $widgetFrontPageContent3->slideImages()->add($slideImage);
         $widgetFrontPageSidebar1 = new SilvercartProductGroupItemsWidget();
         $widgetFrontPageSidebar1->setField('numberOfProductsToShow', 3);
         $widgetFrontPageSidebar1->setField('SilvercartProductGroupPageID', $productGroupMarketing->ID);
         $widgetFrontPageSidebar1->setField('useSlider', 0);
         $widgetFrontPageSidebar1->setField('GroupView', 'list');
         $widgetFrontPageSidebar1->setField('isContentView', 0);
         $widgetFrontPageSidebar1->setField('buildArrows', 0);
         $widgetFrontPageSidebar1->setField('buildNavigation', 1);
         $widgetFrontPageSidebar1->setField('buildStartStop', 0);
         $widgetFrontPageSidebar1->setField('slideDelay', 4000);
         $widgetFrontPageSidebar1->setField('transitionEffect', 'horizontalSlide');
         $widgetFrontPageSidebar1->setField('Sort', 0);
         $widgetFrontPageSidebar1->write();
         $widgetSetFrontPageSidebarArea->Widgets()->add($widgetFrontPageSidebar1);
         $widgetFrontPageSidebar2 = new SilvercartShoppingCartWidget();
         $widgetFrontPageSidebar2->setField('Sort', 1);
         $widgetFrontPageSidebar2->write();
         $widgetSetFrontPageSidebarArea->Widgets()->add($widgetFrontPageSidebar2);
         $widgetFrontPageSidebar3 = new SilvercartLoginWidget();
         $widgetFrontPageSidebar3->setField('Sort', 2);
         $widgetFrontPageSidebar3->write();
         $widgetSetFrontPageSidebarArea->Widgets()->add($widgetFrontPageSidebar3);
         // product group page widgets
         $widgetProductGroupPageSidebar1 = new SilvercartProductGroupItemsWidget();
         $widgetProductGroupPageSidebar1->setField('numberOfProductsToShow', 3);
         $widgetProductGroupPageSidebar1->setField('SilvercartProductGroupPageID', $productGroupMarketing->ID);
         $widgetProductGroupPageSidebar1->setField('useSlider', 0);
         $widgetProductGroupPageSidebar1->setField('GroupView', 'list');
         $widgetProductGroupPageSidebar1->setField('isContentView', 0);
         $widgetProductGroupPageSidebar1->setField('buildArrows', 0);
         $widgetProductGroupPageSidebar1->setField('buildNavigation', 1);
         $widgetProductGroupPageSidebar1->setField('buildStartStop', 0);
         $widgetProductGroupPageSidebar1->setField('slideDelay', 4000);
         $widgetProductGroupPageSidebar1->setField('transitionEffect', 'horizontalSlide');
         $widgetProductGroupPageSidebar1->setField('Sort', 0);
         $widgetProductGroupPageSidebar1->write();
         $widgetSetProductGroupPagesSidebarArea->Widgets()->add($widgetProductGroupPageSidebar1);
         $widgetProductGroupPageSidebar2 = new SilvercartShoppingCartWidget();
         $widgetProductGroupPageSidebar2->setField('Sort', 1);
         $widgetProductGroupPageSidebar2->write();
         $widgetSetProductGroupPagesSidebarArea->Widgets()->add($widgetProductGroupPageSidebar2);
         $widgetProductGroupPageSidebar3 = new SilvercartLoginWidget();
         $widgetProductGroupPageSidebar3->setField('Sort', 2);
         $widgetProductGroupPageSidebar3->write();
         $widgetSetProductGroupPagesSidebarArea->Widgets()->add($widgetProductGroupPageSidebar3);
         //self::createTestDataSlidorion($widgetSetFrontPageContentArea);
         return true;
     }
 }
 /**
  * Creates the upload folder for payment images if it doesn't exist.
  *
  * @param array  $paymentLogos      The payment logos as associative array:
  *                                  ['LogoName' => 'PATH_TO_FILE', ....]
  * @param string $paymentModuleName The name of the payment module
  *
  * @return void
  *
  * @author Sebastian Diel <*****@*****.**>,
  *         Sascha Koehler <*****@*****.**>
  * @since 16.06.2014
  */
 public function createLogoImageObjects($paymentLogos, $paymentModuleName)
 {
     //make sure that the folder "Uploads" exists
     Folder::find_or_make('Uploads');
     $paymentModule = SilvercartPaymentMethod::get()->filter(array("ClassName" => $paymentModuleName))->sort(array("ID" => "ASC"))->first();
     if ($paymentModule) {
         if (count($this->getPossiblePaymentChannels()) > 0) {
             // Multiple payment channels
             foreach ($paymentLogos as $paymentChannel => $logos) {
                 $paymentChannelMethod = DataObject::get_one($paymentModuleName, sprintf("\"PaymentChannel\"='%s'", $paymentChannel), true, $paymentModuleName . ".ID");
                 if ($paymentChannelMethod) {
                     if (!$paymentChannelMethod->PaymentLogos()->exists()) {
                         foreach ($logos as $title => $logo) {
                             $paymentLogo = new SilvercartImage();
                             $paymentLogo->Title = $title;
                             $storedLogo = Image::get()->filter('Name', basename($logo))->first();
                             if ($storedLogo) {
                                 $paymentLogo->ImageID = $storedLogo->ID;
                             } else {
                                 file_put_contents(Director::baseFolder() . '/' . $this->uploadsFolder->Filename . basename($logo), file_get_contents(Director::baseFolder() . $logo));
                                 $image = new Image();
                                 $image->setFilename($this->uploadsFolder->Filename . basename($logo));
                                 $image->setName(basename($logo));
                                 $image->Title = basename($logo, '.png');
                                 $image->ParentID = $this->uploadsFolder->ID;
                                 $image->write();
                                 $paymentLogo->ImageID = $image->ID;
                             }
                             $paymentLogo->write();
                             $paymentChannelMethod->PaymentLogos()->add($paymentLogo);
                         }
                     }
                 }
             }
         } else {
             // Single payment channels
             foreach ($paymentLogos as $title => $logo) {
                 if (!$paymentModule->PaymentLogos()->exists()) {
                     $paymentLogo = new SilvercartImage();
                     $paymentLogo->Title = $title;
                     $storedLogo = Image::get()->filter('Name', basename($logo))->first();
                     if ($storedLogo) {
                         $paymentLogo->ImageID = $storedLogo->ID;
                     } else {
                         file_put_contents(Director::baseFolder() . '/' . $this->uploadsFolder->Filename . basename($logo), file_get_contents(Director::baseFolder() . $logo));
                         $image = new Image();
                         $image->setFilename($this->uploadsFolder->Filename . basename($logo));
                         $image->setName(basename($logo));
                         $image->Title = basename($logo, '.png');
                         $image->ParentID = $this->uploadsFolder->ID;
                         $image->write();
                         $paymentLogo->ImageID = $image->ID;
                     }
                     $paymentLogo->write();
                     $paymentModule->PaymentLogos()->add($paymentLogo);
                 }
             }
         }
     }
 }
 function requireDefaultRecords()
 {
     parent::requireDefaultRecords();
     $bt = defined('DB::USE_ANSI_SQL') ? '"' : '`';
     $update = array();
     $siteConfig = DataObject::get_one('SiteConfig');
     $folder = Folder::findOrMake(self::get_folder_name());
     if ($siteConfig && $folder) {
         $fullArray = self::get_images_to_replace();
         //copying ....
         if ($fullArray) {
             foreach ($fullArray as $key => $array) {
                 $className = $array["ClassName"];
                 $fieldName = $array["FieldName"] . "ID";
                 if (class_exists($className)) {
                     $dataObject = singleton($className);
                     $dbFieldName = $array["DBFieldName"];
                     $fileName = basename($array["CopyFromPath"]);
                     $fromLocationLong = Director::baseFolder() . '/' . $array["CopyFromPath"];
                     $toLocationShort = "assets/" . self::get_folder_name() . "/{$fileName}";
                     $toLocationLong = Director::baseFolder() . '/' . $toLocationShort;
                     $image = DataObject::get_one('Image', "Filename='{$toLocationShort}' AND ParentID = " . $folder->ID);
                     if (!$image) {
                         if (!file_exists($toLocationLong)) {
                             copy($fromLocationLong, $toLocationLong);
                         }
                         $image = new Image();
                         $image->ParentID = $folder->ID;
                         $image->FileName = $toLocationShort;
                         $image->setName($fileName);
                         $image->write();
                     } elseif (!$image && file_exists($toLocationLong)) {
                         debug::show("need to update files");
                     }
                     if ($image && $image->ID) {
                         if (!$siteConfig->{$dbFieldName}) {
                             $siteConfig->{$dbFieldName} = $image->ID;
                             $update[] = "created placeholder image for {$key}";
                         }
                         $updateSQL = " UPDATE {$bt}" . $className . "{$bt}";
                         if (isset($_GET["removeplaceholderimages"])) {
                             $setSQL = " SET {$bt}" . $fieldName . "{$bt} = 0";
                             $whereSQL = " WHERE {$bt}" . $fieldName . "{$bt}  = " . $image->ID;
                             DB::alteration_message("removing " . $className . "." . $fieldName . " placeholder images", 'deleted');
                         } else {
                             DB::alteration_message("adding " . $className . "." . $fieldName . " placeholder images", 'created');
                             $setSQL = " SET {$bt}" . $fieldName . "{$bt} = " . $image->ID;
                             if (!isset($_GET["forceplaceholder"])) {
                                 $whereSQL = " WHERE {$bt}" . $fieldName . "{$bt} IS NULL OR {$bt}" . $fieldName . "{$bt} = 0";
                             } else {
                                 $whereSQL = '';
                             }
                         }
                         $sql = $updateSQL . $setSQL . $whereSQL;
                         DB::query($sql);
                         $versioningPresent = false;
                         $array = $dataObject->stat('extensions');
                         if (is_array($array) && count($array)) {
                             if (in_array("Versioned('Stage', 'Live')", $array)) {
                                 $versioningPresent = true;
                             }
                         }
                         if ($dataObject->stat('versioning')) {
                             $versioningPresent = true;
                         }
                         if ($versioningPresent) {
                             $sql = str_replace("{$bt}{$className}{$bt}", "{$bt}{$className}_Live{$bt}", $sql);
                             DB::query($sql);
                         }
                     } else {
                         debug::show("could not create image!" . print_r($array));
                     }
                 } else {
                     debug::show("bad classname reference " . $className);
                 }
             }
         }
         if (count($update)) {
             $siteConfig->write();
             DB::alteration_message($siteConfig->ClassName . " created/updated: " . implode(" --- ", $update), 'created');
         }
     } elseif (!$folder) {
         debug::show("COULD NOT CREATE FOLDER: " . self::get_folder_name());
     }
 }