function module_lang_lists() { global $smarty; $obj = new varia(); $obj->set_where("var_name = 'languages'"); $list = $obj->get_list(); for ($i = 0; $i < count($list); $i++) { $arr = explode('{v}', $list[$i]['var_value']); $list[$i]['pack_name'] = $arr[0]; $list[$i]['index_entrance'] = $arr[1]; $list[$i]['admin_entrance'] = $arr[2]; $list[$i]['chinese_name'] = $arr[3]; $list[$i]['foreign_name'] = $arr[4]; } $smarty->assign('lang_list', $list); $smarty->assign('S_LANG', S_LANG); $smarty->assign('pack', get_folder_list('languages')); }
function module_pic_lists() { global $smarty; $list_public = get_file_list('images'); $smarty->assign('list_public', $list_public); $list_editor = get_folder_list('images/editor'); $smarty->assign('list_editor', $list_editor); $k = 0; $lists = array(); $obj = new channel(); $list = $obj->get_list(); for ($i = 0; $i < count($list); $i++) { $arr = get_folder_list('images/' . $list[$i]['cha_code']); if (count($arr)) { $k++; $lists[$k]['channel'] = $list[$i]['cha_code']; $lists[$k]['name'] = $list[$i]['cha_name']; $lists[$k]['folder'] = $arr; } } $smarty->assign('lists', $lists); $smarty->assign('host', $_SERVER['HTTP_HOST']); }
function create_folder_from_path($folder_path) { global $site; $folder_path = trim($folder_path); // only public folders if (strpos($folder_path, 'public/') === 0) { $public_folders = get_folder_list('public'); $folders = array(); foreach ($public_folders as $folder) { $folders[$folder['objekt_id']] = preg_replace('#^/#', '', $folder['relative_path']); } $folders[$site->alias(array('key' => 'public', 'keel' => 1))] = 'public'; $folder_id = (int) array_search($folder_path, $folders); // if folder id doesn't exist create folder if (!$folder_id) { $folder_path_parts = explode('/', $folder_path); $folders_to_create = array(); while ($folder = array_pop($folder_path_parts)) { $folders_to_create[] = $folder; $folder_id = (int) array_search(implode('/', $folder_path_parts), $folders); if ($folder_id) { break; } } $folders_to_create = array_reverse($folders_to_create); if ($folder_id) { foreach ($folders_to_create as $folder) { $folder_create_result = create_folder($folder, $folder_id); if (!is_int($folder_create_result)) { return $folder_create_result; } else { $folder_id = $folder_create_result; } } return $folder_id; } else { return 'cant_create_folder'; } } else { return $folder_id; } } else { return 'no_such_folder'; } }
echo $upl; } else { echo $upl; } ?> <div class="alerts alert_info" style="display:none">Laster opp.. vennligst vent!</div> <form action="upload.php" id="upload_form" method="post" name="dirSelector" enctype="multipart/form-data"> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td class="column1"><label id="ch_folder" for="align">Velg mappe</label></td> <td> <select id="dirOptions" name="dirOptions" class="selector"> <option value="">..</option> <?php echo get_folder_list(); ?> </select> </td> </tr> <tr> <td>Velg bilde</td> <td><input type="file" name="vImage" id="vImage" /></td> </tr> <tr> <td>Bildebredde (px)</td> <td><input type="text" name="img_width" style="width:50px" id="img_width" value="<?php echo DEFAULT_IMG_WIDTH; ?> " /></td> </tr>