Example #1
0
 /**
  * Constructor
  *
  * @param 	object 	An optional KConfig object with configuration options
  */
 public function __construct(KConfig $config)
 {
     parent::__construct($config);
     foreach (array('enabled' => true, 'levels' => 3, 'limit' => 0, 'offset' => 0, 'sort' => 'path_sort_ordering') as $key => $val) {
         $this->_request->{$key} = $val;
     }
     //Set model recurse
     //if(KRequest::method() == 'GET') KRequest::set('get.recurse', true);
     //Set other model states
     //KRequest::set('get.enabled', true);
     $this->registerCallback(array('before.read', 'before.browse'), array($this, 'setOrdering'));
     if ($this->isDispatched()) {
         $this->registerCallback('after.read', array($this, 'setCanonical'));
     }
     $cache = JPATH_ROOT . '/cache/com_' . $this->getIdentifier()->package . '/maintenance.txt';
     if (!JFile::exists($cache)) {
         if (KFactory::get('admin::com.ninjaboard.controller.maintenance')->topics() && KFactory::get('admin::com.ninjaboard.controller.maintenance')->forums()) {
             JFile::write($cache, date('r'));
         }
     }
     $user = KFactory::get('lib.joomla.user');
     // User specific maintenance
     if (!$user->guest) {
         $cache = JPATH_ROOT . '/cache/com_' . $this->getIdentifier()->package . '/maintenance.' . $user->id . '.txt';
         if (!JFile::exists($cache)) {
             if (KFactory::get('admin::com.ninjaboard.controller.maintenance')->logtopicreads()) {
                 JFile::write($cache, date('r'));
             }
         }
     }
 }
Example #2
0
 /**
  * Constructor
  *
  * @param 	object 	An optional KConfig object with configuration options
  */
 public function __construct(KConfig $config)
 {
     parent::__construct($config);
     $this->registerCallback('before.read', array($this, 'setMe'));
     $this->registerCallback(array('before.edit', 'before.apply', 'before.save'), array($this, 'checkPermissions'));
     $this->registerCallback(array('before.edit', 'before.apply', 'before.save'), array($this, 'checkAlias'));
     $this->registerCallback(array('after.add', 'after.edit'), array($this, 'setAvatar'));
 }
Example #3
0
 /**
  * Constructor
  *
  * @param 	object 	An optional KConfig object with configuration options
  */
 public function __construct(KConfig $config)
 {
     parent::__construct($config);
     $this->registerActionAlias('apply', 'save');
     //Register validation event
     //@TODO we shouldn't have to attach to the save and apply events. But KControllerView expects 'edit' to succeed.
     //$this->registerCallback(array('before.add', 'before.edit', 'before.save', 'before.apply'), array($this, 'validate'));
     $this->registerCallback('after.browse', array($this, 'setRead'));
 }
Example #4
0
 /**
  * Constructor
  *
  * @param 	object 	An optional KConfig object with configuration options.
  */
 public function __construct(KConfig $config)
 {
     //To prevent these states to be set while browsing after a delete/unwatch
     $config->append(array('request' => array('sort' => 'created_on', 'direction' => 'desc')));
     $config->persistent = false;
     parent::__construct($config);
     $this->registerCallback('before.add', array($this, 'setUser'));
     $this->registerCallback('before.edit', array($this, 'setUser'));
     $this->registerCallback('before.delete', array($this, 'beforeDelete'));
     //Set default redirect
     $this->_redirect = KRequest::referrer();
 }
Example #5
0
 /**
  * Constructor
  *
  * @param 	object 	An optional KConfig object with configuration options
  */
 public function __construct(KConfig $config)
 {
     parent::__construct($config);
     //Delete related event handlers
     $this->registerCallback('before.delete', array($this, 'canDelete'));
     $this->registerCallback('after.delete', array($this, 'cleanupDelete'));
     $this->registerCallback('before.edit', array($this, 'canEdit'));
     $this->registerCallback('after.edit', array($this, 'updateForums'));
     if (!KFactory::get('lib.joomla.user')->guest) {
         $this->registerCallback('after.read', array($this, 'setLog'));
     }
     if ($this->isDispatched()) {
         $this->registerCallback('after.read', array($this, 'setCanonicalAfterRead'));
     }
 }
Example #6
0
 /**
  * Constructor
  *
  * @param 	object 	An optional KConfig object with configuration options
  */
 public function __construct(KConfig $config)
 {
     $config->append(array('request' => array('layout' => 'form')));
     parent::__construct($config);
     //Register validation event
     //@TODO we shouldn't have to attach to the save and apply events. But KControllerView expects 'edit' to succeed.
     $this->registerCallback(array('before.add', 'before.edit', 'before.save', 'before.apply'), array($this, 'validate'));
     $this->registerCallback(array('after.add', 'after.edit'), array($this, 'setNotify'));
     $this->registerCallback(array('after.add', 'after.edit'), array($this, 'setAttachments'));
     $this->registerCallback('after.add', array($this, 'notify'));
     //Delete related event handlers
     $this->registerCallback('before.delete', array($this, 'canDelete'));
     $this->registerCallback('after.delete', array($this, 'cleanupDelete'));
     // Workaround for avoiding 404 status on editor preview ajax
     // @TODO replace MarkItUp with a wysiwyg editor so that ajax previews are no longer necessary.
     $this->registerCallback('after.read', array($this, 'prevent404'));
 }
Example #7
0
 /**
  * Constructor
  *
  * @param 	object 	An optional KConfig object with configuration options
  */
 public function __construct(KConfig $config)
 {
     KRequest::set('get.format', 'file');
     parent::__construct($config);
 }