<?php
-return;
require_once(realpath(dirname(__FILE__).'/../../lib/php/maps.php'));
function pub_map(&$r) {
+ debug($r);
if (empty($r['latitude'])) return;
if (empty($r['longiture'])) return;
$r['maps'] = '<a href="'.Maps::link($r['latitude'],$r['latitude']).'">'
}
$DBQ['pub'] = [
- 'tables' => [
- 'zipcode' => [ 'extras' => ['maps' => ''] ],
- ],
+ 'row_parse_post' => function(&$r,&$t) {
+ #debug('zaza');
+ #pub_map($r);
+ },
];
?>
* @param [FILES] $files Files to load
* @return ARRAY the new/existing value of $this->db
*/
+ public static function ar_merge($a,$b) {
+ return array_replace_recursive($a,$b);
+ #return array_combine($a,$b);
+ $n = $a;
+ foreach ($b as $k=>$v) {
+ if (!empty($n[$k]) and is_array($v)) {
+ $v = array_combine($n[$k],$v);
+ }
+ $n[$k] = $v;
+ }
+ return $n;
+ }
+
public static function conf_load($files=[],&$first=false) {
if (empty($files)) return [];
if (!is_readable($file)) continue;
if (preg_match('/\.(yaml|yml)$/i',$file) and ($yaml = self::yaml_parse_file($file))) {
- $dbs = array_replace_recursive($dbs,$yaml);
+ $dbs = self::ar_merge($dbs,$yaml);
} elseif (preg_match('/\.php$/i',$file)) {
+ $DBQ = [];
require($file);
- if (!empty($DBQ)) $dbs = array_replace_recursive($dbs,$DBQ);
+ if (!empty($DBQ)) $dbs = self::ar_merge($dbs,$DBQ);
}
$this->not_found('Unknown db: '.$this->params['db']);
$connect = $this->db->conf[$this->params['db']];
}
+ #debug($connect);
$connect['id'] = $this->params['db'];
if (!empty($this->db()->row_parse_post)) {
$row_parse_post = $this->db()->row_parse_post;
- $call($r,$this);
}
$opt = ($this->page->is('html')