<?php
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die();
jimport('joomla.application.component.model');
/**
* Hello Hello Model
*
* @package Joomla.Tutorials
* @subpackage Components
*/
class MessagesModelMessage extends JModel
{
/**
* Constructor that retrieves the ID from the request
*
* @access public
* @return void
*/
function __construct()
{
parent::__construct();
}
function getMessageLimit(){
if(is_file(JPATH_COMPONENT_ADMINISTRATOR.DS."conf.txt")){
$file = file(JPATH_COMPONENT_ADMINISTRATOR.DS."conf.txt");
return intval($file[0]);
}else{
return 0;
}
}
function store()
{
$data = JRequest::get( 'post' );
$msglmt = intval($data["messageLimit"]);
$conf = $msglmt;
if(is_file(JPATH_COMPONENT_ADMINISTRATOR.DS."conf.txt")){
unlink(JPATH_COMPONENT_ADMINISTRATOR.DS."conf.txt");
}
$file = fopen(JPATH_COMPONENT_ADMINISTRATOR.DS."conf.txt", "a");
fwrite($file, $conf);
fclose($file);
return true;
}
}
?>