예제 #1
0
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//  ------------------------------------------------------------------------ //
/**
 * Xoops header ...
 */
include_once "../../mainfile.php";
$xoopsOption['template_main'] = 'yogurt_index.html';
include_once "../../header.php";
/**
 * Modules class includes  
 */
include_once "class/yogurt_audio.php";
/**
 * Factory of pictures created  
 */
$audio_factory = new Xoopsyogurt_audioHandler($xoopsDB);
$myts =& MyTextSanitizer::getInstance();
/**
 * Getting the title 
 */
$title = $myts->displayTarea($_POST['title'], 0, 1, 1, 1, 1);
$author = $myts->displayTarea($_POST['author'], 0, 1, 1, 1, 1);
/**
 * Getting parameters defined in admin side  
 */
$path_upload = XOOPS_ROOT_PATH . "/uploads/yogurt/mp3/";
$maxfilebytes = $xoopsModuleConfig['maxfilesize'];
/**
 * If we are receiving a file  
 */
if ($_POST['xoops_upload_file'][0] == 'sel_audio') {
예제 #2
0
include_once 'class/yogurt_audio.php';
if (!$GLOBALS['xoopsSecurity']->check()) {
    redirect_header($_SERVER['HTTP_REFERER'], 3, _MD_YOGURT_TOKENEXPIRED);
}
/**
* Receiving info from get parameters  
*/
$cod_audio = $_POST['cod_audio'];
if (!isset($_POST['confirm']) || $_POST['confirm'] != 1) {
    xoops_confirm(array('cod_audio' => $cod_audio, 'confirm' => 1), 'delaudio.php', _MD_YOGURT_ASKCONFIRMAUDIODELETION, _MD_YOGURT_CONFIRMAUDIODELETION);
} else {
    /**
     * Creating the factory  and the criteria to delete the picture
     * The user must be the owner
     */
    $audio_factory = new Xoopsyogurt_audioHandler($xoopsDB);
    $criteria_aud = new Criteria('audio_id', $cod_audio);
    $uid = intval($xoopsUser->getVar('uid'));
    $criteria_uid = new Criteria('uid_owner', $uid);
    $criteria = new CriteriaCompo($criteria_aud);
    $criteria->add($criteria_uid);
    $objects_array = $audio_factory->getObjects($criteria);
    $audio_name = $objects_array[0]->getVar('url');
    /**
     * Try to delete  
     */
    if ($audio_factory->deleteAll($criteria)) {
        unlink(XOOPS_ROOT_PATH . '/uploads/yogurt/mp3/' . $audio_name);
        redirect_header('audio.php', 2, _MD_YOGURT_AUDIODELETED);
    } else {
        redirect_header('audio.php', 2, _MD_YOGURT_NOCACHACA);