function item($items) { static $instance = array(); $item = explode('.', $items, 2); $lg = $item[0]; $it = $item[1]; if (!file_exists(BASE_DIR . 'plugins' . DS . 'forum' . DS . 'forum' . DS . 'languages' . DS . Config::item('lang') . DS . $lg . '.php')) { $lang_file = BASE_DIR . 'plugins' . DS . 'forum' . DS . 'forum' . DS . 'languages' . DS . 'english' . DS . $lg . '.php'; } else { $lang_file = BASE_DIR . 'plugins' . DS . 'forum' . DS . 'forum' . DS . 'languages' . DS . DS . Config::item('lang') . DS . $lg . '.php'; } if (!isset($instance[$lg])) { include $lang_file; $instance[$lg] = $lang; } if (isset($instance[$lg][$it])) { if ($it) { return $instance[$lg][$it]; } else { return $instance[$lg]; } } else { return $items; } }
function img($src, $size = '100%', $params = array()) { if (!$size) { $size = Config::item('thumb_size'); } $image_info = @getimagesize($src); if ($image_info[3]) { $sizes = explode('"', $image_info[3]); $image_info[0] = $sizes[1]; $image_info[1] = $sizes[3]; } if (strpos($size, '%') !== false) { $image_info[0] = round($image_info[0] * (int) $size / 100); $image_info[1] = round($image_info[1] * (int) $size / 100); } else { if (max($image_info[0], $image_info[1]) > $size) { $ratio = $size / max($image_info[0], $image_info[1]); $image_info[0] = round($image_info[0] * $ratio); $image_info[1] = round($image_info[1] * $ratio); } } if ($image_info[1] && $image_info[1]) { return "<img border=\"0\" src=\"{$src}\" width=\"{$image_info[0]}\" height=\"{$image_info[1]}\" " . html::params($params) . "/>"; } else { return "<img border=\"0\" src=\"{$src}\" " . html::params($params) . "/>"; } }
function __construct($method) { $dcUrl = Config::item('dcInfo'); $this->ip = $dcUrl['ip']; $this->method = $method; $this->user = array('user' => $dcUrl['user'], 'ip' => \common\Client::getIp()); }
public function __construct($config = array()) { // Check for GD library before doing anything if (extension_loaded('gd')) { $config += Config::item('dynamicimage'); $this->config = $config; // Check for a filename and check it is a file if ($this->config['filename'] && is_file($this->config['filename'])) { // Set filename $this->filename = $this->config['filename']; $this->gd_data = getimagesize($this->filename); $this->gd_image_out = FALSE; // Get filesize $this->filesize = filesize($this->filename); // Get the Mimetype $this->mime_type = $this->gd_data['mime']; // Get dimensions $this->width = $this->gd_data[0]; $this->height = $this->gd_data[1]; $this->background_colour = $this->config['background']; $this->maintain_transparency = $this->config['maintain_transparency']; // Setup GD object switch ($this->gd_data['mime']) { // If image is PNG, load PNG file case "image/png": $this->gd_image = imagecreatefrompng($this->filename); break; // If image is JPG, load JPG file // If image is JPG, load JPG file case "image/jpg": $this->gd_image = imagecreatefromjpeg($this->filename); break; // If image is GIF, load GIF file // If image is GIF, load GIF file case "image/gif": $this->gd_image = imagecreatefromgif($this->filename); break; // Otherwise image is not supported in this version (more to follow) // Otherwise image is not supported in this version (more to follow) default: throw new Kohana_Exception("DynamicImage.__construct() Filetype {$this->mime_type} not supported yet."); return; } $this->print_image($this->config['width'], $this->config['height'], $this->config['maintain_ratio'], $this->config['format']); } else { // Otherwise die horribly return FALSE; } } else { // Die informing user of lack of extentions throw new Kohana_Exception('GD Library not installed'); return; } }
function Controller() { $this->validate = Inspekt::makeSuperCage(); $this->db = Database::getInstance(array('conn_id' => Config::item('LINK_ID'))); $this->view = new View(); // auto load helper load_helper(array('php', 'time', 'html', 'form', 'table', 'forum')); // load forum model load_model('forum', FALSE); load_model('check', FALSE); $this->forum = forum_model::getInstance(); }
public static function pailemai_categorylist(\ApiParam $params) { //拍了卖专用 $mobileCategoryList = array(); $coverImageList = \Config::item('app.categoryCoverImages'); $blackCategoryList = array('huochepiao', 'shoujihaoma', 'cheliangqiugou', 'qiumai'); foreach ($coverImageList as $categoryEnglishName => $imageUrl) { if (in_array($categoryEnglishName, $blackCategoryList)) { continue; } $category = \Category::loadByName($categoryEnglishName); if ($category->name) { $mobileCategoryList[] = array('name' => $category->name, 'queryUri' => 'categoryEnglishName:' . $categoryEnglishName, 'pic' => $imageUrl, 'categoryEnglishName' => $categoryEnglishName); } } return $mobileCategoryList; }
function tds($tds = array()) { $table_level = (int) Config::item('table_level'); $html = ''; // normalize the data if (!is_array($tds[0])) { $tds = array($tds); } if (count($tds) > 0) { $html .= table::create_element('tr'); foreach ($tds as $td) { $html .= table::create_element('td', $td, TRUE); } $html .= table::create_element('/tr'); } return $html; }
public function call() { $cacheEnabled = array_get($this->action, "cacheEnabled") && Config::item("application", "cache", true); if ($cacheEnabled && ($data = Cache::get(URI::current()))) { $headersEnd = strpos($data, "\n\n"); if ($headersEnd > 0) { $headers = explode("\n", substr($data, 0, $headersEnd)); foreach ($headers as $header) { header($header); } } $data = substr($data, $headersEnd + 2); return $data; } $response = $this->response(); if ($cacheEnabled) { $headersList = implode("\n", headers_list()); Cache::save(URI::current(), $headersList . "\n\n" . $response, array_get($this->action, "cacheExpirationTime")); } else { Cache::remove(URI::current()); } return $response; }
public static function conn($name = null) { if (is_null($name)) { $keys = array_keys(Config::group("databases")); if (count($keys) > 0) { $name = $keys[0]; } } if (!isset(static::$connections[$name])) { $config = Config::item("databases", $name); switch ($config["type"]) { case "mysql": include_once J_SYSTEMPATH . "database" . DS . "mysql" . DS . "MysqlDB" . EXT; include_once J_SYSTEMPATH . "database" . DS . "mysql" . DS . "MysqlRecordSet" . EXT; static::$connections[$name] = new MysqlDB($config); break; default: trigger_error("Database type <b>'" . $config["type"] . "'</b> not suported."); break; } } return static::$connections[$name]; }
function render($template, $vars = array(), $debug = FALSE) { if ($debug) { echo '<pre>'; var_dump($vars); echo '</pre>'; } if (is_array($vars) && count($vars) > 0) { $this->setVars($vars); } $viewPath = $this->getViewPath($template); if (!file_exists($viewPath)) { cpg_die(ERROR, sprintf(Lang::item('error.missing_vw_file'), $viewPath), __FILE__, __LINE__); } extract($this->vars); // checking model $authorizer = check_model::getInstance(); ob_start(); include_once $viewPath; $fr_contents = ob_get_contents(); ob_end_clean(); if (empty($fr_title) || !$fr_title) { $fr_title = $vars[nagavitor][0][1] . " - " . Config::item('fr_title'); } include_once $this->getMainPath(); }
function reply() { include BASE_DIR . 'include' . DS . 'smilies.inc.php'; include BASE_DIR . 'include' . DS . 'mailer.inc.php'; $vars = array(); $errors = array(); $authorizer = check_model::getInstance(); $vars['topic_id'] = $this->validate->get->getInt('id'); if (!$authorizer->is_topic_id($vars['topic_id'])) { cpg_die(ERROR, Lang::item('error.wrong_topic_id'), __FILE__, __LINE__); } if (!$authorizer->can_reply($vars['topic_id'])) { cpg_die(ERROR, Lang::item('error.perm_denied'), __FILE__, __LINE__); } $vars['nagavitor'] = $this->forum->get_nagavitor(); $vars['icons'] = $this->forum->get_icons(); $topic = $this->forum->get_topic_data($vars['topic_id'], 'board_id'); $messages = $this->forum->get_message($vars['topic_id'], 'subject', 'msg_id asc', '1'); $data = array('icon' => 'icon1', 'subject' => Lang::item('topic.re') . $messages[0]['subject']); if ($this->validate->post->keyExists('submit')) { $data = array('topic_id' => $vars['topic_id'], 'icon' => $this->validate->post->getRaw('icon'), 'subject' => $this->validate->post->getEscaped('subject'), 'body' => $this->validate->post->getRaw('body'), 'board_id' => $topic['board_id'], 'poster_time' => time(), 'poster_id' => USER_ID, 'poster_name' => USER_NAME, 'poster_ip' => Config::item('hdr_ip'), 'smileys_enabled' => 1); if (Config::item('fr_msg_icons') == 0 && $data['icon'] == '') { $data['icon'] = 'icon1'; } if ($data['subject'] == '') { $errors[] = Lang::item('error.empty_subject'); } if ($data['icon'] == '') { $errors[] = Lang::item('error.no_msg_icon'); } if ($data['body'] == '') { $errors[] = Lang::item('error.empty_body'); } if (strlen($data['body']) > Config::item('fr_msg_max_size') && Config::item('fr_msg_max_size')) { $data['body'] = substr($data['body'], 0, Config::item('fr_msg_max_size')); } global $CONFIG; if ($CONFIG['comment_captcha'] == 1 || $CONFIG['comment_captcha'] == 2 && !USER_ID) { if (!captcha_plugin_enabled('comment')) { global $lang_errors; $superCage = Inspekt::makeSuperCage(); require "include/captcha.inc.php"; $matches = $superCage->post->getMatched('confirmCode', '/^[a-zA-Z0-9]+$/'); if (!$matches[0] || !PhpCaptcha::Validate($matches[0])) { $errors[] = $lang_errors['captcha_error']; } } else { CPGPluginAPI::action('captcha_comment_validate', null); } } if (count($errors) == 0) { if ($authorizer->double_post()) { cpg_die(ERROR, Lang::item('error.already_post'), __FILE__, __LINE__); } else { $msg_id = $this->forum->insert_message($data); // to-do: send notify email $users = $this->forum->get_notify_user('', $vars['topic_id']); foreach ($users as $user) { if ($user['user_id'] == USER_ID) { continue; } $user = $this->forum->get_user_data($user['user_id'], 'user_email'); // prepare email $email_subject = Lang::item('topic.topic_reply') . $data['subject']; $email_body = sprintf(Lang::item('topic.notify_email'), Config::item('fr_prefix_url') . 'profile.php?uid=' . USER_ID, USER_NAME, Config::item('fr_prefix_url') . forum::link('message', '', $msg_id), Config::item('fr_prefix_url') . forum::link('message', '', $msg_id), Config::item('fr_prefix_url') . forum::link('topic', 'notify', $vars['topic_id']), Config::item('fr_prefix_url') . forum::link('topic', 'notify', $vars['topic_id']), Config::item('fr_title')); // send mail cpg_mail($user['user_email'], $email_subject, $email_body, 'text/html', Config::item('fr_title'), Config::item('gallery_admin_email')); // set send = 0 $this->forum->set_topic_notify($vars['topic_id'], 0, $user['user_id']); } if ($this->validate->post->getInt('notify') === 1) { $this->forum->set_topic_notify($vars['topic_id'], $this->validate->post->getInt('notify')); } if ($this->validate->post->getInt('notify') === 0) { $this->forum->unnotify_topic($vars['topic_id']); } forum::message(Lang::item('common.message'), sprintf(Lang::item('message.new_msg_success'), $data['subject']), 'forum.php?c=message&id=' . $msg_id); } } } $vars['errors'] = $errors; $vars['form'] = $data; $this->view->render('topic/reply', $vars); }
echo $styles; ?> <title><?php echo $page_title; ?> </title> </head> <body> <div id="<?php echo $page_id; ?> "> <h1>Hanami</h1> <h2><?php echo $title; ?> </h2> <?php echo $content; echo Kohana::debug(Config::item('core.modules')); ?> <p class="copyright hanami">Powerd by HanamiCMS v{hanami_version}<br/>Copyright ©2008 Hanami Team</p> <p class="copyright kohana">Rendered in {execution_time} seconds, using {memory_usage} of memory<br/>Copyright ©2007-2008 Kohana Team</p> </div> </body> </html>
public static function pets_categorylist(\ApiParam $params) { return \Config::item('app.petsCategoryList'); }
<?php /************************************************** Coppermine 1.5.x Plugin - forum ************************************************* Copyright (c) 2010 foulu (Le Hoai Phuong), eenemeenemuu ************************************************* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. ******************************************** $HeadURL$ $Revision$ $LastChangedBy$ $Date$ **************************************************/ echo table::open(); echo form::open('forum.php?c=profile&id=' . $user['user_id'], 'profile', 'post', TRUE); echo table::td(Lang::item('profile.profile_title'), 4); echo table::td(Lang::item('profile.avatar'), 4, 'tableh2'); echo table::tds(array(array('class' => 'tableb', 'width' => '5%', 'align' => 'center', 'text' => form::radio('avatar_type', 'url', '', $user['fr_avatar'] ? 'url' : '')), array('class' => 'tableb', 'width' => '20%', 'text' => Lang::item('profile.url')), array('class' => 'tableb', 'width' => '50%', 'text' => form::text('fr_avatar_url', $user['fr_avatar'])), array('class' => 'tableb', 'width' => '25%', 'align' => 'center', 'rowspan' => 2, 'text' => !php::is_empty_string($user['fr_avatar']) ? html::img($user['fr_avatar'], Config::item('fr_avatar_size')) . BR . BR . html::button('forum.php?c=profile&m=remove_avatar', Lang::item('profile.remove_avatar')) : ''))); echo table::tds(array(array('class' => 'tableb', 'align' => 'center', 'text' => form::radio('avatar_type', 'file')), array('class' => 'tableb', 'text' => Lang::item('profile.file')), array('class' => 'tableb', 'text' => form::file('fr_avatar_file')))); echo table::td(Lang::item('profile.profile'), 4, 'tableh2'); echo table::tds(array(array('class' => 'tableb', 'colspan' => 2, 'rowspan' => 3, 'text' => Lang::item('profile.signature')), array('class' => 'tableb', 'colspan' => 2, 'text' => forum::generate_bbcode_tags('profile', 'fr_signature')))); echo table::tds(array(array('class' => 'tableb', 'colspan' => 2, 'align' => 'center', 'text' => form::textarea('fr_signature', $user['fr_signature'])))); echo table::tds(array(array('class' => 'tableb', 'colspan' => 2, 'text' => generate_smilies('profile', 'fr_signature')))); echo table::tds(array(array('class' => 'tablef', 'colspan' => 4, 'text' => form::submit(Lang::item('common.change'), 'submit')))); echo form::close(); echo table::close();
public static function mobile_mobile_config(\ApiParam $params) { //app mobile tracking config $apiKey = $params->api_key; //todo udid 区分限制 //load config data $mktConfig = \MktConfig::loadByConfigKey("mktTrackMobileData"); $configValue = $mktConfig->configValue; $values = json_decode($configValue, true); $configArray = array(); if (isset($values['all'])) { $configArray = $values['all']; } if ($apiKey == "api_mobile_android" && isset($values['android'])) { $configArray = array_merge($configArray, $values['android']); //从配置中加载最新版本 $versions = \Mobile_Logic::androidVersions(); $lastVersion = array_shift(array_keys($versions)); if ($lastVersion) { $configArray['serverVersion'] = $lastVersion; } } else { if (isset($values['iphone'])) { $configArray = array_merge($configArray, $values['iphone']); } } // 加载图片服务器配置 $img_space = \Config::item("env.img.upyun"); $img_space_name = $img_space['policy']['bucket']; $img_space_policy = base64_encode(json_encode($img_space['policy'] + array("expiration" => time() + 3600 * 24))); $img_space_sign = md5("{$img_space_policy}&{$img_space['form_api_secret']}"); $imgConfig = array(); $imgConfig['server'] = "http://v0.api.upyun.com/{$img_space_name}"; $imgConfig['fileKey'] = 'file'; $imgConfig['returnKey'] = 'url'; $imgConfig['params'] = array('policy' => $img_space_policy, 'signature' => $img_space_sign); $configArray['imageConfig'] = $imgConfig; return $configArray; }
private static function log($exception) { if (Config::item("errors", "log", false)) { Log::exception($exception); } }
public static function getInstance($dataType) { if (!isset(self::$connections[$dataType])) { try { $connection = new Mongo(Config::item('env.mongodb.server'), Config::item('env.mongodb.option')); } catch (MongoConnectionException $e) { $connection = new BlackHole(); return self::$connections[$dataType] = $connection; } self::$connections[$dataType] = $connection->selectDB('chaoge')->selectCollection($dataType); self::$connections[$dataType]->setSlaveOkay(); } return self::$connections[$dataType]; }
**************************************************/ // menu echo table::open(); echo table::tds(array(array('class' => 'tableb', 'text' => html::button('forum.php?c=admin', Lang::item('admin.home')) . NBSP . html::button('forum.php?c=admin&m=newcat', Lang::item('admin.new_category')) . NBSP . html::button('forum.php?c=admin&m=setting', Lang::item('admin.setting'))))); echo table::close(); echo table::open(); echo form::open('forum.php?c=admin&m=setting'); echo table::td('Forum Setting', 2); if (count($errors) > 0) { echo table::tds(array(array('class' => 'tableh2', 'colspan' => '2', 'text' => table::error($errors)))); } echo table::td(html::b(Lang::item('admin.basic_features')), 2, 'tableh2'); echo table::tds(array(array('class' => 'tableb', 'width' => '50%', 'text' => Lang::item('admin.title')), array('class' => 'tableb', 'width' => '50%', 'text' => form::text('fr_title', Config::item('fr_title'))))); echo table::tds(array(array('class' => 'tableb', 'width' => '50%', 'text' => Lang::item('admin.allow_guest_browse')), array('class' => 'tableb', 'width' => '50%', 'text' => form::yesno('fr_guest_browse', Config::item('fr_guest_browse'))))); echo table::tds(array(array('class' => 'tableb', 'width' => '50%', 'text' => Lang::item('admin.allow_guest_post')), array('class' => 'tableb', 'width' => '50%', 'text' => form::yesno('fr_guest_post', Config::item('fr_guest_post'))))); echo table::tds(array(array('class' => 'tableb', 'width' => '50%', 'text' => Lang::item('admin.enable_message_icons')), array('class' => 'tableb', 'width' => '50%', 'text' => form::yesno('fr_msg_icons', Config::item('fr_msg_icons'))))); echo table::tds(array(array('class' => 'tableb', 'width' => '50%', 'text' => Lang::item('admin.time_online_checking')), array('class' => 'tableb', 'width' => '50%', 'text' => form::text('fr_time_online_checking', Config::item('fr_time_online_checking'))))); echo table::td(html::b(Lang::item('admin.topic_features')), 2, 'tableh2'); echo table::tds(array(array('class' => 'tableb', 'width' => '50%', 'text' => Lang::item('admin.topic_per_page')), array('class' => 'tableb', 'width' => '50%', 'text' => form::text('fr_topic_per_page', Config::item('fr_topic_per_page'))))); echo table::tds(array(array('class' => 'tableb', 'width' => '50%', 'text' => Lang::item('admin.hot_topic_msg')), array('class' => 'tableb', 'width' => '50%', 'text' => form::text('fr_hot_topic_msg', Config::item('fr_hot_topic_msg'))))); echo table::td(html::b(Lang::item('admin.message_features')), 2, 'tableh2'); echo table::tds(array(array('class' => 'tableb', 'width' => '50%', 'text' => Lang::item('admin.msg_per_page')), array('class' => 'tableb', 'width' => '50%', 'text' => form::text('fr_msg_per_page', Config::item('fr_msg_per_page'))))); echo table::tds(array(array('class' => 'tableb', 'width' => '50%', 'text' => Lang::item('admin.max_msg_size')), array('class' => 'tableb', 'width' => '50%', 'text' => form::text('fr_msg_max_size', Config::item('fr_msg_max_size'))))); echo table::tds(array(array('class' => 'tableb', 'width' => '50%', 'text' => Lang::item('admin.max_word_length')), array('class' => 'tableb', 'width' => '50%', 'text' => form::text('fr_max_word_length', Config::item('fr_max_word_length'))))); echo table::tds(array(array('class' => 'tableb', 'width' => '50%', 'text' => Lang::item('admin.gap_time')), array('class' => 'tableb', 'width' => '50%', 'text' => form::text('fr_gap_time', Config::item('fr_gap_time'))))); echo table::td(html::b(Lang::item('admin.profile_features')), 2, 'tableh2'); echo table::tds(array(array('class' => 'tableb', 'width' => '50%', 'text' => Lang::item('admin.avatar_size')), array('class' => 'tableb', 'width' => '50%', 'text' => form::text('fr_avatar_size', Config::item('fr_avatar_size'))))); echo table::tds(array(array('class' => 'tableb', 'width' => '50%', 'text' => Lang::item('admin.signature_max_size')), array('class' => 'tableb', 'width' => '50%', 'text' => form::text('fr_signature_max_size', Config::item('fr_signature_max_size'))))); echo table::tds(array(array('class' => 'tablef', 'colspan' => '2', 'text' => form::submit(Lang::item('common.modify'), 'submit') . form::reset(Lang::item('common.reset'), 'reset')))); echo form::close(); echo table::close();
foreach ($allowedPaths as $dir) { if (Str::startsWith($path, File::formatDir($dir))) { $allowed = true; break; } } if (!$allowed) { Response::code(403); return; } Response::download(J_PATH . $path, Request::get("name")); }); Router::register("GET", "thumb/", function () { $pieces = explode("/", trim(Request::get("path"), "/")); $path = implode(DS, $pieces); $allowedPaths = Config::item("application", "thumbPaths", array("app/storage/")); $allowed = false; foreach ($allowedPaths as $dir) { if (Str::startsWith($path, File::formatDir($dir))) { $allowed = true; break; } } if (!$allowed || count($pieces) == 0) { return Response::code(403); } $path = implode(DS, $pieces); if (!File::exists(J_PATH . $path) || is_dir(J_PATH . $path)) { return Response::code(404); } $im = new Image(J_PATH . $path);
************************************************* Copyright (c) 2010 foulu (Le Hoai Phuong), eenemeenemuu ************************************************* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. ******************************************** $HeadURL$ $Revision$ $LastChangedBy$ $Date$ **************************************************/ echo table::open(); echo form::open('forum.php?c=search', 'search', 'get'); echo form::hidden('c', Config::item('c')); echo table::td(Lang::item('search.search'), 2); echo table::tds(array(array('class' => 'tableb', 'width' => '30%', 'text' => Lang::item('search.search')), array('class' => 'tableb', 'width' => '70%', 'text' => form::text('search', $search)))); echo table::tds(array(array('class' => 'tablef', 'colspan' => 2, 'text' => form::submit(Lang::item('common.search'), 'submit')))); echo form::close(); echo table::close(); if (count($messages) > 0) { echo html::spacer(); // paging echo table::open(); echo table::td(Lang::item('search.search_result') . ' - ' . sprintf(Lang::item('search.found'), $results)); echo table::tds(array(array('class' => 'tableb', 'text' => Lang::item('board.page') . forum::paging($paging)))); echo table::close(); foreach ($messages as $message) { echo table::open(); echo table::tds(array(array('class' => 'tableh1', 'text' => table::open(2) . table::tds(array(array('align' => 'left', 'width' => '70%', 'text' => forum::nagavitor($message['linkto'], '-->')), array('align' => 'right', 'width' => '30%', 'text' => Lang::item('search.on') . time::decode($message['poster_time'])))) . table::close())));
<?php /************************************************** Coppermine 1.5.x Plugin - forum ************************************************* Copyright (c) 2010 foulu (Le Hoai Phuong), eenemeenemuu ************************************************* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. ******************************************** $HeadURL$ $Revision$ $LastChangedBy$ $Date$ **************************************************/ echo table::open(); echo table::tds(array(array('class' => 'tableh1', 'width' => '170px', 'text' => html::profile_anchor($message['poster_id'], $message['poster_name'])), array('class' => 'tableh1', 'text' => html::img($message['icon'], '65%') . NBSP . sprintf(Lang::item('topic.topic_title'), html::anchor('forum.php?c=message&m=single&id=' . $message['msg_id'], $message['subject']), time::decode($message['time']))))); echo table::tds(array(array('class' => 'tablef', 'valign' => 'top', 'align' => 'left', 'text' => html::span(sprintf(Lang::item('topic.user_profile'), html::img($message['avatar'], Config::item('fr_avatar_size')), $message['poster_group'], $message['poster_posts'], $message['poster_registed']))), array('class' => 'tableb', 'valign' => 'top', 'text' => forum::format_message($message['body']) . (trim($message['signature']) != '' ? sprintf(Lang::item('topic.signature'), forum::format_message($message['signature'])) : '')))); echo table::tds(array(array('class' => 'tablef', 'text' => html::button('profile.php?uid=' . $message['poster_id'], Lang::item('topic.profile')) . NBSP), array('class' => 'tablef', 'text' => ($authorizer->can_edit_msg($message['msg_id']) ? html::button('forum.php?c=message&m=edit&id=' . $message['msg_id'], Lang::item('common.modify')) . NBSP : '') . ($authorizer->can_delete_msg($message['msg_id']) ? html::jsbutton("button_confirm('" . Lang::item('message.confirm_delete') . "','forum.php?c=message&m=delete&id={$message['msg_id']}');", Lang::item('common.delete')) : '')))); echo table::close();
function __construct($method) { $dcUrl = Config::item('apiInfo'); $this->curl = new AppCurl($dcUrl['ip'] . '/' . $method); $this->user = array('user' => $dcUrl['user'], 'appkey' => $dcUrl['key']); }
public static function ssldecode($string) { $key = hash("sha256", Config::item("application", "key")); $iv = substr(hash("sha256", "123"), 0, 16); return openssl_decrypt(static::from64($string), "AES-256-CBC", $key, 0, $iv); }
function index() { require_once 'include' . DS . 'smilies.inc.php'; $vars = array(); $errors = array(); $authorizer = check_model::getInstance(); // user or not if (!$authorizer->is_user()) { cpg_die(ERROR, Lang::item('error.perm_denied'), __FILE__, __LINE__); } // to-do: display the profile if + avatar $vars['nagavitor'] = $this->forum->get_nagavitor(); $vars['user'] = $user = $this->forum->get_user_data(); if ($this->validate->post->keyExists('submit')) { $data = array('fr_signature' => $this->validate->post->getRaw('fr_signature')); if (strlen($data['fr_signature']) > Config::item('fr_signature_max_size') && Config::item('fr_signature_max_size')) { $data['fr_signature'] = substr($data['fr_signature'], 0, Config::item('fr_signature_max_size')); } $avatar_type = $this->validate->post->getRaw('avatar_type'); if ($avatar_type == 'url') { $data['fr_avatar'] = $this->validate->post->getRaw('fr_avatar_url'); $files = explode('.', $data['fr_avatar']); if (!in_array($files[count($files) - 1], array('gif', 'jpg', 'jpeg', 'png'))) { $errors[] = Lang::item('error.wrong_avatar_extension'); } } else { if ($avatar_type == 'file') { $upload = load_library('upload', TRUE); $upload->upload_dir = 'plugins/forum/forum/uploads/avatars/'; if (!is_dir($upload->upload_dir)) { mkdir($upload->upload_dir, octdec(Config::item('default_dir_mode'))); } $upload->extensions = array('.jpg', '.jpeg', '.gif', '.png'); $upload->max_length_filename = 255; $upload->rename_file = true; $upload->the_temp_file = $this->validate->files->getRaw('/fr_avatar_file/tmp_name'); $upload->the_file = $this->validate->files->getRaw('/fr_avatar_file/name'); $upload->http_error = $this->validate->files->getRaw('/fr_avatar_file/error'); $upload->replace = 'y'; $upload->do_filename_check = 'y'; $new_name = 'avatar_' . USER_ID; if ($upload->do_upload($new_name)) { $extension = strtolower(strrchr($upload->the_file, ".")); $data['fr_avatar'] = $upload->upload_dir . $new_name . $extension; } else { $errors[] = $upload->show_error_string(); } $imagesize = getimagesize($data['fr_avatar']); if (max($imagesize[0], $imagesize[1]) > Config::item('fr_avatar_size') && Config::item('fr_avatar_size')) { if (!function_exists('resize_image')) { require_once 'include/picmgmt.inc.php'; } resize_image($data['fr_avatar'], $data['fr_avatar'], Config::item('fr_avatar_size'), Config::item('thumb_method'), Config::item('thumb_use')); } } else { unset($data['fr_avatar']); } } if (count($errors) == 0) { $this->forum->edit_profile($user['user_id'], $data); forum::message(Lang::item('common.message'), Lang::item('profile.update_profile_success'), 'forum.php?c=profile'); } } $vars['errors'] = $errors; $this->view->render('profile/index', $vars); }
function can_delete_msg($msg_id) { // own message $this->db->select('poster_id'); $this->db->where('msg_id', $msg_id); $query = $this->db->get(Config::item('TABLE_FR_MESSAGES')); $row = $query->row(); if ($row->poster_id == USER_ID) { $authorizer = check_model::getInstance(); return $authorizer->can_delete_own_msg(); } else { if (GALLERY_ADMIN_MODE) { return TRUE; } else { return FALSE; } } }
<h1><%=title%></h1> <p>Lorem ipsum</p> </div> </div> </script> <?php if (!Config::item('usedist')) { ?> <!-- build:js(public) js/main.js --> <script src="js/vendor/jquery/jquery-1.10.1.js"></script> <script src="js/vendor/lodash/lodash.compat.js"></script> <script src="js/vendor/mbone/mbone-1.0.0.js"></script> <script src="js/vendor/gaTrackers/gaTrackers.js"></script> <script src="js/modules/modal.js"></script> <script src="js/main.js"></script> <!-- endbuild --> <?php } else { ?> <script src="<?php echo Config::item('publicDist'); ?> js/main.js"></script> <?php } ?> </body> </html>
/** * **************************************************** * SETTING * **************************************************** */ function setting() { $vars = array(); $vars['nagavitor'] = $this->forum->get_nagavitor(); $vars['form'] = array('fr_title' => Config::item('fr_title'), 'fr_guest_browse' => Config::item('fr_guest_browse'), 'fr_guest_post' => Config::item('fr_guest_post'), 'fr_topic_per_page' => Config::item('fr_topic_per_page'), 'fr_hot_topic_msg' => Config::item('fr_hot_topic_msg'), 'fr_msg_per_page' => Config::item('fr_msg_per_page'), 'fr_msg_max_size' => Config::item('fr_msg_max_size'), 'fr_max_word_length' => Config::item('fr_max_word_length'), 'fr_gap_time' => Config::item('fr_gap_time'), 'fr_avatar_size' => Config::item('fr_gap_time'), 'fr_signature_max_size' => Config::item('fr_gap_time'), 'fr_time_online_checking' => Config::item('fr_time_online_checking'), 'fr_msg_icons' => Config::item('fr_msg_icons')); $errors = array(); if ($this->validate->post->keyExists('submit')) { foreach ($vars['form'] as $k => $v) { $nv = $this->validate->post->getRaw($k); if ($nv != $v) { $this->forum->save_config($k, $nv); Config::set($k, $nv); } } } $vars['errors'] = $errors; $this->view->render('admin/setting', $vars); }
document.getElementById('pv_subject').innerHTML = datas[0]; document.getElementById('pv_body').innerHTML = datas[1]; }); }); }); --> </script> EOT; echo "<div name=\"preview_area\" id=\"preview_area\" style=\"display: none;\">"; echo table::open(); echo table::td(Lang::item('board.topic_preview'), 1); echo table::tds(array('class' => 'tableh2', 'id' => 'pv_subject', 'text' => '')); echo table::tds(array('class' => 'tableb', 'id' => 'pv_body', 'text' => '')); echo table::close(); echo "</div>"; echo table::open(); echo table::td(Lang::item('topic.new_topic'), 2); echo form::open('forum.php?c=message&m=edit&id=' . $msg_id, 'editmsg'); if (count($errors) > 0) { echo table::td(table::error($errors), 2, 'tableh2'); } echo table::tds(array(array('class' => 'tableb', 'width' => '30%', 'text' => Lang::item('topic.subject')), array('class' => 'tableb', 'width' => '70%', 'text' => form::text('subject', $form['subject'])))); if (Config::item('fr_msg_icons') == 1) { echo table::tds(array(array('class' => 'tableb', 'text' => Lang::item('topic.message_icon')), array('class' => 'tableb', 'text' => forum::generate_message_icons('icon', $icons, $form['icon'])))); } echo table::tds(array(array('class' => 'tableb', 'text' => NBSP), array('class' => 'tableb', 'text' => forum::generate_bbcode_tags('editmsg', 'body')))); echo table::tds(array(array('class' => 'tableb', 'text' => Lang::item('topic.message')), array('class' => 'tableb', 'text' => form::textarea('body', $form['body'])))); echo table::tds(array(array('class' => 'tableb', 'text' => NBSP), array('class' => 'tableb', 'text' => generate_smilies('editmsg', 'body')))); echo table::tds(array(array('class' => 'tablef', 'text' => NBSP), array('class' => 'tablef', 'text' => form::submit(Lang::item('common.modify'), 'submit') . html::jsbutton('return false;', Lang::item('common.preview'), array('id' => 'preview')) . NBSP . html::button('forum.php?c=board&id=' . $board_id, Lang::item('common.cancel'))))); echo form::close(); echo table::close();
<?php /************************************************** Coppermine 1.5.x Plugin - forum ************************************************* Copyright (c) 2010 foulu (Le Hoai Phuong), eenemeenemuu ************************************************* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. ******************************************** $HeadURL$ $Revision$ $LastChangedBy$ $Date$ **************************************************/ pageheader($fr_title ? $fr_title : Config::item('fr_title')); print html::spacer(); print table::open(0); print table::tds(array(array('text' => $fr_title ? $fr_title : Config::item('fr_title')), array('align' => 'right', 'text' => ($authorizer->is_user() ? html::button('forum.php?c=profile', Lang::item('home.fr_profile')) : '') . NBSP . html::button('forum.php?c=search', Lang::item('home.search'))))); print table::close(); print html::spacer(); print table::open(); print form::hidden('c', 'search'); print table::tds(array(array('class' => 'tableb', 'text' => html::span(forum::nagavitor($nagavitor))))); print table::close(); print html::spacer(); print $fr_contents; pagefooter();
function xxx_topics($xxx) { $func_name = 'get_' . $xxx . '_topic'; $vars = array(); $vars['nagavitor'] = $this->forum->get_nagavitor(); $vars['topic_count'] = $this->forum->{$func_name}('count(*) as count'); $vars['paging'] = array(); $vars['paging']['total'] = $vars['topic_count']; $vars['paging']['pattern'] = 'forum.php?c=search&m=' . $xxx . '_topics'; $vars['paging']['start'] = $this->validate->get->getInt('start', 0); $vars['paging']['limit'] = Config::item('fr_topic_per_page'); $topics = $this->forum->{$func_name}('*', $vars['paging']['start'], $vars['paging']['limit']); $vars['topics'] = array(); foreach ($topics as $topic) { $newtopic = array(); $first_message = $this->forum->get_message_data($topic['first_msg_id']); $last_message = $this->forum->get_message_data($topic['last_msg_id']); $message_count = $this->forum->get_message_count($topic['topic_id']); if ($topic['locked']) { $newtopic['status'] = 'plugins/forum/forum/html/images/icon_topic_readonly.gif'; } else { if ($topic['is_sticky']) { $newtopic['status'] = 'plugins/forum/forum/html/images/icon_topic_reply.gif'; } else { if ($number_of_msg >= Config::item('fr_hot_topic_msg')) { $newtopic['status'] = 'plugins/forum/forum/html/images/icon_topic_hot.gif'; } else { $newtopic['status'] = 'plugins/forum/forum/html/images/icon_topic_new.gif'; //"plugins/forum/forum/html/images/default/icon_topic.gif"; } } } $newtopic['icon'] = 'plugins/forum/forum/html/images/post/' . $first_message['icon'] . '.gif'; $newtopic['id'] = $topic['topic_id']; $newtopic['name'] = $first_message['subject']; $newtopic['starter_id'] = $first_message['poster_id']; $newtopic['starter_name'] = $first_message['poster_name']; $newtopic['replies'] = $topic['replies']; $newtopic['views'] = $topic['views']; $newtopic['last_post_id'] = $last_message['msg_id']; $newtopic['last_post_title'] = $last_message['subject']; $newtopic['last_post_time'] = $last_message['poster_time']; $newtopic['last_post_author_id'] = $last_message['poster_id']; $newtopic['last_post_author_name'] = get_username($last_message['poster_id']); $vars['topics'][] = $newtopic; unset($newtopic); } $this->view->render('search/' . $xxx . '_topics', $vars); }