<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[GlotPress][818] trunk: Use route tmpl instead of gp_tmpl.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="https://glotpress.trac.wordpress.org/changeset/818">818</a></dd>
<dt>Author</dt> <dd>markoheijnen</dd>
<dt>Date</dt> <dd>2013-11-21 16:55:23 +0000 (Thu, 21 Nov 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>Use route tmpl instead of gp_tmpl. Props nbachiyski. See <a href="http://glotpress.trac.wordpress.org/ticket/272">#272</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkgpincludesroutephp">trunk/gp-includes/route.php</a></li>
<li><a href="#trunkgpincludesroutesloginphp">trunk/gp-includes/routes/login.php</a></li>
<li><a href="#trunkgpincludesroutesoriginalphp">trunk/gp-includes/routes/original.php</a></li>
<li><a href="#trunkgpincludesroutesprofilephp">trunk/gp-includes/routes/profile.php</a></li>
<li><a href="#trunkgpincludesroutesprojectphp">trunk/gp-includes/routes/project.php</a></li>
<li><a href="#trunkgpincludesroutestranslationsetphp">trunk/gp-includes/routes/translation-set.php</a></li>
<li><a href="#trunkgpincludesroutestranslationphp">trunk/gp-includes/routes/translation.php</a></li>
<li><a href="#trunkgpincludestemplatephp">trunk/gp-includes/template.php</a></li>
<li><a href="#trunkttests_routestest_route_translation_setphp">trunk/t/tests_routes/test_route_translation_set.php</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkgptemplates404apiphp">trunk/gp-templates/404.api.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkgpincludesroutephp"></a>
<div class="modfile"><h4>Modified: trunk/gp-includes/route.php (817 => 818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/gp-includes/route.php      2013-11-18 15:47:44 UTC (rev 817)
+++ trunk/gp-includes/route.php 2013-11-21 16:55:23 UTC (rev 818)
</span><span class="lines">@@ -187,14 +187,17 @@
</span><span class="cx">          return gp_tmpl_load( $template, $args, $this->template_path );
</span><span class="cx">  }
</span><span class="cx"> 
</span><del>-       function tmpl_404( $args ) {
-               $this->tmpl( '404', $args + array('title' => __('Not Found'), 'http_status' => 404 ) );
</del><ins>+        function die_with_404( $args = array() ) {
+               status_header( 404 );
+               $this->tmpl( '404', $args + array( 'title' => __('Not Found'), 'http_status' => 404 ) );
+               $this->exit_();
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">  function exit_( $message = 0 ) {
</span><span class="cx">          if ( $this->fake_request ) {
</span><span class="cx">                  $this->exited = true;
</span><span class="cx">                  $this->exit_message = $message;
</span><ins>+                       return;
</ins><span class="cx">           }
</span><span class="cx">          exit( $message );
</span><span class="cx">  }
</span></span></pre></div>
<a id="trunkgpincludesroutesloginphp"></a>
<div class="modfile"><h4>Modified: trunk/gp-includes/routes/login.php (817 => 818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/gp-includes/routes/login.php       2013-11-18 15:47:44 UTC (rev 817)
+++ trunk/gp-includes/routes/login.php  2013-11-21 16:55:23 UTC (rev 818)
</span><span class="lines">@@ -5,7 +5,7 @@
</span><span class="cx">                  $this->redirect( gp_url( '/' ) );
</span><span class="cx">                  return;
</span><span class="cx">          }
</span><del>-               gp_tmpl_load( 'login', array() );
</del><ins>+                $this->tmpl( 'login' );
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">  function login_post() {
</span></span></pre></div>
<a id="trunkgpincludesroutesoriginalphp"></a>
<div class="modfile"><h4>Modified: trunk/gp-includes/routes/original.php (817 => 818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/gp-includes/routes/original.php    2013-11-18 15:47:44 UTC (rev 817)
+++ trunk/gp-includes/routes/original.php       2013-11-21 16:55:23 UTC (rev 818)
</span><span class="lines">@@ -4,9 +4,9 @@
</span><span class="cx"> 
</span><span class="cx">     function set_priority( $original_id ) {
</span><span class="cx">         $original = GP::$original->get( $original_id );
</span><del>-        if ( !$original ) gp_tmpl_404();
</del><ins>+        if ( !$original ) $this->die_with_404();
</ins><span class="cx">         $project = GP::$project->get( $original->project_id );
</span><del>-        if ( !$project ) gp_tmpl_404();
</del><ins>+        if ( !$project ) $this->die_with_404();
</ins><span class="cx">         $this->can_or_forbidden( 'write', 'project', $project->id );
</span><span class="cx">         $original->priority = gp_post( 'priority' );
</span><span class="cx">         if ( !$original->validate() ) {
</span><span class="lines">@@ -16,4 +16,4 @@
</span><span class="cx">             $this->die_with_error( 'Error in saving original!' );
</span><span class="cx">         }
</span><span class="cx">     }
</span><del>-}
</del><span class="cx">\ No newline at end of file
</span><ins>+}
</ins></span></pre></div>
<a id="trunkgpincludesroutesprofilephp"></a>
<div class="modfile"><h4>Modified: trunk/gp-includes/routes/profile.php (817 => 818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/gp-includes/routes/profile.php     2013-11-18 15:47:44 UTC (rev 817)
+++ trunk/gp-includes/routes/profile.php        2013-11-21 16:55:23 UTC (rev 818)
</span><span class="lines">@@ -6,7 +6,7 @@
</span><span class="cx">                  return;
</span><span class="cx">          }
</span><span class="cx"> 
</span><del>-               gp_tmpl_load( 'profile', array() );
</del><ins>+                $this->tmpl( 'profile' );
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">  function profile_post() {
</span></span></pre></div>
<a id="trunkgpincludesroutesprojectphp"></a>
<div class="modfile"><h4>Modified: trunk/gp-includes/routes/project.php (817 => 818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/gp-includes/routes/project.php     2013-11-18 15:47:44 UTC (rev 817)
+++ trunk/gp-includes/routes/project.php        2013-11-21 16:55:23 UTC (rev 818)
</span><span class="lines">@@ -9,7 +9,7 @@
</span><span class="cx"> 
</span><span class="cx">  function single( $project_path ) {
</span><span class="cx">          $project = GP::$project->by_path( $project_path );
</span><del>-               if ( !$project ) gp_tmpl_404();
</del><ins>+                if ( !$project ) $this->die_with_404();
</ins><span class="cx">           $sub_projects = $project->sub_projects();
</span><span class="cx">          $translation_sets = GP::$translation_set->by_project_id( $project->id );
</span><span class="cx">          foreach( $translation_sets as $set ) {
</span><span class="lines">@@ -31,7 +31,7 @@
</span><span class="cx"> 
</span><span class="cx">  function personal_options_post( $project_path ) {
</span><span class="cx">          $project = GP::$project->by_path( $project_path );
</span><del>-               if ( !$project ) gp_tmpl_404();
</del><ins>+                if ( !$project ) $this->die_with_404();
</ins><span class="cx">           if ( $this->cannot_and_redirect( 'write', 'project', $project->id ) ) return;
</span><span class="cx">          $user = GP::$user->current();
</span><span class="cx">          $source_url_templates = $user->get_meta( 'source_url_templates' );
</span><span class="lines">@@ -46,15 +46,15 @@
</span><span class="cx"> 
</span><span class="cx">  function import_originals_get( $project_path ) {
</span><span class="cx">          $project = GP::$project->by_path( $project_path );
</span><del>-               if ( !$project ) gp_tmpl_404();
</del><ins>+                if ( !$project ) $this->die_with_404();
</ins><span class="cx">           if ( $this->cannot_and_redirect( 'write', 'project', $project->id ) ) return;
</span><span class="cx">          $kind = 'originals';
</span><del>-               gp_tmpl_load( 'project-import', get_defined_vars() );
</del><ins>+                $this->tmpl( 'project-import', get_defined_vars() );
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">  function import_originals_post( $project_path ) {
</span><span class="cx">          $project = GP::$project->by_path( $project_path );
</span><del>-               if ( !$project ) gp_tmpl_404();
</del><ins>+                if ( !$project ) $this->die_with_404();
</ins><span class="cx">           if ( $this->cannot_and_redirect( 'write', 'project', $project->id ) ) return;
</span><span class="cx"> 
</span><span class="cx">          $format = gp_array_get( GP::$formats, gp_post( 'format', 'po' ), null );
</span><span class="lines">@@ -83,14 +83,14 @@
</span><span class="cx"> 
</span><span class="cx">  function edit_get( $project_path ) {
</span><span class="cx">          $project = GP::$project->by_path( $project_path );
</span><del>-               if ( !$project ) gp_tmpl_404();
</del><ins>+                if ( !$project ) $this->die_with_404();
</ins><span class="cx">           if ( $this->cannot_and_redirect( 'write', 'project', $project->id ) ) return;
</span><del>-               gp_tmpl_load( 'project-edit', get_defined_vars() );
</del><ins>+                $this->tmpl( 'project-edit', get_defined_vars() );
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">  function edit_post( $project_path ) {
</span><span class="cx">          $project = GP::$project->by_path( $project_path );
</span><del>-               if ( !$project ) gp_tmpl_404();
</del><ins>+                if ( !$project ) $this->die_with_404();
</ins><span class="cx">           if ( $this->cannot_and_redirect( 'write', 'project', $project->id ) ) return;
</span><span class="cx">          $updated_project = new GP_Project( gp_post( 'project' ) );
</span><span class="cx">          if ( $this->invalid_and_redirect( $updated_project, gp_url_project( $project, '-edit' ) ) ) return;
</span><span class="lines">@@ -111,7 +111,7 @@
</span><span class="cx">          // TODO: decide what to do with child projects and translation sets
</span><span class="cx">          // TODO: just deactivate, do not actually delete
</span><span class="cx">          $project = GP::$project->by_path( $project_path );
</span><del>-               if ( !$project ) gp_tmpl_404();
</del><ins>+                if ( !$project ) $this->die_with_404();
</ins><span class="cx">           if ( $this->cannot_and_redirect( 'write', 'project', $project->id ) ) return;
</span><span class="cx">          if ( $project->delete() )
</span><span class="cx">                  $this->notices[] = __('The project was deleted.');
</span><span class="lines">@@ -125,7 +125,7 @@
</span><span class="cx">          $project = new GP_Project();
</span><span class="cx">          $project->parent_project_id = gp_get( 'parent_project_id', null );
</span><span class="cx">          if ( $this->cannot_and_redirect( 'write', 'project', $project->parent_project_id ) ) return;
</span><del>-               gp_tmpl_load( 'project-new', get_defined_vars() );
</del><ins>+                $this->tmpl( 'project-new', get_defined_vars() );
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">  function new_post() {
</span><span class="lines">@@ -138,7 +138,7 @@
</span><span class="cx">          if ( !$project ) {
</span><span class="cx">                  $project = new GP_Project();
</span><span class="cx">                  $this->errors[] = __('Error in creating project!');
</span><del>-                       gp_tmpl_load( 'project-new', get_defined_vars() );
</del><ins>+                        $this->tmpl( 'project-new', get_defined_vars() );
</ins><span class="cx">           } else {
</span><span class="cx">                  $this->notices[] = __('The project was created!');
</span><span class="cx">                  $this->redirect( gp_url_project( $project ) );
</span><span class="lines">@@ -147,7 +147,7 @@
</span><span class="cx"> 
</span><span class="cx">  function permissions_get( $project_path ) {
</span><span class="cx">          $project = GP::$project->by_path( $project_path );
</span><del>-               if ( !$project ) gp_tmpl_404();
</del><ins>+                if ( !$project ) $this->die_with_404();
</ins><span class="cx">           if ( $this->cannot_and_redirect( 'write', 'project', $project->id ) ) return;
</span><span class="cx">          $path_to_root = array_slice( $project->path_to_root(), 1 );
</span><span class="cx">          $permissions = GP::$validator_permission->by_project_id( $project->id );
</span><span class="lines">@@ -171,7 +171,7 @@
</span><span class="cx"> 
</span><span class="cx">  function permissions_post( $project_path ) {
</span><span class="cx">          $project = GP::$project->by_path( $project_path );
</span><del>-               if ( !$project ) gp_tmpl_404();
</del><ins>+                if ( !$project ) $this->die_with_404();
</ins><span class="cx">           if ( $this->cannot_and_redirect( 'write', 'project', $project->id ) ) return;
</span><span class="cx">          if ( 'add-validator' == gp_post( 'action' ) ) {
</span><span class="cx">                  $user = GP::$user->by_login( gp_post( 'user_login' ) );
</span><span class="lines">@@ -196,7 +196,7 @@
</span><span class="cx"> 
</span><span class="cx">  function permissions_delete( $project_path, $permission_id ) {
</span><span class="cx">          $project = GP::$project->by_path( $project_path );
</span><del>-               if ( !$project ) gp_tmpl_404();
</del><ins>+                if ( !$project ) $this->die_with_404();
</ins><span class="cx">           if ( $this->cannot_and_redirect( 'write', 'project', $project->id ) ) return;
</span><span class="cx">          $permission = GP::$permission->get( $permission_id );
</span><span class="cx">          if ( $permission ) {
</span><span class="lines">@@ -213,14 +213,14 @@
</span><span class="cx"> 
</span><span class="cx">  function mass_create_sets_get( $project_path ) {
</span><span class="cx">          $project = GP::$project->by_path( $project_path );
</span><del>-               if ( !$project ) gp_tmpl_404();
</del><ins>+                if ( !$project ) $this->die_with_404();
</ins><span class="cx">           if ( $this->cannot_and_redirect( 'write', 'project', $project->id ) ) return;
</span><span class="cx">          $this->tmpl( 'project-mass-create-sets', get_defined_vars() );
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="cx">  function mass_create_sets_post( $project_path ) {
</span><span class="cx">          $project = GP::$project->by_path( $project_path );
</span><del>-               if ( !$project ) gp_tmpl_404();
</del><ins>+                if ( !$project ) $this->die_with_404();
</ins><span class="cx">           if ( $this->cannot_and_redirect( 'write', 'project', $project->id ) ) return;
</span><span class="cx">          $other_project = GP::$project->get( gp_post( 'project_id' ) );
</span><span class="cx">          if ( !$other_project ) {
</span><span class="lines">@@ -244,7 +244,7 @@
</span><span class="cx"> 
</span><span class="cx">  function mass_create_sets_preview_post( $project_path ) {
</span><span class="cx">          $project = GP::$project->by_path( $project_path );
</span><del>-               if ( !$project ) gp_tmpl_404();
</del><ins>+                if ( !$project ) $this->die_with_404();
</ins><span class="cx">           if ( $this->cannot_and_redirect( 'write', 'project', $project->id ) ) return;
</span><span class="cx">          $other_project = GP::$project->get( gp_post( 'project_id' ) );
</span><span class="cx">          if ( !$other_project ) {
</span><span class="lines">@@ -253,4 +253,4 @@
</span><span class="cx">          header('Content-Type: application/json');
</span><span class="cx">          echo json_encode( $project->set_difference_from( $other_project ) );
</span><span class="cx">  }
</span><del>-}
</del><span class="cx">\ No newline at end of file
</span><ins>+}
</ins></span></pre></div>
<a id="trunkgpincludesroutestranslationsetphp"></a>
<div class="modfile"><h4>Modified: trunk/gp-includes/routes/translation-set.php (817 => 818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/gp-includes/routes/translation-set.php     2013-11-18 15:47:44 UTC (rev 817)
+++ trunk/gp-includes/routes/translation-set.php        2013-11-21 16:55:23 UTC (rev 818)
</span><span class="lines">@@ -63,19 +63,19 @@
</span><span class="cx">  private function get_set_project_and_locale_from_set_id_or_404( $set_id ) {
</span><span class="cx">          $set = GP::$translation_set->get( $set_id );
</span><span class="cx">          if ( !$set ) {
</span><del>-                       $this->tmpl_404( array( 'title' => "Translation set wasn't found" ) );
</del><ins>+                        $this->die_with_404( array( 'title' => "Translation set wasn't found" ) );
</ins><span class="cx">                   return;
</span><span class="cx">          }
</span><span class="cx">          $project =  GP::$project->get( $set->project_id );
</span><span class="cx">          if ( !$project ) {
</span><del>-                       $this->tmpl_404( array( 'title' => "The project associated with this translation set wasn't found" ) );
</del><ins>+                        $this->die_with_404( array( 'title' => "The project associated with this translation set wasn't found" ) );
</ins><span class="cx">                   return;
</span><span class="cx">          }
</span><span class="cx">          $locale = $locale = GP_Locales::by_slug( $set->locale );
</span><span class="cx">          if ( !$locale ) {
</span><del>-                       $this->tmpl_404( array( 'title' => "The locale associated with this translation set wasn't found" ) );
</del><ins>+                        $this->die_with_404( array( 'title' => "The locale associated with this translation set wasn't found" ) );
</ins><span class="cx">                   return;
</span><span class="cx">          }
</span><span class="cx">          return array( $set, $project, $locale );
</span><span class="cx">  }
</span><del>-}
</del><span class="cx">\ No newline at end of file
</span><ins>+}
</ins></span></pre></div>
<a id="trunkgpincludesroutestranslationphp"></a>
<div class="modfile"><h4>Modified: trunk/gp-includes/routes/translation.php (817 => 818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/gp-includes/routes/translation.php 2013-11-18 15:47:44 UTC (rev 817)
+++ trunk/gp-includes/routes/translation.php    2013-11-21 16:55:23 UTC (rev 818)
</span><span class="lines">@@ -4,7 +4,7 @@
</span><span class="cx">          $project = GP::$project->by_path( $project_path );
</span><span class="cx">          $locale = GP_Locales::by_slug( $locale_slug );
</span><span class="cx">          $translation_set = GP::$translation_set->by_project_id_slug_and_locale( $project->id, $translation_set_slug, $locale_slug );
</span><del>-               if ( !$project || !$locale || !$translation_set ) gp_tmpl_404();
</del><ins>+                if ( !$project || !$locale || !$translation_set ) $this->die_with_404();
</ins><span class="cx">           if ( $this->cannot_and_redirect( 'approve', 'translation-set', $translation_set->id ) ) return;
</span><span class="cx">          $kind = 'translations';
</span><span class="cx">          $this->tmpl( 'project-import', get_defined_vars() );
</span><span class="lines">@@ -14,7 +14,7 @@
</span><span class="cx">          $project = GP::$project->by_path( $project_path );
</span><span class="cx">          $locale = GP_Locales::by_slug( $locale_slug );
</span><span class="cx">          $translation_set = GP::$translation_set->by_project_id_slug_and_locale( $project->id, $translation_set_slug, $locale_slug );
</span><del>-               if ( !$project || !$locale || !$translation_set ) gp_tmpl_404();
</del><ins>+                if ( !$project || !$locale || !$translation_set ) $this->die_with_404();
</ins><span class="cx">           if ( $this->cannot_and_redirect( 'approve', 'translation-set', $translation_set->id ) ) return;
</span><span class="cx"> 
</span><span class="cx">          $format = gp_array_get( GP::$formats, gp_post( 'format', 'po' ), null );
</span><span class="lines">@@ -44,10 +44,10 @@
</span><span class="cx">          $project = GP::$project->by_path( $project_path );
</span><span class="cx">          $locale = GP_Locales::by_slug( $locale_slug );
</span><span class="cx">          $translation_set = GP::$translation_set->by_project_id_slug_and_locale( $project->id, $translation_set_slug, $locale_slug );
</span><del>-               if ( !$project || !$locale || !$translation_set ) gp_tmpl_404();
</del><ins>+                if ( !$project || !$locale || !$translation_set ) $this->die_with_404();
</ins><span class="cx"> 
</span><span class="cx">          $format = gp_array_get( GP::$formats, gp_get( 'format', 'po' ), null );
</span><del>-               if ( !$format ) gp_tmpl_404();
</del><ins>+                if ( !$format ) $this->die_with_404();
</ins><span class="cx"> 
</span><span class="cx">          $export_locale = apply_filters( 'export_locale', $locale->slug, $locale );
</span><span class="cx">          $filename = sprintf( '%s-%s.'.$format->extension, str_replace( '/', '-', $project->path ), $export_locale );
</span><span class="lines">@@ -69,7 +69,7 @@
</span><span class="cx">          $project = GP::$project->by_path( $project_path );
</span><span class="cx">          $locale = GP_Locales::by_slug( $locale_slug );
</span><span class="cx">          $translation_set = GP::$translation_set->by_project_id_slug_and_locale( $project->id, $translation_set_slug, $locale_slug );
</span><del>-               if ( !$project || !$locale || !$translation_set ) gp_tmpl_404();
</del><ins>+                if ( !$project || !$locale || !$translation_set ) $this->die_with_404();
</ins><span class="cx">           $page = gp_get( 'page', 1 );
</span><span class="cx">          $filters = gp_get( 'filters', array() );
</span><span class="cx">          $sort = gp_get( 'sort', array() );
</span><span class="lines">@@ -102,7 +102,7 @@
</span><span class="cx">          $project = GP::$project->by_path( $project_path );
</span><span class="cx">          $locale = GP_Locales::by_slug( $locale_slug );
</span><span class="cx">          $translation_set = GP::$translation_set->by_project_id_slug_and_locale( $project->id, $translation_set_slug, $locale_slug );
</span><del>-               if ( !$project || !$locale || !$translation_set ) gp_tmpl_404();
</del><ins>+                if ( !$project || !$locale || !$translation_set ) $this->die_with_404();
</ins><span class="cx"> 
</span><span class="cx">          $output = array();
</span><span class="cx">          foreach( gp_post( 'translation', array() ) as $original_id => $translations) {
</span><span class="lines">@@ -160,7 +160,7 @@
</span><span class="cx">          $project = GP::$project->by_path( $project_path );
</span><span class="cx">          $locale = GP_Locales::by_slug( $locale_slug );
</span><span class="cx">          $translation_set = GP::$translation_set->by_project_id_slug_and_locale( $project->id, $translation_set_slug, $locale_slug );
</span><del>-               if ( !$project || !$locale || !$translation_set ) gp_tmpl_404();
</del><ins>+                if ( !$project || !$locale || !$translation_set ) $this->die_with_404();
</ins><span class="cx">           if ( $this->cannot_and_redirect( 'approve', 'translation-set', $translation_set->id ) ) return;
</span><span class="cx"> 
</span><span class="cx">          $bulk = gp_post('bulk');
</span><span class="lines">@@ -241,7 +241,7 @@
</span><span class="cx">          $project = GP::$project->by_path( $project_path );
</span><span class="cx">          $locale = GP_Locales::by_slug( $locale_slug );
</span><span class="cx">          $translation_set = GP::$translation_set->by_project_id_slug_and_locale( $project->id, $translation_set_slug, $locale_slug );
</span><del>-               if ( !$project || !$locale || !$translation_set ) gp_tmpl_404();
</del><ins>+                if ( !$project || !$locale || !$translation_set ) $this->die_with_404();
</ins><span class="cx"> 
</span><span class="cx">          $translation = GP::$translation->get( gp_post( 'translation_id' ) );
</span><span class="cx">          if ( !$translation ) {
</span></span></pre></div>
<a id="trunkgpincludestemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/gp-includes/template.php (817 => 818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/gp-includes/template.php   2013-11-18 15:47:44 UTC (rev 817)
+++ trunk/gp-includes/template.php      2013-11-21 16:55:23 UTC (rev 818)
</span><span class="lines">@@ -59,14 +59,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function gp_tmpl_404( $args = array()) {
</span><del>-       if( GP::$current_route->api  ) {
-               status_header(404);
-               echo json_encode( array( 'success' => false, 'error' => __('Not Found') ) );
-       }
-       else {
-               gp_tmpl_load( '404', $args + array('title' => __('Not Found'), 'http_status' => 404 ) );
-       }
-
</del><ins>+        gp_tmpl_load( '404', $args + array('title' => __('Not Found'), 'http_status' => 404 ) );
</ins><span class="cx">   exit();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -340,4 +333,4 @@
</span><span class="cx">  <a href="#" class="copy" tabindex="-1"><?php _e('Copy from original'); ?></a> &bull;
</span><span class="cx">  <a href="#" class="gtranslate" tabindex="-1"><?php _e('Translation from Google'); ?></a>
</span><span class="cx">  */
</span><del>-}
</del><span class="cx">\ No newline at end of file
</span><ins>+}
</ins></span></pre></div>
<a id="trunkgptemplates404apiphp"></a>
<div class="addfile"><h4>Added: trunk/gp-templates/404.api.php (0 => 818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/gp-templates/404.api.php                           (rev 0)
+++ trunk/gp-templates/404.api.php      2013-11-21 16:55:23 UTC (rev 818)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+<?php
+
+echo json_encode( array( 'success' => false, 'error' => __('Not Found') ) );
</ins></span></pre></div>
<a id="trunkttests_routestest_route_translation_setphp"></a>
<div class="modfile"><h4>Modified: trunk/t/tests_routes/test_route_translation_set.php (817 => 818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/t/tests_routes/test_route_translation_set.php      2013-11-18 15:47:44 UTC (rev 817)
+++ trunk/t/tests_routes/test_route_translation_set.php 2013-11-21 16:55:23 UTC (rev 818)
</span><span class="lines">@@ -10,7 +10,8 @@
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="cx">  function test_single_with_a_non_existent_set_gives_404() {
</span><del>-               $this->route->single( 11 );
</del><ins>+                $this->route->single( 11123123 );
+               $this->assert404();
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">  function test_single_redirects_to_existing_set() {
</span></span></pre>
</div>
</div>

</body>
</html>