/** * @return string */ function _getSkinFilePath($skin = null) { global $_conf; $skinFilePath = ''; if ($skin) { $skinFilePath = P2Util::getSkinFilePathBySkinName($skin); } elseif ($skin_setting_path = _getSkinSettingPath()) { $skinFilePath = P2Util::getSkinFilePathBySkinName($skin_setting_path); } if (!$skinFilePath || !is_file($skinFilePath)) { $skinFilePath = $_conf['conf_user_style_inc_php']; } return $skinFilePath; }
/** * スキン設定を更新し、ページをリロードする * * @return false 成功すれば、そのままページリダイレクトされる */ function _updateSkinSetting($newskin) { global $_conf; if ($newskin !== '') { if (!preg_match('/^\\w+$/', $newskin)) { P2Util::pushInfoHtml(sprintf("<p>p2 error: 不正なスキン (%s) が指定されました。</p>", hs($newskin))); return false; } $skinFilePath = P2Util::getSkinFilePathBySkinName($newskin); if (!file_exists($skinFilePath)) { P2Util::pushInfoHtml(sprintf("<p>p2 error: 不正なスキン (%s) が指定されました。</p>", hs($newskin))); return false; } } FileCtl::make_datafile($_conf['skin_setting_path'], $_conf['skin_setting_perm']); if (false === file_put_contents($_conf['skin_setting_path'], $newskin, LOCK_EX)) { P2Util::pushInfoHtml("<p>p2 error: スキン設定を書き込めませんでした。</p>"); return false; } $sid_q = defined('SID') && strlen(SID) ? '&' . SID : ''; header("Location: {$_SERVER['SCRIPT_NAME']}?reload_skin=1" . $sid_q); exit; }
/** * @return void */ function _setStyle() { global $_conf, $STYLE, $MYSTYLE; // デフォルトCSS設定($STYLE, $MYSTYLE)を読み込む include_once $_conf['conf_user_style_inc_php']; if ($_conf['skin'] = P2Util::getSkinSetting()) { // スキンで$STYLEを上書き $skinfile = P2Util::getSkinFilePathBySkinName($_conf['skin']); if (file_exists($skinfile)) { include_once $skinfile; } } // $STYLE設定の調整処理 //if ($_SERVER['SCRIPT_NAME'] == 'css.php') { foreach ($STYLE as $k => $v) { if (empty($v)) { $STYLE[$k] = ''; } elseif (strpos($k, 'fontfamily') !== false) { $STYLE[$k] = p2_correct_css_fontfamily($v); } elseif (strpos($k, 'color') !== false) { $STYLE[$k] = p2_correct_css_color($v); } elseif (strpos($k, 'background') !== false) { $STYLE[$k] = 'url("' . p2_escape_css_url($v) . '")'; } } //} }