Magento override

CMS page override / controller override

app\etc\modules\Webalive_Cms.xml



<?xml version="1.0"?><config>
    <modules>
        <Webalive_Wamail>
            <active>true</active>
            <codePool>local</codePool>
        </Webalive_Wamail>
    </modules>
</config>
 
 
app\code\local\Webalive\Cms\etc\config.xml 

<?xml version="1.0"?>
<config>
    <modules>
        <Webalive_Cms>
            <version>1.0.0</version>
        </Webalive_Cms>
    </modules>
    <frontend>
        <routers>
            <cms>
                <args>
                    <modules>
                        <Webalive_Cms before="Mage_Cms_PageController">Webalive_Cms</Webalive_Cms>
                    </modules>
                </args>
            </cms>
        </routers>
    </frontend>
</config>


app\code\local\Webalive\Cms\controllers\PageController.php

<?php
require_once Mage::getModuleDir('controllers', 'Mage_Cms').DS.'PageController.php';

class Webalive_Cms_PageController extends Mage_Cms_PageController
{
    public function indexAction()
    {
        parent::indexAction();
        //to get default functionality

    }

    public function sendwholesaleAction()
    {
        $toEmail = $_POST["email"];
        $toName = $_POST["name"];
        $subject = "Contact - wholesale ";
        $fromEmail = "info@perse.com.au";
        $fromName = "Perse website";
        $type = "text";
        $body = "Hello," .
            "\n\nThis is to inform you that wholesale form at perse.com.au is submitted" .
            "\n\nName: " . $toName .
            "\nPhone/Mobile: " . $_POST["telephone"] .
            "\nMessage: " . $_POST["comment"] .
            "\n\nRegards," .
            "\nperse.com.au";

        $mail = Mage::getModel('core/email');
        $mail->setToEmail("autobillsmtp@webalive.biz");
        $mail->setToName("perse");
        $mail->setBody($body);
        $mail->setSubject($subject);
        $mail->setFromEmail($fromEmail);
        $mail->setFromName($fromName);
        $mail->setType($type);

        try {
            $mail->send();
            Mage::getSingleton('core/session')->addSuccess($this->__('Thank you for your enquiry. We will contact you via email or phone'));
        }
        catch (Exception $e) {
            Mage::getSingleton('core/session')->addError($this->__('Sorry can not complete your enquiry.'));
        }
        $this->_redirect('wholesale');
    }

    public function captcha_ajaxAction()
    {

        require_once(Mage::getBaseDir('lib') . DS . 'reCaptcha' . DS . 'recaptchalib.php');

        $privatekey = "6Lf28ucSAAAAAPx7Tf1ZwG_7omIuFLS4bDDuG6R_";

        $resp = recaptcha_check_answer($privatekey,
            $_SERVER["REMOTE_ADDR"],
            $_POST["recaptcha_challenge_field"],
            $_POST["recaptcha_response_field"]);
        if ($resp->is_valid) {
            echo "success";
        } else {
            die("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
                "(reCAPTCHA said: " . $resp->error . ")");
        }
    }
}
 
access link
magentosite/cms/page/captcha_ajax