summaryrefslogtreecommitdiff
path: root/addons/base_module_publish/scripts/mtree_upload.php
diff options
context:
space:
mode:
authorFabien Pinckaers <fp@tinyerp.com>2007-05-08 19:07:53 +0000
committerFabien Pinckaers <fp@tinyerp.com>2007-05-08 19:07:53 +0000
commit24ab4c3c28e3e8a46d13e0dfa429f9cfa3cf12f9 (patch)
tree7ae743d0bbeb89c837652460131bb743d0202caf /addons/base_module_publish/scripts/mtree_upload.php
parenta0ccaaaf78b043787eb62df9c41804c2b9d260f3 (diff)
Adding Joomla scripts
bzr revid: fp@tinyerp.com-987f2d8a79e1644021d6386fb37f5ce27b3102b4
Diffstat (limited to 'addons/base_module_publish/scripts/mtree_upload.php')
-rw-r--r--addons/base_module_publish/scripts/mtree_upload.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/addons/base_module_publish/scripts/mtree_upload.php b/addons/base_module_publish/scripts/mtree_upload.php
new file mode 100644
index 00000000000..6f6d048db41
--- /dev/null
+++ b/addons/base_module_publish/scripts/mtree_upload.php
@@ -0,0 +1,34 @@
+<?
+ function debug($str)
+ {
+ $fp = fopen('/tmp/debug_tinyerp.txt', 'a');
+ fwrite($fp, $str."\n");
+ fclose($fp);
+ }
+
+ // Check module name
+ if (strcmp(substr($_FILES['module']['name'],-4,4),'.zip')) {
+ return '0';
+ }
+
+ $port=mysql_connect(":/var/run/mysqld/mysqld.sock","tiny","XXXX");
+ // Verify user and password
+ $query = mysql_db_query("tiny_terp", "select id,password from jos_users where username='".addslashes($_POST['login'])."' and password=md5('".addslashes($_POST['password'])."')");
+ $user = mysql_fetch_object($query);
+ if (!$user) {
+ return "0";
+ }
+
+ // Verify module owner
+ $query = mysql_db_query("tiny_terp", "select user_id from jos_mt_links where cust_7='".addslashes($_POST['module_name'])."'");
+ $row = mysql_fetch_object($query);
+
+ if ((!$row) or $row[0]==$user[0]) {
+ // save .zip module
+ $dest = '/home/tiny/www/tinyerp.com/download/modules/'.$_FILES['module']['name'];
+ if(move_uploaded_file($_FILES['module']['tmp_name'], $dest)) {
+ } else{
+ }
+
+ }
+?>