Example #1
0
 /**
  * Gets RSA Public Key.
  *
  * @param array $parameters Parameters (not used)
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $parent The calling parent AJAX object
  * @return void
  */
 public function getRsaPublicKey(array $parameters, \TYPO3\CMS\Core\Http\AjaxRequestHandler $parent)
 {
     $backend = BackendFactory::getBackend();
     if ($backend !== NULL) {
         $keyPair = $backend->createNewKeyPair();
         $storage = \TYPO3\CMS\Rsaauth\Storage\StorageFactory::getStorage();
         $storage->put($keyPair->getPrivateKey());
         session_commit();
         $parent->addContent('publicKeyModulus', $keyPair->getPublicKeyModulus());
         $parent->addContent('exponent', sprintf('%x', $keyPair->getExponent()));
         $parent->setContentFormat('json');
     } else {
         $parent->setError('No OpenSSL backend could be obtained for rsaauth.');
     }
 }
Example #2
0
 function Run($aParams)
 {
     $this->iParams = $aParams;
     Driver::$silent = $aParams['silent'];
     $encoder = BarcodeFactory::Create($aParams['barcode']);
     $encoder->AddChecksum($aParams['checkdigit']);
     switch ($aParams['output']) {
         case 0:
             $e = BackendFactory::Create(BACKEND_IMAGE, $encoder);
             set_exception_handler(array('Driver', 'ErrHandlerImg'));
             break;
         case 1:
             $e = BackendFactory::Create(BACKEND_PS, $encoder);
             set_exception_handler(array('Driver', 'ErrHandlerPS'));
             break;
         case 2:
             $e = BackendFactory::Create(BACKEND_PS, $encoder);
             $e->SetEPS();
             set_exception_handler(array('Driver', 'ErrHandlerPS'));
             break;
     }
     $e->SetHeight($aParams['height']);
     $e->SetVertical($aParams['rotate']);
     $e->SetModuleWidth($aParams['modulewidth']);
     $e->SetScale($aParams['scale']);
     $e->HideText($aParams['hide']);
     if ($aParams['output'] === 0) {
         $err = $e->Stroke($aParams['data'], $aParams['filename']);
     } else {
         $s = $e->Stroke($aParams['data'], $aParams['filename']);
         if ($aParams['filename'] == '') {
             // If no filename specified then return the generated postscript
             echo $s;
         }
     }
 }
    function GetPICwithZIP($aZIP, $aServiceType, $aDUNS, $aSeqNbr)
    {
        // Convert to USPS format with AI=420 and extension starting with AI=91
        $data = '420' . $aZIP . '91' . $aServiceType . $aDUNS . $aSeqNbr;
        // Only calculate the checkdigit from the AI=91 and forward
        // and do not include the ~1 (FUNC1) in the calculation
        $cd = $this->_USPS_chkd(substr($data, 8));
        $data = '420' . $aZIP . '~191' . $aServiceType . $aDUNS . $aSeqNbr;
        return $data . $cd;
    }
    // Get type 2 of confirmation code (without ZIP)
    function GetPIC($aServiceType, $aDUNS, $aSeqNbr)
    {
        // Convert to USPS format with AI=91
        $data = '91' . $aServiceType . $aDUNS . $aSeqNbr;
        $cd = $this->_USPS_chkd($data);
        return $data . $cd;
    }
}
$usps = new USPS_Confirmation();
$zip = '92663';
$service = '21';
$DUNS = '805213907';
$seqnr = '04508735';
$data = $usps->GetPICwithZIP($zip, $service, $DUNS, $seqnr);
//$data = $usps->GetPIC('01','123456789','00000001');
$encoder = BarcodeFactory::Create(ENCODING_EAN128);
$e = BackendFactory::Create(BACKEND_IMAGE, $encoder);
$e->SetModuleWidth(2);
$e->SetFont(FF_ARIAL, FS_NORMAL, 14);
$e->Stroke($data);
Example #4
0
<?php

// ==============================================
// Output Encapsulated Postscript of interleaved 2 of 5
// ==============================================
require_once 'jpgraph/jpgraph_barcode.php';
echo "Start ...<br>";
$encoder = BarcodeFactory::Create(ENCODING_CODEI25);
$e = BackendFactory::Create(BACKEND_PS, $encoder);
$e->SetModuleWidth(2);
$e->SetHeight(70);
$e->SetEPS();
$ps = $e->Stroke('3125134772');
echo nl2br(htmlspecialchars($ps));
Example #5
0
 /**
  * Contsructor
  *
  * @param string graph type. Can be combination of comma separated types
  * @param int width of the graph canvas
  * @param int height of the graph canvas
  * @param string cached name of the graph (see JpGraph docs)
  * @param int timeout (see JpGraph docs)
  * @param bool inline (or not, see JpGrpah docs)
  */
 public function __construct($type = 'bar', $width = 300, $height = 200, $cached_name = '', $time_out = 0, $inline = true, $barcode_type = null)
 {
     /*
      * Some types used their own class, default is Graph, however
      */
     switch ($type) {
         case 'pie3D':
             require_once 'jpgraph/jpgraph_pie.php';
             require_once 'jpgraph/jpgraph_pie3d.php';
             $this->JpGraph = new PieGraph($width, $height, $cached_name, $time_out, $inline);
             break;
         case 'pie':
             require_once 'jpgraph/jpgraph_pie.php';
             $this->JpGraph = new PieGraph($width, $height, $cached_name, $time_out, $inline);
             break;
         case 'polar':
             require_once 'jpgraph/jpgraph_polar.php';
             $this->JpGraph = new PolarGraph($width, $height, $cached_name, $time_out, $inline);
             break;
         case 'radar':
             require_once 'jpgraph/jpgraph_radar.php';
             $this->JpGraph = new RadarGraph($width, $height, $cached_name, $time_out, $inline);
             break;
         case 'canvas':
             require_once 'jpgraph/jpgraph_canvas.php';
             $this->JpGraph = new CanvasGraph($width, $height, $cached_name, $time_out, $inline);
             break;
         case 'gantt':
             require_once 'jpgraph/jpgraph_gantt.php';
             $this->JpGraph = new GanttGraph($width, $height, $cached_name, $time_out, $inline);
             break;
         case 'mgraph':
             require_once 'jpgraph/jpgraph_mgraph.php';
             $this->JpGraph = new MGraph($width, $height, $cached_name, $time_out, $inline);
             break;
         case 'barcode':
             require_once 'jpgraph_canvas.php';
             require_once 'jpgraph_barcode.php';
             switch ($barcode_type) {
                 case 'EAN-8':
                     $symbology = BarcodeFactory::Create(ENCODING_EAN8);
                     break;
                 case 'EAN-13':
                     $symbology = BarcodeFactory::Create(ENCODING_EAN13);
                     break;
                 case 'EAN-128':
                     $symbology = BarcodeFactory::Create(ENCODING_EAN128);
                     break;
                 case 'UPC-A':
                     $symbology = BarcodeFactory::Create(ENCODING_UPCA);
                     break;
                 case 'UPC-E':
                     $symbology = BarcodeFactory::Create(ENCODING_UPCE);
                     break;
                 case 'CODE-11':
                     $symbology = BarcodeFactory::Create(ENCODING_CODE11);
                     break;
                 case 'CODE-25':
                     $symbology = BarcodeFactory::Create(ENCODING_CODE25);
                     break;
                 case 'CODE-39':
                     $symbology = BarcodeFactory::Create(ENCODING_CODE39);
                     break;
                 case 'CODE-93':
                     $symbology = BarcodeFactory::Create(ENCODING_CODE93);
                     break;
                 case 'CODE-128':
                     $symbology = BarcodeFactory::Create(ENCODING_CODE128);
                     break;
                 case 'POSTNET':
                     $symbology = BarcodeFactory::Create(ENCODING_POSTNET);
                     break;
                 case 'CODEI25':
                     $symbology = BarcodeFactory::Create(ENCODING_CODEI25);
                     break;
                 case 'CODABAR':
                     $symbology = BarcodeFactory::Create(ENCODING_CODABAR);
                     break;
                 case 'BOOKLAND':
                     $symbology = BarcodeFactory::Create(ENCODING_BOOKLAND);
                     break;
             }
             $this->JpGraph = BackendFactory::Create(BACKEND_IMAGE, $symbology);
             $this->JpGraph->setHeight($height);
             $this->JpGraph->AddChecksum();
             break;
         default:
             $this->JpGraph = new Graph($width, $height, $cached_name, $time_out, $inline);
             $this->JpGraph->SetScale('textlin');
             break;
     }
 }
Example #6
0
} elseif ($code == -1) {
    echo "<h4>No code symbology selected.</h4>";
} elseif ($height < 10 || $height > 500) {
    echo "<h4> Height must be in range [10, 500]</h4>";
} elseif ($scale < 0.1 || $scale > 15) {
    echo "<h4> Scale must be in range [0.1, 15]</h4>";
} else {
    if ($code == 20) {
        $encoder = BarcodeFactory::Create(6);
        $encoder->UseExtended();
    } else {
        $encoder = BarcodeFactory::Create($code);
    }
    $b = $backend == 'EPS' ? 'PS' : $backend;
    $b = substr($backend, 0, 5) == 'IMAGE' ? 'IMAGE' : $b;
    $e = BackendFactory::Create($b, $encoder);
    if (substr($backend, 0, 5) == 'IMAGE') {
        if (substr($backend, 5, 1) == 'J') {
            $e->SetImgFormat('JPEG');
        }
    }
    if ($e) {
        if ($backend == 'EPS') {
            $e->SetEPS();
        }
        if ($pswidth != '') {
            $modwidth = $pswidth;
        }
        $e->SetModuleWidth($modwidth);
        $e->AddChecksum($checksum);
        $e->NoText($notext);