コード例 #1
0
ファイル: UnSubscribe.php プロジェクト: Koulio/OpenZIS
 private function saveUnSubscribes()
 {
     $db = ZitDBAdapter::getDBAdapter();
     foreach ($this->unSubscribeObjects as $object) {
         $db->delete(DBConvertor::convertCase('agent_subscriptions'), 'agent_id = ' . $this->agent->agentId . ' and context_id = ' . $object->contextId . ' and object_type_id = ' . $object->objectId . ' and zone_id = ' . $_SESSION['ZONE_ID']);
     }
 }
コード例 #2
0
ファイル: SifLogEntry.php プロジェクト: Koulio/OpenZIS
 public static function CreateSifLogEvents($header, $category, $code, $desc)
 {
     $db = Zend_Registry::get('my_db');
     $xml = XmlHelper::buildSifLogEvent(Utility::createMessageId(), Utility::createTimestamp(), $header, $category, $code, $desc);
     $xml = str_replace('xmlns="http://www.sifinfo.org/uk/infrastructure/2.x"', '', $xml);
     $xml = str_replace('xmlns="http://www.sifinfo.org/infrastructure/2.x"', '', $xml);
     $xml = str_replace('xmlns="http://www.sifinfo.org/infrastructure/1.x"', '', $xml);
     $dataObject = new DataObject('sif_logentry');
     $query = "select\r\n\t\t\t\t  \tagent_registered.agent_id,\r\n\t\t\t\t\tagent_registered.agent_mode_id,\r\n                    agent_registered.context_id,\r\n                    agent_registered.zone_id\r\n\t\t\t\t  from \r\n\t\t\t\t  \t" . DBConvertor::convertCase('agent_registered') . " \r\n\t\t\t\t  where \r\n\t\t\t\t  \tagent_registered.context_id = " . $_SESSION["CONTEXT_ID"] . " \r\n\t\t\t\t\tand agent_registered.zone_id = " . $_SESSION["ZONE_ID"] . "\r\n\t\t\t\t\tand agent_registered.unregister_timestamp is null";
     $result = $db->fetchAll($query);
     foreach ($result as $row) {
         switch (DB_TYPE) {
             case 'mysql':
                 $agentId = intval($row->agent_id);
                 $agentModeId = intval($row->agent_mode_id);
                 $zoneId = intval($row->zone_id);
                 $contextId = intval($row->context_id);
                 break;
             case 'oci8':
                 $agentId = intval($row->AGENT_ID);
                 $agentModeId = intval($row->AGENT_MODE_ID);
                 $zoneId = intval($row->ZONE_ID);
                 $contextId = intval($row->CONTEXT_ID);
                 break;
         }
         $data = array('event_timestamp' => new Zend_Db_Expr(DBConvertor::convertCurrentTime()), 'agent_id_sender' => intval(0), 'agent_id_rec' => $agentId, 'event_data' => $xml, 'object_id' => $dataObject->objectId, 'action_id' => intval(1), 'zone_id' => $zoneId, 'context_id' => $contextId, 'agent_mode_id' => $agentModeId);
         /*
         *            $db->insert('event', $data);
         */
     }
 }
コード例 #3
0
ファイル: Context.php プロジェクト: Koulio/OpenZIS
 public static function updateContext($description, $contextId)
 {
     //$db = ZitDBAdapter::getDBAdapter();
     $db = Zend_Registry::get('my_db');
     $data = array('CONTEXT_DESC' => $description);
     $n = $db->update(DBConvertor::convertCase('context'), $data, DBConvertor::convertCase('context_id') . ' = ' . $contextId);
 }
コード例 #4
0
ファイル: ZitLog.php プロジェクト: neilberget/OpenZIS
 public static function writeToErrorLog($shortErrorDesc, $longErrorDesc, $errorLocation, $zoneId = null, $agentId = null, $contextId = null)
 {
     $db = Zend_Registry::get('my_db');
     $data = array(DBConvertor::convertCase('error_timestamp') => new Zend_Db_Expr(DBConvertor::convertCurrentTime()), DBConvertor::convertCase('short_error_desc') => $shortErrorDesc, DBConvertor::convertCase('long_error_desc') => $longErrorDesc, DBConvertor::convertCase('error_location') => $errorLocation, DBConvertor::convertCase('zone_id') => $zoneId, DBConvertor::convertCase('agent_id') => $agentId, DBConvertor::convertCase('context_id') => $contextId);
     if ($db->insert(DBConvertor::convertCase('error_log'), $data)) {
         return true;
     } else {
         return false;
     }
 }
コード例 #5
0
ファイル: OpenZisPushHandler.php プロジェクト: Koulio/OpenZIS
 public function Stop($zoneId, $contextId = 1)
 {
     $db = ZitDBAdapter::getDBAdapter();
     $data = array('push_running' => 0, 'last_stop' => new Zend_Db_Expr(DBConvertor::convertCurrentTime()));
     $db->update('push_handler', $data, 'zone_id = ' . $zoneId . ' and context_id = ' . $contextId);
     $query = "select \r\n\t\t\t\t\tphp_pid from \r\n\t\t\t\t\t " . DBConvertor::convertCase('push_handler') . " \r\n\t\t\t\t  where zone_id = {$zoneId} and context_id = {$contextId}";
     $result = $db->fetchAll($query);
     $pid = $result[0]->pid;
     if ($this->psExists($pid)) {
         $this->psKill($pid);
     }
 }
コード例 #6
0
ファイル: DataElement.php プロジェクト: Koulio/OpenZIS
 public static function getAllDataElements($permission, $agentId, $zoneId, $contextId)
 {
     $db = Zend_Registry::get('my_db2');
     $query = "select distinct\r\n                    de.element_id,\r\n                    de.element_name,\r\n                    f.data_object_element_id,\r\n                    doe.can_filter\r\n\t\t  from " . DBConvertor::convertCase('data_element') . " de\r\n\t\t  inner join " . DBConvertor::convertCase('data_object_element') . " doe on doe.element_id = de.element_id\r\n\t\t  left outer join " . DBConvertor::convertCase('agent_filters') . " f on f.data_object_element_id = doe.data_object_element_id\r\n                  and f.data_element_child_id = 0 \r\n                  and f.agent_id = " . $agentId . " and f.zone_id = " . $zoneId . " and f.context_id = " . $contextId . "\r\n\t\t  where doe.object_id = " . $permission->objectId;
     $result = $db->fetchAll($query);
     foreach ($result as $row) {
         $filtered = false;
         if ($row->filter_id != null) {
             $filtered = true;
         }
         $element = new DataElement($row->element_id . "_" . $permission->objectId, $row->element_name, Utility::nullBooleanConvertor($row->data_object_element_id), Utility::intBooleanConvertor($row->can_filter));
         $query2 = "select distinct\r\n                        child.data_element_child_id as id,\r\n                        doe.object_id,\r\n                        de.element_name,\r\n                        f.data_element_child_id\r\n                       from\r\n                        " . DBConvertor::convertCase('data_element_child') . " child\r\n                       inner join\r\n                        " . DBConvertor::convertCase('data_element') . " de on de.element_id = child.child_element_id\r\n                       inner join\r\n                        " . DBConvertor::convertCase('data_object_element') . " doe on doe.element_id = " . $row->element_id . "\r\n                       left outer join\r\n                        " . DBConvertor::convertCase('agent_filters') . " as f on f.data_element_child_id = child.data_element_child_id\r\n                            and f.data_object_element_id = doe.data_object_element_id\r\n                           and f.agent_id = " . $agentId . " and f.zone_id = " . $zoneId . " and f.context_id = " . $contextId . "\r\n                       where\r\n                        child.parent_element_id =  " . $row->element_id . "\r\n                       and\r\n                        doe.object_id = " . $permission->objectId . "\r\n                       order by\r\n                        child.data_element_child_id";
         $result2 = $db->fetchAll($query2);
         foreach ($result2 as $row2) {
             $child_element = new DataElement($row2->id . "_" . $row->element_id . "_" . $permission->objectId, $row2->element_name, Utility::nullBooleanConvertor($row2->data_element_child_id));
             array_push($element->childElements, $child_element);
         }
         array_push($permission->dataElements, $element);
     }
 }
コード例 #7
0
ファイル: Subscribe.php プロジェクト: Koulio/OpenZIS
 private function alreadySubscribed($objectId, $contextId)
 {
     $db = Zend_Registry::get('my_db');
     $query = "select count(*) as NUM_ROWS from \r\n\t\t\t\t  " . DBConvertor::convertCase('agent_subscriptions') . "\r\n\t\t\t\t  where agent_id = " . $this->agent->agentId . "\r\n\t\t\t\t  and object_type_id = " . $objectId . "\r\n\t\t\t\t  and context_id = {$contextId}\r\n\t\t\t\t  and zone_id = " . $_SESSION['ZONE_ID'];
     $result = $db->fetchAll($query);
     foreach ($result as $row) {
         switch (DB_TYPE) {
             case 'mysql':
                 $num = $row->num_rows;
                 break;
             case 'oci8':
                 $num = $row->NUM_ROWS;
                 break;
         }
     }
     if ($num != 0) {
         return true;
     } else {
         return false;
     }
 }
コード例 #8
0
ファイル: DataObject.php プロジェクト: Koulio/OpenZIS
 public static function getAllDataObjects($groupId = null)
 {
     $dataObjects = array();
     $db = Zend_Registry::get('my_db2');
     $select = "select object_id, object_name from " . DBConvertor::convertCase('data_object');
     if ($groupId != null) {
         $select = $select . " where group_id = " . $groupId;
     }
     $result = $db->fetchAll($select);
     foreach ($result as $row) {
         switch (DB_TYPE) {
             case 'mysql':
                 $object = new DataObject($row->object_id, $row->object_name);
                 break;
             case 'oci8':
                 $object = new DataObject($row->OBJECT_ID, $row->OBJECT_NAME);
                 break;
         }
         array_push($dataObjects, $object);
     }
     return $dataObjects;
 }
コード例 #9
0
ファイル: ResponseObject.php プロジェクト: Koulio/OpenZIS
 public static function responseExist($msgId)
 {
     $db = Zend_Registry::get('my_db');
     switch (DB_TYPE) {
         case 'mysql':
             $query = "SELECT COUNT(*) AS num_rows FROM " . DBConvertor::convertCase('messagequeue') . " WHERE ref_msg_id = '" . $msgId . "' and msg_type = 2";
             $result = $db->fetchAll($query);
             $rows = isset($result[0]->num_rows) ? $result[0]->num_rows : 0;
             break;
         case 'oci8':
             ## This should be corrected:: ##
             $query = "SELECT COUNT(*) AS num_rows FROM " . DBConvertor::convertCase('response') . " WHERE ref_msg_id = '" . $msgId . "'";
             $result = $db->fetchAll($query);
             $rows = isset($result[0]->NUM_ROWS) ? $result[0]->NUM_ROWS : 0;
             break;
     }
     if ($rows != 0) {
         return true;
     } else {
         return false;
     }
 }
コード例 #10
0
ファイル: Provision.php プロジェクト: Koulio/OpenZIS
 private function saveProvisions()
 {
     $db = Zend_Registry::get('my_db');
     $agt_pro = new AgentProvisions($db);
     $agt_sub = new AgentSubscriptions($db);
     $agt_req = new AgentRequester($db);
     $agt_res = new AgentResponder($db);
     $where = 'agent_id = ' . $this->agent->agentId . ' and zone_id = ' . $_SESSION['ZONE_ID'];
     $agt_pro->delete($where);
     $agt_sub->delete($where);
     $agt_req->delete($where);
     $agt_res->delete($where);
     if (count($this->requestObjects) > 0) {
         foreach ($this->requestObjects as $object) {
             $data = array(DBConvertor::convertCase('agent_id') => $this->agent->agentId, DBConvertor::convertCase('object_type_id') => $object->objectId, DBConvertor::convertCase('requester_timestamp') => new zend_db_expr(DBConvertor::convertCurrentTime()), DBConvertor::convertCase('context_id') => $object->contextId, DBConvertor::convertCase('zone_id') => $_SESSION['ZONE_ID']);
             $agt_req->insert($data);
         }
     }
     if (count($this->respondObjects) > 0) {
         foreach ($this->respondObjects as $object) {
             $data = array(DBConvertor::convertCase('agent_id') => $this->agent->agentId, DBConvertor::convertCase('object_type_id') => $object->objectId, DBConvertor::convertCase('responder_timestamp') => new zend_db_expr(DBConvertor::convertCurrentTime()), DBConvertor::convertCase('context_id') => $object->contextId, DBConvertor::convertCase('zone_id') => $_SESSION['ZONE_ID']);
             $agt_res->insert($data);
             //              $db->insert('agent_responder', $data);
         }
     }
     if (count($this->provideObjects) > 0) {
         foreach ($this->provideObjects as $object) {
             $data = array(DBConvertor::convertCase('agent_id') => $this->agent->agentId, DBConvertor::convertCase('object_type_id') => $object->objectId, DBConvertor::convertCase('provision_timestamp') => new zend_db_expr(DBConvertor::convertCurrentTime()), DBConvertor::convertCase('context_id') => $object->contextId, DBConvertor::convertCase('zone_id') => $_SESSION['ZONE_ID']);
             //                $db->insert('agent_provisions', $data);
             $agt_pro->insert($data);
         }
     }
     if (count($this->subscribeObjects) > 0) {
         foreach ($this->subscribeObjects as $object) {
             $data = array(DBConvertor::convertCase('agent_id') => $this->agent->agentId, DBConvertor::convertCase('object_type_id') => $object->objectId, DBConvertor::convertCase('subscribe_timestamp') => new zend_db_expr(DBConvertor::convertCurrentTime()), DBConvertor::convertCase('context_id') => $object->contextId, DBConvertor::convertCase('zone_id') => $_SESSION['ZONE_ID']);
             //                $db->insert('agent_subscriptions', $data);
             $agt_sub->insert($data);
         }
     }
     if (count($this->publishAddObjects) > 0) {
         foreach ($this->publishAddObjects as $object) {
             $data = array(DBConvertor::convertCase('publish_add') => '1');
             $where = 'agent_id = ' . $this->agent->agentId . ' and object_type_id = ' . $object->objectId . ' and context_id = ' . $object->contextId;
             $agt_pro->update($data, $where);
             //                $db->update('agent_provisions', $data, 'agent_id = '.$this->agent->agentId.' and object_type_id = '.$object->objectId.' and context_id = '.$object->contextId);
         }
     }
     if (count($this->publishChangeObjects) > 0) {
         foreach ($this->publishChangeObjects as $object) {
             $data = array(DBConvertor::convertCase('publish_change') => '1');
             $where = 'agent_id = ' . $this->agent->agentId . ' and object_type_id = ' . $object->objectId . ' and context_id = ' . $object->contextId;
             $agt_pro->update($data, $where);
             //                $db->update('agent_provisions', $data, 'agent_id = '.$this->agent->agentId.' and object_type_id = '.$object->objectId.' and context_id = '.$object->contextId);
         }
     }
     if (count($this->publishDeleteObjects) > 0) {
         foreach ($this->publishDeleteObjects as $object) {
             $data = array(DBConvertor::convertCase('publish_delete') => '1');
             $where = 'agent_id = ' . $this->agent->agentId . ' and object_type_id = ' . $object->objectId . ' and context_id = ' . $object->contextId;
             $agt_pro->update($data, $where);
             //                $db->update('agent_provisions', $data, 'agent_id = '.$this->agent->agentId.' and object_type_id = '.$object->objectId.' and context_id = '.$object->contextId);
         }
     }
 }
コード例 #11
0
ファイル: Event.php プロジェクト: Koulio/OpenZIS
 private function publishEvent($agentId, $objectName, $objectAction, $version, $m)
 {
     $db = Zend_Registry::get('my_db');
     $dom = $m->dom;
     $event_destination_found = false;
     $headerNode = $m->headerNode;
     $originalMsgId = $m->msgId;
     $originalSourceId = $m->sourceId;
     $originalTimestamp = $headerNode->getElementsByTagName('SIF_Timestamp')->item(0)->nodeValue;
     $dataObject = new DataObject($objectName);
     $actionId = Event::getActionId($objectAction);
     $query = "select agent_subscriptions.agent_id,\r\n\t\t\t \t\t\t agent_registered.agent_mode_id,\r\n\t\t\t \t\t\t agent_registered.sif_version,\r\n\t\t\t \t\t\t agent_registered.maxbuffersize,\r\n\t\t     \t\t\t agent.source_id\r\n\t\t    \t\tfrom " . DBConvertor::convertCase('agent_subscriptions') . "\r\n\t\t   \t\t\tinner join " . DBConvertor::convertCase('agent_registered') . " on agent_registered.agent_Id = agent_subscriptions.agent_id and agent_registered.unregister_timestamp is null\r\n\t\t   \t\t\tinner join " . DBConvertor::convertCase('agent') . " on agent.agent_id = agent_subscriptions.agent_id\r\n\t\t   \t\t\twhere agent_subscriptions.zone_id = " . $_SESSION["ZONE_ID"] . "\r\n\t\t\t\t\t\tand agent_subscriptions.object_type_id = " . $dataObject->objectId . "\r\n\t\t     \t\t\tand agent_subscriptions.context_id = " . $_SESSION["CONTEXT_ID"] . "\r\n\t\t     \t\t\tand agent_subscriptions.context_id = agent_registered.context_id \r\n\t\t     \t\t\tand agent_subscriptions.zone_id = agent_registered.zone_id";
     if ($m->destinationIdFound == true) {
         $query = $query . " and agent.source_id = '" . $m->destinationId . "'";
     }
     $result = $db->fetchAll($query);
     foreach ($result as $row) {
         $error = false;
         $event_destination_found = true;
         switch (DB_TYPE) {
             case 'mysql':
                 $agent_id = intval($row->agent_id);
                 $maxbuffersize = intval($row->maxbuffersize);
                 $source_id = $row->source_id;
                 $agent_mode_id = intval($row->agent_mode_id);
                 $agent_version = $row->sif_version;
                 break;
             case 'oci8':
                 $agent_id = intval($row->AGENT_ID);
                 $maxbuffersize = intval($row->MAXBUFFERSIZE);
                 $source_id = $row->SOURCE_ID;
                 $agent_mode_id = intval($row->AGENT_MODE_ID);
                 $agent_version = $row->SIF_VERSION;
                 break;
         }
         $sifMessageNode = $dom->getElementsByTagName('SIF_Message')->item(0);
         $eventXML = $dom->saveXML($sifMessageNode);
         $eventXML = str_replace('xmlns="http://www.sifinfo.org/uk/infrastructure/2.x" ', '', $eventXML);
         $eventXML = str_replace('xmlns="http://www.sifinfo.org/infrastructure/2.x" ', '', $eventXML);
         $eventXML = str_replace('xmlns="http://www.sifinfo.org/infrastructure/1.x" ', '', $eventXML);
         $eventXML = str_replace('xmlns:sif="http://www.sifinfo.org/infrastructure/2.x" ', '', $eventXML);
         $eventXML = str_replace('xmlns:sif="http://www.sifinfo.org/infrastructure/1.x" ', '', $eventXML);
         $eventXML = str_replace('xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ', '', $eventXML);
         $messageSize = strlen($eventXML);
         if ($messageSize > $maxbuffersize) {
             SifLogEntry::CreateSifLogEvents($header, '4', '2', 'Buffer size of agent ' . $row->source_id . ' is too small to recieve this event [size : ' . $row->maxbuffersize . ']');
             $error = true;
         }
         if ($version != $agent_version) {
             SifLogEntry::CreateSifLogEvents($header, '4', '4', 'Version in event not supported by agent ' . $source_id);
             $error = true;
         }
         if (!$error) {
             $data = array(DBConvertor::convertCase('insert_timestamp') => new Zend_Db_Expr(DBConvertor::convertCurrentTime()), DBConvertor::convertCase('msg_id') => $originalMsgId, DBConvertor::convertCase('agt_id_in') => $agentId, DBConvertor::convertCase('msg_type') => 3, DBConvertor::convertCase('status_id') => 1, DBConvertor::convertCase('agt_id_out') => $agent_id, DBConvertor::convertCase('data') => $eventXML, DBConvertor::convertCase('object_id') => $dataObject->objectId, DBConvertor::convertCase('action_id') => $actionId, DBConvertor::convertCase('agt_mode_id') => $agent_mode_id, DBConvertor::convertCase('zone_id') => $_SESSION["ZONE_ID"], DBConvertor::convertCase('context_id') => $_SESSION["CONTEXT_ID"]);
             $db->insert(DBConvertor::convertCase('messagequeue'), $data);
         }
     }
     if ($event_destination_found == false) {
         GeneralError::genericError($m, "11", "1", "Generic Error", "SIF DestinationId not found.");
     }
 }
コード例 #12
0
ファイル: archive.php プロジェクト: Koulio/OpenZIS
}
try {
    $select = $db->select()->from(DBConvertor::convertCase('zit_log'))->where('archived = 1');
    $stmt = $db->query($select);
    $result2 = $stmt->fetchAll();
} catch (Zend_Exception $e) {
    echo "Caught exception: " . get_class($e) . "\n";
    echo "Message: " . $e->getMessage() . "\n";
}
foreach ($result2 as $row) {
    switch (DB_TYPE) {
        case 'mysql':
            $id = $row->log_id;
            $data = array('log_id' => $row->log_id, 'log_message_type_id' => $row->log_message_type_id, 'agent_id' => $row->agent_id, 'archived' => $row->archived, 'create_timestamp' => $row->create_timestamp, 'rec_xml' => $row->rec_xml, 'sent_xml' => $row->sent_xml, 'sif_message_type_id' => $row->sif_message_type_id, 'zone_id' => $row->zone_id);
            break;
        case 'oci8':
            $id = $row->LOG_ID;
            $rec_xml = $row->REC_XML;
            $sent_xml = $row->SENT_XML;
            $data = array('LOG_ID' => $row->LOG_ID, 'LOG_MESSAGE_TYPE_ID' => $row->LOG_MESSAGE_TYPE_ID, 'AGENT_ID' => $row->AGENT_ID, 'ARCHIVED' => $row->ARCHIVED, 'CREATE_TIMESTAMP' => $row->CREATE_TIMESTAMP, 'REC_XML' => $rec_xml->read($rec_xml->size()), 'SENT_XML' => $sent_xml->read($sent_xml->size()), 'SIF_MESSAGE_TYPE_ID' => $row->SIF_MESSAGE_TYPE_ID, 'ZONE_ID' => $row->ZONE_ID);
            break;
    }
    try {
        $db->insert(DBConvertor::convertCase('zit_log_archive'), $data);
    } catch (Zend_Exception $e) {
        echo "Caught exception: " . get_class($e) . "\n";
        echo "Message: " . $e->getMessage() . "\n";
    }
}
?>
Finished!
コード例 #13
0
ファイル: Zone.php プロジェクト: neilberget/OpenZIS
 public static function updateZone($description, $sourceId, $zoneId, $versionId, $zoneAuthenticationType)
 {
     //$db = ZitDBAdapter::getDBAdapter();
     $db = Zend_Registry::get('my_db');
     if (Zone::updatingVersion($zoneId, $versionId)) {
         Zone::deleteAllPermissions_subscriptions_provisions_requests_responds($zoneId);
         Zone::unregisterAllAgents($zoneId);
     }
     $data = array(DBConvertor::convertCase('zone_desc') => $description, DBConvertor::convertCase('source_id') => $sourceId, DBConvertor::convertCase('ZONE_AUTHENTICATION_TYPE_ID') => $zoneAuthenticationType, DBConvertor::convertCase('update_timestamp') => new Zend_Db_Expr(DBConvertor::convertCurrentTime()), DBConvertor::convertCase('version_id') => $versionId);
     $n = $db->update(DBConvertor::convertCase('zones'), $data, 'zone_id = ' . $zoneId);
     $frontendOptions = array('lifetime' => Null);
     $backendOptions = array('cache_dir' => CACHE);
     $cache = Zend_Cache::factory('Output', 'File', $frontendOptions, $backendOptions);
     $cacheID = 'DataObject1Navigation';
     $cache->clean(Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG, array($cacheID));
 }
コード例 #14
0
 public static function getGroupItems($groupId)
 {
     $db = Zend_Registry::get('my_db2');
     $items = array();
     //		$query = "select ".DBConvertor::convertCase('GROUP_PERMISSION_ITEM_ID')." from ".DBConvertor::convertCase('group_permission_item')." where group_permission_id = $groupId order by object_id";
     $query = "select " . DBConvertor::convertCase('GROUP_PERMISSION_ITEM_ID') . " from " . DBConvertor::convertCase('group_permission_item') . " where group_permission_id = {$groupId} order by group_permission_item_id";
     $result = $db->fetchAll($query);
     foreach ($result as $row) {
         switch (DB_TYPE) {
             case 'mysql':
                 $groupPermissionItem = new GroupPermissionItem($row->group_permission_item_id);
                 break;
             case 'oci8':
                 $groupPermissionItem = new GroupPermissionItem($row->GROUP_PERMISSION_ITEM_ID);
                 break;
         }
         array_push($items, $groupPermissionItem);
     }
     return $items;
 }
コード例 #15
0
ファイル: Event2.php プロジェクト: Koulio/OpenZIS
 private function publishEvent($agentId, $objectName, $objectAction, $version, $header)
 {
     $db = Zend_Registry::get('my_db');
     $dom = $this->dom;
     $dataObject = new DataObject($objectName);
     $actionId = Event::getActionId($objectAction);
     $query = "select agent_subscriptions.agent_id,\r\n\t\t\t \t\t\t agent_registered.agent_mode_id,\r\n\t\t\t \t\t\t agent_registered.sif_version,\r\n\t\t\t \t\t\t agent_registered.maxbuffersize,\r\n\t\t     \t\t\t agent.source_id\r\n\t\t    \t\tfrom " . DBConvertor::convertCase('agent_subscriptions') . "\r\n\t\t   \t\t\tinner join \r\n\t\t\t\t\t\t" . DBConvertor::convertCase('agent_registered') . " on agent_registered.agent_Id = agent_subscriptions.agent_id\r\n\t\t     \t\t\tand agent_registered.unregister_timestamp is null\r\n\t\t   \t\t\tinner join " . DBConvertor::convertCase('agent') . " on agent.agent_id = agent_subscriptions.agent_id\r\n\t\t   \t\t\twhere agent_subscriptions.object_type_id = " . $dataObject->objectId . " \r\n\t\t     \t\t\tand agent_subscriptions.context_id = " . $_SESSION["CONTEXT_ID"] . " \r\n\t\t     \t\t\tand agent_subscriptions.zone_id = " . $_SESSION["ZONE_ID"] . "\r\n\t\t     \t\t\tand agent_subscriptions.context_id = agent_registered.context_id \r\n\t\t     \t\t\tand agent_subscriptions.zone_id = agent_registered.zone_id";
     $result = $db->fetchAll($query);
     foreach ($result as $row) {
         $error = false;
         switch (DB_TYPE) {
             case 'mysql':
                 $agent_id = intval($row->agent_id);
                 $maxbuffersize = intval($row->maxbuffersize);
                 $source_id = $row->source_id;
                 $agent_mode_id = intval($row->agent_mode_id);
                 $agent_version = $row->sif_version;
                 break;
             case 'oci8':
                 $agent_id = intval($row->AGENT_ID);
                 $maxbuffersize = intval($row->MAXBUFFERSIZE);
                 $source_id = $row->SOURCE_ID;
                 $agent_mode_id = intval($row->AGENT_MODE_ID);
                 $agent_version = $row->SIF_VERSION;
                 break;
         }
         //            $filterUtility = new FilterUtility();
         //            $filterUtility->FilterCommonElements($dataObject->objectId, $dom, $agent_id);
         $sifMessageNode = $dom->getElementsByTagName('SIF_Message')->item(0);
         $eventXML = $dom->saveXML($sifMessageNode);
         $eventXML = str_replace('xmlns="http://www.sifinfo.org/uk/infrastructure/2.x" ', '', $eventXML);
         $eventXML = str_replace('xmlns="http://www.sifinfo.org/infrastructure/2.x" ', '', $eventXML);
         $eventXML = str_replace('xmlns="http://www.sifinfo.org/infrastructure/1.x" ', '', $eventXML);
         $eventXML = str_replace('xmlns:sif="http://www.sifinfo.org/infrastructure/2.x" ', '', $eventXML);
         $eventXML = str_replace('xmlns:sif="http://www.sifinfo.org/infrastructure/1.x" ', '', $eventXML);
         $messageSize = strlen($eventXML);
         if ($messageSize > $maxbuffersize) {
             SifLogEntry::CreateSifLogEvents($header, '4', '2', 'Buffer size of agent ' . $row->source_id . ' is too small to recieve this event [size : ' . $row->maxbuffersize . ']');
             $error = true;
         }
         if ($version != $agent_version) {
             SifLogEntry::CreateSifLogEvents($header, '4', '4', 'Version in event not supported by agent ' . $source_id);
             $error = true;
         }
         if (!$error) {
             $data = array(DBConvertor::convertCase('event_timestamp') => new Zend_Db_Expr(DBConvertor::convertCurrentTime()), DBConvertor::convertCase('agent_id_sender') => $agentId, DBConvertor::convertCase('agent_id_rec') => $agent_id, DBConvertor::convertCase('event_data') => $eventXML, DBConvertor::convertCase('object_id') => $dataObject->objectId, DBConvertor::convertCase('action_id') => $actionId, DBConvertor::convertCase('agent_mode_id') => $agent_mode_id, DBConvertor::convertCase('zone_id') => $_SESSION["ZONE_ID"], DBConvertor::convertCase('context_id') => $_SESSION["CONTEXT_ID"]);
             $db->insert(DBConvertor::convertCase('event'), $data);
         }
     }
 }
コード例 #16
0
ファイル: Request.php プロジェクト: neilberget/OpenZIS
 private function setupRequest($objectName, $sourceId, $agent)
 {
     $db = ZitDBAdapter::getDBAdapter();
     $dom = $this->dom;
     $providerId = null;
     if ($sourceId != null) {
         $agent = new Agent($sourceId);
         $providerId = $agent->agentId;
     } else {
         $providerId = DataObject::getProviderId($objectName);
     }
     if ($providerId == 0) {
         RequestError::invalidProvider($this->originalSourceId, $this->originalMsgId);
     } else {
         $error = false;
         $sifMessageNode = $dom->getElementsByTagName('SIF_Message')->item(0);
         $eventXML = $dom->saveXML($sifMessageNode);
         $eventXML = str_replace('xmlns:sif="http://www.sifinfo.org/infrastructure/2.x" ', '', $eventXML);
         $eventXML = str_replace('xmlns="http://www.sifinfo.org/infrastructure/2.x" ', '', $eventXML);
         $eventXML = str_replace('xmlns:sif="http://www.sifinfo.org/infrastructure/1.x" ', '', $eventXML);
         $eventXML = str_replace('xmlns="http://www.sifinfo.org/infrastructure/1.x" ', '', $eventXML);
         $eventXML = str_replace('xmlns="http://www.sifinfo.org/uk/infrastructure/2.x" ', '', $eventXML);
         $eventXML = str_replace('xmlns="http://www.sifinfo.org/au/infrastructure/2.x" ', '', $eventXML);
         $eventXML = str_replace('xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ', '', $eventXML);
         $messageId = $dom->getElementsByTagName('SIF_MsgId')->item(0)->nodeValue;
         $bufferSize = $dom->getElementsByTagName('SIF_MaxBufferSize')->item(0)->nodeValue;
         /*
         PUSH all messages to the ZONE Version:
         DO NOT Check Message Version:
         */
         $version = $_SESSION['ZONE_VERSION'];
         $query = "select\r\n                            agent_registered.sif_version,\r\n                            agent_registered.maxbuffersize,\r\n                            agent_registered.agent_mode_id,\r\n                            agent.source_id\r\n                      from " . DBConvertor::convertCase('agent_registered') . " \r\n                      inner join " . DBConvertor::convertCase('agent') . " on agent.agent_id = agent_registered.agent_id\r\n                      where agent_registered.agent_id = {$providerId} and agent_registered.unregister_timestamp is null\r\n                      and   agent_registered.zone_id = " . $_SESSION["ZONE_ID"] . "\r\n                      and   agent_registered.context_id = " . $_SESSION["CONTEXT_ID"];
         $result = $db->fetchAll($query);
         switch (DB_TYPE) {
             case 'mysql':
                 $agentModeId = $result[0]->agent_mode_id;
                 $maxbuffersize = intval($result[0]->maxbuffersize);
                 $source_id = $result[0]->source_id;
                 $sif_version = $result[0]->sif_version;
                 break;
             case 'oci8':
                 $agentModeId = $result[0]->AGENT_MODE_ID;
                 $maxbuffersize = intval($result[0]->MAXBUFFERSIZE);
                 $source_id = $result[0]->SOURCE_ID;
                 $sif_version = $result[0]->SIF_VERSION;
                 break;
         }
         $messageSize = strlen($eventXML);
         if ($messageSize > $maxbuffersize) {
             $error = true;
             $header = $this->headerNode;
             SifLogEntry::CreateSifLogEvents($header, '4', '2', 'Buffer size of agent ' . $source_id . ' is too small to recieve this request [size : ' . $maxbuffersize . ']');
         }
         /*
                     if($version != '2.*') {
                         if($version != $sif_version) {
                             $header = $this->headerNode;
         					$error = true;
                             SifLogEntry::CreateSifLogEvents($header,
                                     '4',
                                     '4',
                                     'Version in request not supported by agent '.$source_id
                             );
                         }
                     } else {
         				$version = $_SESSION['ZONE_VERSION'];
         			}
         */
         if (!$error) {
             $dataObject = new DataObject($objectName);
             #				$request = new Requests($db);
             #                $data = array(
             #                        DBConvertor::convertCase('request_msg_id')      => $messageId,
             #                        DBConvertor::convertCase('request_timestamp')   => new Zend_Db_Expr(DBConvertor::convertCurrentTime()),
             #                        DBConvertor::convertCase('agent_id_requester')  => $agent->agentId,
             #                        DBConvertor::convertCase('agent_id_responder')  => intval($providerId),
             #                        DBConvertor::convertCase('request_data')        => $eventXML,
             #                        DBConvertor::convertCase('max_buffer_size')     => $bufferSize,
             #                        DBConvertor::convertCase('version')				=> $version,
             #                        DBConvertor::convertCase('agent_mode_id')		=> intval($agentModeId),
             #                        DBConvertor::convertCase('zone_id')         	=> $_SESSION["ZONE_ID"],
             #                        DBConvertor::convertCase('context_id')			=> $_SESSION["CONTEXT_ID"]
             #                );
             #                $request->insert($data);
             $messagequeue = new MessageQueues($db);
             $data = null;
             $data = array(DBConvertor::convertCase('msg_id') => $messageId, DBConvertor::convertCase('msg_type') => 1, DBConvertor::convertCase('status_id') => 1, DBConvertor::convertCase('insert_timestamp') => new Zend_Db_Expr(DBConvertor::convertCurrentTime()), DBConvertor::convertCase('agt_id_in') => intval($agent->agentId), DBConvertor::convertCase('agt_id_out') => intval($providerId), DBConvertor::convertCase('data') => $eventXML, DBConvertor::convertCase('maxbuffersize') => intval($bufferSize), DBConvertor::convertCase('version') => $version, DBConvertor::convertCase('agt_mode_id') => intval($agentModeId), DBConvertor::convertCase('zone_id') => $_SESSION["ZONE_ID"], DBConvertor::convertCase('context_id') => $_SESSION["CONTEXT_ID"]);
             $messagequeue->insert($data);
         }
         $timestamp = Utility::createTimestamp();
         $msgId = Utility::createMessageId();
         $sifMessageNode = $dom->getElementsByTagName('SIF_Message')->item(0);
         XmlHelper::buildSuccessMessage($msgId, $timestamp, $this->originalSourceId, $this->originalMsgId, 0, $originalMsg = null, $desc = null);
     }
     //invalid provider check
 }
コード例 #17
0
ファイル: GroupPermission.php プロジェクト: Koulio/OpenZIS
 public static function getGroups()
 {
     $db = Zend_Registry::get('my_db2');
     $groups = array();
     $query = "select group_permission_id from " . DBConvertor::convertCase('group_permission') . " where admin_id = " . $_SESSION['ADMIN_ID'];
     $result = $db->fetchAll($query);
     foreach ($result as $row) {
         switch (DB_TYPE) {
             case 'mysql':
                 $groupPermission = new GroupPermission($row->group_permission_id);
                 break;
             case 'oci8':
                 $groupPermission = new GroupPermission($row->GROUP_PERMISSION_ID);
                 break;
         }
         array_push($groups, $groupPermission);
     }
     return $groups;
 }
コード例 #18
0
ファイル: DataObject.php プロジェクト: neilberget/OpenZIS
 public static function updateEvent($agentId, $orginalMsgId, $msgId)
 {
     $db = Zend_Registry::get('my_db');
     #		$event = new Events($db);
     #
     #        $data = array(
     #                DBConvertor::convertCase('status_id') => 3
     #        );
     #        $where = "msg_id = '".$orginalMsgId."'";
     #        $res = $event->update($data, $where);
     #        if($res != 1) {
     #			$response = new Responses($db);
     #            $res2 = $response->update($data, $where);
     #            if($res2 != 1) {
     #				$request = new Requests($db);
     #                return $request->update($data, $where);
     #            }
     #            else {
     #                return $res2;
     #            }
     #        }
     #        else {
     #            return $res;
     #        }
     #    }
     $message = new MessageQueues($db);
     $data = array(DBConvertor::convertCase('status_id') => 3, DBConvertor::convertCase('ack_msg_id') => $msgId);
     $where = "msg_id = '" . $orginalMsgId . "'";
     return $message->update($data, $where);
 }
コード例 #19
0
ファイル: Zit.php プロジェクト: neilberget/OpenZIS
 public static function ArchiveMessages()
 {
     //$db = ZitDBAdapter::getDBAdapter();
     $db = Zend_Registry::get('my_db');
     $data = array(DBConvertor::convertCase('archived') => 1);
     $n = $db->update(DBConvertor::convertCase('error_log'), $data);
 }
コード例 #20
0
ファイル: ZitAdmin.php プロジェクト: Koulio/OpenZIS
 public static function getAllAdmins()
 {
     //$db = ZitDBAdapter::getDBAdapter();
     $db = Zend_Registry::get('my_db2');
     $admins = array();
     $sql = "select admin_id from " . DBConvertor::convertCase("zit_admin") . " order by admin_username";
     $result = $db->fetchAll($sql);
     foreach ($result as $row) {
         switch (DB_TYPE) {
             case 'mysql':
                 $admin_id = $row->admin_id;
                 break;
             case 'oci8':
                 $admin_id = $row->ADMIN_ID;
                 break;
         }
         $admin = new ZitAdmin($admin_id);
         array_push($admins, $admin);
     }
     return $admins;
 }
コード例 #21
0
ファイル: Permission.php プロジェクト: Koulio/OpenZIS
 public static function getAllSubscribedPermissions($agentId, $zoneId, $contextId)
 {
     //$db = ZitDBAdapter::getDBAdapter();
     $db = Zend_Registry::get('my_db');
     $permissions = array();
     $select = null;
     $select = "SELECT p.permission_id " . "  FROM " . DBConvertor::convertCase('AGENT_PERMISSIONS') . " p " . " INNER JOIN " . DBConvertor::convertCase('DATA_OBJECT') . " d ON p.object_id = d.object_id " . " WHERE (p.agent_id = {$agentId} ) and (p.context_id =  {$contextId} ) and (p.zone_id = {$zoneId}) and p.can_subscribe = 1" . " ORDER BY d.object_name ASC";
     /*        $select = $db->select()
                         ->from(array('p' => 'agent_permissions'),array('p.permission_id'))
                         ->join(array('d' => 'data_object'), 'p.object_id = d.object_id')
                         ->where('p.agent_id = ?', $agentId)
                         ->where('p.context_id = ?', $contextId)
                         ->where('p.zone_id = ?', $zoneId)
                         ->where('p.can_subscribe = 1')
                         ->order('d.object_name');
     
             $stmt = $select->query();
     */
     $result = $db->fetchAll($select);
     foreach ($result as $row) {
         switch (DB_TYPE) {
             case 'mysql':
                 $permission_id = $row->permission_id;
                 break;
             case 'oci8':
                 $permission_id = $row->PERMISSION_ID;
                 break;
         }
         $permission = new Permission($permission_id);
         array_push($permissions, $permission);
     }
     return $permissions;
 }
コード例 #22
0
ファイル: Response.php プロジェクト: neilberget/OpenZIS
 private function setupResponseNew($agent, $msgId, $m)
 {
     $dom = $m->dom;
     $dataObject = null;
     $db = Zend_Registry::get('my_db');
     $requesterId = RequestObject::getRequesterId($msgId);
     $agentModeId = RequestObject::getRequesterAgentMode($msgId);
     try {
         $sifObjectDataNode = $dom->getElementsByTagName('SIF_ObjectData')->item(0);
         $children = isset($sifObjectDataNode->childNodes) ? $sifObjectDataNode->childNodes : '';
         if (is_object($children)) {
             $objectName = isset($children->item(0)->nodeName) ? $children->item(0)->nodeName : null;
         } else {
             $objectName = null;
             ZitLog::writeToErrorLog('[SIF_ObjectData Error]', 'No SIF_ObjectData found from agent = ' . $agent->sourceId, $this->xmlStr);
             GeneralError::systemError($this->xmlStr);
         }
         $dataObject = new DataObject($objectName);
     } catch (Exception $e) {
         ZitLog::writeToErrorLog('[Error processing message]', "DataObject Name: " . $objectName . "\nError Message\n" . $e->getMessage() . "\n\nStack Trace\n" . $e->getTraceAsString() . ' ' . $this->xmlStr, 'Process Message', $_SESSION['ZONE_ID']);
         GeneralError::systemError($this->xmlStr);
     }
     $sifMessageNode = $dom->getElementsByTagName('SIF_Message')->item(0);
     $responseXml = $dom->saveXML($sifMessageNode);
     $responseXml = str_replace('xmlns="http://www.sifinfo.org/infrastructure/1.x"', '', $responseXml);
     $responseXml = str_replace('xmlns:sif="http://www.sifinfo.org/infrastructure/1.x"', '', $responseXml);
     $responseXml = str_replace('xmlns="http://www.sifinfo.org/infrastructure/2.x" ', '', $responseXml);
     $responseXml = str_replace('xmlns="http://www.sifinfo.org/uk/infrastructure/2.x" ', '', $responseXml);
     $responseXml = str_replace('xmlns="http://www.sifinfo.org/au/infrastructure/2.x" ', '', $responseXml);
     $responseXml = str_replace('xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ', '', $responseXml);
     #        $data = array(
     #                DBConvertor::convertCase('request_msg_id')      => $msgId,
     #                DBConvertor::convertCase('response_data')       => $responseXml,
     #                DBConvertor::convertCase('next_packet_num')     => '2',
     #                DBConvertor::convertCase('status_id')           => '1',
     #                DBConvertor::convertCase('agent_id_requester')  => intval($requesterId),
     #                DBConvertor::convertCase('agent_id_responder')  => $agent->agentId,
     #                DBConvertor::convertCase('agent_mode_id')       => intval($agentModeId),
     #                DBConvertor::convertCase('zone_id')         	=> $_SESSION["ZONE_ID"],
     #                DBConvertor::convertCase('context_id')     	 	=> $_SESSION["CONTEXT_ID"]
     #        );
     #        $db->insert(DBConvertor::convertCase('response'), $data);
     /*          Removing the filterUtility as it should be reworked.	
     			$filterUtility = new FilterUtility();
                 $filterUtility->FilterCommonElements($dataObject->objectId, $dom, intval($requesterId));
     */
     try {
         $this->xslt = null;
         $permissions = new AgentPermissions($db);
         $where = "object_id = " . $dataObject->objectId . " and agent_id = " . $requesterId . " and zone_id = " . $_SESSION['ZONE_ID'] . " and context_id = " . $_SESSION['CONTEXT_ID'];
         $result = $permissions->fetchAll($where);
         switch (DB_TYPE) {
             case 'mysql':
                 $this->xslt = isset($result[0]->xslt) ? $result[0]->xslt : null;
                 break;
             case 'oci8':
                 $this->xslt = isset($result[0]->XSLT) ? $result[0]->XSLT : null;
                 break;
         }
         if ($this->xslt != null) {
             $xsltpro = new XSLTProcessor();
             $XSL = new DOMDocument();
             $XSL->loadXML($this->xslt);
             $xsltpro->importStylesheet($XSL);
             $XML = new DOMDocument();
             $XML->loadXML($responseXml);
             $responseXml = $xsltpro->transformToXML($XML);
         }
         $responseXml = str_replace('<?xml version="1.0"?>' . "\n", '', $responseXml);
     } catch (Zend_Exception $e) {
         ZitLog::writeToErrorLog('[Error filtering message]', "DataObject Name: " . $objectName . "\nError Message\n" . $e->getMessage() . "\n\nStack Trace\n" . $e->getTraceAsString() . ' ' . $this->xmlStr, 'Process Message', $_SESSION['ZONE_ID']);
         GeneralError::systemError($this->xmlStr);
     }
     $messagequeue = new MessageQueues($db);
     $data = null;
     $data = array(DBConvertor::convertCase('msg_id') => $this->originalMsgId, DBConvertor::convertCase('ref_msg_id') => $msgId, DBConvertor::convertCase('msg_type') => 2, DBConvertor::convertCase('status_id') => '1', DBConvertor::convertCase('version') => $_SESSION['ZONE_VERSION'], DBConvertor::convertCase('insert_timestamp') => new Zend_Db_Expr(DBConvertor::convertCurrentTime()), DBConvertor::convertCase('agt_id_in') => $agent->agentId, DBConvertor::convertCase('agt_id_out') => intval($requesterId), DBConvertor::convertCase('data') => $responseXml, DBConvertor::convertCase('next_packet_num') => 2, DBConvertor::convertCase('agt_mode_id') => intval($agentModeId), DBConvertor::convertCase('zone_id') => $_SESSION["ZONE_ID"], DBConvertor::convertCase('context_id') => $_SESSION["CONTEXT_ID"]);
     $messagequeue->insert($data);
     $timestamp = Utility::createTimestamp();
     $msgId = Utility::createMessageId();
     XmlHelper::buildSuccessMessage($msgId, $timestamp, $this->originalSourceId, $this->originalMsgId, 0, $originalMsg = null, $desc = null);
 }
コード例 #23
0
ファイル: Agent.php プロジェクト: Koulio/OpenZIS
 public function wakeup()
 {
     $db = Zend_Registry::get('my_db');
     $ra = new AgentRegistered($db);
     $data = array(DBConvertor::convertCase('asleep') => new Zend_Db_Expr('0'), DBConvertor::convertCase('frozen') => 0);
     $n = $ra->update($data, 'agent_id = ' . $this->agentId . ' and unregister_timestamp is null and context_id = ' . $_SESSION['CONTEXT_ID'] . ' and zone_id = ' . $_SESSION['ZONE_ID']);
     if ($n == 1) {
         return true;
     } else {
         return false;
     }
 }
コード例 #24
0
ファイル: SystemControl.php プロジェクト: Koulio/OpenZIS
 private function buildProviders($domElement, $dom)
 {
     $db = ZitDBAdapter::getDBAdapter();
     $query = "select distinct\r\n\t\t\t\t a.agent_id,\r\n\t\t\t\t a.source_id\r\n\t\t\t\t from\r\n\t\t\t\t " . DBConvertor::convertCase('agent_provisions') . " p,\r\n\t\t\t\t " . DBConvertor::convertCase('agent') . " a\r\n\t\t\t\t where p.zone_id = " . $_SESSION['ZONE_ID'] . "\r\n\t\t\t\t and p.context_id = " . $_SESSION['CONTEXT_ID'] . "\r\n\t\t\t\t and a.agent_id = p.agent_id";
     $result = $db->fetchAll($query);
     foreach ($result as $row) {
         $sifProviderNode = $dom->createElement('SIF_Provider');
         switch (DB_TYPE) {
             case 'mysql':
                 $sifProviderNode->setAttribute('SourceId', $row->source_id);
                 $agt = $row->agent_id;
                 break;
             case 'oci8':
                 $sifProviderNode->setAttribute('SourceId', $row->SOURCE_ID);
                 $agt = $row->AGENT_ID;
                 break;
         }
         $query2 = "select\r\n\t\t\t\t\t   o.object_name,\r\n\t\t\t\t\t   c.context_desc\r\n\t\t\t\t\t   from\r\n\t\t\t\t\t   " . DBConvertor::convertCase('data_object') . " o,\r\n\t\t\t\t\t   " . DBConvertor::convertCase('agent_provisions') . " a,\r\n\t\t\t\t\t   " . DBConvertor::convertCase('context') . " c\r\n\t\t\t\t\t   where\r\n\t\t\t\t\t   a.zone_id = " . $_SESSION['ZONE_ID'] . "\r\n\t\t\t\t\t   and\r\n\t\t\t\t\t   a.context_id = " . $_SESSION['CONTEXT_ID'] . "\r\n\t\t\t\t\t   and\r\n\t\t\t\t\t   a.agent_id = " . $agt . "\r\n\t\t\t\t\t   and o.object_id = a.object_type_id\r\n\t\t\t\t\t   and a.context_id = c.context_id order by o.object_id";
         $objectListNode = $dom->createElement('SIF_ObjectList');
         $sifProviderNode->appendChild($objectListNode);
         $result2 = $db->fetchAll($query2);
         $currentObjectName = '';
         $oldNode = null;
         foreach ($result2 as $row2) {
             switch (DB_TYPE) {
                 case 'mysql':
                     $objectName = $row2->object_name;
                     $contextDesc = $row2->context_desc;
                     break;
                 case 'oci8':
                     $objectName = $row2->OBJECT_NAME;
                     $contextDesc = $row2->CONTEXT_DESC;
                     break;
             }
             if ($objectName != $currentObjectName) {
                 $sifObjectNode = $dom->createElement('SIF_Object');
                 $sifObjectNode->setAttribute('ObjectName', $objectName);
                 $sifExtednedQueryNode = $dom->createElement('SIF_ExtendedQuerySupport');
                 $sifExtednedQueryNode->appendChild($dom->createTextNode('false'));
                 $sifObjectNode->appendChild($sifExtednedQueryNode);
                 $sifContextsNode = $dom->createElement('SIF_Contexts');
             } else {
                 $sifContextsNode = $oldNode;
             }
             $sifContextNode = $dom->createElement('SIF_Context');
             $text = $dom->createTextNode($contextDesc);
             $sifContextNode->appendChild($text);
             $sifContextsNode->appendChild($sifContextNode);
             if ($objectName != $currentObjectName) {
                 $sifObjectNode->appendChild($sifContextsNode);
                 $objectListNode->appendChild($sifObjectNode);
             }
             $currentObjectName = $objectName;
             $oldNode = $sifContextsNode;
         }
         //get all objects
         $domElement->appendChild($sifProviderNode);
     }
     //get all agent providers
     return $domElement;
 }
コード例 #25
0
ファイル: Agent.php プロジェクト: Koulio/OpenZIS
 public static function updateAgent($name, $sourceId, $username, $password, $agentId, $ipaddress, $maxbuffersize, $active)
 {
     $empty = null;
     $db = Zend_Registry::get('my_db');
     $data = array(DBConvertor::convertCase('agent_name') => $name, DBConvertor::convertCase('source_id') => $sourceId, DBConvertor::convertCase('active') => $active);
     $data[DBConvertor::convertCase('username')] = $username;
     $data[DBConvertor::convertCase('password')] = $password;
     $data[DBConvertor::convertCase('ipaddress')] = $ipaddress;
     $data[DBConvertor::convertCase('maxbuffersize')] = $maxbuffersize;
     $n = $db->update(DBConvertor::convertCase('agent'), $data, 'agent_id = ' . $agentId);
     $frontendOptions = array('lifetime' => Null);
     $backendOptions = array('cache_dir' => CACHE);
     $cache = Zend_Cache::factory('Output', 'File', $frontendOptions, $backendOptions);
     $cacheID = 'Zone1BuildNavigation' . $_SESSION['ADMIN_ID'];
     $cache->remove($cacheID);
     $cache->remove('Zone1BuildNavigation1');
 }
コード例 #26
0
ファイル: DataObjectGroup.php プロジェクト: Koulio/OpenZIS
 public static function getAllDataObjectGroups()
 {
     $dataObjectGroups = array();
     $db = Zend_Registry::get('my_db2');
     $query = "select " . DBConvertor::convertCase('group_id') . " from " . DBConvertor::convertCase('data_object_group') . " order by group_desc";
     $result = $db->fetchAll($query);
     foreach ($result as $row) {
         switch (DB_TYPE) {
             case 'mysql':
                 $object = new DataObjectGroup($row->group_id);
                 break;
             case 'oci8':
                 $object = new DataObjectGroup($row->GROUP_ID);
                 break;
         }
         array_push($dataObjectGroups, $object);
     }
     return $dataObjectGroups;
 }