Пример #1
0
function apms_widget($wname, $wid = '', $opt = '', $mopt = '', $wdir = '', $addon = '')
{
    global $is_admin, $is_demo, $is_wdir;
    if ($wdir) {
        $widget_path = $wdir . '/' . $wname;
        $widget_url = str_replace(G5_PATH, G5_URL, $wdir) . '/' . $wname;
        $wdir = str_replace(G5_PATH, '', $wdir);
    } else {
        if ($is_wdir) {
            $widget_url = G5_URL . $is_wdir . '/' . $wname;
            $widget_path = G5_PATH . $is_wdir . '/' . $wname;
            $wdir = $is_dir;
        } else {
            if ($addon) {
                // 애드온
                $widget_url = G5_SKIN_URL . '/addon/' . $wname;
                $widget_path = G5_SKIN_PATH . '/addon/' . $wname;
            } else {
                $widget_url = THEMA_URL . '/widget/' . $wname;
                $widget_path = THEMA_PATH . '/widget/' . $wname;
            }
        }
    }
    if (!is_file($widget_path . '/widget.php')) {
        return;
    }
    $wid = apms_escape_string($wid);
    if ($wid) {
        $wset = apms_widget_config($wid, $opt, $mopt, $addon);
        $setup_href = '';
        if ($is_demo || $is_wdir || $is_admin == 'super') {
            $setup_href = G5_BBS_URL . '/widget.setup.php?wid=' . urlencode($wid) . '&wname=' . urlencode($wname) . '&thema=' . urlencode(THEMA);
            if ($addon) {
                $setup_href .= '&add=' . $addon;
            }
            if ($opt) {
                $setup_href .= '&opt=' . urlencode($opt);
            }
            if ($mopt) {
                $setup_href .= '&mopt=' . urlencode($mopt);
            }
            if ($wdir) {
                $setup_href .= '&wdir=' . urlencode($wdir);
            }
            if ($is_demo) {
                $setup_href .= '&wdemo=1';
            }
        }
    } else {
        if ($opt) {
            $wset = apms_query($opt);
            if (G5_IS_MOBILE && $wset && $mopt) {
                $wset = array_merge($wset, apms_query($mopt));
            }
        }
    }
    // 초기값
    $wset['new'] = isset($wset['new']) && $wset['new'] ? $wset['new'] : 'red';
    $wset['cache'] = isset($wset['cache']) && $wset['cache'] > 0 ? $wset['cache'] : 0;
    ob_start();
    @(include $widget_path . '/widget.php');
    $widget = ob_get_contents();
    ob_end_clean();
    return $widget;
}
Пример #2
0
    } else {
        alert_close('값이 넘어오지 않았습니다.');
    }
}
if (!file_exists($widget_file)) {
    alert_close('설정을 할 수 없는 위젯입니다.');
}
// 불러오기
$row = sql_fetch("select data_set, data_1 from {$g5['apms_data']} where type = '{$type}' and data_q = '{$wid}' limit 1 ");
if ($row['data_set']) {
    $wset = apms_unpack($row['data_set']);
    $wmset = apms_unpack($row['data_1']);
} else {
    if (isset($opt) && $opt) {
        $wset = apms_query($opt);
        $wmset = isset($mopt) && $mopt ? apms_query($mopt) : $wset;
    }
}
if ($add) {
    // 애드온
    $txt = '애드온';
    $loc = $wdir ? $wdir : '/skin/addon/' . $wname;
} else {
    $txt = '위젯';
    $loc = $wdir ? $wdir : '/thema/' . THEMA . '/widget/' . $wname;
}
$g5['title'] = $txt . ' 설정';
include_once G5_PATH . '/head.sub.php';
?>
<style>
 .local_desc01 ul, .local_desc01 ol { padding-bottom:0px; }