Пример #1
0
 public function apply($value)
 {
     $statuuus = Service\Record::getStatus();
     foreach ($statuuus as $k => $v) {
         if (strcasecmp($v, $value) == 0) {
             return $k;
         }
     }
     return false;
 }
Пример #2
0
 private function substituteVars($sql, Service\Record $record)
 {
     // tables
     $result = $this->sql->getAll('SELECT name, value FROM ' . $this->registry['table.core_registry'] . ' WHERE name LIKE "table.%"');
     foreach ($result as $row) {
         $sql = str_replace('{' . $row['name'] . '}', $row['value'], $sql);
     }
     // service
     $data = $record->getData();
     foreach ($data as $k => $v) {
         $sql = str_replace('{service.' . $k . '}', $v, $sql);
     }
     // ids
     foreach ($this->ids as $k => $v) {
         $sql = str_replace('{id.' . $k . '}', $v, $sql);
     }
     // config
     $data = array('host' => $this->base->getHost(), 'table_prefix' => $this->config['amun_table_prefix']);
     foreach ($data as $k => $v) {
         $sql = str_replace('{config.' . $k . '}', $v, $sql);
     }
     return $sql;
 }