Converting this codes..

Results 1 to 2 of 2
  1. #1
    Loyalty Vaulient is offline
    MemberRank
    May 2012 Join Date
    MalaysiaLocation
    1,796Posts

    Converting this codes..

    I recently found this in holocms
    Code:
    <?php
    /*===================================================+
    || # HoloCMS - Website and Content Management System
    |+===================================================+
    || # Copyright Ā© 2008 Meth0d. All rights reserved.
    || # http://www.meth0d.org
    |+===================================================+
    || # HoloCMS is provided "as is" and comes without
    || # warrenty of any kind. HoloCMS is free software!
    |+===================================================*/
    
    include('../core.php');
    include('../includes/session.php');
    
    $i = 0;
    $output = "[";
    $getem = mysql_query("SELECT * FROM messenger_friendships WHERE userid = '".$my_id."' OR friendid = '".$my_id."'") or die(mysql_error());
    
    while ($row = mysql_fetch_assoc($getem)) {
    	$i++;
    
    	if($row['friendid'] == $my_id){
    		$friendsql = mysql_query("SELECT * FROM users WHERE id = '".$row['userid']."'");
    	} else {
    		$friendsql = mysql_query("SELECT * FROM users WHERE id = '".$row['friendid']."'");
    	}
    
    	$friendrow = mysql_fetch_assoc($friendsql);
    
    	$name = $friendrow['name'];
    	$id = $friendrow['id'];
    
    	$output = $output."{\"id\":".$id.",\"name\":\"".$name."\"},";
    }
    $output = substr_replace($output,"",-1);
    $output = $output."]";
    ?>
    /*-secure-
    <?php echo $output; ?>
     */
    and I noticed that it was kinda similar to ubercms however whenever I try to implement it or should I say replace it , I seem to fail.

    This is the code I'm trying to change

    Code:
    	case 'recipients':
    	
    		echo '/*-secure-' . LB;
    		echo '[';
    		
    		$getBuddies = dbquery("SELECT receiver FROM messenger_friendships WHERE sender = '" . USER_ID . "'");
    		$i = 0;
    		
    		while ($buddy = mysql_fetch_assoc($getBuddies))
    		{
    			if ($i > 0)
    			{
    				echo ',';
    			}
    			
    			echo '{"id":' . $buddy['receiver'] . ',"name":"' . clean($users->id2name($buddy['receiver'])) . '"}';
    		
    			$i++;
    		}
    		
    		echo ']';
    		echo LB . ' */';
    		
    		break;
    Any pro coders could help with converting this?


  2. #2
    Loyalty Vaulient is offline
    MemberRank
    May 2012 Join Date
    MalaysiaLocation
    1,796Posts

    Re: Converting this codes..

    Fixed.



Advertisement