本文整理汇总了PHP中titania::add_lang方法的典型用法代码示例。如果您正苦于以下问题:PHP titania::add_lang方法的具体用法?PHP titania::add_lang怎么用?PHP titania::add_lang使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类titania
的用法示例。
在下文中一共展示了titania::add_lang方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($post_object)
{
titania::add_lang('posting');
phpbb::$user->add_lang('posting');
if (!function_exists('titania_access_select')) {
include TITANIA_ROOT . 'includes/functions_posting.' . PHP_EXT;
}
$this->post_object = $post_object;
}
示例2: load_types
/**
* Load the types into the $types array
*/
public static function load_types()
{
$dh = @opendir(TITANIA_ROOT . 'includes/types/');
if (!$dh) {
trigger_error('Could not open the types directory');
}
while (($fname = readdir($dh)) !== false) {
if (strpos($fname, '.' . PHP_EXT) && substr($fname, 0, 1) != '_' && $fname != 'base.' . PHP_EXT) {
include TITANIA_ROOT . 'includes/types/' . $fname;
$class_name = 'titania_type_' . substr($fname, 0, strpos($fname, '.' . PHP_EXT));
titania::add_lang('types/' . substr($fname, 0, strpos($fname, '.' . PHP_EXT)));
$class = new $class_name();
$class->auto_install();
self::$types[$class->id] = $class;
}
}
closedir($dh);
ksort(self::$types);
}
示例3: main
function main($id, $mode)
{
global $phpbb_root_path;
define('PHPBB_INCLUDED', true);
define('USE_PHPBB_TEMPLATE', true);
define('IN_TITANIA', true);
if (!defined('PHP_EXT')) {
define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
}
require TITANIA_ROOT . 'common.' . PHP_EXT;
// Need a few hacks to be used from within phpBB
titania_url::decode_url(titania::$config->phpbb_script_path);
titania::$hook->register(array('titania_url', 'build_url'), 'titania_outside_build_url', 'standalone');
titania::$hook->register(array('titania_url', 'append_url'), 'titania_outside_build_url', 'standalone');
titania::$hook->register(array('titania', 'page_header'), 'titania_outside_page_header', 'standalone');
titania::$hook->register(array('titania', 'page_footer'), 'titania_outside_page_footer', 'standalone');
titania::$hook->register('titania_generate_text_for_display', 'titania_outside_generate_text_for_display', 'standalone');
titania::add_lang('manage');
$this->p_master->assign_tpl_vars(phpbb::append_sid('mcp'));
phpbb::$template->assign_vars(array('L_TITLE' => phpbb::$user->lang['ATTENTION'], 'L_EXPLAIN' => ''));
include TITANIA_ROOT . 'manage/attention.' . PHP_EXT;
}
示例4: phpbb_com_titania_queue_update_first_queue_post
/**
* Copy new posts for queue discussion, queue to the forum
*/
function phpbb_com_titania_queue_update_first_queue_post($hook, &$post_object, $queue_object)
{
if ($queue_object->queue_status == TITANIA_QUEUE_HIDE || !$queue_object->queue_topic_id) {
return;
}
// First we copy over the queue discussion topic if required
$sql = 'SELECT topic_id, phpbb_topic_id, topic_category FROM ' . TITANIA_TOPICS_TABLE . '
WHERE parent_id = ' . $queue_object->contrib_id . '
AND topic_type = ' . TITANIA_QUEUE_DISCUSSION;
$result = phpbb::$db->sql_query($sql);
$topic_row = phpbb::$db->sql_fetchrow($result);
phpbb::$db->sql_freeresult($result);
// Do we need to create the queue discussion topic or not?
if ($topic_row['topic_id'] && !$topic_row['phpbb_topic_id']) {
$forum_id = phpbb_com_forum_id($post_object->topic->topic_category, TITANIA_QUEUE_DISCUSSION);
$temp_post = new titania_post();
// Go through any posts in the queue discussion topic and copy them
$topic_id = false;
$sql = 'SELECT * FROM ' . TITANIA_POSTS_TABLE . ' WHERE topic_id = ' . $topic_row['topic_id'];
$result = phpbb::$db->sql_query($sql);
while ($row = phpbb::$db->sql_fetchrow($result)) {
$temp_post->__set_array($row);
$post_text = $row['post_text'];
titania_decode_message($post_text, $row['post_text_uid']);
$post_text .= "\n\n" . titania_url::remove_sid($temp_post->get_url());
$options = array('poster_id' => $row['post_user_id'], 'forum_id' => $forum_id, 'topic_title' => $row['post_subject'], 'post_text' => $post_text);
titania::_include('functions_posting', 'phpbb_posting');
if ($topic_id) {
$options = array_merge($options, array('topic_id' => $topic_id));
phpbb_posting('reply', $options);
} else {
switch ($topic_row['topic_category']) {
case TITANIA_TYPE_MOD:
$options['poster_id'] = titania::$config->forum_mod_robot;
break;
case TITANIA_TYPE_STYLE:
$options['poster_id'] = titania::$config->forum_style_robot;
break;
}
$topic_id = phpbb_posting('post', $options);
}
}
phpbb::$db->sql_freeresult($result);
if ($topic_id) {
$sql = 'UPDATE ' . TITANIA_TOPICS_TABLE . '
SET phpbb_topic_id = ' . $topic_id . '
WHERE topic_id = ' . $topic_row['topic_id'];
phpbb::$db->sql_query($sql);
}
unset($temp_post);
}
// Does a queue topic already exist? If so, don't repost.
$sql = 'SELECT phpbb_topic_id FROM ' . TITANIA_TOPICS_TABLE . '
WHERE topic_id = ' . $queue_object->queue_topic_id;
phpbb::$db->sql_query($sql);
$phpbb_topic_id = phpbb::$db->sql_fetchfield('phpbb_topic_id');
phpbb::$db->sql_freeresult();
if ($phpbb_topic_id) {
return;
}
$forum_id = phpbb_com_forum_id($post_object->topic->topic_category, $post_object->topic->topic_type);
if (!$forum_id) {
return;
}
$post_object->submit();
titania::_include('functions_posting', 'phpbb_posting');
// Need some stuff
titania::add_lang('contributions');
$contrib = new titania_contribution();
$contrib->load((int) $queue_object->contrib_id);
$revision = $queue_object->get_revision();
$contrib->get_download($revision->revision_id);
switch ($post_object->topic->topic_category) {
case TITANIA_TYPE_MOD:
$post_object->topic->topic_first_post_user_id = titania::$config->forum_mod_robot;
$lang_var = 'MOD_QUEUE_TOPIC';
break;
case TITANIA_TYPE_STYLE:
$post_object->topic->topic_first_post_user_id = titania::$config->forum_style_robot;
$lang_var = 'STYLE_QUEUE_TOPIC';
break;
default:
return;
break;
}
$description = $contrib->contrib_desc;
titania_decode_message($description, $contrib->contrib_desc_uid);
$post_text = sprintf(phpbb::$user->lang[$lang_var], $contrib->contrib_name, $contrib->author->get_url(), users_overlord::get_user($contrib->author->user_id, '_username'), $description, $revision->revision_version, titania_url::build_url('download', array('id' => $revision->attachment_id)), $contrib->download['real_filename'], $contrib->download['filesize']);
$post_text .= "\n\n" . $post_object->post_text;
titania_decode_message($post_text, $post_object->post_text_uid);
$post_text .= "\n\n" . titania_url::remove_sid($post_object->get_url());
$options = array('poster_id' => $post_object->topic->topic_first_post_user_id, 'forum_id' => $forum_id, 'topic_title' => $post_object->topic->topic_subject, 'post_text' => $post_text);
$topic_id = phpbb_posting('post', $options);
$post_object->topic->phpbb_topic_id = $topic_id;
$sql = 'UPDATE ' . TITANIA_TOPICS_TABLE . '
SET phpbb_topic_id = ' . (int) $topic_id . '
WHERE topic_id = ' . $post_object->topic->topic_id;
//.........这里部分代码省略.........
示例5: repack
/**
* Repack a revision
*
* @param titania_revision $old_revision titania_revision object
*/
public function repack($old_revision)
{
if (!$this->revision_id) {
throw new exception('Submit the revision before repacking');
}
titania::add_lang('manage');
// Get the old and new queue objects
$old_queue = $old_revision->get_queue();
$queue = $this->get_queue();
if ($old_queue === false) {
throw new exception('Old queue missing. Revision ID: ' . $old_revision->revision_id);
}
// Reply to the queue topic to say that it's been repacked and have the old mpv/automod results listed in it as well
$repack_message = phpbb::$user->lang['REVISION_REPACKED'] . "\n\n";
// Add the MPV results
if ($old_queue->mpv_results) {
$mpv_results = $old_queue->mpv_results;
titania_decode_message($mpv_results, $old_queue->mpv_results_uid);
$repack_message .= '[quote="' . phpbb::$user->lang['OLD_VALIDATION_MPV'] . '"]' . $mpv_results . "[/quote]\n";
}
// Add the Automod results
if ($old_queue->automod_results) {
$repack_message .= '[quote="' . phpbb::$user->lang['OLD_VALIDATION_AUTOMOD'] . '"]' . $old_queue->automod_results . "[/quote]\n";
}
// Reply
$old_queue->topic_reply($repack_message);
// Update the old queue with the new results
$old_queue->revision_id = $queue->revision_id;
$old_queue->mpv_results = $queue->mpv_results;
$old_queue->mpv_results_bitfield = $queue->mpv_results_bitfield;
$old_queue->mpv_results_uid = $queue->mpv_results_uid;
$old_queue->automod_results = $queue->automod_results;
$old_queue->submit();
// Delete the new queue we made for this revision
$queue->delete();
// Unlink the old queue_id from the old revision and set it to repacked
$old_revision->change_status(TITANIA_REVISION_REPACKED);
$old_revision->revision_queue_id = 0;
$old_revision->submit();
// Update the queue_id for this revision to point to the old queue_id
$this->revision_queue_id = $old_queue->queue_id;
$this->submit();
// Move any translations
$sql = 'UPDATE ' . TITANIA_ATTACHMENTS_TABLE . '
SET object_id = ' . $this->revision_id . '
WHERE object_type = ' . TITANIA_TRANSLATION . '
AND object_id = ' . $old_revision->revision_id;
phpbb::$db->sql_query($sql);
// Hooks
titania::$hook->call_hook_ref(array(__CLASS__, __FUNCTION__), $this);
}
示例6: array_merge
$search_types = array_merge($search_types, array(TITANIA_SUPPORT => 'CONTRIB_SUPPORT'));
}
$mode = request_var('mode', '');
$keywords = utf8_normalize_nfc(request_var('keywords', '', true));
$user_id = request_var('u', 0);
$contrib_id = request_var('contrib', 0);
$search_fields = request_var('sf', '');
$search_type = request_var('type', 0);
$categories = request_var('c', array(0));
$search_subcategories = request_var('sc', 0);
$phpbb_versions = request_var('versions', array(''));
// Display the advanced search page
if (!$keywords && !$user_id && !$contrib_id && !isset($_POST['submit'])) {
if ($mode == 'find-contribution') {
titania::_include('functions_posting', 'generate_category_select');
titania::add_lang('contributions');
phpbb::$template->assign_vars(array('S_SEARCH_ACTION' => titania_url::build_url('find-contribution')));
// Display the list of phpBB versions available
foreach (titania::$cache->get_phpbb_versions() as $version => $name) {
$template->assign_block_vars('phpbb_versions', array('VERSION' => $name));
}
generate_category_select($categories, false, false);
titania::page_header('SEARCH');
titania::page_footer(true, 'find_contribution.html');
}
// Output search types
foreach ($search_types as $value => $name) {
phpbb::$template->assign_block_vars('types', array('NAME' => isset(phpbb::$user->lang[$name]) ? phpbb::$user->lang[$name] : $name, 'VALUE' => $value));
}
phpbb::$template->assign_vars(array('S_SEARCH_ACTION' => titania_url::build_url('search')));
titania::page_header('SEARCH');
示例7: define
* @copyright (c) 2008 phpBB Customisation Database Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
define('IN_TITANIA', true);
if (!defined('TITANIA_ROOT')) {
define('TITANIA_ROOT', './');
}
if (!defined('PHP_EXT')) {
define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
}
require TITANIA_ROOT . 'common.' . PHP_EXT;
titania::add_lang('faq', false, true);
/**
* From phpBB faq.php
*/
// Pull the array data from the lang pack
$switch_column = $found_switch = false;
$help_blocks = array();
foreach (phpbb::$user->help as $help_ary) {
if ($help_ary[0] == '--') {
if ($help_ary[1] == '--') {
$switch_column = true;
$found_switch = true;
continue;
}
phpbb::$template->assign_block_vars('faq_block', array('BLOCK_TITLE' => $help_ary[1], 'SWITCH_COLUMN' => $switch_column));
if ($switch_column) {
示例8: display_queue_item
/**
* Display a single queue item
*
* @param int $queue_id
* @return array('row' => (sql selection), 'contrib' => $contrib, 'topic' => $topic)
*/
public static function display_queue_item($queue_id)
{
titania::add_lang('contributions');
$sql_ary = array('SELECT' => '*', 'FROM' => array(TITANIA_QUEUE_TABLE => 'q', TITANIA_REVISIONS_TABLE => 'r', TITANIA_TOPICS_TABLE => 't'), 'WHERE' => 'q.queue_id = ' . (int) $queue_id . '
AND r.revision_id = q.revision_id
AND t.topic_id = q.queue_topic_id');
// Main SQL Query
$sql = phpbb::$db->sql_build_query('SELECT', $sql_ary);
$result = phpbb::$db->sql_query($sql);
$row = phpbb::$db->sql_fetchrow($result);
phpbb::$db->sql_freeresult($result);
if (!$row) {
trigger_error('NO_QUEUE_ITEM');
}
self::$queue[$queue_id] = $row;
// Load the contribution
$contrib = new titania_contribution();
$contrib->load((int) $row['contrib_id']);
$contrib->get_download($row['revision_id']);
$contrib->get_revisions();
$contrib->get_screenshots();
$contrib->assign_details();
// Load the topic (with the already selected data)
$topic = new titania_topic();
$topic->__set_array($row);
// Bit of a hack for the posting
$_REQUEST['t'] = $topic->topic_id;
// Some quick-actions
$quick_actions = array();
if ($row['queue_status'] > 0) {
if ($row['queue_progress'] == phpbb::$user->data['user_id']) {
$quick_actions['MARK_NO_PROGRESS'] = array('url' => titania_url::append_url(titania_url::$current_page_url, array('action' => 'no_progress')), 'class' => 'queue_progress');
} else {
if (!$row['queue_progress']) {
$quick_actions['MARK_IN_PROGRESS'] = array('url' => titania_url::append_url(titania_url::$current_page_url, array('action' => 'in_progress')), 'class' => 'queue_progress');
}
}
$tags = titania::$cache->get_tags(TITANIA_QUEUE);
unset($tags[$row['queue_status']]);
$quick_actions['CHANGE_STATUS'] = array('url' => titania_url::append_url(titania_url::$current_page_url, array('action' => 'move')), 'class' => 'change_status', 'tags' => $tags);
if (titania_types::$types[$contrib->contrib_type]->acl_get('moderate')) {
$quick_actions['REPACK'] = array('url' => titania_url::append_url($contrib->get_url('revision'), array('repack' => $row['revision_id'])), 'class' => 'repack');
}
// This allows you to alter the author submitted notes to the validation team, not really useful as the field's purpose was changed, so commenting out
/*$quick_actions['ALTER_NOTES'] = array(
'url' => titania_url::append_url(titania_url::$current_page_url, array('action' => 'notes')),
);*/
// Misc actions
$subactions = array();
if (titania_types::$types[$contrib->contrib_type]->mpv_test) {
$subactions['RETEST_MPV'] = array('url' => titania_url::build_url('', array('action' => 'mpv', 'revision' => $row['revision_id'])));
}
if (titania_types::$types[$contrib->contrib_type]->automod_test) {
$subactions['RETEST_AUTOMOD'] = array('url' => titania_url::build_url('', array('action' => 'automod', 'revision' => $row['revision_id'])));
}
$subactions['REBUILD_FIRST_POST'] = array('url' => titania_url::append_url(titania_url::$current_page_url, array('action' => 'rebuild')));
$quick_actions['CAT_MISC'] = array('subactions' => $subactions, 'class' => 'misc');
// Validation
if (titania_types::$types[$contrib->contrib_type]->acl_get('validate')) {
$quick_actions['APPROVE'] = array('url' => titania_url::append_url(titania_url::$current_page_url, array('action' => 'approve', 'start' => '*destroy*')), 'class' => 'approve');
$quick_actions['DENY'] = array('url' => titania_url::append_url(titania_url::$current_page_url, array('action' => 'deny', 'start' => '*destroy*')), 'class' => 'deny');
}
}
foreach ($quick_actions as $lang_key => $data) {
phpbb::$template->assign_block_vars('queue_actions', array('NAME' => isset(phpbb::$user->lang[$lang_key]) ? phpbb::$user->lang[$lang_key] : $lang_key, 'CLASS' => isset($data['class']) ? $data['class'] : '', 'U_VIEW' => isset($data['url']) ? $data['url'] : ''));
if (isset($data['tags'])) {
foreach ($data['tags'] as $tag_id => $tag_row) {
phpbb::$template->assign_block_vars('queue_actions.subactions', array('ID' => $tag_id, 'NAME' => isset(phpbb::$user->lang[$tag_row['tag_field_name']]) ? phpbb::$user->lang[$tag_row['tag_field_name']] : $tag_row['tag_field_name'], 'U_ACTION' => titania_url::append_url($data['url'], array('id' => $tag_id, 'hash' => generate_link_hash('quick_actions')))));
}
}
if (isset($data['subactions'])) {
foreach ($data['subactions'] as $sublang_key => $subdata) {
phpbb::$template->assign_block_vars('queue_actions.subactions', array('NAME' => isset(phpbb::$user->lang[$sublang_key]) ? phpbb::$user->lang[$sublang_key] : $sublang_key, 'U_ACTION' => $subdata['url']));
}
}
}
if ($row['queue_status'] == -2) {
$current_status = phpbb::$user->lang['REVISION_DENIED'];
} else {
if ($row['queue_status'] == -1) {
$current_status = phpbb::$user->lang['REVISION_APPROVED'];
} else {
$current_status = titania_tags::get_tag_name($row['queue_status']);
}
}
phpbb::$template->assign_vars(array('CURRENT_STATUS' => $current_status, 'S_DISPLAY_CONTRIBUTION' => true, 'S_IN_QUEUE' => true, 'U_POST_REPLY' => titania_url::append_url(titania_url::$current_page_url, array('action' => 'reply', 't' => $topic->topic_id)), 'U_NEW_REVISION' => false));
// Subscriptions
titania_subscriptions::handle_subscriptions(TITANIA_TOPIC, $topic->topic_id, titania_url::$current_page_url);
return compact('row', 'contrib', 'topic');
}
示例9: common_delete
private function common_delete($post_id, $undelete = false)
{
titania::add_lang('posting');
phpbb::$user->add_lang('posting');
// Load the stuff we need
$post_object = $this->load_post($post_id);
// Check permissions
if (!$undelete && !$post_object->acl_get('delete') || $undelete && !$post_object->acl_get('undelete')) {
titania::needs_auth();
}
if (titania::confirm_box(true)) {
if (!$undelete) {
$redirect_post_id = false;
// Delete the post
if (isset($_POST['hard_delete']) || $post_object->post_deleted) {
if (!phpbb::$auth->acl_get('u_titania_post_hard_delete')) {
titania::needs_auth();
}
$post_object->hard_delete();
// Try to redirect to the next or previous post
$redirect_post_id = posts_overlord::next_prev_post_id($post_object->topic_id, $post_object->post_id);
if ($redirect_post_id) {
redirect(titania_url::append_url($post_object->topic->get_url(), array('p' => $redirect_post_id, '#p' => $redirect_post_id)));
}
redirect(titania_url::build_url($post_object->topic->topic_url));
} else {
$post_object->soft_delete();
if (phpbb::$auth->acl_get('u_titania_mod_post_mod')) {
// They can see the post, redirect back to it
redirect($post_object->get_url());
} else {
// They cannot see the post, try to redirect to the next or previous post
$redirect_post_id = posts_overlord::next_prev_post_id($post_object->topic_id, $post_object->post_id);
if ($redirect_post_id) {
redirect(titania_url::append_url($post_object->topic->get_url(), array('p' => $redirect_post_id, '#p' => $redirect_post_id)));
}
}
}
redirect($post_object->topic->get_url());
} else {
$post_object->undelete();
redirect($post_object->get_url());
}
} else {
phpbb::$template->assign_var('S_HARD_DELETE', !$undelete && !$post_object->post_deleted && phpbb::$auth->acl_get('u_titania_post_hard_delete') ? true : false);
titania::confirm_box(false, !$undelete ? 'DELETE_POST' : 'UNDELETE_POST', '', array(), 'posting/delete_confirm.html');
}
redirect($post_object->get_url());
}
示例10: load_contrib
*/
/**
* @ignore
*/
if (!defined('IN_TITANIA')) {
exit;
}
titania::add_lang('authors');
// Load the Contrib item
load_contrib();
if ($page == 'report') {
// Check permissions
if (!phpbb::$user->data['is_registered']) {
titania::needs_auth();
}
titania::add_lang('posting');
phpbb::$user->add_lang('mcp');
if (titania::confirm_box(true)) {
$message = utf8_normalize_nfc(request_var('report_text', '', true));
titania::$contrib->report($message);
// Notifications
redirect(titania::$contrib->get_url());
} else {
//phpbb::$template->assign_var('S_CAN_NOTIFY', ((phpbb::$user->data['is_registered']) ? true : false));
titania::confirm_box(false, 'REPORT_CONTRIBUTION', '', array(), 'posting/report_body.html');
}
redirect(titania::$contrib->get_url());
}
titania::$contrib->get_download();
titania::$contrib->get_revisions();
titania::$contrib->get_screenshots();
示例11: define
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
define('IN_TITANIA', true);
if (!defined('TITANIA_ROOT')) {
define('TITANIA_ROOT', '../');
}
if (!defined('PHP_EXT')) {
define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
}
include TITANIA_ROOT . 'common.' . PHP_EXT;
// Add common lang
titania::add_lang('authors');
// Load the author
$author = utf8_normalize_nfc(request_var('u', '', true));
titania::$author = new titania_author();
if (!titania::$author->load($author)) {
trigger_error('AUTHOR_NOT_FOUND');
}
titania::$author->assign_details();
// Check to see if the currently accessing user is the author
if (titania::$access_level == TITANIA_ACCESS_PUBLIC && phpbb::$user->data['user_id'] == titania::$author->user_id) {
titania::$access_level = TITANIA_ACCESS_AUTHORS;
}
/**
* Menu Array
*
* 'filename' => array(
示例12: array
/**
*
* @package titania
* @version $Id$
* @copyright (c) 2008 Customisation Database Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
if (!defined('IN_TITANIA')) {
exit;
}
titania::add_lang('faq');
$faq_id = request_var('f', 0);
$action = request_var('action', '');
$error = array();
// Setup faq object
$faq = new titania_faq($faq_id);
if ($faq_id) {
if (!$faq->contrib_id) {
// Faq does not exist
trigger_error('FAQ_NOT_FOUND');
}
load_contrib($faq->contrib_id);
} else {
load_contrib();
}
// Output the simple info on the contrib
示例13: define
*
*/
/**
* @ignore
*/
define('IN_TITANIA', true);
define('IN_TITANIA_INSTALL', true);
define('UMIL_AUTO', true);
if (!defined('TITANIA_ROOT')) {
define('TITANIA_ROOT', './');
}
if (!defined('PHP_EXT')) {
define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
}
include TITANIA_ROOT . 'common.' . PHP_EXT;
titania::add_lang('install');
// Hopefully this helps
@set_time_limit(0);
include TITANIA_ROOT . 'includes/functions_install.' . PHP_EXT;
// Just to be on the safe side, add a php version check.
if (version_compare(PHP_VERSION, '5.2.0') < 0) {
die('You are running an unsupported PHP version. Please upgrade to PHP 5.2.0 or higher before trying to install Titania');
}
if (!file_exists(PHPBB_ROOT_PATH . 'umil/umil_auto.' . PHP_EXT)) {
trigger_error('Please download the latest UMIL (Unified MOD Install Library) from: <a href="http://www.phpbb.com/mods/umil/">phpBB.com/mods/umil</a>', E_USER_ERROR);
}
// Make sure we are not using the same table prefix as phpBB (will cause conflicts).
if (titania::$config->table_prefix == $GLOBALS['table_prefix']) {
trigger_error('You can not use the same table prefix for Titania as you are using for phpBB.');
}
// Include the versions/data file
示例14: run_tool
/**
* Run the tool
*/
function run_tool()
{
// Define some vars that we'll need
$start = request_var('start', 0);
$limit = 100;
// Create topic if it does not exist?
$create_topic = true;
titania::_include('functions_posting', 'phpbb_posting');
titania::add_lang('contributions');
$types = array();
foreach (titania_types::$types as $id => $class) {
if ($class->forum_robot && $class->forum_database) {
$types[] = $id;
}
}
if (!sizeof($types)) {
trigger_back('UPDATE_RELEASE_TOPICS_COMPLETE');
}
$sql = 'SELECT COUNT(contrib_id) AS cnt FROM ' . TITANIA_CONTRIBS_TABLE . '
WHERE ' . phpbb::$db->sql_in_set('contrib_status', array(TITANIA_CONTRIB_APPROVED, TITANIA_CONTRIB_DOWNLOAD_DISABLED)) . '
AND ' . phpbb::$db->sql_in_set('contrib_type', $types);
phpbb::$db->sql_query($sql);
$total = phpbb::$db->sql_fetchfield('cnt');
phpbb::$db->sql_freeresult();
// Grab our batch
$sql_ary = array('SELECT' => 'c.contrib_id, c.contrib_user_id, c.contrib_type, c.contrib_name, c.contrib_name_clean, c.contrib_desc, c.contrib_desc_uid, c.contrib_release_topic_id,
t.topic_first_post_id,
u.user_id, u.username, u.username_clean, u.user_colour', 'FROM' => array(TITANIA_CONTRIBS_TABLE => 'c', USERS_TABLE => 'u'), 'LEFT_JOIN' => array(array('FROM' => array(TOPICS_TABLE => 't'), 'ON' => 't.topic_id = c.contrib_release_topic_id')), 'GROUP_BY' => 'c.contrib_id', 'WHERE' => phpbb::$db->sql_in_set('c.contrib_status', array(TITANIA_CONTRIB_APPROVED, TITANIA_CONTRIB_DOWNLOAD_DISABLED)) . '
AND u.user_id = c.contrib_user_id
AND ' . phpbb::$db->sql_in_set('contrib_type', $types), 'ORDER_BY' => 'c.contrib_id DESC');
$sql = phpbb::$db->sql_build_query('SELECT', $sql_ary);
$result = phpbb::$db->sql_query_limit($sql, $limit, $start);
while ($row = phpbb::$db->sql_fetchrow($result)) {
// Grab the revisions
$revisions = array();
$sql = 'SELECT r.revision_id, r.attachment_id, r.revision_version, a.real_filename, a.filesize
FROM ' . TITANIA_REVISIONS_TABLE . ' r, ' . TITANIA_ATTACHMENTS_TABLE . ' a
WHERE r.contrib_id = ' . $row['contrib_id'] . '
AND r.revision_status = ' . TITANIA_REVISION_APPROVED . '
AND a.attachment_id = r.attachment_id';
$rev_result = phpbb::$db->sql_query($sql);
while ($rev_row = phpbb::$db->sql_fetchrow($rev_result)) {
$revisions[$rev_row['revision_version']] = $rev_row;
}
phpbb::$db->sql_freeresult($rev_result);
// Sort the revisions by their version, put the newest one in $revision
uksort($revisions, 'reverse_version_compare');
if (!sizeof($revisions)) {
continue;
}
$revision = array_shift($revisions);
users_overlord::$users[$row['user_id']] = $row;
$contrib = new titania_contribution();
$contrib->__set_array($row);
$contrib->download = $row;
// Update the release topic
$contrib->update_release_topic();
}
phpbb::$db->sql_freeresult($result);
if ($start + $limit >= $total) {
trigger_back('UPDATE_RELEASE_TOPICS_COMPLETE');
} else {
meta_refresh(0, titania_url::build_url('manage/administration', array('t' => 'update_release_topics', 'start' => $start + $limit, 'submit' => 1, 'hash' => generate_link_hash('manage'))));
trigger_error(phpbb::$user->lang('UPDATE_RELEASE_TOPICS_PROGRESS', $start + $limit, $total));
}
}
示例15: copy_modx_install
/**
* Copy the modx install file to the storage path (and edit it to use our xsl file)
*
* @param string $to Place to copy the modx file to
*/
public function copy_modx_install($to)
{
// Find the main modx file
$modx_root = $this->find_root();
echo $modx_root;
if ($modx_root === false) {
titania::add_lang('contributions');
$this->error[] = phpbb::$user->lang['COULD_NOT_FIND_ROOT'];
return false;
}
$modx_root = $this->unzip_dir . $modx_root;
$modx_file = false;
if (file_exists($modx_root . 'install.xml')) {
$modx_file = $modx_root . 'install.xml';
} else {
// Find the first item with install in the name
foreach (scandir($modx_root) as $item) {
if (strpos($item, 'install') !== false && strpos($item, '.xml')) {
$modx_file = $modx_root . $item;
break;
}
}
}
if (!$modx_file) {
titania::add_lang('contributions');
$this->error[] = phpbb::$user->lang['COULD_NOT_FIND_ROOT'];
return false;
}
// Open the file
if (!($file_contents = file_get_contents($modx_file))) {
titania::add_lang('contributions');
$this->error[] = phpbb::$user->lang['COULD_NOT_OPEN_MODX'];
return false;
}
// Find the ModX version
$version = array();
preg_match('#<mod (.*)xmlns="(.*)"(.*)>#', $file_contents, $version);
preg_match('#([0-9]\\.(.*))\\.xsd#', $version[2], $version);
$modx_version = preg_replace('#[^a-zA-Z0-9\\.]#', '', $version[1]);
// Replace the stylesheet path
$file_contents = preg_replace('#<\\?xml\\-stylesheet (.*)\\?>#', '<?xml-stylesheet type="text/xsl" href="./modx/' . $modx_version . '.xsl" ?>', $file_contents);
// Replace the link-group
$file_contents = preg_replace('#<link\\-group>(.*)</link\\-group>#', '', $file_contents);
// Output time
file_put_contents($to, $file_contents);
phpbb_chmod($to, CHMOD_READ | CHMOD_WRITE);
return true;
}