/** * Update ePayment status. * * @access public * @param integer $status * @return boolean */ public function setEpaymentStatus($status) { $objResult = $this->objDatabase->Execute('UPDATE `' . DBPREFIX . 'module_checkout_settings_general` SET `value`=' . intval($status) . ' WHERE `id`=1'); if ($objResult) { return true; } else { return false; } }
/** * Update settings. * * @access public * @param array $arrYellowpay */ public function update($arrYellowpay) { foreach ($arrYellowpay as $name => $value) { $objResult = $this->objDatabase->Execute(' UPDATE `' . DBPREFIX . 'module_checkout_settings_yellowpay` SET `value`="' . contrexx_raw2db($value) . '" WHERE `name`="' . $name . '" '); if (!$objResult) { return false; } } return true; }
/** * Returns the AdoDB connection * @deprecated Use Doctrine (getEntityManager()) instead * @global string $ADODB_FETCH_MODE * @return \ADONewConnection */ public function getAdoDb() { if ($this->adodb) { return $this->adodb; } // Make sure, \Env::get('pdo') is set $this->getPdoConnection(); global $ADODB_FETCH_MODE, $ADODB_NEWCONNECTION; // open db connection \Env::get('ClassLoader')->loadFile(ASCMS_LIBRARY_PATH . '/adodb/adodb.inc.php'); $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; $ADODB_NEWCONNECTION = 'cxAdodbPdoConnectionFactory'; $this->adodb = \ADONewConnection('pdo'); $errorNo = $this->adodb->ErrorNo(); if ($errorNo != 0) { if ($errorNo == 1049) { throw new DbException('The database is unavailable'); } else { throw new DbException($this->adodb->ErrorMsg() . '<br />'); } unset($this->adodb); return false; } return $this->adodb; }
/** * Initialisation * * @access private */ private function init() { // check the content for installed and used modules $arrCmActiveModules = array(); $arrCmInstalledModules = array(); $qb = $this->em->createQueryBuilder(); $qb->add('select', 'p')->add('from', 'Cx\\Core\\ContentManager\\Model\\Entity\\Page p')->add('where', $qb->expr()->neq('p.module', $qb->expr()->literal(''))); $pages = $qb->getQuery()->getResult(); foreach ($pages as $page) { $arrCmInstalledModules[] = $page->getModule(); if ($page->isActive()) { $arrCmActiveModules[] = $page->getModule(); } } $arrCmInstalledModules = array_unique($arrCmInstalledModules); $arrCmActiveModules = array_unique($arrCmActiveModules); // add static modules $arrCmInstalledModules[] = 'Block'; $arrCmInstalledModules[] = 'Crm'; $arrCmInstalledModules[] = 'Order'; $arrCmInstalledModules[] = 'Pim'; $arrCmInstalledModules[] = 'Support'; $arrCmActiveModules[] = 'Block'; $arrCmInstalledModules[] = 'upload'; $arrCmActiveModules[] = 'upload'; $objResult = $this->db->Execute('SELECT `name`, `is_core`, `is_required` FROM `' . DBPREFIX . 'modules`'); if ($objResult !== false) { while (!$objResult->EOF) { $moduleName = $objResult->fields['name']; if ($moduleName == 'News') { $this->arrModules[] = $moduleName; //$this->arrCoreModules[] = $moduleName; if (in_array($moduleName, $arrCmInstalledModules)) { $this->arrInstalledModules[] = $moduleName; if (in_array($moduleName, $arrCmInstalledModules)) { $this->arrActiveModules[] = $moduleName; } } $objResult->MoveNext(); continue; } if (!empty($moduleName)) { $isCore = $objResult->fields['is_core']; if ($isCore == 1) { $this->arrCoreModules[] = $moduleName; } else { $this->arrModules[] = $moduleName; } if (in_array($moduleName, $arrCmInstalledModules) && ($isCore || !$isCore && is_dir($this->cl->getFilePath(ASCMS_MODULE_PATH . '/' . $moduleName)))) { $this->arrInstalledModules[] = $moduleName; } if (in_array($moduleName, $arrCmActiveModules) && ($isCore || !$isCore && is_dir($this->cl->getFilePath(ASCMS_MODULE_PATH . '/' . $moduleName)))) { $this->arrActiveModules[] = $moduleName; } } $objResult->MoveNext(); } } }
/** * Disconnects from db * * @access private * @return boolean */ private function _db_Disconnect() { $this->_debugMessage('_db_Disconnect()'); if (is_object($this->db)) { @$this->db->Close(); } return true; }
/** * Update existing transaction. * * @access public * @param integer $id id of transaction * @param integer $status status of transaction * @return boolean status of update */ public function updateStatus($id, $status) { $objResult = $this->objDatabase->Execute('UPDATE `' . DBPREFIX . 'module_checkout_transactions` SET `status`="' . contrexx_raw2db($status) . '", `time`=' . time() . ' WHERE `id`=' . intval($id)); if ($objResult && $this->objDatabase->Affected_Rows() > 0) { return true; } else { return false; } }
/** * Update customer mail. * * @access public * @param array $arrCustomerMail */ public function updateCustomerMail($arrCustomerMail) { $objResult = $this->objDatabase->Execute(' UPDATE `' . DBPREFIX . 'module_checkout_settings_mails` SET `title`="' . contrexx_raw2db($arrCustomerMail['title']) . '", `content`="' . contrexx_raw2db($arrCustomerMail['content']) . '" WHERE `id`=2 '); if ($objResult) { return true; } else { return false; } }
/** * This function will insert a single page into the community_pages table if * it is an active page. * @param ADONewConnection $db The database connection * @param array $page An array containing a single row from the community_pages table. * @param integer $new_community_id The id of the new community. * @param integer $proxy_id The integer representation of the user inserting the page * (found in the medtech_auth.user_data table. * @return the cpage_id of the inserted page. */ function insert_community_page($db, $page, $new_community_id, $proxy_id) { //Insert new page if it is active if ($page["page_active"] != 0) { //if this is a default page make it a course page so that it cannot be removed. if (strcmp($page["page_type"], "default") == 0) { $page["page_type"] = "course"; } //check the page content for intra-community URL's and rename for the new community $query = "\tSELECT *\n\t\t\tFROM " . DATABASE_NAME . ".`communities`\n\t\t\tWHERE `community_id` = " . $db->qstr($new_community_id); $community = $db->GetRow($query); $page["page_content"] = str_replace("pgme_generic", $community["community_shortname"], $page["page_content"]); $page["page_content"] = str_replace("pgme_rheumatology", $community["community_shortname"], $page["page_content"]); //if there is an image file on this page find the old photo id and replace with new one $pos1 = strpos($page["page_content"], "view-photo&id="); if (is_int($pos1) && $pos1 !== 0) { $pos2 = strpos($page["page_content"], "&", $pos1 + 18); $old_photo_id = substr($page["page_content"], $pos1 + 18, $pos2 - ($pos1 + 18)); $new_photo_id = find_photo_id($db, $old_photo_id, $new_community_id); if ($new_photo_id > 0) { $old_page = $page["page_content"]; $page["page_content"] = str_replace("view-photo&id=" . $old_photo_id, "view-photo&id=" . $new_photo_id, $page["page_content"]); if (strcmp($old_page, $page["page_content"]) == 0) { output_error("String replace failed for the photo ID."); } } else { output_notice("New photo ID not found."); } } $query = "\tINSERT INTO " . DATABASE_NAME . ".`community_pages`\n\t\t\t\t\t\t(`community_id`,\n\t\t\t\t\t\t`parent_id`,\n\t\t\t\t\t\t`page_order`,\n\t\t\t\t\t\t`page_type`,\n\t\t\t\t\t\t`menu_title`,\n\t\t\t\t\t\t`page_title`,\n\t\t\t\t\t\t`page_url`,\n\t\t\t\t\t\t`page_content`,\n\t\t\t\t\t\t`page_active`,\n\t\t\t\t\t\t`page_visible`,\n\t\t\t\t\t\t`allow_member_view`,\n\t\t\t\t\t\t`allow_troll_view`,\n\t\t\t\t\t\t`allow_public_view`,\n\t\t\t\t\t\t`updated_date`,\n\t\t\t\t\t\t`updated_by`)\n\t\t\t\t\t\tVALUES(\n\t\t\t\t\t\t" . $db->qstr($new_community_id) . ",\n\t\t\t\t\t\t" . $db->qstr($page["parent_id"]) . ",\n\t\t\t\t\t\t" . $db->qstr($page["page_order"]) . ",\n\t\t\t\t\t\t" . $db->qstr($page["page_type"]) . ",\n\t\t\t\t\t\t" . $db->qstr($page["menu_title"]) . ",\n\t\t\t\t\t\t" . $db->qstr($page["page_title"]) . ",\n\t\t\t\t\t\t" . $db->qstr($page["page_url"]) . ",\n\t\t\t\t\t\t" . $db->qstr($page["page_content"]) . ",\n\t\t\t\t\t\t" . $db->qstr($page["page_active"]) . ",\n\t\t\t\t\t\t" . $db->qstr($page["page_visible"]) . ",\n\t\t\t\t\t\t" . $db->qstr($page["allow_member_view"]) . ",\n\t\t\t\t\t\t" . $db->qstr($page["allow_troll_view"]) . ",\n\t\t\t\t\t\t" . $db->qstr($page["allow_public_view"]) . ",\n\t\t\t\t\t\t" . $db->qstr(time()) . ",\n\t\t\t\t\t\t" . $db->qstr($proxy_id) . ")"; if (!$db->Execute($query)) { output_error("There was a problem while inserting page " . $page["cpage_id"] . " into the new community where Community ID is (" . $new_community_id . "). Database said: " . $db->ErrorMsg()); } $new_cpage_id = $db->Insert_Id(); return $new_cpage_id; } }
/** * Sets the MySQL default timezone * * @access private * @param ADONewConnection $objDatabase * @param string $timezone */ private function setTimezone($objDatabase, $timezone = '') { $arrTimezones = timezone_identifiers_list(); if (empty($timezone)) { $timezone = isset($_SESSION['installer']['config']['timezone']) ? $_SESSION['installer']['config']['timezone'] : ''; } if (array_key_exists($timezone, $arrTimezones)) { $timezone = $arrTimezones[$timezone]; } if ($timezone !== '' && (in_array($timezone, $arrTimezones) || $timezone == 'UTC')) { if (!$objDatabase->Execute('SET TIME_ZONE = "' . addslashes($timezone) . '"')) { //calculate and set the timezone offset if the mysql timezone tables aren't loaded $objDateTimeZone = new DateTimeZone($timezone); $objDateTime = new DateTime('now', $objDateTimeZone); $offset = $objDateTimeZone->getOffset($objDateTime); $offsetHours = round(abs($offset) / 3600); $offsetMinutes = round((abs($offset) - $offsetHours * 3600) / 60); $offsetString = ($offset > 0 ? '+' : '-') . ($offsetHours < 10 ? '0' : '') . $offsetHours . ':' . ($offsetMinutes < 10 ? '0' : '') . $offsetMinutes; $objDatabase->Execute('SET TIME_ZONE="' . addslashes($offsetString) . '"'); } } }
/** * @param array $_CONFIG Reference to the basic settings ($_CONFIG) * @param ADONewConnection $objDb Database connection object * @return \Cx\Core_Modules\License\License */ public static function getCached(&$_CONFIG, $objDb) { $state = isset($_CONFIG['licenseState']) ? htmlspecialchars_decode($_CONFIG['licenseState']) : self::LICENSE_DEMO; $validTo = isset($_CONFIG['licenseValidTo']) ? htmlspecialchars_decode($_CONFIG['licenseValidTo']) : null; $editionName = isset($_CONFIG['coreCmsEdition']) ? htmlspecialchars_decode($_CONFIG['coreCmsEdition']) : null; $instId = isset($_CONFIG['installationId']) ? htmlspecialchars_decode($_CONFIG['installationId']) : null; $licenseKey = isset($_CONFIG['licenseKey']) ? htmlspecialchars_decode($_CONFIG['licenseKey']) : null; $messages = isset($_CONFIG['licenseMessage']) ? unserialize(base64_decode(htmlspecialchars_decode($_CONFIG['licenseMessage']))) : array(); $createdAt = isset($_CONFIG['licenseCreatedAt']) ? htmlspecialchars_decode($_CONFIG['licenseCreatedAt']) : null; $registeredDomains = isset($_CONFIG['licenseDomains']) ? unserialize(base64_decode(htmlspecialchars_decode($_CONFIG['licenseDomains']))) : array(); $grayzoneMessages = isset($_CONFIG['licenseGrayzoneMessages']) ? unserialize(base64_decode(htmlspecialchars_decode($_CONFIG['licenseGrayzoneMessages']))) : array(); $dashboardMessages = isset($_CONFIG['dashboardMessages']) ? unserialize(base64_decode(htmlspecialchars_decode($_CONFIG['dashboardMessages']))) : array(); $partner = isset($_CONFIG['licensePartner']) ? unserialize(base64_decode(htmlspecialchars_decode($_CONFIG['licensePartner']))) : new Person(); $customer = isset($_CONFIG['licenseCustomer']) ? unserialize(base64_decode(htmlspecialchars_decode($_CONFIG['licenseCustomer']))) : new Person(); $versionNumber = isset($_CONFIG['coreCmsVersion']) ? htmlspecialchars_decode($_CONFIG['coreCmsVersion']) : null; $versionName = isset($_CONFIG['coreCmsName']) ? htmlspecialchars_decode($_CONFIG['coreCmsName']) : null; $versionCodeName = isset($_CONFIG['coreCmsCodeName']) ? htmlspecialchars_decode($_CONFIG['coreCmsCodeName']) : null; $versionState = isset($_CONFIG['coreCmsStatus']) ? htmlspecialchars_decode($_CONFIG['coreCmsStatus']) : null; $versionReleaseDate = isset($_CONFIG['coreCmsReleaseDate']) ? htmlspecialchars_decode($_CONFIG['coreCmsReleaseDate']) : null; $version = new Version($versionNumber, $versionName, $versionCodeName, $versionState, $versionReleaseDate); $grayzoneTime = isset($_CONFIG['licenseGrayzoneTime']) ? htmlspecialchars_decode($_CONFIG['licenseGrayzoneTime']) : null; $lockTime = isset($_CONFIG['licenseLockTime']) ? htmlspecialchars_decode($_CONFIG['licenseLockTime']) : null; $updateInterval = isset($_CONFIG['licenseUpdateInterval']) ? htmlspecialchars_decode($_CONFIG['licenseUpdateInterval']) : null; $failedUpdate = isset($_CONFIG['licenseFailedUpdate']) ? htmlspecialchars_decode($_CONFIG['licenseFailedUpdate']) : null; $successfulUpdate = isset($_CONFIG['licenseSuccessfulUpdate']) ? htmlspecialchars_decode($_CONFIG['licenseSuccessfulUpdate']) : null; $upgradeUrl = isset($_CONFIG['upgradeUrl']) ? htmlspecialchars_decode($_CONFIG['upgradeUrl']) : null; $isUpgradable = isset($_CONFIG['isUpgradable']) ? $_CONFIG['isUpgradable'] == 'on' : false; $availableComponents = isset($_CONFIG['availableComponents']) ? unserialize(base64_decode(htmlspecialchars_decode($_CONFIG['availableComponents']))) : array(); $query = ' SELECT `name` FROM ' . DBPREFIX . 'modules WHERE `distributor` != \'Cloudrexx AG\' OR `is_licensed` = \'1\' '; $result = $objDb->execute($query); $activeComponents = array(); if ($result) { while (!$result->EOF) { $activeComponents[] = $result->fields['name']; $result->MoveNext(); } } return new static($state, $editionName, $availableComponents, $activeComponents, $validTo, $createdAt, $registeredDomains, $instId, $licenseKey, $messages, $version, $partner, $customer, $grayzoneTime, $grayzoneMessages, $lockTime, $updateInterval, $failedUpdate, $successfulUpdate, $upgradeUrl, $isUpgradable, $dashboardMessages); }
function __construct($host = false, $name = false, $user = false, $pass = false) { parent::__construct("mysql"); parent::connect($host, $user, $pass, $name); }