Jump to content

Sort Problem


thechris

Recommended Posts

I looked on the nulavatar forums already but couldn't find anything and I looked through the faq for it but couldn't find anything wrong there either.

What i'm getting is the warning
Warning: sort() expects parameter 1 to be array, null given in /Users/chrismorlang/Sites/admin/admin_nulavatar.php on line 674

here is the code
[code]
//
// [START] Add image
//
if($action == "addimage")
{
$location = '<a href="'.append_sid($file.'?action=images').'" class="nav">'.$lang['nulavatar_loc_images'].'</a> -> <a href="'.append_sid($file.'?action=addimage').'" class="nav">'.$lang['nulavatar_loc_addimage'].'</a>';
//
// [START] Create list with images!
//
$dir = @opendir($phpbb_root_path . $sprites_path);

$firstimage = '';

while($file = @readdir($dir))
{
if( !@is_dir(phpbb_realpath($phpbb_root_path . $sprites_path . '/' . $file)) )
{
$img_size = @getimagesize($phpbb_root_path . $sprites_path . '/' . $file);

if( ($img_size[0] == $img_width) && ($img_size[1] == $img_height) )
{
$sprite_images[] = $file;
}
}
}

@closedir($dir);

sort($sprite_images); //LINE GIVING ME THE PROBLEM
$i_list = "";

for( $i = 0; $i < count($sprite_images); $i++ )
{
if ($firstimage == '')
{ $firstimage = $sprite_images[$i]; }
$i_list .= '<option value="' . $sprite_images[$i] . '">' . $sprite_images[$i] . '</option>';
}
//
// [END] Create list with images!
//

$sql = "SELECT * FROM ".$table_prefix."nulavatar_layers ORDER BY position DESC";
if ( !($result = $db->sql_query($sql)) )
{ message_die(GENERAL_MESSAGE, "<b>Fatal Error!</b><br />".mysql_error()); }

$l_list = '';

for( $i = 0; $i < mysql_num_rows($result); $i++ )
{
$row = mysql_fetch_array($result);
$l_list .= '<option value = "'.$row['id'].'">'.str_replace("_"," ",$row['name']).'</option>';
}

$noshow = '<option value = "">'.$lang['nulavatar_dont_use_nolayer'].'</option>';

$useaction = '
<tr><td class="row1" align="center"><span class="gen">
<br /><b>'.$lang['nulavatar_addimage'].'</b><br /><br />
<form action="" method="post">
<table width="60%" cellpadding="10" cellspacing="0">
<tr>
<td width="40%" class="row2"><span class="gen"><b>'.$lang['nulavatar_name'].'</b></span></td>
<td width="60%" class="row2"><span class="gen"><input type="text" name="name" value=""></span></td>
</tr>
<tr>
<td width="40%" class="row2"><span class="gen"><b>'.$lang['nulavatar_image'].'</b></span></td>
<td width="60%" class="row2"><span class="gen"><img src="'.$phpbb_root_path.$sprites_path.'/'.$firstimage.'" name="preview"><br /><select name="image" onChange="document.images[\'preview\'].src = \''.$phpbb_root_path.$sprites_path.'/\'+ this.value;">'.$i_list.'</select></span></td>
</tr>
<tr>
<td width="40%" class="row2"><span class="gen"><b>'.$lang['nulavatar_layer'].'</b></span></td>
<td width="60%" class="row2"><span class="gen"><select name="layer">'.$l_list.'</select></span></td>
</tr>
<tr>
<td width="40%" class="row2"><span class="gen"><b>'.$lang['nulavatar_dontshowlayer'].'</b></span><span class="gensmall"><br />'.$lang['nulavatar_dontshowlayer_explain'].'</span></td>
<td width="60%" class="row2"><span class="gen"><select name="dontshowlayer">'.$noshow.$l_list.'</select></span></td>
</tr>
<tr>
<td width="40%" class="row2"><span class="gen"><b>'.$lang['nulavatar_itemneeded'].'</b></span><span class="gensmall"><br />'.$lang['nulavatar_itemneeded_explain'].'</span></td>
<td width="60%" class="row2"><span class="gen"><input type="text" name="itemneeded" value=""></span></td>
</tr>
</table>
<br />
<input type="hidden" name="action" value="doaddimage"><input type="submit" class="mainoption" value="'.$lang['nulavatar_addimage'].'"><br /><br /></span></th>
</form>
</span></td></tr>
';
}
//
// [END] Add image
//

[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.