예제 #1
1
 function updateDb()
 {
     $params = array();
     $toReturn = array();
     $toReturn['updated'] = true;
     $toReturn['message'] = "";
     $db = new RecordSet($this->dbConnectionInfo, false, true);
     $rows = $db->Open("SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA =  '" . $this->dbConnectionInfo['dbName'] . "' AND TABLE_NAME =  'webhelp'");
     if ($rows > 0) {
         $db->Open("SELECT * FROM webhelp;");
         while ($db->MoveNext()) {
             $assoc = $db->getAssoc();
             $params[$db->Field("parameter")] = $db->Field("value");
         }
         $db->Close();
         if ($params['databaseVersion'] != '1') {
             $toReturn['updated'] = false;
             $toReturn['message'] = "Incompatible database version found!";
         }
     } else {
         $toReturn['updated'] = false;
         $toReturn['message'] = "Database structure does not exist! In order to create a compatible database structure you must check option <strong>\"Create new database structure\"</strong> from previous instalation page.";
     }
     return $toReturn;
 }
예제 #2
0
 /**
  * export Comments for a specified page
  * 	
  * @param IExporter $exporter exporter to be used
  * @param String fields to be exported separated by comma
  * @param String orderClause to be used in selecting records
  */
 function export($exporter, $fields = null, $orderClause = null)
 {
     $whereClause = "";
     $whereFromFilter = $exporter->getFilter()->getSqlFilterClause();
     if ($whereFromFilter != null) {
         $whereClause = "WHERE " . $whereFromFilter;
     }
     $db = new RecordSet($this->dbConnectionInfo);
     $select = "*";
     if ($fields != null) {
         //$select=Utils::arrayToString($fields,",");
         $select = $fields;
     }
     $sql = "SELECT " . $select . " FROM " . $this->tableName . " " . $whereClause;
     if ($orderClause != null) {
         $sql .= " " . $orderClause;
     }
     $sql .= ";";
     if ($db->Open($sql)) {
         $rowArray = $db->getAssoc();
         while ($rowArray) {
             if (is_array($rowArray)) {
                 $exporter->exportRow($rowArray);
             }
             $rowArray = $db->getAssoc();
         }
     }
     $db->Close();
 }
예제 #3
0
파일: Comment.php 프로젝트: hphelion/tools
 /**
  * export Comments for a specified page
  * @param array $info exporting information
  * @param IExporter $exporter exporter to be used
  */
 function exportForPage($info, $exporter, $fields = null)
 {
     $toReturn = "";
     $whereClause = " WHERE ";
     if ($info["filter_version"] != "" && $info["filter_product"] != "") {
         $whereClause .= " version='" . $info["filter_version"] . "' AND product='" . $info["filter_product"] . "'";
     } else {
         $whereClause = "";
     }
     if ($this->isLoggedModerator()) {
         $db = new RecordSet($this->dbConnectionInfo);
         $select = "*";
         if ($fields != null) {
             $select = Utils::arrayToString($fields, ",");
         }
         $sql = "SELECT " . $select . " FROM comments " . $whereClause . " ORDER BY date DESC";
         if ($db->Open($sql)) {
             $rowArray = $db->getAssoc();
             while ($rowArray) {
                 if (is_array($rowArray)) {
                     $exporter->exportRow($rowArray);
                 }
                 $rowArray = $db->getAssoc();
             }
         }
         $db->Close();
     } else {
         $exporter->exportRow(array('ERROR' => 'Your user rights does not permit this opperation!'));
     }
 }