示例#1
0
 /**
  * Get an indirect url to find image through model restrictions.
  *
  * @access	public static
  * @param	string	$view	List model name
  * @param	string	$key	Field name where is stored the filename
  * @param	string	$id	Item id
  * @param	array	$options	File parameters.
  *
  * @return	string	Indirect url
  *
  * @since	Cook 2.6.1
  */
 public static function getIndexedFile($view, $key, $id, $options = null)
 {
     return RtiprintClassFile::getIndexUrl($view, $key, $id, $options);
 }
示例#2
0
 /**
  * Delete the files assiciated to the items
  *
  * @access	public
  * @param	array	$pks	Ids of the items to delete the images
  * @param	array	$fileFields	Images indexes fields of the table where to find the images paths.
  *
  * @return	boolean	True on success
  */
 public function deletefiles($pks, $fileFields)
 {
     if (!count($fileFields) || !count($pks)) {
         return;
     }
     JArrayHelper::toInteger($pks);
     $db = JFactory::getDBO();
     $errors = false;
     $table = $this->getTable();
     //Get all indexes for all fields
     $query = "SELECT " . qn($db, implode(qn($db, ', '), array_keys($fileFields))) . " FROM " . qn($db, $table->getTableName()) . ' WHERE id IN ( ' . implode(', ', $pks) . ' )';
     $db->setQuery($query);
     $files = $db->loadObjectList();
     $config = JComponentHelper::getParams('com_rtiprint');
     foreach ($fileFields as $fieldName => $op) {
         $dir = $config->get('upload_dir_' . $this->view_list . '_' . $fieldName, '[COM_SITE]' . DS . 'files' . DS . $this->view_list . '_' . $fieldName);
         foreach ($files as $fileObj) {
             $imagePath = $fileObj->{$fieldName};
             if (!preg_match("/\\[.+\\]/", $imagePath)) {
                 $imagePath = $dir . DS . $imagePath;
             }
             if (!RtiprintClassFile::deleteFile($imagePath, $op)) {
                 $errors = true;
             }
         }
     }
     return !$errors;
 }
示例#3
0
* @author		MOLEDesign (Morgan Leecy) - http://www.moledesign.biz - morgan@moledesign.biz
* @license		GNU/GPL
*
*             .oooO  Oooo.
*             (   )  (   )
* -------------\ (----) /----------------------------------------------------------- +
*               \_)  (_/
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
if (!defined('DS')) {
    define('DS', DIRECTORY_SEPARATOR);
}
//Copy this line to be able to call the application from outside (Module, Plugin, Third component, ...)
require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_rtiprint' . DS . 'helpers' . DS . 'loader.php';
//Document title
$document = JFactory::getDocument();
$document->titlePrefix = "RT iPrint - ";
$document->titleSuffix = "";
if (defined('JDEBUG') && count($_POST)) {
    $_SESSION['Rtiprint']['$_POST'] = $_POST;
}
$jinput = JFactory::getApplication()->input;
// When this component is called to return a file
// TODO : A better practice is to call it through the View Class
if ($jinput->get('task', null, 'CMD') == 'file') {
    RtiprintClassFile::returnFile('db');
}
$controller = CkJController::getInstance('Rtiprint');
$controller->execute($jinput->get('task', null, 'CMD'));
$controller->redirect();