load((int)$uid); } if ($user->picture) { $img_path = $base_url."/files/".$user->picture; } else { $img_path = $current_theme_path."/images/default.jpg"; } $set_outputthis = TRUE; $user_destinations = array(); $destinations = ContentRouting::get_all_destinations(); $user_destinations = ContentRouting::get_user_destinations((int)$_SESSION['user']['id']); foreach ($user_destinations as $dest) { if ($dest['blog_type'] == 4) { $set_outputthis = FALSE; } } if (isset($_POST['add'])) { $blogname = trim($_POST['blogname']); $blog_type = $_POST['blog_type']; $blog_username = trim($_POST['blog_username']); $blog_password = trim($_POST['blog_password']); $blogurl = trim($_POST['blogurl']); if (empty($blogname)) { $error = "Please specify a blog name."; } elseif (empty($blogurl) ) { $error = "Please specify the blog url."; } elseif (empty($blog_username) ) { $error = "Please specify the blog username."; } elseif (empty($blog_password) ) { $error = "Please specify the blog password."; } else { $blog_url = validate_url($blog_url); ContentRouting::add_routing_destination_for_user ($_SESSION['user']['id'], $blogname, $blogurl, $blog_username, $blog_password, $blog_type); header("Location: $base_url/showcontent.php?uid=".$_SESSION['user']['id']); } } $header = & new Template(CURRENT_THEME_FSPATH."/header.tpl"); $header->set('user_name', $user->first_name.' '.$user->last_name); $left_page = & new Template(CURRENT_THEME_FSPATH."/left_page.tpl"); $left_page->set('img_path', $img_path); $center_content = & new Template(CURRENT_THEME_FSPATH."/adddestination.tpl"); $center_content->set('heading', $heading); $center_content->set('error', $error); $center_content->set('blogname', $blogname); $center_content->set('blogurl', $blogurl); $center_content->set('destinations', $destinations); $center_content->set('user_destinations', $user_destinations); $center_content->set('blog_username', $blog_username); $center_content->set('blog_password', $blog_password); $center_content->set('set_outputthis', $set_outputthis); $footer = & new Template(CURRENT_THEME_FSPATH."/footer.tpl"); ?> fetch(); echo $left_page->fetch(); echo $center_content->fetch(); echo $footer->fetch(); ?>