/*************************************************************************** * Dolphin Smart Community Builder * ----------------- * begin : Mon Mar 23 2006 * copyright : (C) 2006 BoonEx Group * website : http://www.boonex.com/ * This file is part of Dolphin - Smart Community Builder * * Dolphin is free software. This work is licensed under a Creative Commons Attribution 3.0 License. * http://creativecommons.org/licenses/by/3.0/ * * Dolphin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the Creative Commons Attribution 3.0 License for more details. * You should have received a copy of the Creative Commons Attribution 3.0 License along with Dolphin, * see license.txt file; if not, write to marketing@boonex.com ***************************************************************************/ require_once( '../inc/header.inc.php' ); require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' ); require_once( BX_DIRECTORY_PATH_INC . 'admin_design.inc.php' ); require_once( BX_DIRECTORY_PATH_INC . 'utils.inc.php' ); $logged['admin'] = member_auth( 1, true, true ); $_page['css_name'] = 'links.css'; TopCodeAdmin(); ContentBlockHead("Manage links"); if( !$demo_mode && 'add' == $_GET['action'] ) { echo GetLinkForm(); } elseif( !$demo_mode && 'addnew' == $_POST['action']) { if( 1 > strlen($_POST['title']) ) { echo GetActionText( 'Please enter title' ); echo GetLinkForm( false, 0, true ); } elseif( 1 > strlen($_POST['URL']) ) { echo GetActionText( 'Please enter URL' ); echo GetLinkForm( false, 0, true ); } elseif( 1 > strlen($_POST['desc']) ) { echo GetActionText( 'Please enter description' ); echo GetLinkForm( false, 0, true ); } else { if( db_res( "INSERT INTO `Links` SET `Title` = '" . $_POST['title'] . "', `URL` = '" . $_POST['URL'] . "', `Description` = '" . $_POST['desc'] . "';" ) ) { echo GetActionText( 'link successfully added', 1); echo GetLinkList(); } else { echo GetActionText( 'action failed'); echo GetLinkList(); } } } elseif( !$demo_mode && 'edit' == $_GET['action']) { echo GetLinkForm( true, $_GET['linkID'] ); } elseif( !$demo_mode && 'update' == $_POST['action'] ) { if( 1 > strlen($_POST['title']) ) { echo GetActionText( 'Please enter title' ); echo GetLinkForm( false, 0, true ); } elseif( 1 > strlen($_POST['URL']) ) { echo GetActionText( 'Please enter URL' ); echo GetLinkForm( false, 0, true ); } elseif( 1 > strlen($_POST['desc']) ) { echo GetActionText( 'Please enter description' ); echo GetLinkForm( false, 0, true ); } else { if( db_res( "UPDATE `Links` SET `Title` = '" . process_db_input($_POST['title']) . "', `URL` = '" . process_db_input($_POST['URL']) . "', `Description` = '" . process_db_input($_POST['desc']) . "' WHERE `ID` = " . (int)$_POST['linkID'] . ";" ) ) { echo GetActionText( 'link updated successfully', 1 ); echo GetLinkList(); } else { echo GetActionText( 'action failed'); echo GetLinkList(); } } } elseif( !$demo_mode && 'delete' == $_GET['action'] ) { if( db_res( "DELETE FROM `Links` WHERE `ID` = " . (int)$_GET['linkID'] ) ) { echo GetActionText( 'link deleted successfully', 1 ); echo GetLinkList(); } else { echo GetActionText( 'action failed'); echo GetLinkList(); } } else { echo GetLinkList(); } ContentBlockFoot(); BottomCode(); function GetLinkList() { global $site; $link_query = "SELECT `ID`, `Title`, `URL`, `Description` FROM `Links`"; $link_res = db_res($link_query); $link_count = db_arr("SELECT COUNT(ID) FROM `Links`"); $link_count = $link_count['0']; $links_onpage = 10; $ret = ''; $ret .= '