//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
//  GNU General Public License for more details.                             //
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//  ------------------------------------------------------------------------ //
include_once '../../mainfile.php';
include_once '../../header.php';
include_once '../../class/criteria.php';
include_once 'class/yogurt_reltribeuser.php';
include_once 'class/yogurt_tribes.php';
/**
* 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);
    /**
//  ------------------------------------------------------------------------ //
include_once '../../mainfile.php';
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 {
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
//  GNU General Public License for more details.                             //
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//  ------------------------------------------------------------------------ //
include_once '../../mainfile.php';
include_once '../../header.php';
include_once 'class/yogurt_friendpetition.php';
include_once 'class/yogurt_reltribeuser.php';
include_once 'class/yogurt_tribes.php';
/**
* Factories of tribes... testing for zend editor  
*/
$reltribeuser_factory = new Xoopsyogurt_reltribeuserHandler($xoopsDB);
$tribes_factory = new Xoopsyogurt_tribesHandler($xoopsDB);
$tribe_id = intval($_POST['tribe_id']);
$uid = intval($xoopsUser->getVar('uid'));
$criteria_uid = new Criteria('rel_user_uid', $uid);
$criteria_tribe_id = new Criteria('rel_tribe_id', $tribe_id);
$criteria = new CriteriaCompo($criteria_uid);
$criteria->add($criteria_tribe_id);
if ($reltribeuser_factory->getCount($criteria) < 1) {
    $reltribeuser = $reltribeuser_factory->create();
    $reltribeuser->setVar('rel_tribe_id', $tribe_id);
    $reltribeuser->setVar('rel_user_uid', $uid);
    if ($reltribeuser_factory->insert($reltribeuser)) {
        redirect_header('tribes.php', 1, _MD_YOGURT_YOUAREMEMBERNOW);
    } else {
        redirect_header('tribes.php', 1, _MD_YOGURT_NOCACHACA);
//  ------------------------------------------------------------------------ //
/**
 * Xoops header ...
 */
include_once "../../mainfile.php";
include_once "../../header.php";
/**
 * Modules class includes  
 */
include_once "class/yogurt_friendpetition.php";
include_once "class/yogurt_reltribeuser.php";
include_once "class/yogurt_tribes.php";
/**
 * Factories of tribes  
 */
$reltribeuser_factory = new Xoopsyogurt_reltribeuserHandler($xoopsDB);
$tribes_factory = new Xoopsyogurt_tribesHandler($xoopsDB);
$marker = isset($_POST['marker']) ? $_POST['marker'] : 0;
if ($marker == 1) {
    /**
     * Verify Token
     */
    if (!$GLOBALS['xoopsSecurity']->check()) {
        redirect_header($_SERVER['HTTP_REFERER'], 3, _MD_YOGURT_TOKENEXPIRED);
    }
    /**
     * 
     */
    $myts =& MyTextSanitizer::getInstance();
    $tribe_title = $myts->displayTarea($_POST['tribe_title'], 0, 1, 1, 1, 1);
    $tribe_desc = $myts->displayTarea($_POST['tribe_desc'], 0, 1, 1, 1, 1);