main_dir = $this->admin_puzzles; $this->puzzle_name = $puzzle_name; $this->difficulty = $difficulty; $this->full_path = $this->main_dir."/".$this->puzzle_name."/".$difficulty."/"; $this->realPic = $this->main_dir."/".$this->puzzle_name."/picture.jpg"; } # Function for loading puzzle function load() { if(file_exists($this->realPic)) { if(!is_dir($this->full_path)) { mkdir($this->full_path); } } else { return 0; } $file_array = glob($this->full_path."*.jpg"); if(count($file_array) < ($this->difficulty-1)) { if(is_file($this->realPic)) { // There is a picture not not that generated sequence yet, so yeah lets do it require("puzzleGenerator.inc.php"); $fapa = $this->full_path; $geneRator = new puzzleGenerator($this->realPic, $this->difficulty, $fapa); $geneRator->image2pieces(); if($geneRator != true) { return 0; } else { $file_array = glob($this->full_path."*.jpg"); } } elseif(!is_dir($this->full_path)) { return 0; } } $files = array(); foreach($file_array as $key => $file) { $file = basename($file); $name = basename($file,".jpg"); $files[$name] = $this->full_path.$file; } return $files; } # Function to make up piece HTML function code2html($s_array) { if(!is_array($s_array)) return 0; $counter = 0; $output = "\n