Monday, 5 October 2015

CakePHP Installation

Installation

CakePHP is simple and easy to install. The minimum requirements are a web server and a copy of CakePHP, that’s it! While this chapter focuses primarily on setting up on Apache (because it’s simple to install and setup), CakePHP will run on a variety of web servers such as nginx, LightHTTPD, or Microsoft IIS.

Requirements

  • HTTP Server. For example: Apache. Having mod_rewrite is preferred, but by no means required.
  • PHP 5.4.16 or greater.
  • mbstring extension
  • intl extension
Note
In both XAMPP and WAMP, the mbstring extension is working by default.
In XAMPP, intl extension is included but you have to uncomment extension=php_intl.dll in php.ini and restart the server through the XAMPP Control Panel.
In WAMP, the intl extension is “activated” by default but not working. To make it work you have to go to php folder (by default) C:\wamp\bin\php\php{version}, copy all the files that looks like icu*.dll and paste them into the apache bin directory C:\wamp\bin\apache\apache{version}\bin. Then restart all services and it should be OK.
While a database engine isn’t required, we imagine that most applications will utilize one. CakePHP supports a variety of database storage engines:
  • MySQL (5.1.10 or greater)
  • PostgreSQL
  • Microsoft SQL Server (2008 or higher)
  • SQLite 3
Note
All built-in drivers require PDO. You should make sure you have the correct PDO extensions installed.

Installing CakePHP

CakePHP uses Composer, a dependency management tool for PHP 5.3+, as the officially supported method for installation.
First, you’ll need to download and install Composer if you haven’t done so already. If you have cURL installed, it’s as easy as running the following:
curl -s https://getcomposer.org/installer | php
Or, you can download composer.phar from the Composer website.
For Windows systems, you can download Composer’s Windows installer here. Further instructions for Composer’s Windows installer can be found within the README here.
Now that you’ve downloaded and installed Composer, you can get a new CakePHP application by running:
php composer.phar create-project --prefer-dist cakephp/app [app_name]
Or if Composer is installed globally:
composer create-project --prefer-dist cakephp/app [app_name]
Once Composer finishes downloading the application skeleton and the core CakePHP library, you should have a functioning CakePHP application installed via Composer. Be sure to keep the composer.json and composer.lock files with the rest of your source code.
You can now visit the path to where you installed your CakePHP application and see the setup traffic lights.
Although composer is the recommended installation method, there are pre-installed downloads available onGithub. Those downloads contain the app skeleton with all vendor packages installed. Also it includes thecomposer.phar so you have everything you need for further use.

Keeping Up To Date with the Latest CakePHP Changes

By default this is what your application composer.json looks like:
"require": {
"cakephp/cakephp": "~3.0"
}
Each time you run php composer.phar update you will receive the latest stable releases when using the default version constraint ~3.0. Only bugfix and minor version releases of 3.x will be used when updating.
If you want to keep current with the latest unreleased changes in CakePHP you can add the change your application’s composer.json:
"require": {
"cakephp/cakephp": "dev-master"
}
Be aware that is not recommended, as your application can break when next major version is being released. Additionally composer does not cache development branches, so it slows down consecutive composer installs/updates.

Permissions

CakePHP uses the tmp directory for a number of different operations. Model descriptions, cached views, and session information are just a few examples. The logs directory is used to write log files by the default FileLogengine.
As such, make sure the directories logstmp and all its subdirectories in your CakePHP installation are writable by the web server user. Composer’s installation process makes tmp and its subfolders globally writeable to get things up and running quickly but you can update the permissions for better security and keep them writable only for the webserver user.
One common issue is that logs and tmp directories and subdirectories must be writable both by the web server and the command line user. On a UNIX system, if your web server user is different from your command line user, you can run the following commands from your application directory just once in your project to ensure that permissions will be setup properly:
HTTPDUSER=`ps aux | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\  -f1`
setfacl -R -m u:${HTTPDUSER}:rwx tmp
setfacl -R -d -m u:${HTTPDUSER}:rwx tmp
setfacl -R -m u:${HTTPDUSER}:rwx logs
setfacl -R -d -m u:${HTTPDUSER}:rwx logs

Development Server

A development installation is the fastest method to setup CakePHP. In this example, we will be using CakePHP’s console to run PHP’s built-in web server which will make your application available at http://host:port. From the app directory, execute:
bin/cake server
By default, without any arguments provided, this will serve your application at http://localhost:8765/.
If you have something conflicting with localhost or port 8765, you can tell the CakePHP console to run the web server on a specific host and/or port utilizing the following arguments:
bin/cake server -H 192.168.13.37 -p 5673
This will serve your application at http://192.168.13.37:5673/.
That’s it! Your CakePHP application is up and running without having to configure a web server.
Warning
The development server should never be used in a production environment. It is only intended as a basic development server.
If you’d prefer to use a real webserver, you should be able to move your CakePHP install (including the hidden files) inside your webserver’s document root. You should then be able to point your web-browser at the directory you moved the files into and see your application in action.

Production

A production installation is a more flexible way to setup CakePHP. Using this method allows an entire domain to act as a single CakePHP application. This example will help you install CakePHP anywhere on your filesystem and make it available at http://www.example.com. Note that this installation may require the rights to change theDocumentRoot on Apache webservers.
After installing your application using one of the methods above into the directory of your choosing - we’ll assume you chose /cake_install - your production setup will look like this on the file system:
/cake_install/
bin/
config/
logs/
plugins/
src/
tests/
tmp/
vendor/
webroot/ (this directory is set as DocumentRoot)
.gitignore
.htaccess
.travis.yml
composer.json
index.php
phpunit.xml.dist
README.md
Developers using Apache should set the DocumentRoot directive for the domain to:
DocumentRoot /cake_install/webroot
If your web server is configured correctly, you should now find your CakePHP application accessible athttp://www.example.com.

Fire It Up

Alright, let’s see CakePHP in action. Depending on which setup you used, you should point your browser tohttp://example.com/ or http://localhost:8765/. At this point, you’ll be presented with CakePHP’s default home, and a message that tells you the status of your current database connection.
Congratulations! You are ready to create your first CakePHP application.

URL Rewriting

Apache

While CakePHP is built to work with mod_rewrite out of the box–and usually does–we’ve noticed that a few users struggle with getting everything to play nicely on their systems.
Here are a few things you might try to get it running correctly. First look at your httpd.conf. (Make sure you are editing the system httpd.conf rather than a user- or site-specific httpd.conf.)
These files can vary between different distributions and Apache versions. You may also take a look athttp://wiki.apache.org/httpd/DistrosDefaultLayout for further information.
  1. Make sure that an .htaccess override is allowed and that AllowOverride is set to All for the correct DocumentRoot. You should see something similar to:
    # Each directory to which Apache has access can be configured with respect
    # to which services and features are allowed and/or disabled in that
    # directory (and its subdirectories).
    #
    # First, we configure the "default" to be a very restrictive set of
    # features.
    <Directory />
    Options FollowSymLinks
    AllowOverride All
    # Order deny,allow
    # Deny from all
    </Directory>
  2. Make sure you are loading mod_rewrite correctly. You should see something like:
    LoadModule rewrite_module libexec/apache2/mod_rewrite.so
    In many systems these will be commented out by default, so you may just need to remove the leading # symbols.
    After you make changes, restart Apache to make sure the settings are active.
    Verify that your .htaccess files are actually in the right directories. Some operating systems treat files that start with ‘.’ as hidden and therefore won’t copy them.
  3. Make sure your copy of CakePHP comes from the downloads section of the site or our Git repository, and has been unpacked correctly, by checking for .htaccess files.
    CakePHP app directory (will be copied to the top directory of your application by bake):
    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule ^$ webroot/ [L]
    RewriteRule (.*) webroot/$1 [L]
    </IfModule>
    CakePHP webroot directory (will be copied to your application’s web root by bake):
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
    </IfModule>
    If your CakePHP site still has problems with mod_rewrite, you might want to try modifying settings for Virtual Hosts. On Ubuntu, edit the file /etc/apache2/sites-available/default (location is distribution-dependent). In this file, ensure that AllowOverride None is changed to AllowOverride All, so you have:
    <Directory />
    Options FollowSymLinks
    AllowOverride All
    </Directory>
    <Directory /var/www>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order Allow,Deny
    Allow from all
    </Directory>
    On Mac OSX, another solution is to use the tool virtualhostx to make a Virtual Host to point to your folder.
    For many hosting services (GoDaddy, 1and1), your web server is actually being served from a user directory that already uses mod_rewrite. If you are installing CakePHP into a user directory (http://example.com/~username/cakephp/), or any other URL structure that already utilizes mod_rewrite, you’ll need to add RewriteBase statements to the .htaccess files CakePHP uses (.htaccess, webroot/.htaccess).
    This can be added to the same section with the RewriteEngine directive, so for example, your webroot .htaccess file would look like:
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /path/to/app
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
    </IfModule>
    The details of those changes will depend on your setup, and can include additional things that are not related to CakePHP. Please refer to Apache’s online documentation for more information.
  4. (Optional) To improve production setup, you should prevent invalid assets from being parsed by CakePHP. Modify your webroot .htaccess to something like:
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /path/to/app/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !^/(webroot/)?(img|css|js)/(.*)$
    RewriteRule ^ index.php [L]
    </IfModule>
    The above will simply prevent incorrect assets from being sent to index.php and instead display your webserver’s 404 page.
    Additionally you can create a matching HTML 404 page, or use the default built-in CakePHP 404 by adding anErrorDocument directive:
    ErrorDocument 404 /404-not-found

nginx

nginx does not make use of .htaccess files like Apache, so it is necessary to create those rewritten URLs in the site-available configuration. This is usually found in /etc/nginx/sites-available/your_virtual_host_conf_file. Depending upon your setup, you will have to modify this, but at the very least, you will need PHP running as a FastCGI instance:
server {
listen 80;
server_name www.example.com;
rewrite ^(.*) http://example.com$1 permanent;
}

server {
listen 80;
server_name example.com;

# root directive should be global
root /var/www/example.com/public/webroot/;
index index.php;

access_log /var/www/example.com/log/access.log;
error_log /var/www/example.com/log/error.log;

location / {
try_files $uri $uri/ /index.php?$args;
}

location ~ \.php$ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
On some servers (Like Ubuntu 14.04) the above configuration won’t work out of the box, and the nginx docs recommend a different approach anyway (http://nginx.org/en/docs/http/converting_rewrite_rules.html). You might try the following (you’ll notice this is also just one server {} block, rather than two, although if you want example.com to resolve to your CakePHP application in addition to www.example.com consult the nginx link above):
server {
listen 80;
server_name www.example.com;
rewrite 301 http://www.example.com$request_uri permanent;

# root directive should be global
root /var/www/example.com/public/webroot/;
index index.php;

access_log /var/www/example.com/log/access.log;
error_log /var/www/example.com/log/error.log;

location / {
try_files $uri /index.php?$args;
}

location ~ \.php$ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}

IIS7 (Windows hosts)

IIS7 does not natively support .htaccess files. While there are add-ons that can add this support, you can also import htaccess rules into IIS to use CakePHP’s native rewrites. To do this, follow these steps:
  1. Use Microsoft’s Web Platform Installer to install the URL Rewrite Module 2.0 or download it directly (32-bit / 64-bit).
  2. Create a new file called web.config in your CakePHP root folder.
  3. Using Notepad or any XML-safe editor, copy the following code into your new web.config file:
    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
    <system.webServer>
    <rewrite>
    <rules>
    <rule name="Exclude direct access to webroot/*"
    stopProcessing="true">
    <match url="^webroot/(.*)$" ignoreCase="false" />
    <action type="None" />
    </rule>
    <rule name="Rewrite routed access to assets(img, css, files, js, favicon)"
    stopProcessing="true">
    <match url="^(img|css|files|js|favicon.ico)(.*)$" />
    <action type="Rewrite" url="webroot/{R:1}{R:2}"
    appendQueryString="false" />
    </rule>
    <rule name="Rewrite requested file/folder to index.php"
    stopProcessing="true">
    <match url="^(.*)$" ignoreCase="false" />
    <action type="Rewrite" url="index.php"
    appendQueryString="true" />
    </rule>
    </rules>
    </rewrite>
    </system.webServer>
    </configuration>
Once the web.config file is created with the correct IIS-friendly rewrite rules, CakePHP’s links, CSS, JavaScipt, and rerouting should work correctly.

I Can’t Use URL Rewriting

If you don’t want or can’t get mod_rewrite (or some other compatible module) up and running on your server, you’ll need to use CakePHP’s built in pretty URLs. In config/app.php, uncomment the line that looks like:
'App' => [
// ...
// 'baseUrl' => env('SCRIPT_NAME'),
]
Also remove these .htaccess files:
/.htaccess
webroot/.htaccess
This will make your URLs look like www.example.com/index.php/controllername/actionname/param rather than www.example.com/controllername/actionname/param.

Tuesday, 18 August 2015

What Is PrestaShop? Ecommerce Features & Reasons To Use

PrestaShop is a free, secure, and open-source e-commerce platform. But what is PrestaShop exactly? We look at PrestaShop's many features.

In short, PrestaShop is a feature-rich, free, secure, and open-source e-commerce platform. We're going to dive into the finer details of exactly 'what is PrestaShop?'.
PrestaShop interest is growing with a new website launched ahead of the soon to be released PrestaShop 1.5 things are looking good. But exactly what is PrestaShop?

PrestaShop is open source

PrestaShop is an Open-source e-commerce solution. This is great news for several reasons.
It means that the software is free to be used, modified, and distributed as you see fit. You can see the finer details in the Open Software License 3.0.
This affects many things, from the ability for you to ** use PrestaShop freely on your next client project, to support given by the PrestaShop community as it is **open, scalable, and constantly being improved.
What is PrestaShop's biggest strength? Probably being open-source, as it is key to the many areas of PrestaShop we are about to look at.

PrestaShop is packed with features

PrestaShop comes packed with over 275 features out-the-box, and features are improving and increasing with every new version.

Key features include

Product Management

  • Unlimited categories, products and attributes
  • Product comparison
  • Quantity / Stock management
  • Multiple images with lightbox
  • Product image zoom
  • Cross-selling / Related products
  • Customer product reviews

Store Management

  • Custom store design with PrestaShop Themes
  • Multiple 'employees' with customised permissions
  • Custom invoices
  • Affiliate programme

SEO

  • 'Friendly' URL structure
  • Google Sitemaps
  • Performance settings for maximum speed
  • Meta tag support on everything

Checkout

  • One page or multi-page checkout
  • Guest checkout
  • Gift messages / wrapping
  • Saved shopping carts

Shipping

  • Shipping fees by weight or price
  • Billing / Shipping addresses
  • Unlimited carriers and destinations to fine-tune your shipping options

Payments

  • Integrates with any payment provider through modules (many included).
  • Tax by country, states and counties
  • Payment gateway filtered by currency

Marketing

  • Automated follow-up emails
  • Coupons and Vouchers
  • Newsletter subscription
  • Loyalty programme
  • Refer-a-friend

Customers

  • Customer groups with custom pricing, shipping settings etc
  • Order tracking
  • Returns management
  • Guest account to full account conversion

Translations / Localisation

  • Available in 41 languages
  • Allow customer to choose language
  • Unlimited currencies with exchange rate sync
  • Geolocation - settings based on your customer's location
  • Address format for customer's country

Security

  • PCI Compliant
  • SSL Support
  • Secure admin
  • Encryption

Analytics / Reporting

  • Track visitors
  • Track orders and sales
  • See best sellers, most viewed products etc
You can see a full list of every feature on the features page of the PrestaShop website ordownload the feature PDF.

PrestaShop Modules

If there's a feature that PrestaShop doesn't come with, the PrestaShop Addons website holdsover 1000 more modules that you can 'plug' into your store to enhance it.
PrestaShop modules could range from supporting a new payment provider, to displaying a fancy slideshow of product images on your home page.
If you're a developer with knowledge of PHP it's straightforward to dive right in and start creating PrestaShop modules of your own for your clients needs.

Lightweight

With so many features you might think things get complicated and slow. This is not the case, asPrestaShop is built to be lightweight and intuitive.
As PrestaShop uses modules for a lot of its features, if there is a certain feature you no longer require it can be disabled, keeping your PrestaShop store simple and agile.

User Documentation

If you're new to PrestaShop and don't know where to start, the PrestaShop website offers User documentation to step you through the process of setting up your store.

PrestaShop is secure

Security is of course a big concern when it comes to running an online store, and PrestaShop is serious about making their software as secure as possible.
PrestaShop supports SSL web hostingpassword and cookie encryption and PCI compliance.
If you're wondering what is PrestaShop's stance on security, you can see the finer details on theirSecurity feature page.

PrestaShop is used worldwide

As mentioned, PrestaShop is now used and trusted in over 100,000 active stores worldwide in over 150 countries.
http://youtu.be/jzsrPHGCefQ
Being available in 41 languages, and supporting unlimited currencies, tax and shipping rules, you can truly use your PrestaShop store to service the world.
You can read about other merchant's success stories or see the great work designers have done using PrestaShop in the showcase.

Multilingual

The 41+ languages are driven by a community effort to translate PrestaShop for use around the globe.
You can download language packs from the PrestaShop website, or if you're a native speaker of a language not listed you can contribute too!

PrestaShop is community driven

A lot of what is PrestaShop's strengths comes down to the fact that it is open-source and community driven.
Features such as the language packs mentioned previously would not be possible if it wasn't for the community contributing to the software.

PrestaShop Forums

As PrestaShop is community driven, the PrestaShop forums are a great resource of information from other users or developers willing to lend a hand.
If you get stuck, you can be sure that there is someone that has previously had the same issue and willing to lend support.
You're not stuck relying on call centres or patchy customer service from companies you actual pay to use.

Bug tracking

You can report bugs and issues you find with the software to PrestaShop Forge, the open bug tracker.
This helps PrestaShop iron out problems as quickly as possible, and also ensures that any problems you may come across on your store are fixed in the next update.

PrestaShop Events

PrestaShop regularly gets together with its community members and partners to talk about developments, whats around the corner, and to answer QA sessions.
http://vimeo.com/22682806
You can find out when the next event will be taking place by visiting the PrestaShop events.

Wordpress Security tips

1. Use secure hosting

Not all web hosting providers are created equal and, in fact, hosting vulnerabilities account for a huge percentage of WordPress sites being hacked.
When choosing a web hosting provider, don’t simply go for the cheapest you can find. Do your research, and make sure you use a well-established company with a good track-record for strong security measures.
It’s always worth paying a bit extra for the peace of mind you get from knowing your site is in safe hands.
2. Update all the things
Every new release of WordPress contains patches and fixes that address real or potential vulnerabilities. If you don’t keep your website updated with the latest version of WordPress, you could be leaving yourself open to attacks.
Many hackers will intentionally target older versions of WordPress with known security issues, so keep an eye on your Dashboard notification area and don’t ignore those ‘Please update now’ messages.

The same applies to themes and plugins. Make sure you update to the latest versions as they are released. If you keep everything up-to-date your site is much less likely to get hacked.

3. Strengthen up those passwords

According to this infographic, around 8% of hacked WordPress websites are down to weak passwords.
If your WordPress administrator password is anything like ‘letmein’, ‘abc123’, or ‘password’ (all way more common than you might think!), you need to change it to something secure as soon as possible.
For a password that’s easy to remember but very hard to crack, I recommend coming up with a good password recipe.
If you’re feeling lazy, you can also use a password manager like LastPass to remember all your passwords for you. If you use this method, make sure your master password is nice and strong.

4. Never use “admin” as your username

Earlier this year, there was a spate of brute-force attacks launched at WordPress websites across the web, consisting of repeated login attempts using the username ‘admin’, combined with a bunch of common passwords.
If you use “admin” as your username, and your password isn’t strong enough (see #3), then your site is very vulnerable to a malicious attack. It’s strongly recommended that you change your username to something less obvious.
Until version 3.0, installing WordPress automatically created a user with “admin” as the username. This was updated in version 3.0 so you can now choose your own username. Many people still use “admin” as it’s become the standard, and it’s easy to remember. Some web hosts also use auto-install scripts that still set up an ‘admin’ username by default.
Fixing this is simply a case of creating a new administrator account for yourself using a different username, logging in as that new user and deleting the original “admin” account.
If you have posts published by the “admin” account, when you delete it, you can assign all the existing posts to your new user account.

5. Hide your username from the author archive URL

Another way an attacker can potentially gain access to your username is via the author archive pages on your site.
By default WordPress displays your username in the URL of your author archive page. e.g. if your username is joebloggs, your author archive page would be something like   http://yoursite.com/author/joebloggs
This is less than ideal, for the same reasons explained above for the “admin” username, so it’s a good idea to hide this by changing the user_nicename entry in your database, as described here.

6. Limit login attempts

In the case of a hacker or a bot attempting a brute-force attack to crack your password, it can be useful to limit the number of failed login attempts from a single IP address.
Limit Login Attempts does just that, allowing you to specify how many retries will be allowed, and how long an IP will be locked out for after too many failed login attempts.
There are ways around this, as some attackers will use a large number of different IP addresses, but it’s still worth doing as an additional precaution.

7. Disable file editing via the dashboard

In a default WordPress installation, you can navigate to Appearance > Editor and edit any of your theme files right in the dashboard.
The trouble is, if a hacker managed to gain access to your admin panel, they could also edit your files that way, and execute whatever code they wanted to.
So it’s a good idea to disable this method of file editing, by adding the following to your wp-config.php file:
define( ‘DISALLOW_FILE_EDIT’, true );

8. Try to avoid free themes

We’re confident in the quality and security of our free themes. As a general rule though, it’s better to avoid using free themes, if possible, especially if they aren’t built by a reputable developer.
The main reason for this is that free themes can often contain things like base64 encoding, which may be used to sneakily insert spam links into your site, or other malicious code that can cause all sorts of problems, as shown in this experiment, where 8 out of 10 sites reviewed offered free themes containing base64 code.
If you really need to use a free theme, you should only use those developed by trusted theme companies, or those available on the official WordPress.org theme repository.
Note: The same logic applies to plugins. Only use plugins that are listed on WordPress.org, or built by a well-established developer.

9. Keep a backup

I can’t overemphasize the importance of making regular backups of your website. This is something that many people put off until it’s too late.
Even with the best security measures at your disposal, you never know when something unexpected could happen that might leave your site open to an attack.
If that happens you want to make sure all of your content is safely backed up, so that you can easily restore your site to its former glory.
The WordPress Codex tells you exactly how to backup your site, and if that seems like too much hard work, you can use a plugin such as WordPress Backup to Dropbox to schedule regular automatic backups.

10. Use security plugins

As well as all of the measures above, there are tons of plugins you can use to tighten your site’s security and reduce the likelihood of being hacked.
Here are a handful of popular options:

Thursday, 14 May 2015

WordPress 4.2.2 Security and Maintenance Release

WordPress 4.2.2 is now available. This is a critical security release for all previous versions and we strongly encourage you to update your sites immediately.
Version 4.2.2 addresses two security issues:
  • The Genericons icon font package, which is used in a number of popular themes and plugins, contained an HTML file vulnerable to a cross-site scripting attack. All affected themes and plugins hosted on WordPress.org (including the Twenty Fifteen default theme) have been updated today by the WordPress security team to address this issue by removing this nonessential file. To help protect other Genericons usage, WordPress 4.2.2 proactively scans the wp-content directory for this HTML file and removes it. Reported by Robert Abela of Netsparker.
  • WordPress versions 4.2 and earlier are affected by a critical cross-site scripting vulnerability, which could enable anonymous users to compromise a site. WordPress 4.2.2 includes a comprehensive fix for this issue. Reported separately by Rice Adu and Tong Shi from Baidu[X-team].
The release also includes hardening for a potential cross-site scripting vulnerability when using the visual editor. This issue was reported by Mahadev Subedi.

Joomla : Features Overview

Joomla is one of the world's most popular software packages used to build, organize, manage and publish content for websites, blogs, Intranets and mobile applications. Owing to its scalable MVC architecture its also a great base to build web applications.
With more than 3 percent of the Web running on Joomla and a CMS market share of more than 9 percent, Joomla! powers the web presence of hundreds of thousands of small businesses, governments, non-profits and large organizations worldwide like Citibank, eBay, Harvard University, Ikea, McDonald's and Sony.
As an award winning CMS led by an international community of more than a half million active contributors, helping the most inexperienced user to seasoned web developer make their digital visions a reality.
Here are some of the Joomla! features you will love.

Multilingual

Joomla is the most popular and widely supported open source multilingual CMS platform in the world, offering more than 64 languages. Webmasters and content creators can create websites to be presented in multiple languages, without ever needing to step outside of the options available in the Joomla! core software. This is a big step forward and represents a set of capabilities that can make websites much more accessible, reaching out to a much larger audience.

Well Supported

Our worldwide, enthusiastic community is filled with individuals, and teams of world class developers and business consultants who actively help at no cost in the forums.
There are thousands of professional Joomla! service providers throughout the world who can help build, maintain and market your Joomla! projects. The Joomla community has a vetted directory of just some of these providers at the Joomla Resource Directory.

Easy Upgrades

One of the big challenges with any software is keeping it up to date. Fortunately, Joomla! has a "One Click Version Update" feature to make this process super easy for users of any skill level.
The built-in updater also has an automated checker which notifies you if anything needs updating; this includes notifications of the core software and Joomla extension that utilise this feature. Keeping your site up to date is the single best thing you can do to secure your web assets and Joomla gives you the tools to do this with little effort.

Integrated Help System

Joomla has an in-app contextual help system to help every level of user to operate their Joomla! Most pages have a help button in the top right, helping you fully understand all options on that page. There is also a glossary explaining the terms in plain English, a version checker makes sure you're using the latest version, a system information tool helps you troubleshoot. If all else fails, links to a wealth of online resources for additional help and support are available, such as Joomla! Documentation and User Forum.

Media Manager

The Media Manager is the tool for easily uploading, organizing and managing your media files and folders. You can even handle more types of files, thanks to the configurable MIME settings. The Media Manager is integrated into the Article Editor so you can access images and all other media files for easy usage and enhancement of your written content.

Banner Management

With the banner manager you have the possibility to easily add advertising and monetize your website. The tool allows you to create clients and campaigns, to add as many banners as you need, even custom codes, to set impression numbers, track the clicks and much more...

Contact Management

Not enough with just one contact form on your site? The contacts component allows you to add several contacts, departments and categories, and extend the basic contact information with miscellaneous information and an image. Easily set up a contact form for each contact you create and allow access to the public or just to some registered users, or create a listing of these contacts.

Search better, Search Smarter

With the built in search and smart search, your website visitors will be able to quickly and easily find the appropriate information on your site. And even more, thanks to the statistics you can analyze your visitors needs and streamline your content even better to serve them. You have the ability to use the included smart indexing, advanced search options, auto suggest searches - making Joomla search the best in class right out of the box.

Content Management

Joomla is a Content management system at heart and has some seriously great features that make organising and managing your content a breeze. Content creation is made very easy by the inbuilt WYSIWYG editor and allows you to edit content without any knowledge of code. After you created your content you'll find a lot of possibilities to show it on the frontend. Next to different layouts, you're able to use several pre installed modules to show the most popular articles, latest items, related articles and more.

Nested categorization

When you are managing content, organisation is a key requirement. Being able to create categories with nesting and no limits on depth is a great plus in helping manage large websites.

Tagging

When categorisation is not enough to structure your content, it's time to look at a flat organisation structure which is best served by tagging. What's more, tagging in Joomla also supports nesting, so limits are just not there!

Frontend Editing

Editing content should be easy and fast. You are reading through your site's content and see a change you need to make. No need to login to the administrative section any more for simple edits of content and modules. Simply click and edit from the frontend.

Content Versioning

You will never again lose a previous important version of your article and other changes on your site. You are now able to track exactly who made what changes, when, and, if a version note was entered, why the item got edited. Then if needed you can revert to any previous version.

Syndication and Newsfeed Management

Make sure your visitors stay updated on the new content you're adding, even when they come only once in a while. With Syndication you create a feed that users subscribe to in their favorite RSS reader and so they receive the updates. With newsfeed management, you can integrate RSS feeds to your site. Gather all posts from some of the largest news sites and show them on your site for example.

Menu Manager

The Menu Manager allows you to create as many menus and menu items as you need. You can structure your menu hierarchy (and nested menu items) completely independent of your content structure. Put one menu in multiple places and in any style you want; use rollovers, dropdown, flyouts and just about any other navigation system you can think of. Also automatic breadcrumbs are generated to help navigate your site users.

Powerful Extensibility

The Joomla core is just the beginning, the real power is in the way you can customize Joomla.More then 8.000 extensions are available to extend your website and broaden it's funcionality. Visit the Joomla Extensions Directory or use the Joomla extension finder built right into Joomla to see thousands of ways to enhance Joomla to suit your needs.

Extensive ACL for all your access control needs

ACL stands for Access Control List , it allows you to manage the users of your site, and different groups. When you're managing large content portals or even intranets that means you need extensive control on who can see what and who can edit or manage what. The Joomla ACL is extremely powerful and can be tweaked via configuration to suit any needs you might have.

For Designers

Design Uncoupled

Joomla was one of the pioneers in open source CMS's by adopting a MVC design strategy. MVC means that views are strictly separate from the business logic. This is a huge advantage since you own the views or can override them to achieve superior custom designs. Joomla not only gives you the design freedom that you have always craved but can help you make your sites stand out in the crowd!

Responsive with Bootstrap

Joomla is Mobile Ready and allows you to build more than just websites but online applications that can respond to virtually any device. Joomla! core templates are built with Bootstrap making it responsive out of the box. Which means you have a toolset to work with which makes creating templates even easier!

Do More with Less

Spend less time coding and reduce the tedious tasks associated with building interfaces in Joomla 3. Joomla now features LESS CSS and jQuery which means you can write less code to achieve greater results. In addition the Icomoon font icon library provides a wealth of retina-optimized icons. The Joomla User Interface (JUI) library gives you a standardized backend & frontend interface.

Override Away!

With a highly advanced override system, designers get an awesome amount of power over how pages & elements of pages are presented without touching any of the core code! Practically any HTML generated by Joomla can be customized to your project.

Beautiful Fonts for that extra edge

Designers know the power of fonts for expressing ideas and design strategies. With Joomla you don not need to get constrained by standard Web fonts. The Joomla core itself opens a whole new world of expression because it allows you the freedom to use Google fonts to make that new design dream come true !

Template Management

Templates in Joomla are more than a framework for managing your designs but a powerful tool suite for making your site look exactly the way you want. You have complete control of your presentation since you can either use a single template for the entire site or a separate template for each site section or menu item. The level of visual control goes a step further with powerful template overrides, allowing you to customize each part of your pages.

For Developers

User Management

Joomla has a registration system that allows users to configure personal options. Out of the box, there are nine user groups with various types of permissions on what users are allowed to access, edit, publish and administer.
Authentication is an important part of user management and Joomla supports multiple protocols, including LDAP, OpenID, and even Gmail. This allows users to use their existing account information to streamline the registration process.
All of this can be added onto with extensions, giving you complete control over what users can access and how they authenticate to your site.

Microdata library implementation

Developers will now be able to incorporate microdata more easily into their extensions and sites. From automating the Author tag in articles, to generating detailed markup for directories of information, the microdata library will significantly enhance how you can optimise SEO with Joomla!

Cloud Storage APIs

A new API in Joomla will allow Joomla to access cloud storage services including Amazon S3, Google Cloud Storage, Rackspace and Dropbox. This allows sites to now use these services as content distribution networks without the need for third party extensions.

System Features

Speedy page loads are possible with page caching, granular-level module caching, and GZIP page compression.
If your system administrator needs to troubleshoot an issue, an extended debugging mode and error reporting are invaluable.
The FTP Layer allows file operations (like installing Extensions) without having to make all the folders and files writable, making your site administrator's life easier and increasing the security of your site.
Administrators quickly and efficiently communicate with users one-on-one through private messaging or all site users via the mass mailing system.

Web Services

In a web where content is being shared across multiple networks, Joomla makes it easy to manage your content from a single location. With APIs supporting several third party services and a connector enabling requests to anywhere on the web, users and developers have a magnitude of power and data readily available to them.

Monday, 4 May 2015

PHP JSON: An Example Javascript JSON Client With PHP Server

While JSON has many uses, probably the most common use is to pass data structures to Javascript. JSON is simply a standard format for data structures.

In this example we'll use a PHP page as a JSON server; we'll use an HTML page with embedded javascript to contact the server, retrieve the data and display it via an alert popup.

A JSON Server in PHP



First, the server. Our server here is very simple, but of course it could easily retrieve data from a database. The data structure that this example sends is also very simple, but JSON can send data structures that are as complex as you like.



<?php

// Prevent caching.
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 01 Jan 1996 00:00:00 GMT');

// The JSON standard MIME header.
header('Content-type: application/json');

// This ID parameter is sent by our javascript client.
$id = $_GET['id'];

// Here's some data that we want to send via JSON.
// We'll include the $id parameter so that we
// can show that it has been passed in correctly.
// You can send whatever data you like.
$data = array("Hello", $id);

// Send the data.
echo json_encode($data);

?>


Let's imagine you run this on your local machine and access it with a URL like this: http://localhost/test.php?id=goodbye

What you get back looks like this:


["Hello","goodbye"]


Here we see some simple data in standard JSON format.

But it's much more interesting to retrieve this data via javascript.

A Simple JSON Javascript Client



The following HTML page implements a simple javascript client that contacts our server, retrieves data via an AJAX call and displays it in an alert popup.

While you could make the AJAX call in pure unvarnished javascript, it's much better to use a standard javascript library to hide browser and platform differences. In the following code we use the industry-standard free jQuery library, which downloads as a single file.



<html>

<head>

<script src="jquery-1.5.2.min.js"></script>

<script language="javascript">

// This just displays the first parameter passed to it
// in an alert.
function show(json) {
alert(json);
}

function run() {
$.getJSON(
"/test.php", // The server URL
{ id: 567 }, // Data you want to pass to the server.
show // The function to call on completion.
);
}

// We'll run the AJAX query when the page loads.
window.onload=run;

</script>

</head>

<body>

JSON Test Page.

</body>

</html>

JSON Example

This example reads JSON data from a web server running PHP and MySQL:

Customers.html

<!DOCTYPE html>
<html>
<body>

<h1>Customers</h1>
<div id="id01"></div>

<script>
var xmlhttp = new XMLHttpRequest();
var url = "http://www.w3schools.com/website/customers_mysql.php";

xmlhttp.onreadystatechange=function() {
    if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
        myFunction(xmlhttp.responseText);
    }
}
xmlhttp.open("GET", url, true);
xmlhttp.send();

function myFunction(response) {
    var arr = JSON.parse(response);
    var i;
    var out = "<table>";

    for(i = 0; i < arr.length; i++) {
        out += "<tr><td>" +
        arr[i].Name +
        "</td><td>" +
        arr[i].City +
        "</td><td>" +
        arr[i].Country +
        "</td></tr>";
    }
    out += "</table>"
    document.getElementById("id01").innerHTML = out;
}
</script>

</body>
</html>



The PHP Code on the Server

This is the PHP code running on the server:
<?php
header("Access-Control-Allow-Origin: *");
header("Content-Type: application/json; charset=UTF-8");

$conn = new mysqli("myServer", "myUser", "myPassword", "Northwind");

$result = $conn->query("SELECT CompanyName, City, Country FROM Customers");

$outp = "[";
while($rs = $result->fetch_array(MYSQLI_ASSOC)) {
    if ($outp != "[") {$outp .= ",";}
    $outp .= '{"Name":"'  . $rs["CompanyName"] . '",';
    $outp .= '"City":"'   . $rs["City"]        . '",';
    $outp .= '"Country":"'. $rs["Country"]     . '"}';
}
$outp .="]";

$conn->close();

echo($outp);
?>

A Styled Version

Customers.html

<!DOCTYPE html>
<html>

<head>
<style>
h1 {
    border-bottom: 3px solid #cc9900;
    color: #996600;
    font-size: 30px;
}
table, th , td {
    border: 1px solid grey;
    border-collapse: collapse;
    padding: 5px;
}
table tr:nth-child(odd) {
    background-color: #f1f1f1;
}
table tr:nth-child(even) {
    background-color: #ffffff;
}
</style>
</head>

<body>

<h1>Customers</h1>
<div id="id01"></div>

<script>
var xmlhttp = new XMLHttpRequest();
var url = "http://www.w3schools.com/website/customers_mysql.php";

xmlhttp.onreadystatechange=function() {
    if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
        myFunction(xmlhttp.responseText);
    }
}
xmlhttp.open("GET", url, true);
xmlhttp.send();

function myFunction(response) {
    var arr = JSON.parse(response);
    var i;
    var out = "<table>";

    for(i = 0; i < arr.length; i++) {
        out += "<tr><td>" +
        arr[i].Name +
        "</td><td>" +
        arr[i].City +
        "</td><td>" +
        arr[i].Country +
        "</td></tr>";
    }
    out += "</table>"
    document.getElementById("id01").innerHTML = out;
}
</script>

</body>
</html>