$uid)); } $address = $_SERVER['SERVER_NAME']; $sopradeParing = db_query("SELECT ur.requestee_id FROM {user_relationships} ur WHERE ur.requester_id = %d ORDER BY updated_at DESC", $uid); while ($sober = db_fetch_object($sopradeParing)){ $userId=$sober->requestee_id; if($userId!=""){ $query_result = db_query(("SELECT * FROM {node} n WHERE n.status = 1 AND n.type = 'raamat' AND n.uid = %d ORDER BY n.changed DESC LIMIT 1"), $userId); if(mysql_num_rows($query_result)!=0){ while ($result = db_fetch_object($query_result)){ //SIIN ON VAJA MIDAGI TEHA $query_result2 = db_query("SELECT tn.nid, tn.tid FROM {term_node} tn WHERE ".$result->nid."=tn.nid ORDER BY tn.tid ASC"); $last = mysql_num_rows($query_result2); $a=0; while ($result2 = db_fetch_object($query_result2)){ $a++; if($a==$last){ $query_result3 = db_query("SELECT cfk.nid, cfk.field_kaanepilt_fid FROM {content_field_kaanepilt} cfk WHERE ".$result2->nid."=cfk.nid"); $result3 = db_fetch_object($query_result3); if($result3->field_kaanepilt_fid!=''){ $query_result4 = db_query("SELECT f.fid, f.filepath FROM {files} f WHERE ".$result3->field_kaanepilt_fid."=f.fid"); $result4 = db_fetch_object($query_result4); } else {$result4->filepath="";} $query_result5 = db_query("SELECT td.tid, td.name FROM {term_data} td WHERE ".$result2->tid."=td.tid"); $result5 = db_fetch_object($query_result5); $query_result6 = db_query(("SELECT * FROM {profile_values} pv WHERE pv.uid = '%d' AND pv.fid='13'"), $userId); $firstName = db_fetch_object($query_result6); $nameAlone = $firstName->value; $nameLength = strlen($nameAlone); if($nameLength<=13){ $newName=$nameAlone; } else { $newName = substr($nameAlone, 0, 13); $newName .= '...'; } if($result4->filepath != ""){ $trimmed = str_replace(' ', '%20', $result4->filepath); $newPictureSizes = pictureSizes("http://".$address."/".$trimmed, 100); $block_content .= '
'; } else { $block_content .= ''; } } } } } } } $block_content .= ''; // the block view if ($block_content == '') { // no content $block['subject'] = 'Sõprade raamatud'; $block['content'] = '