/** * @return array all products that share comments with this one */ function getSharedWith() { $toReturn = array(); $db = new RecordSet($this->dbConnectionInfo, false, true); $query = "Select product,value from webhelp where parameter='name' and version='" . $db->sanitize($this->version) . "' "; if (defined('__SHARE_WITH__')) { $query .= "AND product in ("; $shareArray = explode(",", __SHARE_WITH__); foreach ($shareArray as $key => $value) { $query .= "'" . $db->sanitize($value) . "', "; } $query = substr($query, 0, -2) . ");"; } error_log($query); $prds = $db->Open($query); if ($prds > 0) { while ($db->MoveNext()) { $product = $db->Field('product'); $value = $db->Field('value'); $toReturn[$product] = $value; } } $db->close(); return $toReturn; }
/** * @return array all products that share comments with this one */ function getSharedWith() { $toReturn = array(); $db = new RecordSet($this->dbConnectionInfo, false, true); $prds = $db->Open("Select product,value from webhelp where parameter='name' and version='" . $this->version . "' " . (defined('__SHARE_WITH__') ? "AND product in (" . __SHARE_WITH__ . ")" : '') . ";"); if ($prds > 0) { while ($db->MoveNext()) { $product = $db->Field('product'); $value = $db->Field('value'); $toReturn[$product] = $value; } } $db->close(); return $toReturn; }
private function getEmails() { global $dbConnectionInfo; $this->to = array(); if (defined('__ADMIN_EMAIL__') && strlen(trim(__ADMIN_EMAIL__)) > 0) { $this->to[] = __ADMIN_EMAIL__; } if (defined("__SEND_ERRORS__") && __SEND_ERRORS__) { try { $ds = new RecordSet($dbConnectionInfo, false, true); $ds->open("SELECT email FROM users WHERE level='admin';"); while ($ds->MoveNext()) { $this->to[] = $ds->Field('email'); } $ds->close(); } catch (Exception $e) { // ignore $msg = date("Y-m-d H:i:s") . ": Error:[" . $e->getCode() . "] message:[" . $e->getMessage() . "]\tfile:[" . $e->getFile() . "] line:[" . $e->getLine() . "]"; $this->bag .= "[" . $this->getRealIpAddr() . "] - " . $msg . "<br/>"; $this->count++; $this->sendInternal(false); } } }
/** * Get allproduct for witch this user is valid * * @return multitype:Strign productId=>Name */ function getSharedProducts() { $toReturn = array(); $db = new RecordSet($this->dbConnectionInfo, false, true); $prds = $db->Open("SELECT product,value FROM webhelp WHERE parameter='name' ;"); if ($prds > 0) { while ($db->MoveNext()) { $product = $db->Field('product'); $value = $db->Field('value'); $toReturn[$product] = $value; } } $db->close(); return $toReturn; }
function deleteRecursive($ids) { if (count($ids) > 0) { $db = new RecordSet($this->dbConnectionInfo, false, true); $toDelete = array(); $idsS = implode(", ", $ids); $db->open("SELECT commentId FROM comments WHERE referedComment in (" . $idsS . ");"); while ($db->MoveNext()) { $toDelete[] = $db->Field("commentId"); } $query = "DELETE FROM comments WHERE commentId in (" . $idsS . ");"; $toReturn = $db->Run($query); $db->close(); if (count($toDelete) > 0) { $this->deleteRecursive($toDelete); } } }