/** * activate a user * * @param XoopsUser &$user reference to the {@link XoopsUser} object * * @return bool successful? */ public function activateUser(XoopsUser &$user) { if ($user->getVar('level') != 0) { return true; } $user->setVar('level', 1); return $this->_uHandler->insert($user, true); }
include_once '../../class/criteria.php'; include_once 'class/yogurt_images.php'; if (!$GLOBALS['xoopsSecurity']->check()) { redirect_header('index.php', 3, _MD_YOGURT_TOKENEXPIRED); } /** * Creating the factory loading the picture changing its caption */ $picture_factory = new Xoopsyogurt_imagesHandler($xoopsDB); $picture = $picture_factory->create(false); $picture->load($_POST['cod_img']); $uid = intval($xoopsUser->getVar('uid')); $image = XOOPS_ROOT_PATH . '/uploads/' . 'thumb_' . $picture->getVar('url'); $avatar = 'av' . $uid . '_' . time() . '.jpg'; $imageavatar = XOOPS_ROOT_PATH . '/uploads/' . $avatar; if (!copy($image, $imageavatar)) { echo 'failed to copy $file...\\n'; } $xoopsUser->setVar('user_avatar', $avatar); $userHandler = new XoopsUserHandler($xoopsDB); /** * Verifying who's the owner to allow changes */ if ($uid == $picture->getVar('uid_owner')) { if ($userHandler->insert($xoopsUser)) { redirect_header('album.php', 2, _MD_YOGURT_AVATAR_EDITED); } else { redirect_header('album.php', 2, _MD_YOGURT_NOCACHACA); } } include '../../footer.php';
function checkSuspension() { $criteria_suspended = new Criteria("uid", $this->uidOwner); if ($this->isSuspended == 1) { $suspensions = $this->suspensions_factory->getObjects($criteria_suspended); $suspension = $suspensions[0]; if (time() > $suspension->getVar('suspension_time')) { $suspension = $this->suspensions_factory->create(false); $suspension->load($this->uidOwner); $this->owner->setVar('email', $suspension->getVar('old_email', "n")); $this->owner->setVar('pass', $suspension->getVar('old_pass', "n")); $this->owner->setVar('user_sig', $suspension->getVar('old_signature', "n")); $user_handler = new XoopsUserHandler($this->db); $user_handler->insert($this->owner, true); $criteria = new Criteria("uid", $this->uidOwner); $this->suspensions_factory->deleteAll($criteria); } } }