本文整理汇总了PHP中get_db_type函数的典型用法代码示例。如果您正苦于以下问题:PHP get_db_type函数的具体用法?PHP get_db_type怎么用?PHP get_db_type使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_db_type函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: ocf_get_forums_stats
/**
* Get some forum stats.
*
* @return array A map of forum stats.
*/
function ocf_get_forums_stats()
{
$out = array();
$out['num_topics'] = $GLOBALS['OCF_DRIVER']->get_topics();
$out['num_posts'] = $GLOBALS['OCF_DRIVER']->get_num_forum_posts();
$out['num_members'] = $GLOBALS['OCF_DRIVER']->get_members();
$temp = get_value_newer_than('ocf_newest_member_id', time() - 60 * 60 * 1);
$out['newest_member_id'] = is_null($temp) ? NULL : intval($temp);
if (!is_null($out['newest_member_id'])) {
$out['newest_member_username'] = get_value_newer_than('ocf_newest_member_username', time() - 60 * 60 * 1);
} else {
$out['newest_member_username'] = NULL;
}
$out['newest_member_username'] = NULL;
if (is_null($out['newest_member_username'])) {
$newest_member = $GLOBALS['FORUM_DB']->query('SELECT m_username,id FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_members WHERE m_validated=1 AND id<>' . strval($GLOBALS['FORUM_DRIVER']->get_guest_id()) . ' ORDER BY m_join_time DESC', 1);
// Only ordered by m_join_time and not double ordered with ID to make much faster in MySQL
$out['newest_member_id'] = $newest_member[0]['id'];
$out['newest_member_username'] = $newest_member[0]['m_username'];
if (get_db_type() != 'xml') {
set_value('ocf_newest_member_id', strval($out['newest_member_id']));
set_value('ocf_newest_member_username', $out['newest_member_username']);
}
}
return $out;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:31,代码来源:ocf_general.php
示例2: upgrade
/** Upgrade database from given version to the latest. */
static function upgrade($country, $version = null)
{
if ($version === null) {
$version = Installer::getVersion();
if ($version === null) {
// Assume it's an old v4 with the old id
$version = 4;
}
}
while ($version != PT::DB_LEVEL) {
$uid = get_user_id();
$type = get_db_type($uid);
$pdo = PDOBuilder::getPDO();
// Load generic sql update for current version
$file = PT::$ABSPATH . "/install/database/" . $type . "/upgrade-" . $version . ".sql";
$fileContent = \file_get_contents($file);
if (!Installer::loadFile($pdo, $fileContent)) {
return false;
}
// Check for localized update data for current version
$file = PT::$ABSPATH . "/install/database/" . $type . "upgrade-" . $version . "_" . $country . ".sql";
if (\file_exists($file)) {
$fileContent = \file_get_contents($file);
if (!Installer::loadFile($pdo, $fileContent)) {
return false;
}
}
$version++;
}
}
开发者ID:booko,项目名称:pasteque-server,代码行数:31,代码来源:Installer.php
示例3: info
/**
* Standard modular info function.
*
* @return ?array Map of module info (NULL: module is disabled).
*/
function info()
{
if (get_db_type() != 'mysql') {
return NULL;
}
$info = array();
$info['title'] = do_lang_tempcode('MYSQL_OPTIMISE');
$info['description'] = do_lang_tempcode('DESCRIPTION_MYSQL_OPTIMISE');
$info['type'] = 'optimise';
return $info;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:16,代码来源:mysql.php
示例4: run
/**
* Standard modular run function for CRON hooks. Searches for tasks to perform.
*/
function run()
{
if (get_db_type() == 'oracle') {
$oracle_index_cleanup_last_time = intval(get_value('oracle_index_cleanup_last_time'));
if ($oracle_index_cleanup_last_time < time() - 60 * 60 * 5) {
set_value('oracle_index_cleanup_last_time', strval(time()));
$indices = $GLOBALS['SITE_DB']->query_select('db_meta_indices', array('i_name'));
foreach ($indices as $index) {
if ($index['i_name'][0] == '#') {
$GLOBALS['SITE_DB']->query('EXEC CTX_DDL.SYNC_INDEX(\'' . substr($index['i_name'], 1) . '\')');
}
}
}
}
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:18,代码来源:oracle.php
示例5: activities_addon_syndicate_described_activity
/**
* @license http://opensource.org/licenses/cpal_1.0 Common Public Attribution License
* @copyright ocProducts Ltd
* @package activity_feed
*/
function activities_addon_syndicate_described_activity($a_language_string_code = '', $a_label_1 = '', $a_label_2 = '', $a_label_3 = '', $a_pagelink_1 = '', $a_pagelink_2 = '', $a_pagelink_3 = '', $a_addon = '', $a_is_public = 1, $a_member_id = NULL, $sitewide_too = false, $a_also_involving = NULL)
{
require_code('activities');
require_lang('activities');
if (get_db_type() == 'xml' && get_param_integer('keep_testing_logging', 0) != 1) {
return NULL;
}
$stored_id = 0;
if (is_null($a_member_id)) {
$a_member_id = get_member();
}
if (is_guest($a_member_id)) {
return NULL;
}
$go = array('a_language_string_code' => $a_language_string_code, 'a_label_1' => $a_label_1, 'a_label_2' => $a_label_2, 'a_label_3' => $a_label_3, 'a_is_public' => $a_is_public);
$stored_id = mixed();
// Check if this has been posted previously (within the last 10 minutes) to
// stop spamming but allow generalised repeat status messages.
$test = $GLOBALS['SITE_DB']->query_select('activities', array('a_language_string_code', 'a_label_1', 'a_label_2', 'a_label_3', 'a_is_public'), NULL, 'WHERE a_time>' . strval(time() - 600), 1);
if (!array_key_exists(0, $test) || $test[0] != $go || running_script('execute_temp')) {
// Log the activity
$row = $go + array('a_member_id' => $a_member_id, 'a_also_involving' => $a_also_involving, 'a_pagelink_1' => $a_pagelink_1, 'a_pagelink_2' => $a_pagelink_2, 'a_pagelink_3' => $a_pagelink_3, 'a_time' => time(), 'a_addon' => $a_addon, 'a_is_public' => $a_is_public);
$stored_id = $GLOBALS['SITE_DB']->query_insert('activities', $row, true);
// Update the latest activity file
log_newest_activity($stored_id, 1000);
// External places
if ($a_is_public == 1 && !$GLOBALS['IS_ACTUALLY_ADMIN']) {
$dests = find_all_hooks('systems', 'syndication');
foreach (array_keys($dests) as $hook) {
require_code('hooks/systems/syndication/' . $hook);
$ob = object_factory('Hook_Syndication_' . $hook);
if ($ob->is_available()) {
$ob->syndicate_user_activity($a_member_id, $row);
if ($sitewide_too && has_specific_permission(get_member(), 'syndicate_site_activity') && post_param_integer('syndicate_this', 0) == 1) {
$ob->syndicate_site_activity($row);
}
}
}
}
list($message) = render_activity($row, false);
require_code('notifications');
$username = $GLOBALS['FORUM_DRIVER']->get_username($a_member_id);
$subject = do_lang('ACTIVITY_NOTIFICATION_MAIL_SUBJECT', get_site_name(), $username, html_entity_decode(strip_tags($message->evaluate()), ENT_QUOTES, get_charset()));
$mail = do_lang('ACTIVITY_NOTIFICATION_MAIL', comcode_escape(get_site_name()), comcode_escape($username), array('[semihtml]' . $message->evaluate() . '[/semihtml]'));
dispatch_notification('activity', strval($a_member_id), $subject, $mail);
}
return $stored_id;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:53,代码来源:activities_submission.php
示例6: import_sql_scripts_to_databases
function import_sql_scripts_to_databases($schema_files, $db_ids, $psa_modify_hash, $db_modify_hash, $settings_modify_hash, $crypt_settings_modify_hash, $settings_enum_modify_hash, $additional_modify_hash)
{
foreach ($db_ids as $db_id) {
if (get_db_type($db_id) != "mysql") {
print "FIXME: database type " . get_db_type($db_id) . " is not supported.\n";
exit(1);
}
foreach ($schema_files as $schema_filename => $schema_db_id) {
if ($schema_db_id == $db_id) {
mysql_db_connect(get_db_address($db_id), get_db_login($db_id), get_db_password($db_id), get_db_name($db_id));
$sql = modify_content($schema_filename, array_merge($psa_modify_hash, $db_modify_hash, $settings_modify_hash, $settings_enum_modify_hash, $crypt_settings_modify_hash, $additional_modify_hash));
populate_mysql_db($sql);
}
}
}
}
开发者ID:Staalkoper,项目名称:microweber-hosting-scripts,代码行数:16,代码来源:app-util.php
示例7: getPDO
/** Get PDO from the loaded database core module */
public static function getPDO($uid = null)
{
// Set uid to logged user
if ($uid === null) {
$uid = get_user_id();
}
// Return cached pdo if same uid
if (PDOBuilder::$pdo !== null && $uid === PDOBuilder::$pdoUid) {
return PDOBuilder::$pdo;
}
$dsn = null;
switch (get_db_type($uid)) {
case 'mysql':
$dsn = "mysql:dbname=" . get_db_name($uid) . ";host=" . get_db_host($uid) . ";port=" . get_db_port($uid);
$options = array(\PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\'');
$attributes = array(\PDO::ATTR_CASE => \PDO::CASE_UPPER);
break;
case 'postgresql':
$dsn = "pgsql:dbname=" . get_db_name($uid) . ";host=" . get_db_host($uid) . ";port=" . get_db_port($uid);
$options = array();
$attributes = array(\PDO::ATTR_CASE => \PDO::CASE_UPPER);
break;
default:
die("Config error");
}
try {
PDOBuilder::$pdo = new \PDO($dsn, get_db_user($uid), get_db_password($uid), $options);
foreach ($attributes as $key => $value) {
PDOBuilder::$pdo->setAttribute($key, $value);
}
PDOBuilder::$pdoUid = $uid;
return PDOBuilder::$pdo;
} catch (\PDOException $e) {
die("Connexion error " . $e);
}
}
开发者ID:booko,项目名称:pasteque-server,代码行数:37,代码来源:PDOBuilder.php
示例8: show_video
/**
* The UI to show a video.
*
* @param ?string Alternate category name to use (NULL: use standard one). This is useful if you are overriding this code to show images in virtual galleries.
* @param ?tempcode Breadcrumbs (NULL: derive in this function).
* @return tempcode The UI
*/
function show_video($category_name = NULL, $tree = NULL)
{
$id = get_param_integer('id');
if (get_param_integer('ajax', 0) == 1) {
header('Content-type: text/xml');
}
list($sort, $sort_backwards, $sql_suffix_images, $sql_suffix_videos) = $this->get_sort_order();
if (addon_installed('awards')) {
require_code('awards');
$awards = find_awards_for('video', strval($id));
} else {
$awards = array();
}
// Pic up some info
$rows = $GLOBALS['SITE_DB']->query_select('videos', array('*'), array('id' => $id), '', 1);
if (!array_key_exists(0, $rows)) {
return warn_screen(get_page_title('ERROR_OCCURRED'), do_lang_tempcode('MISSING_RESOURCE'));
}
$myrow = $rows[0];
$url = $myrow['url'];
if (url_is_local($url)) {
$url = get_custom_base_url() . '/' . $url;
}
$cat = $myrow['cat'];
$GLOBALS['FEED_URL'] = find_script('backend') . '?mode=galleries&filter=' . urlencode($cat);
if (get_value('no_individual_gallery_view') === '1' && $GLOBALS['SITE_DB']->query_value('galleries', 'flow_mode_interface', array('name' => $cat)) == '1') {
require_code('site2');
assign_refresh(build_url(array('page' => '_SELF', 'type' => 'misc', 'id' => $cat, 'probe_id' => $id, 'probe_type' => 'video'), '_SELF'), 0.0);
}
$true_category_name = get_translated_text($GLOBALS['SITE_DB']->query_value('galleries', 'fullname', array('name' => $cat)));
if (is_null($category_name)) {
$category_name = $true_category_name;
}
if (get_param_integer('slideshow', 0) == 1) {
$title = get_page_title('VIEW_SLIDESHOW', true, array(escape_html($category_name)));
global $EXTRA_HEAD;
$EXTRA_HEAD->attach('<meta name="robots" content="noindex" />');
// XHTMLXHTML
} else {
$title = get_page_title(get_translated_text($myrow['title']) == '' ? 'VIEW_VIDEO' : '_VIEW_VIDEO', true, array(escape_html(get_translated_text($myrow['title']))), NULL, $awards);
}
$root = get_param('root', 'root');
seo_meta_load_for('video', strval($id));
$thumb_url = $myrow['thumb_url'];
if (url_is_local($thumb_url)) {
$thumb_url = get_custom_base_url() . '/' . $thumb_url;
}
if (!has_category_access(get_member(), 'galleries', $cat)) {
access_denied('CATEGORY_ACCESS');
}
// Views
if (get_db_type() != 'xml') {
$myrow['video_views']++;
$GLOBALS['SITE_DB']->query_update('videos', array('video_views' => $myrow['video_views']), array('id' => $id), '', 1, NULL, false, true);
}
list($rating_details, $comment_details, $trackback_details) = embed_feedback_systems('videos', strval($id), $myrow['allow_rating'], $myrow['allow_comments'], $myrow['allow_trackbacks'], $myrow['validated'], $myrow['submitter'], build_url(array('page' => '_SELF', 'type' => 'video', 'id' => $id), '_SELF', NULL, false, false, true), get_translated_text($myrow['title']) == '' ? do_lang('VIEW_VIDEO_IN', $true_category_name) : get_translated_text($myrow['title']), get_value('comment_forum__videos'));
// Validation
if ($myrow['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('_GUID' => 'b32faacba974e648a67e5e91ffd3d8e5', 'WARNING' => do_lang_tempcode(get_param_integer('redirected', 0) == 1 ? 'UNVALIDATED_TEXT_NON_DIRECT' : 'UNVALIDATED_TEXT')));
} else {
$warning_details = new ocp_tempcode();
}
// Comments
$comments = get_translated_tempcode($myrow['comments']);
if (has_actual_page_access(NULL, 'cms_galleries', NULL, NULL) && has_edit_permission('mid', get_member(), $myrow['submitter'], 'cms_galleries', array('galleries', $cat))) {
$edit_url = build_url(array('page' => 'cms_galleries', 'type' => '_ev', 'id' => $id), get_module_zone('cms_galleries'));
} else {
$edit_url = new ocp_tempcode();
}
$add_date = get_timezoned_date($myrow['add_date']);
$edit_date = is_null($myrow['edit_date']) ? '' : get_timezoned_date($myrow['edit_date']);
// Video HTML
$video = show_gallery_media($url, $thumb_url, $myrow['video_width'], $myrow['video_height'], $myrow['video_length']);
$extension = get_file_extension($url);
require_code('mime_types');
$mime_type = get_mime_type($extension);
list($n, $x, $nav) = $this->build_set_navigation(db_string_equal_to('cat', $cat), '', $category_name, $id, $root, 'video', get_param_integer('slideshow', 0), get_param_integer('wide_high', 0), get_param_integer('start', 0), get_param_integer('max', get_default_gallery_max()), $cat, $sort, $sort_backwards, $sql_suffix_images, $sql_suffix_videos, get_param('select', '*'), get_param('video_select', '*'));
$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);
$video_details = show_video_details($myrow);
if (is_null($tree)) {
$tree = gallery_breadcrumbs($cat, $root, false, get_module_zone('galleries'));
}
breadcrumb_add_segment($tree, do_lang_tempcode('VIEW_VIDEO'));
$GLOBALS['META_DATA'] += array('created' => date('Y-m-d', $myrow['add_date']), 'creator' => $GLOBALS['FORUM_DRIVER']->get_username($myrow['submitter']), 'publisher' => '', 'modified' => is_null($myrow['edit_date']) ? '' : date('Y-m-d', $myrow['edit_date']), 'type' => 'Video', 'title' => get_translated_text($myrow['title']), 'identifier' => '_SEARCH:galleries:video:' . strval($id), 'description' => get_translated_text($myrow['comments']), 'image' => $thumb_url, 'video' => $url, 'video:height' => strval($myrow['video_height']), 'video:width' => strval($myrow['video_width']), 'video:type' => $mime_type);
return do_template('GALLERY_ENTRY_SCREEN', array('_GUID' => '91e231906ed899513ec2db8a2974dddf', 'MEDIA_TYPE' => 'video', 'E_TITLE' => get_translated_text($myrow['title']), 'CAT' => $cat, 'SLIDESHOW' => get_param_integer('slideshow', 0) == 1, 'TRUE_GALLERY_TITLE' => $true_category_name, 'GALLERY_TITLE' => $category_name, 'MEMBER_ID' => is_null($member_id) ? '' : strval($member_id), 'ID' => strval($id), 'TAGS' => get_loaded_tags('videos'), 'TITLE' => $title, 'SUBMITTER' => strval($myrow['submitter']), 'URL' => $url, 'VIDEO_DETAILS' => $video_details, 'MEMBER_DETAILS' => $member_details, 'X' => integer_format($x), 'N' => integer_format($n), 'VIEWS' => integer_format($myrow['video_views']), 'ADD_DATE_RAW' => strval($myrow['add_date']), 'EDIT_DATE_RAW' => is_null($myrow['edit_date']) ? '' : strval($myrow['edit_date']), 'ADD_DATE' => $add_date, 'EDIT_DATE' => $edit_date, 'RATING_DETAILS' => $rating_details, 'TRACKBACK_DETAILS' => $trackback_details, 'COMMENT_DETAILS' => $comment_details, 'EDIT_URL' => $edit_url, 'NAV' => $nav, 'COMMENTS' => $comments, 'VIDEO' => $video, 'WARNING_DETAILS' => $warning_details));
//.........这里部分代码省略.........
开发者ID:erico-deh,项目名称:ocPortal,代码行数:101,代码来源:galleries.php
示例9: dloadinfo_screen
/**
* The UI to view a download.
*
* @return tempcode The UI
*/
function dloadinfo_screen()
{
$id = get_param_integer('id');
$root = get_param_integer('root', db_get_first_id(), true);
// Basic Init
$rows = $GLOBALS['SITE_DB']->query_select('download_downloads', array('*'), array('id' => $id), '', 1);
if (!array_key_exists(0, $rows)) {
return warn_screen(get_page_title('SECTION_DOWNLOADS'), do_lang_tempcode('MISSING_RESOURCE'));
}
$myrow = $rows[0];
$GLOBALS['FEED_URL'] = find_script('backend') . '?mode=downloads&filter=' . strval($myrow['category_id']);
if (!has_category_access(get_member(), 'downloads', strval($myrow['category_id']))) {
access_denied('CATEGORY_ACCESS');
}
$name = get_translated_text($myrow['name']);
list($rating_details, $comment_details, $trackback_details) = embed_feedback_systems(get_page_name(), strval($id), $myrow['allow_rating'], $myrow['allow_comments'], $myrow['allow_trackbacks'], $myrow['validated'], $myrow['submitter'], build_url(array('page' => '_SELF', 'type' => 'entry', 'id' => $id), '_SELF', NULL, false, false, true), $name, get_value('comment_forum__downloads'));
// Views
if (get_db_type() != 'xml') {
$myrow['download_views']++;
$GLOBALS['SITE_DB']->query_update('download_downloads', array('download_views' => $myrow['download_views']), array('id' => $id), '', 1, NULL, false, true);
}
// Tree
$tree = download_breadcrumbs($myrow['category_id'], $root, false, get_zone_name());
$title_to_use = do_lang_tempcode('DOWNLOAD_TITLE', escape_html($name));
$title_to_use_2 = do_lang('DOWNLOAD_TITLE', $name);
if (addon_installed('awards')) {
require_code('awards');
$awards = find_awards_for('download', strval($id));
} else {
$awards = array();
}
$title = get_page_title($title_to_use, false, NULL, NULL, $awards);
seo_meta_load_for('downloads_download', strval($id), $title_to_use_2);
$warning_details = new ocp_tempcode();
// Validation
if ($myrow['validated'] == 0) {
if (!has_specific_permission(get_member(), 'jump_to_unvalidated')) {
access_denied('SPECIFIC_PERMISSION', 'jump_to_unvalidated');
}
$warning_details->attach(do_template('WARNING_TABLE', array('_GUID' => '5b1781b8fbb1ef9b8f47693afcff02b9', 'WARNING' => do_lang_tempcode(get_param_integer('redirected', 0) == 1 ? 'UNVALIDATED_TEXT_NON_DIRECT' : 'UNVALIDATED_TEXT'))));
}
// Cost warning
if ($myrow['download_cost'] != 0 && addon_installed('points')) {
require_lang('points');
$warning_details->attach(do_template('WARNING_TABLE', array('_GUID' => '05fc448bf79b373385723c5af5ec93af', 'WARNING' => do_lang_tempcode('WILL_COST', integer_format($myrow['download_cost'])))));
}
// Admin functions
$edit_url = new ocp_tempcode();
$add_img_url = new ocp_tempcode();
if (has_actual_page_access(NULL, 'cms_downloads', NULL, NULL) && has_edit_permission('mid', get_member(), $myrow['submitter'], 'cms_downloads', array('downloads', $myrow['category_id']))) {
$edit_url = build_url(array('page' => 'cms_downloads', 'type' => '_ed', 'id' => $id), get_module_zone('cms_downloads'));
}
if (addon_installed('galleries')) {
if (has_actual_page_access(NULL, 'cms_galleries', NULL, NULL) && has_edit_permission('mid', get_member(), $myrow['submitter'], 'cms_galleries', array('galleries', 'download_' . strval($id)))) {
require_lang('galleries');
$add_img_url = build_url(array('page' => 'cms_galleries', 'type' => 'ad', 'cat' => 'download_' . strval($id)), get_module_zone('cms_galleries'));
}
}
// Outmoding
if (!is_null($myrow['out_mode_id'])) {
$outmode_url = build_url(array('page' => '_SELF', 'type' => 'entry', 'id' => $myrow['out_mode_id'], 'root' => $root == db_get_first_id() ? NULL : $root), '_SELF');
} else {
$outmode_url = new ocp_tempcode();
}
// Stats
$add_date = get_timezoned_date($myrow['add_date'], false);
// Additional information
$additional_details = get_translated_tempcode($myrow['comments']);
// Edit date
if (!is_null($myrow['edit_date'])) {
$edit_date = make_string_tempcode(get_timezoned_date($myrow['edit_date'], false));
} else {
$edit_date = new ocp_tempcode();
}
$images_details = new ocp_tempcode();
$image_url = '';
$counter = 0;
if (addon_installed('galleries')) {
// Images
require_lang('galleries');
$cat = 'download_' . strval($id);
$map = array('cat' => $cat);
if (!has_specific_permission(get_member(), 'see_unvalidated')) {
$map['validated'] = 1;
}
$rows = $GLOBALS['SITE_DB']->query_select('images', array('*'), $map, 'ORDER BY id', 200);
$div = 2;
$_out = new ocp_tempcode();
$_row = new ocp_tempcode();
require_code('images');
while (array_key_exists($counter, $rows)) {
$row = $rows[$counter];
// $view_url=build_url(array('page'=>'galleries','type'=>'image','wide'=>1,'id'=>$row['id']),get_module_zone('galleries'));
$view_url = $row['url'];
if ($image_url == '') {
//.........这里部分代码省略.........
开发者ID:erico-deh,项目名称:ocPortal,代码行数:101,代码来源:downloads.php
示例10: render_catalogue_entry_screen
/**
* Display a catalogue entry
*
* @param AUTO_LINK Entry ID
* @param boolean Whether to skip rendering a title
* @return tempcode Tempcode interface to display an entry
*/
function render_catalogue_entry_screen($id, $no_title = false)
{
require_code('feedback');
if (addon_installed('ecommerce')) {
require_code('ecommerce');
}
require_code('images');
require_css('catalogues');
require_lang('catalogues');
$entries = $GLOBALS['SITE_DB']->query_select('catalogue_entries', array('*'), array('id' => $id), '', 1);
if (!array_key_exists(0, $entries)) {
return warn_screen(get_page_title('CATALOGUES'), do_lang_tempcode('MISSING_RESOURCE'));
}
$entry = $entries[0];
$categories = $GLOBALS['SITE_DB']->query_select('catalogue_categories', array('*'), array('id' => $entry['cc_id']), '', 1);
if (!array_key_exists(0, $categories)) {
warn_exit(do_lang_tempcode('CAT_NOT_FOUND', strval($entry['cc_id'])));
}
$category = $categories[0];
$GLOBALS['FEED_URL'] = find_script('backend') . '?mode=catalogues&filter=' . strval($entry['cc_id']);
$catalogue_name = $category['c_name'];
$catalogues = $GLOBALS['SITE_DB']->query_select('catalogues', array('*'), array('c_name' => $catalogue_name), '', 1);
if (!array_key_exists(0, $catalogues)) {
warn_exit(do_lang_tempcode('CATALOGUE_NOT_FOUND', $catalogue_name));
}
$catalogue = $catalogues[0];
// Permission for here?
if (!has_category_access(get_member(), 'catalogues_catalogue', $catalogue_name)) {
access_denied('CATALOGUE_ACCESS');
}
if (get_value('disable_cat_cat_perms') !== '1' && !has_category_access(get_member(), 'catalogues_category', strval($entry['cc_id']))) {
access_denied('CATEGORY_ACCESS');
}
$ecommerce = is_ecommerce_catalogue($catalogue_name);
if ($ecommerce) {
$tpl_set = 'products';
} else {
$tpl_set = $catalogue_name;
}
$root = get_param_integer('root', NULL);
$map = get_catalogue_entry_map($entry, $catalogue, 'PAGE', $tpl_set, $root, NULL, NULL, true, true);
if (get_db_type() != 'xml') {
$entry['ce_views']++;
$GLOBALS['SITE_DB']->query_update('catalogue_entries', array('ce_views' => $entry['ce_views']), array('id' => $id), '', 1, NULL, false, true);
}
// Validation
if ($entry['ce_validated'] == 0) {
if (!has_specific_permission(get_member(), 'jump_to_unvalidated')) {
access_denied('SPECIFIC_PERMISSION', 'jump_to_unvalidated');
}
$map['WARNINGS'] = do_template('WARNING_TABLE', array('_GUID' => 'bf604859a572ca53e969bec3d91f9cfb', 'WARNING' => do_lang_tempcode(get_param_integer('redirected', 0) == 1 ? 'UNVALIDATED_TEXT_NON_DIRECT' : 'UNVALIDATED_TEXT')));
} else {
$map['WARNINGS'] = '';
}
//Finding any hook exists for this product--------------------
if (addon_installed('ecommerce')) {
$object = find_product(strval($id));
if (is_object($object) && method_exists($object, 'get_custom_product_map_fields')) {
$object->get_custom_product_map_fields($id, $map);
}
}
//------------------------------------------------------------
$map['ENTRY'] = do_template('CATALOGUE_' . $tpl_set . '_ENTRY', $map, NULL, false, 'CATALOGUE_DEFAULT_ENTRY');
$map['ADD_DATE'] = get_timezoned_date($entry['ce_add_date']);
$map['ADD_DATE_RAW'] = strval($entry['ce_add_date']);
$map['EDIT_DATE'] = is_null($entry['ce_edit_date']) ? '' : get_timezoned_date($entry['ce_edit_date']);
$map['EDIT_DATE_RAW'] = is_null($entry['ce_edit_date']) ? '' : strval($entry['ce_edit_date']);
$map['VIEWS'] = integer_format($entry['ce_views']);
$title_to_use = do_lang_tempcode($catalogue_name . '__CATALOGUE_ENTRY', $map['FIELD_0']);
$title_to_use_2 = do_lang($catalogue_name . '__CATALOGUE_ENTRY', $map['FIELD_0_PLAIN'], NULL, NULL, NULL, false);
if (is_null($title_to_use_2)) {
$title_to_use = do_lang_tempcode('DEFAULT__CATALOGUE_ENTRY', $map['FIELD_0']);
$title_to_use_2 = do_lang('DEFAULT__CATALOGUE_ENTRY', $map['FIELD_0_PLAIN']);
}
if ($no_title) {
$map['TITLE'] = new ocp_tempcode();
} else {
if (addon_installed('awards')) {
require_code('awards');
$awards = find_awards_for('catalogue_entry', strval($id));
} else {
$awards = array();
}
$map['TITLE'] = get_page_title($title_to_use, false, NULL, NULL, $awards);
}
$map['SUBMITTER'] = strval($entry['ce_submitter']);
require_code('seo2');
if (is_object($title_to_use_2)) {
$title_to_use_2 = $title_to_use_2->evaluate();
}
seo_meta_load_for('catalogue_entry', strval($id), strip_tags($title_to_use_2));
if ($map['TREE'] === '') {
$map['TREE'] = new ocp_tempcode();
//.........这里部分代码省略.........
开发者ID:erico-deh,项目名称:ocPortal,代码行数:101,代码来源:catalogues.php
示例11: step_5_core
/**
* Fifth installation step: core tables.
*
* @return tempcode Progress report / UI
*/
function step_5_core()
{
$GLOBALS['SITE_DB']->drop_if_exists('db_meta');
$GLOBALS['SITE_DB']->create_table('db_meta', array('m_table' => '*ID_TEXT', 'm_name' => '*ID_TEXT', 'm_type' => 'ID_TEXT'));
$GLOBALS['SITE_DB']->create_index('db_meta', 'findtransfields', array('m_type'));
$GLOBALS['SITE_DB']->drop_if_exists('db_meta_indices');
$GLOBALS['SITE_DB']->create_table('db_meta_indices', array('i_table' => '*ID_TEXT', 'i_name' => '*ID_TEXT', 'i_fields' => '*ID_TEXT'));
$GLOBALS['SITE_DB']->drop_if_exists('translate');
$GLOBALS['SITE_DB']->create_table('translate', array('id' => '*AUTO', 'language' => '*LANGUAGE_NAME', 'importance_level' => 'SHORT_INTEGER', 'text_original' => 'LONG_TEXT', 'text_parsed' => 'LONG_TEXT', 'broken' => 'BINARY', 'source_user' => 'USER'));
$GLOBALS['SITE_DB']->create_index('translate', '#search', array('text_original'));
$GLOBALS['SITE_DB']->create_index('translate', 'importance_level', array('importance_level'));
//$GLOBALS['SITE_DB']->create_index('translate','id',array('id'));
//$GLOBALS['SITE_DB']->create_index('translate','language',array('language'));
if (substr(get_db_type(), 0, 5) == 'mysql') {
$GLOBALS['SITE_DB']->create_index('translate', 'equiv_lang', array('text_original(4)'));
$GLOBALS['SITE_DB']->create_index('translate', 'decache', array('text_parsed(2)'));
}
$GLOBALS['SITE_DB']->drop_if_exists('values');
$GLOBALS['SITE_DB']->create_table('values', array('the_name' => '*ID_TEXT', 'the_value' => 'ID_TEXT', 'date_and_time' => 'TIME'));
$GLOBALS['SITE_DB']->create_index('values', 'date_and_time', array('date_and_time'));
$GLOBALS['SITE_DB']->drop_if_exists('config');
$GLOBALS['SITE_DB']->create_table('config', array('the_name' => '*ID_TEXT', 'human_name' => 'ID_TEXT', 'c_set' => 'BINARY', 'config_value' => 'LONG_TEXT', 'the_type' => 'ID_TEXT', 'eval' => 'SHORT_TEXT', 'the_page' => 'ID_TEXT', 'section' => 'ID_TEXT', 'explanation' => 'ID_TEXT', 'shared_hosting_restricted' => 'BINARY', 'c_data' => 'SHORT_TEXT'));
// Privileges
$GLOBALS['SITE_DB']->drop_if_exists('gsp');
$GLOBALS['SITE_DB']->create_table('gsp', array('group_id' => '*INTEGER', 'specific_permission' => '*ID_TEXT', 'the_page' => '*ID_TEXT', 'module_the_name' => '*ID_TEXT', 'category_name' => '*ID_TEXT', 'the_value' => 'BINARY'));
$GLOBALS['SITE_DB']->drop_if_exists('sp_list');
$GLOBALS['SITE_DB']->create_table('sp_list', array('p_section' => 'ID_TEXT', 'the_name' => '*ID_TEXT', 'the_default' => '*BINARY'));
$GLOBALS['SITE_DB']->drop_if_exists('attachments');
$GLOBALS['SITE_DB']->create_table('attachments', array('id' => '*AUTO', 'a_member_id' => 'USER', 'a_file_size' => '?INTEGER', 'a_url' => 'SHORT_TEXT', 'a_description' => 'SHORT_TEXT', 'a_thumb_url' => 'SHORT_TEXT', 'a_original_filename' => 'SHORT_TEXT', 'a_num_downloads' => 'INTEGER', 'a_last_downloaded_time' => '?INTEGER', 'a_add_time' => 'INTEGER'));
$GLOBALS['SITE_DB']->drop_if_exists('attachment_refs');
$GLOBALS['SITE_DB']->create_table('attachment_refs', array('id' => '*AUTO', 'r_referer_type' => 'ID_TEXT', 'r_referer_id' => 'ID_TEXT', 'a_id' => 'AUTO_LINK'));
$GLOBALS['SITE_DB']->create_index('attachments', 'ownedattachments', array('a_member_id'));
$GLOBALS['SITE_DB']->create_index('attachments', 'attachmentlimitcheck', array('a_add_time'));
return do_template('INSTALLER_DONE_SOMETHING', array('_GUID' => 'c6b6d92c670b7f1b223798ace54102f9', 'SOMETHING' => do_lang_tempcode('PRIMARY_CORE_INSTALLED')));
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:40,代码来源:install.php
示例12: view_subscribers
//.........这里部分代码省略.........
$start2 = 0;
do {
$map = array();
if (is_null($level)) {
$map[$id] = 1;
// $id will be -1
$_c = newsletter_who_send_to($map, $lang, $start + $start2, $max, true);
} else {
$map[$id] = $level;
// We're requesting that we probe subscribers of $id on $level
$_c = newsletter_who_send_to($map, $lang, $start + $start2, $max, true);
}
$rows = $_c[7];
if ($csv == 1) {
if ($start2 == 0) {
if (!is_null($level)) {
echo '"LEVEL ' . do_lang('NEWSLETTER_' . strval($level)) . '"' . chr(10);
}
echo '"' . str_replace('"', '""', do_lang('EMAIL_ADDRESS')) . '",' . '"' . str_replace('"', '""', do_lang('FORENAME')) . '",' . '"' . str_replace('"', '""', do_lang('SURNAME')) . '",' . '"' . str_replace('"', '""', do_lang('NAME')) . '",' . '"' . str_replace('"', '""', do_lang('NEWSLETTER_SEND_ID')) . '",' . '"' . str_replace('"', '""', do_lang('NEWSLETTER_HASH')) . '",' . '"' . str_replace('"', '""', do_lang('PASSWORD_HASH')) . '",' . '"' . str_replace('"', '""', do_lang('SALT')) . '",' . '"' . str_replace('"', '""', do_lang('LANGUAGE')) . '",' . '"' . str_replace('"', '""', do_lang('CONFIRM_CODE')) . '",' . '"' . str_replace('"', '""', do_lang('JOIN_DATE')) . '"' . chr(10);
}
} else {
$out = '';
}
foreach ($rows as $r) {
$email = array_key_exists('email', $r) ? $r['email'] : $r['m_email_address'];
$forename = array_key_exists('n_forename', $r) ? $r['n_forename'] : '';
$surname = array_key_exists('n_surname', $r) ? $r['n_surname'] : '';
$name = array_key_exists('m_username', $r) ? $r['m_username'] : '';
$salt = array_key_exists('pass_salt', $r) ? $r['pass_salt'] : '';
$_lang = array_key_exists('language', $r) ? $r['language'] : '';
$confirm_code = array_key_exists('confirm_code', $r) ? $r['confirm_code'] : 0;
$join_time = array_key_exists('join_time', $r) ? $r['join_time'] : time();
$send_id = (array_key_exists('m_username', $r) ? 'm' : 'n') . (array_key_exists('id', $r) ? strval($r['id']) : $email);
$hash = array_key_exists('the_password', $r) ? $r['the_password'] : '';
$unsub = array_key_exists('the_password', $r) ? best_hash($r['the_password'], 'xunsub') : '';
if ($csv == 1) {
echo '"' . str_replace('"', '""', $email) . '",' . '"' . str_replace('"', '""', $forename) . '",' . '"' . str_replace('"', '""', $surname) . '",' . '"' . str_replace('"', '""', $name) . '",' . '"' . str_replace('"', '""', $send_id) . '",' . '"' . str_replace('"', '""', $unsub) . '",' . '"' . str_replace('"', '""', $hash) . '",' . '"' . str_replace('"', '""', $salt) . '",' . '"' . str_replace('"', '""', $_lang) . '",' . '"' . str_replace('"', '""', strval($confirm_code)) . '",' . '"' . str_replace('"', '""', date('Y-m-d h:i:s', $join_time)) . '"' . chr(10);
} else {
$tpl = do_template('NEWSLETTER_SUBSCRIBER', array('EMAIL' => $email, 'FORENAME' => $forename, 'SURNAME' => $surname, 'NAME' => $name, 'NEWSLETTER_SEND_ID' => $send_id, 'NEWSLETTER_HASH' => $hash));
$out .= $tpl->evaluate();
}
}
$start2 += $max;
} while ($csv == 1 && array_key_exists(0, $rows));
if (count($rows) == 0 && $start2 == 0) {
if ($csv == 1) {
echo '"(' . do_lang('NONE') . ')"' . chr(10);
} else {
}
}
$text = do_lang_tempcode('NEWSLETTER_PEOPLE_ON_LEVEL', is_numeric($level) && intval($level) > 0 ? make_string_tempcode(escape_html(do_lang('NEWSLETTER_' . strval($level)))) : do_lang_tempcode('NA_EM'));
if ($csv == 1) {
} else {
require_code('templates_results_browser');
$results_browser = results_browser(do_lang_tempcode('VIEW_NEWSLETTER_SUBSCRIBERS'), NULL, $start, 'start_' . (is_null($level) ? '' : strval($level)), $max, 'max_' . (is_null($level) ? '' : strval($level)), $max_rows, NULL, 'subscribers', true);
$outs[] = array('RESULTS_BROWSER' => $results_browser, 'SUB' => $out, 'TEXT' => $text);
}
}
if ($csv == 1) {
$GLOBALS['SCREEN_TEMPLATE_CALLED'] = '';
exit;
}
// Work out stats of what domains are used
$domains = array();
$start = 0;
do {
if (strpos(get_db_type(), 'mysql') !== false) {
$rows = $GLOBALS['SITE_DB']->query_select('newsletter', array('email', 'COUNT(*) as cnt'), NULL, 'GROUP BY SUBSTRING_INDEX(email,\'@\',-1)');
// Far less PHP processing
} else {
$rows = $GLOBALS['SITE_DB']->query_select('newsletter', array('email'), NULL, 500, $start);
}
foreach ($rows as $row) {
$email = $row['email'];
if (strpos($email, '@') === false) {
continue;
}
$domain = substr($email, strpos($email, '@') + 1);
if (!is_string($domain)) {
continue;
}
$cnt = array_key_exists('cnt', $row) ? $row['cnt'] : 1;
if (!array_key_exists($domain, $domains)) {
$domains[$domain] = 0;
}
$domains[$domain] += $cnt;
}
$start += 500;
} while (array_key_exists(0, $rows) && strpos(get_db_type(), 'mysql') === false);
arsort($domains);
foreach ($domains as $key => $val) {
$domains[$key] = strval($val);
if (count($domains) > 100) {
if ($val == 1) {
unset($domains[$key]);
}
}
}
return do_template('NEWSLETTER_SUBSCRIBERS_SCREEN', array('_GUID' => '52e5d97d451b622d59f87f021a5b8f01', 'DOMAINS' => $domains, 'SUBSCRIBERS' => $outs, 'TITLE' => $title));
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:101,代码来源:admin_newsletter.php
示例13: get_db_modify_hash
function get_db_modify_hash($db_ids)
{
$parameters = array();
foreach ($db_ids as $db_id) {
$parameters["@@" . "DB_" . strtoupper($db_id) . "_TYPE" . "@@"] = get_db_type($db_id);
$parameters["@@" . "DB_" . strtoupper($db_id) . "_NAME" . "@@"] = get_db_name($db_id);
$parameters["@@" . "DB_" . strtoupper($db_id) . "_LOGIN" . "@@"] = get_db_login($db_id);
$parameters["@@" . "DB_" . strtoupper($db_id) . "_PASSWORD" . "@@"] = get_db_password($db_id);
$parameters["@@" . "DB_" . strtoupper($db_id) . "_HOST" . "@@"] = fetch_env_var("DB_{$db_id}_HOST");
$parameters["@@" . "DB_" . strtoupper($db_id) . "_VERSION" . "@@"] = fetch_env_var("DB_{$db_id}_VERSION");
$parameters["@@" . "DB_" . strtoupper($db_id) . "_PORT" . "@@"] = fetch_env_var("DB_{$db_id}_PORT");
$parameters["@@" . "DB_" . strtoupper($db_id) . "_PREFIX" . "@@"] = get_db_prefix($db_id);
$parameters["@@" . "DB_" . strtoupper($db_id) . "_ADDRESS" . "@@"] = get_db_address($db_id);
}
return $parameters;
}
开发者ID:Staalkoper,项目名称:microweber-hosting-scripts,代码行数:16,代码来源:env-parser.php
示例14: view
/**
* The UI to view an IOTD.
*
* @return tempcode The UI
*/
function view()
{
$title = get_page_title('IOTD');
breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('IOTD_ARCHIVE'))));
$id = get_param_integer('id');
$rows = $GLOBALS['SITE_DB']->query_select('iotd', array('*'), array('id' => $id), '', 1);
if (!array_key_exists(0, $rows)) {
return warn_screen($title, do_lang_tempcode('MISSING_RESOURCE'));
}
$myrow = $rows[0];
list($rating_details, $comment_details, $trackback_details) = embed_feedback_systems(get_page_name(), strval($id), $myrow['allow_rating'], $myrow['allow_comments'], $myrow['allow_trackbacks'], is_null($myrow['date_and_time']) && $myrow['used'] == 0 ? 0 : 1, $myrow['submitter'], build_url(array('page' => '_SELF', 'type' => 'view', 'id' => $id), '_SELF', NULL, false, false, true), get_translated_text($myrow['i_title']), get_value('comment_forum__iotds'));
$date_raw = strval($myrow['date_and_time']);
$add_date_raw = strval($myrow['add_date']);
$edit_date_raw = is_null($myrow['edit_date']) ? '' : strval($myrow['edit_date']);
$date = get_timezoned_date($myrow['date_and_time']);
$add_date = get_timezoned_date($myrow['add_date']);
$edit_date = get_timezoned_date($myrow['edit_date']);
// Views
if (get_db_type() != 'xml') {
$myrow['iotd_views']++;
$GLOBALS['SITE_DB']->query_update('iotd', array('iotd_views' => $myrow['iotd_views']), array('id' => $id), '', 1, NULL, false, true);
}
if (has_actual_page_access(NULL, 'cms_iotds', NULL, NULL) && has_edit_permission('high', get_member(), $myrow['submitter'], 'cms_iotds')) {
$edit_url = build_url(array('page' => 'cms_iotds', 'type' => '_ed', 'id' => $id), get_module_zone('cms_iotds'));
} else {
$edit_url = new ocp_tempcode();
}
$url = $myrow['url'];
if (url_is_local($url)) {
$url = get_custom_base_url() . '/' . $url;
}
$GLOBALS['META_DATA'] += array('created' => date('Y-m-d', $myrow['add_date']), 'creator' => $GLOBALS['FORUM_DRIVER']->get_username($myrow['submitter']), 'publisher' => '', 'modified' => is_null($myrow['edit_date']) ? '' : date('Y-m-d', $myrow['edit_date']), 'type' => 'Poll', 'title' => get_translated_text($myrow['i_title']), 'identifier' => '_SEARCH:iotds:view:' . strval($id), 'description' => '', 'image' => $url);
return do_template('IOTD_VIEW_SCREEN', array('_GUID' => 'f508d483459b88fab44cd8b9f4db780b', 'TITLE' => $title, 'SUBMITTER' => strval($myrow['submitter']), 'I_TITLE' => get_translated_tempcode($myrow['i_title']), 'CAPTION' => get_translated_tempcode($myrow['caption']), 'DATE_RAW' => $date_raw, 'ADD_DATE_RAW' => $add_date_raw, 'EDIT_DATE_RAW' => $edit_date_raw, 'DATE' => $date, 'ADD_DATE' => $add_date, 'EDIT_DATE' => $edit_date, 'VIEWS' => integer_format($myrow['iotd_views']), 'TRACKBACK_DETAILS' => $trackback_details, 'RATING_DETAILS' => $rating_details, 'COMMENT_DETAILS' => $comment_details, 'EDIT_URL' => $edit_url, 'URL' => $url));
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:39,代码来源:iotds.php
示例15: _helper_get_forum_topic_posts
-
说到十大利润最高的东西,很多是我们生活中比较常见的,但也有一些是出人意料之外的暴
阅读:303|2022-11-06
-
krishnaik06/Machine-Learning-in-90-days
阅读:1119|2022-08-18
-
Inappropriate implementation in PDF in Google Chrome prior to 102.0.5005.61 allo
阅读:1165|2022-07-29
-
armancodv/building-energy-model-matlab: It is a small software which is develope
阅读:1167|2022-08-17
-
在美元的英文“dollar”里面明明没有字母“s”,为什么美元的符号($)是一条竖线穿过字
阅读:1120|2022-11-06
-
快的笔顺是什么?快的笔顺笔画顺序怎么写?还有快的拼音及意思是什么,好多初学练字者
阅读:816|2022-07-30
-
FGRibreau/import-tweets-to-mastodon: How to import tweets to mastodon (e.g. http
阅读:973|2022-08-17
-
证件照的用途不用细说,很多人都有,但拍好看的人却不多。如何拍好看真得好好学一学,
阅读:508|2022-07-30
-
tboronczyk/localization-middleware: PSR-15 middleware to assist primarily with l
阅读:519|2022-08-16
-
长沙城南,有一所以“环保”为名的学校,从1979年创立以来,四易归属、五更其名。 这
阅读:818|2022-11-06
|
请发表评论