本文整理汇总了PHP中find_theme_image函数的典型用法代码示例。如果您正苦于以下问题:PHP find_theme_image函数的具体用法?PHP find_theme_image怎么用?PHP find_theme_image使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了find_theme_image函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Standard modular run function for realtime-rain hooks.
*
* @param TIME Start of time range.
* @param TIME End of time range.
* @return array A list of template parameter sets for rendering a 'drop'.
*/
function run($from, $to)
{
$drops = array();
if (has_actual_page_access(get_member(), 'polls')) {
$rows = $GLOBALS['SITE_DB']->query('SELECT b.option1,b.option2,b.option3,b.option4,b.option5,b.option6,b.option7,b.option8,b.option9,b.option10,b.votes1,b.votes2,b.votes3,b.votes4,b.votes5,b.votes6,b.votes7,b.votes8,b.votes9,b.votes10,b.question,b.id,b.submitter AS member_id,a.date_and_time AS timestamp FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'poll a LEFT JOIN ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'poll b ON a.date_and_time>b.date_and_time WHERE NOT EXISTS(SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'poll x WHERE x.id<>a.id AND x.id<>b.id AND x.date_and_time BETWEEN b.date_and_time AND a.date_and_time) AND b.date_and_time IS NOT NULL AND b.date_and_time BETWEEN ' . strval($from) . ' AND ' . strval($to));
foreach ($rows as $row) {
require_lang('polls');
$timestamp = $row['timestamp'];
$member_id = $row['member_id'];
$best = NULL;
$best_num = -1;
for ($i = 1; $i <= 10; $i++) {
if ($row['votes' . strval($i)] > $best_num) {
$best = $row['option' . strval($i)];
$best_num = $row['votes' . strval($i)];
}
}
if ($best_num == -1) {
continue;
}
$ticker_text = do_lang('VOTES_ARE_IN', strip_comcode(get_translated_text($row['question'])), strip_comcode(get_translated_text($best)));
$drops[] = rain_get_special_icons(NULL, $timestamp, NULL, $ticker_text) + array('TYPE' => 'polls', 'FROM_MEMBER_ID' => strval($member_id), 'TO_MEMBER_ID' => NULL, 'TITLE' => rain_truncate_for_title(get_translated_text($row['question'])), 'IMAGE' => find_theme_image('bigicons/polls'), 'TIMESTAMP' => strval($timestamp), 'RELATIVE_TIMESTAMP' => strval($timestamp - $from), 'TICKER_TEXT' => $ticker_text, 'URL' => build_url(array('page' => 'polls', 'type' => 'view', 'id' => $row[1]['id']), '_SEARCH'), 'IS_POSITIVE' => false, 'IS_NEGATIVE' => false, 'FROM_ID' => 'member_' . strval($member_id), 'TO_ID' => NULL, 'GROUP_ID' => 'poll_' . strval($row['id']));
}
}
return $drops;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:33,代码来源:polls.php
示例2: regen_theme_images
/**
* Regenerate all the theme image paths in the database.
*
* @param ID_TEXT The theme we're searching in.
* @param ?array A map of languages (lang=>1) (NULL: find it in-function).
* @param ?ID_TEXT The theme we're storing in (NULL: same as $theme).
*/
function regen_theme_images($theme, $langs = NULL, $target_theme = NULL)
{
if (is_null($langs)) {
$langs = find_all_langs(true);
}
if (is_null($target_theme)) {
$target_theme = $theme;
}
$images = array_merge(find_images_do_dir($theme, 'images/', $langs), find_images_do_dir($theme, 'images_custom/', $langs));
foreach (array_keys($langs) as $lang) {
$existing = $GLOBALS['SITE_DB']->query_select('theme_images', array('id', 'path'), array('lang' => $lang, 'theme' => $target_theme));
foreach ($images as $id => $path) {
$found = false;
foreach ($existing as $e) {
if ($e['path'] == $path || $e['id'] == $id) {
$found = true;
break;
}
}
if (!$found) {
$nql_backup = $GLOBALS['NO_QUERY_LIMIT'];
$GLOBALS['NO_QUERY_LIMIT'] = true;
$correct_path = find_theme_image($id, false, true, $theme, $lang);
$GLOBALS['SITE_DB']->query_insert('theme_images', array('id' => $id, 'lang' => $lang, 'theme' => $target_theme, 'path' => $correct_path), false, true);
// race conditions
$GLOBALS['NO_QUERY_LIMIT'] = $nql_backup;
}
}
}
persistant_cache_delete('THEME_IMAGES');
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:38,代码来源:themes3.php
示例3: run
/**
* Standard modular run function for award hooks. Renders a content box for an award/randomisation.
*
* @param array The database row for the content
* @param ID_TEXT The zone to display in
* @return tempcode Results
*/
function run($row, $zone)
{
$url = build_url(array('page' => 'news', 'type' => 'view', 'id' => $row['id']), $zone);
$title = get_translated_tempcode($row['title']);
$title_plain = get_translated_text($row['title']);
$news_cat_rows = $GLOBALS['SITE_DB']->query_select('news_categories', array('nc_title', 'nc_img'), array('id' => $row['news_category']), '', 1);
if (!array_key_exists(0, $news_cat_rows)) {
warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
}
$news_cat_row = $news_cat_rows[0];
$category = get_translated_text($news_cat_row['nc_title']);
$img = find_theme_image($news_cat_row['nc_img']);
if ($row['news_image'] != '') {
$img = $row['news_image'];
if (url_is_local($img)) {
$img = get_base_url() . '/' . $img;
}
}
$news = get_translated_tempcode($row['news']);
if ($news->is_empty()) {
$news = get_translated_tempcode($row['news_article']);
$truncate = true;
} else {
$truncate = false;
}
$author_url = addon_installed('authors') ? build_url(array('page' => 'authors', 'type' => 'misc', 'id' => $row['author']), get_module_zone('authors')) : new ocp_tempcode();
$author = $row['author'];
require_css('news');
$seo_bits = seo_meta_get_for('news', strval($row['id']));
$map = array('_GUID' => 'jd89f893jlkj9832gr3uyg2u', 'TAGS' => get_loaded_tags('news', explode(',', $seo_bits[0])), 'TRUNCATE' => $truncate, 'AUTHOR' => $author, 'BLOG' => false, 'AUTHOR_URL' => $author_url, 'CATEGORY' => $category, 'IMG' => $img, 'NEWS' => $news, 'ID' => strval($row['id']), 'SUBMITTER' => strval($row['submitter']), 'DATE' => get_timezoned_date($row['date_and_time']), 'DATE_RAW' => strval($row['date_and_time']), 'FULL_URL' => $url, 'NEWS_TITLE' => $title, 'NEWS_TITLE_PLAIN' => $title_plain);
if (get_option('is_on_comments') == '1' && !has_no_forum() && $row['allow_comments'] >= 1) {
$map['COMMENT_COUNT'] = '1';
}
return put_in_standard_box(do_template('NEWS_PIECE_SUMMARY', $map));
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:42,代码来源:news.php
示例4: run
/**
* Standard modular run function for realtime-rain hooks.
*
* @param TIME Start of time range.
* @param TIME End of time range.
* @return array A list of template parameter sets for rendering a 'drop'.
*/
function run($from, $to)
{
$drops = array();
if (has_actual_page_access(get_member(), 'admin_stats')) {
$rows = $GLOBALS['SITE_DB']->query('SELECT s_primary,s_member_id AS member_id,s_time AS timestamp FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'searches_logged WHERE s_time BETWEEN ' . strval($from) . ' AND ' . strval($to));
foreach ($rows as $row) {
$timestamp = $row['timestamp'];
$member_id = $row['member_id'];
$drops[] = rain_get_special_icons(NULL, $timestamp) + array('TYPE' => 'search', 'FROM_MEMBER_ID' => strval($member_id), 'TO_MEMBER_ID' => NULL, 'TITLE' => rain_truncate_for_title($row['s_primary']), 'IMAGE' => find_theme_image('bigicons/search'), 'TIMESTAMP' => strval($timestamp), 'RELATIVE_TIMESTAMP' => strval($timestamp - $from), 'TICKER_TEXT' => NULL, 'URL' => build_url(array('page' => 'search', 'type' => 'misc', 'content' => $row['s_primary']), '_SEARCH'), 'IS_POSITIVE' => false, 'IS_NEGATIVE' => false, 'FROM_ID' => 'member_' . strval($member_id), 'TO_ID' => NULL, 'GROUP_ID' => 'search_' . $row['s_primary']);
}
}
return $drops;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:20,代码来源:search.php
示例5: run
/**
* Standard modular run function for realtime-rain hooks.
*
* @param TIME Start of time range.
* @param TIME End of time range.
* @return array A list of template parameter sets for rendering a 'drop'.
*/
function run($from, $to)
{
$drops = array();
if (has_actual_page_access(get_member(), 'admin_ocf_join') && get_forum_type() == 'ocf') {
$rows = $GLOBALS['FORUM_DB']->query('SELECT i_email_address,i_inviter AS member_id,i_time AS timestamp FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_invites WHERE i_time BETWEEN ' . strval($from) . ' AND ' . strval($to));
foreach ($rows as $row) {
$timestamp = $row['timestamp'];
$member_id = $row['member_id'];
$invited_member = $GLOBALS['FORUM_DB']->query_value_null_ok('f_members', 'id', array('m_email_address' => $row['i_email_address']));
$drops[] = rain_get_special_icons(NULL, $timestamp) + array('TYPE' => 'recommend', 'FROM_MEMBER_ID' => strval($member_id), 'TO_MEMBER_ID' => is_null($invited_member) ? '' : strval($invited_member), 'TITLE' => do_lang('RECOMMEND_SITE'), 'IMAGE' => is_guest($member_id) ? find_theme_image('recommend') : $GLOBALS['FORUM_DRIVER']->get_member_avatar_url($member_id), 'TIMESTAMP' => strval($timestamp), 'RELATIVE_TIMESTAMP' => strval($timestamp - $from), 'TICKER_TEXT' => NULL, 'URL' => build_url(array('page' => 'points', 'type' => 'member', 'id' => $member_id), '_SEARCH'), 'IS_POSITIVE' => true, 'IS_NEGATIVE' => false, 'FROM_ID' => 'member_' . strval($member_id), 'TO_ID' => is_null($invited_member) ? '' : 'member_' . strval($invited_member), 'GROUP_ID' => NULL);
}
}
return $drops;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:21,代码来源:recommend.php
示例6: run
/**
* Standard modular run function. Creates custom graphics from parameters.
*
* @param array Map of hook parameters (relayed from block parameters map).
* @param object The block itself (contains utility methods).
* @return tempcode HTML to output.
*/
function run($map, &$block)
{
if (!function_exists('imagettftext') || !array_key_exists('FreeType Support', gd_info()) || @imagettfbbox(26.0, 0.0, get_file_base() . '/data/fonts/Vera.ttf', 'test') === false) {
return do_lang_tempcode('REQUIRES_TTF');
}
if (!array_key_exists('img1', $map)) {
$map['img1'] = 'button1';
}
$img_path_1 = find_theme_image($map['img1'], true, true);
if ($img_path_1 == '') {
return do_lang_tempcode('NO_SUCH_THEME_IMAGE', $map['img1']);
}
$cache_id_1 = 'rollover1_' . md5(serialize($map));
$url_1 = $block->_do_image($cache_id_1, $map, $img_path_1);
if (is_object($url_1)) {
return $url_1;
}
if (!array_key_exists('img2', $map)) {
$map['img2'] = 'button2';
}
$img_path_2 = find_theme_image($map['img2'], true, true);
if ($img_path_2 == '') {
return do_lang_tempcode('NO_SUCH_THEME_IMAGE', $map['img2']);
}
$cache_id_2 = 'rollover2_' . md5(serialize($map));
$url_2 = $block->_do_image($cache_id_2, $map, $img_path_2);
if (is_object($url_2)) {
return $url_2;
}
$comb_id = 'rollover_' . uniqid('', true);
$ret = '<img id="' . php_addslashes($comb_id) . '" class="gfx_text_overlay" alt="' . str_replace(chr(10), ' ', escape_html($map['data'])) . '" src="' . escape_html($url_1) . '" />';
$ret .= '
<script type="text/javascript">// <![CDATA[
create_rollover("' . php_addslashes($comb_id) . '","' . php_addslashes($url_2) . '");
//]]></script>
';
if (function_exists('ocp_mark_as_escaped')) {
ocp_mark_as_escaped($ret);
}
return make_string_tempcode($ret);
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:48,代码来源:rollover_button.php
示例7: run
/**
* Standard modular run function for realtime-rain hooks.
*
* @param TIME Start of time range.
* @param TIME End of time range.
* @return array A list of template parameter sets for rendering a 'drop'.
*/
function run($from, $to)
{
$drops = array();
if (has_actual_page_access(get_member(), 'admin_ecommerce')) {
$rows = $GLOBALS['SITE_DB']->query('SELECT amount,item,t_time AS timestamp FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'transactions WHERE t_time BETWEEN ' . strval($from) . ' AND ' . strval($to));
foreach ($rows as $row) {
require_code('ecommerce');
list($product, ) = find_product_row($row['item']);
if (!is_null($product)) {
$title = $product[4];
} else {
require_lang('ecommerce');
$title = do_lang('SALE_MADE');
}
$timestamp = $row['timestamp'];
$ticker_text = do_lang('KA_CHING', ecommerce_get_currency_symbol(), $row['amount']);
$drops[] = rain_get_special_icons(NULL, $timestamp, NULL, $ticker_text) + array('TYPE' => 'ecommerce', 'FROM_MEMBER_ID' => NULL, 'TO_MEMBER_ID' => NULL, 'TITLE' => $title, 'IMAGE' => find_theme_image('bigicons/ecommerce'), 'TIMESTAMP' => strval($timestamp), 'RELATIVE_TIMESTAMP' => strval($timestamp - $from), 'TICKER_TEXT' => $ticker_text, 'URL' => NULL, 'IS_POSITIVE' => true, 'IS_NEGATIVE' => false, 'FROM_ID' => NULL, 'TO_ID' => NULL, 'GROUP_ID' => 'product_' . $row['item']);
}
}
return $drops;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:28,代码来源:ecommerce.php
示例8: run
/**
* Standard modular run function for preview hooks.
*
* @return array A pair: The preview, the updated post Comcode
*/
function run()
{
require_code('uploads');
$urls = get_url('', 'file', 'safe_mode_temp', 0, OCP_UPLOAD_IMAGE, false);
if ($urls[0] == '') {
if (!is_null(post_param_integer('id', NULL))) {
$rows = $GLOBALS['SITE_DB']->query_select('calendar_types', array('t_logo'), array('id' => post_param_integer('id')), '', 1);
$urls = $rows[0];
$url = find_theme_image($urls['t_logo']);
} elseif (!is_null(post_param('theme_img_code', NULL))) {
$url = find_theme_image(post_param('theme_img_code'));
} else {
warn_exit(do_lang_tempcode('IMPROPERLY_FILLED_IN_UPLOAD'));
}
} else {
$url = $urls[0];
}
require_code('images');
$preview = do_image_thumb(url_is_local($url) ? get_custom_base_url() . '/' . $url : $url, post_param('title'), true);
return array($preview, NULL);
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:26,代码来源:calendar_type.php
示例9: run
/**
* Standard modular run function. Creates custom graphics from parameters.
*
* @param array Map of hook parameters (relayed from block parameters map).
* @param object The block itself (contains utility methods).
* @return tempcode HTML to output.
*/
function run($map, &$block)
{
if (!function_exists('imagettftext') || !array_key_exists('FreeType Support', gd_info()) || @imagettfbbox(26.0, 0.0, get_file_base() . '/data/fonts/Vera.ttf', 'test') === false) {
return do_lang_tempcode('REQUIRES_TTF');
}
if (!array_key_exists('img', $map)) {
$map['img'] = 'button1';
}
$img_path = find_theme_image($map['img'], true, true);
if ($img_path == '') {
return do_lang_tempcode('NO_SUCH_THEME_IMAGE', $map['img']);
}
$cache_id = 'text_overlay_' . md5(serialize($map));
$url = $block->_do_image($cache_id, $map, $img_path);
if (is_object($url)) {
return $url;
}
$ret = '<img class="gfx_text_overlay" alt="' . str_replace(chr(10), ' ', escape_html($map['data'])) . '" src="' . escape_html($url) . '" />';
if (function_exists('ocp_mark_as_escaped')) {
ocp_mark_as_escaped($ret);
}
return make_string_tempcode($ret);
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:30,代码来源:text_overlay.php
示例10: find_addon_icon
/**
* Get an addon icon.
*
* @param ID_TEXT The name of the addon
* @return URLPATH Addon icon (blank: could not find one)
*/
function find_addon_icon($hook)
{
if ($hook == '') {
return '';
}
static $addon_icons_cache = array();
if (isset($addon_icons_cache[$hook])) {
return $addon_icons_cache[$hook];
}
$path = get_file_base() . '/sources_custom/hooks/systems/addon_registry/' . filter_naughty_harsh($hook) . '.php';
if (!file_exists($path)) {
$path = get_file_base() . '/sources/hooks/systems/addon_registry/' . filter_naughty_harsh($hook) . '.php';
}
if (!file_exists($path)) {
return '';
}
$hook_file = file_get_contents($path);
$matches = array();
if (preg_match('#function get_file_list\\(\\)\\s*\\{([^\\}]*)\\}#', $hook_file, $matches) != 0) {
if (!defined('HIPHOP_PHP')) {
$addon_files = eval($matches[1]);
} else {
require_code('hooks/systems/addon_registry/' . $hook);
$hook_ob = object_factory('Hook_addon_registry_' . $hook);
$addon_files = $hook_ob->get_file_list();
}
foreach ($addon_files as $file) {
if (substr($file, 0, 31) == 'themes/default/images/bigicons/') {
$addon_icons_cache[$hook] = find_theme_image('bigicons/' . basename($file, '.png'), false, true);
return $addon_icons_cache[$hook];
}
}
}
$addon_icons_cache[$hook] = '';
return '';
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:42,代码来源:addons_overview.php
示例11: do_gallery_regular_mode
/**
* The UI for an "regular mode" gallery.
*
* @param tempcode Rating area
* @param tempcode Commenting area
* @param ID_TEXT Our gallery ID
* @param ID_TEXT Virtual root gallery
* @param tempcode The description of the gallery
* @param tempcode The tempcode for our visible child galleries
* @param boolean Whether may "download this gallery"
* @param tempcode The URL to "edit this gallery"
* @param tempcode The URL to "add a gallery"
* @param tempcode The URL to "submit an image to this gallery"
* @param tempcode The URL to "submit a video to this gallery"
* @param tempcode The title of the page (our of get_page_title)
* @param string The gallery title
* @param tempcode Sorting UI
* @return tempcode The UI
*/
function do_gallery_regular_mode($rating_details, $comment_details, $cat, $root, $description, $children, $may_download, $edit_url, $add_gallery_url, $submit_image_url, $submit_video_url, $title, $fullname, $sorting)
{
$max = get_param_integer('max', get_default_gallery_max());
$start = get_param_integer('start', 0);
if ($max < 1) {
$max = 1;
}
$page_num = $max == 0 ? 0 : intval(floor(floatval($start) / floatval($max))) + 1;
// Work out totals
$num_images = $GLOBALS['SITE_DB']->query_value('images', 'COUNT(*)', array('cat' => $cat));
$num_videos = $GLOBALS['SITE_DB']->query_value('videos', 'COUNT(*)', array('cat' => $cat));
$total_rows = $num_images + $num_videos;
$total_pages = $max == 0 ? 1 : intval(ceil(floatval($total_rows) / floatval($max)));
if ($total_pages == 0) {
$total_pages = 1;
}
list($sort, $sort_backwards, $sql_suffix_images, $sql_suffix_videos) = $this->get_sort_order();
$where = db_string_equal_to('cat', $cat);
if (!has_specific_permission(get_member(), 'see_unvalidated')) {
$where .= ' AND validated=1';
}
if (get_param('days', '') != '') {
$where .= ' AND add_date>' . strval(time() - get_param_integer('days') * 60 * 60 * 24);
}
$rows = $GLOBALS['SITE_DB']->query('SELECT *' . $sql_suffix_videos . ' FROM ' . get_table_prefix() . 'videos e WHERE ' . $where . ' ORDER BY ' . $sort, $max, $start);
if (count($rows) < $max) {
$where = db_string_equal_to('cat', $cat);
if (!has_specific_permission(get_member(), 'see_unvalidated')) {
$where .= ' AND validated=1';
}
$rows2 = $GLOBALS['SITE_DB']->query('SELECT *' . $sql_suffix_images . ' FROM ' . get_table_prefix() . 'images e WHERE ' . $where . ' ORDER BY ' . $sort, $max - count($rows), max(0, $start - $num_videos));
} else {
$rows2 = array();
}
$entries = new ocp_tempcode();
$image_select = get_param('select', '*');
$video_select = get_param('video_select', '*');
// Display videos
foreach ($rows as $row_video) {
$view_url = build_url(array('page' => '_SELF', 'type' => 'video', 'root' => $root == 'root' ? NULL : $root, 'wide' => 1, 'id' => $row_video['id'], 'start' => $start == 0 ? NULL : $start, 'max' => $start == get_default_gallery_max() ? NULL : $max, 'days' => get_param('days', '') == '' ? NULL : get_param('days'), 'sort' => $sort == 'add_date DESC' ? NULL : $sort, 'select' => $image_select == '*' ? NULL : $image_select, 'video_select' => $video_select == '*' ? NULL : $video_select), '_SELF');
$thumb_url = ensure_thumbnail($row_video['url'], $row_video['thumb_url'], 'galleries', 'videos', $row_video['id']);
if ($thumb_url == '') {
$thumb_url = find_theme_image('na');
}
$thumb = do_image_thumb($thumb_url, '', true);
$this_full_url = $row_video['url'];
if (url_is_local($this_full_url)) {
$this_full_url = get_custom_base_url() . '/' . $this_full_url;
}
$entry_rating_details = $row_video['allow_rating'] == 1 ? display_rating(get_self_url(true), get_translated_text($row_video['title']), 'videos', strval($row_video['id']), 'RATING_INLINE_STATIC', $row_video['submitter']) : NULL;
$map = array('_GUID' => '395f0aa1212e69da5752d228a6efe54d', 'RATING_DETAILS' => $entry_rating_details, 'TITLE' => get_translated_text($row_video['title']), 'DESCRIPTION' => get_translated_tempcode($row_video['comments']), 'CAT' => $cat, 'THUMB_URL' => $thumb_url, 'FULL_URL' => $this_full_url, 'ID' => strval($row_video['id']), 'VIEWS' => strval($row_video['video_views']), 'ADD_DATE_RAW' => strval($row_video['add_date']), 'EDIT_DATE_RAW' => is_null($row_video['edit_date']) ? '' : strval($row_video['edit_date']), 'SUBMITTER' => strval($row_video['submitter']), 'THUMB' => $thumb, 'VIEW_URL' => $view_url, 'VIDEO_DETAILS' => show_video_details($row_video));
$entry = do_template('GALLERY_VIDEO', $map);
$entries->attach(do_template('GALLERY_ENTRY_WRAP', array('_GUID' => 'bc0d3de5d0160b00e3250d78658888c1', 'ENTRY' => $entry) + $map));
}
// Display images
foreach ($rows2 as $row_image) {
$view_url = build_url(array('page' => '_SELF', 'type' => 'image', 'root' => $root == 'root' ? NULL : $root, 'wide' => 1, 'id' => $row_image['id'], 'start' => $start == 0 ? NULL : $start, 'max' => $max == get_default_gallery_max() ? NULL : $max, 'days' => get_param('days', '') == '' ? NULL : get_param('days'), 'sort' => $sort == 'add_date DESC' ? NULL : $sort, 'select' => $image_select == '*' ? NULL : $image_select, 'video_select' => $video_select == '*' ? NULL : $video_select), '_SELF');
$thumb_url = ensure_thumbnail($row_image['url'], $row_image['thumb_url'], 'galleries', 'images', $row_image['id']);
$thumb = do_image_thumb($thumb_url, '', true);
$this_full_url = $row_image['url'];
if (url_is_local($this_full_url)) {
$file_size = file_exists(get_custom_file_base() . '/' . rawurldecode($this_full_url)) ? strval(filesize(get_custom_file_base() . '/' . rawurldecode($this_full_url))) : '';
$this_full_url = get_custom_base_url() . '/' . $this_full_url;
} else {
$file_size = '';
}
$entry_rating_details = $row_image['allow_rating'] == 1 ? display_rating(get_self_url(true), get_translated_text($row_image['title']), 'images', strval($row_image['id']), 'RATING_INLINE_STATIC', $row_image['submitter']) : NULL;
$map = array('_GUID' => 'aa70f543297e25379c49fa25d6dbcac0', 'RATING_DETAILS' => $entry_rating_details, 'TITLE' => get_translated_text($row_image['title']), 'DESCRIPTION' => get_translated_tempcode($row_image['comments']), 'FILE_SIZE' => $file_size, 'CAT' => $cat, 'THUMB_URL' => $thumb_url, 'FULL_URL' => $this_full_url, 'ID' => strval($row_image['id']), 'VIEWS' => strval($row_image['image_views']), 'ADD_DATE_RAW' => strval($row_image['add_date']), 'EDIT_DATE_RAW' => is_null($row_image['edit_date']) ? '' : strval($row_image['edit_date']), 'SUBMITTER' => strval($row_image['submitter']), 'THUMB' => $thumb, 'VIEW_URL' => $view_url);
$entry = do_template('GALLERY_IMAGE', $map);
$entries->attach(do_template('GALLERY_ENTRY_WRAP', array('_GUID' => 'ea12d7acf47eab493b6fb4658b3c0346', 'ENTRY' => $entry) + $map));
}
// Member gallery?
$member_id = get_member_id_from_gallery_name($cat, NULL, true);
if (get_forum_type() == 'ocf') {
require_code('ocf_members');
require_code('ocf_members2');
}
$member_details = is_null($member_id) || get_forum_type() != 'ocf' ? new ocp_tempcode() : ocf_show_member_box($member_id);
// Results browser
require_code('templates_results_browser');
$_selectors = array_map('intval', explode(',', get_option('gallery_selectors')));
//.........这里部分代码省略.........
开发者ID:erico-deh,项目名称:ocPortal,代码行数:101,代码来源:galleries.php
示例12: ocf_make_member
/**
* Add a member.
*
* @param SHORT_TEXT The username.
* @param SHORT_TEXT The password.
* @param SHORT_TEXT The e-mail address.
* @param ?array A list of usergroups (NULL: default/current usergroups).
* @param ?integer Day of date of birth (NULL: unknown).
* @param ?integer Month of date of birth (NULL: unknown).
* @param ?integer Year of date of birth (NULL: unknown).
* @param array A map of custom field values (field-id=>value).
* @param ?ID_TEXT The member timezone (NULL: auto-detect).
* @param ?GROUP The member's primary (NULL: default).
* @param BINARY Whether the profile has been validated.
* @param ?TIME When the member joined (NULL: now).
* @param ?TIME When the member last visited (NULL: now).
* @param ID_TEXT The member's default theme.
* @param ?URLPATH The URL to the member's avatar (blank: none) (NULL: choose one automatically).
* @param LONG_TEXT The member's signature (blank: none).
* @param BINARY Whether the member is permanently banned.
* @param BINARY Whether posts are previewed before they are made.
* @param BINARY Whether the member's age may be shown.
* @param SHORT_TEXT The member's title (blank: get from primary).
* @param URLPATH The URL to the member's photo (blank: none).
* @param URLPATH The URL to the member's photo thumbnail (blank: none).
* @param BINARY Whether the member sees signatures in posts.
* @param ?BINARY Whether the member automatically is enabled for notifications for content they contribute to (NULL: get default from config).
* @param ?LANGUAGE_NAME The member's language (NULL: auto detect).
* @param BINARY Whether the member allows e-mails via the site.
* @param BINARY Whether the member allows e-mails from staff via the site.
* @param LONG_TEXT Personal notes of the member.
* @param ?IP The member's IP address (NULL: IP address of current user).
* @param SHORT_TEXT The code required before the account becomes active (blank: already entered).
* @param boolean Whether to check details for correctness.
* @param ?ID_TEXT The compatibility scheme that the password operates in (blank: none) (NULL: none [meaning normal ocPortal salted style] or plain, depending on whether passwords are encrypted).
* @param SHORT_TEXT The password salt (blank: password compatibility scheme does not use a salt / auto-generate).
* @param BINARY Whether the member likes to view zones without menus, when a choice is available.
* @param ?TIME The time the member last made a submission (NULL: set to now).
* @param ?AUTO_LINK Force an ID (NULL: don't force an ID)
* @param BINARY Whether the member username will be highlighted.
* @param SHORT_TEXT Usergroups that may PT the member.
* @param LONG_TEXT Rules that other members must agree to before they may start a PT with the member.
* @return AUTO_LINK The ID of the new member.
*/
function ocf_make_member($username, $password, $email_address, $secondary_groups, $dob_day, $dob_month, $dob_year, $custom_fields, $timezone = NULL, $primary_group = NULL, $validated = 1, $join_time = NULL, $last_visit_time = NULL, $theme = '', $avatar_url = NULL, $signature = '', $is_perm_banned = 0, $preview_posts = 0, $reveal_age = 1, $title = '', $photo_url = '', $photo_thumb_url = '', $views_signatures = 1, $auto_monitor_contrib_content = NULL, $language = NULL, $allow_emails = 1, $allow_emails_from_staff = 1, $personal_notes = '', $ip_address = NULL, $validated_email_confirm_code = '', $check_correctness = true, $password_compatibility_scheme = NULL, $salt = '', $zone_wide = 1, $last_submit_time = NULL, $id = NULL, $highlighted_name = 0, $pt_allow = '*', $pt_rules_text = '')
{
if (is_null($auto_monitor_contrib_content)) {
$auto_monitor_contrib_content = get_value('no_auto_notifications') === '1' ? 0 : 1;
}
if (is_null($password_compatibility_scheme)) {
if (get_value('no_password_hashing') === '1') {
$password_compatibility_scheme = 'plain';
} else {
$password_compatibility_scheme = '';
}
}
if (is_null($language)) {
$language = '';
}
if (is_null($signature)) {
$signature = '';
}
if (is_null($title)) {
$title = '';
}
if (is_null($timezone)) {
$timezone = get_site_timezone();
}
if (is_null($allow_emails)) {
$allow_emails = 1;
}
if (is_null($allow_emails_from_staff)) {
$allow_emails_from_staff = 1;
}
if (is_null($personal_notes)) {
$personal_notes = '';
}
if (is_null($avatar_url)) {
if ($GLOBALS['IN_MINIKERNEL_VERSION'] == 1 || !addon_installed('ocf_member_avatars')) {
$avatar_url = '';
} else {
if (get_option('random_avatars') == '1' && !running_script('stress_test_loader')) {
require_code('themes2');
$codes = get_all_image_ids_type('ocf_default_avatars/default_set', false, $GLOBALS['FORUM_DB']);
shuffle($codes);
$results = array();
foreach ($codes as $code) {
if (strpos($code, 'ocp_fanatic') !== false) {
continue;
}
$count = $GLOBALS['FORUM_DB']->query_value_null_ok_full('SELECT SUM(m_cache_num_posts) FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_members WHERE ' . db_string_equal_to('m_avatar_url', find_theme_image($code, false, true)));
if (is_null($count)) {
$count = 0;
}
$results[$code] = $count;
}
@asort($results);
// @'d as type checker fails for some odd reason
$found_avatars = array_keys($results);
$avatar_url = find_theme_image(array_shift($found_avatars), true, true);
//.........这里部分代码省略.........
开发者ID:erico-deh,项目名称:ocPortal,代码行数:101,代码来源:ocf_members_action.php
示例13: testAddImageActualiser
function testAddImageActualiser()
{
//Test data add to POST
$_POST = array('title' => 'A test image', 'require__title' => 0, 'cat' => 'a_test_gallery_for_ut', 'require__cat' => 1, 'require__file' => 0, 'hidFileID_file' => -1, 'url' => find_theme_image('bottom/loading'), 'require__url' => 1, 'require__file2' => 1, 'hidFileID_file2' => -1, 'file2' => '', 'comcode__comments' => 1, 'comments' => 'test description', 'comments_parsed' => '', 'validated' => 1, 'tick_on_form__validated' => 0, 'require__validated' => 0, 'tick_on_form__rep_image' => 0, 'require__rep_image' => 0, 'allow_rating' => 1, 'tick_on_form__allow_rating' => 0, 'require__allow_rating' => 0, 'allow_comments' => 1, 'require__allow_comments' => 1, 'allow_trackbacks' => 1, 'tick_on_form__allow_trackbacks' => 0, 'require__allow_trackbacks' => 0, 'notes' => '', 'pre_f_notes' => 1, 'require__notes' => 0, 'meta_keywords' => '', 'require__meta_keywords' => 0, 'meta_description' => '', 'require__meta_description' => 0, 'comments__is_wysiwyg' => 1);
return $this->cms_gal->_ad();
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:6,代码来源:galleries.php
示例14: create_video_thumb
/**
* Create a video thumbnail.
*
* @param URLPATH Video to get thumbail from (must be local)
* @param ?PATH Where to save to (NULL: decide for ourselves)
* @return URLPATH Thumbnail, only valid if expected_output_path was passed as NULL (blank: could not generate)
*/
function create_video_thumb($src_url, $expected_output_path = NULL)
{
// Audio ones should have automatic thumbnails
require_code('mime_types');
$file_ext = get_file_extension($src_url);
$input_mime_type = get_mime_type($file_ext);
if (preg_match('#audio\\/#i', $input_mime_type) != 0) {
$ret = find_theme_image('audio_thumb', true);
if ($ret != '') {
if (!is_null($expected_output_path)) {
require_code('files');
$_expected_output_path = fopen($expected_output_path, 'wb');
http_download_file($ret, NULL, true, false, 'ocPortal', NULL, NULL, NULL, NULL, NULL, $_expected_output_path);
fclose($_expected_output_path);
}
}
return $ret;
}
// Try one of the hooks for video types
$ve_hooks = find_all_hooks('systems', 'video_embed');
foreach (array_keys($ve_hooks) as $ve_hook) {
require_code('hooks/systems/video_embed/' . $ve_hook);
$ve_ob = object_factory('Hook_video_embed_' . $ve_hook);
$thumbnail = $ve_ob->get_video_thumbnail($src_url);
if (!is_null($thumbnail)) {
return $thumbnail;
}
}
// Ok, gonna try hard using what FFMPEG techniques we can...
if (substr($src_url, 0, strlen(get_custom_base_url() . '/')) == get_custom_base_url() . '/') {
$src_url = substr($src_url, strlen(get_custom_base_url() . '/'));
}
if (!url_is_local($src_url)) {
return '';
}
$src_file = get_custom_file_base() . '/' . rawurldecode($src_url);
$src_file = preg_replace('#(\\\\|/)#', DIRECTORY_SEPARATOR, $src_file);
if (class_exists('ffmpeg_movie')) {
$filename = 'thumb_' . md5(uniqid('', true)) . '1.jpg';
if (is_null($expected_output_path)) {
$expected_output_path = get_custom_file_base() . '/uploads/galleries/' . $filename;
}
if (file_exists($expected_output_path)) {
return 'uploads/galleries/' . rawurlencode(basename($expected_output_path));
}
$movie = @new ffmpeg_movie($src_file, false);
if ($movie !== false) {
if ($movie->getFrameCount() == 0) {
return '';
}
$frame = $movie->getFrame(min($movie->getFrameCount(), 25));
if (method_exists($frame, 'toGDImage')) {
$gd_img = $frame->toGDImage();
@imagejpeg($gd_img, $expected_output_path);
} else {
$frame->save($expected_output_path);
// New-style
}
if (file_exists($expected_output_path)) {
require_code('images');
if (get_option('is_on_gd') == '1' && function_exists('imagecreatefromstring')) {
convert_image($expected_output_path, $expected_output_path, -1, -1, intval(get_option('thumb_width')), true, NULL, true);
}
return 'uploads/galleries/' . rawurlencode(basename($expected_output_path));
}
}
}
$ffmpeg_path = get_option('ffmpeg_path');
if ($ffmpeg_path != '' && strpos(@ini_get('disable_functions'), 'shell_exec') === false) {
$filename = 'thumb_' . md5(uniqid(strval(post_param_integer('thumbnail_auto_position', 1)), true)) . '%d.jpg';
$dest_file = get_custom_file_base() . '/uploads/galleries/' . $filename;
if (is_null($expected_output_path)) {
$expected_output_path = str_replace('%d', '1', $dest_file);
}
if (file_exists($dest_file) && is_null(post_param_integer('thumbnail_auto_position', NULL))) {
return 'uploads/galleries/' . rawurlencode(basename($expected_output_path));
}
@unlink($dest_file);
// So "if (@filesize($expected_output_path)) break;" will definitely fail if error
$dest_file = preg_replace('#(\\\\|/)#', DIRECTORY_SEPARATOR, $dest_file);
$at = display_seconds_period(post_param_integer('thumbnail_auto_position', 1));
if (strlen($at) == 5) {
$at = '00:' . $at;
}
$shell_command = '"' . $ffmpeg_path . 'ffmpeg" -i ' . @escapeshellarg($src_file) . ' -an -ss ' . $at . ' -r 1 -vframes 1 -y ' . @escapeshellarg($dest_file);
$shell_commands = array($shell_command, $shell_command . ' -map 0.0:0.0', $shell_command . ' -map 0.1:0.0');
foreach ($shell_commands as $shell_command) {
shell_exec($shell_command);
if (@filesize($expected_output_path)) {
break;
}
}
if (file_exists(str_replace('%d', '1', $dest_file))) {
//.........这里部分代码省略.........
开发者ID:erico-deh,项目名称:ocPortal,代码行数:101,代码来源:galleries2.php
示例15: nice_get_radio_entries
/**
* Standard aed_module list function.
*
* @return tempcode The selection list
*/
function nice_get_radio_entries()
{
$_m = $GLOBALS['FORUM_DB']->query_select('f_emoticons', array('e_code', 'e_theme_img_code'));
$entries = array();
$first = true;
foreach ($_m as $m) {
$url = find_theme_image($m['e_theme_img_code']);
$entries[] = do_template('FORM_SCREEN_INPUT_RADIO_LIST_ENTRY_PICTURE_3', array('_GUID' => 'f7f64637d1c4984881f7acc68c2fe6c7', 'PRETTY' => $m['e_code'], 'CHECKED' => $first, 'NAME' => 'id', 'CODE' => $m['e_code'], 'URL' => $url));
$first = false;
}
$_entries = wrap_image_radio_list($entries);
return $_entries;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:18,代码来源:admin_ocf_emoticons.php
示例16: do_quiz
/**
* The UI for doing a quiz.
*
* @return tempcode The result of execution.
*/
function do_quiz()
{
$id = get_param_integer('id');
$quizzes = $GLOBALS['SITE_DB']->query_select('quizzes', array('*'), array('id' => $id), '', 1);
if (!array_key_exists(0, $quizzes)) {
warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
}
$quiz = $quizzes[0];
$this->enforcement_checks($quiz);
if (addon_installed('awards')) {
require_code('awards');
$awards = find_awards_for('quiz', strval($id));
} else {
$awards = array();
}
$quiz_name = get_translated_text($quiz['q_name']);
$title_to_use = do_lang_tempcode('THIS_WITH', do_lang_tempcode($quiz['q_type']), make_string_tempcode(escape_html($quiz_name)));
$title_to_use_2 = do_lang('THIS_WITH_SIMPLE', do_lang($quiz['q_type']), $quiz_name);
$title = get_page_title($title_to_use, false, NULL, NULL, $awards);
seo_meta_load_for('quiz', strval($id), $title_to_use_2);
$last_visit_time = $GLOBALS['SITE_DB']->query_value_null_ok('quiz_member_last_visit', 'v_time', array('v_quiz_id' => $id, 'v_member_id' => get_member()), 'ORDER BY v_time DESC');
if (!is_null($last_visit_time)) {
$timer_offset = time() - $last_visit_time;
if (is_null($quiz['q_timeout']) || $timer_offset >= $quiz['q_timeout'] * 60) {
$GLOBALS['SITE_DB']->query_delete('quiz_member_last_visit', array('v_member_id' => get_member(), 'v_quiz_id' => $id));
$GLOBALS['SITE_DB']->query_insert('quiz_member_last_visit', array('v_quiz_id' => $id, 'v_time' => time(), 'v_member_id' => get_member()));
$timer_offset = 0;
}
} else {
$GLOBALS['SITE_DB']->query_insert('quiz_member_last_visit', array('v_quiz_id' => $id, 'v_time' => time(), 'v_member_id' => get_member()));
$timer_offset = 0;
}
$questions = $GLOBALS['SITE_DB']->query_select('quiz_questions', array('*'), array('q_quiz' => $id), 'ORDER BY q_order');
// If a test/quiz, randomly order questions
// if ($quiz['q_type']!='SURVEY') shuffle($questions); No, could cause problems
foreach ($questions as $i => $question) {
$answers = $GLOBALS['SITE_DB']->query_select('quiz_question_answers', array('*'), array('q_question' => $question['id']), 'ORDER BY q_order');
// If a test/quiz, randomly order answers
if ($quiz['q_type'] != 'SURVEY') {
shuffle($answers);
}
$questions[$i]['answers'] = $answers;
}
require_code('quiz');
$fields = render_quiz($questions);
breadcrumb_set_self(make_string_tempcode(escape_html(get_translated_text($quiz['q_name']))));
// Validation
if ($quiz['q_validated'] == 0) {
if (!has_specific_permission(get_member(), 'jump_to_unvalidated')) {
access_denied('SPECIFIC_PERMISSION', 'jump_to_unvalidated');
}
$warning_details = do_template('WARNING_TABLE', array('WARNING' => do_lang_tempcode(get_param_integer('redirected', 0) == 1 ? 'UNVALIDATED_TEXT_NON_DIRECT' : 'UNVALIDATED_TEXT')));
} else {
$warning_details = new ocp_tempcode();
}
$type = 'Quiz';
switch ($quiz['q_type']) {
case 'COMPETITION':
$type = 'Competition';
break;
case 'SURVEY':
$type = 'Survey';
break;
case 'TEST':
$type = 'Test';
break;
}
$GLOBALS['META_DATA'] += array('created' => date('Y-m-d', $q
|
请发表评论