• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP DBG类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中DBG的典型用法代码示例。如果您正苦于以下问题:PHP DBG类的具体用法?PHP DBG怎么用?PHP DBG使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了DBG类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: startQuery

 /**
  * {@inheritdoc}
  */
 public function startQuery($sql, array $params = null, array $types = null)
 {
     $this->query = null;
     if (!(\DBG::getMode() & DBG_DOCTRINE) && !(\DBG::getMode() & DBG_DOCTRINE_CHANGE) && !(\DBG::getMode() & DBG_DOCTRINE_ERROR)) {
         return;
     }
     // prepare SQL statement
     if ($params) {
         $sql = str_replace('?', "'%s'", $sql);
         //$this->query = vsprintf($sql, $params);
         foreach ($params as &$param) {
             // serialize arrays
             if (is_array($param)) {
                 $param = serialize($param);
             } elseif (is_object($param)) {
                 // serialize objects
                 switch (get_class($param)) {
                     case 'DateTime':
                         // output DateTime object as date literal
                         $param = $param->format(ASCMS_DATE_FORMAT_DATETIME);
                         break;
                     default:
                         break;
                 }
             }
         }
         $sql = vsprintf($sql, $params);
     }
     \DBG::logSQL($sql);
     $this->startTime = microtime(true);
 }
开发者ID:Niggu,项目名称:cloudrexx,代码行数:34,代码来源:DoctrineSQLLogger.class.php


示例2: _marketUpdate

/**
 * Cloudrexx
 *
 * @link      http://www.cloudrexx.com
 * @copyright Cloudrexx AG 2007-2015
 *
 * According to our dual licensing model, this program can be used either
 * under the terms of the GNU Affero General Public License, version 3,
 * or under a proprietary license.
 *
 * The texts of the GNU Affero General Public License with an additional
 * permission and of our proprietary license can be found at and
 * in the LICENSE file you have received along with this program.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * "Cloudrexx" is a registered trademark of Cloudrexx AG.
 * The licensing of the program under the AGPLv3 does not imply a
 * trademark license. Therefore any rights, title and interest in
 * our trademarks remain entirely with us.
 */
function _marketUpdate()
{
    global $objDatabase, $_ARRAYLANG;
    $query = "SELECT id FROM " . DBPREFIX . "module_market_settings WHERE name='codeMode'";
    $objCheck = $objDatabase->SelectLimit($query, 1);
    if ($objCheck !== false) {
        if ($objCheck->RecordCount() == 0) {
            $query = "INSERT INTO `" . DBPREFIX . "module_market_settings` ( `id` , `name` , `value` , `description` , `type` )\n                        VALUES ( NULL , 'codeMode', '1', 'TXT_MARKET_SET_CODE_MODE', '2')";
            if ($objDatabase->Execute($query) === false) {
                return _databaseError($query, $objDatabase->ErrorMsg());
            }
        }
    } else {
        return _databaseError($query, $objDatabase->ErrorMsg());
    }
    $arrColumns = $objDatabase->MetaColumns(DBPREFIX . 'module_market_mail');
    if ($arrColumns === false) {
        setUpdateMsg(sprintf($_ARRAYLANG['TXT_UNABLE_GETTING_DATABASE_TABLE_STRUCTURE'], DBPREFIX . 'module_market_mail'));
        return false;
    }
    if (!isset($arrColumns['MAILTO'])) {
        $query = "ALTER TABLE `" . DBPREFIX . "module_market_mail` ADD `mailto` VARCHAR( 10 ) NOT NULL AFTER `content`";
        if ($objDatabase->Execute($query) === false) {
            return _databaseError($query, $objDatabase->ErrorMsg());
        }
    }
    /*****************************************************************
     * EXTENSION:    New attributes 'color' and 'sort_id' for entries *
     * ADDED:        Contrexx v2.1.0                                  *
     *****************************************************************/
    $arrColumns = $objDatabase->MetaColumns(DBPREFIX . 'module_market');
    if ($arrColumns === false) {
        setUpdateMsg(sprintf($_ARRAYLANG['TXT_UNABLE_GETTING_DATABASE_TABLE_STRUCTURE'], DBPREFIX . 'module_market'));
        return false;
    }
    if (!isset($arrColumns['SORT_ID'])) {
        $query = "ALTER TABLE `" . DBPREFIX . "module_market` ADD `sort_id` INT( 4 ) NOT NULL DEFAULT '0' AFTER `paypal`";
        if ($objDatabase->Execute($query) === false) {
            return _databaseError($query, $objDatabase->ErrorMsg());
        }
    }
    if (!isset($arrColumns['COLOR'])) {
        $query = "ALTER TABLE `" . DBPREFIX . "module_market` ADD `color` VARCHAR(50) NOT NULL DEFAULT '' AFTER `description`";
        if ($objDatabase->Execute($query) === false) {
            return _databaseError($query, $objDatabase->ErrorMsg());
        }
    }
    try {
        // delete obsolete table  contrexx_module_market_access
        \Cx\Lib\UpdateUtil::drop_table(DBPREFIX . 'module_market_access');
        \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_market_spez_fields', array('id' => array('type' => 'INT(5)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'name' => array('type' => 'VARCHAR(100)'), 'value' => array('type' => 'VARCHAR(100)'), 'type' => array('type' => 'INT(1)', 'notnull' => true, 'default' => '1'), 'lang_id' => array('type' => 'INT(2)', 'notnull' => true, 'default' => '0'), 'active' => array('type' => 'INT(1)', 'notnull' => true, 'default' => '0')));
    } catch (\Cx\Lib\UpdateException $e) {
        DBG::trace();
        return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
    }
    return true;
}
开发者ID:Niggu,项目名称:cloudrexx,代码行数:81,代码来源:market.php


示例3: onEvent

 /**
  * Event handler to add logs
  * 
  * We need to do this with an event handler so there's no dependency to this component
  * @param string $eventName Name of triggered event, should always be static::EVENT_NAME
  * @param array $eventArgs Supplied arguments, should be an array (see DBG message below)
  */
 public function onEvent($eventName, array $eventArgs)
 {
     if ($eventName != static::EVENT_NAME) {
         return;
     }
     if (empty($eventArgs['severity']) || empty($eventArgs['message']) || empty($eventArgs['data'])) {
         \DBG::msg('Triggered event "SysLog/Add" with wrong arguments. I need an array with non-empty values for the keys "severity", "message" and "data"');
         return;
     }
     $this->addSysLog(new \Cx\Core_Modules\SysLog\Model\Entity\Log($eventArgs['severity'], $eventArgs['message'], $eventArgs['data']));
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:18,代码来源:ComponentController.class.php


示例4: _auctionUpdate

/**
 * Cloudrexx
 *
 * @link      http://www.cloudrexx.com
 * @copyright Cloudrexx AG 2007-2015
 *
 * According to our dual licensing model, this program can be used either
 * under the terms of the GNU Affero General Public License, version 3,
 * or under a proprietary license.
 *
 * The texts of the GNU Affero General Public License with an additional
 * permission and of our proprietary license can be found at and
 * in the LICENSE file you have received along with this program.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * "Cloudrexx" is a registered trademark of Cloudrexx AG.
 * The licensing of the program under the AGPLv3 does not imply a
 * trademark license. Therefore any rights, title and interest in
 * our trademarks remain entirely with us.
 */
function _auctionUpdate()
{
    try {
        // delete obsolete table  contrexx_module_auction_access
        \Cx\Lib\UpdateUtil::drop_table(DBPREFIX . 'module_auction_access');
    } catch (\Cx\Lib\UpdateException $e) {
        // we COULD do something else here..
        DBG::trace();
        return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
    }
    return true;
}
开发者ID:Niggu,项目名称:cloudrexx,代码行数:36,代码来源:auction.php


示例5: convertIdnToUtf8Format

 /**
  * Convert idn to utf8 format
  * 
  * @param string $name
  * 
  * @return string
  */
 public static function convertIdnToUtf8Format($name)
 {
     if (empty($name)) {
         return;
     }
     if (!function_exists('idn_to_utf8')) {
         \DBG::msg('Idn is not supported in this system.');
     } else {
         $name = idn_to_utf8($name);
     }
     return $name;
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:19,代码来源:ComponentController.class.php


示例6: clearCachePageForDomainAndPort

 /**
  * Clears a cache page
  * @param string $urlPattern Drop all pages that match the pattern, for exact format, make educated guesses
  * @param string $domain Domain name to drop cache page of
  * @param int $port Port to drop cache page of
  */
 protected function clearCachePageForDomainAndPort($urlPattern, $domain, $port)
 {
     $errno = 0;
     $errstr = '';
     $varnishSocket = fsockopen($this->hostname, $this->port, $errno, $errstr);
     if (!$varnishSocket) {
         \DBG::log('Varnish error: ' . $errstr . ' (' . $errno . ') on server ' . $this->hostname . ':' . $this->port);
     }
     $domainOffset = ASCMS_PATH_OFFSET;
     $request = 'BAN ' . $domainOffset . $urlPattern . " HTTP/1.0\r\n";
     $request .= 'Host: ' . $domain . ':' . $port . "\r\n";
     $request .= "User-Agent: Cloudrexx Varnish Cache Clear\r\n";
     $request .= "Connection: Close\r\n\r\n";
     fwrite($varnishSocket, $request);
     fclose($varnishSocket);
 }
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:22,代码来源:ReverseProxyVarnish.class.php


示例7: execute

 protected function execute()
 {
     switch ($this->mode) {
         case self::MODE_DQL:
             $this->result = '';
             $strQuery = trim($this->code);
             $lister = new \Cx\Core_Modules\Listing\Controller\ListingController(function (&$offset, &$count, &$criteria, &$order) use($strQuery) {
                 return \Env::get('em')->createQuery($strQuery);
             });
             try {
                 $table = new \BackendTable($lister->getData());
                 $this->result = $table->toHtml() . $lister;
             } catch (\Exception $e) {
                 $this->result = 'Could not execute query (' . $e->getMessage() . ')!';
             }
             break;
         case self::MODE_PHP:
             $dbgMode = \DBG::getMode();
             try {
                 // This error handler catches all Warnings and Notices and some Strict errors
                 \DBG::activate(DBG_PHP);
                 set_error_handler(array($this, 'phpErrorsAsExceptionsHandler'));
                 $this->errrorHandlerActive = true;
                 // Since DBG catches the rest (E_PARSE) let's use that
                 ob_start();
                 $function = create_function('$em, $cx', '' . $this->code . ';');
                 $dbgContents = ob_get_clean();
                 \DBG::activate($dbgMode);
                 if (!is_callable($function)) {
                     // parse exception
                     throw new SandboxException($dbgContents);
                 }
                 $this->result = var_export($function(\Env::get('em'), \Env::get('cx')), true);
                 restore_error_handler();
                 $this->errrorHandlerActive = false;
             } catch (\Exception $e) {
                 \DBG::activate($dbgMode);
                 restore_error_handler();
                 $this->errrorHandlerActive = false;
                 $this->result = get_class($e) . ': ' . $e->getMessage();
             }
             break;
         default:
             break;
     }
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:46,代码来源:Sandbox.class.php


示例8: set

 public static function set($prop, &$val)
 {
     switch ($prop) {
         case 'cx':
             // set is only used for installerCx. Normal cx class will load with \Env::get('cx')
             self::$props[$prop] = $val;
             \DBG::msg(__METHOD__ . ": Setting '{$prop}' is deprecated. Use only for installer, otherwise use \\Env::('{$prop}')");
             \DBG::stack();
             break;
         case 'em':
             self::$props[$prop] = $val;
             \DBG::msg(__METHOD__ . ": Setting '{$prop}' is deprecated. Env::get({$prop}) always returns the active/preferred instance of {$prop}.");
             \DBG::stack();
             break;
         default:
             self::$props[$prop] = $val;
             break;
     }
 }
开发者ID:Niggu,项目名称:cloudrexx,代码行数:19,代码来源:Env.class.php


示例9: processRequest

 public static function processRequest($token, $arrOrder)
 {
     global $_CONFIG;
     if (empty($token)) {
         return array('status' => 'error', 'message' => 'invalid token');
     }
     $testMode = intval(\Cx\Core\Setting\Controller\Setting::getValue('paymill_use_test_account', 'Shop')) == 0;
     $apiKey = $testMode ? \Cx\Core\Setting\Controller\Setting::getValue('paymill_test_private_key', 'Shop') : \Cx\Core\Setting\Controller\Setting::getValue('paymill_live_private_key', 'Shop');
     if ($token) {
         try {
             $request = new Paymill\Request($apiKey);
             $transaction = new Paymill\Models\Request\Transaction();
             $transaction->setAmount($arrOrder['amount'])->setCurrency($arrOrder['currency'])->setToken($token)->setDescription($arrOrder['note'])->setSource('contrexx_' . $_CONFIG['coreCmsVersion']);
             DBG::log("Transactoin created with token:" . $token);
             $response = $request->create($transaction);
             $paymentId = $response->getId();
             DBG::log("Payment ID" . $paymentId);
             return array('status' => 'success', 'payment_id' => $paymentId);
         } catch (\Paymill\Services\PaymillException $e) {
             //Do something with the error informations below
             return array('status' => 'error', 'response_code' => $e->getResponseCode(), 'status_code' => $e->getStatusCode(), 'message' => $e->getErrorMessage());
         }
     }
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:24,代码来源:PaymillHandler.class.php


示例10: editMedia

 /**
  * Shows the image manipulation component.
  *
  * @global  array   $_ARRAYLANG
  * @return  string  Parsed content.
  */
 function editMedia()
 {
     global $_ARRAYLANG;
     $this->_objTpl->loadTemplateFile('module_media_edit.html', true, true);
     $this->pageTitle = $_ARRAYLANG['TXT_MEDIA_EDIT_FILE'];
     if (isset($_GET['saveError']) && $_GET['saveError'] === 'true') {
         $this->_objTpl->setVariable(array('TXT_MEDIA_ERROR_OCCURED' => $_ARRAYLANG['TXT_MEDIA_ERROR_OCCURED'], 'TXT_MEDIA_ERROR_MESSAGE' => $_ARRAYLANG['TXT_MEDIA_CANNOT_SAVE_IMAGE']));
         $this->_objTpl->parse('mediaErrorFile');
         return;
     }
     // Activate cx
     \JS::activate('cx');
     // Activate jQuery and imgAreaSelect
     \JS::activate('jquery');
     \JS::activate('jquery-imgareaselect');
     try {
         // Get quality options from the settings
         $arrImageSettings = $this->getImageSettings();
     } catch (\Exception $e) {
         \DBG::msg('Could not query image settings: ' . $e->getMessage());
     }
     $check = true;
     empty($this->getFile) ? $check = false : '';
     empty($this->getPath) ? $check = false : '';
     !file_exists($this->path . $this->getFile) ? $check = false : '';
     if ($check) {
         // File exists
         $this->_objTpl->setVariable(array('TXT_MEDIA_SAVE' => $_ARRAYLANG['TXT_MEDIA_SAVE'], 'TXT_MEDIA_SAVE_AS' => $_ARRAYLANG['TXT_MEDIA_SAVE_AS'], 'TXT_MEDIA_RESET' => $_ARRAYLANG['TXT_MEDIA_RESET'], 'TXT_MEDIA_PREVIEW' => $_ARRAYLANG['TXT_PREVIEW'], 'MEDIA_EDIT_ACTION' => 'index.php?cmd=Media&archive=' . $this->archive . '&act=editImage&path=' . $this->webPath, 'MEDIA_DIR' => $this->webPath, 'MEDIA_FILE' => $this->getFile));
         $icon = $this->_getIcon($this->path . $this->getFile);
         $info = pathinfo($this->getFile);
         $fileExt = $info['extension'];
         $ext = !empty($fileExt) ? '.' . $fileExt : '';
         $fileName = substr($this->getFile, 0, strlen($this->getFile) - strlen($ext));
         // Icon, file & extension name
         $this->_objTpl->setVariable(array('MEDIA_FILE_ICON' => self::_getIconWebPath() . $icon . '.png', 'MEDIA_FILE_DIR' => $this->webPath, 'MEDIA_FILE_NAME' => $fileName, 'MEDIA_FILE_EXT' => $fileExt));
         // Edit image
         $imageSize = @getimagesize($this->path . $this->getFile);
         $this->_objTpl->setVariable(array('TXT_MEDIA_IMAGE_MANIPULATION' => $_ARRAYLANG['TXT_MEDIA_IMAGE_MANIPULATION'], 'TXT_MEDIA_WIDTH' => $_ARRAYLANG['TXT_MEDIA_WIDTH'], 'TXT_MEDIA_HEIGHT' => $_ARRAYLANG['TXT_MEDIA_HEIGHT'], 'TXT_MEDIA_BALANCE' => $_ARRAYLANG['TXT_MEDIA_BALANCE'], 'TXT_MEDIA_QUALITY' => $_ARRAYLANG['TXT_MEDIA_QUALITY'], 'TXT_MEDIA_SAVE' => $_ARRAYLANG['TXT_MEDIA_SAVE'], 'TXT_MEDIA_RESET' => $_ARRAYLANG['TXT_MEDIA_RESET'], 'TXT_MEDIA_SET_IMAGE_NAME' => $_ARRAYLANG['TXT_MEDIA_SET_IMAGE_NAME'], 'TXT_MEDIA_CONFIRM_REPLACE_IMAGE' => $_ARRAYLANG['TXT_MEDIA_CONFIRM_REPLACE_IMAGE'], 'TXT_MEDIA_REPLACE' => $_ARRAYLANG['TXT_MEDIA_REPLACE'], 'TXT_MEDIA_OR' => $_ARRAYLANG['TXT_MEDIA_OR'], 'TXT_MEDIA_SAVE_NEW_COPY' => $_ARRAYLANG['TXT_MEDIA_SAVE_NEW_COPY'], 'TXT_MEDIA_CROP' => $_ARRAYLANG['TXT_MEDIA_CROP'], 'TXT_MEDIA_CROP_INFO' => $_ARRAYLANG['TXT_MEDIA_CROP_INFO'], 'TXT_MEDIA_CANCEL' => $_ARRAYLANG['TXT_MEDIA_CANCEL'], 'TXT_MEDIA_ROTATE' => $_ARRAYLANG['TXT_MEDIA_ROTATE'], 'TXT_MEDIA_ROTATE_INFO' => $_ARRAYLANG['TXT_MEDIA_ROTATE_INFO'], 'TXT_MEDIA_SCALE_COMPRESS' => $_ARRAYLANG['TXT_MEDIA_SCALE_COMPRESS'], 'TXT_MEDIA_SCALE_INFO' => $_ARRAYLANG['TXT_MEDIA_SCALE_INFO'], 'TXT_MEDIA_PREVIEW' => $_ARRAYLANG['TXT_MEDIA_PREVIEW'], 'MEDIA_IMG_WIDTH' => $imageSize[0], 'MEDIA_IMG_HEIGHT' => $imageSize[1]));
         foreach ($this->arrImageQualityValues as $value) {
             $this->_objTpl->setVariable(array('IMAGE_QUALITY_VALUE' => $value, 'IMAGE_QUALITY_OPTION_CHECKED' => $value == $arrImageSettings['image_compression'] ? 'selected="selected"' : ''));
             $this->_objTpl->parse('mediaEditImageQualityOptions');
         }
         $this->_objTpl->parse('mediaEditImage');
     } else {
         // File doesn't exist
         $this->_objTpl->setVariable(array('TXT_MEDIA_ERROR_OCCURED' => $_ARRAYLANG['TXT_MEDIA_ERROR_OCCURED'], 'TXT_MEDIA_ERROR_MESSAGE' => $_ARRAYLANG['TXT_MEDIA_FILE_DONT_EXISTS']));
         $this->_objTpl->parse('mediaErrorFile');
     }
     // Variables
     $this->_objTpl->setVariable(array('CSRF' => \Cx\Core\Csrf\Controller\Csrf::param(), 'MEDIA_EDIT_AJAX_ACTION' => 'index.php?cmd=Media&archive=' . $this->archive . '&act=editImage&path=' . $this->webPath, 'MEDIA_EDIT_REDIRECT' => 'index.php?cmd=Media&archive=' . $this->archive . '&path=' . $this->webPath, 'MEDIA_BACK_HREF' => 'index.php?cmd=Media&archive=' . $this->archive . '&path=' . $this->webPath, 'MEDIA_FILE_IMAGE_SRC' => 'index.php?cmd=Media&archive=' . $this->archive . '&act=getImage&path=' . $this->webPath . '&file=' . $this->getFile . '&' . \Cx\Core\Csrf\Controller\Csrf::param(), 'MEDIA_IMAGE_WIDTH' => !empty($imageSize) ? intval($imageSize[0]) : 0, 'MEDIA_IMAGE_HEIGHT' => !empty($imageSize) ? intval($imageSize[1]) : 0, 'MEDIA_IMAGE_CROP_WIDTH' => $arrImageSettings['image_cut_width'], 'MEDIA_IMAGE_CROP_HEIGHT' => $arrImageSettings['image_cut_height'], 'MEDIA_IMAGE_RESIZE_QUALITY' => $arrImageSettings['image_compression']));
 }
开发者ID:hbdsklf,项目名称:LimeCMS,代码行数:57,代码来源:MediaManager.class.php


示例11: convertAllThemesToComponent

 /**
  * Generate a component.yml for each theme available on the system
  * only used in update process for fixing invalid themes
  */
 public function convertAllThemesToComponent()
 {
     foreach ($this->findAll() as $theme) {
         if ($theme->isComponent()) {
             continue;
         }
         try {
             $this->convertThemeToComponent($theme);
         } catch (\Exception $ex) {
             \DBG::log($ex->getMessage());
             \DBG::log($theme->getThemesname() . ' : Unable to convert theme to component');
         }
     }
 }
开发者ID:Niggu,项目名称:cloudrexx,代码行数:18,代码来源:ThemeRepository.class.php


示例12: saveEntry


//.........这里部分代码省略.........
             $associatedEntityClassMetadata = $em->getClassMetadata($value["targetEntity"]);
             foreach ($_POST[$relatedClassInputFieldName] as $relatedPostData) {
                 $entityData = array();
                 parse_str($relatedPostData, $entityData);
                 // if we have already an entry (on update) we take the existing one and update it.
                 // Otherwise we create a new one
                 if (isset($entityData['id']) && $entityData['id'] != 0) {
                     // update/edit case
                     $associatedClassRepo = $em->getRepository($value["targetEntity"]);
                     $associatedEntity = $associatedClassRepo->find($entityData['id']);
                 } else {
                     // add case
                     $associatedEntity = $associatedEntityClassMetadata->newInstance();
                 }
                 // if there are any entries which the user wants to delete, we delete them here
                 if (isset($entityData['delete']) && $entityData['delete'] == 1) {
                     $em->remove($associatedEntity);
                 }
                 // save the "n" associated class data to its class
                 $this->savePropertiesToClass($associatedEntity, $associatedEntityClassMetadata, $entityData, $entityWithNS);
                 // Linking 1: link the associated entity to the main entity for doctrine
                 $methodName = 'add' . str_replace(' ', '', ucwords(str_replace('_', ' ', $name)));
                 if (!in_array($methodName, $classMethods)) {
                     \Message::add(sprintf($_ARRAYLANG['TXT_CORE_RECORD_FUNCTION_NOT_FOUND'], $name, $methodName), \Message::CLASS_ERROR);
                     continue;
                 }
                 $entity->{$methodName}($associatedEntity);
                 // Linking 2: link the main entity to its associated entity. This should normally be done by
                 // 'Linking 1' but because not all components have implemented this, we do it here by ourselves
                 $method = 'set' . ucfirst($value["mappedBy"]);
                 if (method_exists($associatedEntity, $method)) {
                     $associatedEntity->{$method}($entity);
                 }
                 // buffer entity, so we can persist it later
                 $associatedEntityToPersist[] = $associatedEntity;
             }
         }
     }
     if ($entityId != 0) {
         // edit case
         // update the main entry in doctrine so we can store it over doctrine to database later
         $this->savePropertiesToClass($entity, $entityClassMetadata);
         $param = 'editid';
         $successMessage = $_ARRAYLANG['TXT_CORE_RECORD_UPDATED_SUCCESSFUL'];
     } else {
         // add case
         // save main formular class data to its class over $_POST
         $this->savePropertiesToClass($entity, $entityClassMetadata);
         $param = 'add';
         $successMessage = $_ARRAYLANG['TXT_CORE_RECORD_ADDED_SUCCESSFUL'];
     }
     $showSuccessMessage = false;
     if ($entity instanceof \Cx\Core\Model\Model\Entity\YamlEntity) {
         // Save the yaml entities
         $entityRepository = $em->getRepository($entityWithNS);
         if (!$entityRepository->isManaged($entity)) {
             $entityRepository->add($entity);
         }
         $entityRepository->flush();
         $showSuccessMessage = true;
     } else {
         if ($entity instanceof \Cx\Model\Base\EntityBase) {
             /* We try to store the prepared em. This may fail if (for example) we have a one to many association which
                can not be null but was not set in the post request. This cases should be caught here. */
             try {
                 // persist main entity. This must be done first, otherwise saving oneToManyAssociated entities won't work
                 $em->persist($entity);
                 // now we can persist the associated entities. We need to do this, because otherwise it will fail,
                 // if yaml does not contain a cascade option
                 foreach ($associatedEntityToPersist as $associatedEntity) {
                     $em->persist($associatedEntity);
                 }
                 $em->flush();
                 $showSuccessMessage = true;
             } catch (\Cx\Core\Error\Model\Entity\ShinyException $e) {
                 /* Display the message from the exception. If this message is empty, we output a general message,
                    so the user knows what to do in every case */
                 if ($e->getMessage() != "") {
                     \Message::add($e->getMessage(), \Message::CLASS_ERROR);
                 } else {
                     \Message::add($_ARRAYLANG['TXT_CORE_RECORD_UNKNOWN_ERROR'], \Message::CLASS_ERROR);
                 }
                 return;
             } catch (\Exception $e) {
                 echo $e->getMessage();
                 die;
             }
         } else {
             \Message::add($_ARRAYLANG['TXT_CORE_RECORD_VALIDATION_FAILED'], \Message::CLASS_ERROR);
             \DBG::msg('Unkown entity model ' . get_class($entity) . '! Trying to persist using entity manager...');
         }
     }
     if ($showSuccessMessage) {
         \Message::add($successMessage);
     }
     // get the proper action url and redirect the user
     $actionUrl = clone $cx->getRequest()->getUrl();
     $actionUrl->setParam($param, null);
     \Cx\Core\Csrf\Controller\Csrf::redirect($actionUrl);
 }
开发者ID:Niggu,项目名称:cloudrexx,代码行数:101,代码来源:ViewGenerator.class.php


示例13: getSqlSnippets

 /**
  * Returns an array of SQL snippets to include the selected Text records
  * in the query.
  *
  * Provide a single value for the $key, or an array.
  * If you use an array, the array keys *MUST* contain distinct alias names
  * for the respective text keys.
  * The array returned looks as follows:
  *  array(
  *    'alias' => The array of Text field aliases:
  *                array(key => field name alias, ...)
  *               Use the alias to access the text content in the resulting
  *               recordset, or if you need to sort the result by that
  *               column.
  *    'field' => Field snippet to be included in the SQL SELECT, uses
  *               aliased field names for the id ("text_#_id") and text
  *               ("text_#_text") fields.
  *               No leading comma is included!
  *    'join'  => SQL JOIN snippet, the LEFT JOIN with the core_text table
  *               and conditions
  *  )
  * The '#' is replaced by a unique integer number.
  * The '*' may be any descriptive part of the name that disambiguates
  * multiple foreign keys in a single table, like 'name', or 'value'.
  * Note that the $lang_id parameter is mandatory and *MUST NOT* be
  * emtpy.  $alias may be null (or omitted), in which case it is ignored,
  * and the default form "text_<index>" is used, where <index> is an integer
  * incremented on each use.
  * @static
  * @param   string      $field_id   The name of the text ID
  *                                  foreign key field.  Note that this
  *                                  is not part of the SELECTed fields,
  *                                  but used in the JOIN only.
  * @param   integer     $lang_id    The language ID
  * @param   string      $section    The section
  * @param   mixed       $keys       A single key, or an array thereof
  * @return  array                   The array with SQL code parts
  * @author  Reto Kohli <[email protected]>
  */
 static function getSqlSnippets($field_id, $lang_id, $section, $keys)
 {
     static $table_alias_index = 0;
     if (empty($field_id)) {
         DBG::log("Text::getSqlSnippets(): ERROR: Empty field ID");
         return false;
     }
     if (empty($lang_id)) {
         DBG::log("Text::getSqlSnippets(): ERROR: Empty language ID");
         return false;
     }
     if (empty($section)) {
         DBG::log("Text::getSqlSnippets(): ERROR: Empty section");
         return false;
     }
     if (empty($keys)) {
         DBG::log("Text::getSqlSnippets(): ERROR: Empty keys");
         return false;
     }
     if (!is_array($keys)) {
         $keys = array($keys);
     }
     $query_field = '';
     $query_join = '';
     $arrSql = array();
     foreach ($keys as $alias => $key) {
         $table_alias = 'text_' . ++$table_alias_index;
         $field_id_alias = $table_alias . '_id';
         $field_text_alias = $alias ? $alias : $table_alias . '_text';
         $field_text_name = "`{$table_alias}`.`text`";
         $query_field .= ($query_field ? ', ' : '') . "\n                `{$table_alias}`.`id` AS `{$field_id_alias}`,\n                {$field_text_name} AS `{$field_text_alias}`";
         $query_join .= "\n                LEFT JOIN `" . DBPREFIX . "core_text` as `{$table_alias}`\n                  ON `{$table_alias}`.`id`={$field_id}\n                 AND `{$table_alias}`.`lang_id`={$lang_id}\n                 AND `{$table_alias}`.`section`" . (isset($section) ? "='" . addslashes($section) . "'" : ' IS NULL') . "\n                 AND `{$table_alias}`.`key`='" . addslashes($key) . "'";
         $arrSql['alias'][$alias] = $field_text_name;
     }
     $arrSql['field'] = $query_field;
     $arrSql['join'] = $query_join;
     //DBG::log("Text::getSqlSnippets(): field: {$arrSql['field']}");
     //DBG::log("Text::getSqlSnippets(): join: {$arrSql['join']}");
     return $arrSql;
 }
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:79,代码来源:Text.class.php


示例14: urlfind

 /**
  * Find the url exists or not
  * 
  * @param string $url url
  * 
  * @return boolean true on url exists, false otherwise
  */
 function urlfind($url)
 {
     if (!ini_get('allow_url_fopen')) {
         ini_set('allow_url_fopen', 'On');
     }
     if (ini_get('allow_url_fopen')) {
         if ($url) {
             $file = @fopen($url . '/modules/Calendar/Controller/CalendarWebserviceServer.class.php', "r");
         }
         if ($file) {
             fclose($file);
             return true;
         } else {
             return false;
         }
     } else {
         try {
             $request = new \HTTP_Request2($url . 'modules/Calendar/Controller/CalendarWebserviceServer.class.php');
             $response = $request->send();
             if (404 == $response->getStatus()) {
                 return false;
             } else {
                 return true;
             }
         } catch (Exception $e) {
             \DBG::msg($e->getMessage());
             return false;
         }
     }
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:37,代码来源:CalendarEventManager.class.php


示例15: _newsletterUpdate

function _newsletterUpdate()
{
    global $objDatabase, $objUpdate, $_CONFIG;
    try {
        \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_newsletter_category', array('id' => array('type' => 'INT(11)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'status' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => '0', 'after' => 'id'), 'name' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'status'), 'notification_email' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'default' => '', 'after' => 'name')), array('name' => array('fields' => array('name'))));
        \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_newsletter_confirm_mail', array('id' => array('type' => 'INT(1)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'title' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'id'), 'content' => array('type' => 'longtext', 'after' => 'title'), 'recipients' => array('type' => 'text', 'after' => 'content')));
        \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_newsletter', array('id' => array('type' => 'INT(11)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'subject' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'id'), 'template' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0', 'after' => 'subject'), 'content' => array('type' => 'text', 'after' => 'template'), 'attachment' => array('type' => 'ENUM(\'0\',\'1\')', 'notnull' => true, 'default' => '0', 'after' => 'content'), 'priority' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => '0', 'after' => 'attachment'), 'sender_email' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'priority'), 'sender_name' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'sender_email'), 'return_path' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'sender_name'), 'smtp_server' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'return_path'), 'status' => array('type' => 'INT(1)', 'notnull' => true, 'default' => '0', 'after' => 'smtp_server'), 'count' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0', 'after' => 'status'), 'recipient_count' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'count'), 'date_create' => array('type' => 'INT(14)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'recipient_count'), 'date_sent' => array('type' => 'INT(14)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'date_create'), 'tmp_copy' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => '0', 'after' => 'date_sent')));
    } catch (\Cx\Lib\UpdateException $e) {
        return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
    }
    DBG::msg("Done checking tables.. going to check settings");
    //the two values notifyOnUnsubscribe and notificationUnsubscribe have been merged into the latter.
    $unsubscribeVal = 1;
    try {
        DBG::msg("Retrieving old unsubscribe value if set.");
        $res = \Cx\Lib\UpdateUtil::sql("SELECT setvalue FROM " . DBPREFIX . "module_newsletter_settings WHERE setname='notifyOnUnsubscribe'");
        if (!$res->EOF) {
            $unsubscribeVal = $res->fields['setvalue'];
        } else {
            DBG::msg("Not found. Retrieving new unsubscribe value if set.");
            $res = \Cx\Lib\UpdateUtil::sql("SELECT setvalue FROM " . DBPREFIX . "module_newsletter_settings WHERE setname='notificatonUnsubscribe'");
            if (!$res->EOF) {
                $unsubscribeVal = $res->fields['setvalue'];
            }
        }
    } catch (\Cx\Lib\UpdateException $e) {
        return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
    }
    $settings = array('sender_mail' => array('setid' => 1, 'setname' => 'sender_mail', 'setvalue' => '[email protected]', 'status' => 1), 'sender_name' => array('setid' => 2, 'setname' => 'sender_name', 'setvalue' => 'admin', 'status' => 1), 'reply_mail' => array('setid' => 3, 'setname' => 'reply_mail', 'setvalue' => '[email protected]', 'status' => 1), 'mails_per_run' => array('setid' => 4, 'setname' => 'mails_per_run', 'setvalue' => '30', 'status' => 1), 'text_break_after' => array('setid' => 5, 'setname' => 'text_break_after', 'setvalue' => '100', 'status' => 1), 'test_mail' => array('setid' => 6, 'setname' => 'test_mail', 'setvalue' => '[email protected]', 'status' => 1), 'overview_entries_limit' => array('setid' => 7, 'setname' => 'overview_entries_limit', 'setvalue' => '10', 'status' => 1), 'rejected_mail_operation' => array('setid' => 8, 'setname' => 'rejected_mail_operation', 'setvalue' => 'delete', 'status' => 1), 'defUnsubscribe' => array('setid' => 9, 'setname' => 'defUnsubscribe', 'setvalue' => '0', 'status' => 1), 'notificationSubscribe' => array('setid' => 11, 'setname' => 'notificationSubscribe', 'setvalue' => '1', 'status' => 1), 'notificationUnsubscribe' => array('setid' => 10, 'setname' => 'notificationUnsubscribe', 'setvalue' => $unsubscribeVal, 'status' => 1), 'recipient_attribute_status' => array('setid' => 12, 'setname' => 'recipient_attribute_status', 'setvalue' => '{"recipient_sex":{"active":true,"required":false},"recipient_salutation":{"active":true,"required":false},"recipient_title":{"active":false,"required":false},"recipient_firstname":{"active":true,"required":false},"recipient_lastname":{"active":true,"required":false},"recipient_position":{"active":false,"required":false},"recipient_company":{"active":true,"required":false},"recipient_industry":{"active":false,"required":false},"recipient_address":{"active":true,"required":false},"recipient_city":{"active":true,"required":false},"recipient_zip":{"active":true,"required":false},"recipient_country":{"active":true,"required":false},"recipient_phone":{"active":true,"required":false},"recipient_private":{"active":false,"required":false},"recipient_mobile":{"active":false,"required":false},"recipient_fax":{"active":false,"required":false},"recipient_birthday":{"active":true,"required":false},"recipient_website":{"active":false,"required":false}}', 'status' => 1), 'reject_info_mail_text' => array('setid' => 13, 'setname' => 'reject_info_mail_text', 'setvalue' => 'Der Newsletter konnte an folgende E-Mail-Adresse nicht versendet werden:\\r\\n[[EMAIL]]\\r\\n\\r\\nUm die E-Mail Adresse zu bearbeiten, klicken Sie bitte auf den folgenden Link:\\r\\n[[LINK]]', 'status' => 1));
    try {
        DBG::msg("Reading current settings");
        $res = \Cx\Lib\UpdateUtil::sql("SELECT * FROM " . DBPREFIX . "module_newsletter_settings");
        while (!$res->EOF) {
            $field = $res->fields['setname'];
            DBG::msg("...merging {$field} with default settings");
            if (isset($settings[$field])) {
                //do we have another value for this?
                $settings[$field]['setvalue'] = $res->fields['setvalue'];
            }
            $res->MoveNext();
        }
        DBG::msg("Updating settings");
        foreach ($settings as $entry) {
            $setid = intval($entry['setid']);
            $field = addslashes($entry['setname']);
            $value = addslashes($entry['setvalue']);
            $status = intval($entry['status']);
            DBG::msg("...deleting field {$field}");
            \Cx\Lib\UpdateUtil::sql("DELETE FROM " . DBPREFIX . "module_newsletter_settings WHERE setid = '{$setid}' OR setname = '{$field}'");
            DBG::msg("...rewriting field {$field}");
            \Cx\Lib\UpdateUtil::sql("\n                INSERT INTO " . DBPREFIX . "module_newsletter_settings\n                    (setid, setname, setvalue, status)\n                VALUES (\n                    '{$setid}', '{$field}', '{$value}', '{$status}'\n                );\n            ");
        }
        DBG::msg("Deleting old unsubscribe key if set");
        \Cx\Lib\UpdateUtil::sql("DELETE FROM " . DBPREFIX . "module_newsletter_settings WHERE setname='notifyOnUnsubscribe'");
        DBG::msg("Done with newsletter update");
    } catch (\Cx\Lib\UpdateException $e) {
        return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
    }
    try {
        DBG::msg("Setting recipient count");
        $objResult = \Cx\Lib\UpdateUtil::sql("SELECT `newsletter`, COUNT(1) AS recipient_count FROM `" . DBPREFIX . "module_newsletter_tmp_sending` GROUP BY `newsletter`");
        if ($objResult->RecordCount()) {
            while (!$objResult->EOF) {
                \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "module_newsletter` SET `recipient_count` = " . $objResult->fields['recipient_count'] . " WHERE `id`=" . $objResult->fields['newsletter']);
                $objResult->MoveNext();
            }
        }
    } catch (\Cx\Lib\UpdateException $e) {
        return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
    }
    // Add notification recipients to confirm_mail table
    try {
        $objResult = \Cx\Lib\UpdateUtil::sql("SELECT id FROM `" . DBPREFIX . "module_newsletter_confirm_mail` WHERE id='3'");
        if ($objResult->RecordCount() == 0) {
            DBG::msg("inserting standard confirm mails");
            \Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "module_newsletter_confirm_mail` (`id` ,`title` ,`content` ,`recipients`) VALUES ('3', '[[url]] - Neue Newsletter Empfänger [[action]]', 'Hallo Admin Eine neue Empfänger [[action]] in ihrem Newsletter System. Automatisch generierte Nachricht [[date]]', '');");
        }
    } catch (\Cx\Lib\UpdateException $e) {
        return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
    }
    try {
        \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_newsletter_access_user', array('accessUserID' => array('type' => 'INT(5)', 'unsigned' => true), 'newsletterCategoryID' => array('type' => 'INT(11)', 'after' => 'accessUserID'), 'code' => array('type' => 'VARCHAR(255)', 'after' => 'newsletterCategoryID', 'notnull' => true, 'default' => '')), array('rel' => array('fields' => array('accessUserID', 'newsletterCategoryID'), 'type' => 'UNIQUE'), 'accessUserID' => array('fields' => array('accessUserID'))));
        // set random newsletter code for access recipients
        \Cx\Lib\UpdateUtil::sql('UPDATE ' . DBPREFIX . 'module_newsletter_access_user SET `code` = SUBSTR(MD5(RAND()),1,12) WHERE `code` = \'\'');
        \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_newsletter_rel_usergroup_newsletter', array('userGroup' => array('type' => 'INT(10)', 'unsigned' => true), 'newsletter' => array('type' => 'INT(10)', 'unsigned' => true, 'after' => 'userGroup')), array('uniq' => array('fields' => array('userGroup', 'newsletter'), 'type' => 'UNIQUE')));
        \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_newsletter_settings', array('setid' => array('type' => 'INT(6)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'setname' => array('type' => ' 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP DBLayer类代码示例发布时间:2022-05-23
下一篇:
PHP DBField类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap