Jump to content

Demonic

Members
  • Posts

    562
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://fpsreviews.com

Profile Information

  • Gender
    Male

Demonic's Achievements

Advanced Member

Advanced Member (4/5)

0

Reputation

  1. any programming language. There was a website that I visited years ago that gave you like problems to solve with a programming language like for example: Write a PHP app that gives you every odd number between 200-300. I just forget the name of the website and wondering if someone remember or currently visits that website.
  2. Yeah, not a fan of Doctrine. Found RapidDataMapper.com looks promising.
  3. I just practically completed what I think is a tiny framework I don't want to create a complete database library or orm library just to work with my framework. Anyone recommend anything?
  4. Will this work, I've never used a subselect before: SELECT * FROM users WHERE user_id NOT IN ( SELECT user_id FROM groups WHERE group_id = 1 )
  5. I find classical music is great, I recommend you try it some time . It's like programming at the library xD quiet, no one to bother you peaceful.
  6. I'm downloading this mega pack of relaxing music and some relaxing classical music to see if it helps me program in a more relaxing way. (Might even help sooth my headache) [it's warez so I can't post it contact me if your interested, just not on the forums PM is fine] Do you listen to relaxing music when you program?
  7. http://leftblank.nl/how-to-redirect-www-to-no-www-or-vice-versa-on-your-website-274.html http://wordpress.org/extend/plugins/no-www/
  8. Not really. $url outputs an array, and if I passed $url, I would have to treat the parameter like an array. Heres my default action: public function _default($test) { echo $test; $this->template->load( array( array( "admin/modules/folio/manage", array('results' => $this->instance->folio_model->get_array()), ), ),"admin"); } If I don't have any actions created for the parameter I provided, it will be come a function parameter. http:// localhost/portfolio/admin/module/folio/test If the function "test" isn't created in the url, that will become the first parameter in the default function _default("test") If there are more url segments it will automatically become the next parameter in the function: http://localhost/portfolio/admin/module/folio/test/test2 _default("test","test2") thats only if I haven't created a function named "test". If I created a function named test: it'll look like: test("test") What I'm trying to figure out is if theres an alternative to "eval" to executing that function with the parameters. Heres what I got so far: /** * Plugin Modules * * This function is used to load built in and user created * modules. Plug and play system for easibility. * * @param string module name * @param string module sub page * @return void */ public function module($module=null,$action=null) { switch( $module ) { case "groups": if( !$this->perms->has("main_admin_groups")) return redirect("admin/no_permissions"); return $this->_module_groups(); break; case "manage": if( !$this->perms->has("main_admin_modules")) return redirect("admin/no_permissions"); return $this->_module_manage(); break; } $perms =& $this->perms; //check if module exists and try loading it $class_name = "module_" . $module; if( $this->module_model->exists($class_name) ) { $file = str_replace("\\","/",APPPATH) . "modules/module_" . $module . EXT; if( file_exists($file)) { require_once $file; if( class_exists($class_name)) { $class = new $class_name; if( !is_null($action) && method_exists($class,$action) && !preg_match("/^_/i",$action)) { //does this action require permissions and does user have them if they do? if( ($this->perms->exists("main_" . $class_name . "_" . $action) && $this->perms->has("main_" . $class_name . "_" . $action)) OR !$this->perms->exists("main_" . $class_name . "_" . $action)) { $url = $this->uri->segment_array(); $rurl = array(); for($x=5;$x<sizeof($url)+1;$x++) $rurl[] = $url[$x]; if( sizeof($rurl) > 0 ) { $params = "'" . implode("','",$rurl) . "'"; return eval("call_user_func(array(\$class,\$action),{$params});"); } else { return call_user_func(array($class,$action)); } //return call_user_func(array($class,$action)); } else { //user has no permissions return $this->error("You have no permissions"); } } else { $action = $this->default_action; //show default action if( method_exists($class,$action)) { if( ($this->perms->exists("main_" . $class_name . $action) && $this->perms->has("main_" . $class_name . $action)) OR !$this->perms->exists("main_" . $class_name . $action)) { $url = $this->uri->segment_array(); $rurl = array(); for($x=4;$x<sizeof($url)+1;$x++) $rurl[] = $url[$x]; if( sizeof($rurl) > 0 ) { $params = "'" . implode("','",$rurl) . "'"; return eval("call_user_func(array(\$class,\$action),{$params});"); } else { return call_user_func(array($class,$action)); } } else { //user has no permissions return $this->error("You have no permissions"); } } else { //return error saying default module does not exists return $this->error("Default Action does not exists!"); } } } else { //warn user module is missing return $this->error("The module class is missing!"); } } } else { return $this->error("Module does not exists!"); } }
  9. Okay, heres the thing, I'm building my semi cms, its used for a majority of my projects just to get me started with a basic of everything I need. Backend wise and what not. It's built off of codeigniter and I'm trying to manipulate a feature that they have in my system. I've created a semi module system which acts just like the controller system codeigniter has, but what I don't have is the extra parameters being passed to my class function. $action = '_default'; //show default action if( method_exists($class,$action)) { if( ($this->perms->exists("main_" . $class_name . $action) && $this->perms->has("main_" . $class_name . $action)) OR !$this->perms->exists("main_" . $class_name . $action)) { $url = $this->uri->segment_array(); return call_user_func(array($class,$action),'test'); } else { //user has no permissions return $this->error("You have no permissions"); } } else { //return error saying default module does not exists return $this->error("Default Action does not exists!"); } Heres a snipet from my code. Above you see $url, that grabs all the urls, Basically I want to pass the results of the urls to the current class function withing using an array, you see how I have "test", thats exactly how I want the parameters to output not: Array().. How can I pass the array (with a foreach) statement to that call_user_func, without "eval"? $params = "'" . implode("','",$url) . "'"; eval("call_user_func(array(\$class,\$action),{$params});"); Is the only way I can see it being done.
  10. IF you can't get allow_url_fopen enabled, use cURL to grab the content them parse it.
  11. Just a note: echo "var randomAnimals=new Array(\"" . implode('"',$myarray) . "\");"; Would output what your expecting.
  12. Yes its possible, just echo the data out like normal.
  13. Since I can't edit my post forgot to mention my db table is something like: CREATE TABLE `groups` ( id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), group_name VARCHAR(255), main_admin_groups INT(11), main_admin_modules INT(11), main_admin_access INT(11), ); After I create my modules, it adds another field named after each action. main_module_modulename_action Then it loads the users permissions to see if they have access to that action, it also checks if that action exists, it none exists anyone can access.
  14. Well before I've read your post, I've constructed something like I had at the end of my previous post. Since I'm using a framework, I've created a CI Library which is called "Permissions". My permissions library has a function like yours which checks if user has role, but my module system is a bit different. Since most of the module stuff is mainly for the ACP, the permission system is actually used just about throughout the acp and not the website. Since the website will have it's own functions, mainly readibility and commenting on news, things like that. (Users wont really need to many permissions, since all the main CORE website management will be ALL located in the acp using a module of some sort) Anyways, I have a built in module and permission column which allows me to install modules. (How does this really tie into what I did? Continue) So when I install a module. It's built like the following: class module_modulename - var instance - used to get code igniters instance so we can use their built in classes, modules will act like controllers in a way - var install - an array variable used to install permissions for each action, actions are sub pages to each module, if we don't assign a action to this variable, it will declare that..that action in perticular will not have any access permissions, any admin can freely access that page. Each function besides "_default" that starts with a "_" is a private function, everything else is a action. So..when you install that module it will add columns in the groups table then you must enable permissions to that group to access them pages. By default there are only 2 modules in acp, "groups" and "manage_modules", used to manage the user groups and modules. What I'm trying to do is make it very light weight: 1. User login 2. User register 3. User logout 4. User forgot password 4. Admin Login 6. Admin Module System - Manage groups, add/edit/delete groups, admin group has default permissions that can't be changed - install/uninstall modules - which creates permissions for the module on its own to be accessed or not and what not. Allowing me to fork the system and be able to create basic sites that require a user system (admin backend) with minimum features. I'll post the code when I'm finished. (Today to show in detail how I did it) and its not bad, because you can install sql on installation with the built in "_install" and "_uninstall" functions that does exactly what it says. Run then functions when installing or uninstall modules. In short, I think I've created everything I needed to create every other project. In 2-3 days with just code igniter.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.