コード例 #1
0
 /**
  *
  * @param string $message informational message
  * @param mixed $code query string
  * @param Exception $previous previous Exception
  */
 public function __construct($message = null, $code = 0, Exception $previous = null)
 {
     if (0 !== $code && is_String($code)) {
         $code = trim($code);
         if (strlen($code) > 1024) {
             $code = substr($code, 0, 1023) . ' *snip*';
         }
         $this->query = $code;
         $message = $message . " (SQL '" . $code . "')";
         $code = 0;
     }
     parent::__construct($message, $code);
 }
コード例 #2
0
 function test_get_hierarchy()
 {
     $hierarchy = $this->manager->getHierarchy(new HarmoniId("8"));
     $this->assertIsA($hierarchy, "HarmoniHierarchy");
     $this->assertIdentical($hierarchy->getId(), new HarmoniId("8"));
     $this->assertTrue(is_string($hierarchy->getDisplayName()));
     $this->assertTrue(is_String($hierarchy->getDescription()));
     $this->assertIdentical($hierarchy->allowsMultipleParents(), true);
     $this->assertIdentical($hierarchy->allowsRecursion(), false);
     // second time should be from cache
     $hierarchy = $this->manager->getHierarchy(new HarmoniId("8"));
     $this->assertIsA($hierarchy, "HarmoniHierarchy");
     $this->assertIdentical($hierarchy->getId(), new HarmoniId("8"));
     $this->assertTrue(is_string($hierarchy->getDisplayName()));
     $this->assertTrue(is_String($hierarchy->getDescription()));
     $this->assertIdentical($hierarchy->allowsMultipleParents(), true);
     $this->assertIdentical($hierarchy->allowsRecursion(), false);
 }
コード例 #3
0
ファイル: choose.php プロジェクト: edward-tsai/vanilla4china
         <?php 
echo $this->Form->Label('Configure an Authenticator', 'Garden.Authentication.Chooser');
echo $this->Form->DropDown('Garden.Authentication.Chooser', array_merge(array(NULL => NULL), $this->ChooserList), array('value' => $this->Data('PreFocusAuthenticationScheme')));
echo $this->Form->Button("Activate", array('Class' => 'SliceSubmit SmallButton'));
?>
      </li>
   </ul>
   <?php 
echo $this->Form->Close();
?>
</div>
<?php 
if ($this->Data('PreFocusAuthenticationScheme')) {
    $Scheme = $this->Data('PreFocusAuthenticationScheme');
    $Rel = $this->Data('AuthenticationConfigureList.' . $Scheme);
    if (!is_String($Rel)) {
        $Rel = '/dashboard/authentication/configure/' . $Scheme;
    }
    ?>
      <div class="AuthenticationConfigure Slice Async" rel="<?php 
    echo $Rel;
    ?>
"></div>
<?php 
} else {
    echo $this->Slice('configure');
}
?>
<script type="text/javascript">
   var ConfigureList = <?php 
echo json_encode($this->Data('AuthenticationConfigureList'));
コード例 #4
0
 public function submitshipmentAction()
 {
     try {
         $service = $this->getRequest()->getPost('glsservice');
         (int) ($weight = str_replace(',', '.', $this->getRequest()->getPost('weight')));
         $shipfromID = $this->getRequest()->getPost('shipfrom');
         $shipmentID = $this->getRequest()->getParam('shipment_id');
         $notiz = $this->getRequest()->getPost('notiz');
         $extra['frankatur'] = $this->getRequest()->getPost('frankatur');
         $extra['expressart'] = $this->getRequest()->getPost('expressart');
         $extra['alternativzustellung'] = $this->getRequest()->getPost('alternativzustellung');
         $extra['notiz'] = $notiz;
         if (empty($service)) {
             Mage::throwException($this->__('Sie muessen einen Service auswaehlen.'));
         }
         if (empty($weight) || $weight <= 0) {
             Mage::throwException($this->__('Das Paketgewicht muss größer als 0 kg sein.'));
         }
         if (empty($shipfromID)) {
             Mage::throwException($this->__('Sie müssen eine Versandadresse auswählen.'));
         }
         if (empty($shipmentID)) {
             Mage::throwException($this->__('Keine Shipment Id gegeben.'));
         }
         $shipment = $this->_initShipment($shipmentID);
         $shipfrom = $this->_initShipfrom($shipfromID);
         if ($shipment && $shipfrom) {
             $this->loadLayout();
             $response_gls = $this->_initGlsService($service, $shipment, $weight, $shipfrom, $notiz, $extra);
             if (is_String($response_gls)) {
                 $response = array('error' => true, 'message' => $response_gls);
             } else {
                 $response = $this->getLayout()->getBlock('gls_unibox')->toHtml();
                 $this->_insertTracking($shipment, $response_gls, $notiz);
             }
         } else {
             $response = array('error' => true, 'message' => $this->__('Konnte Shipment oder Gls Mandanten nicht initialisieren.'));
         }
     } catch (Mage_Core_Exception $e) {
         $response = array('error' => true, 'message' => $e->getMessage());
     } catch (Exception $e) {
         $response = array('error' => true, 'message' => $this->__('Ein unerwarteter Fehler ist aufgetreten.'));
     }
     if (is_array($response)) {
         $response = Mage::helper('core')->jsonEncode($response);
     }
     $this->getResponse()->setBody($response);
 }
コード例 #5
0
 /**
  * 
  * Regex to validate Internet media type
  *
  */
 private function validateInternetMediaType($value)
 {
     $type = '(application|audio|example|image|message|model|multipart|text|video)';
     $subtype = '(/[-\\w\\+]+)';
     $attribute = '(;\\s*[-\\w]+\\=[-\\w]+)';
     if (is_String($value) && preg_match('#^' . $type . $subtype . $attribute . '*;?$#', $value)) {
         return true;
     }
     return false;
 }
コード例 #6
0
ファイル: pdoHelper.php プロジェクト: elribonazo/riframework
 /**
  * [join description]
  * @param  string
  * @param  string
  * @param  string
  * @param  string
  * @return string
  */
 public function join($joinType, $joinTable, $joinField, $joinValue)
 {
     if (!is_String($joinType) || !is_string($joinTable) || !is_string($joinField) || !is_string($joinValue)) {
         rifException::modelException(array('message' => $this->lng->__("Invalid join parameters")));
     }
     return $joinType . " " . $joinTable . ' ON ' . $joinField . ' = ' . $joinValue . " ";
 }
コード例 #7
0
 /**
  * Prepare email attachments
  *
  * @param array $mail Email data
  * @param array $data ?
  * @param array $form For config
  *
  * @return array
  */
 public static function mail_attachment_check($mail, $data, $form)
 {
     // check for
     foreach ($form['fields'] as $field_id => $field) {
         if ($field['type'] == 'file' && isset($field['config']['attach'])) {
             $dir = wp_upload_dir();
             $file = str_replace($dir['baseurl'], $dir['basedir'], self::get_field_data($field_id, $form));
             if (is_String($file) && file_exists($file)) {
                 $mail['attachments'][] = $file;
                 return $mail;
             } else {
                 if (isset($data[$field_id]) && filter_var($data[$field_id], FILTER_VALIDATE_URL)) {
                     $mail['attachments'][] = $data[$field_id];
                 } elseif (isset($_POST[$field_id]) && filter_var($_POST[$field_id], FILTER_VALIDATE_URL) && 0 === strpos($_POST[$field_id], $dir['url'])) {
                     $mail['attachments'][] = $_POST[$field_id];
                 } else {
                     continue;
                 }
             }
         }
     }
     return $mail;
 }
コード例 #8
0
ファイル: mysql4.class.php プロジェクト: aquarion/AqWiki
 function unique($table, $field, $value, $changeID = false)
 {
     global $db;
     if (is_String($value)) {
         $value = "\"{$value}\"";
     }
     $sql = "select id" . " from " . $table . " where " . $field . " = " . $value;
     $result = $this->query($sql);
     if (DB::isError($result)) {
         panic("database", $result->getMessage(), $sql);
     }
     if ($result->numRows() == 0) {
         return true;
     } else {
         return false;
     }
 }
コード例 #9
0
 /**
  * Launched when a closing brace is encountered.
  *
  * @param TokenInfo $token
  *        	the current token
  */
 private function _processBracesClose($token)
 {
     // signifies the end of a block
     // currently tests whether this token resides on a new line.
     // This test is deactivated when in a view
     if ($this->_isActive('controlCloseCurly') && !$this->_isView && !$this->_inString) {
         $previousToken = $this->tokenizer->peekPrvsValidToken();
         if ($previousToken->line == $token->line && $previousToken->id !== T_BRACES_OPEN) {
             // the last token was on the same line
             $this->_writeError('controlCloseCurly', $this->_getMessage("END_BLOCK_NEW_LINE"));
         }
     }
     $currentStackItem = $this->statementStack->getCurrentStackItem();
     // Workaround code
     if (!is_String($currentStackItem)) {
         // Test for the end of a switch bloc
         if ($currentStackItem->type == "SWITCH" || $currentStackItem->type == "DEFAULT" || $currentStackItem->type == "CASE") {
             $this->_processSwitchStop();
         }
         // Test for the end of a function
         if ($currentStackItem->type == "FUNCTION") {
             $this->_processFunctionStop();
         }
         // Test for the end of a class
         if ($currentStackItem->type == "CLASS") {
             $this->_processClassStop();
         }
         // Test for the end of an interface
         if ($currentStackItem->type == "INTERFACE") {
             $this->_processInterfaceStop();
         }
     }
     $this->statementStack->pop();
     // Particular case of a ELSE IF {}
     // We unstack both the IF and the ELSE
     $isElse = $currentStackItem->type == "ELSE";
     $isIf = $this->statementStack->getCurrentStackItem()->type == "IF";
     $isNoCurly = $this->statementStack->getCurrentStackItem()->noCurly;
     if ($isElse && $isIf && $isNoCurly) {
         $this->statementStack->pop();
     }
 }
コード例 #10
0
ファイル: core.php プロジェクト: Acens/jao2015
 /**
  * Prepare email attachments
  *
  * @param array $mail Email data
  * @param array $data ?
  * @param array $form For config
  *
  * @return array
  */
 public static function mail_attachment_check($mail, $data, $form)
 {
     // check for
     foreach ($form['fields'] as $field_id => $field) {
         if ($field['type'] == 'file' && isset($field['config']['attach'])) {
             $dir = wp_upload_dir();
             $file = str_replace($dir['baseurl'], $dir['basedir'], self::get_field_data($field_id, $form));
             if (is_String($file) && file_exists($file)) {
                 $mail['attachments'][] = $file;
             }
         }
     }
     return $mail;
 }