$user_id = $sessionAgent->getUserId(); $user_info = $sessionAgent->getUserInfo(); $message = ""; $user_id = ""; $name = ""; $email = ""; if ('user_register' == MeinBlog::getRequest('act')) { $name = MeinBlog::getRequest('name'); $password = MeinBlog::getRequest('password'); $email = MeinBlog::getRequest('email'); $code = MeinBlog::getRequest('code'); $role = "GUEST"; if (empty($name) || empty($password) || empty($email)) { $message = "Please fulfill all required fields."; } else { $userAgent = new MBUser(); $role = $userAgent->authEmailAndCode($email, $code); if ($role) { $user_id = $userAgent->create($name, $email, $role, md5($password)); if (empty($user_id)) { $message = "Failed to create user."; } else { $message = "Successfully created user, now directing..."; $sessionAgent->login($name, $password); } } else { $message = "Code is not correct."; } } } ?>
<?php require_once __DIR__ . '/library/MeinBlog.php'; // Start or resume one session $sessionAgent = MeinBlogSession::sharedInstance(); $user_id = $sessionAgent->getUserId(); $user_info = $sessionAgent->getUserInfo(); $userAgent = new MBUser(); $fields = array(); $sort = 'user_id'; $sort_order = 'ASC'; if (!empty($user_id)) { if ($user_info['role'] == 'ADMIN') { if (MeinBlog::getRequest('act') == 'modify_user') { $target_user_id = MeinBlog::getRequest('target_user_id'); $new_name = MeinBlog::getRequest('new_name'); $new_email = MeinBlog::getRequest('new_email'); $new_password = MeinBlog::getRequest('new_password'); $new_role = MeinBlog::getRequest('new_role'); if (!empty($target_user_id) && !empty($new_name) && !empty($new_email)) { if ($target_user_id == 1) { $new_role = 'ADMIN'; } $done = $userAgent->modify($target_user_id, $new_name, $new_email, $new_role, empty($new_password) ? '' : md5($new_password)); if ($done) { header("location: UserAgency.php"); } else { $modify_user_message = "Failed to modify."; } } else { $done = false;
<?php require_once __DIR__ . '/library/MeinBlog.php'; require_once __DIR__ . '/library/Parsedown.php'; // Start or resume one session $sessionAgent = MeinBlogSession::sharedInstance(); $user_id = $sessionAgent->getUserId(); $user_info = $sessionAgent->getUserInfo(); $userAgent = new MBUser(); $fileAgent = new MBFileHeader(); $contentAgent = new MBFileContent(); $tagAgent = new MBFileTag(); $commentAgent = new MBFileComment(); $file_id = MeinBlog::getRequest('file_id'); if (!empty($file_id)) { $header = $fileAgent->getFileHeader($file_id); if ($header) { if (MeinBlog::getRequest('act') == 'add_tag') { $tag = MeinBlog::getRequest('tag'); if (!empty($tag)) { $tagAgent->createTagForFile($file_id, $tag, $user_id); } header("location: FileView.php?file_id=" . $file_id); } elseif (MeinBlog::getRequest('act') == 'new_comment') { $to_comment_id = MeinBlog::getRequest('to_comment_id', 0); $content = MeinBlog::getRequest('content'); if (!empty($content)) { $commentAgent->createComment($file_id, $user_id, $content, $to_comment_id); } header("location: FileView.php?file_id=" . $file_id); }