) { $objFile = new stdClass(); $objFile->file = str_replace('http://', '', $file); $objFile->title = ($feedTitle) ? (string) $entry->title : ''; $objFile->source = 'picasa-' . (string) $sxml->channel->title; $photos[] = $objFile; } } } } } //neu source la phoca if (JRequest::getString('phoca_catid') !== '') { require_once JPATH_ROOT . '/modules/mod_btslideshow_pro/helpers/helper.php'; $helper = new BTSlideshowHelper(); if (!$helper->checkPhocaComponent()) { $this->result["message"] = JText::_('MOD_BTSLIDESHOW_COM_PHOCA_NOT_EXIST'); } else { $rs = $helper->getPhocaPhotos(JRequest::getString('phoca_catid')); if (count($rs) > 0) { foreach ($rs as $photo) { $file = JPATH_ROOT . "/images/phocagallery/" . $photo->filename; $fileInfo = pathinfo($file); $hashedName = md5($moduleID . '-' . 'phoca-' . $photo->cat_name . '-' . $fileInfo['filename']); if ( $file && !JFile::exists($this->saveDir . "/tmp/original/{$hashedName}.{$fileInfo["extension"]}") && !in_array($hashedName . '.' . $fileInfo["extension"], $this->items) ) { $objFile = new stdClass(); $objFile->file = str_replace('http://', '', $file); $objFile->title = ($feedTitle) ? $photo->title : ''; $objFile->source = 'phoca-' . $photo->cat_name; $photos[] = $objFile; } } } } }//end of phoca //if source is joom gallery if (JRequest::getString('jgallery_catid') !== '') { require_once JPATH_ROOT . '/modules/mod_btslideshow_pro/helpers/helper.php'; $helper = new BTSlideshowHelper(); if (!$helper->checkJGalleryComponent()) { $this->result["success"] = false; $this->result["message"] = JText::_('MOD_BTSLIDESHOW_COM_JOOMGALLERY_NOT_EXIST'); } else { $rs = $helper->getJoomGalleryPhotos(JRequest::getString('jgallery_catid')); if (count($rs) > 0) { foreach ($rs as $photo) { $file = JPATH_ROOT . "/images/joomgallery/originals/" . $photo->cat_name . '/' . $photo->filename; $fileInfo = pathinfo($file); $hashedName = md5($moduleID . '-' . 'jgallery-' . $photo->cat_name . '-' . $fileInfo['filename']); if ( $file && !JFile::exists($this->saveDir . "/tmp/original/{$hashedName}.{$fileInfo["extension"]}") && !in_array($hashedName . '.' . $fileInfo["extension"], $this->items) ) { $objFile = new stdClass(); $objFile->file = str_replace('http://', '', $file); $objFile->title = ($feedTitle) ? $photo->title : ''; $objFile->source = 'jgallery-' . $photo->cat_name; $photos[] = $objFile; } } } } }//end of jqallery /** * Xu ly anh source photo a lay ve */ if ($getLimit) { $photos = array_slice($photos, 0, $getLimit); } if (count($photos) > 0) { $this->result['success'] = true; $this->result['files'] = json_encode($photos); } else { if (!isset($this->result['message']) || $this->result['message'] == '') $this->result["message"] = JText::_('MOD_BTSLIDESHOW_ERROR_NO_IMAGE'); } return json_encode($this->result); } else if (JRequest::getString('action') == 'upload' && JRequest::getString('btfile')) { $file = 'http://' . JRequest::getString('btfile'); $source = JRequest::getString('source'); $fileInfo = pathinfo($file); $objFile = new stdClass(); $hashedName = md5($moduleID . '-' . $source . '-' . $fileInfo['filename']); //neu chua co file nay trong thu muc original thi load file do vao trong thu muc tmp if (!JFile::exists($this->saveDir . "/tmp/original/{$hashedName}.{$fileInfo["extension"]}") && !in_array($hashedName . '.' . $fileInfo["extension"], $this->items)) { $filename = "{$hashedName}.{$fileInfo["extension"]}"; if (!copy($file, "{$this->saveDir}/tmp/original/{$filename}")) { $this->result['message'] = JText::_('MOD_BTSLIDESHOW_ERROR_COULD_NOT_SAVE'); $validated = false; } else { BTImageHelper::resize($this->saveDir . "/tmp/original/{$filename}", $this->saveDir . "/tmp/manager/{$filename}", 128, 96); $objFile->filename = $filename; $objFile->title = ($feedTitle && JRequest::getString('title')) ? JRequest::getString('title') : ''; $validated = true; } } else { $this->result['message'] = JText::_('MOD_BTSLIDESHOW_FILE_EXISTED'); $validated = false; } if ($validated) { $this->result['success'] = true; $this->result['files'] = $objFile; } return json_encode($this->result); } else if (JRequest::getString('action') == 'delete') { $file = JRequest::getString('file'); $fileInfo = pathinfo($file); try { JFile::delete($this->saveDir . '/manager/' . $fileInfo['basename']); JFile::delete($this->saveDir . '/original/' . $fileInfo['basename']); JFile::delete($this->saveDir . '/slideshow/' . $fileInfo['basename']); JFile::delete($this->saveDir . '/thumbnail/' . $fileInfo['basename']); JFile::delete($this->saveDir . '/tmp/manager/' . $fileInfo['basename']); JFile::delete($this->saveDir . '/tmp/original/' . $fileInfo['basename']); $this->result['success'] = true; $objFile = new stdClass(); $objFile->filename = $fileInfo['basename']; $this->result["files"] = $objFile; } catch (Exception $ex) { $this->result['message'] = $ex->getMessage(); $validated = false; } return json_encode($this->result); } } } } } else if (JRequest::getString('action')