[3531] | 1 | <?php |
---|
| 2 | |
---|
| 3 | // Load module language |
---|
| 4 | function get_flash_modules_language($type = null) |
---|
| 5 | { |
---|
| 6 | $dir = opendir( FLASHGAL_PATH . 'modules/'); |
---|
| 7 | if ($type != null) |
---|
| 8 | { |
---|
| 9 | $path = FLASHGAL_PATH . 'modules/' . $type; |
---|
| 10 | if (is_dir($path) and !is_link($path)) |
---|
| 11 | { |
---|
| 12 | load_language('module.lang', $path .'/'); |
---|
| 13 | } |
---|
| 14 | } |
---|
| 15 | |
---|
| 16 | else |
---|
| 17 | { |
---|
| 18 | while ($file = readdir($dir)) { |
---|
| 19 | if ($file != '.' and $file != '..') |
---|
| 20 | { |
---|
| 21 | $path = FLASHGAL_PATH . 'modules/' . $file; |
---|
| 22 | if (is_dir($path) and !is_link($path)) |
---|
| 23 | { |
---|
| 24 | if (load_language('module.lang', $path .'/') == false) continue; |
---|
| 25 | } |
---|
| 26 | } |
---|
| 27 | } |
---|
| 28 | } |
---|
| 29 | closedir($dir); |
---|
| 30 | } |
---|
| 31 | |
---|
| 32 | |
---|
| 33 | function get_flashgal_modules() |
---|
| 34 | { |
---|
| 35 | $IsVisible = 'visible'; |
---|
| 36 | $dir = opendir(FLASHGAL_PATH . 'modules/'); |
---|
| 37 | while ($file = readdir($dir)) { |
---|
| 38 | if ($file != '.' and $file != '..') { |
---|
| 39 | $path = FLASHGAL_PATH . 'modules/' . $file; |
---|
| 40 | if (is_dir($path) and !is_link($path) |
---|
| 41 | and file_exists($path.'/'.$IsVisible)) // Possibility to mask some modules |
---|
| 42 | { |
---|
| 43 | |
---|
| 44 | $screenshot = (file_exists(FLASHGAL_PATH . 'modules/'.$file.'/screenshot.jpg') ? FLASHGAL_PATH . 'modules/'.$file.'/screenshot.jpg' : ''); |
---|
| 45 | $modules[$file] = array('type' => $file, |
---|
| 46 | 'name' => l10n('module_name_' . $file), |
---|
| 47 | 'description' => sprintf(l10n('module_desc_' . $file), $screenshot)); |
---|
| 48 | } |
---|
| 49 | } |
---|
| 50 | } |
---|
| 51 | closedir($dir); |
---|
| 52 | if (isset($modules)) |
---|
| 53 | { |
---|
| 54 | uasort($modules, 'name_compare'); |
---|
| 55 | return $modules; |
---|
| 56 | } |
---|
| 57 | else |
---|
| 58 | return NULL; |
---|
| 59 | } |
---|
| 60 | |
---|
| 61 | function get_html_groups_selection( |
---|
| 62 | $groups, |
---|
| 63 | $fieldname, |
---|
| 64 | $selecteds = array() |
---|
| 65 | ) |
---|
| 66 | { |
---|
| 67 | global $conf; |
---|
| 68 | if (count ($groups) == 0 ) |
---|
| 69 | { |
---|
| 70 | return ''; |
---|
| 71 | } |
---|
| 72 | $output = '<div id="'.$fieldname.'">'; |
---|
| 73 | $id = 1; |
---|
| 74 | foreach ($groups as $group) |
---|
| 75 | { |
---|
| 76 | $output.= |
---|
| 77 | |
---|
| 78 | '<input type="checkbox" name="'.$fieldname.'[]"' |
---|
| 79 | .' id="group_'.$id++.'"' |
---|
| 80 | .' value="'.$group['id'].'"' |
---|
| 81 | ; |
---|
| 82 | |
---|
| 83 | if (in_array($group['id'], $selecteds)) |
---|
| 84 | { |
---|
| 85 | $output.= ' checked="checked"'; |
---|
| 86 | } |
---|
| 87 | |
---|
| 88 | $output.= |
---|
| 89 | '><label>' |
---|
| 90 | .' '. $group['name'] |
---|
| 91 | .'</label>' |
---|
| 92 | ."\n" |
---|
| 93 | ; |
---|
| 94 | } |
---|
| 95 | $output.= '</div>'; |
---|
| 96 | |
---|
| 97 | return $output; |
---|
| 98 | } |
---|
| 99 | |
---|
| 100 | |
---|
| 101 | function get_all_groups() |
---|
| 102 | { |
---|
| 103 | $query = ' |
---|
| 104 | SELECT id, name |
---|
| 105 | FROM '.GROUPS_TABLE.' |
---|
| 106 | ORDER BY name ASC |
---|
| 107 | ;'; |
---|
| 108 | $result = pwg_query($query); |
---|
| 109 | |
---|
| 110 | $groups = array(); |
---|
| 111 | while ($row = mysql_fetch_assoc($result)) |
---|
| 112 | { |
---|
| 113 | array_push($groups, $row); |
---|
| 114 | } |
---|
| 115 | |
---|
| 116 | uasort($groups, 'name_compare'); |
---|
| 117 | return $groups; |
---|
| 118 | } |
---|
| 119 | |
---|
| 120 | ?> |
---|