⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 admin.typedcontent.php

📁 mambo的cms源代码
💻 PHP
📖 第 1 页 / 共 2 页
字号:
	$menuid		= mosGetParam( $_POST, 'menuid', 0 );	$row = new mosContent( $database );	if (!$row->bind( $_POST )) {		echo "<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n";		exit();	}	if ( $row->id ) {		$row->modified = date( 'Y-m-d H:i:s' );		$row->modified_by = $my->id;	} else {		$row->created = date( 'Y-m-d H:i:s' );		$row->created_by = $my->id;	}	if (trim( $row->publish_down ) == 'Never') {		$row->publish_down = '0000-00-00 00:00:00';	}	// Save Parameters	$params = mosGetParam( $_POST, 'params', '' );	if (is_array( $params )) {		$txt = array();		foreach ( $params as $k=>$v) {			$txt[] = "$k=$v";		}		$row->attribs = implode( "\n", $txt );	}	// code cleaner for xhtml transitional compliance	$row->introtext = str_replace( '<br>', '<br />', $row->introtext );	$row->state = mosGetParam( $_REQUEST, 'published', 0 );	if (!$row->check()) {		echo "<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n";		exit();	}	if (!$row->store()) {		echo "<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n";		exit();	}	$row->checkin();	switch ( $task ) {		case 'go2menu':			mosRedirect( 'index2.php?option=com_menus&menutype='. $menu );			break;		case 'go2menuitem':			mosRedirect( 'index2.php?option=com_menus&menutype='. $menu .'&task=edit&hidemainmenu=1&id='. $menuid );			break;		case 'menulink':			menuLink( $option, $row->id );			break;		case 'resethits':			resethits( $option, $row->id );			break;		case 'save':			$msg = $adminLanguage->A_COMP_TYPED_SAVED;			mosRedirect( 'index2.php?option='. $option, $msg );			break;		case 'apply':		default:			$msg = $adminLanguage->A_COMP_TYPED_CHG_SAVED;			mosRedirect( 'index2.php?option='. $option .'&task=edit&hidemainmenu=1&id='. $row->id, $msg );			break;	}}/*** Trashes the typed content item*/function trash( &$cid, $option ) {	global $database, $mainframe, $adminLanguage;	$total = count( $cid );	if ( $total < 1) {		echo "<script> alert(\"". $adminLanguage->A_COMP_CONTENT_SEL_DEL ."\"); window.history.go(-1);</script>\n";		exit;	}	$state = '-2';	$ordering = '0';	//seperate contentids	$cids = implode( ',', $cid );	$query = 	"UPDATE #__content SET state = '". $state ."', ordering = '". $ordering ."'"	. "\n WHERE id IN ( ". $cids ." )"	;	$database->setQuery( $query );	if ( !$database->query() ) {		echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>\n";		exit();	}	$msg = $total ." ". $adminLanguage->A_COMP_TYPED_TRASHED;	mosRedirect( 'index2.php?option='. $option, $msg );}/*** Changes the state of one or more content pages* @param string The name of the category section* @param integer A unique category id (passed from an edit form)* @param array An array of unique category id numbers* @param integer 0 if unpublishing, 1 if publishing* @param string The name of the current user*/function changeState( $cid=null, $state=0, $option ) {	global $database, $my, $adminLanguage;	if (count( $cid ) < 1) {		$action = $state == 1 ? $adminLanguage->A_PUBLISH : ($state == -1 ? $adminLanguage->A_COMP_CONTENT_ARCHIVE : $adminLanguage->A_COMP_UNPUBLISHED );		echo "<script> alert(\"". $adminLanguage->A_COMP_SEL_ITEM ." ". $action ."\"); window.history.go(-1);</script>\n";		exit;	}	$total = count ( $cid );	$cids = implode( ',', $cid );	$database->setQuery( "UPDATE #__content SET state='$state'"	. "\nWHERE id IN ($cids) AND (checked_out=0 OR (checked_out='$my->id'))"	);	if (!$database->query()) {		echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>\n";		exit();	}	if (count( $cid ) == 1) {		$row = new mosContent( $database );		$row->checkin( $cid[0] );	}	if ( $state == "1" ) {		$msg = $total ." ". $adminLanguage->A_COMP_CONTENT_PUBLISHED;	} else if ( $state == "0" ) {		$msg = $total ." ". $adminLanguage->A_COMP_CONTENT_UNPUBLISHED;	}	mosRedirect( 'index2.php?option='. $option .'&msg='. $msg );}/*** changes the access level of a record* @param integer The increment to reorder by*/function changeAccess( $id, $access, $option  ) {	global $database;	$row = new mosContent( $database );	$row->load( $id );	$row->access = $access;	if ( !$row->check() ) {		return $row->getError();	}	if ( !$row->store() ) {		return $row->getError();	}	mosRedirect( 'index2.php?option='. $option );}/*** Function to reset Hit count of a content item*/function resethits( $option, $id ) {	global $database;	$row = new mosContent($database);	$row->Load( $id );	$row->hits = "0";	$row->store();	$row->checkin();	$msg = 'Successfully Reset Hit';	mosRedirect( 'index2.php?option='. $option .'&task=edit&hidemainmenu=1&id='. $row->id, $msg );}/*** Cancels an edit operation* @param database A database connector object*/function cancel( $option ) {	global $database;	$row = new mosContent( $database );	$row->bind( $_POST );	$row->checkin();	mosRedirect( 'index2.php?option='. $option );}function menuLink( $option, $id ) {	global $database, $adminLanguage;	$menu 	= mosGetParam( $_POST, 'menuselect', '' );	$link 	= mosGetParam( $_POST, 'link_name', '' );	$row 				= new mosMenu( $database );	$row->menutype 		= $menu;	$row->name 			= $link;	$row->type 			= 'content_typed';	$row->published		= 1;	$row->componentid	= $id;	$row->link			= 'index.php?option=com_content&task=view&id='. $id;	$row->ordering		= 9999;	if (!$row->check()) {		echo "<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n";		exit();	}	if (!$row->store()) {		echo "<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n";		exit();	}	$row->checkin();	$row->updateOrder( "menutype='$row->menutype' AND parent='$row->parent'" );	$msg = $link ." ". $adminLanguage->A_COMP_CONTENT_IN_MENU  .": ". $menu ." ". $adminLanguage->A_COMP_CONTENT_SUCCESS;	mosRedirect( 'index2.php?option='. $option .'&task=edit&hidemainmenu=1&id='. $id, $msg );}function go2menu() {	global $database;	// checkin content	$row = new mosContent( $database );	$row->bind( $_POST );	$row->checkin();	$menu = mosGetParam( $_POST, 'menu', 'mainmenu' );	mosRedirect( 'index2.php?option=com_menus&menutype='. $menu );}function go2menuitem() {	global $database;	// checkin content	$row = new mosContent( $database );	$row->bind( $_POST );	$row->checkin();	$menu 	= mosGetParam( $_POST, 'menu', 'mainmenu' );	$id		= mosGetParam( $_POST, 'menuid', 0 );	mosRedirect( 'index2.php?option=com_menus&menutype='. $menu .'&task=edit&hidemainmenu=1&id='. $id );}function saveOrder( &$cid ) {	global $database;	$total		= count( $cid );	$order 		= mosGetParam( $_POST, 'order', array(0) );	$row 		= new mosContent( $database );	$conditions = array();    // update ordering values	for ( $i=0; $i < $total; $i++ ) {		$row->load( $cid[$i] );		if ($row->ordering != $order[$i]) {			$row->ordering = $order[$i];	        if (!$row->store()) {	            echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>\n";	            exit();	        } // if	        // remember to updateOrder this group	        $condition = "catid='$row->catid' AND state >= 0";	        $found = false;	        foreach ( $conditions as $cond )	            if ($cond[1]==$condition) {	                $found = true;	                break;	            } // if	        if (!$found) $conditions[] = array($row->id, $condition);		} // if	} // for	// execute updateOrder for each group	foreach ( $conditions as $cond ) {		$row->load( $cond[0] );		$row->updateOrder( $cond[1] );	} // foreach	$msg 	= 'New ordering saved';	mosRedirect( 'index2.php?option=com_typedcontent', $msg );} // saveOrder?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -