Current Path : /var/www/html/clients/kampol.e-nk.ru/components/com_blog_calendar/ |
Current File : /var/www/html/clients/kampol.e-nk.ru/components/com_blog_calendar/controller.php |
<?php /** * @version 1.2.2.1 * @package Blog Calendar * @copyright Justo Gonzalez de Rivera * @license GNU/GPL */ // no direct access defined('_JEXEC') or die('Restricted access'); jimport( 'joomla.application.component.controller' ); // Require the base controller class BlogCalendarController extends JController { function editCSS(){ jimport('joomla.filesystem.file'); $content = JFile::read(JPATH_ROOT . DS . 'modules'.DS.'mod_blog_calendar'.DS.'tmpl'.DS.'calstyle.css'); echo ' <form action="index.php" method="post" name="adminForm"> <table class="adminform"> <tr> <th> Editing '.JPATH_ROOT . DS . 'modules'.DS.'mod_blog_calendar'.DS.'tmpl'.DS.'calstyle.css' . ' </th> </tr> <tr> <td> <textarea style="width:80%;height:500px" cols="110" rows="25" name="filecontent" class="inputbox">'. $content. ' </textarea> </td> </tr> </table> <input type=\'hidden\' name=\'task\' value=\'save_css\'> <input type=\'hidden\' name=\'option\' value=\'com_blog_calendar\'> <input type=\'submit\' value=\'Save\'> '; } function saveCSS(){ global $mainframe; // Initialize some variables $filename = JPATH_ROOT; $filename .= '/modules/mod_blog_calendar/tmpl/calstyle.css'; $filecontent = JRequest::getVar('filecontent', '', 'post', 'string', JREQUEST_ALLOWRAW); // Set FTP credentials, if given jimport('joomla.client.helper'); JClientHelper::setCredentialsFromRequest('ftp'); $ftp = JClientHelper::getCredentials('ftp'); $file = $filename; // Try to make the css file writeable if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0755')) { JError::raiseNotice('SOME_ERROR_CODE', 'Could not make the css file writable'); } jimport('joomla.filesystem.file'); $return = JFile::write($file, $filecontent); if($return) echo 'Success saving the file'; // Try to make the css file unwriteable if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0555')) { JError::raiseNotice('SOME_ERROR_CODE', 'Could not make the css file unwritable'); } } function preview(){ } function viewGuide(){ echo '<ul><li>To edit the css file click <a href=\'?option=com_blog_calendar&task=edit_css\'>here</a><br>'; echo '</li><li>For documentation and guides go to <a href=\'http://joomlacode.org/gf/project/blog_calendar/wiki/\'>Blog Calendar wiki</a></li>'; echo '<br><center>Original code of the Blog Calendar by Justo de Rivera, licensed under GPL. Feel free to modify it.</center>'; } } ?>