Exemple #1
0
 $content[] = '<caption>' . preg_replace($patt2, $replace2, $lng['ALL_ITEMS']) . '</caption>';
 $content[] = '<thead>';
 $content[] = '<tr>';
 $content[] = '<th scope=col id=c0>{LNG_CREATED}</th>';
 $content[] = '<th scope=col id=c1 class=check-column><a class="checkall icon-uncheck"></a></th>';
 $content[] = '<th scope=col id=c2>{LNG_SENDER}</th>';
 $content[] = '<th scope=col id=c3>{LNG_DETAIL}</th>';
 $content[] = '</tr>';
 $content[] = '</thead>';
 $content[] = '<tbody>';
 // shoutbox
 $sql = "SELECT * FROM `" . DB_SHOUTBOX . "` ORDER BY `time` DESC LIMIT {$start}, {$list_per_page}";
 foreach ($db->customQuery($sql) as $item) {
     $id = $item['id'];
     $tr = '<tr id=L_' . $id . '>';
     $tr .= '<td headers="r' . $id . ' c0">' . gcms::mktime2date($item['time'], 'd M Y H:i:s') . '</td>';
     $tr .= '<td headers="r' . $id . ' c1" class=check-column><a id=check_' . $id . ' class=icon-uncheck></a></td>';
     $tr .= '<td headers="r' . $id . ' c2">' . $item['sender'] . '</td>';
     $tr .= '<td headers="r' . $id . ' c3">' . $item['text'] . '</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=2>&nbsp;</td>';
 $content[] = '</tr>';
 $content[] = '</tfoot>';
 $content[] = '</table>';
             $u[] = "({$item['displayname']})";
         }
     } elseif ($item['displayname'] != '') {
         $u[] = $item['displayname'];
     } else {
         $u[] = '{LNG_UNNAME}';
     }
     $u = implode(' ', $u);
     $tr .= '<td headers="r' . $id . ' c4" class=mobile>' . $u . '</td>';
     $sex = in_array($item['sex'], array_keys($lng['SEX'])) ? $item['sex'] : 'u';
     $tr .= '<td headers="r' . $id . ' c5" class="center tablet"><span class=icon-sex-' . $sex . '></span></td>';
     $website = $item['website'] == '' ? '&nbsp;' : '<a href="http://' . $item['website'] . '" target=_blank>' . $item['website'] . '</a>';
     $tr .= '<td headers="r' . $id . ' c6" class="website tablet">' . $website . '</td>';
     $tr .= '<td headers="r' . $id . ' c7" class="date tablet">' . gcms::mktime2date($item['create_date'], 'd M Y') . '</td>';
     if (trim($item['activatecode']) == '') {
         $tr .= '<td headers="r' . $id . ' c8" class="date tablet">' . gcms::mktime2date($item['lastvisited'], 'd M Y H:i') . ' <span class=visited>(' . $item['visited'] . ')</span></td>';
     } else {
         $tr .= '<td headers="r' . $id . ' c8" class="noactivate center tablet">{LNG_NOACTIVATE}</td>';
     }
     $tr .= '<td headers="r' . $id . ' c9" class=menu><a href="{URLQUERY?id=' . $id . '&module=editprofile&src=member&spage=' . $page . '}" title="{LNG_MEMBER_EDIT_TITLE}" class=icon-edit>&nbsp;</a></td>';
     $tr .= '</tr>';
     $content[] = $tr;
 }
 $content[] = '</tbody>';
 $content[] = '<tfoot>';
 $content[] = '<tr>';
 $content[] = '<td headers=c0 colspan=2>&nbsp;</td>';
 $content[] = '<td headers=c2 class=check-column><a class="checkall icon-uncheck"></a></td>';
 $content[] = '<td headers=c3 colspan=8></td>';
 $content[] = '</tr>';
 $content[] = '</tfoot>';
Exemple #3
0
                $i++;
                $row = '<article class=r>';
                $row .= '<div class=detail>' . $picture . gcms::showDetail($item['detail'], true) . '</div>';
                $row .= '<footer>';
                $row .= '<p><strong>{LNG_COMMENT_NO}#' . $i . '</strong></p>';
                $row .= '<p><strong>{LNG_BY}</strong>: ' . (empty($item['displayname']) ? $item['email'] : $item['displayname']) . '</p>';
                $row .= '<p><strong>{LNG_POSTED}</strong>: ' . gcms::mktime2date($item['last_update']) . '</p>';
                $row .= '<p><strong>{LNG_IP}</strong>: ' . gcms::showip($item['ip']) . '</p>';
                $row .= '</footer>';
                $row .= '</article>';
                $comments[] = $row;
            }
            $title = $index['topic'];
            if ($index['picture'] != '' && is_file($imagedir . $index['picture'])) {
                $picture = '<p class=img><img src="' . $imageurl . $index['picture'] . '" alt=""></p>';
            } else {
                $picture = '';
            }
            $content = '<article>';
            $content .= '<header><h1>' . $index['topic'] . '</h1></header>';
            $content .= '<div class=detail>' . $picture . gcms::showDetail($index['detail'], true) . '</div>';
            $content .= '<footer>';
            $content .= '<p><strong>{LNG_BY}</strong> : ' . ($index['displayname'] == '' ? $index['email'] : $index['displayname']) . '</p>';
            $content .= '<p><strong>{LNG_POSTED}</strong>: ' . gcms::mktime2date($index['create_date']) . '</p>';
            $content .= '<p><strong>{LNG_URL}</strong> : ' . gcms::getURL($modules['module'], '', 0, 0, "wbid={$index['id']}") . '</p>';
            $content .= '</footer>';
            $content .= '</article>';
            $content .= implode("\n", $comments);
        }
    }
}
Exemple #4
0
 $content[] = '</tr>';
 $content[] = '</thead>';
 $content[] = '<tbody>';
 // query โมดูลที่ติดตั้ง
 $sql = "SELECT I.`id`,D.`topic`,I.`last_update`,I.`visited`,I.`language`,I.`published`";
 $sql .= ",M.`id` AS `module_id`,M.`owner`,M.`module`";
 $sql .= " {$sql1} {$where} ORDER BY M.`owner`,M.`module`,I.`language` LIMIT {$start}, {$list_per_page}";
 foreach ($db->customQuery($sql) as $i => $item) {
     $id = $item['id'];
     $content[] = '<tr id=M_' . $id . '>';
     $content[] = '<th headers=c0 id=r' . $id . ' scope=row class=topic><a href="{WEBURL}/index.php?module=' . $item['module'] . '" title="{LNG_PREVIEW}">' . $item['topic'] . '</a></th>';
     $content[] = '<td headers="r' . $id . ' c1" class="menu mobile"><a id=published_index_' . $id . ' class="icon-published' . $item['published'] . '" title="' . $lng['LNG_PUBLISHEDS'][$item['published']] . '"></a></td>';
     $content[] = '<td headers="r' . $id . ' c2" class=menu>' . ($item['language'] == '' ? '&nbsp;' : '<img src=' . WEB_URL . '/datas/language/' . $item['language'] . '.gif alt="' . $item['language'] . '">') . '</td>';
     $content[] = '<td headers="r' . $id . ' c3">' . $item['module'] . '</td>';
     $content[] = '<td headers="r' . $id . ' c4" class=tablet>' . $item['owner'] . '</td>';
     $content[] = '<td headers="r' . $id . ' c5" class="date mobile">' . gcms::mktime2date($item['last_update'], 'd M Y H:i') . ' {LNG_TIME_DIGIT}</td>';
     $content[] = '<td headers="r' . $id . ' c6" class="visited mobile">' . $item['visited'] . '</td>';
     $content[] = '<td headers="r' . $id . ' c7" class=menu><a class=icon-edit href="{URLQUERY?module=index-write&src=index-insmod&spage=' . $page . '&id=' . $id . '}" title="{LNG_EDIT}"></a></td>';
     $content[] = '<td headers="r' . $id . ' c7" class=menu><a class=icon-delete href="{URLQUERY}" title="{LNG_DELETE}" id=delete_module_' . $id . '></a></td>';
     $content[] = '</tr>';
 }
 $content[] = '</tbody>';
 $content[] = '</table>';
 // แบ่งหน้า
 $url = '<a href="{URLQUERY?page=%d}" title="{LNG_DISPLAY_PAGE} %d">%d</a>';
 $content[] = '<div class=splitpage>' . gcms::pagination($totalpage, $page, $url) . '</div>';
 $content[] = '</section>';
 $content[] = '<script>';
 $content[] = '$G(window).Ready(function(){';
 $content[] = "inintTR('insmod', /M_[0-9]+/);";
 $content[] = "inintIndexPages('insmod', false);";
Exemple #5
0
 foreach ($datas as $i => $item) {
     if ($i > 0 && $i % $match[2] == 0) {
         $widget[] = '</div><div class="row ' . $styles . 'view">';
     }
     $bg = $bg == 'bg1' ? 'bg2' : 'bg1';
     $replace = array();
     $replace[] = "{$bg} background" . rand(0, 5);
     if ($config['module_url'] == '1') {
         $replace[] = gcms::getURL($index['module'], $item['alias']);
     } else {
         $replace[] = gcms::getURL($index['module'], '', 0, $item['id']);
     }
     $replace[] = $item['topic'];
     $replace[] = $item['description'];
     $replace[] = gcms::ser2Str($item, 'category');
     $replace[] = gcms::mktime2date($item['create_date'], 'd M Y');
     $replace[] = $item['member_id'];
     $replace[] = $item['displayname'] == '' ? $item['email'] : $item['displayname'];
     $replace[] = $item['status'];
     $replace[] = number_format($item['comments']);
     $replace[] = number_format($item['visited']);
     if ($item['picture'] != '' && is_file(DATA_PATH . "document/{$item['picture']}")) {
         $replace[] = DATA_URL . "document/{$item['picture']}";
     } else {
         $replace[] = WEB_URL . "/{$index['default_icon']}";
     }
     if ($item['create_date'] > $valid_date && $item['comment_date'] == 0) {
         $replace[] = 'new';
     } elseif ($item['last_update'] > $valid_date || $item['comment_date'] > $valid_date) {
         $replace[] = 'update';
     } else {
                 $input = !$error ? 'email_subject' : $input;
                 $error = !$error ? 'TOPIC_EMPTY' : $error;
             } else {
                 $ret['ret_email_subject'] = '';
             }
         }
         if (!$error) {
             $save['last_update'] = $mmktime;
             if ($id == 0) {
                 // ใหม่
                 $id = $db->add(DB_EMAIL_TEMPLATE, $save);
             } else {
                 // แก้ไข
                 $db->edit(DB_EMAIL_TEMPLATE, $id, $save);
             }
             $ret['lastupdate'] = gcms::mktime2date($mmktime);
             if (isset($_POST['email_copy_to'])) {
                 $ret['email_copy_to'] = rawurlencode($save['copy_to']);
             }
             $ret['email_id'] = $id;
             $ret['error'] = 'SAVE_COMPLETE';
             $ret['location'] = gcms::retURL(WEB_URL . '/admin/index.php', array('module' => 'mailtemplate'));
         } else {
             // คืนค่า input ตัวแรกที่ error
             if ($input) {
                 $ret['input'] = $input;
             }
             $ret['error'] = $error;
         }
     }
 }
Exemple #7
0
 $config['member_status'][$item['status']] = $lng['LNG_GUEST'];
 // query
 $sql = "SELECT D.*,U.`fname`,U.`lname`,U.`email`,U.`status` FROM `" . DB_EDOCUMENT_DOWNLOAD . "` AS D";
 $sql .= " LEFT JOIN `" . DB_USER . "` AS U ON U.`id`=D.`member_id`";
 $sql .= " {$where} ORDER BY D.`last_update` DESC LIMIT {$start},{$list_per_page}";
 foreach ($db->customQuery($sql) as $item) {
     $tr = '<tr id=M_' . $item['id'] . '>';
     if ($item['member_id'] == 0) {
         $sender = '-';
     } else {
         $sender = trim("{$item['fname']} {$item['lname']}");
         $sender = $sender == '' ? $item['email'] : $sender;
     }
     $tr .= '<th headers=c0 id=r' . $id . ' scope=row class=topic><a href="index.php?id=' . $item['sender_id'] . '&module=editprofile&src=edocument-setup" class="cuttext status' . $item['status'] . '">' . $sender . '</a></th>';
     $tr .= '<td headers="r' . $id . ' c1" class="center status' . $item['status'] . ' mobile">' . $config['member_status'][$item['status']] . '</td>';
     $tr .= '<td headers="r' . $id . ' c2" class=date>' . gcms::mktime2date($item['last_update']) . '</td>';
     $tr .= '<td headers="r' . $id . ' c3" class="visited mobile">' . $item['downloads'] . '</td>';
     $tr .= '</tr>';
     $content[] = $tr;
 }
 $content[] = '</tbody>';
 $content[] = '</table>';
 // แบ่งหน้า
 $maxlink = 9;
 $url = '<a href="{URLQUERY?module=edocument-report&page=%d}" title="{LNG_DISPLAY_PAGE} %d">%d</a>';
 if ($totalpage > $maxlink) {
     $start = $page - floor($maxlink / 2);
     if ($start < 1) {
         $start = 1;
     } elseif ($start + $maxlink > $totalpage) {
         $start = $totalpage - $maxlink + 1;
Exemple #8
0
             $tr .= '<td headers="r' . $id . ' c2" class="menu mobile"><img src="' . DATA_URL . 'document/' . $item['picture'] . '" title="' . $lng['LNG_THUMBNAILS'][1] . '" width=22 height=22 alt=thumbnail>';
         } else {
             $tr .= '<td headers="r' . $id . ' c2" class="menu mobile"><span class=icon-thumbnail title="' . $lng['LNG_THUMBNAILS'][0] . '"></span>';
         }
         $tr .= '<td headers="r' . $id . ' c2" class="menu mobile"><span class="icon-reply reply' . $item['can_reply'] . '" title="' . $lng['LNG_CAN_REPLIES'][$item['can_reply']] . '"></span></td>';
         $tr .= '<td headers="r' . $id . ' c2" class="menu mobile"><span class="icon-published' . $item['published'] . '" title="' . $lng['LNG_PUBLISHEDS'][$item['published']] . '"></span></td>';
         $tr .= '<td headers="r' . $id . ' c2" class="menu mobile"><span class="icon-widgets reply' . (preg_match('/news=1/', $item['show_news']) ? 1 : 0) . '"></span></td>';
         $tr .= '<td headers="r' . $id . ' c5" class=mobile>';
         if (isset($categories[$item['category_id']])) {
             $category = $categories[$item['category_id']];
             $tr .= '<a href="{URLQUERY?cat=' . $item['category_id'] . '}" title="{LNG_SELECT_ITEM}">' . gcms::cutstring($category, 10) . '</a>';
         }
         $tr .= '</td>';
         $tr .= '<td headers="r' . $id . ' c6" class="username tablet"><a href="index.php?module=editprofile&amp;id=' . $item['member_id'] . '" class=status' . $item['status'] . ' title="{LNG_MEMBER_PROFILE}">' . $item['sender'] . '</a></td>';
         $tr .= '<td headers="r' . $id . ' c7" class="date tablet">' . gcms::mktime2date($item['create_date'], 'd M Y H:i') . '</td>';
         $tr .= '<td headers="r' . $id . ' c8" class="date tablet">' . gcms::mktime2date($item['last_update'], 'd M Y H:i') . '</td>';
         $tr .= '<td headers="r' . $id . ' c9" class="visited tablet">' . $item['visited'] . '</td>';
         $tr .= '<td headers="r' . $id . ' c10" class=menu><a href="{URLQUERY?module=document-write&src=document-setup&spage=' . $page . '&qid=' . $item['id'] . '}" title="{LNG_EDIT}" 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=10></td>';
 $content[] = '</tr>';
 $content[] = '</tfoot>';
 $content[] = '</table>';
Exemple #9
0
     $content[] = '<option value=' . $i . $sel . '>' . $item . '</option>';
 }
 $content[] = '</select></span>';
 $content[] = '<div class=comment>{LNG_PUBLISHED_SETTING}</div>';
 $content[] = '</div>';
 $content[] = '</fieldset>';
 // submit
 $content[] = '<fieldset class=submit>';
 $content[] = '<input type=submit class="button large save" value="{LNG_SAVE}">';
 $content[] = '<input type=button id=write_open class="button large preview" value="{LNG_PREVIEW}">';
 $content[] = gcms::get2Input($_GET);
 $content[] = '<input type=hidden id=write_id name=write_id value=' . (int) $index['id'] . '>';
 $content[] = '<input type=hidden name=module_id value=' . (int) $index['module_id'] . '>';
 $content[] = '<input type=hidden id=write_tab name=write_tab>';
 $content[] = '</fieldset>';
 $lastupdate = empty($index['last_update']) ? '-' : gcms::mktime2date($index['last_update']);
 $content[] = '<div class=lastupdate><span class=comment>{LNG_WRITE_COMMENT}</span>{LNG_LAST_UPDATE}<span id=lastupdate>' . $lastupdate . '</span></div>';
 $content[] = '</form>';
 $content[] = '</section>';
 $content[] = '<script>';
 $_SESSION['CKEDITOR'] = $_SESSION['login']['id'];
 foreach ($config['languages'] as $item) {
     $content[] = 'CKEDITOR.replace("write_detail_' . $item . '", {';
     $content[] = 'toolbar:"Document",';
     $content[] = 'language:"' . LANGUAGE . '",';
     $content[] = 'height:300,';
     if (is_dir(ROOT_PATH . 'ckfinder')) {
         $content[] = 'filebrowserBrowseUrl:"' . WEB_URL . '/ckfinder/ckfinder.html",';
         $content[] = 'filebrowserImageBrowseUrl:"' . WEB_URL . '/ckfinder/ckfinder.html?Type=Images",';
         $content[] = 'filebrowserFlashBrowseUrl:"' . WEB_URL . '/ckfinder/ckfinder.html?Type=Flash",';
         $content[] = 'filebrowserUploadUrl:"' . WEB_URL . '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files",';
Exemple #10
0
        } elseif ($result['displayname'] != '') {
            $u[] = $result['displayname'];
        } else {
            $u[] = $result['email'];
        }
        $replace[] = implode(' ', $u);
        if (is_file(ROOT_PATH . 'modules/pm/send.php')) {
            $replace[] = '<a class=icon-email-sent title="{LNG_PM_SEND_TITLE}" href="index.php?module=pm-send&amp;to=' . $result['id'] . '">&nbsp;</a>';
        } else {
            $replace[] = '<a class=icon-email-sent title="{LNG_MAIL_TO}" href="index.php?module=sendmail&amp;to=' . $result['id'] . '">&nbsp;</a>';
        }
        $replace[] = in_array($result['sex'], array_keys($lng['SEX'])) ? $result['sex'] : 'u';
        $replace[] = gcms::mktime2date($result['create_date'], 'd M Y');
        $replace[] = $result['website'] == '' ? '-' : "<a href=\"http://{$result['website']}\" target=_blank>{$result['website']}</a>";
        $replace[] = number_format($result['visited']);
        $replace[] = $result['fb'] == 1 ? 'icon-facebook' : '';
        $replace[] = gcms::mktime2date($result['lastvisited'], 'd M Y');
        $replace[] = $result['post'];
        $replace[] = $result['reply'];
        $replace[] = $config['member_status'][(int) $result['status']];
        $replace[] = $result['point'];
        $replace[] = OLD_PHP ? '$lng[\'$1\']' : 'gcms::getLng';
        $content = gcms::pregReplace($patt, $replace, gcms::loadtemplate('member', 'member', 'view'));
    } else {
        $title = $lng['LNG_ID_NOT_FOUND'];
        $content = '<div class=error>' . $title . '</div>';
    }
} else {
    $title = $lng['LNG_DATA_NOT_FOUND'];
    $content = '<div class=error>' . $title . '</div>';
}
Exemple #11
0
 foreach ($lng['LNG_PUBLISHEDS'] as $i => $item) {
     $sel = $index['published'] == $i ? ' selected' : '';
     $content[] = '<option value=' . $i . $sel . '>' . $item . '</option>';
 }
 $content[] = '</select></span>';
 $content[] = '<div class=comment>{LNG_PUBLISHED_SETTING}</div>';
 $content[] = '</div>';
 $content[] = '</fieldset>';
 // submit
 $content[] = '<fieldset class=submit>';
 $content[] = '<input type=submit class="button large save" value="{LNG_SAVE}">';
 $content[] = '<input type=button id=write_open class="button large preview" value="{LNG_PREVIEW}">';
 $content[] = '<input type=hidden id=write_id name=write_id value=' . $index['id'] . '>';
 $content[] = '<input type=hidden id=write_owner name=write_owner value=' . $index['owner'] . '>';
 $content[] = '</fieldset>';
 $lastupdate = $index['last_update'] == '' ? '-' : gcms::mktime2date($index['last_update']);
 $content[] = '<div class=lastupdate><span class=comment>{LNG_WRITE_COMMENT}</span>{LNG_LAST_UPDATE}<span id=lastupdate>' . $lastupdate . '</span></div>';
 $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 . '",';
 $content[] = 'height:300,';
 if (is_dir(ROOT_PATH . 'ckfinder')) {
     $content[] = 'filebrowserBrowseUrl:"' . WEB_URL . '/ckfinder/ckfinder.html",';
     $content[] = 'filebrowserImageBrowseUrl:"' . WEB_URL . '/ckfinder/ckfinder.html?Type=Images",';
     $content[] = 'filebrowserFlashBrowseUrl:"' . WEB_URL . '/ckfinder/ckfinder.html?Type=Flash",';
     $content[] = 'filebrowserUploadUrl:"' . WEB_URL . '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files",';
Exemple #12
0
 /**
  * ฟังก์ชั่นส่งเมล์จากแม่แบบจดหมาย
  *
  * @global resource $db database resource
  * @global array $config ตัวแปรเก็บการตั้งค่าของ GCMS
  * @global int $mmktime เวลาปัจจุบัน (mktime)
  * @param int $id ID ของจดหมายที่ต้องการส่ง
  * @param string $module ชื่อโมดูลของจดหมายที่ต้องการส่ง
  * @param array $datas ข้อมูลที่จะถูกแทนที่ลงในจดหมาย ในรูป 'ตัวแปร'=>'ข้อความ'
  * @param string $to ที่อยู่อีเมล์ผู้รับ  คั่นแต่ละรายชื่อด้วย ,
  * @return string สำเร็จคืนค่าว่าง ไม่สำเร็จ คืนค่าข้อความผิดพลาด
  */
 public static function sendMail($id, $module, $datas, $to)
 {
     global $db, $config, $mmktime;
     $sql = "SELECT * FROM `" . DB_EMAIL_TEMPLATE . "`";
     $sql .= " WHERE `module`='{$module}' AND `email_id`='{$id}' AND `language` IN ('" . LANGUAGE . "','th')";
     $sql .= " LIMIT 1";
     $email = $db->customQuery($sql);
     if (sizeof($email) == 0) {
         return 'Error : email template not found.';
     } else {
         $email = $email[0];
         // ข้อความในอีเมล์
         $replace = array();
         $replace['/%WEBTITLE%/'] = strip_tags($config['web_title']);
         $replace['/%WEBURL%/'] = WEB_URL;
         $replace['/%EMAIL%/'] = $to;
         $replace['/%ADMINEMAIL%/'] = empty($email['from_email']) ? $config['noreply_email'] : $email['from_email'];
         $replace['/%TIME%/'] = gcms::mktime2date($mmktime);
         $replace = array_merge($replace, $datas);
         $patt = array_keys($replace);
         $replace = array_values($replace);
         $msg = preg_replace($patt, $replace, $email['detail']);
         $subject = preg_replace($patt, $replace, $email['subject']);
         // ส่งอีเมล์
         return gcms::customMail($to . (!empty($email['copy_to']) ? ",{$email['copy_to']}" : ''), $email['from_email'], $subject, $msg);
     }
 }
Exemple #13
0
                    $row = '<article class=r>';
                    $row .= '<div class=detail>' . gcms::showDetail($item['detail'], true) . '</div>';
                    $row .= '<footer>';
                    $row .= '<p><strong>{LNG_COMMENT_NO}#' . $i . '</strong></p>';
                    $row .= '<p><strong>{LNG_BY}</strong>: ' . $index['displayname'] . '</p>';
                    $row .= '<p><strong>{LNG_POSTED}</strong>: ' . gcms::mktime2date($index['last_update']) . '</p>';
                    $row .= '<p><strong>{LNG_IP}</strong>: ' . gcms::showip($item['ip']) . '</p>';
                    $row .= '</footer>';
                    $row .= '</article>';
                    $comments[] = $row;
                }
            }
            $title = $index['topic'];
            if ($config['module_url'] == '1') {
                $url = gcms::getURL($modules['module'], $index['alias'], 0, 0, '', false);
            } else {
                $url = gcms::getURL($modules['module'], '', 0, $index['id'], '', false);
            }
            $content = '<article>';
            $content .= '<header><h1>' . $index['topic'] . '</h1></header>';
            $content .= '<div class=detail>' . gcms::showDetail($index['detail'], true, false) . '</div>';
            $content .= '<footer>';
            $content .= '<p><strong>{LNG_WRITER}</strong> : ' . ($index['displayname'] == '' ? $index['email'] : $index['displayname']) . '</p>';
            $content .= '<p><strong>{LNG_LAST_UPDATE}</strong>: ' . gcms::mktime2date($index['last_update']) . '</p>';
            $content .= '<p><strong>{LNG_URL}</strong> : ' . $url . '</p>';
            $content .= '</footer>';
            $content .= '</article>';
            $content .= implode("\n", $comments);
        }
    }
}
     $content[] = '<div class=comment id=result_email_language>{LNG_EMAIL_LANGUAGE_COMMENT}</div>';
     $content[] = '</div>';
 }
 // detail
 $content[] = '<div class=item>';
 $content[] = '<label for=email_detail>{LNG_DETAIL} </label>';
 $content[] = '<div><textarea name=email_detail id=email_detail>' . gcms::detail2TXT($email, 'detail') . '</textarea></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 id=email_id name=email_id value=' . $email['id'] . '>';
 $content[] = '</fieldset>';
 $lastupdate = $email['last_update'] == '' ? '-' : gcms::mktime2date($email['last_update']);
 $content[] = '<div class=lastupdate><span class=comment>{LNG_WRITE_COMMENT}</span>{LNG_LAST_UPDATE}<span id=lastupdate>' . $lastupdate . '</span></div>';
 $content[] = '</form>';
 $content[] = '</section>';
 $content[] = '<script>';
 $content[] = '$G(window).Ready(function(){';
 $_SESSION['CKEDITOR'] = $_SESSION['login']['id'];
 $content[] = 'CKEDITOR.replace("email_detail", {';
 $content[] = 'toolbar:"Document",';
 $content[] = 'language:"' . LANGUAGE . '",';
 $content[] = 'contentsCss:"",';
 $content[] = 'height:300,';
 if (is_dir(ROOT_PATH . 'ckfinder')) {
     $content[] = 'filebrowserBrowseUrl:"' . WEB_URL . '/ckfinder/ckfinder.html",';
     $content[] = 'filebrowserImageBrowseUrl:"' . WEB_URL . '/ckfinder/ckfinder.html?Type=Images",';
     $content[] = 'filebrowserFlashBrowseUrl:"' . WEB_URL . '/ckfinder/ckfinder.html?Type=Flash",';
Exemple #15
0
 $replace[] = $canDelete ? '\\1' : 'hidden';
 $replace[] = $canReply ? '\\1' : 'hidden';
 $replace[] = gcms::HighlightSearch(gcms::showDetail($index['detail'], $canview, false), $search);
 $replace[] = LANGUAGE;
 $replace[] = (int) $index['member_id'];
 $replace[] = empty($index['displayname']) ? $index['email'] : $index['displayname'];
 if (is_file(DATA_PATH . "document/{$index['picture']}")) {
     // รูปภาพของบทความ
     $image_src = DATA_URL . "document/{$index['picture']}";
     $replace[] = '<figure><img src="' . $image_src . '" alt="' . $index['topic'] . '"></figure>';
 } else {
     $image_src = WEB_URL . "/{$index['default_icon']}";
     $replace[] = '';
 }
 $replace[] = $index['status'];
 $replace[] = gcms::mktime2date($index['create_date']);
 $replace[] = date(DATE_ISO8601, $index['create_date']);
 $replace[] = $category;
 $replace[] = number_format($index['visited']);
 $replace[] = sizeof($relate) == 0 ? '' : implode('', $relate);
 $replace[] = number_format($index['comments']);
 $replace[] = $index['id'];
 $replace[] = $login['password'];
 $replace[] = $login['email'];
 if (isset($register_antispamchar)) {
     $replace[] = $register_antispamchar;
     $replace[] = $isAdmin ? $_SESSION[$register_antispamchar] : '';
 } else {
     $replace[] = '';
     $replace[] = '';
 }
Exemple #16
0
 // หน้าหลัก
 $breadcrumbs['HOME'] = gcms::breadcrumb('icon-home', $canonical, $install_modules[$module_list[0]]['menu_tooltip'], $install_modules[$module_list[0]]['menu_text'], $breadcrumb);
 if (isset($ds) || !empty($tag)) {
     // tag หรือ calendar
     if (!isset($default)) {
         include ROOT_PATH . 'modules/document/default.config.php';
     }
     $index = $default['document'];
     $index['categories'] = 0;
     if (isset($ds)) {
         // เรียกจากวันที่
         $selday = mktime(0, 0, 0, $ds[2], $ds[1], (int) $ds[3] - $lng['YEAR_OFFSET']);
         $nextday = $selday + 86400;
         $sqls[] = "I.`create_date` >= {$selday}";
         $sqls[] = "I.`create_date` < {$nextday}";
         $index['topic'] = $lng['LNG_DOCUMENT_DATE'] . ' ' . gcms::mktime2date($selday, 'd F Y');
         // breadcrumb ของวันที่ที่เรียก
         $breadcrumbs['MODULE'] = gcms::breadcrumb('', gcms::getURL('calendar', "{$ds['1']}-{$ds['2']}-{$ds['3']}"), $index['topic'], $index['topic'], $breadcrumb);
     } elseif ($tag != '') {
         // เรียกตาม tags
         $index['topic'] = $lng['LNG_TAGS'] . ' ' . $tag;
         // breadcrumb ของ tag ที่เรียก
         $breadcrumbs['MODULE'] = gcms::breadcrumb('', gcms::getURL('tag', $tag), $index['topic'], $index['topic'], $breadcrumb);
     }
     $index['keywords'] = "{$index['topic']},{$keywords}";
     $index['description'] = "{$index['topic']},{$description}";
     $index['menu_text'] = $index['topic'];
     $index['module'] = 'document';
     include ROOT_PATH . 'modules/document/default.config.php';
     $index = array_merge($default['document'], $index);
 } else {
Exemple #17
0
 $content[] = '<tbody>';
 foreach ($datas as $item) {
     $id = $item['id'];
     $tr = '<tr id=user-' . $id . ' class=sort>';
     $tr .= '<th headers=c0 scope=row id=r' . $id . '><a href="index.php?module=textlink-setup&amp;name=' . $item['name'] . '" title="' . $item['description'] . '"' . ($item['published'] == 0 ? ' class=ban' : '') . '>' . $item['name'] . '</a></th>';
     $tr .= '<td headers="r' . $id . ' c1" class=check-column><a id=check_' . $id . ' class=icon-uncheck></a></td>';
     $tr .= '<td headers="r' . $id . ' c2"><a id=move_' . $id . ' title="{LNG_DRAG_MOVE}" class=icon-move></a></td>';
     $tr .= '<td headers="r' . $id . ' c3" class=tablet>' . $item['description'] . ' (' . $item['type'] . ')</td>';
     $tr .= '<td headers="r' . $id . ' c4" class=tablet><a href="' . $item['url'] . '" target=_blank>' . $item['url'] . '</a></td>';
     $tr .= '<td headers="r' . $id . ' c5" class=tablet>' . $item['text'] . '</td>';
     $tr .= '<td headers="r' . $id . ' c6" class="center tablet">' . $item['width'] . ' * ' . $item['height'] . '</td>';
     $tr .= '<td headers="r' . $id . ' c7" class="date mobile">' . gcms::mktime2date($item['publish_start'], 'd M Y') . '</td>';
     if ($item['publish_end'] == 0) {
         $tr .= '<td headers="r' . $id . ' c8" class="date tablet">{LNG_DATELESS}</td>';
     } else {
         $tr .= '<td headers="r' . $id . ' c8" class="date tablet' . ($mmktime > $item['publish_end'] ? ' noactivate' : '') . '">' . gcms::mktime2date($item['publish_end'], 'd M Y') . '</td>';
     }
     $tr .= '<td headers="r' . $id . ' c9"><a href="index.php?module=textlink-write&amp;id=' . $id . '" title="{LNG_EDIT}" 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=8></td>';
 $content[] = '</tr>';
 $content[] = '</tfoot>';
 $content[] = '</table>';
 $content[] = '<div class=table_nav>';
Exemple #18
0
<?php

// modules/document/calendar.php
if (defined('MAIN_INIT')) {
    $d = gcms::getVars($_REQUEST, 'd', '');
    if ($d == 'today') {
        $d = gcms::mktime2date($mmktime, 'd-m-Y');
    }
    // โมดูลที่เรียก
    if (preg_match('/^([0-3]?[0-9])[\\-|\\s]([0-1]?[0-9])[\\-|\\s]([0-9]{4,4})$/', $d, $ds)) {
        include ROOT_PATH . 'modules/document/list.php';
    } else {
        $title = $lng['PAGE_NOT_FOUND'];
        $content = '<div class=error>' . $title . '</div>';
    }
}
Exemple #19
0
     $cache->save($sql, $datas);
 }
 // เครื่องหมาย new
 $valid_date = $mmktime - $match[5];
 // template
 $skin = gcms::loadtemplate($index['module'], 'board', 'widgetitem');
 $patt = array('/{BG}/', '/{URL}/', '/{TOPIC}/', '/{DATE}/', '/{UID}/', '/{SENDER}/', '/{STATUS}/', '/{THUMB}/', '/{ICON}/');
 $widget = array();
 $bg = 'bg2';
 foreach ($datas as $item) {
     $bg = $bg == 'bg1' ? 'bg2' : 'bg1';
     $replace = array();
     $replace[] = "{$bg} background" . rand(0, 5);
     $replace[] = gcms::getURL($index['module'], '', 0, 0, "wbid={$item['id']}");
     $replace[] = $item['topic'];
     $replace[] = gcms::mktime2date($item['comment_date'] > 0 ? $item['comment_date'] : $item['last_update']);
     $replace[] = $item['member_id'];
     $replace[] = $item['displayname'];
     $replace[] = $item['status'];
     if ($item['picture'] != '' && is_file(DATA_PATH . "board/thumb-{$item['picture']}")) {
         $replace[] = DATA_URL . "board/thumb-{$item['picture']}";
     } else {
         $replace[] = WEB_URL . "/{$index['default_icon']}";
     }
     if ($item['create_date'] > $valid_date && $item['comment_date'] == 0) {
         $replace[] = 'new';
     } elseif ($item['last_update'] > $valid_date || $item['comment_date'] > $valid_date) {
         $replace[] = 'update';
     } else {
         $replace[] = '';
     }
Exemple #20
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>';
 // แบ่งหน้า
Exemple #21
0
 $datas = sizeof($datas) == 1 ? $datas[0] : array('counter' => 0, 'visited' => 0, 'members' => 0, 'activate' => 0, 'ban' => 0, 'useronline' => 0);
 $content[] = '<section class=section>';
 $content[] = '<header><h1 class=icon-summary>{LNG_SITE_REPORT}</h1></header>';
 $content[] = '<table class="summary fullwidth">';
 $content[] = '<caption>{LNG_REPORT_MEMBER}</caption>';
 $content[] = '<tbody>';
 $content[] = '<tr><th scope=row><a href="' . WEB_URL . '/admin/index.php?module=member&amp;order=0">{LNG_REPORT_MEMBER_ALL}</a></th><td class=right>' . number_format($datas['members']) . ' {LNG_PEOPLE}</td></tr>';
 $content[] = '<tr class=bg2><th scope=row><a href="' . WEB_URL . '/admin/index.php?module=member&amp;order=2">{LNG_MEMBER_NOT_CONFIRM}</a></th><td class=right>' . number_format($datas['activate']) . ' {LNG_PEOPLE}</td></tr>';
 $content[] = '<tr><th scope=row><a href="' . WEB_URL . '/admin/index.php?module=member&amp;order=9">{LNG_MEMBER_BAN}</a></th><td class=right>' . number_format($datas['ban']) . ' {LNG_PEOPLE}</td></tr>';
 $content[] = '<tr class=bg2><th scope=row>{LNG_COUNTER_ALL}</th><td class=right>' . number_format($datas['counter']) . ' {LNG_PEOPLE}</td></tr>';
 $content[] = '<tr><th scope=row>{LNG_COUNTER_ONLINE}</th><td class=right>' . number_format($datas['useronline']) . ' {LNG_PEOPLE}</td></tr>';
 $content[] = '<tr class=bg2><th scope=row><a href="' . WEB_URL . '/admin/index.php?module=report">{LNG_COUNTER_TODAY}</a></th><td class=right>' . number_format($datas['visited']) . ' {LNG_PEOPLE}</td></tr>';
 if (is_file(DATA_PATH . 'index.php')) {
     $date = file_get_contents(DATA_PATH . 'index.php');
     if (preg_match('/([0-9]+){0,2}-([0-9]+){0,2}-([0-9]+){0,4}\\s([0-9]+){0,2}:([0-9]+){0,2}:([0-9]+){0,2}/', $date, $match)) {
         $cron_time = gcms::mktime2date(mktime($match[4], $match[5], $match[6], $match[2], $match[1], $match[3]));
     } else {
         $cron_time = '-';
     }
 } else {
     $cron_time = '-';
 }
 $content[] = '<tr><th scope=row>{LNG_CRON_CREATED}</th><td class=right>' . $cron_time . '</td></tr>';
 $content[] = '</tbody>';
 $content[] = '<tfoot>';
 $content[] = '<tr><td colspan=2 class=right>{LNG_REPORT_VERSION}</td></tr>';
 $content[] = '</tfoot>';
 $content[] = '</table>';
 $content[] = '</section>';
 // gcms news
 $content[] = '<section class=section>';
Exemple #22
0
 // list รายการ
 $sql = "SELECT D.*,U.`fname`,U.`lname`,U.`email`,U.`status` FROM `" . DB_EDOCUMENT_DOWNLOAD . "` AS D";
 $sql .= " LEFT JOIN `" . DB_USER . "` AS U ON U.`id`=D.`member_id`";
 $sql .= " {$where} ORDER BY D.`last_update` DESC LIMIT {$start},{$config['edocument_listperpage']}";
 $datas = $cache->get($sql);
 if (!$datas) {
     $datas = $db->customQuery($sql);
     $cache->save($sql, $datas);
 }
 // อ่านรายการลงใน $list
 $list = array();
 $patt = array('/{DATE}/', '/{DOWNLOADS}/', '/{NAME}/', '/{GROUP}/', '/{STATUS}/', '/{UID}/');
 $listitem = gcms::loadtemplate($index['module'], 'edocument', 'reportitem');
 foreach ($datas as $item) {
     $replace = array();
     $replace[] = gcms::mktime2date($item['last_update']);
     $replace[] = $item['downloads'];
     if ($item['member_id'] == 0) {
         $replace[] = '&nbsp;';
         $replace[] = '{LNG_GUEST}';
     } else {
         $sender = trim("{$item['fname']} {$item['lname']}");
         $replace[] = $sender == '' ? $item['email'] : $sender;
         $replace[] = $config['member_status'][$item['status']];
     }
     $replace[] = $item['status'];
     $replace[] = $item['member_id'];
     $list[] = preg_replace($patt, $replace, $listitem);
 }
 // แบ่งหน้า
 $maxlink = 9;
Exemple #23
0
function boardList($sql, &$list)
{
    global $db, $cache, $patt, $listitem, $config, $cat, $valid_date, $index, $page;
    $datas = $cache->get($sql);
    if (!$datas) {
        $datas = $db->customQuery($sql);
        $cache->save($sql, $datas);
    }
    foreach ($datas as $item) {
        $ctiime = $item['comment_date'] > 0 ? $item['comment_date'] : $item['last_update'];
        $replace = array();
        $replace[] = $item['id'];
        if ($item['pin'] > 0) {
            $replace[] = WEB_URL . '/' . SKIN . 'board/img/pin.png';
        } elseif (is_file(DATA_PATH . "board/thumb-{$item['picture']}")) {
            $replace[] = DATA_URL . "board/thumb-{$item['picture']}";
        } elseif (is_file(DATA_PATH . "board/{$item['picture']}")) {
            $replace[] = DATA_URL . "board/{$item['picture']}";
        } else {
            $replace[] = WEB_URL . "/{$index['default_icon']}";
        }
        $replace[] = gcms::getURL($index['module'], '', $cat, 0, "wbid={$item['id']}");
        $replace[] = $item['topic'];
        $replace[] = (int) $item['member_id'];
        $replace[] = $item['sender'];
        $replace[] = $item['status'];
        $replace[] = gcms::mktime2date($item['create_date']);
        $replace[] = date(DATE_ISO8601, $item['create_date']);
        $replace[] = number_format($item['visited']);
        $replace[] = number_format($item['comments']);
        $replace[] = $item['comment_date'] == 0 ? '&nbsp;' : gcms::mktime2date($item['comment_date']);
        $replace[] = $item['comment_date'] == 0 ? '&nbsp;' : $item['commentator'];
        $replace[] = (int) $item['commentator_id'];
        $replace[] = $item['replyer_status'];
        $replace[] = $ctiime >= $valid_date ? $item['comment_date'] > 0 ? ' update' : ' new' : '';
        $list[] = preg_replace($patt, $replace, $listitem);
    }
}