Ejemplo n.º 1
0
 function tearDown()
 {
     delete_author($author = 'author2');
     parent::tearDown();
 }
Ejemplo n.º 2
0
        }
    }
}
if (array_key_exists('create_submit', $_POST)) {
    if ($isFormValid) {
        add_author($valid_authors[WRITER]['value'], $valid_authors[ARTIST]['value']);
        header('Location: index.php');
        exit;
    }
} elseif (array_key_exists('edit_submit', $_POST)) {
    if ($isFormValid) {
        update_author($_GET['id'], $valid_authors[WRITER]['value'], $valid_authors[ARTIST]['value']);
        $isUpdated = true;
    }
} elseif (array_key_exists('delete_submit', $_POST)) {
    delete_author($_GET['id']);
    header('Location: index.php');
    exit;
} elseif (array_key_exists('close_submit', $_POST)) {
    header('Location: index.php');
    exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title><?php 
echo SITE_NAME, ' Admin';
?>
</title>
Ejemplo n.º 3
0
}
// change password
if (isset($_POST['change_password']) && $_POST['change_password'] == 'change') {
    $author_id = (int) $_GET['author_id'];
    $change_status = change_author_password($author_id);
    if ($change_status === true) {
        $reload = $_SERVER["PHP_SELF"] . '?page_name=authors&author_id=' . $author_id . '&passwordchanged';
        header('Location: ' . $reload);
    } else {
        $error = 'Error changing password: '******'confirm_delete_author']) && $_POST['confirm_delete_author'] == 'Yes') {
    $author_id = (int) $_GET['author_id'];
    $delete_status = delete_author($author_id);
    if ($delete_status === true) {
        $reload = $_SERVER["PHP_SELF"] . '?page_name=authors';
        header('Location: ' . $reload);
    } else {
        $error = $delete_status;
    }
}
// author list
$author_id = isset($_GET['author_id']) ? (int) $_GET['author_id'] : $_SESSION[WW_SESS]['user_id'];
$author = get_author($author_id);
// check if author has written any articles
$usage = get_articles_stats(1);
// redirect if author details not found
if (empty($author)) {
    $reload = $_SERVER["PHP_SELF"] . '?page_name=authors';
Ejemplo n.º 4
0
 /**
  * The actualiser to add an author.
  *
  * @return tempcode		The UI
  */
 function __ad()
 {
     $title = get_page_title('DEFINE_AUTHOR');
     $author = post_param('author', get_param('author'));
     if (!has_edit_author_permission(get_member(), $author)) {
         access_denied('SPECIFIC_PERMISSION', 'edit_midrange_content');
     }
     if ($author == '') {
         $forum_handle_string = post_param('forum_handle', strval(get_member()));
         $author = is_numeric($forum_handle_string) ? $GLOBALS['FORUM_DRIVER']->get_username(intval($forum_handle_string)) : $forum_handle_string;
         if (is_null($author)) {
             $author = do_lang('UNKNOWN');
         }
     }
     $_forum_handle = post_param('forum_handle', NULL);
     if ($_forum_handle == '') {
         $_forum_handle = NULL;
     }
     if (!is_null($_forum_handle)) {
         $forum_handle = is_numeric($_forum_handle) ? intval($_forum_handle) : $GLOBALS['FORUM_DRIVER']->get_member_from_username($_forum_handle);
     } else {
         $forum_handle = NULL;
     }
     if (post_param_integer('delete', 0) == 1) {
         if (!has_delete_author_permission(get_member(), $author)) {
             access_denied('SPECIFIC_PERMISSION', 'delete_midrange_content');
         }
         delete_author($author);
         $author = NULL;
         require_code('fields');
         if (has_tied_catalogue('author')) {
             delete_form_custom_fields('author', $author);
         }
     } else {
         $_url = post_param('url');
         if (strpos($_url, '@') !== false && strpos($_url, 'mailto:') === false) {
             $_url = 'mailto:' . $_url;
         }
         $url = strpos($_url, 'mailto:') === false ? fixup_protocolless_urls($_url) : $_url;
         add_author($author, $url, $forum_handle, post_param('description'), post_param('skills'), post_param('meta_keywords', ''), post_param('meta_description', ''));
         require_code('fields');
         if (has_tied_catalogue('author')) {
             save_form_custom_fields('author', $author);
         }
         if (addon_installed('awards')) {
             require_code('awards');
             handle_award_setting('author', $author);
         }
     }
     breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('AUTHOR_MANAGE'))));
     return $this->do_next_manager($title, do_lang_tempcode('SUCCESS'), $author);
 }
Ejemplo n.º 5
0
 function update_author_record()
 {
     // Throw the extra 1 as a parameter since this is an authorized request.
     $typepad_url = get_author_api_url('@self', 1);
     $response = $this->make_authorized_request($typepad_url);
     $this->author = new Author(array('json' => $response));
     // this writes the Author record to the db.
     $oauth_user_id = remember_author($this->author);
     // Also create a cookie out of this author if one does not already exist.
     if (!array_key_exists(COOKIE_NAME, $_COOKIE)) {
         //setcookie(COOKIE_NAME, $oauth_user_id);
         setcookie(COOKIE_NAME, get_session_id_from_user_id($oauth_user_id));
     }
     // this is important for other services using this obj...
     $this->user_id = $oauth_user_id;
     // When you begin the sign-on process, you're given a temporary user record
     // without its TypePad XID -- even if you already existed.  This block
     // makes the temporary request/access token your actual request/access tokens.
     if (get_user_id_from_session_id($_COOKIE[COOKIE_NAME]) != $oauth_user_id && $oauth_user_id) {
         // store the temporary user_id
         $old_oauth_id = get_user_id_from_session_id($_COOKIE[COOKIE_NAME]);
         debug("Replacing temporary oauth_oauthor credentials...");
         // Update the OAuth table to user our author lookup.
         replace_oauth_author($old_oauth_id, $oauth_user_id);
         // Correct your active cookie.
         debug("Setting active cookie...");
         $session_id = get_session_id_from_user_id($oauth_user_id);
         debug("[update_author_record] session_id={$session_id} when user_id = {$oauth_user_id}");
         setcookie(COOKIE_NAME, get_session_id_from_user_id($oauth_user_id));
         // Remove the temporary user.
         debug("Removing temporary author record...");
         delete_author($old_oauth_id);
     }
 }