// 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'; $xoopsOption['template_main'] = 'yogurt_index.html'; include_once '../../header.php'; include_once 'class/yogurt_friendpetition.php'; include_once 'class/yogurt_friendship.php'; /** * Factory of petitions created */ $friendpetition_factory = new Xoopsyogurt_friendpetitionHandler($xoopsDB); $friendship_factory = new Xoopsyogurt_friendshipHandler($xoopsDB); $petition_id = intval($_POST['petition_id']); $friendship_level = intval($_POST['level']); $uid = intval($xoopsUser->getVar('uid')); if (!$GLOBALS['xoopsSecurity']->check()) { redirect_header($_SERVER['HTTP_REFERER'], 3, _MD_YOGURT_TOKENEXPIRED); } $criteria = new criteriaCompo(new criteria('friendpet_id', $petition_id)); $criteria->add(new criteria('petioned_uid', $uid)); if ($friendpetition_factory->getCount($criteria) > 0) { if ($friendship_level > 0 && ($petition = $friendpetition_factory->getObjects($criteria))) { $friend1_uid = $petition[0]->getVar('petitioner_uid'); $friend2_uid = $petition[0]->getVar('petioned_uid'); $newfriendship1 = $friendship_factory->create(true); $newfriendship1->setVar('level', 3);
// 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_friendpetition.php"; /** * Factory of petitions created */ $friendpetition_factory = new Xoopsyogurt_friendpetitionHandler($xoopsDB); /** * Getting the uid of the user which user want to ask to be friend */ $petitioned_uid = $_POST['petitioned_uid']; /** * Verify Token */ if (!$GLOBALS['xoopsSecurity']->check()) { redirect_header($_SERVER['HTTP_REFERER'], 3, _MD_YOGURT_TOKENEXPIRED); } //Verify if the user has already asked for friendship or if the user he s asking to be a friend has already asked him $criteria = new criteriaCompo(new criteria('petioned_uid', $petitioned_uid)); $criteria->add(new criteria('petitioner_uid', $xoopsUser->getVar('uid'))); if ($friendpetition_factory->getCount($criteria) > 0) { redirect_header(XOOPS_URL . "/modules/yogurt/index.php?uid=" . $_POST['petitioned_uid'], 3, _MD_YOGURT_ALREADY_PETITIONED);