[Customisation Database Commits] r610 - in /trunk/titania: contributions/ includes/ includes/core/ includes/objects/ includes/overlords/ language/en/ styles/default/template/common/ styles/default/template/contributions/
Nathan Guse
exreaction at phpbb.com
Tue Feb 16 00:39:35 GMT 2010
Author: exreaction
Date: Tue Feb 16 00:39:34 2010
New Revision: 610
Log:
Bugs
Backtrace config option for most errors to help with debugging (tons easier to find which place says that something doesn't exist and other things)
Modified:
trunk/titania/contributions/revision.php
trunk/titania/includes/core/config.php
trunk/titania/includes/functions.php
trunk/titania/includes/objects/queue.php
trunk/titania/includes/objects/revision.php
trunk/titania/includes/objects/topic.php
trunk/titania/includes/overlords/queue.php
trunk/titania/language/en/manage.php
trunk/titania/styles/default/template/common/contribution_details.html
trunk/titania/styles/default/template/contributions/contribution_revision.html
Modified: trunk/titania/contributions/revision.php
==============================================================================
*** trunk/titania/contributions/revision.php (original)
--- trunk/titania/contributions/revision.php Tue Feb 16 00:39:34 2010
***************
*** 209,215 ****
$revision->revision_submitted = true;
$revision->submit();
! return;
break;
}
} while($try_again);
--- 209,215 ----
$revision->revision_submitted = true;
$revision->submit();
! redirect(titania::$contrib->get_url());
break;
}
} while($try_again);
Modified: trunk/titania/includes/core/config.php
==============================================================================
*** trunk/titania/includes/core/config.php (original)
--- trunk/titania/includes/core/config.php Tue Feb 16 00:39:34 2010
***************
*** 52,57 ****
--- 52,59 ----
'max_rating' => array('default' => 5),
+ 'display_backtrace' => array('default' => 0), // Display backtrace? 0 = never, 1 = for administrators, 2 = for all
+
// Search backend (zend or solr (if solr, set the correct ip/port))
'search_backend' => array('default' => 'zend'),
'search_backend_ip' => array('default' => 'localhost'),
Modified: trunk/titania/includes/functions.php
==============================================================================
*** trunk/titania/includes/functions.php (original)
--- trunk/titania/includes/functions.php Tue Feb 16 00:39:34 2010
***************
*** 25,35 ****
{
$message = $exception->getMessage();
! // display the trace for administrators
! if (phpbb::$auth->acl_get('a_'))
! {
! $message .= '<br /><br /><pre>' . var_export($exception->getTrace(), true) . '</pre>';
! }
trigger_error($message);
}
--- 25,31 ----
{
$message = $exception->getMessage();
! $message .= titania_backtrace($exception);
trigger_error($message);
}
***************
*** 210,216 ****
phpbb::$template->assign_vars(array(
'MESSAGE_TITLE' => $msg_title,
! 'MESSAGE_TEXT' => $msg_text,
'S_USER_WARNING' => ($errno == E_USER_WARNING) ? true : false,
'S_USER_NOTICE' => ($errno == E_USER_NOTICE) ? true : false)
);
--- 206,212 ----
phpbb::$template->assign_vars(array(
'MESSAGE_TITLE' => $msg_title,
! 'MESSAGE_TEXT' => $msg_text . titania_backtrace(),
'S_USER_WARNING' => ($errno == E_USER_WARNING) ? true : false,
'S_USER_NOTICE' => ($errno == E_USER_NOTICE) ? true : false)
);
***************
*** 234,237 ****
--- 230,246 ----
// If we notice an error not handled here we pass this back to PHP by returning false
// This may not work for all php versions
return false;
+ }
+
+ function titania_backtrace($exception = false)
+ {
+ if (titania::$config->display_backtrace == 2 || (titania::$config->display_backtrace == 1 && phpbb::$auth->acl_get('a_')))
+ {
+ if ($exception !== false)
+ {
+ return '<br /><br /><pre>' . var_export($exception->getTrace(), true) . '</pre>';
+ }
+
+ return '<br /><br /><pre>' . get_backtrace() . '</pre>';
+ }
}
\ No newline at end of file
Modified: trunk/titania/includes/objects/queue.php
==============================================================================
*** trunk/titania/includes/objects/queue.php (original)
--- trunk/titania/includes/objects/queue.php Tue Feb 16 00:39:34 2010
***************
*** 80,86 ****
{
if (!$this->queue_id)
{
! $sql = 'SELECT c.contrib_name, c.contrib_name_clean, c.contrib_type, r.revision_version
FROM ' . TITANIA_CONTRIBS_TABLE . ' c, ' . TITANIA_REVISIONS_TABLE . ' r
WHERE r.revision_id = ' . (int) $this->revision_id . '
AND c.contrib_id = r.contrib_id';
--- 80,86 ----
{
if (!$this->queue_id)
{
! $sql = 'SELECT c.*, r.revision_version
FROM ' . TITANIA_CONTRIBS_TABLE . ' c, ' . TITANIA_REVISIONS_TABLE . ' r
WHERE r.revision_id = ' . (int) $this->revision_id . '
AND c.contrib_id = r.contrib_id';
***************
*** 88,98 ****
$row = phpbb::$db->sql_fetchrow($result);
phpbb::$db->sql_freeresult($result);
$this->contrib_name_clean = $row['contrib_name_clean'];
$this->queue_type = $row['contrib_type'];
titania::add_lang('manage');
! $this->update_first_queue_post(phpbb::$user->lang['VALIDATION'] . ' - ' . $row['contrib_name'] . ' - ' . $row['revision_version']);
}
parent::submit();
--- 88,106 ----
$row = phpbb::$db->sql_fetchrow($result);
phpbb::$db->sql_freeresult($result);
+ if (!$row)
+ {
+ trigger_error('NO_CONTRIB');
+ }
+
+ $contrib = new titania_contribution;
+ $contrib->__set_array($row);
+
$this->contrib_name_clean = $row['contrib_name_clean'];
$this->queue_type = $row['contrib_type'];
titania::add_lang('manage');
! $this->update_first_queue_post(phpbb::$user->lang['VALIDATION'] . ' - ' . $row['contrib_name'] . ' - ' . $row['revision_version'], $contrib);
}
parent::submit();
***************
*** 101,117 ****
/**
* Rebuild (or create) the first post in the queue topic
*/
! public function update_first_queue_post($post_subject)
{
if (!$this->queue_topic_id)
{
// Create the topic
$post = new titania_post(TITANIA_QUEUE);
}
else
{
$topic = new titania_topic;
$topic->topic_id = $this->queue_topic_id;
$topic->load;
$post = new titania_post($topic->topic_type, $topic, $topic->topic_first_post_id);
--- 109,129 ----
/**
* Rebuild (or create) the first post in the queue topic
*/
! public function update_first_queue_post($post_subject, $contrib)
{
if (!$this->queue_topic_id)
{
// Create the topic
$post = new titania_post(TITANIA_QUEUE);
+ $post->topic->contrib = $contrib;
+ $post->topic->contrib_id = $contrib->contrib_id;
}
else
{
$topic = new titania_topic;
$topic->topic_id = $this->queue_topic_id;
+ $topic->contrib = $contrib;
+ $topic->contrib_id = $contrib->contrib_id;
$topic->load;
$post = new titania_post($topic->topic_type, $topic, $topic->topic_first_post_id);
Modified: trunk/titania/includes/objects/revision.php
==============================================================================
*** trunk/titania/includes/objects/revision.php (original)
--- trunk/titania/includes/objects/revision.php Tue Feb 16 00:39:34 2010
***************
*** 126,131 ****
--- 126,141 ----
'queue_status' => ($this->revision_submitted) ? TITANIA_QUEUE_NEW : TITANIA_QUEUE_HIDE,
));
$queue->submit();
+
+ if ($this->revision_submitted)
+ {
+ // Delete any old revisions that were in the queue and marked as New
+ $sql = 'DELETE FROM ' . TITANIA_QUEUE_TABLE . '
+ WHERE contrib_id = ' . (int) $this->contrib_id . '
+ AND revision_id <> ' . $this->revision_id . '
+ AND queue_status = ' . TITANIA_QUEUE_NEW;
+ phpbb::$db->sql_query($sql);
+ }
}
}
Modified: trunk/titania/includes/objects/topic.php
==============================================================================
*** trunk/titania/includes/objects/topic.php (original)
--- trunk/titania/includes/objects/topic.php Tue Feb 16 00:39:34 2010
***************
*** 140,145 ****
--- 140,154 ----
{
$this->topic_subject_clean = titania_url::url_slug($this->topic_subject);
+ if (!$this->contrib_id && $this->contrib !== false)
+ {
+ $this->contrib_id = $this->contrib->contrib_id;
+ }
+ else if (!$this->contrib_id && $this->contrib === false)
+ {
+ throw new exception('Need a contrib_id to submit a topic');
+ }
+
return parent::submit();
}
Modified: trunk/titania/includes/overlords/queue.php
==============================================================================
*** trunk/titania/includes/overlords/queue.php (original)
--- trunk/titania/includes/overlords/queue.php Tue Feb 16 00:39:34 2010
***************
*** 27,33 ****
public static $queue = array();
public static $sort_by = array(
! 't' => array('POST_TIME', 'q.queue_submit_time', true),
);
/**
--- 27,33 ----
public static $queue = array();
public static $sort_by = array(
! 't' => array('SUBMIT_TIME', 'q.queue_submit_time', true),
);
/**
***************
*** 88,94 ****
// Setup the sort tool
$sort = new titania_sort();
$sort->set_sort_keys(self::$sort_by);
! $sort->default_dir = phpbb::$user->data['user_topic_sortby_dir'];
}
if ($pagination === false)
--- 88,94 ----
// Setup the sort tool
$sort = new titania_sort();
$sort->set_sort_keys(self::$sort_by);
! $sort->default_dir = 'a';
}
if ($pagination === false)
***************
*** 143,148 ****
--- 143,150 ----
}
$queue_ids[] = $row['queue_id'];
+ $user_ids[] = $row['topic_first_post_user_id'];
+ $user_ids[] = $row['topic_last_post_user_id'];
$user_ids[] = $row['submitter_user_id'];
self::$queue[$row['queue_id']] = $row;
***************
*** 210,216 ****
phpbb::$template->assign_vars(array(
'S_DISPLAY_CONTRIBUTION' => true,
! 'U_POST_REPLY' => titania_url::append_url($topic->get_url(false), array('action' => 'reply')),
));
}
--- 212,218 ----
phpbb::$template->assign_vars(array(
'S_DISPLAY_CONTRIBUTION' => true,
! 'U_POST_REPLY' => titania_url::append_url(titania_url::$current_page_url, array('action' => 'reply', 't' => $topic->topic_id)),
));
}
Modified: trunk/titania/language/en/manage.php
==============================================================================
*** trunk/titania/language/en/manage.php (original)
--- trunk/titania/language/en/manage.php Tue Feb 16 00:39:34 2010
***************
*** 36,41 ****
--- 36,42 ----
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
$lang = array_merge($lang, array(
+ 'SUBMIT_TIME' => 'Submission Time',
'VALIDATION_QUEUE' => 'Validation Queue',
'VALIDATION' => 'Validation',
));
Modified: trunk/titania/styles/default/template/common/contribution_details.html
==============================================================================
*** trunk/titania/styles/default/template/common/contribution_details.html (original)
--- trunk/titania/styles/default/template/common/contribution_details.html Tue Feb 16 00:39:34 2010
***************
*** 66,76 ****
</li>
</ul>
! <!-- IF .revisions -->
! <br />
! <br />
! <hr />
<!-- IF U_NEW_REVISION --><a href="{U_NEW_REVISION}" class="new-revision">{L_NEW_REVISION}</a><!-- ENDIF -->
<div class="clear"></div>
<ul class="topiclist">
--- 66,74 ----
</li>
</ul>
!
<!-- IF U_NEW_REVISION --><a href="{U_NEW_REVISION}" class="new-revision">{L_NEW_REVISION}</a><!-- ENDIF -->
+ <!-- IF .revisions -->
<div class="clear"></div>
<ul class="topiclist">
Modified: trunk/titania/styles/default/template/contributions/contribution_revision.html
==============================================================================
*** trunk/titania/styles/default/template/contributions/contribution_revision.html (original)
--- trunk/titania/styles/default/template/contributions/contribution_revision.html Tue Feb 16 00:39:34 2010
***************
*** 15,24 ****
<!-- IF MPV_RESULTS -->
<p class="error">{L_MPV_RESULTS}</p>
<hr class="dashed" />
! {MPV_RESULTS}<br />
<br />
<hr class="dashed" />
! <strong>{L_AUTOMOD_TEST}</strong>
<!-- ENDIF -->
<fieldset class="submit-buttons">
--- 15,24 ----
<!-- IF MPV_RESULTS -->
<p class="error">{L_MPV_RESULTS}</p>
<hr class="dashed" />
! {MPV_RESULTS}<!--<br />
<br />
<hr class="dashed" />
! <strong>{L_AUTOMOD_TEST}</strong>-->
<!-- ENDIF -->
<fieldset class="submit-buttons">
More information about the customisationdb-commits
mailing list