Installing Aauth doesn't work - php

i'm new on CodeIgniter and i try to install Aauth. But the installation Guide is not so clear.
I put the application/libraries/Aauth.php in libraries, application/config/aauth.php in config and application/controller/example.php in controller.
Next I import the sql file in phpmyadmin (with aauth for DB name). After that i put the halpers in helper folder even if it's not mentionned. Same for languages.
And then
You must set up database connections from
application/config/database.php
I tried database' => 'aauth'.
You can also make some changes on application/config/aauth.php"
I don't know what to do? I have never used a framework before.
I created a controller and put $this->load->library("Aauth"); in __construct, and did the tutorial.
Problems are:
Fatal error: Call to undefined method Aauth::deny()
If i dont use the deny function, there is no error but when i look in the DB I only have legolas and no frodo or gandalf. But all perms and groups are there.
If I give "immortality to hobbits", it still say that hobbits do not "immortality".
I work with Xampp and Codeigniter 3 on Windows 10.

You do not have to change anything in your database config file. Just make sure db_profile in the Aauth config matches the name of the database active_group.
As for the Aauth config, for CI3, change use_cookies to false.
To load the library, change the name to lowercase, $this->load->library("aauth");

Related

Run a laravel application

I am absolutely new to laravel. I have an open source laravel application for which I have downloaded the code. I was able to get the home page running using these links:
https://www.rosehosting.com/blog/install-laravel-on-ubuntu-16-04/
https://askubuntu.com/questions/764782/install-laravel-5-on-ubuntu-16-04
http://idroot.net/linux/install-laravel-ubuntu-16-04/
https://www.howtoforge.com/tutorial/install-laravel-on-ubuntu-for-apache/
none of the other webpages are running. I have to manually change the path in the address bar from localhost/public to localhost/public/index.php. Even after this, the webpage that executes, shows no css.If I try to register a user, I get
SQLSTATE[HY000]: General error: 1364 Field 'username' doesn't have a default value
I have referred to the following links in an attempt to solve the issue but no use -
Access denied for user 'root'#'localhost' - Laravel
https://laravel.com/docs/4.2/quick#routing
https://laravel.com/docs/5.1/quickstart#database-migrations
https://laravel.com/docs/5.1/database
I don't have any data in the database as I cannot understand how to import it. My directory structure is
/var/www/laravelApplicaton
-app/
-artisan
-bootstrap/
-composer.json
-composer.lock
-config/
-database/
-gulpfile.js
-package.json
-phpunit.xml
-public/
-readme.md
-resources/
-routes/
-server.php
-storage/
-tests/
-vendor/
I am using ubuntu 16.04 server; Php7.0.
OK, you're using Laravel 5.3 as your folder structure shows. There if you closely look there's no any .env file. Do create that because Laravel first seeks for .env file for configurations if that doesn't exists, then it looks for key value pairs in configuration folder i.e config. So if you have got .env file do change database information there or you can change that from /config/database.php. But the good practice is to use .env file on development machine. It's shown here in this link, the way to create .env file:
https://www.rosehosting.com/blog/install-laravel-on-ubuntu-16-04/
And for "username doesn't have a default value" issue, you have not passed value for "username" while inserting, this problem arises if you have username field that can't be null in your database structure.
The best option to play with Laravel is to use composer. Please follow the laravel 5.3 documentation for installation process.
https://laravel.com/docs/5.3/installation
And for beginner Laracast.com have very nice series to get started with Laravel from scratch, I myself have used this tutorial series to get started with laravel.
https://laracasts.com/series/laravel-5-from-scratch/episodes/1
Do check all those episodes out, once you finish you'll be now very much familiar with Laravel.
Hope this helps you.

Mage::getModel() - getCollection() on non-object on staging server

I've created a custom banner module for Magento and I've tested it locally on my Vagrant/VirtualBox setup running an instance of precise32 and everything is working great.
When I pulled the code from GitHub on to a staging server the extension is not working and I'm getting the following error:
PHP Fatal error: Call to a member function getCollection() on a non-object in /var/colourbox/app/code/local/AffinityCloud/ACBanners/Block/Slider.php on line 7, referer: http://colourbox.affinitycloud.co.uk/tub-storage.html
This is while viewing the home page, so I'm not sure why it's referencing http://colourbox.affinitycloud.co.uk/tub-storage.html as the referer as this is a category page.
I've cleared the cache (is disabled anyway) and reindexed. Stil no joy. I've also tried to rename the model classes using lowercase characters and the first character uppercase with no result.
I've added the module code to GitHub below so you can see the code:
https://github.com/garethdaine/acbanners
Any ideas why this would be working locally and not on the staging server? It's as if it can't find the model classes but has no problem fining the Slider.php class.
I'm at a loss as to what to do here.
NOTE: For brevity, I would like to add that I have logged out and back in to the admin, while also deleting the module tables and the reference in core_resource to no avail. It creates the tables fine but I still get the same issues and the module is showing as enabled in the advanced config.
The problem is case sensitivity.
On windows systems the file names are not case sensitive. On Unix they are case sensitive.
So in the ways you configured the module and named the files, when calling Mage::getModel('acbanners/acbanners') the magento autoloader looks for the file
AffinityCloud/ACBanners/Model/Acbanners.php But the real name of your file is AffinityCloud/ACBanners/Model/ACBanners.php
So the file is not found and the class is not loaded and Mage::getModel(...) returns null.
You have 2 options here.
The cleanest and fastest. rename all your classes in the Model folder to start with a capital letter and the rest should be lowercase. Acbanners.php in the example above. You may need to do the same for the files in Block and Helper.
The long version. If you want to keep the file names you need to change Mage::getModel('acbanners/acbanners') to Mage::getModel('acbanners/aCBanners') or Mage::getModel('acbanners/ACBanners'). but I guess this will take a lot of refactoring. You may also need this for blocks and helpers also.

Cakephp 2.0.4 bake error

I tried bake with Cakephp 2.0.4 stable with 'cake bake' command
But it's giving me below errors...
Unable to set console path for app/Console.
CakePHP is on your `include_path`. CAKE_CORE_INCLUDE_PATH will be set, but commented out.
Unable to set CAKE_CORE_INCLUDE_PATH, you should change it in /home/wmetools/public_html/security/app/Console/myapp/webroot/index.php
Project baked but with some issues..
Your database configuration was not found. Take a moment to create one.
Is there a reason why this is happening?
If you meant to say
CakePHP is not on your include_path
** Code from the webroot/index.php file **
For ease of development CakePHP uses PHP's include_path. If you
cannot modify your include_path set this value.
Setting the include path will get rid of this error. There are two ways to accomplish this:
Edit your php ini file (on wamp this would be WAMPMENU->PHP->php.ini)
Better Description on how to.
or
// THIS METHOD IS NOT RECOMMENDED FOR THIS SITUATION
1. ini_set("include_path", ".:../:./include:../include");
If you do not want to mess with all that, just set the include path manually in the index.php file.

CodeIgniter: "Unable to load the requested class"

On my WAMP box, I did the following:
Added a file called /application/libraries/Foo.php
Foo.php is a class, and it's name is Foo
In /application/config/autoload.php, I added $autoload['libraries'] = array('foo');
Everything works fine. When I upload to my LAMP box, I get the following error:
Unable to load the requested class: foo
Permission of /application/libraries/Foo.php is 0755. Owner is the same as the rest of the CI files. Taking foo out from autoload makes the problem go away.
Any ideas what might be wrong?
In Windows, capitalization in paths doesn't matter. In Linux it does.
When you autoload, use "Foo" not "foo".
I believe that will do the trick.
I think it works when you take it out of autoloading because codeigniter is smart enough to figure out the capitalization in the path and classes are case independent in php.
I had a similar issue when deploying from OSx on my local to my Linux live site.
It ran fine on OSx, but on Linux I was getting:
An Error Was Encountered
Unable to load the requested class: Ckeditor
The problem was that Linux paths are apparently case-sensitive so I had to rename my library files from "ckeditor.php" to "CKEditor.php".
I also changed my load call to match the capitalization:
$this->load->library('CKEditor');
If you're using a linux server for your application then it is necessary to use lowercase file name and class name to avoid this issue.
Ex.
Filename: csvsample.php
class csvsample {
}

Codeigniter: user defined helper function does not load

I made a custom helper extending the system string_helper.php.
I placed it in my /application/helpers directory, called it MY_string_helper.php as required, unit-tested its functions.
Now, when I try to call one of its functions from a model, it does not work.
The functions in the default string helper work, instead. It looks like my extension is not loaded for some reasons.
Thanks a lot, and happy holidays.
Edit: even funnier. I saved the file as categories_helper.php in the system/helpers directory, and when I try to load it within a model i got the following response: *Unable to load the requested file: helpers/categories_helper.php*
I had the same problem. I came from windows OS development of my codeigniter project, then shifted to Ubuntu, but somehow it still didn't load my helpers.
I found that changing the naming convention to lowercase solves the problem. Don't follow what's written in the doc where you are given a prefix to insert, especially if it's in uppercase. Make use of lowercase.
The Codeigniter User Guide for helpers describes that helpers are available to controllers and views only. It does not explicitly mention that helper functions work in models.
CodeIgniter does not load Helper Files
by default, so the first step in using
a Helper is to load it. Once loaded,
it becomes globally available in your
controller and views.
Linux is case sensitive, Windows no. So, if you are development in OS Windows, before upload your system in a Linux hosting foe example, you need have the names of the files in lowcase.
For example:
In Windows: application/helpers/MY_functions_helpers.php
In Linux: application/helpers/my_functions_helpers.php
mmm, i'm not sure it will work for helpers, but have you tried to load the helper in this way?
$CI = & get_instance();
$CI->load->helper('string');
I faced a similar kind of situation. My development environment was WINDOWS and it worked fine as described in the DOCs i.e. MY_string_helper.php
On the production environment of UNIX, it gave error:
Unable to load the requested file: helpers/my_form_helper.php
Changing the file name to lower case resolved this error BUT the helper was not actually loaded.
After a lot of time waste, by hit and trail it worked [ it is un-documented ]
In the autoload.php, just include the mention the extended helper before the default helper:
$autoload['helper'] = array('my_string', 'string');
Also, the prefix has to capital, it did not work with lower case prefix:
$config['subclass_prefix'] = 'MY_';
you just have to change your helper function name with your prefix like found in application/config/config.php
after helper renamed make sure it contains small letters only
then change autoload file with the function name that you renamed,
main problem because of OS like your Hosting server is linux and you develope with windows so this problem rise

Categories