]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 29 Dec 2010 18:42:53 +0000 (18:42 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 29 Dec 2010 18:42:53 +0000 (18:42 +0000)
inc/ws/Controlleur/class.ws.flash.php
inc/ws/Controlleur/class.ws.url.php
inc/ws/DAO/class.ws.dao.theme.php

index 90e5f6a74db07d3f04081c8b4b16aa1fc4c104eb..37d878f095bc760412f1134a0e708763faa4aa2e 100644 (file)
@@ -47,6 +47,11 @@ class wsFlash extends cubeFlashGateway {
                        }\r
                        $fname = cubeFiles::tidyName($infos['name']);\r
                        $dest = '/' . $this->args['theme_id'] . '/' . $fname;\r
+\r
+                       if (!file_exists(WS_THEMES . '/' . $this->args['theme_id'])) {\r
+                               mkdir(WS_THEMES . '/' . $this->args['theme_id'], 0755, true);\r
+                       }\r
+\r
                        move_uploaded_file($infos['tmp_name'], WS_THEMES . $dest);\r
                        $this->xml->addChild('file', $fname);\r
                        return;\r
index 225b81c8917eabdfe0b2a613a3fde945dee7b045..864be578a364b7cba975f6b3664d74af2b47b940 100644 (file)
@@ -104,7 +104,7 @@ html{height:100%}' . "\n";
                $res .= '</style>';\r
                $res .= '<title>' . __('Edition de la publication') . ' #' . $args[0] . '</title>';\r
                $res .= '</head>';\r
-               $res .= '<body>';\r
+               $res .= '<body onload="this.focus();">';\r
                $res .= self::editComposition($args);\r
                $res .= '</body>';\r
                $res .= '</html>';\r
index a853e2e5a68f93c75671a5ad368df891112c92c3..937a45f46c3c1ff15e6455af5298b7721248349a 100644 (file)
@@ -37,7 +37,7 @@ class wsDAOTheme extends extranetDAO {
                } else {\r
                        $table = 'themes_vue';\r
                }\r
-               $r = $this->con->select('SELECT * FROM '.$table.' WHERE theme_id IN (SELECT theme FROM books WHERE book_id=\'' . $this->con->escape($book_id) . '\') LIMIT 1');\r
+               $r = $this->con->select('SELECT * FROM ' . $table . ' WHERE theme_id IN (SELECT theme FROM books WHERE book_id=\'' . $this->con->escape($book_id) . '\') LIMIT 1');\r
                return $this->singleton($r);\r
        }\r
 \r
@@ -75,8 +75,8 @@ class wsDAOTheme extends extranetDAO {
                }\r
                $c->parametres = serialize($p);\r
                $c->update('WHERE theme_id=\'' . $this->con->escape($data['theme_id']) . '\'');\r
-               if (file_exists(ROOT . '/themes/' . $data['theme_id'] . '.jpg')) {\r
-                       unlink(ROOT . '/themes/' . $data['theme_id'] . '.jpg');\r
+               if (file_exists(WS_THEMES . '/' . $data['theme_id'] . '.jpg')) {\r
+                       unlink(WS_THEMES . '/' . $data['theme_id'] . '.jpg');\r
                }\r
        }\r
 \r
@@ -86,15 +86,13 @@ class wsDAOTheme extends extranetDAO {
                return $r->theme_id + 1;\r
        }\r
 \r
-       public function delete($theme_id)\r
+       public function delete($theme_id, $onlyFiles=false)\r
        {\r
                if (is_null($theme_id) || $theme_id == '') {\r
                        return;\r
                }\r
-               $this->con->execute('DELETE FROM themes WHERE theme_id=\'' . $this->con->escape($theme_id) . '\'');\r
-               if (file_exists(ROOT . '/themes/' . $theme_id)) {\r
-                       files::deltree(ROOT . '/themes/' . $theme_id);\r
-                       unlink(ROOT . '/themes/' . $theme_id . '.jpg');\r
+               if (!$onlyFiles) {\r
+                       $this->con->execute('DELETE FROM themes WHERE theme_id=\'' . $this->con->escape($theme_id) . '\'');\r
                }\r
        }\r
 \r
@@ -121,9 +119,11 @@ class wsDAOTheme extends extranetDAO {
                $c->proprietaire = $proprietaire;\r
                $c->date = TIME;\r
                $c->insert();\r
+\r
+               $this->delete($c->theme_id, true);\r
                // Copie des fichiers\r
-               $from = ROOT . '/themes/' . $theme_id ;\r
-               $to = ROOT . '/themes/' . $c->theme_id;\r
+               $from = WS_THEMES . '/' . $theme_id ;\r
+               $to = WS_THEMES . '/' . $c->theme_id;\r
                $dr = opendir($from);\r
                if (!file_exists($to)) {\r
                        mkdir($to, 0777, true);\r