[TEP-COMMIT] [CVS catalog] update the language class somewhat (more updates pending)
hpdl-OfajU3CKLf1/[email protected] 20 Nov 2004 02:11:48 -0000
| Newsgroups | gmane.comp.web.oscommerce.cvs |
|---|---|
| Message-ID | <[email protected]> |
<html>
<head>
<style><!--
body {background-color:#ffffff;}
.file {border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;}
.pathname {font-family:monospace; float:right;}
.fileheader {margin-bottom:.5em;}
.diff {margin:0;}
.tasklist {padding:4px;border:1px dashed #000000;margin-top:1em;}
.tasklist ul {margin-top:0;margin-bottom:0;}
tr.alt {background-color:#eeeeee}
#added {background-color:#ddffdd;}
#addedchars {background-color:#99ff99;font-weight:bolder;}
tr.alt #added {background-color:#ccf7cc;}
#removed {background-color:#ffdddd;}
#removedchars {background-color:#ff9999;font-weight:bolder;}
tr.alt #removed {background-color:#f7cccc;}
#info {color:#888888;}
#context {background-color:#eeeeee;}
td {padding-left:.3em;padding-right:.3em;}
tr.head {border-bottom-width:1px;border-bottom-style:solid;}
tr.head td {padding:0;padding-top:.2em;}
.task {background-color:#ffff00;}
.comment {padding:4px;border:1px dashed #000000;background-color:#ffffdd}
.error {color:red;}
hr {border-width:0px;height:2px;background:black;}
--></style>
</head>
<body>
<table cellspacing="0" cellpadding="0" border="0" rules="cols">
<tr class="head"><td colspan="4">Commit in <b><tt>catalog/catalog/includes/classes</tt></b><span id="info"> on MAIN</span></td></tr>
<tr><td><tt><a href="#file1">language.php</a></tt></td><td align="right" id="added">+34</td><td align="right" id="removed">-5</td><td nowrap="nowrap" align="center"><a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes/language.php?rev=1.7&content-type=text/vnd.viewcvs-markup">1.7</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes/language.php.diff?r1=1.7&r2=1.8">-></a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes/language.php?rev=1.8&content-type=text/vnd.viewcvs-markup">1.8</a></td></tr>
</table>
<pre class="comment">
update the language class somewhat (more updates pending)
now caches the language database query result set
</pre>
<hr /><a name="file1" /><div class="file">
<span class="pathname"><a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog">catalog</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog">catalog</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes">includes</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes">classes</a><br /></span>
<div class="fileheader"><big><b>language.php</b></big> <small id="info"><a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes/language.php?rev=1.7&content-type=text/vnd.viewcvs-markup">1.7</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes/language.php.diff?r1=1.7&r2=1.8">-></a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes/language.php?rev=1.8&content-type=text/vnd.viewcvs-markup">1.8</a></small></div>
<pre class="diff"><small id="info">diff -u -r1.7 -r1.8
--- language.php 2004/02/16 07:08:16 1.7
+++ language.php 2004/11/20 02:11:47 1.8
@@ -59,13 +59,15 @@
</small></pre><pre class="diff" id="context">
$this->catalog_languages = array();
</pre><pre class="diff" id="removed">- $Qlanguages = $osC_Database->query('select languages_id, name, code, image, directory from :table_languages order by sort_order');
- $Qlanguages->bindRaw(':table_languages', TABLE_LANGUAGES);
</pre><pre class="diff" id="added">+ $Qlanguages = $osC_Database->query('select * from :table_languages order by sort_order, name');
+ $Qlanguages->bindTable(':table_languages', TABLE_LANGUAGES);
+ $Qlanguages->setCache('languages');
</pre><pre class="diff" id="context"> $Qlanguages->execute();
while ($Qlanguages->next()) {
$this->catalog_languages[$Qlanguages->value('code')] = array('id' => $Qlanguages->valueInt('languages_id'),
'name' => $Qlanguages->value('name'),
</pre><pre class="diff" id="added">+ 'code' => $Qlanguages->value('code'),
</pre><pre class="diff" id="context"> 'image' => $Qlanguages->value('image'),
'directory' => $Qlanguages->value('directory'));
}
</pre><pre class="diff"><small id="info">@@ -79,10 +81,21 @@
</small></pre><pre class="diff" id="context"> }
function set_language($language) {
</pre><pre class="diff" id="removed">- if ( (tep_not_null($language)) && (isset($this->catalog_languages[$language])) ) {
- $this->language = $this->catalog_languages[$language];
</pre><pre class="diff" id="added">+ global $osC_Session;
+
+ if (empty($language) && $osC_Session->exists('language')) {
+ foreach ($this->catalog_languages as $l) {
+ if ($l['directory'] == $osC_Session->value('language')) {
+ $language = $l['code'];
+ break;
+ }
+ }
+ }
+
+ if (!empty($language) && $this->exists($language)) {
+ $this->language = $this->get($language);
</pre><pre class="diff" id="context"> } else {
</pre><pre class="diff" id="removed">- $this->language = $this->catalog_languages[DEFAULT_LANGUAGE];
</pre><pre class="diff" id="added">+ $this->language = $this->get(DEFAULT_LANGUAGE);
</pre><pre class="diff" id="context"> }
}
</pre><pre class="diff"><small id="info">@@ -98,6 +111,22 @@
</small></pre><pre class="diff" id="context"> }
}
}
</pre><pre class="diff" id="added">+ }
+
+ function get($language) {
+ return $this->catalog_languages[$language];
+ }
+
+ function getAll() {
+ return $this->catalog_languages;
+ }
+
+ function exists($language) {
+ if (isset($this->catalog_languages[$language])) {
+ return true;
+ }
+
+ return false;
</pre><pre class="diff" id="context"> }
}
?>
</pre></div>
<center><small><a href="http://www.badgers-in-foil.co.uk/projects/cvsspam/" title="commit -> email">CVSspam</a> 0.2.9</small></center>
</body></html>
-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8