Beispiel #1
0
include_once '../../header.php';
include_once '../../class/criteria.php';
include_once 'class/yogurt_reltribeuser.php';
include_once 'class/yogurt_tribes.php';
$tribe_id = intval($_POST['tribe_id']);
$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);
        }