protected function dtgDirectoryToken_Bind()
 {
     // Get Total Count b/c of Pagination
     $this->dtgDirectoryToken->TotalItemCount = DirectoryToken::CountAll();
     $objClauses = array();
     if ($objClause = $this->dtgDirectoryToken->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     if ($objClause = $this->dtgDirectoryToken->LimitClause) {
         array_push($objClauses, $objClause);
     }
     $this->dtgDirectoryToken->DataSource = DirectoryToken::LoadAll($objClauses);
 }
Esempio n. 2
0
    public static function LoadAllUsingOrderBy($strOrderBy = null, $strLimit = null, $objExpansionMap = null)
    {
        // Call to ArrayQueryHelper to Get Database Object and Get SQL Clauses
        DirectoryToken::ArrayQueryHelper($strOrderBy, $strLimit, $strLimitPrefix, $strLimitSuffix, $strExpandSelect, $strExpandFrom, $objExpansionMap, $objDatabase);
        // Setup the SQL Query
        $strQuery = sprintf('
				SELECT
				%s
					`directory_token`.`id` AS `id`,
					`directory_token`.`token` AS `token`,
					`directory_token`.`path` AS `path`,
					`directory_token`.`core_flag` AS `core_flag`,
					`directory_token`.`relative_flag` AS `relative_flag`
					%s
				FROM
					`directory_token` AS `directory_token`
					%s
				%s
				%s', $strLimitPrefix, $strExpandSelect, $strExpandFrom, $strOrderBy, $strLimitSuffix);
        // Perform the Query and Instantiate the Result
        $objDbResult = $objDatabase->Query($strQuery);
        return DirectoryToken::InstantiateDbResult($objDbResult);
    }
 public static function GetSoapArrayFromArray($objArray)
 {
     if (!$objArray) {
         return null;
     }
     $objArrayToReturn = array();
     foreach ($objArray as $objObject) {
         array_push($objArrayToReturn, DirectoryToken::GetSoapObjectFromObject($objObject, true));
     }
     return unserialize(serialize($objArrayToReturn));
 }
Esempio n. 4
0
 protected function lstDirectory_Create()
 {
     $this->lstDirectory = new QListBox($this);
     $this->lstDirectory->Name = QApplication::Translate('Directory');
     $this->lstDirectory->Required = true;
     if (!$this->blnEditMode) {
         $this->lstDirectory->AddItem(QApplication::Translate('- Select One -'), null);
     }
     $objDirectoryArray = DirectoryToken::LoadAll();
     if ($objDirectoryArray) {
         foreach ($objDirectoryArray as $objDirectory) {
             $objListItem = new QListItem($objDirectory->__toString(), $objDirectory->Id);
             if ($this->objFile->Directory && $this->objFile->Directory->Id == $objDirectory->Id) {
                 $objListItem->Selected = true;
             }
             $this->lstDirectory->AddItem($objListItem);
         }
     }
 }
Esempio n. 5
0
 public function __construct($intMajor, $intMinor, $intBuild, $blnStable)
 {
     $this->intMajor = $intMajor;
     $this->intMinor = $intMinor;
     $this->intBuild = $intBuild;
     $this->blnStable = $blnStable;
     $this->strTemp = sprintf('%s/qcodo-temp', QBuildMaker::BuildRoot);
     $this->strRoot = sprintf('%s/qcodo-%s.%s.%s', QBuildMaker::BuildRoot, $intMajor, $intMinor, $intBuild);
     $this->strVersion = sprintf('%s.%s.%s', $intMajor, $intMinor, $intBuild);
     $objDirectoryArray = DirectoryToken::LoadAllUsingOrderBy('length(path) DESC');
     foreach ($objDirectoryArray as $objDirectory) {
         $this->objDirectoryTokens[$objDirectory->Token] = $objDirectory;
     }
     if ($this->blnStable) {
         $this->strVersionFilename = '/STABLE';
     } else {
         $this->strVersionFilename = '/DEVELOPMENT';
     }
     // Erase Previous Temp
     if (file_exists($this->strTemp)) {
         print shell_exec("rm -r -f {$this->strTemp}");
     }
     // Get the Latest Build and Remove any GIT-related stuff
     print shell_exec('cd ' . QBuildMaker::BuildRoot . '; git clone ' . QBuildMaker::GitUrl);
     print shell_exec('cd ' . QBuildMaker::BuildRoot . '/qcodo; rm -r -f .git');
     print shell_exec('cd ' . QBuildMaker::BuildRoot . '/qcodo; rm -r -f .gitignore');
     // Remove any Examples-related stuff
     print shell_exec('cd ' . QBuildMaker::BuildRoot . '/qcodo; rm -r -f www/examples');
     print shell_exec('cd ' . QBuildMaker::BuildRoot . '/qcodo; rm -r -f includes/examples');
     print shell_exec('cd ' . QBuildMaker::BuildRoot . '/qcodo; rm -r -f www/assets/images/examples');
     print shell_exec('cd ' . QBuildMaker::BuildRoot . '/qcodo; rm -r -f www/assets/css/examples');
     // Move to Temp Location
     rename(QBuildMaker::BuildRoot . '/qcodo', $this->strTemp);
     // Check/Validate Version Number
     $strQcodoInc = file_get_contents($this->strTemp . '/includes/qcodo/_core/qcodo.inc.php');
     $strQcodoIncLines = explode("\n", $strQcodoInc);
     $blnFound = false;
     foreach ($strQcodoIncLines as $strLine) {
         if (!$blnFound) {
             if (strpos($strLine, 'QCODO_VERSION') !== false) {
                 $strLine = trim($strLine);
                 $blnFound = true;
                 if (strpos($strLine, $this->strVersion) === false) {
                     print "Error: Attempting to build Qcodo Version {$this->strVersion}\r\n";
                     print "Code is reporting Qcodo Version: {$strLine}\r\n";
                     if (file_exists($this->strTemp)) {
                         print shell_exec("rm -r -f {$this->strTemp}");
                     }
                     exit;
                 }
             }
         }
     }
     if (!$blnFound) {
         print "Error: Attempting to build Qcodo Version {$strVersion}\r\n";
         print "Code does not report a Qcodo Version\r\n";
         if (file_exists($this->strTemp)) {
             print shell_exec("rm -r -f {$this->strTemp}");
         }
         exit;
     }
     // Erase Previous Builds
     if (file_exists($this->strRoot)) {
         print shell_exec("rm -r -f {$this->strRoot}");
     }
     if (file_exists($this->strRoot . '.zip')) {
         print shell_exec("rm -r -f {$this->strRoot}.zip");
     }
     if (file_exists($this->strRoot . '.tar.gz')) {
         print shell_exec("rm -r -f {$this->strRoot}.tar.gz");
     }
     if (file_exists(QBuildMaker::BuildRoot . $this->strVersionFilename)) {
         print shell_exec("rm -r -f " . QBuildMaker::BuildRoot . $this->strVersionFilename);
     }
     // Fix up the folder path
     rename($this->strTemp, $this->strRoot);
     // Go Ahead and Process Everything
     $this->blnFileProcessedArray = array();
     $this->strXml = sprintf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n<!-- Generated by the Qcodo Build Maker and Qcodo Updater Utility -->\r\n<!-- Do NOT delete or modify ANYTHING in this file.  Doing so will break the Qcodo Updater service. -->\r\n<manifest>\r\n<version>%s</version>\r\n<major>%s</major>\r\n<minor>%s</minor>\r\n<build>%s</build>\r\n<type>%s</type>\r\n<files>\r\n", $this->strVersion, $this->intMajor, $this->intMinor, $this->intBuild, $this->blnStable ? 'Stable' : 'Development');
     $this->ProcessFolder($this->strRoot);
     $this->Deprecate();
     $this->strXml .= "</files>\r\n<directories>\r\n";
     foreach ($this->objDirectoryTokens as $objDirectory) {
         $this->strXml .= sprintf("<directory token=\"%s\" coreFlag=\"%s\" relativeFlag=\"%s\"/>\r\n", $objDirectory->Token, $objDirectory->CoreFlag ? 1 : 0, $objDirectory->RelativeFlag ? 1 : 0);
     }
     $this->strXml .= "</directories>\r\n</manifest>";
     file_put_contents($this->strRoot . QBuildMaker::ManifestPath, $this->strXml);
     // Finally, Package It All
     shell_exec(sprintf('cd %s; tar -cf qcodo-%s.tar qcodo-%s; gzip qcodo-%s.tar; zip -r qcodo-%s.zip qcodo-%s', QBuildMaker::BuildRoot, $this->strVersion, $this->strVersion, $this->strVersion, $this->strVersion, $this->strVersion));
     shell_exec('echo ' . $this->strVersion . ' > ' . QBuildMaker::BuildRoot . $this->strVersionFilename);
 }
Esempio n. 6
0
 /**
  * Returns the file given the file path and specified release
  *
  * @param integer $intMajorVersion
  * @param integer $intMinorVersion
  * @param integer $intBuild
  * @param string $strPath
  * @param string $strToken
  * @param bool $blnGzCompress
  * @return string Base64-encoded file and associated data
  */
 public function GetFile($intMajorVersion, $intMinorVersion, $intBuild, $strPath, $strToken, $blnGzCompress)
 {
     $objDirectory = DirectoryToken::LoadByToken(trim(strtoupper($strToken)));
     if (!$objDirectory) {
         throw new Exception('Directory Token does not exist: ' . $strToken);
     }
     $strVersion = sprintf('%s.%s.%s', $intMajorVersion, $intMinorVersion, $intBuild);
     $strFile = sprintf('%s/qcodo-%s/%s%s', QBuildMaker::BuildRoot, $strVersion, $objDirectory->Path, $strPath);
     if (file_exists($strFile) && is_file($strFile)) {
         $strText = file_get_contents($strFile);
         $intOriginalLength = strlen($strText);
         if ($blnGzCompress) {
             $strText = gzcompress($strText, 9);
         }
         $strText = base64_encode($strText);
         $intPointer = 0;
         $intLength = strlen($strText);
         $strOutput = '';
         while ($intPointer < $intLength) {
             $strOutput .= substr($strText, $intPointer, 80) . "\r\n";
             $intPointer += 80;
         }
         $strOutput = trim($strOutput);
         $strToReturn = sprintf("OK\r\n%s\r\n%s\r\n%s\r\n%s\r\n%s", $strPath, $strToken, $intOriginalLength, strlen($strOutput), $strOutput);
         return $strToReturn;
     } else {
         throw new Exception('File Not Found: Could not find "' . $strPath . '" in "' . $strToken . '" for Qcodo Version ' . $strVersion);
     }
 }
Esempio n. 7
0
 public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects)
 {
     if ($objObject->objDirectory) {
         $objObject->objDirectory = DirectoryToken::GetSoapObjectFromObject($objObject->objDirectory, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intDirectoryId = null;
         }
     }
     return $objObject;
 }