II currently have a multisite drupal working well, except for one problem: only one of the sites is mine, and i don't necessarily want anyone else to be able to access squirrel mail or phpmyadmin unless they have logged into my site.
In other words, I would like to make certain directories on my filesystem only available to users who have authenticated with a specific drupal site/domain.
On a similar note, I have some small php web apps i've designed myself. Similarly, I can give everyone on the server access to these sites, but I only want myself to have it.
Because these are simple programs my goals are a bit more ambitious. I would like to actually integrate these into my drupal site, ideally in the "main" content blocks of a given page.
What I had in mind was modifying my simple app so its a function, require it from inside the block, and call it. It will then spit out a form. The second part, which I am less sure about, is how I'm gonna pick up the $_POST variable on a different drupal node.
I'm sure these issues are easily overcome, I don't really need a detailed description, just maybe a nudge in the right direction. I'm finding relevant docs tough to come by.
Thanks In Advance,
FG
Comments
Solved
I spent so much time learning the 'drupal multisite' paradigm that I forgot to mention that I knew I could obviously just change the apache configuration to facilitate restricting 3rd party applications, e.g. squirrel mail, to specific domains.
So I just set up the virtual hosting via apache, and symlink around in /var/www/domain-that-needs-squirrelmail,com (that's my new drupal root dir, it's now installed once per domain, but ive been assured that's OK and not uncommon).
Sadly, realizing there was no way to do what I wanted with the default multisite configuration took some time, but (surprisingly) not as much as configuring apache correctly , so I'm just now embarking on the second part of my question.
Speaking of that, I've also been assured that integrating my simple preexisting php scripts into my drupal sites will be easy, and works just like I think it would, so I'm going to proceed with that today and get back to you guys.
For the record, changing the drupal setup from the recommended multisite configuration to the apache vhosts setup was simple once I got the hang of apache vhosts. It went something like this:
You can now navigate to your website, and if you have almost nothing changed from the default site it will work fine.
If you changed the default theme, you may see a very broken page with just the html from the main content block, and no menus. Don't worry this was easy to fix (for me anyway).
Step1: Fire up IRC client, go to #drupal-support, and ask someone with a working drupal to tell you the URL for the admin/build/themes part of the GUI. That page will already load with the correct theme and all your menus.
(Alternatively, you can just know that it is admin/build/themes, assuming clean urls arent broken for you. remember to 'AllowOverrides All' in Apache config or it will ignore your local .htaccess)
This was not tested with any 3rd party modules at all.
I've just set up this sever, and minimal work has been done on the sites, but that's what worked for me. Hope that helps someone down the road.
PART II: Integrating my php scripts into drupal
If you've actually read my last two posts, you know I promised an update for bringing my simple scripts into drupal. Originally, I wanted to do it as an update to my last POST, but after having done it, I think this experience deserves its own mention.
What I've been doing is taking my existing code, encapsulating what I should call the "main" or "root level" code in a function, and calling it from a drupal block like:
require_once('MyScript.php'); MyMainFunction();The fist app made some API calls to a busy remote server, queries a slow remote db and then a not-so-slow remote DB, and prints some info about what it discovered.
In order to make the wait for all of this more tolerable, I used to flush() the buffer after each call or query. Well, I discovered the drupal theming engine loads after the html/php in the blocks, so those flush()es really messed up the node. I'm sure there is a very good reason for this, so until I find a better solution i'm doing an if (arg[1]==3){Function();}
The second app A LOT is more of a mystery.
In a sense, it is even simpler, it just reads a table from that not-so-slow- remote DB, and prints the tables to the screen. I actually have two of these scripts for two dissimilar tables. Mysteriously, a few lines into both programs, a function which will return a value as expected when called outside of a drupal will return NULL from a drupal node.
This is totally incomprehensible to me as it is, but to make matters worse, these nearly identical programs will fail at different points
One has a mysql_query() that returns a resource id like it should when its parent function is called outside of a drupal site.
The other mysteriously fails to load its PEAR/Template_ITX template, only a few lines down relative to its 'sister script'.
I've tried to ask this question in the IRC channel, with no luck, so I'm hoping that if I dedicate its own drupal.org forum thread, I might get some notice. So, look for me, and this in a new post which should appear in a few minutes. Im usually idle in #drupal-support, so if you hang out in there (same nick) please shoot me a /msg any time.