Ejemplo n.º 1
0
* Factories of tribes  
*/
$reltribeuser_factory = new Xoopsyogurt_reltribeuserHandler($xoopsDB);
$tribes_factory = new Xoopsyogurt_tribesHandler($xoopsDB);
$tribe_id = intval($_POST['tribe_id']);
if (!isset($_POST['confirm']) || $_POST['confirm'] != 1) {
    xoops_confirm(array('tribe_id' => $tribe_id, 'confirm' => 1), 'delete_tribe.php', _MD_YOGURT_ASKCONFIRMTRIBEDELETION, _MD_YOGURT_CONFIRMTRIBEDELETION);
} else {
    /**
     * Creating the factory  and the criteria to delete the picture
     * The user must be the owner
     */
    $criteria_tribe_id = new Criteria('tribe_id', $tribe_id);
    $uid = intval($xoopsUser->getVar('uid'));
    $criteria_uid = new Criteria('owner_uid', $uid);
    $criteria = new CriteriaCompo($criteria_tribe_id);
    $criteria->add($criteria_uid);
    /**
     * Try to delete  
     */
    if ($tribes_factory->getCount($criteria) == 1) {
        if ($tribes_factory->deleteAll($criteria)) {
            $criteria_rel_tribe_id = new Criteria('rel_tribe_id', $tribe_id);
            $reltribeuser_factory->deleteAll($criteria_rel_tribe_id);
            redirect_header('tribes.php?uid=' . $uid, 3, _MD_YOGURT_TRIBEDELETED);
        } else {
            redirect_header('tribes.php?uid=' . $uid, 3, _MD_YOGURT_NOCACHACA);
        }
    }
}
include '../../footer.php';
Ejemplo n.º 2
0
$rel_user_uid = intval($_POST['rel_user_uid']);
if ($_POST['confirm'] != 1) {
    xoops_confirm(array('rel_user_uid' => $rel_user_uid, 'tribe_id' => $tribe_id, 'confirm' => 1), 'kickfromtribe.php', _MD_YOGURT_ASKCONFIRMKICKFROMTRIBE, _MD_YOGURT_CONFIRMKICK);
} else {
    /**
     * Creating the factory  and the criteria to delete the picture
     * The user must be the owner
     */
    $reltribeuser_factory = new Xoopsyogurt_reltribeuserHandler($xoopsDB);
    $tribes_factory = new Xoopsyogurt_tribesHandler($xoopsDB);
    $tribe = $tribes_factory->get($tribe_id);
    //	echo "<pre>";
    //	print_r($tribe);
    if ($xoopsUser->getVar('uid') == $tribe->getVar('owner_uid')) {
        $criteria_rel_user_uid = new Criteria('rel_user_uid', $rel_user_uid);
        $criteria_tribe_id = new Criteria('rel_tribe_id', $tribe_id);
        $criteria = new CriteriaCompo($criteria_rel_user_uid);
        $criteria->add($criteria_tribe_id);
        /**
         * Try to delete  
         */
        if ($reltribeuser_factory->deleteAll($criteria)) {
            redirect_header('tribes.php', 2, _MD_YOGURT_TRIBEKICKED);
        } else {
            redirect_header('tribes.php', 2, _MD_YOGURT_NOCACHACA);
        }
    } else {
        redirect_header('tribes.php', 2, _MD_YOGURT_NOCACHACA);
    }
}
include '../../footer.php';