3 Commits 5e87f15563 ... 30a2ec16ab

Auteur SHA1 Bericht Datum
  cedric 30a2ec16ab new test file 11 maanden geleden
  cedric bfc8d21de0 add create folder img 11 maanden geleden
  cedric 44453620c7 add static fonction 11 maanden geleden
3 gewijzigde bestanden met toevoegingen van 39 en 2 verwijderingen
  1. 4 1
      classes/chcreaimages.php
  2. 1 1
      classes/chcreapost.php
  3. 34 0
      tests/test.php

+ 4 - 1
classes/chcreaimages.php

@@ -130,11 +130,14 @@ class Chcreaimages extends ObjectModel
 
 	public function getPath($dir=null)
 	{
+		if( !file_exists(chcrea_img_dir)) {
+			mkdir(chcrea_img_dir);
+		}
 		if($dir == null) {
 			$dir = chcrea_img_dir.$this->id_chcreaposts.'/';
 			if ( !file_exists($dir) ) {
 				$oldmask = umask(000);
-				mkdir($dir                                                                                                                                                                                                                    );
+				mkdir($dir);
 				chmod($dir, 0775);
 				umask($oldmask);
 			}

+ 1 - 1
classes/chcreapost.php

@@ -527,7 +527,7 @@ class Chcreapost extends ObjectModel
 	 * 
 	 * @return [type]
 	 */
-	protected function getViewedProducts($productIds)
+	protected static function getViewedProducts($productIds)
 	{
 		if (!empty($productIds)) {
 			$context = Context::getContext();

+ 34 - 0
tests/test.php

@@ -0,0 +1,34 @@
+<?php
+
+
+include(dirname(__FILE__).'/../../../config/config.inc.php');
+
+$context->controller = new stdClass();
+$context->controller->controller_type = ['test'];
+
+require_once(dirname(__FILE__) . '/../classes/chcreaimages.php');
+
+$id_post  = 1;
+/*
+if (!file_exists(chcrea_img_dir)) {
+    print(chcrea_img_dir." exist\n");
+} else {
+    print(chcrea_img_dir." non\n");
+}
+
+$path = chcrea_img_dir.$id_post.'/';
+print($path);
+
+mkdir($path);
+
+print("\n");
+*/
+$obj = new Chcreaimages();
+$obj->id_chcreaposts = $id_post;
+
+print($obj->getPath());
+
+
+
+
+