Development
How to setup SFTP server (FTP over SSH) in Ubuntu
by Raza on Apr.24, 2013, under Others
In my previous post, i discussed about how to install & configure FTP Server on Ubuntu. In this post, i will discuss about how to setup SFTP server in Ubuntu. First you need to install openssh-server, which can be done using command:
sudo apt-get install openssh-server ssh
You can use the following commands for ssh:
sudo service ssh start # Starts SSH Servier sudo service ssh restart # Restarts SSH Server sudo service ssh stop # Stops SSH Server sudo service ssh status # Gives a short description of the status of the SSH server
First create a backup of the /etc/ssh/sshd_config file and name it as /etc/ssh/sshd_config.bak. When done, open the /etc/ssh/sshd_config file:
sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak sudo vi /etc/ssh/sshd_config
Now edit the file /etc/ssh/sshd_config and add/edit the following lines:
#Subsystem sftp /usr/lib/openssh/sftp-server Subsystem sftp internal-sftp -f AUTH -1 VERBOSE #Uncomment this line if already commented UsePAM yes AllowGroups sftpusers sftp Match Group sftpusers ChrootDirectory %h AllowTCPForwarding no X11Forwarding no ForceCommand internal-sftp
Now lets create the relevant users & groups. First the create user group sftpusers using command:
sudo groupadd sftpusers
Now create a user suppose sftpuser. The commands listed below will create the user, add it to the sftpusers, and update its password
sudo adduser sftpuser sudo usermod -a -G sftpusers sftpuser sudo passwd sftpuser
Now proceed with modifying the permissions of the users home directory to allow for chrooting:
sudo chown root:sftpuser /home/sftpuser sudo chmod 750 /home/sftpuser
Create a directory in which sftpuser is free to put any files in it:
sudo mkdir /home/sftpuser/public sudo chown sftp-user: /home/sftpuser/public sudo chmod 777 /home/sftpuser/public
Should you run in any problems, check Should you run in any problems, check /var/log/syslog and /var/log/auth.log for details. Run ssh or sftp with the -vvv option for debugging messages. For sftp, the option must appear before the host as in sftp -vvv user@host.
How to install FTP Server (ProFTPd) in Ubuntu
by Raza on Apr.22, 2013, under Others
In this post, i will go through the process of installing FTP server in Ubuntu. First, run the following command to install ProFTPd in ubuntu:
sudo apt-get install proftpd
When installing a dialog box like this will be shown. Choose whatever option you feel suits your best needs:

Now open the file /etc/shells through any text editor, and add the following line to the end of the file:
/bin/false
Next step is to create the users and their respective home directories.
sudo mkdir -m 777 /home/ftp sudo useradd ftpuser -p [YOUR_PASSWORD] -d /home/ftp -s /bin/false sudo passwd ftpuser
Now open the proFTPd configuration file /etc/proftpd/proftpd.conf. Normally you only edit a couple of parameters to get the server running, but you can configure the rest based on your own requirements.
ServerName "Ubuntu" DefaultRoot ~
Uncomment the DefaultRoot line in the configuration, if it is already commented. This will jail the users to their home directories.
Now run the following command to restart ProFTPd.
sudo service proftpd restart
Now you have a fully functioning FTP server running on Ubuntu.
Detect Web Browser through Javascript
by Raza on Apr.08, 2013, under Development, Others
<script type="text/javascript">
var browser = navigator.userAgent;
if (/MSIE (\d+\.\d+);/.test(browser)){ //Check for Internet Explorer
document.write("YOU ARE USING INTERNET EXPLORER");
}else if (/Firefox[\/\s](\d+\.\d+)/.test(browser)){ //Check for Firefox
document.write("YOU ARE USING FIREFOX");
}else if (/Chrome[\/\s](\d+\.\d+)/.test(browser)){ //Check for Google chrome
document.write("YOU ARE USING GOOGLE CHROME");
}else if (/Opera[\/\s](\d+\.\d+)/.test(browser)){ //Check for Opera
document.write("YOU ARE USING OPERA");
}else if (browser.toLowerCase().indexOf('safari') > 0){ //Check for Safari
document.write("YOU ARE USING SAFARI");
}
</script>
How to Develop a Template System in Zend Framework Application
by Raza on Jan.31, 2013, under PHP, Zend Framework
In this post, i will show you how to create a template system in a Zend Framework appplication using Zend_Layout & Zend_View. The Zend Framework version being used is 1.12. I would assume that you have created a Zend Framework application that has already layout enabled. The following is the default folder structure of a Zend Framework application:
To implement the template system, we would need to change the folder structure as well. I change layouts & views sub-folders of the applications folder in the following way:
Now we must sure that Zend Framework loads this template & layout structure by default. Open the application/Bootstrap.php file, and insert the following code:
<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
private $_theme = '';
public function __construct($application) {
$this->_theme = 'blue';
parent::__construct($application);
}
protected function _initLayout() {
$options = array(
'layout' => 'layout',
'layoutPath' => APPLICATION_PATH . '/layouts/scripts/' . (!empty($this->_theme) ? $this->_theme : 'default'),
'contentKey' => 'content'
);
$layout = Zend_Layout::startMvc($options);
return $layout;
}
protected function _initView() {
$view = new Zend_View();
$view->doctype('XHTML1_STRICT');
$view->setBasePath(APPLICATION_PATH . '/views/' . (!empty($this->_theme) ? $this->_theme : 'default'));
$view->addHelperPath(APPLICATION_PATH . '/views/helpers');
$view->theme = (!empty($this->_theme) ? $this->_theme : 'default');
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
$viewRenderer->setView($view);
return $view;
}
}
Now we have made the necessary adjustments to the Bootstrap.php file, lets turn our attention to the template configuration. As you can see in the previous screenshot, there is a template.xml for every template folder in the application/views folders. I simply entered in the list of CSS & Javascript files in the specific template folder. Please note this may vary:
<?xml version="1.0" encoding="UTF-8"?>
<template>
<stylesheets>
<stylesheet>layout.css</stylesheet>
<stylesheet>print.css</stylesheet>
<stylesheet>jquery-ui.min.css</stylesheet>
</stylesheets>
<scripts>
<script>jquery.min.js</script>
<script>jquery-ui.min.js</script>
<script>script.js</script>
</scripts>
</template>
Now we need to create a view helper to load the files listed in the template.xml folder. Create a file called LoadTemplate.php in the applications/views/helpers folder, and write the following code:
<?php
class Zend_View_Helper_LoadTemplate extends Zend_View_Helper_Abstract {
public function loadTemplate($template) {
$templateData = new Zend_Config_Xml(APPLICATION_PATH . '/views/' . $template . '/template.xml');
$scripts = $templateData->scripts->toArray();
$stylesheets = $templateData->stylesheets->toArray();
if(is_array($scripts) && !empty($scripts)) {
foreach($scripts as $script)
$this->view->headScript()->appendFile(APPLICATION_PATH . '/views/' . $template . '/js/' . $script);
}
if(is_array($stylesheets) && !empty($stylesheets)) {
foreach($stylesheets as $stylesheet)
$this->view->headLink()->appendStylesheet(APPLICATION_PATH . '/views/' . $template . '/css/' . $stylesheet);
}
}
}
Finally we simply update the layout.phtml files in our desired template folders with the following code:
<?php $this->loadTemplate($this->template); ?> <html> <head> <?php echo $this->headTitle(); echo $this->headScript(); echo $this->headLink(); ?> </head> <body> <?php echo $this->layout()->content; ?> </body> </html>
Thats it. You now have a basic templates system in a Zend Framework application. You can also modify it to your own requirements.
Looking forward to your feedback in the comments
.
How to Renew Self-Signed Certificate in Linux?
by Raza on Jul.05, 2012, under Others
Hi guys,
We can generate self-signed certificate in Linux using OpenSSL. One issue we may encounter is how to renew that certificate. No issues, this can accomplished using OpenSSL.
openssl x509 -x509toreq -signkey private.key -out newcert.csr -in oldcert.pem
where oldcert.pem is the old certificate. When you run the above command, its data will be imported into the certificate newcert.csr using the current private key private.key
How to install LAMP in Ubuntu with SSL
by Raza on Mar.15, 2012, under Others
Hi guys,
In this tutorial, you will know how to install apache, php5 & mysql in ubuntu. You will know how to configure virtual hosts & SSL in ubuntu as well. So lets get started …
Open the terminal using command Ctrl+Alt+T.First run the command sudo apt-get update to update all the packages.
Step 1: Install Apache
To install apache, just run the following command:
sudo apt-get install apache2
The above command will install apache with some default modules, libraries etc. To check whether the installation was successful, just browse to the address http://localhost/. If you see a page like this, then your installation was successful.

Step 2: Install MySQL Server
To install mysql server, run the following command in terminal:
sudo apt-get install mysql-server
The wizard will ask you to set the password of the mysql root user. Just set the password as you desire, and the remaining packages in the installation will be installed as desired.
Step 3: Install PHP (plus phpMyAdmin)
To install php, just run the following command in the terminal:
sudo apt-get install php5 libapache2-mod-php5 php5-mysql phpmyadmin
This will get you a through a wizard to setup phpMyAdmin as well. Just select apache2 as the server. Leave the remaining settings untouched. After the installation is completed, just created a file called info.php in the /var/www folder and put the following code:
<?php phpinfo(); ?>
To configure phpmyadmin, open the file /etc/apache2/apache2.conf and add the following line to the end of the file.
Include /etc/phpmyadmin/apache.conf
Now run the command sudo service apache2 restartto restart the server for the php5 installation changes to take effect.
Step 4: Install & Configure SSL for Apache
To setup HTTPS for apache in ubuntu, we first need to install openssl:
sudo apt-get install openssl
After the installation is done, we need to enable the default apache SSL module by running the command:
sudo a2enmod ssl
Now run the command described in the end of Step 3 to restart apache.
To enable SSL on apache we need to have a security certificate signed from a certified CA authority. But in this post, we are going to generate a self-signed certificate. To do that we need to do the following steps:
- First we need to generate a key for the certificate. This can be done by using the command:
openssl genrsa -des3 -out server.key 1024
The above command will generate a Triple-DES, 1024-bit encrypted SSL key in ASCII text format, which is readable.
- Then we need to generate a CSR (Certificate Signing Request). This can be done by using the command:
openssl req -new -key server.key -out server.csr
The above command creates a request for a signed certificate. It asks for some information which is needed to create the request.
- Now we need to generate our self-signed certificate. This can be done by using the command:
openssl x509 -req -days 730 -in server.csr -signkey server.key -out server.crt
The above command will create a certificate valid for 730 days.
- Now copy the certificate & key file to the following locations:
cp server.crt /etc/ssl/certs/ cp server.key /etc/ssl/private/
- By default there is a default-ssl when apache is installed. Now open the file using command:
sudo nano /etc/apache2/sites-availabe/default-ssl
Now find the following lines(uncomment them if needed), and change the values to the following:
SSLEngine on SSLCertificateFile /etc/ssl/certs/server.crt SSLCertificateKeyFile /etc/ssl/private/server.key
- Now run the following command to enable the default SSL site:
sudo a2ensite default-ssl
- Now restart the server as described in Step 3. This time it will ask you to input the certificate’s key password. Just enter it to restart the server.
- Now browse to https://localhost/ to view it in HTTPS mode.
Now you have a running LAMP stack with SSL enabled. Remember that by default, linux allows only one site to enter in HTTPS mode. Please feel free to comment, if you guys have any questions.
How to implement SSL in Zend Framework?
by Raza on Jun.21, 2011, under Zend Framework
Hi guys!
At work, i was working on an e-commerce application in Zend Framework. I had to implement SSL on login, cart and checkout pages. While searching on the task, i found the following post on stackoverflow.com. This implements SSL on specific urls of your application. I am gonna assume that you have a working zend framework application configured.So, if you want to have SSL enabled for the login page of your application:
First, enter the following code in your ssl.ini file. We will parse it later through the Bootstrap.php file.
ssl.modules.default.require_ssl = true //-> entire module requires SSL ssl.modules.default.Index.require_ssl = true //-> entire controller requires SSL ssl.modules.default.Index.login.require_ssl = true //-> single action requires SSL
Next create a file Ssl.php in library/Application/Controller/Plugin folder. In the file, write the following code:
class Application_Controller_Plugin_Ssl extends Zend_Controller_Plugin_Abstract
{
public function preDispatch ( Zend_Controller_Request_Abstract $request )
{
$shouldSecureUrl = false;
//get the config settings for SSL
$options = new Zend_Config_Ini(APPLICATION_PATH.'/configs/ssl.ini');
$options = $options->ssl;
//if config is empty, exit
if (!is_object($options))
return;
//simpler to use
$options = $options->toArray();
//only use it production environment
if ( APPLICATION_ENV == 'production' )
{
if (
( isset($options['modules'][$request->module]['require_ssl']) && $options['modules'][$request->module]['require_ssl'] ) ||
( isset($options['modules'][$request->module][$request->controller]['require_ssl']) && $options['modules'][$request->module][$request->controller]['require_ssl'] ) ||
( isset($options['modules'][$request->module][$request->controller][$request->action]['require_ssl']) && $options['modules'][$request->module][$request->controller][$request->action]['require_ssl'] )
)
{
$shouldSecureUrl = true;
}
if ( $shouldSecureUrl )
{
$this->_secureUrl($request);
}
}
}
protected function _secureUrl ( Zend_Controller_Request_Abstract $request )
{
$server = $request->getServer();
$hostname = $server['HTTP_HOST'];
if ( ! $request->isSecure() )
{
$url = Zend_Controller_Request_Http::SCHEME_HTTPS . "://" . $hostname .
$request->getPathInfo();
$redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
$redirector->setGoToUrl($url);
$redirector->redirectAndExit();
}
}
}
Now, in the Bootstrap.php file, add a function called _initPlugins() and add the following code:
$frontController = Zend_Controller_Front::getInstance(); $frontController->registerPlugin( new Application_Controller_Plugin_Ssl());
How to Export Categories/Subcategories from x-cart to Magento?
by Raza on Mar.21, 2011, under Magento
Hi guys!
I just started working in magento a few days back. One of the tasks was to import categories data from x-cart to magento. So lets get started:
- First create a file called func.export_magento.php in the folder include/func of the x-cart installation, and write the following code in it.
<?php if ( !defined('XCART_START') ) { header("Location: ../"); die("Access denied"); } function getSubCategoriesCSV($catid,$cattitle) { global $sql_tbl,$config; $strCSV = ''; $newline = "\n"; $categories = func_query("select * from $sql_tbl[categories] where parentid=$catid"); if(sizeof($categories)>0) { foreach($categories as $category) { $ctitle = '/'.$category["category"]; if(getSubCategoriesCSV($category["categoryid"],$cattitle)=='') { $strCSV .= '"default","'.$cattitle.$ctitle.'"'.$newline; } else { $strCSV .= '"default","'.$cattitle.$ctitle.'"'.$newline; $strCSV .= getSubCategoriesCSV($category["categoryid"],$cattitle.$ctitle).$newline; } } } return $strCSV; } ?> - Then create another file called export_magento.php in the admin folder of the x-cart installation. Write the following code in it:
<?php require "./auth.php"; require $xcart_dir."/include/security.php"; require $xcart_dir."/include/categories.php"; x_load("export_magento"); $newline = "\n"; $output = ''; $output .= '"store","categories"'; $output .= "$newline"; $parentCategories = func_query("select * from $sql_tbl[categories] where parentid=0 order by product_count desc;"); foreach($parentCategories as $pcat) { $output .= '"default","'.$pcat["category"].'"'; $output .= $newline; $csvstring = getSubCategoriesCSV($pcat["categoryid"],$pcat["category"]); $output .= $csvstring; $output .= $newline; } @mkdir($xcart_dir.'/export',0777,true); $expfile = $xcart_dir."/export/Categories.csv"; $fp = @fopen($expfile,'w+'); @fwrite($fp,$output); @fclose($fp); if(file_exists($expfile)) { header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename='.basename($expfile)); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . filesize($expfile)); ob_clean(); flush(); readfile($expfile); exit; } $smarty->assign("main","magento"); # Assign the current location line $smarty->assign("location", $location); @include $xcart_dir."/modules/gold_display.php"; func_display("admin/home.tpl",$smarty); ?>The last four lines of code is for theme configuration and is for x-cart 4.1.8 gold. Change it accordingly for your version of x-cart.
- The above code will write the categories data into a CSV file, and will let you download the file.
- Before exporting the data to magento, you should install and configure magento on your system. Here is a guide that i previously wrote on installation in windows with xampp..
- When you have installed magento, login into the backend. Then goto System->Import/Export->Dataflow – Advanced Profiles. Click Add New Profile to add a profile.
- In the Profile Name textbox, write Import Categories. In the Actions XML textarea, write the following code:
<action type="dataflow/convert_adapter_io" method="load"> <var name="type">file</var> <var name="path">var/import</var> <var name="filename"><![CDATA[Categories.csv]]></var> <var name="format"><![CDATA[csv]]></var> </action> <action type="dataflow/convert_parser_csv" method="parse"> <var name="delimiter"><![CDATA[,]]></var> <var name="enclose"><![CDATA["]]></var> <var name="fieldnames">true</var> <var name="store"><![CDATA[0]]></var> <var name="number_of_records">1</var> <var name="decimal_separator"><![CDATA[.]]></var> <var name="adapter">catalog/convert_adapter_category</var> <var name="method">parse</var> </action>.
- Now click Save Profile to save the profile.
- Now upload the file into var/import folder of the magento installation.
- Now a create folder called MyApp in the app/code/local folder of magento installation. Create the following folders in the myappfolder also:
- Catalog/Model/Convert/Adapter/
- Catalog/etc/
- In the Catalog/Model/Convert/Adapter/ folder, create a file Category.php, and write the following code in it.
class MyApp_Catalog_Model_Convert_Adapter_Category extends Mage_Eav_Model_Convert_Adapter_Entity { protected $_categoryCache = array(); protected $_stores; /** * Category display modes */ protected $_displayModes = array( 'PRODUCTS', 'PAGE', 'PRODUCTS_AND_PAGE'); public function parse() { $batchModel = Mage::getSingleton('dataflow/batch'); /* @var $batchModel Mage_Dataflow_Model_Batch */ $batchImportModel = $batchModel->getBatchImportModel(); $importIds = $batchImportModel->getIdCollection(); foreach ($importIds as $importId) { //print '<pre>'.memory_get_usage().'</pre>'; $batchImportModel->load($importId); $importData = $batchImportModel->getBatchData(); $this->saveRow($importData); } } /** * Save category (import) * * @param array $importData * @throws Mage_Core_Exception * @return bool */ public function saveRow(array $importData) { if (empty($importData['store'])) { if (!is_null($this->getBatchParams('store'))) { $store = $this->getStoreById($this->getBatchParams('store')); } else { $message = Mage::helper('catalog')->__('Skip import row, required field "%s" not defined', 'store'); Mage::throwException($message); } } else { $store = $this->getStoreByCode($importData['store']); } if ($store === false) { $message = Mage::helper('catalog')->__('Skip import row, store "%s" field not exists', $importData['store']); Mage::throwException($message); } $rootId = $store->getRootCategoryId(); if (!$rootId) { return array(); } $rootPath = '1/'.$rootId; if (empty($this->_categoryCache[$store->getId()])) { $collection = Mage::getModel('catalog/category')->getCollection() ->setStore($store) ->addAttributeToSelect('name'); $collection->getSelect()->where("path like '".$rootPath."/%'"); foreach ($collection as $cat) { $pathArr = explode('/', $cat->getPath()); $namePath = ''; for ($i=2, $l=sizeof($pathArr); $i<$l; $i++) { $name = $collection->getItemById($pathArr[$i])->getName(); $namePath .= (empty($namePath) ? '' : '/').trim($name); } $cat->setNamePath($namePath); } $cache = array(); foreach ($collection as $cat) { $cache[strtolower($cat->getNamePath())] = $cat; $cat->unsNamePath(); } $this->_categoryCache[$store->getId()] = $cache; } $cache =& $this->_categoryCache[$store->getId()]; $importData['categories'] = preg_replace('#\s*/\s*#', '/', trim($importData['categories'])); if (!empty($cache[$importData['categories']])) { return true; } $path = $rootPath; $namePath = ''; $i = 1; $categories = explode('/', $importData['categories']); foreach ($categories as $catName) { $namePath .= (empty($namePath) ? '' : '/').strtolower($catName); if (empty($cache[$namePath])) { $dispMode = $this->_displayModes[2]; $cat = Mage::getModel('catalog/category') ->setStoreId($store->getId()) ->setPath($path) ->setName($catName) ->setIsActive(1) ->setIsAnchor(1) ->setDisplayMode($dispMode) ->save(); $cache[$namePath] = $cat; } $catId = $cache[$namePath]->getId(); $path .= '/'.$catId; $i++; } return true; } /** * Retrieve store object by code * * @param string $store * @return Mage_Core_Model_Store */ public function getStoreByCode($store) { $this->_initStores(); if (isset($this->_stores[$store])) { return $this->_stores[$store]; } return false; } public function getStoreById($id) { $this->_initStores(); /** * In single store mode all data should be saved as default */ if (Mage::app()->isSingleStoreMode()) { return Mage::app()->getStore(Mage_Catalog_Model_Abstract::DEFAULT_STORE_ID); } if (isset($this->_storesIdCode[$id])) { return $this->getStoreByCode($this->_storesIdCode[$id]); } return false; } /** * Init stores * * @param none * @return void */ protected function _initStores () { if (is_null($this->_stores)) { $this->_stores = Mage::app()->getStores(true, true); foreach ($this->_stores as $code => $store) { $this->_storesIdCode[$store->getId()] = $code; } } } } ?>Also copy this file into app/code/core/Mage/Catalog/Model/Convert/Parser/ folder.
- Create a file config.xml in the MyApp/Catalog/etc/ folder. Write the following code in it:
<?xml version="1.0" encoding="UTF-8"?> <config> <global> <models> <catalog> <rewrite> <convert_adapter_category>MyApp_Catalog_Model_Convert_Adapter_Category</convert_adapter_category> </rewrite> </catalog> </models> </global> </config> - Now create another file MyApp_All.xml in the app/etc/modules folder,and write the following code in it.
<?xml version="1.0"?> <config> <modules> <MyApp_Catalog> <codePool>local</codePool> <active>true</active> </MyApp_Catalog> </modules> </config> - Now goto System->Import/Export->Dataflow – Advanced Profiles. Click on the profile you just created in step 6. Click Run Profile. Now click Run Profile in Popup. This will open a popup window, which will start importing the categories data into magento from the CSV file you downloaded from the x-cart script in step 1 & 2.
- In case of any issues, please dont hestitate to comment…
How to properly automate a MySQL database with triggers and stored procedure
by Raza on Jan.28, 2011, under PHP
Hi guys!
I would like to share with you this great article on implementing stored procedures with triggers …
http://suite101.com/article/mysql-stored-procedures-and-triggers-a71091
Get list of all modules with all controllers and actions in Zend Framework
by Raza on Jan.06, 2011, under Zend Framework
Hi guys!
Finally back after a long time. I have been really busy at work. In one of the projects, i had to get list of modules plus controllers and their respective actions for ACL configuration purposes .. I implemented the said task using action helper and controller plugin in Zend Framework. I am listing the Action helper code here. Also, when done with ACL, i will post that code here as well …
Before getting started, i am going to assume that you have configured Zend Framework installation on your local machine and setup your application through a virtual host.
First, open the Bootstrap.php in your application directory and put the following code:
<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
protected function _initAutoLoad(){
$autoLoader = Zend_Loader_Autoloader::getInstance();
$autoLoader->registerNamespace('Application_');
return $autoLoader;
}
protected function _initActionHelpers() {
Zend_Controller_Action_HelperBroker::addHelper(new Application_Action_Helper_AssetsList());
}
Now do the following:
- Create a folder called Application in your site’s library folder.
- Then create sub-folder called Actionin the Applicationfolder.
- Again create a sub-folder called Helperin the Actionfolder.
- Now a create a file called AssetsList.phpin the plugin folder.
In the AssetsList.php folder, write the following code:
<?php
class Application_Action_Helper_AssetsList extends Zend_Controller_Action_Helper_Abstract {
public function direct() {
}
public function getList() {
$module_dir = $this->getFrontController()->getControllerDirectory();
$resources = array();
foreach($module_dir as $dir=>$dirpath) {
$diritem = new DirectoryIterator($dirpath);
foreach($diritem as $item) {
if($item->isFile()) {
if(strstr($item->getFilename(),'Controller.php')!=FALSE) {
include_once $dirpath.'/'.$item->getFilename();
}
}
}
foreach(get_declared_classes() as $class){
if(is_subclass_of($class, 'Zend_Controller_Action')) {
$functions = array();
foreach(get_class_methods($class) as $method) {
if(strstr($method, 'Action')!=false) {
array_push($functions,substr($method,0,strpos($method,"Action")));
}
}
$c = strtolower(substr($class,0,strpos($class,"Controller")));
$resources[$dir][$c] = $functions;
}
}
}
return $resources;
}
}
To get the list, simply put the following line in any controller action:
$resources = $this->_helper->AssetsList->getList();
Hopefully, this helps out everyone. I will post the dynamic ACL plugin code in coming days when i am finished with it.

