// check if the directory is already in use
 $query = "SELECT upload_category_id from " . cms_db_prefix() . "module_uploads_categories WHERE upload_category_path = ?";
 $dbresult = $db->Execute($query, array($params['input_categorypath']));
 if ($dbresult->FetchRow()) {
     $this->smarty->assign('error', "1");
     $this->smarty->assign('message', $this->Lang("error_pathinuse"));
     $error = true;
 } else {
     // Create the directory if it doesn't exist
     $do_scan = false;
     $dir = $this->_categoryPath($params['input_categorypath']);
     if (file_exists($dir)) {
         $do_scan = true;
     } else {
         // create the directory
         $result = cge_dir::mkdirr($dir);
         if ($result === FALSE) {
             $this->smarty->assign('error', "1");
             $this->smarty->assign('message', $this->Lang("error_categoryexists") . ': ' . $dir);
             $error = true;
         }
         // create an index.html file (empty)
         if ($this->GetPreference('create_dummy_index_html')) {
             touch($dir . DIRECTORY_SEPARATOR . "index.html");
         }
     }
     if (!$error) {
         $groups = null;
         if (isset($params['input_grouplist'])) {
             $groups = implode(',', $params['input_grouplist']);
         }