예제 #1
0
파일: class.db.php 프로젝트: phannack/GCMS
/**
 *  Inint database driver
 *
 * @param string DNS string driver://username:password@hostname/database
 */
function &sql($params)
{
    if (($dns = @parse_url($params)) === FALSE) {
        $msg = 'Invalid DB Connection String';
        if (class_exists('gcms')) {
            gcms::writeDebug($msg);
        } else {
            echo $msg;
        }
    } else {
        $params = array('dbdriver' => strtolower($dns['scheme']), 'hostname' => isset($dns['host']) ? rawurldecode($dns['host']) : '', 'username' => isset($dns['user']) ? rawurldecode($dns['user']) : '', 'password' => isset($dns['pass']) ? rawurldecode($dns['pass']) : '', 'dbname' => isset($dns['path']) ? rawurldecode(substr($dns['path'], 1)) : '');
        // inint database class
        require_once ROOT_PATH . 'bin/drivers/class.db.driver.php';
        // driver class
        if (is_file(ROOT_PATH . 'bin/drivers/class.' . $params['dbdriver'] . '_driver.php')) {
            // โหลดจาก driver ที่กำหนด
            require_once ROOT_PATH . 'bin/drivers/class.' . $params['dbdriver'] . '_driver.php';
        } else {
            // ไม่พบ driver ใช้ pdo
            require_once ROOT_PATH . 'bin/drivers/class.pdo_driver.php';
        }
        // driver string
        $driver = strtoupper($params['dbdriver']) . '_DB_driver';
        // parse query string
        if (isset($dns['query'])) {
            parse_str($dns['query'], $extra);
            foreach ($extra as $key => $val) {
                // booleans
                if (strtoupper($val) == "TRUE") {
                    $params[$key] = TRUE;
                } elseif (strtoupper($val) == "FALSE") {
                    $params[$key] = FALSE;
                } else {
                    $params[$key] = $val;
                }
            }
        }
        // inint class
        $db = new $driver($params);
        // return class
        return $db;
    }
}
예제 #2
0
     $id = $item['id'];
     $file_exists = file_exists(iconv('UTF-8', 'TIS-620', DATA_PATH . "edocument/{$item['file']}"));
     $tr = '<tr id="M_' . $id . '">';
     $tr .= '<th headers=c0 id=r' . $id . ' scope=row class=topic><span class=cuttext>' . $item['topic'] . '.' . $item['ext'] . '</span></th>';
     $icon = "skin/ext/{$item['ext']}.png";
     $icon = WEB_URL . (is_file(ROOT_PATH . $icon) ? "/{$icon}" : "/skin/ext/file.png");
     $tr .= '<td headers="r' . $id . ' c0" class=menu>';
     $tr .= $file_exists ? '<a href="' . WEB_URL . '/modules/edocument/admin_download.php?id=' . $id . '" target=_blank title="{LNG_CLICK_TO} {LNG_DOWNLOAD}"><img src="' . $icon . '" alt=' . $item['ext'] . '></a>' : '';
     $tr .= '</td>';
     $tr .= '<td headers="r' . $id . ' c1" class=check-column><a id=check_' . $id . ' class=icon-uncheck href=""></a></td>';
     $tr .= '<td headers="r' . $id . ' c2" title="' . $item['detail'] . '" class=tablet>' . $item['detail'] . '</td>';
     $sender = trim("{$item['fname']} {$item['lname']}");
     $sender = $sender == '' ? $item['email'] : $sender;
     $tr .= '<td headers="r' . $id . ' c3" class=mobile><a href="index.php?id=' . $item['sender_id'] . '&module=editprofile&src=edocument-setup" class="cuttext status' . $item['status'] . '">' . $sender . '</a></td>';
     $tr .= '<td headers="r' . $id . ' c4" class="' . ($file_exists ? 'size' : 'notfound') . ' tablet center">' . gcms::formatFileSize($item['size']) . '</td>';
     $tr .= '<td headers="r' . $id . ' c5" class="date mobile">' . gcms::mktime2date($item['last_update']) . '</td>';
     $tr .= '<td headers="r' . $id . ' c6" class="visited mobile"><a class=count href="index.php?id=' . $id . '&module=edocument-report&src=edocument-setup" title="{LNG_EDOCUMENT_DOWNLOAD_DETAILS}">' . $item['downloads'] . '</a></td>';
     $tr .= '<td headers="r' . $id . ' c7" class=menu><a href="{URLQUERY?module=edocument-write&id=' . $id . '}" title="{LNG_EDIT}" class=icon-edit></a></td>';
     $tr .= '</tr>';
     $content[] = $tr;
 }
 $content[] = '</tbody>';
 $content[] = '<tfoot>';
 $content[] = '<tr>';
 $content[] = '<td headers=c0 colspan=2>&nbsp;</td>';
 $content[] = '<td headers=c1 class=check-column><a class="checkall icon-uncheck"></a></td>';
 $content[] = '<td headers=c2 colspan=5></td>';
 $content[] = '</tr>';
 $content[] = '</tfoot>';
 $content[] = '</table>';
 // แบ่งหน้า
예제 #3
0
파일: action.php 프로젝트: phannack/GCMS
<?php

// widgets/tags/action.php
header("content-type: text/html; charset=UTF-8");
// inint
include '../../bin/inint.php';
// referer
if (gcms::isReferer()) {
    // อัปเดทการคลิก
    list($action, $id) = explode('-', $_POST['id']);
    if ($action == 'tags') {
        $sql = "UPDATE `" . DB_TAGS . "` SET `count`=`count`+1 WHERE `id`=" . (int) $id . " LIMIT 1";
        $db->query($sql);
    }
}
예제 #4
0
파일: country.php 프로젝트: phannack/GCMS
     $tr .= '<td headers="r' . $id . ' c4" class=menu><a href="{URLQUERY?id=' . $id . '&module=countrywrite&src=country&spage=' . $page . '}" title="{LNG_MEMBER_EDIT_TITLE}" class=icon-edit></a></td>';
     $tr .= '</tr>';
     $content[] = $tr;
 }
 $content[] = '</tbody>';
 $content[] = '<tfoot>';
 $content[] = '<tr>';
 $content[] = '<td headers=c0>&nbsp;</td>';
 $content[] = '<td headers=c1 class=check-column><a class="checkall icon-uncheck"></a></td>';
 $content[] = '<td headers=c2 colspan=3></td>';
 $content[] = '</tr>';
 $content[] = '</tfoot>';
 $content[] = '</table>';
 // แบ่งหน้า
 $url = '<a href="{URLQUERY?module=country&page=%d}" title="{LNG_DISPLAY_PAGE} %d">%d</a>';
 $content[] = '<div class=splitpage>' . gcms::pagination($totalpage, $page, $url) . '</div>';
 $content[] = '<div class=table_nav>';
 $content[] = '<fieldset>';
 // sel action
 $sel = array();
 $sel[] = '<select id=sel_action>';
 // delete
 $sel[] = '<option value=delete_country>{LNG_DELETE}</option>';
 // country zone
 $sel[] = '<option value=zone_0>{LNG_COUNTRY_NO_ZONE}</option>';
 if (isset($lng['COUNTRIES_ZONE'])) {
     foreach ($lng['COUNTRIES_ZONE'] as $i => $item) {
         $sel[] = '<option value=zone_' . $i . '>' . $item . '</option>';
     }
 }
 $sel[] = '</select>';
예제 #5
0
                }
            }
            if (!$error) {
                if ($id == 0) {
                    // ใหม่
                    $save['module_id'] = $index[0]['module_id'];
                    $db->add(DB_PERSONNEL, $save);
                    // คืนค่า
                    $ret['error'] = 'ADD_COMPLETE';
                    $ret['location'] = rawurlencode('index.php?module=personnel-setup');
                } else {
                    // แก้ไข
                    $db->edit(DB_PERSONNEL, $index[0]['id'], $save);
                    // คืนค่า
                    $ret['error'] = 'EDIT_SUCCESS';
                }
                $ret['write_order'] = $save['order'];
            } else {
                if ($input) {
                    $ret['input'] = $input;
                }
                $ret['error'] = $error;
            }
        }
    }
} else {
    $ret['error'] = 'ACTION_ERROR';
}
// คืนค่าเป็น JSON
echo gcms::array2json($ret);
예제 #6
0
<?php

// widgets/tags/admin_setup.php
if (MAIN_INIT == 'admin' && $isAdmin && defined('DB_TAGS')) {
    // รายการที่แก้ไข
    $id = gcms::getVars($_GET, 'id', 0);
    $tags = '';
    $tag = array('id' => 0, 'tag' => '');
    // query
    $sql = "SELECT * FROM " . DB_TAGS . " ORDER BY `count` ASC, `id` DESC";
    foreach ($db->customQuery($sql) as $item) {
        if ($id == $item['id']) {
            $tag = $item;
        }
        $tags .= '<tr id=L_' . $item['id'] . '>';
        $tags .= '<th headers=c1 id=r' . $item['id'] . ' scope=row class=topic><a id=edit_' . $item['id'] . ' href="' . WEB_URL . '/admin/index.php?module=tags-setup&amp;id=' . $item['id'] . '">' . htmlspecialchars($item['tag']) . '</a></th>';
        $tags .= '<td headers="r' . $item['id'] . ' c2" class=check-column><a id=check_' . $item['id'] . ' class=icon-uncheck></a></td>';
        $tags .= '<td headers="r' . $item['id'] . ' c3" class=visited>' . $item['count'] . '</td>';
        $tags .= '</tr>';
    }
    // title
    $title = $lng['LNG_TAGS_TITLE'];
    $a = array();
    $a[] = '<span class=icon-widgets>{LNG_WIDGETS}</span>';
    $a[] = '{LNG_TAGS}';
    // แสดงผล
    $content[] = '<div class=breadcrumbs><ul><li>' . implode('</li><li>', $a) . '</li></ul></div>';
    $content[] = '<section>';
    $content[] = '<header><h1 class=icon-tags>' . $title . '</h1></header>';
    $content[] = '<div class=setup_frm>';
    $content[] = '<form id=setup_frm class=paper method=post action=index.php>';
예제 #7
0
<?php

// modules/gallery/admin_inint.php
if (MAIN_INIT == 'admin' && $isAdmin && (sizeof($install_owners['gallery']) == 0 || !defined('DB_GALLERY'))) {
    // เมนูติดตั้ง
    $admin_menus['tools']['install']['gallery'] = '<a href="index.php?module=install&amp;modules=gallery"><span>Gallery</span></a>';
    unset($admin_menus['modules']['gallery']['config']);
} else {
    // เมนูแอดมิน
    if (!gcms::canConfig($config, 'gallery_can_config')) {
        unset($admin_menus['modules']['gallery']['config']);
    }
    if (gcms::canConfig($config, 'gallery_can_write')) {
        $admin_menus['modules']['gallery']['album'] = '<a href="index.php?module=gallery-album"><span>{LNG_GALLERY_ALBUM}</span></a>';
        $admin_menus['modules']['gallery']['write'] = '<a href="index.php?module=gallery-write"><span>{LNG_ADD_NEW} {LNG_GALLERY_ALBUM}</span></a>';
    }
}
예제 #8
0
파일: index.php 프로젝트: phannack/GCMS
<?php

// widgets/shoutbox/index.php
if (defined('MAIN_INIT')) {
    // default
    $config['shoutbox_time'] = gcms::getVars($config, 'shoutbox_time', 5);
    $config['shoutbox_lines'] = gcms::getVars($config, 'shoutbox_lines', 10);
    $emoticon_dir = WEB_URL . '/widgets/shoutbox/smile';
    $shoutbox = array();
    $shoutbox[] = '<div id=shoutbox_div>';
    $shoutbox[] = '<dl id=shoutbox_list></dl>';
    $shoutbox[] = '<form id=shoutbox_frm method=post action=' . WEB_URL . '>';
    $shoutbox[] = '<fieldset>';
    $shoutbox[] = '<p><label for=shoutbox_sender>{LNG_FNAME}:</label><span><input type=text id=shoutbox_sender name=shoutbox_sender maxlength=20 size=15></span></p>';
    $shoutbox[] = '<p><label for=shoutbox_txt>{LNG_SHOUTBOX_MESSAGE}:</label><span><input type=text id=shoutbox_txt name=shoutbox_txt maxlength=100 size=15 title="{LNG_SHOUTBOX_TEXT_TITLE}"></span></p>';
    $shoutbox[] = '<p><label for=shoutbox_submit>&nbsp;</label><span><input class="button send" id=shoutbox_submit type=submit value="{LNG_SHOUTBOX_SEND}"><img src=' . $emoticon_dir . '/0.gif alt=emoticon class=nozoom></span></p>';
    $shoutbox[] = '</fieldset>';
    $shoutbox[] = '<p id=shoutbox_emoticon>';
    $f = @opendir(ROOT_PATH . 'widgets/shoutbox/smile/');
    if ($f) {
        while (false !== ($text = readdir($f))) {
            if (preg_match('/^([0-9]+)\\.gif$/', $text, $match)) {
                $shoutbox[] = "<img src={$emoticon_dir}/{$match['1']}.gif alt={$match['1']} class=nozoom>";
            }
        }
        closedir($f);
    }
    $shoutbox[] = '</p>';
    $shoutbox[] = '</form>';
    $shoutbox[] = '</div>';
    $shoutbox[] = '<script>';
예제 #9
0
<?php

// admin/import.php
header("content-type: text/html; charset=UTF-8");
// inint
include '../bin/inint.php';
// ไฟล์ที่ส่งมา
$file = $_FILES['import_file'];
// แอดมินเท่านั้น
if (gcms::isReferer() && gcms::isAdmin() && $file['tmp_name'] != '') {
    if (isset($_SESSION['login']['account']) && $_SESSION['login']['account'] == 'demo') {
        echo gcms::array2json(array('error' => 'EX_MODE_ERROR'));
    } else {
        // long time
        set_time_limit(0);
        // อัปโหลด
        $fr = file($file['tmp_name']);
        // query ทีละบรรทัด
        foreach ($fr as $value) {
            $sql = str_replace(array('\\r', '\\n', '{prefix}', '/{WEBMASTER}/', '/{WEBURL}/'), array("\r", "\n", PREFIX, $_SESSION['login']['email'], WEB_URL), trim($value));
            if ($sql != '') {
                $db->query($sql);
            }
        }
    }
}
예제 #10
0
파일: send.php 프로젝트: phannack/GCMS
<?php

// widgets/shoutbox/send.php
header("content-type: text/html; charset=UTF-8");
// inint
include '../../bin/inint.php';
// referer
if (gcms::isReferer()) {
    // ค่าที่ส่งมา
    $save = array();
    $save['text'] = $db->sql_trim_str($_POST, 'val');
    $save['time'] = gcms::getVars($_POST, 'time', 0);
    $save['sender'] = $db->sql_trim_str($_POST, 'sender');
    // save message
    $db->add(DB_SHOUTBOX, $save);
}
예제 #11
0
파일: index.php 프로젝트: phannack/GCMS
            }
        }
        $_SESSION['emails'] = implode(',', $emails);
    }
    $widget[] = '<option value=admin>{LNG_ADMIN}</option>';
    foreach ($emails as $i => $email) {
        $widget[] = '<option value=' . $i . '>' . $email . '</option>';
    }
    $widget[] = '</select></span></div>';
    // sender
    $widget[] = '<div class=item><label for=mail_sender>{LNG_EMAIL_SENDER}</label><span class="g-input icon-email"><input type=text name=mail_sender id=mail_sender value="' . (isset($_SESSION['login']['email']) ? $_SESSION['login']['email'] : '') . '"></span></div>';
    // subject
    $widget[] = '<div class=item><label for=mail_topic>{LNG_EMAIL_SUBJECT}</label><span class="g-input icon-edit"><input type=text name=mail_topic id=mail_topic value="' . $subject . '"></span></div>';
    // detail
    $widget[] = '<div class=item><label for=mail_detail>{LNG_DETAIL}</label><span class="g-input icon-file"><textarea id=mail_detail name=mail_detail rows=10></textarea></span></div>';
    // anti spam
    $widget[] = '<div class=item><label class="g-input antispam"><span><img src="' . WEB_URL . '/antispamimage.php?id=' . $antispam . '" alt=Antispam></span>';
    $widget[] = '<input type=text name=mail_antispam id=mail_antispam maxlength=4 value="' . (gcms::isAdmin() ? $_SESSION[$antispam] : '') . '" placeholder="{LNG_ANTISPAM_COMMENT}">';
    $widget[] = '</span></div>';
    $widget[] = '<div class=item>';
    $widget[] = '<input type=submit id=mail_submit class="button large send" value="{LNG_SEND_MESSAGE}">';
    $widget[] = '<input type=hidden name=antispam value="' . $antispam . '">';
    $widget[] = '</div>';
    $widget[] = '</form>';
    $widget[] = '<script>';
    $widget[] = '$G(window).Ready(function(){';
    $widget[] = 'new GForm("contact_frm", "' . WEB_URL . '/widgets/contact/sendmail.php", null, false).onsubmit(doFormSubmit);';
    $widget[] = '});';
    $widget[] = '</script>';
    $widget = implode("\n", $widget);
}
예제 #12
0
파일: index.php 프로젝트: phannack/GCMS
<?php

// widgets/search/index.php
if (defined('MAIN_INIT')) {
    $patt = array('/[\\t\\r]/', '/{(LNG_[A-Z0-9_]+)}/e', '/{WEBURL}/', '/{SEARCH}/', '/{ID}/');
    $replace = array();
    $replace[] = '';
    $replace[] = OLD_PHP ? '$lng[\'$1\']' : 'gcms::getLng';
    $replace[] = WEB_URL;
    $replace[] = preg_replace('/[\\+\\s]+/u', ' ', gcms::getVars($_GET, 'q', ''));
    $replace[] = gcms::rndname(10);
    $widget = gcms::pregReplace($patt, $replace, file_get_contents(ROOT_PATH . 'widgets/search/search.html'));
}
예제 #13
0
<?php

// widgets/chat/admin_setup.php
if (MAIN_INIT == 'admin' && $isAdmin) {
    // default
    $config['chat_time'] = gcms::getVars($config, 'chat_time', 5);
    $config['chat_history'] = gcms::getVars($config, 'chat_history', 7);
    $config['chat_lines'] = gcms::getVars($config, 'chat_lines', 10);
    // title
    $title = $lng['LNG_CHAT_SETUP'];
    $a = array();
    $a[] = '<span class=icon-widgets>{LNG_WIDGETS}</span>';
    $a[] = '{LNG_CHAT}';
    // แสดงผล
    $content[] = '<div class=breadcrumbs><ul><li>' . implode('</li><li>', $a) . '</li></ul></div>';
    $content[] = '<section>';
    $content[] = '<header><h1 class=icon-chat>' . $title . '</h1></header>';
    $content[] = '<form id=setup_frm class=setup_frm method=post action=index.php>';
    $content[] = '<fieldset>';
    $content[] = '<legend><span>{LNG_CHAT}</span></legend>';
    // chat_time
    $content[] = '<div class=item>';
    $content[] = '<label for=chat_time>{LNG_CHAT_TIME}</label>';
    $content[] = '<span class="g-input icon-clock"><input type=number id=chat_time name=chat_time title="{LNG_CHAT_TIME_COMMENT}" value=' . $config['chat_time'] . '></span>';
    $content[] = '<div class=comment id=result_chat_time>{LNG_CHAT_TIME_COMMENT}</div>';
    $content[] = '</div>';
    // chat_history
    $content[] = '<div class=item>';
    $content[] = '<label for=chat_history>{LNG_CHAT_HISTORY}</label>';
    $content[] = '<span class="g-input icon-history"><input type=number id=chat_history name=chat_history title="{LNG_CHAT_HISTORY_COMMENT}" value=' . $config['chat_history'] . '></span>';
    $content[] = '<div class=comment id=result_chat_history>{LNG_CHAT_HISTORY_COMMENT}</div>';
예제 #14
0
     $content[] = '<label for=download_file>{LNG_DOWNLOAD_FILE}</label>';
     $content[] = '<span class="g-input icon-world"><input type=text id=download_file name=download_file title="{LNG_DOWNLOAD_FILE_COMMENT}" value="' . $index['file'] . '"></span>';
     $content[] = '<div class=comment id=result_download_file>{LNG_DOWNLOAD_FILE_COMMENT}</div>';
     $content[] = '</div>';
     // download_upload
     $content[] = '<div class=item>';
     $t = str_replace(array('{TYPE}', '{SIZE}'), array(str_replace(',', ', ', $config['download_file_typies']), gcms::formatFileSize($config['download_upload_size'])), $lng['LNG_DOWNLOAD_FILE_BROWSER_COMMENT']);
     $content[] = '<label for=download_upload>{LNG_BROWSE_FILE}</label>';
     $content[] = '<span class="g-input icon-upload"><input type=file class=g-file id=download_upload name=download_upload title="' . $t . '" placeholder="' . $index['file'] . '"></span>';
     $content[] = '<div class=comment id=result_download_upload>' . $t . '</div>';
     $content[] = '</div>';
     $content[] = '</fieldset>';
     // submit
     $content[] = '<fieldset class=submit>';
     $content[] = '<input type=submit class="button large save" value="{LNG_SAVE}">';
     $content[] = gcms::get2Input($_GET);
     $content[] = '<input type=hidden name=write_id value=' . (int) $index['id'] . '>';
     $content[] = '</fieldset>';
     $content[] = '</form>';
     $content[] = '</section>';
     $content[] = '<script>';
     $content[] = '$G(window).Ready(function(){';
     $content[] = 'new GForm("setup_frm","' . WEB_URL . '/modules/download/admin_write_save.php").onsubmit(doFormSubmit);';
     $content[] = '});';
     $content[] = '</script>';
     // หน้านี้
     $url_query['module'] = 'download-write';
 } else {
     $title = $lng['LNG_DATA_NOT_FOUND'];
     $content[] = '<aside class=error>' . $title . '</aside>';
 }
예제 #15
0
 $content[] = '<label for=config_icon_category_type>{LNG_IMAGE_FILE_TYPIES}</label>';
 $content[] = '<div>';
 $icon_category_typies = explode(',', $index['icon_category_type']);
 foreach (array('jpg', 'gif', 'png') as $i => $item) {
     $chk = in_array($item, $icon_category_typies) ? ' checked' : '';
     $d = $item == 'jpg' ? ' id=config_icon_category_type' : '';
     $content[] = '<label><input type=checkbox' . $chk . $d . ' name=config_icon_category_type[] value=' . $item . ' title="{LNG_IMAGE_UPLOAD_TYPE_COMMENT}"> ' . $item . '</label>';
 }
 $content[] = '</div>';
 $content[] = '<div class=comment id=result_config_icon_category_type>{LNG_IMAGE_UPLOAD_TYPE_COMMENT}</div>';
 $content[] = '</div>';
 // default_icon
 $content[] = '<div class=item>';
 $content[] = '<div class=usericon><span><img id=img_default_icon src="' . WEB_URL . '/' . $index['default_icon'] . '" alt=default_icon></span></div>';
 $content[] = '<label for=config_default_icon>{LNG_BROWSE_FILE}</label>';
 $content[] = '<span class="g-input icon-upload"><input type=file class=g-file id=config_default_icon name=config_default_icon title="{LNG_DEFAULT_ICON_COMMENT}" accept="' . gcms::getEccept(array('jpg', 'png', 'gif')) . '" data-preview=img_default_icon></span>';
 $content[] = '<div class=comment id=result_config_default_icon>{LNG_DEFAULT_ICON_COMMENT}</div>';
 $content[] = '</div>';
 $content[] = '</fieldset>';
 // การแสดงผล
 $content[] = '<fieldset>';
 $content[] = '<legend><span>{LNG_DISPLAY}</span></legend>';
 // list_per_page
 $content[] = '<div class=item>';
 $content[] = '<label for=config_list_per_page>{LNG_QUANTITY}</label>';
 $content[] = '<span class="g-input icon-published1"><input type=number name=config_list_per_page id=config_list_per_page value="' . $index['list_per_page'] . '" title="{LNG_LIST_PER_PAGE_COMMENT}"></span>';
 $content[] = '<div class=comment>{LNG_LIST_PER_PAGE_COMMENT}</div>';
 $content[] = '</div>';
 // new_date
 $content[] = '<div class=item>';
 $new_date = $index['new_date'] / 86400;
예제 #16
0
파일: main.php 프로젝트: phannack/GCMS
                 $text = gcms::getVars($lng, 'LNG_' . strtoupper($key), '');
                 $menus[] = '<li class="' . $key . '"><a class=menu-arrow tabindex=0><span>' . ($text == '' ? ucfirst($key) : $text) . '</span></a><ul>';
                 foreach ($value as $key2 => $value2) {
                     $menus[] = '<li class="' . $key2 . '">' . $value2 . '</li>';
                 }
                 $menus[] = '</ul></li>';
             } else {
                 $menus[] = '<li class="' . $key . '">' . $value . '</li>';
             }
         }
         $menus[] = '</ul>';
     }
     $menus[] = '</li>';
 }
 // โมดูลที่เรียก
 $module = preg_replace('/[\\.\\/]/', '', gcms::getVars($_GET, 'module', ''));
 if (is_file(ROOT_PATH . "admin/{$module}.php")) {
     require_once ROOT_PATH . "admin/{$module}.php";
 } elseif (preg_match('/^(' . implode('|', array_keys($install_owners)) . ')(-(.*))?$/ui', $module, $modules)) {
     if (is_file(ROOT_PATH . "modules/{$modules['1']}/admin_{$modules['3']}.php")) {
         // โมดูลที่เรียก
         require_once ROOT_PATH . "modules/{$modules['1']}/admin_{$modules['3']}.php";
     } elseif (is_file(ROOT_PATH . "widgets/{$modules['1']}/admin_{$modules['3']}.php")) {
         // เรียก widget ชื่อเดียวกับโมดูล
         require_once ROOT_PATH . "widgets/{$modules['1']}/admin_{$modules['3']}.php";
     } else {
         require_once ROOT_PATH . "admin/dashboard.php";
     }
 } elseif (preg_match('/^(' . implode('|', $setup_widgets) . ')(-(.*))?$/ui', $module, $modules)) {
     // เรียก widget
     if (isset($modules[3]) && is_file(ROOT_PATH . "widgets/{$modules['1']}/admin_{$modules['3']}.php")) {
예제 #17
0
파일: report.php 프로젝트: phannack/GCMS
            } elseif ($start + $maxlink > $totalpage) {
                $start = $totalpage - $maxlink + 1;
            }
        } else {
            $start = 1;
        }
        $splitpage = $start > 2 ? str_replace('%1', 1, $url) : '';
        for ($i = $start; $i <= $totalpage && $maxlink > 0; $i++) {
            $splitpage .= $i == $page ? '<strong>' . $i . '</strong>' : str_replace('%1', $i, $url);
            $maxlink--;
        }
        $splitpage .= $i < $totalpage ? str_replace('%1', $totalpage, $url) : '';
        $splitpage = $splitpage == '' ? '<strong>1</strong>' : $splitpage;
        // แสดงผล list รายการ
        $patt = array('/{BREADCRUMS}/', '/{LIST}/', '/{TOPIC}/', '/{SPLITPAGE}/', '/{(LNG_[A-Z0-9_]+)}/e');
        $replace = array();
        $replace[] = implode("\n", $breadcrumbs);
        $replace[] = implode("\n", $list);
        $replace[] = "{$index['topic']}.{$index['ext']}";
        $replace[] = $splitpage;
        $replace[] = OLD_PHP ? '$lng[\'$1\']' : 'gcms::getLng';
        $content = gcms::pregReplace($patt, $replace, gcms::loadtemplate($index['module'], 'edocument', 'report'));
        // title,keywords,description
        $title = $index['title'];
        $keywords = $index['keywords'];
        $description = $index['description'];
    }
} else {
    $title = $lng['LNG_NOT_LOGIN'];
    $content = '<div class=error>' . $title . '</div>';
}
예제 #18
0
 $content[] = '<div class="table collapse">';
 $content[] = '<div class=td>';
 $content[] = '<span class="g-input icon-language"><select name=write_language id=write_language title="{LNG_PLEASE_SELECT} {LNG_LANGUAGE}">';
 foreach ($install_languages as $item) {
     $sel = $lang == $item ? ' selected' : '';
     $content[] = '<option value=' . $item . $sel . '>' . $item . '</option>';
 }
 $content[] = '</select></span>';
 $content[] = '</div>';
 $content[] = '<div class=td>&nbsp;<a id=write_go class="button go">{LNG_GO}</a></div>';
 $content[] = '</div>';
 $content[] = '</div>';
 // detail
 $content[] = '<div class=item>';
 $content[] = '<label for=write_detail>{LNG_CONTENTS}</label>';
 $content[] = '<div><textarea name=write_detail id=write_detail>' . gcms::detail2TXT($search, $lang) . '</textarea></div>';
 $content[] = '</div>';
 $content[] = '</fieldset>';
 // submit
 $content[] = '<fieldset class=submit>';
 $content[] = '<input type=submit class="button large save" value="{LNG_SAVE}">';
 $content[] = '<input type=hidden name=intro value=1>';
 $content[] = '</fieldset>';
 $content[] = '</form>';
 $content[] = '</section>';
 $content[] = '<script>';
 $content[] = '$G(window).Ready(function(){';
 $_SESSION['CKEDITOR'] = $_SESSION['login']['id'];
 $content[] = 'CKEDITOR.replace("write_detail", {';
 $content[] = 'toolbar:"Document",';
 $content[] = 'language:"' . LANGUAGE . '",';
예제 #19
0
<?php

// widgets/facebook/admin_setup.php
if (MAIN_INIT == 'admin' && $isAdmin) {
    // ตรวจสอบค่า default
    $config['facebook_width'] = gcms::getVars($config, 'facebook_width', 500);
    $config['facebook_height'] = gcms::getVars($config, 'facebook_height', 0);
    $config['facebook_user'] = gcms::getVars($config, 'facebook_user', 'gcmscms');
    $config['facebook_show_facepile'] = gcms::getVars($config, 'facebook_show_facepile', 1);
    $config['facebook_show_posts'] = gcms::getVars($config, 'facebook_show_posts', 0);
    $config['facebook_hide_cover'] = gcms::getVars($config, 'facebook_hide_cover', 0);
    // title
    $title = $lng['LNG_FACEBOOK_SETTINGS'];
    $a = array();
    $a[] = '<span class=icon-widgets>{LNG_WIDGETS}</span>';
    $a[] = '{LNG_FACEBOOK_LIKE_BOX}';
    // แสดงผล
    $content[] = '<div class=breadcrumbs><ul><li>' . implode('</li><li>', $a) . '</li></ul></div>';
    $content[] = '<section>';
    $content[] = '<header><h1 class=icon-facebook>' . $title . '</h1></header>';
    $content[] = '<div class=setup_frm>';
    $content[] = '<form id=setup_frm class=paper method=post action=index.php>';
    $content[] = '<fieldset>';
    $content[] = '<legend><span>{LNG_FACEBOOK_LIKE_BOX}</span></legend>';
    // width, height
    $content[] = '<div class=item>';
    $content[] = '<div class=input-groups>';
    $content[] = '<div class=width50>';
    $content[] = '<label for=facebook_width>{LNG_WIDTH}</label>';
    $content[] = '<span class="g-input icon-width"><input type=number name=facebook_width id=facebook_width value="' . $config['facebook_width'] . '" title="{LNG_FACEBOOK_SIZE_COMMENT}"></span>';
    $content[] = '</div>';
예제 #20
0
파일: 521.php 프로젝트: phannack/GCMS
    while (false !== ($text = readdir($f))) {
        if ($text != '.' && $text != '..') {
            if (is_file($dir . $text . '/sql.php')) {
                $sqlfiles[] = $dir . $text . '/sql.php';
            }
        }
    }
    closedir($f);
    foreach ($sqlfiles as $folder) {
        $fr = file($folder);
        foreach ($fr as $value) {
            $sql = str_replace(array('{prefix}', '{WEBMASTER}', '{NOREPLY}', '\\r', '\\n'), array(PREFIX, $config['webmaster_email'], $reply, "\r", "\n"), trim($value));
            if ($sql != '') {
                if (preg_match('/INSERT[\\s]+INTO[\\s]+`' . PREFIX . '_language`.*/iu', $sql, $match)) {
                    // install language
                    $db->query($sql);
                }
            }
        }
    }
    echo '<li class=correct>Install <strong>new languages</strong> <i>complete...</i></li>';
    ob_flush();
    flush();
    // import old language
    include ROOT_PATH . 'admin/install/langtool.php';
    // บันทึกไฟล์ภาษา
    gcms::saveLanguage();
    echo '<li class=correct>Import <strong>old languages</strong> <i>complete...</i></li>';
    ob_flush();
    flush();
}
예제 #21
0
파일: index.php 프로젝트: phannack/GCMS
if (defined('MAIN_INIT') && preg_match('/^[a-z0-9]{4,}$/', $module) && isset($install_modules[$module])) {
    // module
    $index = $install_modules[$module];
    // อ่าน config
    gcms::r2config($index['config'], $index);
    // ค่าที่ส่งมา
    $id = $index['module_id'];
    $cat = isset($cat) ? $cat : 0;
    $new_date = (int) $index['new_date'];
    $interval = isset($interval) ? (int) $interval : 0;
    $cols = isset($cols) ? (int) $cols : 1;
    $rows = isset($rows) ? (int) $rows : 0;
    $show = isset($show) && preg_match('/^[a-z0-9]+$/', $show) ? $show : '';
    if ($rows > 0) {
        $count = $rows * $cols;
    } else {
        $count = isset($count) ? (int) $count : 0;
        $count = $count == 0 ? $index['news_count'] : $count;
    }
    $sort = isset($sort) ? (int) $sort : $index['news_sort'];
    if ($count > 0) {
        $styles = isset($styles) && in_array($styles, array('list', 'icon', 'thumb')) ? $styles : 'list';
        // แสดงผล
        $patt = array('/{ID}/', '/{DETAIL}/', '/{MODULE}/');
        $replace = array();
        $replace[0] = "widget_" . (empty($index['module']) ? '' : $index['module']) . "_{$id}_{$cat}_{$count}_{$new_date}_{$sort}_{$cols}_{$styles}_{$show}";
        $replace[1] = "<script>getWidgetNews('{$replace['0']}', 'document', {$interval});</script>";
        $replace[2] = $index['module'];
        $widget = preg_replace($patt, $replace, gcms::loadtemplate($index['module'], 'document', 'widget'));
    }
}
예제 #22
0
파일: module.php 프로젝트: phannack/GCMS
                $page = $match[1];
                $modules[4] = $match[2];
            }
            // ชื่อโมดูลที่ติดตั้งแล้ว
            $modules[2] = $install_modules[$modules[1]]['owner'];
        }
        if (empty($modules[3])) {
            $modules[3] = 'main';
        } elseif (is_file(ROOT_PATH . "modules/{$modules['1']}/{$modules['3']}.php")) {
            // เรียกโมดูลตรงๆ
            $modules[2] = $modules[1];
        } elseif (!empty($page) && is_file(ROOT_PATH . "modules/{$modules['1']}/{$page}.php")) {
            $modules[3] = $page;
        } elseif (!is_file(ROOT_PATH . "modules/{$modules['2']}/{$modules['3']}.php")) {
            $modules[4] = $modules[3];
            $modules[3] = 'view';
        }
    } else {
        // ไม่ได้ส่งชื่อโมดูลมา เช่น ข้อความ.html
        // ให้แสดงเรื่องจากโมดูล document
        unset($modules[1]);
        $modules[2] = 'document';
        $modules[3] = 'view';
        $modules[4] = $module;
    }
    unset($modules[0]);
    // โมดูลที่เรียก
    $module = gcms::getVars($modules, 1, '');
    // เลือกเมนู
    $menu = empty($install_modules[$module]['alias']) ? $module : $install_modules[$module]['alias'];
}
예제 #23
0
파일: main.php 프로젝트: phannack/GCMS
                $m = $install_modules[$index['module']]['menu_text'];
                $t = $install_modules[$index['module']]['menu_tooltip'];
            } else {
                $m = ucwords($index['module']);
                $t = $m;
            }
            $canonical = gcms::getURL($index['module']);
            $breadcrumbs['MODULE'] = gcms::breadcrumb('', $canonical, $t, $m, $breadcrumb);
        }
        // อัปเดทการเปิดดู
        if (!isset($_REQUEST['visited'])) {
            $index['visited']++;
            $db->edit(DB_INDEX, $index['id'], array('visited' => $index['visited']));
        }
        $cache->save($sql, $index);
        // แทนที่ลงใน template ของโมดูล
        $patt = array('/{BREADCRUMS}/', '/{TOPIC}/', '/{DETAIL}/', '/{MODULE}/');
        $replace = array();
        $replace[] = implode("\n", $breadcrumbs);
        $replace[] = $index['topic'];
        $replace[] = gcms::showDetail($index['detail'], true, false);
        $replace[] = $module;
        $content = preg_replace($patt, $replace, gcms::loadtemplate($index['module'], '', 'main'));
        // title,keywords,description
        $title = $index['topic'];
        $keywords = $index['keywords'];
        $description = $index['description'];
        // เลือกเมนู
        $menu = empty($install_modules[$index['module']]['alias']) ? $index['module'] : $install_modules[$index['module']]['alias'];
    }
}
예제 #24
0
 $a[] = '<a href="{URLQUERY?module=download-config}">{LNG_DOWNLOAD}</a>';
 $a[] = '{LNG_CATEGORY}';
 // แสดงผล
 $content[] = '<div class=breadcrumbs><ul><li>' . implode('</li><li>', $a) . '</li></ul></div>';
 $content[] = '<section>';
 $content[] = '<header><h1 class=icon-category>' . $title . '</h1></header>';
 // หมวดหมู่
 $content[] = '<div class=subtitle>{LNG_DOWNLOAD_CATEGORY_DETAIL}</div>';
 $content[] = '<dl id=config_category class=editinplace_list>';
 $sql = "SELECT `id`,`category_id`,`topic` FROM `" . DB_CATEGORY . "` WHERE `module_id`='{$index['id']}' ORDER BY `category_id`";
 foreach ($db->customQuery($sql) as $item) {
     $id = $item['id'];
     $row = '<dd id=config_category_' . $id . '>';
     $row .= '<span class=no>[' . $item['category_id'] . ']</span>';
     $row .= '<span class=icon-delete id=config_category_delete_' . $id . ' title="{LNG_DELETE} {LNG_CATEGORY}"></span>';
     $row .= '{LNG_CATEGORY} <span id=config_category_name_' . $id . ' title="{LNG_CLICK_TO} {LNG_EDIT}">' . htmlspecialchars(gcms::ser2Str($item, 'topic')) . '</span>';
     $row .= '</dd>';
     $content[] = $row;
 }
 $content[] = '</dl>';
 // submit
 $content[] = '<div class=submit>';
 $content[] = '<a id=config_category_add class="button large add"><span class=icon-plus>{LNG_ADD_NEW} {LNG_CATEGORY}</span></a>';
 $content[] = '</div>';
 $content[] = '</section>';
 $content[] = '<script>';
 $content[] = '$G(window).Ready(function(){';
 $content[] = "inintModuleCategory('config_category', '{$index['id']}', 'download');";
 $content[] = '});';
 $content[] = '</script>';
 // หน้านี้
예제 #25
0
파일: index.php 프로젝트: phannack/GCMS
        $nmax = sizeof($tag_result) - 1;
        $min = isset($tag_result[1]) ? $tag_result[1]['count'] : 0;
        $max = isset($tag_result[$nmax - 1]) ? $tag_result[$nmax - 1]['count'] : 0;
        $step = $max - $min > 0 ? ($max - $min) / 7 : 0.1;
        for ($i = $nmax; $i >= 0; $i--) {
            $value = $tag_result[$i]['count'];
            $key = $tag_result[$i]['tag'];
            $id = $tag_result[$i]['id'];
            if ($i == 0) {
                $classname = 'class0';
            } elseif ($i == $nmax) {
                $classname = 'class9';
            } else {
                $classname = 'class' . (floor(($value - $min) / $step) + 1);
            }
            if (empty($config['tag_owner']) || $config['tag_owner'] == 'document') {
                $url = gcms::getURL('tag', $key);
            } else {
                $url = gcms::getURL($config['tag_owner'], 'tag', 0, 0, 'tag=' . rawurlencode($key));
            }
            $keyword[] = '<a href="' . $url . '" class=' . $classname . ' id=tags-' . $id . '>' . str_replace(' ', '&nbsp;', $key) . '</a>';
        }
    }
    $keyword[] = '</div>';
    $keyword[] = '<script>';
    $content[] = '$G(window).Ready(function(){';
    $keyword[] = "inintTags('{$widget_id}', '" . SKIN . "');";
    $content[] = '});';
    $keyword[] = '</script>';
    $widget = implode("\n", $keyword);
}
예제 #26
0
파일: register.php 프로젝트: phannack/GCMS
    // title
    $title = $lng['LNG_REGISTER_TITLE'];
    // breadcrumbs
    $breadcrumb = gcms::loadtemplate('', '', 'breadcrumb');
    $breadcrumbs = array();
    // หน้าหลัก
    $breadcrumbs['HOME'] = gcms::breadcrumb('icon-home', WEB_URL . '/index.php', $install_modules[$module_list[0]]['menu_tooltip'], $install_modules[$module_list[0]]['menu_text'], $breadcrumb);
    // url ของหน้านี้
    $breadcrumbs['MODULE'] = gcms::breadcrumb('', gcms::getURL('register'), $lng['LNG_REGISTER_TITLE'], $lng['LNG_REGISTER_TITLE'], $breadcrumb);
    if (isset($config['custom_register']) && is_file(ROOT_PATH . $config['custom_register'])) {
        // custom register form
        include ROOT_PATH . $config['custom_register'];
    } else {
        // antispam
        $register_antispamchar = gcms::rndname(32);
        $_SESSION[$register_antispamchar] = gcms::rndname(4);
        // แสดงฟอร์ม registerfrm.html
        $patt = array('/{BREADCRUMS}/', '/<PHONE>(.*)<\\/PHONE>/isu', '/<IDCARD>(.*)<\\/IDCARD>/isu', '/<INVITE>(.*)<\\/INVITE>/isu', '/{(LNG_[A-Z0-9_]+)}/e', '/{ANTISPAM}/', '/{WEBURL}/', '/{MODAL}/', '/{INVITE}/');
        $replace = array();
        $replace[] = implode("\n", $breadcrumbs);
        $replace[] = empty($config['member_phone']) ? '' : '\\1';
        $replace[] = empty($config['member_idcard']) ? '' : '\\1';
        $replace[] = empty($config['member_invitation']) ? '' : '\\1';
        $replace[] = OLD_PHP ? '$lng[\'$1\']' : 'gcms::getLng';
        $replace[] = $register_antispamchar;
        $replace[] = WEB_URL;
        $replace[] = gcms::getVars($_POST, 'action', '') != 'modal' ? 'false' : 'true';
        $replace[] = gcms::getVars($_COOKIE, PREFIX . '_invite', '');
        $content = gcms::pregReplace($patt, $replace, gcms::loadtemplate('member', 'member', 'registerfrm'));
    }
}
예제 #27
0
파일: meta.php 프로젝트: phannack/GCMS
 $content[] = '</div>';
 $content[] = '</fieldset>';
 $content[] = '<fieldset>';
 $content[] = '<legend><span class=icon-facebook>{LNG_FACEBOOK}</span></legend>';
 // facebook_appId
 $facebook = gcms::getVars($config, 'facebook', array());
 $content[] = '<div class=item>';
 $content[] = '<label for=facebook_appId>{LNG_FACEBOOK_APPID}</label>';
 $content[] = '<span class="g-input icon-password"><input id=facebook_appId name=facebook_appId type=text value="' . gcms::getVars($facebook, 'appId', '') . '" title="{LNG_FACEBOOK_COMMENT}"></span>';
 $content[] = '</div>';
 // facebook_picture
 $content[] = '<div class=item>';
 $image = is_file(DATA_PATH . 'image/facebook_photo.jpg') ? DATA_URL . 'image/facebook_photo.jpg' : WEB_URL . '/skin/img/blank.gif';
 $content[] = '<div class=usericon><span><img src="' . $image . '" alt="Facebook Picture" id=fbPicture></span></div>';
 $content[] = '<label for=facebook_picture>{LNG_BROWSE_FILE}</label>';
 $content[] = '<span class="g-input icon-upload"><input class=g-file id=facebook_picture name=facebook_picture type=file title="{LNG_FACEBOOK_PICTURE_COMMENT}" accept="' . gcms::getEccept(array('jpg')) . '" data-preview=fbPicture></span>';
 $content[] = '<div class=comment id=result_facebook_picture>{LNG_FACEBOOK_PICTURE_COMMENT}</div>';
 $content[] = '</div>';
 $content[] = '<aside class=message>{LNG_FACEBOOK_REDIRECT_URL} <em>{WEBURL}/index.php</em></aside>';
 $content[] = '</fieldset>';
 // submit
 $content[] = '<fieldset class=submit>';
 $content[] = '<input type=submit class="button large save" value="{LNG_SAVE}">';
 $content[] = '</fieldset>';
 $content[] = '</form>';
 $content[] = '</section>';
 $content[] = '<script>';
 $content[] = '$G(window).Ready(function(){';
 $content[] = 'new GForm("setup_frm","saveconfig.php").onsubmit(doFormSubmit);';
 $content[] = '});';
 $content[] = '</script>';
예제 #28
0
파일: sitemap.php 프로젝트: phannack/GCMS
<?php

// modules/event/sitemap.php
if (is_array($owners['event'])) {
    $sql = "SELECT `id`,`begin_date`,`module_id`";
    $sql .= " FROM `" . DB_EVENTCALENDAR . "`";
    $sql .= " WHERE `module_id` IN(" . implode(',', $owners['event']) . ") AND `published`='1' AND `published_date`<='{$cdate}'";
    $datas = $cache->get($sql);
    if (!$datas) {
        $datas = $db->customQuery($sql);
        $cache->save($sql, $datas);
    }
    foreach ($datas as $item) {
        echo '<url>';
        echo '<loc>' . gcms::getURL($modules[$item['module_id']], '', 0, 0, "id={$item['id']}") . '</loc>';
        list($d, $t) = explode(' ', $item['begin_date']);
        echo '<lastmod>' . $d . '</lastmod>';
        echo '<changefreq>daily</changefreq>';
        echo '<priority>0.5</priority>';
        echo '</url>';
    }
}
예제 #29
0
<?php

// admin/register.php
if (MAIN_INIT == 'admin' && $isAdmin) {
    // title
    $title = $lng['LNG_REGISTER_TITLE'];
    // แสดงผล
    $patt2 = array('/{STATUS}/');
    $replace2 = array();
    $statuses = array();
    foreach ($config['member_status'] as $i => $value) {
        $statuses[] = '<option value=' . $i . '>' . $value . '</option>';
    }
    $replace2[] = implode('', $statuses);
    $content[] = preg_replace($patt2, $replace2, gcms::loadfile(ROOT_PATH . "admin/skin/{$config['admin_skin']}/register.html"));
} else {
    $title = $lng['LNG_DATA_NOT_FOUND'];
    $content[] = '<aside class=error>' . $title . '</aside>';
}
예제 #30
0
파일: write.php 프로젝트: phannack/GCMS
                $categories[$item['category_id']] = "<option value={$item['category_id']}{$sel}>" . gcms::ser2Str($item, 'topic') . "</option>";
            }
        }
        if (sizeof($categories) > 1) {
            unset($categories[0]);
        }
        // antispam
        $register_antispamchar = gcms::rndname(32);
        $_SESSION[$register_antispamchar] = gcms::rndname(4);
        // แสดงผล
        $patt = array('/{BREADCRUMS}/', '/<MEMBER>(.*)<\\/MEMBER>/s', '/<UPLOAD>(.*)<\\/UPLOAD>/s', '/{CATEGORIES}/', '/{(LNG_[A-Z0-9_]+)}/e', '/{LOGIN_PASSWORD}/', '/{LOGIN_EMAIL}/', '/{ANTISPAM}/', '/{ANTISPAMVAL}/', '/{SIZE}/', '/{TYPE}/', '/{MODULEID}/');
        $replace = array();
        $replace[] = implode("\n", $breadcrumbs);
        $replace[] = $isMember ? '' : '$1';
        $replace[] = $index['img_upload_type'] == '' ? '' : '$1';
        $replace[] = implode("\n", $categories);
        $replace[] = OLD_PHP ? '$lng[\'$1\']' : 'gcms::getLng';
        $replace[] = $login['password'];
        $replace[] = $login['email'];
        $replace[] = $register_antispamchar;
        $replace[] = $isAdmin ? $_SESSION[$register_antispamchar] : '';
        $replace[] = $index['img_upload_size'];
        $replace[] = empty($index['img_upload_type']) ? '&nbsp;' : $index['img_upload_type'];
        $replace[] = $index['module_id'];
        $content = gcms::pregReplace($patt, $replace, gcms::loadtemplate($index['module'], 'board', 'write'));
        // title
        $title = $lng['LNG_BOARD_NEW'] . ' ' . $install_modules[$index['module']]['menu_text'];
        // เลือกเมนู
        $menu = empty($install_modules[$index['module']]['alias']) ? $index['module'] : $install_modules[$index['module']]['alias'];
    }
}