All pastes #605758 Raw Edit

devil

public php v1 · immutable
·published 2007-07-06 12:27 UTC
rendered paste body
<?php// no direct accessdefined( '_VALID_MOS' ) or die( 'Restricted access' );$_MAMBOTS->registerFunction( 'onPrepareContent', 'botTitle' );function botTitle( $published, &$row, &$params, $page=0 ) {	// check whether mambot has been unpublished	if ( !$published ) {		return true;}			// check for Static-Content	if ($row->sectionid == 0) {	return true;}global $database, $mosConfig_live_site, $mainframe;// get mambot params from db$query = "SELECT params FROM #__mambots"    ."\n WHERE element='mostitlenew'"    ."\n AND folder='content'"    ."\n LIMIT 0,1"    ;$database->setQuery($query);$bot_params = null;$database->loadObject($bot_params);// error sql query handlingif( $database->getErrorNum()) {    echo $database->stderr();}// parse params in an object$bot_param = new mosParameters( $bot_params->params );$days       = intval($bot_param->get( 'days', 7)); // Holt die eingestellten Tage.$text       = $bot_param->get( 'new-text', 'New'); //Holt den Text. $posi       = intval($bot_param->get( 'posi', '0')); // Holt die Position. $img        = $bot_param->get( 'title_image'); // Holt ein Bild aus dem images$alt        = $bot_param->get( 'title_alt'); // Alt-Tag for the Image$csstext    = $bot_param->get( 'css-text'); // Alt-Tag for the Image$cssimages  = $bot_param->get( 'css-images'); // Alt-Tag for the Image$images = $mosConfig_live_site.'/mambots/content/mostitlenew/icons/'.$img;// CSS Header schreiben$customHeadTag = ''.					'<style type="text/css">' . "\n" .					'span.new-text {' . "\n" .					''. $csstext.''  . "\n" .          '}' . "\n" .          'img.new-image {' . "\n" .					''. $cssimages.''  . "\n" .          '}' . "\n" .					'</style>';				$mainframe->addCustomHeadTag( $customHeadTag );				// Ausgabe  $images = $mosConfig_live_site.'/mambots/content/mostitlenew/icons/'.$img; if  (((time()- strtotime($row->created))/(3600*24)) < $days){ if ($img !='-1') {														$mark_new = "<img src='$images' alt='$alt' class='new-image' style='display:inline;'/>";									}	else  { 													$mark_new = '<span class="new-text">'.$text.'</span>' ;													}																																		    if( $posi == 0 ){  $row->title = $mark_new . ' ' . $row->title ;  } else  {  $row->title = $row->title . ' ' . $mark_new ;  }}  return true;     }  ?>