public function query($sQuery, $sClass = null) { _DEBUG('[sqlite] Query ' . $sQuery); $oRes = sqlite_query($this->db, $sQuery, SQLITE_ASSOC, $sError); if ($oRes === false) { _ERROR('[sqlite] failed ' . $sError); throw new Exception($sError); } return new SQLiteDBResult($oRes, $sClass); }
function checkPaths() { global $REPO, $CONFIG, $PROJECTS; // Check for repositories folder path; create if absent if (!is_dir($CONFIG['repositoriesPath'])) { $mode = !empty($CONFIG['folderMode']) ? $CONFIG['folderMode'] : DEFAULT_FOLDER_MODE; if (mkdir($CONFIG['repositoriesPath'], $mode, true)) { _LOG("Creating repository folder '" . $CONFIG['repositoriesPath'] . " (" . decoct($mode) . ") for '{$REPO}'"); } else { _ERROR("Error creating repository folder '" . $CONFIG['repositoriesPath'] . " for '{$REPO}'! Exiting."); exit; } } // Check for current project folder; create if absent if (!is_dir($PROJECTS[$REPO]['projPath'])) { $mode = !empty($CONFIG['folderMode']) ? $CONFIG['folderMode'] : DEFAULT_FOLDER_MODE; if (mkdir($PROJECTS[$REPO]['projPath'], $mode, true)) { _LOG("Creating project folder '" . $PROJECTS[$REPO]['projPath'] . " (" . decoct($mode) . ") for '{$REPO}'"); } else { _ERROR("Error creating project folder '" . $PROJECTS[$REPO]['projPath'] . " for '{$REPO}'! Exiting."); exit; } } }
public function notFound($msg) { // XXX configure 404 page header('HTTP/1.1 404 Not Found', true, 404); header('Location: /404.html'); _ERROR($msg); exit; }
public static function get_music_artwork($sArtist, $sAlbum) { $client = new SoapClient("http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl"); do { $request = new ItemSearchRequest(); $request->SearchIndex = 'Music'; $request->Artist = $sArtist; $request->Title = $sAlbum; $request->ResponseGroup = array('Images', 'ItemAttributes', 'Tracks'); $request->ItemPage = $PageIndex; $a = new ItemSearch(); $a->SubscriptionId = '1KQKYN1NNCQDXTQ5WZG2'; $a->AssociateTag = 'webservices-20'; $a->Request = array($request); try { $result = $client->ItemSearch($a); $Pages[$PageIndex] =& $result->Items->Item; $NbPages = $result->Items->TotalPages; if (isset($result->Items->Item)) { foreach ($result->Items->Item as $N => $item) { $Coef = 0; $a = strtolower($sAlbum); $b = strtolower(utf8_decode($item->ItemAttributes->Title)); similar_text($a, $b, &$Coef); if ($Coef == 100) { // Found It $hRes = array(); $hRes['ASIN'] = $item->ASIN; $hRes['URL'] = urldecode($item->DetailPageURL); $hRes['image']['small'] = $item->SmallImage->URL; $hRes['image']['medium'] = $item->MediumImage->URL; $hRes['image']['large'] = $item->LargeImage->URL; return $hRes; } } } } catch (SoapFault $e) { _ERROR("SOAP Error : " . $e->GetMessage()); } $PageIndex++; } while ($PageIndex <= $NbPages); }
protected function __construct($hConfig) { $this->db = mysql_connect($hConfig['host'], $hConfig['user'], $hConfig['password']) or _ERROR('Could not connect'); }