aboutsummaryrefslogtreecommitdiff
path: root/h-source/Application/Include/myFunctions.php
diff options
context:
space:
mode:
Diffstat (limited to 'h-source/Application/Include/myFunctions.php')
-rw-r--r--h-source/Application/Include/myFunctions.php69
1 files changed, 36 insertions, 33 deletions
diff --git a/h-source/Application/Include/myFunctions.php b/h-source/Application/Include/myFunctions.php
index 483a85f..daefb59 100644
--- a/h-source/Application/Include/myFunctions.php
+++ b/h-source/Application/Include/myFunctions.php
@@ -95,40 +95,40 @@ function getOrderByClause($string)
function diff($old, $new){
- $maxlen = 0;
- foreach($old as $oindex => $ovalue){
+ $maxlen = 0;
+ foreach($old as $oindex => $ovalue){
// $nkeys = getNewKeys($new,$ovalue);
- $nkeys = array_keys($new, $ovalue);
- foreach($nkeys as $nindex){
- $matrix[$oindex][$nindex] = isset($matrix[$oindex - 1][$nindex - 1]) ?
- $matrix[$oindex - 1][$nindex - 1] + 1 : 1;
- if($matrix[$oindex][$nindex] > $maxlen){
- $maxlen = $matrix[$oindex][$nindex];
- $omax = $oindex + 1 - $maxlen;
- $nmax = $nindex + 1 - $maxlen;
- }
- }
- }
- if($maxlen == 0) return array(array('d'=>$old, 'i'=>$new));
- return array_merge(
- diff(array_slice($old, 0, $omax), array_slice($new, 0, $nmax)),
- array_slice($new, $nmax, $maxlen),
- diff(array_slice($old, $omax + $maxlen), array_slice($new, $nmax + $maxlen)));
+ $nkeys = array_keys($new, $ovalue);
+ foreach($nkeys as $nindex){
+ $matrix[$oindex][$nindex] = isset($matrix[$oindex - 1][$nindex - 1]) ?
+ $matrix[$oindex - 1][$nindex - 1] + 1 : 1;
+ if($matrix[$oindex][$nindex] > $maxlen){
+ $maxlen = $matrix[$oindex][$nindex];
+ $omax = $oindex + 1 - $maxlen;
+ $nmax = $nindex + 1 - $maxlen;
+ }
+ }
+ }
+ if($maxlen == 0) return array(array('d'=>$old, 'i'=>$new));
+ return array_merge(
+ diff(array_slice($old, 0, $omax), array_slice($new, 0, $nmax)),
+ array_slice($new, $nmax, $maxlen),
+ diff(array_slice($old, $omax + $maxlen), array_slice($new, $nmax + $maxlen)));
}
function htmlDiff($old, $new){
- $old = str_replace("\r\n"," \r\n ",$old);
- $new = str_replace("\r\n"," \r\n ",$new);
-
- $ret = null;
- $diff = diff(explode(' ', $old), explode(' ', $new));
- foreach($diff as $k){
- if(is_array($k))
- $ret .= (!empty($k['d'])?"<del>".implode(' ',$k['d'])."</del> ":'').
- (!empty($k['i'])?"<ins>".implode(' ',$k['i'])."</ins> ":'');
- else $ret .= $k . ' ';
- }
- return $ret;
+ $old = str_replace("\r\n"," \r\n ",$old);
+ $new = str_replace("\r\n"," \r\n ",$new);
+
+ $ret = null;
+ $diff = diff(explode(' ', $old), explode(' ', $new));
+ foreach($diff as $k){
+ if(is_array($k))
+ $ret .= (!empty($k['d'])?"<del>".implode(' ',$k['d'])."</del> ":'').
+ (!empty($k['i'])?"<ins>".implode(' ',$k['i'])."</ins> ":'');
+ else $ret .= $k . ' ';
+ }
+ return $ret;
}
@@ -457,16 +457,19 @@ function getUrlsFromIdHard($id_hard)
$urlView = "http://".DOMAIN_NAME;
$urlTalk = "http://".DOMAIN_NAME;
+ $deviceName = null;
$hard = new HardwareModel();
$res = $hard->select('type,model')->where(array('id_hard'=>$clean['id_hard']))->send();
if (count($res) > 0)
{
- $urlView = "http://".DOMAIN_NAME."/".MyStrings::$reverse[$res[0]['hardware']['type']]."/view/".Lang::$current."/".$clean['id_hard']."/".encodeUrl($res[0]['hardware']['model']);
+ $urlView = "http://".DOMAIN_NAME."/".Hardware::$typeToController[$res[0]['hardware']['type']]."/view/".Lang::$current."/".$clean['id_hard']."/".encodeUrl($res[0]['hardware']['model']);
- $urlTalk = "http://".DOMAIN_NAME."/".MyStrings::$reverse[$res[0]['hardware']['type']]."/talk/".Lang::$current."/".$clean['id_hard'];
+ $urlTalk = "http://".DOMAIN_NAME."/".Hardware::$typeToController[$res[0]['hardware']['type']]."/talk/".Lang::$current."/".$clean['id_hard'];
+
+ $deviceName = $res[0]['hardware']['model'];
}
- return array('urlView'=>$urlView,'urlTalk'=>$urlTalk);
+ return array('urlView'=>$urlView,'urlTalk'=>$urlTalk,'modelName'=>$deviceName);
} \ No newline at end of file