URL $userid = JRequest::getString('picasaUserID'); $feedURL = 'http://picasaweb.google.com/data/feed/api/user/' . $userid . '?alt=rss&kind=album'; @$sxml = simplexml_load_file($feedURL); if (isset($sxml) && $sxml) { foreach ($sxml->channel->item as $entry) { $guid = (string) $entry->guid; $albumID = substr($guid, strrpos($guid, '/') + 1, strrpos($guid, '?') - 1 - strrpos($guid, '/')); $objOption = new stdClass(); $objOption->value = $albumID; $objOption->text = (string) $entry->title; $arrOptions[] = $objOption; } if (count($arrOptions) > 0) { $arrOptions = array_reverse($arrOptions); $objOption = new stdClass(); $objOption->value = 0; $objOption->text = JText::_('MOD_BTSLIDESHOW_PICASA_ALL_ALBUMS'); $arrOptions[] = $objOption; $arrOptions = array_reverse($arrOptions); } } else { $this->result['message'] = 'Unable to find user with email ' . $userid . '@gmail.com'; } } if (count($arrOptions) > 0) { $this->result['success'] = true; $this->result['options'] = $arrOptions; } return json_encode($this->result); } /** * Neu khong phai la lay thong tin bai viet (chi co o admin) */ else if (JRequest::getString('action') != 'get_article') { //kiem tra quyen ghi cua cac thu muc trong thu muc images if ( !is_writable($this->saveDir . '/tmp') || !is_writable($this->saveDir . '/slideshow') || !is_writable($this->saveDir . '/thumbnail') || !is_writable($this->saveDir . '/manager') || !is_writable($this->saveDir . '/original') ) { $this->result['message'] = JText::_('MOD_BTSLIDESHOW_ERROR_SAVE_DIR_NOT_WRITABLE'); $validated = false; return json_encode($this->result); } else { /** * Check login & permission */ $isAdmin = JFactory::getApplication()->isAdmin(); if (!$isAdmin) { $this->result['message'] = JText::_('JERROR_ALERTNOAUTHOR'); $validated = false; return json_encode($this->result); } else { /** * Xu ly danh rieng cho uploadify */ //neu la uploadify if (JRequest::getString('action') == 'uploadify' && !empty($_FILES)) { $validated = true; $file = $_FILES['Filedata']['tmp_name']; $objFile = new stdClass(); $extension = explode('.', $_FILES['Filedata']['name']); $extension = strtolower($extension[count($extension) - 1]); if (in_array($extension, $this->allowedExtensions)) { $basename = substr($_FILES['Filedata']['name'], 0, strrpos($_FILES['Filedata']['name'], '.')); $hashedName = md5($moduleID . '-' . 'upload-' . $basename); $filename = "{$hashedName}.{$extension}"; if (!in_array($filename, $this->items)) { if (!move_uploaded_file($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 = $basename; } } else { $this->result['message'] = JText::_('MOD_BTSLIDESHOW_FILE_EXISTED'); $validated = false; } } else { $this->result['message'] = JText::_('MOD_BTSLIDESHOW_FILE_EXTENSION_INVALID'); $validated = false; } if ($validated) { $this->result["success"] = true; $this->result["files"] = $objFile; } return json_encode($this->result); } else { //lay tham so $feedTitle = true; $getLimit = JRequest::getInt('get_limit', false); /** * Xu ly danh cho get list anh * Neu khong phai la upload file va delete ( tuc la lay danh sach cac file anh co the co) */ if (JRequest::getString('action') == 'get') { //array photo getted $photos = array(); //neu source la joomla folder if (JRequest::getString('jFolderPath')) { //lay tham so jFolderPath $jFolderPath = JRequest::getString('jFolderPath'); //check validated folder if (is_dir($jFolderPath)) { $open = opendir($jFolderPath); $filename = readdir($open); while ($filename !== false) { //check validated file if (filetype($jFolderPath . '/' . $filename) == "file") { $file = $jFolderPath . '/' . $filename; $fileInfo = pathinfo($file); $hashedName = md5($moduleID . '-' . 'jfolder-' . JRequest::getString('jFolderPath') . '-' . $fileInfo['filename']); if ( $file && in_array(strtolower($fileInfo["extension"]), $this->allowedExtensions) && !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) ? $fileInfo['filename'] : ''; $objFile->source = 'jfolder-' . JRequest::getString('jFolderPath'); $photos[] = $objFile; } } $filename = readdir($open); } closedir($open); } else { $this->result['message'] = JText::_('MOD_BTSLIDESHOW_ERROR_DIRECTORY'); $validated = false;