2016-03-06 00:50:22 +00:00
|
|
|
<?php
|
|
|
|
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
|
|
|
__ __ _ _____ _ _ __ __ _ _ _
|
|
|
|
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
|
|
|
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
|
|
|
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
|
|
|
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
|
|
|
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
2019-04-04 11:53:29 +00:00
|
|
|
| |
|
|
|
|
|_|
|
2016-03-06 00:50:22 +00:00
|
|
|
/-------------------------------------------------------------------------------------------------------------------------------/
|
|
|
|
|
2019-04-04 11:53:29 +00:00
|
|
|
@version 1.0.10
|
2019-08-14 01:50:35 +00:00
|
|
|
@build 14th August, 2019
|
2016-03-06 00:50:22 +00:00
|
|
|
@created 24th February, 2016
|
|
|
|
@package Support Groups
|
2018-05-05 13:35:10 +00:00
|
|
|
@subpackage ajax.php
|
2019-04-04 11:53:29 +00:00
|
|
|
@author Llewellyn van der Merwe <http://www.vdm.io>
|
2016-03-06 00:50:22 +00:00
|
|
|
@copyright Copyright (C) 2015. All Rights Reserved
|
2019-04-04 11:53:29 +00:00
|
|
|
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
|
|
|
|
|
|
|
Support Groups
|
|
|
|
|
2016-03-06 00:50:22 +00:00
|
|
|
/-----------------------------------------------------------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
// No direct access to this file
|
|
|
|
defined('_JEXEC') or die('Restricted access');
|
|
|
|
|
2018-05-05 13:35:10 +00:00
|
|
|
/**
|
|
|
|
* Supportgroups Ajax Model
|
|
|
|
*/
|
|
|
|
class SupportgroupsModelAjax extends JModelList
|
2016-03-06 00:50:22 +00:00
|
|
|
{
|
2018-05-05 13:35:10 +00:00
|
|
|
protected $app_params;
|
|
|
|
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
// get params
|
|
|
|
$this->app_params = JComponentHelper::getParams('com_supportgroups');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// Used in support_group
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check and if a vdm notice is new (per/user)
|
|
|
|
**/
|
|
|
|
public function isNew($notice)
|
2016-03-06 00:50:22 +00:00
|
|
|
{
|
2018-05-05 13:35:10 +00:00
|
|
|
// first get the file path
|
|
|
|
$path_filename = SupportgroupsHelper::getFilePath('path', 'usernotice', 'md', JFactory::getUser()->username, JPATH_COMPONENT_ADMINISTRATOR);
|
|
|
|
// check if the file is set
|
|
|
|
if (($content = @file_get_contents($path_filename)) !== FALSE)
|
2016-03-06 00:50:22 +00:00
|
|
|
{
|
2018-05-05 13:35:10 +00:00
|
|
|
if ($notice == $content)
|
2016-03-06 00:50:22 +00:00
|
|
|
{
|
2018-05-05 13:35:10 +00:00
|
|
|
return false;
|
2016-03-06 00:50:22 +00:00
|
|
|
}
|
2018-05-05 13:35:10 +00:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
2016-03-06 00:50:22 +00:00
|
|
|
|
2018-05-05 13:35:10 +00:00
|
|
|
/**
|
|
|
|
* set That a notice has been read (per/user)
|
|
|
|
**/
|
|
|
|
public function isRead($notice)
|
|
|
|
{
|
|
|
|
// first get the file path
|
|
|
|
$path_filename = SupportgroupsHelper::getFilePath('path', 'usernotice', 'md', JFactory::getUser()->username, JPATH_COMPONENT_ADMINISTRATOR);
|
|
|
|
// set as read if not already set
|
|
|
|
if (($content = @file_get_contents($path_filename)) !== FALSE)
|
|
|
|
{
|
|
|
|
if ($notice == $content)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $this->saveFile($notice,$path_filename);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function saveFile($data,$path_filename)
|
|
|
|
{
|
|
|
|
if (SupportgroupsHelper::checkString($data))
|
|
|
|
{
|
|
|
|
$fp = fopen($path_filename, 'w');
|
|
|
|
fwrite($fp, $data);
|
|
|
|
fclose($fp);
|
|
|
|
return true;
|
2016-03-06 00:50:22 +00:00
|
|
|
}
|
2018-05-05 13:35:10 +00:00
|
|
|
return false;
|
2016-03-06 00:50:22 +00:00
|
|
|
}
|
|
|
|
}
|