function getTemplates($template = "") { global $db; $dir = @dir(DIR_FS_CATALOG_TEMPLATES); if (!$dir) { die('DIR_FS_CATALOG_TEMPLATES NOT SET'); } $template_info = array(); while ($file = $dir->read()) { if (is_dir(DIR_FS_CATALOG_TEMPLATES . $file) && strtoupper($file) != 'CVS' && $file != '.svn') { if ($template == "" || $template == $file) { if (file_exists(DIR_FS_CATALOG_TEMPLATES . $file . '/template_info.php')) { require DIR_FS_CATALOG_TEMPLATES . $file . '/template_info.php'; // カラー設定 // デフォルト $template_color = array(array('key' => EASY_DESIGN_DEFAULT_MAIN_KEY, 'name' => EASY_DESIGN_DEFAULT_MAIN_COLOR_NAME, 'value' => EASY_DESIGN_DEFAULT_MAIN_COLOR), array('key' => EASY_DESIGN_DEFAULT_SUB_KEY, 'name' => EASY_DESIGN_DEFAULT_SUB_COLOR_NAME, 'value' => EASY_DESIGN_DEFAULT_SUB_COLOR)); // ファイルから if (file_exists(DIR_FS_CATALOG_TEMPLATES . $file . '/color_config.php')) { require DIR_FS_CATALOG_TEMPLATES . $file . '/color_config.php'; } // データベースから $template_color = array_merge($template_color, getTemplateColor($file)); // テーブル更新 updateTemplateColor($file, $template_color); // 再度データベースから $template_color = getTemplateColor($file); $template_info[] = array('name' => $template_name, 'version' => $template_version, 'author' => $template_author, 'description' => $template_description, 'screenshot' => $template_screenshot, 'file' => $file, 'color' => $template_color, 'id' => $file, 'text' => $template_name); } } } } return $template_info; }
// テンプレート名が設定されている事 $template = $_REQUEST['template']; if ($template != "") { $template_color = array(); $i = 0; // POSTされた全データを対象とする // (keyが追加されても大丈夫なように) for (;;) { if (!isset($_REQUEST['template_color_key'][$i]) || !isset($_REQUEST['template_color_name'][$i]) || !isset($_REQUEST['template_color_picker'][$i])) { break; } $template_color[] = array('key' => $_REQUEST['template_color_key'][$i], 'name' => $_REQUEST['template_color_name'][$i], 'value' => $_REQUEST['template_color_picker'][$i]); $i++; } if (count($template_color)) { updateTemplateColor($template, $template_color); // 更新したので、テンプレート情報取得 $template_info = getTemplates(); // css更新 if (updateCssFromTemplateColor($template)) { $message .= "<br/>" . TEXT_UPDATE_SUCCESS_COLOR; } else { $error .= "<br/>" . TEXT_UPDATE_FAILURE_COLOR; } } } } else { if ($action == "recovery_color") { // 色の初期化 // テンプレート名が設定されている事 $template = $_REQUEST['template'];