'); fclose($inF); }function checkAccount( $username,$password,$email,&$userid,$conf ) { global $database,$mainframe,$mosConfig_uniquemail; // simple spoof check security (login module does it only with Joomla functions, no cb.class inclusion) /*if ( is_callable("josSpoofCheck")) { josSpoofCheck(1); }*/ //$passwd = md5( $password ); $database->setQuery( "SELECT * " . "\nFROM #__users u " . "\nWHERE u.username='".$username."'" ); $database->loadObject( $user ); if (isset($user)) { //User exist, Verify Password if ((strpos($user->password, ':') === false) && $user->password == md5($password)) { // Old password hash storage but authentic ... lets convert it $salt = mosMakePassword(16); $crypt = md5($password.$salt); $user->password = $crypt.':'.$salt; // Now lets store it in the database $query = 'UPDATE #__users' . ' SET password = '.$database->Quote($user->password) . ' WHERE id = '.(int)$user->id; $database->setQuery($query); if (!$database->query()) { // This is an error but not sure what to do with it ... we'll still work for now } } list($hash, $salt) = explode(':', $user->password); $cryptpass = md5($password.$salt); if ($hash == $cryptpass) { //Login Ok if ( adscheckJoomlaVersion() == 1 ) $mainframe->login( array( 'username' => $username, 'password' => $password ), array() ); else $mainframe->login($username,$password); $userid = $user->id; return null; } else { //Login Failed return "bad_password"; } } else { if ($mosConfig_uniquemail == 1) { $database->setQuery( "SELECT * " . "\nFROM #__users u " . "\nWHERE u.email='".$email."'" ); $database->loadObject( $user ); if (isset($user)) { //Login Failed return "email_already_used"; } } //Create Account echo "Create Account"; $userid = saveRegistration($conf->comprofiler); if ( adscheckJoomlaVersion() == 1 ) $mainframe->login( array( 'username' => $username, 'password' => $password ), array() ); else $mainframe->login($username,$password); return null; }}function saveRegistration($comprofiler) { global $database, $acl,$mosConfig_absolute_path; // simple spoof check security //josSpoofCheck(); $row = new mosUser( $database ); if (!$row->bind( $_POST, 'usertype' )) { mosErrorAlert( addslashes(end($row -> getErrors())) ); } mosMakeHtmlSafe($row); $row->id = 0; $row->usertype = ''; $row->gid = $acl->get_group_id( 'Registered', 'ARO' ); if (!$row->check()) { echo "\n"; exit(); } $row->password = md5( $row->password ); $row->registerDate = date( 'Y-m-d H:i:s' ); if (!$row->store()) { echo "\n"; exit(); } $row->checkin(); $database->setQuery( "SELECT u.id " . "\nFROM #__users u " . "\nWHERE u.username='".$row->username."'" ); $userid = $database->loadResult(); if ($comprofiler > 0) { $lastname = mosGetParam( $_POST, 'name', "" ); $firstname = mosGetParam( $_POST, 'firstname', "" ); $middlename = mosGetParam( $_POST, 'middlename', "" ); $query = "INSERT INTO #__comprofiler (id,user_id,firstname,middlename,lastname) VALUES ('$userid' ,'$userid' ,'$firstname','$middlename','$lastname')"; $database->setQuery($query); $database->query(); } return $userid;} function show_rss($catid,$option){ global $database,$mosConfig_absolute_path,$mosConfig_live_site,$my,$mainframe,$mosConfig_cachepath; // load feed creator class require_once( $mosConfig_absolute_path .'/includes/feedcreator.class.php' ); $itemid = intval( mosGetParam( $_GET, 'Itemid', 0 )); // parameter intilization $info[ 'date' ] = date( 'r' ); $info[ 'year' ] = date( 'Y' ); $iso = split( '=', _ISO ); $info[ 'encoding' ] = $iso[1]; $info[ 'link' ] = htmlspecialchars( $mosConfig_live_site ); $info[ 'cache' ] = 1;//$params->def( 'cache', 1 ); $info[ 'cache_time' ] = 3600;//$params->def( 'cache_time', 3600 ); $info[ 'count' ] = 20;//$params->def( 'count', 20 ); $info[ 'orderby' ] = '';//$params->def( 'orderby', '' ); $info[ 'title' ] = 'title';//$params->def( 'title', 'Joomla! powered Site' ); $info[ 'description' ] = 'description';//$params->def( 'description', 'Joomla! site syndication' ); $info[ 'image_file' ] = 'joomla_rss.png';//$params->def( 'image_file', 'joomla_rss.png' ); $info[ 'image_alt' ] = 'Powered by Joomla!';//$params->def( 'image_alt', 'Powered by Joomla!' ); $info[ 'limit_text' ] = 0;//$params->def( 'limit_text', 0 ); $info[ 'text_length' ] = 20;//$params->def( 'text_length', 20 ); // get feed type from url $info[ 'feed' ] = strval( mosGetParam( $_GET, 'feed', 'RSS2.0' ) ); // live bookmarks $info[ 'live_bookmark' ] = '';//$params->def( 'live_bookmark', '' ); $info[ 'bookmark_file' ] = '';//$params->def( 'bookmark_file', '' ); // set filename for rss feeds $info[ 'file' ] = "adsmanager__".$catid."".strtolower( str_replace( '.', '', $info[ 'feed' ] ) ); $filename = $info[ 'file' ] .'.xml'; // security check to stop server path disclosure if ( strstr( $filename, '/' ) ) { echo _NOT_AUTH; return; } $info[ 'file' ] = $mosConfig_cachepath .'/'. $filename; // load feed creator class $rss = new UniversalFeedCreator(); // load image creator class $image = new FeedImage(); // loads cache file if ( $info[ 'cache' ] ) { $rss->useCached( $info[ 'feed' ], $info[ 'file' ], $info[ 'cache_time' ] ); } if ($catid == 0) { $info[ 'title' ] = "All Ads"; $info[ 'description' ] = "Description"; $info[ 'link' ] = sefRelToAbs("$mosConfig_live_site/index.php?option=$option"); $info[ 'rsslink' ] = sefRelToAbs("$mosConfig_live_site/index.php?option=$option&page=rss&no_html=1"); $search = "1"; } else { // get category-name: #__adsmanager".$directory."_category $database->setQuery("SELECT c.id, c.name, c.description, c.parent ". " FROM #__adsmanager_categories as c WHERE c.published='1' AND c.id=$catid"); $database->loadObject($category); $info[ 'title' ] = $category->name; $info[ 'description' ] = $category->description; $info[ 'link' ] = sefRelToAbs("$mosConfig_live_site/index.php?option=$option"); $info[ 'rsslink' ] = sefRelToAbs("$mosConfig_live_site/index.php?option=$option&page=rss&catid=$catid&no_html=1"); $database->setQuery( "SELECT c.id, c.name,c.parent ". " FROM #__adsmanager_categories as c ". "WHERE c.published = 1 ORDER BY c.parent,c.ordering"); $listcats = $database->loadObjectList(); $list[] = $catid; recurseSearch($listcats,$list,$catid); $listids = implode(',', $list); $search = "adcat.catid IN ($listids)"; } $order_text = "a.date_created DESC ,a.id DESC"; $limitstart = 0; $query = "SELECT a.*, p.name as parent, p.id as parentid, c.name as cat, c.id as catid, u.username as user ". "FROM #__adsmanager_ads as a ". "LEFT JOIN #__adsmanager_adcat as adcat ON adcat.adid = a.id ". "LEFT JOIN #__users as u ON a.userid = u.id ". "LEFT JOIN #__adsmanager_categories as c ON adcat.catid = c.id ". "LEFT JOIN #__adsmanager_categories as p ON c.parent = p.id ". "WHERE $search and c.published = 1 and a.published = 1 ". "GROUP BY a.id ORDER BY a.date_created DESC ,a.id DESC"; $database->setQuery($query,0,20); $ads = $database->loadObjectList(); $rss->title = $info[ 'title' ]; $rss->description = $info[ 'description' ]; $rss->link = $info[ 'link' ]; $rss->syndicationURL = $info[ 'rsslink' ]; $rss->cssStyleSheet = NULL; $rss->encoding = $info[ 'encoding' ]; if ( isset($info[ 'image' ]) ) { $image->url = $info[ 'image' ]; $image->link = $info[ 'link' ]; $image->title = $info[ 'image_alt' ]; $image->description = $info[ 'description' ]; // loads image info into rss array $rss->image = $image; } foreach($ads as $ad) { $item_link = sefRelToAbs("index.php?option=$option&page=show_ad&catid=$catid&adid=".$ad->id."&Itemid=$itemid"); $item_title = htmlspecialchars( $ad->ad_headline ); $item_title = html_entity_decode( $item_title ); $item_description = $ad->ad_text; $item_description = mosHTML::cleanText( $item_description ); $item_description = html_entity_decode( $item_description ); if ( $info[ 'limit_text' ] ) { if ( $info[ 'text_length' ] ) { // limits description text to x words $item_description_array = split( ' ', $item_description ); $count = count( $item_description_array ); if ( $count > $info[ 'text_length' ] ) { $item_description = ''; for ( $a = 0; $a < $info[ 'text_length' ]; $a++ ) { $item_description .= $item_description_array[$a]. ' '; } $item_description = trim( $item_description ); $item_description .= '...'; } } else { // do not include description when text_length = 0 $item_description = NULL; } } // load individual item creator class $item = new FeedItem(); // item info $item->title = $item_title; $item->link = $item_link; $item->description = $item_description; $item->source = $info[ 'link' ]; $item->date = date( 'r', strtotime($ad->date_created) ); $item->category = $ad->parent . ' - ' . $ad->cat; // loads item info into rss array $rss->addItem( $item ); } // save feed file $rss->saveFeed( $info[ 'feed' ], $info[ 'file' ], 1 );}?>