Esempio n. 1
0
    $t = 'img';
}
$list = array();
// first build a list of icons from our local directory
$dir = $ps->conf['theme']['icons_dir'];
$url = $ps->conf['theme']['icons_url'];
if ($dh = @opendir($dir)) {
    while (($file = @readdir($dh)) !== false) {
        if (substr($file, 0, 1) == '.') {
            continue;
        }
        // skip dot files
        $fullfile = catfile($dir, $file);
        if (is_dir($fullfile)) {
            continue;
        }
        // skip directories
        if (is_link($fullfile)) {
            continue;
        }
        // skip symlinks
        $info = getimagesize($fullfile);
        $size = @filesize($fullfile);
        $list[$file] = array('filename' => rawurlencode($file), 'url' => catfile($url, rawurlencode($file)), 'desc' => ps_escape_html(sprintf("%s - %dx%d - %s", $file, $info[0], $info[1], abbrnum($size))), 'size' => $size, 'width' => $info[0], 'height' => $info[1], 'attr' => $info[3]);
    }
    @closedir($dh);
}
ksort($list);
$fields = array('filename', 'url', 'size', 'width', 'height');
output_list($t, $list, $fields, $idstr);
Esempio n. 2
0
while ($row = $db->sql_fetchrow($result))
{
	unset($row['auth_option_id']);
	$permissions[] = $row;
}

output_list($permissions, 'auth_option');
*/
$modules = array();
$sql = 'SELECT * FROM ' . MODULES_TABLE . '
	ORDER BY module_id ASC';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
    $modules[] = $row;
}
output_list($modules, 'module_id', true);
die;
function output_list($data, $key, $list_key = false)
{
    $max_length = 0;
    foreach ($data as $row) {
        if (utf8_strlen($row[$key]) > $max_length) {
            $max_length = utf8_strlen($row[$key]);
        }
    }
    $total_tabs = ceil(($max_length + 3) / 4);
    $output = '';
    foreach ($data as $row) {
        if ($list_key == false) {
            $output .= "\t\t\t'{$row[$key]}'";
            $tabs = $total_tabs - ceil((utf8_strlen($row[$key]) + 3) / 4);