本文整理汇总了PHP中gcms类的典型用法代码示例。如果您正苦于以下问题:PHP gcms类的具体用法?PHP gcms怎么用?PHP gcms使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了gcms类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
/**
* 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: file_exists
$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> </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: header
<?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: array
$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> </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: rawurlencode
}
}
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: array
<?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&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: unset
<?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&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: array
<?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> </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: header
<?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: header
<?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: implode
}
}
$_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: str_replace
$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>';
}
示例13: explode
$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;
示例14: strtoupper
$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")) {
示例15: elseif
} 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>';
}