Server console - 27-10-2010 - Alpha out now! (1 Viewer)

maybeme

Portal Member
December 2, 2007
45
2
Home Country
Belgium Belgium
Re: Server console (again ;))

Why don't you use the 'Adjacency List Model' (first described in your link)?

It's incredible how good your project looks. Maybe I will help you if I can after my exams. I know how to code in PHP, and have to use OO-programming in Java for the courses I follow, so that's no problem either.
 

joz

Portal Pro
March 17, 2008
1,353
306
Home Country
Netherlands Netherlands
Re: Server console (again ;))

What I have now is based upon adjacency list model, the one that uses parentid.

That works ofcourse however the downside of that structure is that CRUD (Create Read (not that complicated) Update Delete) operations can become over complicated from times.
I want to give the user the ability to build up there own menu. So when there's a release it will have default set of items (that work out of the box) but the user can just delete those, move them around, rename them and what not.
This can be done with adjacency and already currently is but the left right structure seems more flexible when it comes to this.
Moving items around is easier (although more resource intensive) as well as adding items etc.

Building up the multi dimensional array within PHP based upon adjacency also tends to get trickier when there are a lot of sublevels.

And maybeme if you got some spare time on your hands feel free to contact me, can use all the help there is.

---EDIT---

thought I might as well drop some kind of changelog here to let you know what I've been working on;

- Refactored models now use a nice way of getting settings per model basis (for filenames of sqlite db's for example)
- Refactored controller base class to handle mobile requests better
- Refactored mobile detection script into a model
- Added PHPSysInfo as a plugin
- Added highslide jquery plugin to the jquery imageflow plugin that's used for the catalog part (readout of AMC, SGC, movingP, tvseries)
- Added MySQL status as a plugin
- Added uTorrent statistics as a plugin
- Added Orb as a plugin
- Added some mobile layouts for a couple of plugins

----EDIT2---

I guess I'll be sticking with adjacency for now. I can not seem to figure this out and it's not that badly needed, just over optimizing things again :)

----EDIT3---
As long as I keep discussing my development issues here with you guys I thought I might as well throw out another one.

A lot of the third party web applications I use in my server console require a login to be accessed. This is a good practice and I do not want to disable any of it however requires loging in when accessing certain parts of the console (like ForTheRecord or utorrent for example). Which means for 4TR access thru server console I need to login to the console (or not when I have set remember me cookie) and then login to 4tr. You can guess were I'm going with this, circumventing the second (in this aspect unneccessary but still vital for security cause 4tr URL is still accessible with a direct URL).

So what I though of doing now since I have not been successfull with this totally yet (I have some half assed stuff going that works kinda). The scenario:

Apache runs on port 80,
ForTheRecord runs on 8080
When accessing it thru the server console I will be using the server as a proxy to itself (although on a different port)
So all requests done for 4TR will go to apache (say on "/4tr/request?org-url=http://fortherecord-original-url-request") which then fires a php script that uses cURL and the get paramater orig-url as the URL to cURL too. Bassically using a proxy call.
This way the first request (the login) will generate a cookie on 8080 (which is useless for port 80). That cookie will be send over and over for the proxy requests (from the server) which then will validate because they are on the same domain (read on the same port)

What do you guys think? This is gonna take some effort to get to go but if it works will be a solution for other problematic logins as well.
 

maybeme

Portal Member
December 2, 2007
45
2
Home Country
Belgium Belgium
Re: Server console (again ;))

I see 2 other possibilities, but I'm not sure if one of them is better than yours.

The one with the least work to do:
Disable login for 4tr, put the 4tr on a port which isn't accesible from the outside, and use curl

The one which is less tricky than yours, is a bit less work probably, but would need adjustments every time a new 4tr gets released:
Adjust 4tr to use your login system.

I've never looked at 4tr code, so I can't say if this would be easy, but I think it's worth to think about it.
 

joz

Portal Pro
March 17, 2008
1,353
306
Home Country
Netherlands Netherlands
Re: Server console (again ;))

Disabling login for 4tr can be done really easily by using the web.config. This crossed my mind.
However 4TR does not stand alone. uTorrent is another one that's problematic, emule I already have a working solution for (that's the easiest one to do with cURL).
So a generic solution would be the most ideal, handy for plugins to come. The MP webservices is another one.

I started this by not mod building the third party apps (except for skinning utorrent webui) to keep it as generic as possible, kinda wanna stick to it as long as I can :)

I wonder if there's something I missed with my proxy idea. It seems possible, I'll be doing some testing tomorrow I hope.
 

maybeme

Portal Member
December 2, 2007
45
2
Home Country
Belgium Belgium
Re: Server console (again ;))

I've been thinking about this last night, and I now wonder why you can't use curl immediately? So that 4tr is running on the same port. Why wouldn't this work?
 

joz

Portal Pro
March 17, 2008
1,353
306
Home Country
Netherlands Netherlands
Re: Server console (again ;))

because it's not running on the same port.
The console runs on apache which I run on port 80.
ForTheRecord runs on IIS (can be run on casini as well) which runs for me on 8080.
I have some script (test stuff) posted here (and already changed) that already does all the screenscraping (getting viewstate and cookie stuff) but does not work because of invalid cookie (domain change, or more correctly port change).
Another option would be running ForTheRecord on apache with the apache module mod_asp_dotnet. Haven't tried that (lot of work and unsure if that will even succeed).
However that same approach cannot be done for utorrent, or well I could if I had the utorrent source and change the webinterface integrated in it, everything is possible.
So the fact remains that different third party apps will have to run on different ports so I was looking for some generic solution.
I have not tested the proxy yet. Kinda busy today, will drop a message on my progress.
 

joz

Portal Pro
March 17, 2008
1,353
306
Home Country
Netherlands Netherlands
Re: Server console (again ;))

And there you have it!
I figured out how to build up the proper array with PHP based upon a correctly formed MySQL nestedset result.
here you have it (credit goes to emil, colleague);
PHP:
        $menu = $this->getSubTree(fetchAll($query));
        return $menu[0]['children'];
    }
    
    private function getSubTree(&$nodes, $prevNodeRgt = false){
        while($node = current($nodes)){ 
            if((!$prevNodeRgt ? $node['rgt'] : $prevNodeRgt) < $node['rgt']) return $tree;

            next($nodes);

            //Has children?   
            if($node['rgt'] - $node['lft'] > 1) $node['children'] = $this->getSubTree($nodes, $node['rgt']);    

            $tree[] = $node;        
        }
        return $tree; 
    }

Some more good news; Lord Alderaan (utorrent forum user) pointed me to one of his own projects that might help me tackle the login stuff faster. Have to wait for his project page being back online though :)
 

joz

Portal Pro
March 17, 2008
1,353
306
Home Country
Netherlands Netherlands
Re: Server console (again ;))

Another little bump on this thread.

I think I'm now @ a stage where people can start applying for testing.
All hardcoded stuff is decoupled and put into the db. However there is no (working) setup script yet (there will be eventually, not a top prio for the time being, every setting can be managed with any mysql db tool) and the part that does the CRUD (Create Read Update Delete) for the menu is not working (was based upon parent_id but since I switched to lft/rgt that does not work anymore).
So far for all the known limitations (I think/hope :)).

So on to the point you guys probably care about most, applying as a tester and how to go about, here's what I had in mind;
1) Apply for testing by PM'ing me
2) When PM'ing please mention the parts you would eventually want to run in your own version of the console (like 4tr, utorrent etc. you can also mention stuff that is not supported yet)
3) For now the first round of testing will only be on apache webserver, IIS will come @ a later stage. IIS will be problematic @ first (as the project is now) but I will try my best to get it running on IIS 5.1 and up
4) As well as the point mentioned above only MySQL (5 and up) is supported as a database currently (and is a prerequisite)
5) Please provide me with some example code you are proud off. Why you ask? Since I do not want to be a helpdesk for people that do not know PHP or MySQL that well. This way I can guesstimate your expertise. It does not need to be lengthy (rather not), just provide something in any language that you think is pretty darn good :)
If you do not want to do so, you could still pm and apply. The changes of not being selected as a tester might get higher though.

The release date of the first alpha will depend on the amount of people applying for testing. Besides siffing thru the submitted example code I will also need to do some more work, for example;
- A developers manual, hopefully covering all aspects (feedback will be welcome too on that aspect)
- Making my code release ready (I use some php shorttags here and there and need to pull out my passwords for db etc.)
- Creating a database as a fresh start (mine is already filled with bunches of stuff that is useless for you guys and also contains sensitive info)

So I hope this first alpha will be reality within the coming 2 weeks (first of february) but since I'm still alone developing this try to be patient.

Oh right forgot to mention the prerequisites again:
- PHP 5 and up with extensions;
* php_fileinfo
* and ofcourse php_mysql
- and optionally (required by some plugins)
* php_sqlite3 (needed for all MP db access)
* php_tidy
* php_sockets
* curl
- MySQL 5 and up (dunno about < 5, this is more of just in case ;))
- Apache, preferably with rights to configure it. For some parts (plugins) this will be needed. More importantly the usage of htaccess must be enabled!
I am running 2.2.14 (latest). Since I am no expert on this (have been reading lots lately) I can not see/say if there will be problems on other versions, I know for certain it will be working with all 2.2 builds
- Microsoft Windows, any kind (although running x64 will make your life a bit harder setting up php etc.). I run on XP SP3 x86 atm
 

joz

Portal Pro
March 17, 2008
1,353
306
Home Country
Netherlands Netherlands
Re: Server console (again ;))

Just had a crash of my server's ssd and I think I lost some of my work in the progress.
The latest backup I ran got somehow corrupted so I'm set about 2 weeks back, bummer.

Also trouble restoring my databases from the filesystem, the most important stuff's recovered already but lost some specifics. At least I can recreate skeletons with some sql files I got lying around.

This might mean I need to push back the deadline a little, will post some more on my progress later.
 

joz

Portal Pro
March 17, 2008
1,353
306
Home Country
Netherlands Netherlands
Re: Server console (again ;))

Starting to work on documentation now, just setup php documentor again and ran it. Still a lot todo :)
here's the output
 

Users who are viewing this thread

Top Bottom