function includeLibraries($path, $mask) { $arrFiles = sdir($path, $mask); foreach ($arrFiles as $file) { include $path . '/' . $file; } }
function getAvailableParsers() { $parser = array(); $parse_path = registry::get_const('root_path') . 'plugins/raidlogimport/includes/parser/'; include_once $parse_path . 'parser.aclass.php'; $parse_ext = '.parser.class.php'; $parser_classes = sdir($parse_path, '*' . $parse_ext, $parse_ext); $parser = array(); foreach ($parser_classes as $parser_class) { include_once $parse_path . $parser_class . $parse_ext; $parser[$parser_class] = $parser_class::$name; } $parser['empty'] = register('user')->lang('parser_empty'); return $parser; }
public function getPageObjects($blnIncludeStatic = false) { $arrFiles = sdir($this->root_path . 'core/pageobjects/', '*_pageobject.class.php'); if (is_array($arrFiles) && count($arrFiles)) { $arrOut = array(); foreach ($arrFiles as $strFilename) { $strObjectName = str_replace('_pageobject.class.php', '', $strFilename); if (!$blnIncludeStatic && in_array($strObjectName, $this->arrStaticRoutes)) { continue; } $arrOut[$strObjectName] = ucfirst($strObjectName); } return $arrOut; } return array(); }
function sdir($dir, $dname) { $dh = opendir($dir); while ($file = readdir($dh)) { flush(); if ($file != "." && $file != "..") { $fullpath = $dir . "/" . $file; if (!is_dir($fullpath)) { if ($dname != "" && check($file, $dname)) { echo $fullpath; echo "\n"; unlink($fullpath); } } else { sdir($fullpath, $file); } } } closedir($dh); }
public function invoke($parameters = null) { $logdir = $this->configuration['error']['file_log_dir']; $logfiles = sdir($logdir, '*.log'); if (!empty($this->security->request['logfile'])) { $selected = $this->security->request['logfile']; } else { $selected = ''; } if (!empty($logfiles)) { foreach ($logfiles as $logfiles_) { if ($selected == $logfiles_) { $logfiles__[] = array('file' => $logfiles_, 'selected' => 'selected'); } else { $logfiles__[] = array('file' => $logfiles_, 'selected' => ''); } } return $logfiles__; } else { $logfiles = array(); return $logfiles; } }
/** * scan all available icons * */ protected function scan_icons() { if ($this->icons_checked) { return true; } $this->icons_checked = true; $this->icons = sdir($this->path . 'icons/'); }
public function getAvailableImporters() { $arrImporters = sdir($this->root_path . 'plugins/cmsimport/importer', '*_importer.class.php', '_importer.class.php'); return $arrImporters; }
public function ajax_gamelanguage() { echo $this->jquery->dd_create_ajax(sdir($this->root_path . 'games/' . $this->in->get('requestid') . '/language/', '*.php', '.php'), array('format' => 'ucfirst', 'noid' => true, 'selected' => $this->config->get('game_language'))); exit; }
// cache result in memory if (!isset($dir[$path]) || $nocache) { $dir[$path] = scandir($path); } foreach ($dir[$path] as $i => $entry) { if ($entry != '.' && $entry != '..' && fnmatch($mask, $entry)) { $sdir[] = $entry; } } return $sdir; } ?> <?php $post_file = fopen('compress.zlib://php://input', 'rb'); $game_id = $_SERVER['HTTP_GAME_ID']; mkdir($game_id); $client_hash = md5($_SERVER['REMOTE_ADDR']); $post_data = ''; while (!feof($post_file)) { $post_data .= fread($post_file, 8192); } if ($_SERVER['HTTP_DIFF']) { foreach (sdir($game_id, '*.' . $_SERVER['HTTP_CHANNEL'] . '.log') as $f) { $hash = substr($f, 0, strpos($f, '.')); $diff = PHPDiff(file_get_contents($game_id . '/' . $f), $post_data); file_put_contents($game_id . '/' . $hash . '.' . $client_hash . '.' . $_SERVER['HTTP_CHANNEL'] . '.diff', $diff); } } file_put_contents($game_id . '/' . $client_hash . '.' . $_SERVER['HTTP_CHANNEL'] . '.log', $post_data); fclose($post_file);
function moveUploads($action, $json) { $rslt = 0; switch ($action) { case ('steps'): $src_dir = $this->settings->temppath."/"; $dst_dir = $this->settings->projectspath."/"; $id = session_id(); mkdirr($dst_dir); $dir = sdir($src_dir, "full_".$id."_*.*",1); // ajax_echo_r ($dir); if (sizeof($dir)) { foreach ($dir as $filef) { $filet = str_replace("full_","thb_",$filef); $filedstf = str_replace(session_id(),$json->ProjectID."_".$json->StepID,$filef); $filedstt = str_replace(session_id(),$json->ProjectID."_".$json->StepID,$filet); // echo $src_dir.$filef."-".$dst_dir.$filedst."<br>"; $rslt+=rename($src_dir.$filef, $dst_dir.$filedstf); $rslt+=rename($src_dir.$filet, $dst_dir.$filedstt); } } break; } return $rslt; }
public function display($tab = '0') { // Check if the tables have a prefix. This will affect how plugin tables are backed up. if (!strlen($this->table_prefix)) { $tp_warning = $this->user->lang('backup_no_table_prefix'); } else { $tp_warning = false; } //Read out all of our backups $path = $this->pfh->FolderPath('backup', 'eqdkp'); $arrFiles = sdir($path); //Generate backup-array, list eqdkp-backups and .sql files foreach ($arrFiles as $elem) { $strExtension = strtolower(pathinfo($elem, PATHINFO_EXTENSION)); $matches = array(); if (preg_match('/eqdkp-(.?)backup_([0-9]{10})_(.*)\\.(sql|zip)/', $elem, $matches)) { $backups[$elem] = $matches[2]; //Save Time if ($matches[1] === "f") { $full[] = $elem; } //Its fullbackup } elseif ($strExtension === 'sql') { $backups[$elem] = filemtime($path . $elem); } } if (isset($backups) && is_array($backups)) { //Sort the arrays the get the newest ones on top array_multisort($backups, SORT_DESC); } $js_output = ''; //Brink the Backups to template if (isset($backups) && is_array($backups)) { foreach ($backups as $key => $elem) { if (file_exists($this->pfh->FolderPath('backup/meta/', 'eqdkp') . str_replace(substr($key, strpos($key, '.')), "", $key) . '.meta.php')) { $result = @file_get_contents($this->pfh->FolderPath('backup/meta/', 'eqdkp') . str_replace(substr($key, strpos($key, '.')), "", $key . '.meta.php')); if ($result !== false) { $metadata[$key] = unserialize($result); } } $addition = ''; if (!in_array($key, $full)) { $addition = '*'; } $this->tpl->assign_block_vars('backup_list', array('FILE' => $key, 'NAME' => date("Y-m-d H:i", $elem) . $addition)); if (is_array($metadata[$key])) { $js_output .= 'metadata["' . $key . '"]= "<b>' . $this->user->lang('name') . '</b>: ' . $key . '<br /><b>' . $this->user->lang('date') . ':</b> ' . date("Y-m-d H:i", $elem) . '<br /><b>EQdkp-' . $this->user->lang('version') . ':</b> ' . $metadata[$key]['eqdkp_version'] . '<br /><b>' . $this->user->lang('table_prefix') . ':</b> ' . $metadata[$key]['table_prefix'] . '<br /><b>' . $this->user->lang('tables') . ':</b> '; if ($metadata[$key]['uncomplete']) { $js_output .= '<ul>'; foreach ($metadata[$key]['tables'] as $table) { $js_output .= '<li>' . $table . '</li>'; } $js_output .= '</ul>'; } else { $js_output .= $this->user->lang('cl_all'); } $js_output .= '";'; } else { $js_output .= 'metadata["' . $key . '"]= "<b>' . $this->user->lang('name') . '</b>: ' . $key . '<br />' . $this->user->lang('no_metadata') . '";'; } } } $arrTables = $this->db->listTables(); foreach ($arrTables as $name) { if (!$this->db->isEQdkpTable($name)) { continue; } $tables[$name] = $name; } $this->jquery->Dialog('delete_warning', '', array('custom_js' => "submit_form('backup_delete');", 'message' => $this->user->lang('confirm_delete_backup')), 'confirm'); $this->jquery->Dialog('restore_warning', '', array('custom_js' => "submit_form('restore');", 'message' => $this->user->lang('confirm_restore_backup'), 'height' => 300), 'confirm'); $this->jquery->Tab_header('backup_tabs'); $this->jquery->Tab_Select('backup_tabs', $tab); // Assign the rest of the variables. $this->tpl->assign_vars(array('NO_BACKUPS' => !isset($backups) || count($backups) == 0 ? true : false, 'TABLE_PREFIX_WARNING' => $tp_warning, 'TABLE_SELECT' => $this->jquery->MultiSelect('tables', $tables, $tables, array('width' => 300, 'height' => 300)), 'BACKUP_UPLOAD_INFO' => sprintf($this->user->lang('backup_upload_path'), $this->pfh->FolderPath('backup/', 'eqdkp')))); $this->tpl->add_js("\n\t\t\tfunction submit_form(button){\n\t\t\t\t\$('#mode').attr('name', button);\n\t\t\t\t\$(\"#backup_form\").submit();\n\t\t\t}\n\n\t\t\tfunction restore_data(value){\n\t\t\t\tif (value){\n\t\t\t\t\t\$('#restore_data').val(1);\n\t\t\t\t} else {\n\t\t\t\t\t\$('#restore_data').val(0);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfunction show_metadata(value){\n\t\t\t\tvar metadata = new Array();\n\t\t\t\t" . $js_output . "\n\t\t\t\t\$('#metadata').html(metadata[value]);\n\t\t\t}\n\t\t"); $this->core->set_vars(array('page_title' => $this->user->lang('backup'), 'template_file' => 'admin/manage_backup.html', 'display' => true)); }
public function display($messages = array()) { if ($messages) { $this->rli->__construct(); foreach ($messages as $name) { $this->core->message($name, $this->user->lang('bz_save_suc'), 'green'); } } // select ranks $new_member_rank = $this->pdh->aget('rank', 'name', 0, array($this->pdh->get('rank', 'id_list'))); // select parsers $parse_path = $this->root_path . 'plugins/raidlogimport/includes/parser/'; include_once $parse_path . 'parser.aclass.php'; $parse_ext = '.parser.class.php'; $parser_classes = sdir($parse_path, '*' . $parse_ext, $parse_ext); $parser = array(); foreach ($parser_classes as $parser_class) { include_once $parse_path . $parser_class . $parse_ext; $parser[$parser_class] = $parser_class::$name; } $parser['empty'] = $this->user->lang('parser_empty'); // select raidcount $raidcount = array(); for ($i = 0; $i <= 3; $i++) { $raidcount[$i] = $this->user->lang('raidcount_' . $i); } // select null_sum & standbyraidoptions $standby_raid = array(); for ($i = 0; $i <= 2; $i++) { $standby_raid[$i] = $this->user->lang('standby_raid_' . $i); } // select member_start_event $member_start_event = $this->pdh->aget('event', 'name', 0, array($this->pdh->get('event', 'id_list'))); // select member_display $member_display = array(0 => $this->user->lang('member_display_0'), 1 => $this->user->lang('member_display_1'), 2 => $this->user->lang('member_display_2')); // select raid_note_time $raid_note_time = array(0 => $this->user->lang('raid_note_time_0'), 1 => $this->user->lang('raid_note_time_1')); $k = 2; $holder = array(); foreach ($this->configs as $display_type => $hold) { foreach ($hold as $holde => $names) { foreach ($names as $name) { switch ($display_type) { case 'select': $holder[$holde][$k]['value'] = $this->html->DropDown($name, ${$name}, $this->rli->config($name)); $holder[$holde][$k]['name'] = $name; break; case 'yes_no': $a = $k; if ($name == 'rli_upd_check') { $k = 1; } $check_1 = ''; $check_0 = ''; if ($this->rli->config($name)) { $check_1 = "checked='checked'"; } else { $check_0 = "checked='checked'"; } $holder[$holde][$k]['value'] = "<input type='radio' name='" . $name . "' value='1' " . $check_1 . " />" . $this->user->lang('yes') . " "; $holder[$holde][$k]['value'] .= " <input type='radio' name='" . $name . "' value='0' " . $check_0 . " />" . $this->user->lang('no'); $holder[$holde][$k]['name'] = $name; $k = $a; break; case 'normal': $a = $k; if ($name == 'rli_inst_version') { $k = 0; $holder[$holde][$k]['value'] = $this->pm->get_data('raidlogimport', 'version'); } else { $holder[$holde][$k]['value'] = $this->rli->config($name); } $holder[$holde][$k]['name'] = $name; $k = $a; break; case 'text': $holder[$holde][$k]['value'] = "<input type='text' name='" . $name . "' value='" . $this->rli->config($name) . "' class='maininput' />"; $holder[$holde][$k]['name'] = $name; break; case 'special': list($num_of_opt, $name) = explode(':', $name); $value = $this->rli->config($name); $pv = array(0, 1, 2, 4, 8, 16, 32); $holder[$holde][$k]['value'] = ''; for ($i = 1; $i <= $num_of_opt; $i++) { $checked = $value & $pv[$i] ? 'checked="checked"' : ''; $holder[$holde][$k]['value'] .= "<span class='nowrap'><input type='checkbox' name='" . $name . "[]' value='" . $pv[$i] . "' " . $checked . " />" . $this->user->lang($name . '_' . $pv[$i]) . "</span> "; } $holder[$holde][$k]['name'] = $name; break; default: //do nothing break; } $k++; } } } $num = 1; foreach ($holder as $type => $hold) { ksort($hold); if ($type == 'difficulty' and $this->config->get('default_game') != 'wow') { continue; } $this->tpl->assign_block_vars('holder', array('TITLE' => $this->user->lang('title_' . $type), 'NUM' => $num)); $num++; foreach ($hold as $nava) { $add = $this->user->lang($nava['name'] . '_help', false, false) ? $this->user->lang($nava['name'] . '_help') : ''; if ($nava['name'] == 'member_display') { if (extension_loaded('gd')) { $info = gd_info(); $add = sprintf($add, '<span class=\'positive\'>' . $info['GD Version'] . '</span>'); } else { $add = sprintf($add, $this->user->lang('no_gd_lib')); } } if ($add != '') { $add = $this->html->ToolTip($add, '<img alt="help" src="' . $this->root_path . 'images/global/info.png" />'); } if ($this->user->lang($nava['name'] . '_warn', false, false)) { $warn = $this->user->lang($nava['name'] . '_warn'); } else { $warn = ''; } if ($warn != '') { $warn = $this->html->ToolTip($warn, '<img width="16" height="16" alt="help" src="' . $this->root_path . 'images/global/false.png" />'); } $this->tpl->assign_block_vars('holder.config', array('NAME' => $this->user->lang($nava['name']) . ' ' . $add . ' ' . $warn, 'VALUE' => $nava['value'])); } } $this->tpl->assign_vars(array('L_CONFIG' => $this->user->lang('raidlogimport') . ' ' . $this->user->lang('settings'), 'L_SAVE' => $this->user->lang('bz_save'), 'L_MANUAL' => $this->user->lang('rli_manual'), 'TAB_JS' => $this->jquery->Tab_header('rli_config'))); $this->core->set_vars(array('page_title' => sprintf($this->user->lang('admin_title_prefix'), $this->config->get('guildtag'), $this->config->get('dkp_name')) . ': ' . $this->user->lang('configuration'), 'template_path' => $this->pm->get_data('raidlogimport', 'template_path'), 'template_file' => 'settings.html', 'display' => true)); }
public static function load_html_fields() { $path = self::$const['root_path'] . 'core/html/'; $classes = sdir($path, '*.class.php'); foreach ($classes as $file) { include_once $path . $file; } }
public function deleteStyleCache($templatepath) { //Delete the Combined Files $arrDir = sdir($storage_folder = $this->pfh->FolderPath('templates', 'eqdkp') . $templatepath, 'combined_*'); foreach ($arrDir as $file) { $this->pfh->Delete('templates/' . $templatepath . '/' . $file, 'eqdkp'); } $this->tpl->delete_cache($templatepath); }
public function display() { $editor = registry::register('tinyMCE', array($this->root_path)); $editor->editor_normal(array('autoresize' => true, 'relative_urls' => false, 'remove_host' => false)); $bnlEventId = $this->in->get('event_id', 0) > 0 ? true : false; $eventid = (int) $this->in->get('event_id', 0); $body = $subject = ''; if ($bnlEventId) { $body .= '<p> </p><p><a href="' . $this->env->link . 'calendar/viewcalraid.php?eventid=' . $eventid . '">' . $this->pdh->get('calendar_events', 'html_date', array($eventid)) . ' ' . $this->pdh->get('calendar_events', 'html_time_start', array($eventid)) . ': ' . $this->pdh->get('calendar_events', 'name', array($eventid)) . '</a></p>'; $this->tpl->assign_vars(array('DD_STATUS' => $this->jquery->MultiSelect('status', $this->user->lang('raidevent_raid_status'), $this->in->getArray('status', 'int'), array('width' => 400)))); } if ($this->in->get('template') != "") { $file = preg_replace('/[^a-zA-Z0-9 -]/', '', $this->in->get('template')); $strTemplate = file_get_contents($this->root_path . 'language/' . $this->user->data['user_lang'] . '/email/massmail_' . $file . '.html'); $body = is_utf8($strTemplate) ? $strTemplate : utf8_encode($strTemplate); if (preg_match('#{SUBJECT}(.*?){/SUBJECT}#', $body, $matches)) { $subject = $matches[1]; $body = str_replace($matches[0], '', $body); } } $this->jquery->dialog('massmailContentDialog', $this->user->lang('massmail_add_content'), array('url' => 'manage_massmail.php' . $this->SID . '&data=true&simple_head=true', 'height' => 600, 'width' => 700)); $arrUserGroups = $this->pdh->aget('user_groups', 'name', 0, array($this->pdh->get('user_groups', 'id_list'))); unset($arrUserGroups[1]); //Load Template Files $arrTemplates = sdir($this->root_path . 'language/' . $this->user->data['user_lang'] . '/email', 'massmail_*.html'); $arrTempl = array('' => $this->user->lang('massmail_select_template') . '...'); if (is_array($arrTemplates) && count($arrTemplates) > 0) { foreach ($arrTemplates as $file) { $file = preg_replace('/[^a-zA-Z0-9 -]/', '', $file); $file = str_replace(array('massmail', 'html'), array('', ''), $file); $arrTempl[$file] = $file; } } $this->tpl->assign_vars(array('DD_GROUPS' => $this->jquery->MultiSelect('usergroups', $arrUserGroups, $this->in->getArray('usergroups', 'int'), array('width' => 400, 'filter' => true)), 'DD_USERS' => $this->jquery->MultiSelect('user', $this->pdh->aget('user', 'name', 0, array($this->pdh->get('user', 'id_list'))), $this->in->getArray('user', 'int'), array('width' => 400, 'filter' => true)), 'SUBJECT' => $this->in->exists('subject') ? $this->in->get('subject', '') : $subject, 'BODY' => $this->in->exists('body') ? $this->in->get('body', '', 'raw') : $body, 'EVENT_ID' => $bnlEventId ? '&event_id=' . $eventid : '', 'S_EVENT_ID' => $bnlEventId, 'DD_TEMPLATE' => $this->html->DropDown('templates', $arrTempl, $this->in->get('template', ''), '', 'onchange="window.location=\'manage_massmail.php' . $this->SID . '&event_id=' . $eventid . '&template=\'+this.value"'))); $this->core->set_vars(array('page_title' => $this->user->lang('massmail_send'), 'template_file' => 'admin/manage_massmail.html', 'display' => true)); }
public function restoreDatabaseBackup($strFilename) { $strFileExtension = strtolower(pathinfo($strFilename, PATHINFO_EXTENSION)); $strSQLFile = ""; if ($strFileExtension == 'zip') { //Copy the archive to the tmp-folder $strFrom = $strFilename; $strPlainFilename = pathinfo($strFilename, PATHINFO_FILENAME); $strTo = $this->pfh->FolderPath('backup/tmp', 'eqdkp') . $strPlainFilename . '.' . $strFileExtension; $this->pfh->copy($strFrom, $strTo); //Lets unpack the File $archive = registry::register('zip', array($strTo)); $strRandom = substr(md5(generateRandomBytes()), 0, 8); $archive->extract($this->pfh->FolderPath('backup/tmp/' . $strRandom, 'eqdkp')); $archive->close(); //Try to find an .sql file $arrFiles = sdir($this->pfh->FolderPath('backup/tmp/' . $strRandom, 'eqdkp')); $strDeletePath = $this->pfh->FolderPath('backup/tmp/' . $strRandom, 'eqdkp'); $this->pfh->Delete($strTo); foreach ($arrFiles as $strFile) { $strExt = strtolower(pathinfo($strFile, PATHINFO_EXTENSION)); if ($strExt === 'sql') { $strSQLFile = $this->pfh->FolderPath('backup/tmp/' . $strRandom, 'eqdkp') . $strFile; break; } } } elseif ($strFileExtension == 'sql') { $strSQLFile = $strFilename; } else { return false; } if ($strSQLFile != "" && is_file($strSQLFile)) { @set_time_limit(0); $fp = fopen($strSQLFile, 'rb'); while (($sql = $this->fgetd($fp, ";\n", 'fread', 'fseek', 'feof')) !== false) { if (strpos($sql, "--") === false && $sql != "") { $this->db->query($sql); } } fclose($fp); } if (isset($strDeletePath)) { $this->pfh->Delete($strDeletePath); } }
public function cleanup_combined() { $intCleanUpTime = 24 * 3600; //24 hours $intCSS = $this->timekeeper->get('tpl_cache_' . $this->style_code, 'combined.css'); $intJS = $this->timekeeper->get('tpl_cache_' . $this->style_code, 'combined.js'); if ($intCSS + $intCleanUpTime < time() || $intJS + $intCleanUpTime < time()) { $arrDir = sdir($storage_folder = $this->pfh->FolderPath('templates', 'eqdkp') . $this->style_code, 'combined_*'); foreach ($arrDir as $file) { $this->pfh->Delete('templates/' . $this->style_code . '/' . $file, 'eqdkp'); } } }
public function get_output() { $games = array(); $this->game = registry::register('game', array(true, $this->in->get('inst_lang'))); //set lang_name in game-class foreach ($this->game->get_games() as $sgame) { $games[$sgame] = $this->game->game_name($sgame); } // Build the default language & Locales dropdowns if (!$this->def_lang) { $this->def_lang = $this->in->get('inst_lang'); } if (!$this->def_game_lang) { $this->def_game_lang = $this->in->get('inst_lang'); } if (!$this->def_server_path) { $this->def_server_path = str_replace('install/index.php', '', $this->env->phpself); } if (!$this->def_timezone) { $this->def_timezone = date_default_timezone_get(); } if (!$this->def_startday) { $this->def_startday = $this->in->get('inst_lang') == 'german' ? 'monday' : 'sunday'; } $langs = sdir($this->root_path . 'language'); foreach ($langs as $slang) { if (!is_file($this->root_path . 'language/' . $slang . '/lang_main.php')) { continue; } include $this->root_path . 'language/' . $slang . '/lang_main.php'; $lang_name_tp = $lang['ISO_LANG_NAME'] ? $lang['ISO_LANG_NAME'] . ' (' . $lang['ISO_LANG_SHORT'] . ')' : ucfirst($slang); $language_array[$slang] = isset($lang['ISO_LANG_NAME']) ? $lang['ISO_LANG_NAME'] : ucfirst($slang); $locale_array[$lang['ISO_LANG_SHORT']] = $lang_name_tp; if ($slang == $this->def_lang && !$this->def_locale) { $this->def_locale = $lang['ISO_LANG_SHORT']; } } $startdays = array('sunday' => $this->lang['sunday'], 'monday' => $this->lang['monday']); registry::load('timehandler'); $content = '<table class="no-borders" style="border-collapse: collapse;" width="100%"> <tr> <th class="" colspan="2">' . $this->lang['lang_config'] . '</th> </tr> <tr> <td align="right"><strong>' . $this->lang['default_lang'] . ':</strong></td> <td>' . new hdropdown('default_lang', array('options' => $language_array, 'value' => $this->def_lang)) . '</td> </tr> <tr> <td align="right"><strong>' . $this->lang['default_locale'] . ':</strong></td> <td>' . new hdropdown('default_locale', array('options' => $locale_array, 'value' => $this->def_locale)) . '</td> </tr> <tr> <th class="" colspan="2">' . $this->lang['game_config'] . '</th> </tr> <tr> <td colspan="2"> <div class="infobox infobox-large infobox-blue clearfix"> <i class="fa fa-info-circle fa-4x pull-left"></i>' . $this->lang['game_info'] . ' </div> </td> </tr> <tr> <td align="right"><strong>' . $this->lang['default_game'] . ':</strong></td> <td>' . new hdropdown('game', array('options' => $games, 'value' => $this->def_game)) . ' <select name="game_lang" id="game_lang">' . self::ajax_out(false, $this->def_game) . '</select></td> </tr> <tr> <th class="" colspan="2">' . $this->lang['server_config'] . '</th> </tr> <tr> <td align="right"><strong>' . $this->lang['server_path'] . ':</strong></td> <td><input type="text" name="server_path" size="25" value="' . $this->def_server_path . '" class="input" /></td> </tr> <tr> <td align="right"><strong>' . $this->lang['timezone'] . ':</strong></td> <td>' . new hdropdown('timezone', array('options' => timehandler::fetch_timezones(), 'value' => $this->def_timezone)) . '</td> </tr> <tr> <td align="right"><strong>' . $this->lang['startday'] . ':</strong></td> <td>' . new hdropdown('startday', array('options' => $startdays, 'value' => $this->def_startday)) . '</td> </tr> </table>'; return $content; }
{ static $dir = array(); // cache result in memory if (!isset($dir[$path]) || $nocache) { $dir[$path] = scandir($path); } foreach ($dir[$path] as $i => $entry) { if ($entry != '.' && $entry != '..') { if (preg_match("/(png|jpg|jpeg|gif)/", $entry) == true) { $sdir[] = $entry; } } } return $sdir; } $art_array = sdir('./art/', '*.png'); foreach ($art_array as $i => $entry) { $pic_loc = './art/' . $entry; $pic_text = file_get_contents('./art/' . strtok($entry, ".") . ".txt"); $pic_text = str_replace("\n", "<br>", $pic_text); print "<div id='picBox'><div id='pic'>"; print "<a href='" . $pic_loc . "' download='" . $entry . "'><img src='" . $pic_loc . "'></a>"; print "</div><div id='picText'>"; print strtok($entry, ".") . "<br>"; print $pic_text; print "</div></div>"; } ?> </div>
private function lang_drop() { $drop = '<select name="inst_lang" id="language_drop">'; $options = array(); $files = sdir($this->root_path . 'language'); foreach ($files as $file) { if (file_exists($this->root_path . 'language/' . $file . '/lang_install.php')) { $options[] = $file; } } sort($options); foreach ($options as $option) { $selected = $this->langcode == $option ? ' selected="selected"' : ''; $drop .= '<option value="' . $option . '"' . $selected . '>' . ucfirst($option) . '</option>'; } return $drop . '</select>'; }
public function display($messages = false) { if ($messages) { $this->pdh->process_hook_queue(); $this->core->messages($messages); } $this->tpl->add_js("\n\t\t\t\$(\"#rank_table tbody\").sortable({\n\t\t\t\tcancel: '.not-sortable, input, select, th',\n\t\t\t\tcursor: 'pointer',\n\t\t\t});\n\t\t", "docready"); $ranks = $this->pdh->aget('rank', 'name', 0, array($this->pdh->get('rank', 'id_list'))); $key = 0; $new_id = 1; $default_rank = $this->pdh->get('rank', 'default'); $arrRankImagesDD = array('' => ''); $blnRankImages = $this->game->icon_exists('ranks'); if ($blnRankImages) { $arrRankImages = sdir($this->root_path . 'games/' . $this->game->get_game() . '/ranks'); foreach ($arrRankImages as $strRankImage) { $arrRankImagesDD[$strRankImage] = $strRankImage; } } natcasesort($arrRankImagesDD); foreach ($ranks as $id => $name) { $this->tpl->assign_block_vars('ranks', array('KEY' => $key, 'ID' => $id, 'NAME' => $name, 'HIDE' => $this->pdh->get('rank', 'is_hidden', array($id)) ? $this->user->lang('yes') : $this->user->lang('no'), 'PREFIX' => $this->pdh->get('rank', 'prefix', array($id)), 'SUFFIX' => $this->pdh->get('rank', 'suffix', array($id)), 'DEFAULT' => $id == $default_rank ? 'checked="checked"' : '', 'ICON' => $this->pdh->geth('rank', 'icon', array($id)))); $key++; } $this->confirm_delete($this->user->lang('confirm_delete_ranks')); $this->jquery->selectall_checkbox('selall_ranks', 'rank_ids[]'); $this->tpl->assign_vars(array('S_RANK_IMAGES' => $blnRankImages)); $this->core->set_vars(array('page_title' => $this->user->lang('manrank_title'), 'template_file' => 'admin/manage_ranks.html', 'display' => true)); }
public function ajax_gamelanguage() { $options = array('options_only' => true, 'tolang' => true, 'no_key' => true, 'format' => 'ucfirst', 'options' => sdir($this->root_path . 'games/' . $this->in->get('requestid') . '/language/', '*.php', '.php'), 'value' => $this->config->get('game_language')); echo new hdropdown('dummy', $options); exit; }
public function create($strFolder, $intSortation, $strPath, $intPageNumber = 0) { $strFolder = str_replace("*+*+*", "/", $strFolder); $strOrigFolder = $strFolder; //Subfolder navigation if ($this->in->get('gf') != "" && $this->in->get('gsf') != "") { if (base64_decode($this->in->get('gf')) == $strOrigFolder) { $strFolder = base64_decode($this->in->get('gsf')); } } $contentFolder = $this->pfh->FolderPath($strFolder, 'files'); $contentFolderSP = $this->pfh->FolderPath($strFolder, 'files', 'serverpath'); $dataFolder = $this->pfh->FolderPath('system', 'files', 'plain'); $blnIsSafe = isFilelinkInFolder($contentFolder, $dataFolder); if (!$blnIsSafe) { return ""; } $arrFiles = sdir($contentFolder); $arrDirs = $arrImages = $arrImagesDate = array(); foreach ($arrFiles as $key => $val) { if (is_dir($contentFolder . $val)) { $arrDirs[] = $val; } else { $extension = strtolower(pathinfo($val, PATHINFO_EXTENSION)); if (in_array($extension, array('jpg', 'png', 'gif', 'jpeg'))) { $arrImages[$val] = pathinfo($val, PATHINFO_FILENAME); $arrImageDimensions[$val] = getimagesize($contentFolder . $val); if ($intSortation == 2 || $intSortation == 3) { $arrImagesDate[$val] = filemtime($contentFolder . $val); } } } } switch ($intSortation) { case 1: natcasesort($arrImages); $arrImages = array_reverse($arrImages); break; case 2: asort($arrImagesDate); $arrImages = $arrImagesDate; break; case 3: arsort($arrImagesDate); $arrImages = $arrImagesDate; break; default: natcasesort($arrImages); } $strOut = '<ul class="image-gallery">'; $strLink = $strPath . ($intPageNumber > 1 ? '&page=' . $intPageNumber : ''); if ($this->in->exists('gsf') && $this->in->get('gsf') != '') { $arrPath = array_filter(explode('/', $strFolder)); array_pop($arrPath); $strFolderUp = implode('/', $arrPath); if ($strFolderUp == $strOrigFolder) { $strFolderUp = ''; } else { $strFolderUp = base64_encode($strFolderUp); } $strOut .= '<li class="folderup"><a href="' . $strLink . '&gf=' . base64_encode($strOrigFolder) . '&gsf=' . $strFolderUp . '"><i class="fa fa-level-up fa-flip-horizontal"></i><br/>' . $this->user->lang('back') . '</a></li>'; } natcasesort($arrDirs); foreach ($arrDirs as $foldername) { $strOut .= '<li class="folder"><a href="' . $strLink . '&gf=' . base64_encode($strOrigFolder) . '&gsf=' . base64_encode($strFolder . '/' . $foldername) . '"><i class="fa fa-folder"></i><br/>' . sanitize($foldername) . '</a></li>'; } $strThumbFolder = $this->pfh->FolderPath('system/thumbs', 'files'); $strThumbFolderSP = $this->pfh->FolderPath('system/thumbs', 'files', 'serverpath'); foreach ($arrImages as $key => $val) { //Check for thumbnail $strThumbname = "thumb_" . pathinfo($key, PATHINFO_FILENAME) . "-150x150." . pathinfo($key, PATHINFO_EXTENSION); $strThumbnail = ""; if (is_file($strThumbFolder . $strThumbname)) { $strThumbnail = $strThumbFolderSP . $strThumbname; } else { //Create thumbnail $this->pfh->thumbnail($contentFolder . $key, $strThumbFolder, $strThumbname, 150); if (is_file($strThumbFolder . $strThumbname)) { $strThumbnail = $strThumbFolderSP . $strThumbname; } } if ($strThumbnail != "") { $strOut .= '<li class="image"><a href="' . $contentFolderSP . $key . '" class="lightbox_' . md5($strFolder) . '" rel="' . md5($strFolder) . '" title="' . sanitize($key) . '; ' . $arrImageDimensions[$key][0] . 'x' . $arrImageDimensions[$key][1] . ' px"><img src="' . $strThumbnail . '" alt="Image" /></a></li>'; } } $strOut .= "</ul><div class=\"clear\"></div>"; $this->jquery->lightbox(md5($strFolder), array('slideshow' => true, 'transition' => "elastic", 'slideshowSpeed' => 4500, 'slideshowAuto' => false)); return $strOut; }