Adding Joomla scripts
bzr revid: fp@tinyerp.com-987f2d8a79e1644021d6386fb37f5ce27b3102b4
This commit is contained in:
parent
a0ccaaaf78
commit
24ab4c3c28
|
@ -0,0 +1,14 @@
|
|||
<?
|
||||
$port=mysql_connect(":/var/run/mysqld/mysqld.sock","tiny","XXXX");
|
||||
if (! $_GET['module']) {
|
||||
$query = mysql_db_query("tiny_terp", "select c1.cat_id as cat_id,c1.cat_name as name1,c2.cat_name as name2 from jos_mt_cats c1 left join jos_mt_cats c2 on (c1.cat_parent=c2.cat_id) where c1.cat_allow_submission order by c1.cat_parent,c1.ordering");
|
||||
while ($row = mysql_fetch_object($query))
|
||||
echo $row->cat_id."=".$row->name2.'/'.$row->name1."\n";
|
||||
} else {
|
||||
$query = mysql_db_query("tiny_terp", "select link_id from jos_mt_links where cust_7='".addslashes($_GET['module'])."'");
|
||||
if ($row = mysql_fetch_object($query))
|
||||
echo $row->link_id."\n";
|
||||
else
|
||||
echo "0\n";
|
||||
}
|
||||
?>
|
|
@ -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{
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
Loading…
Reference in New Issue