Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
45eb8d6
Merge pull request #2 from joomla/master
Mathewlenning Sep 18, 2013
2be4e10
Added Single Task Controllers to the CMS Directory
Mathewlenning Apr 25, 2014
9f7a6d3
Removed the cms/model and cms/view directories. I'm going to create
Mathewlenning Apr 25, 2014
8f149bb
Change the class name of cms/controller/update/close.php to fit the
Mathewlenning Apr 25, 2014
a308d43
Updated cms/controller/add.php & cms/controller/edit.php to return the
Mathewlenning Apr 25, 2014
2addb89
Renamed controllers to work with naming convention.
Mathewlenning Apr 26, 2014
bbb3330
slight changes
Mathewlenning Apr 30, 2014
5da5e13
Merge pull request #6 from Mathewlenning/revised
Mathewlenning Apr 30, 2014
83fc12c
Adjusted the alignment on the @subpackage tag
Mathewlenning May 3, 2014
12426a6
Fixed typo in JControllerCreateBase. Thanks Herman
Mathewlenning May 4, 2014
4654fd6
Added the models to the cms dir
Mathewlenning May 4, 2014
ab223dd
Codesniffer changes and refactoring of getModel to remove duplicate c…
Mathewlenning May 5, 2014
486546b
Refactoring task abort redirections
Mathewlenning May 6, 2014
9f5c697
Reformatted to fit Joomla! standards
Mathewlenning May 6, 2014
eb88f74
More reformatted
Mathewlenning May 6, 2014
a734bef
Added JControllerCms::internalRedirect, JControllerCms::mergeModels, …
Mathewlenning May 6, 2014
8a65be7
Renamed JControllerCms::internalRedirect to JControllerCms::executeIn…
Mathewlenning May 6, 2014
00c442f
Added Ajax support for publish & unpublish.
Mathewlenning May 7, 2014
3c9d4e8
Cleaning up the models. Changed JModelData::getTable and createTable …
Mathewlenning May 8, 2014
cfd10cf
Added the views
Mathewlenning May 8, 2014
5176d24
Added the table. This is still extending JTable, but it was written u…
Mathewlenning May 8, 2014
a443c47
Fixed JViewCms::setModel call in JControllerDisplay::execute method
Mathewlenning May 9, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 22 additions & 20 deletions libraries/cms/captcha/captcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class JCaptcha extends JObject
/**
* Captcha Plugin object
*
* @var JPlugin
* @var JPlugin
* @since 2.5
*/
private $_captcha;
Expand All @@ -62,15 +62,15 @@ class JCaptcha extends JObject
/**
* Array of instances of this class.
*
* @var array
* @var array
*/
private static $_instances = array();

/**
* Class constructor.
*
* @param string $captcha The editor to use.
* @param array $options Associative array of options.
* @param string $captcha The editor to use.
* @param array $options Associative array of options.
*
* @since 2.5
*/
Expand All @@ -84,8 +84,8 @@ public function __construct($captcha, $options)
* Returns the global Captcha object, only creating it
* if it doesn't already exist.
*
* @param string $captcha The plugin to use.
* @param array $options Associative array of options.
* @param string $captcha The plugin to use.
* @param array $options Associative array of options.
*
* @return JCaptcha Instance of this class.
*
Expand All @@ -104,6 +104,7 @@ public static function getInstance($captcha, array $options = array())
catch (RuntimeException $e)
{
JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error');

return null;
}
}
Expand All @@ -114,11 +115,11 @@ public static function getInstance($captcha, array $options = array())
/**
* Fire the onInit event to initialise the captcha plug-in.
*
* @param string $id The id of the field.
* @param string $id The id of the field.
*
* @return boolean True on success
*
* @since 2.5
* @since 2.5
*/
public function initialise($id)
{
Expand All @@ -132,6 +133,7 @@ public function initialise($id)
catch (Exception $e)
{
JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error');

return false;
}

Expand All @@ -141,9 +143,9 @@ public function initialise($id)
/**
* Get the HTML for the captcha.
*
* @param string $name The control name.
* @param string $id The id for the control.
* @param string $class Value for the HTML class attribute
* @param string $name The control name.
* @param string $id The id for the control.
* @param string $class Value for the HTML class attribute
*
* @return mixed The return value of the function "onDisplay" of the selected Plugin.
*
Expand Down Expand Up @@ -174,11 +176,11 @@ public function display($name, $id, $class = '')
/**
* Checks if the answer is correct.
*
* @param string $code The answer.
* @param string $code The answer.
*
* @return mixed The return value of the function "onCheckAnswer" of the selected Plugin.
*
* @since 2.5
* @since 2.5
*/
public function checkAnswer($code)
{
Expand All @@ -197,11 +199,11 @@ public function checkAnswer($code)
/**
* Load the Captcha plug-in.
*
* @param array $options Associative array of options.
* @param array $options Associative array of options.
*
* @return void
*
* @since 2.5
* @since 2.5
* @throws RuntimeException
*/
private function _load(array $options = array())
Expand All @@ -224,11 +226,11 @@ private function _load(array $options = array())
{
throw new RuntimeException(JText::sprintf('JLIB_CAPTCHA_ERROR_PLUGIN_NOT_FOUND', $name));
}
$params = new JRegistry($plugin->params);
$params = new JRegistry($plugin->params);
$plugin->params = $params;

// Build captcha plugin classname
$name = 'plgCaptcha' . $this->_name;
$name = 'plgCaptcha' . $this->_name;
$this->_captcha = new $name($this, (array) $plugin, $options);
}

Expand All @@ -247,7 +249,7 @@ public function getState()
/**
* Attach an observer object
*
* @param object $observer An observer object to attach
* @param object $observer An observer object to attach
*
* @return void
*
Expand Down Expand Up @@ -294,7 +296,7 @@ public function attach($observer)
}

$this->_observers[] = $observer;
$methods = array_diff(get_class_methods($observer), get_class_methods('JPlugin'));
$methods = array_diff(get_class_methods($observer), get_class_methods('JPlugin'));
}

$key = key($this->_observers);
Expand All @@ -315,7 +317,7 @@ public function attach($observer)
/**
* Detach an observer object
*
* @param object $observer An observer object to detach.
* @param object $observer An observer object to detach.
*
* @return boolean True if the observer object was detached.
*
Expand Down
47 changes: 47 additions & 0 deletions libraries/cms/controller/add.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php
/**
* @package Joomla.Libraries
* @subpackage Controller
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('JPATH_PLATFORM') or die;

class JControllerAdd extends JControllerDisplay
{
/**
* Instantiate the controller.
*
* @param JInput $input The input object.
* @param JApplicationBase $app The application object.
* @param array $config Configuration
*
* @since 12.1
*/
public function __construct(JInput $input, $app = null, $config = array())
{
$input->set('layout', 'edit');

parent::__construct($input, $app, $config);
}

/**
* @see JControllerDisplay::execute()
*/
public function execute()
{
$model = $this->getModel();
if (!$model->allowAction('core.create'))
{
$msg = $this->translate('JLIB_APPLICATION_ERROR_CREATE_RECORD_NOT_PERMITTED');
$this->abort($msg, 'error');

return false;
}

return parent::execute();
}

}
50 changes: 50 additions & 0 deletions libraries/cms/controller/cancel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php
/**
* @package Joomla.Libraries
* @subpackage Controller
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('JPATH_PLATFORM') or die;

class JControllerCancel extends JControllerCms
{
/**
* (non-PHPdoc)
* @see JController::execute()
*/
public function execute()
{
$config = $this->config;
$url = 'index.php?option=' . $config['option'] . '&task=display.' . $config['subject'];

$model = $this->getModel();
$keyName = $model->getKeyName();

$input = $this->input;
$pk = $input->getInt($keyName, 0);

if ($pk != 0)
{
try
{
$model->checkin($pk);
}
catch (Exception $e)
{
$msg = $e->getMessage();
$this->setRedirect($url, $msg, 'warning');

return false;
}
}

$this->setRedirect($url);

return true;
}


}
59 changes: 59 additions & 0 deletions libraries/cms/controller/checkin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php
/**
* @package Joomla.Libraries
* @subpackage Controller
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('JPATH_PLATFORM') or die;

class JControllerCheckin extends JControllerCms
{
/**
* @see JController::execute()
*/
public function execute()
{
//Check for request forgeries
$this->validateSession();

$model = $this->getModel();

if (!$model->allowAction('core.manage'))
{
$msg = $this->translate('JLIB_APPLICATION_ERROR_CHECKIN_NOT_ALLOWED');
$this->abort($msg, 'error');

return false;
}

$input = $this->input;
$cid = $input->post->get('cid', array(), 'array');
// Make sure the item ids are integers
$cid = $this->cleanCid($cid);

try
{
foreach ($cid AS $pk)
{
$model->checkin($pk);
}
}
catch (Exception $e)
{
$msg = $e->getMessage();
$this->abort($msg, 'warning');

return false;
}

$config = $this->config;
$url = 'index.php?option=' . $config['option'] . '&task=display.' . $config['subject'];
$msg = $this->translate('JLIB_APPLICATION_MSG_CHECKIN_SUCCEEDED');
$this->setRedirect($url, $msg, 'message');

return true;
}
}
Loading