⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 avatars.php

📁 个人主页音乐程序 个人主页音乐程序 个人主页音乐程序 个人主页音乐程序 个人主页音乐程序
💻 PHP
字号:
<?php
/**
 * avatars.php
 * Musicbox Version 2.1
 * TeaM SCRiPTMAFiA 2005
 *
 * This include displays a HTML list of all available avatars, allowing the user to select one. 
 */

/**
 * Recursive version of glob
 * sthomas at townnews dot com
 *
 * @return array containing all pattern-matched files.
 *
 * @param string $sDir      Directory to start with.
 * @param string $sPattern  Pattern to glob for.
 * @param int $nFlags      Flags sent to glob.
 */
function rglob($sDir, $sPattern, $nFlags = NULL)
{
  $sDir = escapeshellcmd($sDir);

  // Get the list of all matching files currently in the
  // directory.

  $aFiles = glob("$sDir/$sPattern", $nFlags);

  // Then get a list of all directories in this directory, and
  // run ourselves on the resulting array.  This is the
  // recursion step, which will not execute if there are no
  // directories.

  foreach (glob("$sDir/*", GLOB_ONLYDIR) as $sSubDir)
  {
   $aSubFiles = rglob($sSubDir, $sPattern, $nFlags);
   $aFiles = array_merge($aFiles, $aSubFiles);
  }

  // The array we return contains the files we found, and the
  // files all of our children found.

  return $aFiles;
}

/* Get Listing of avatars */
$files = rglob (AVATARS_DIR.AVATARS_DIR_STOCK, '*');
sort ($files, SORT_STRING);

/**
 * Display table of images
 */
?>
<table>
<?
for ($count = 0; $count < count($files); $count++)
{
	?>
	<tr>
	<?
	/* Display each row of avatars */
	for ($x = 0; $x < AVATARS_PER_ROW; $x++)
	{
		$avatar = substr($files[$count], strlen(AVATARS_DIR));
		?>
		<td>
			<input type="radio" name="avatar" value="<?=$avatar?>"<? if($form->value("avatar") == $avatar) echo 'checked'; ?> onClick="document.getElementById('avatar_type_choose').checked=1">
			<img src="<?=AVATARS_URL.$avatar?>" width="30" height="30" alt="<?=$avatar?>" align="middle"><br>
		</td>
		<?		
		if (++$count >= count($files)) break;
	}
	?>
	</tr>
	<?
}
?>
</table>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -