当前位置: 首页>>代码示例>>PHP>>正文


PHP Application::Database方法代码示例

本文整理汇总了PHP中CBLib\Application\Application::Database方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::Database方法的具体用法?PHP Application::Database怎么用?PHP Application::Database使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CBLib\Application\Application的用法示例。


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

示例1: initNotification

 /**
  * Fills object with all standard items of a Notification record
  *
  * @param  cbpaidPayHandler     $payHandler
  * @param  int                  $test_ipn
  * @param  string               $log_type
  * @param  string               $paymentStatus
  * @param  string               $paymentType
  * @param  string               $reasonCode
  * @param  int                  $paymentTime
  * @param  string               $charset
  */
 public function initNotification($payHandler, $test_ipn, $log_type, $paymentStatus, $paymentType, $reasonCode, $paymentTime, $charset = 'utf-8')
 {
     $this->payment_method = $payHandler->getPayName();
     $this->gateway_account = $payHandler->getAccountParam('id');
     $this->log_type = $log_type;
     $this->time_received = Application::Database()->getUtcDateTime();
     $this->ip_addresses = cbpaidRequest::getIPlist();
     $this->geo_ip_country_code = cbpaidRequest::getGeoIpCountryCode();
     $this->notify_version = '2.1';
     $this->user_id = (int) cbGetParam($_GET, 'user', 0);
     $this->charset = $charset;
     $this->test_ipn = $test_ipn;
     $this->payer_status = 'unverified';
     $this->payment_status = $paymentStatus;
     if (in_array($paymentStatus, array('Completed', 'Pending', 'Processed', 'Failed', 'Reversed', 'Refunded', 'Partially-Refunded', 'Canceled_Reversal'))) {
         if (in_array($paymentStatus, array('Completed', 'Reversed', 'Refunded', 'Partially-Refunded', 'Canceled_Reversal'))) {
             $this->payment_date = gmdate('H:i:s M d, Y T', $paymentTime);
             // paypal-style
         }
         $this->payment_type = $paymentType;
     }
     if ($reasonCode) {
         $this->reason_code = $reasonCode;
     }
 }
开发者ID:jasonrgd,项目名称:Digital-Publishing-Platform-Joomla,代码行数:37,代码来源:cbpaidPaymentNotification.php

示例2: store

	/**
	 * @param bool $updateNulls
	 * @return bool
	 */
	public function store( $updateNulls = false )
	{
		global $_PLUGINS;

		$new	=	( $this->get( 'id' ) ? false : true );
		$old	=	new self();

		$this->set( 'date', $this->get( 'date', Application::Database()->getUtcDateTime() ) );

		if ( ! $new ) {
			$old->load( (int) $this->get( 'id' ) );

			$_PLUGINS->trigger( 'gj_onBeforeUpdateAttendance', array( &$this, $old ) );
		} else {
			$_PLUGINS->trigger( 'gj_onBeforeCreateAttendance', array( &$this ) );
		}

		if ( ! parent::store( $updateNulls ) ) {
			return false;
		}

		if ( ! $new ) {
			$_PLUGINS->trigger( 'gj_onAfterUpdateAttendance', array( $this, $old ) );
		} else {
			$_PLUGINS->trigger( 'gj_onAfterCreateAttendance', array( $this ) );
		}

		return true;
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:33,代码来源:AttendanceTable.php

示例3: __construct

 /**
  * Constructor
  *
  * @param  DatabaseDriverInterface  $db              Database driver interface
  * @param  boolean                  $silentTestLogs  TRUE: Silent on successful tests
  */
 public function __construct(DatabaseDriverInterface $db = null, $silentTestLogs = true)
 {
     if ($db === null) {
         $db = Application::Database();
     }
     $this->_db = $db;
     $this->_silentTestLogs = $silentTestLogs;
 }
开发者ID:Raul-mz,项目名称:web-erpcya,代码行数:14,代码来源:DatabaseUpgrade.php

示例4: __construct

 /**
  * Constructor
  *
  * @param DatabaseDriverInterface  $db  Database driver
  */
 public function __construct(DatabaseDriverInterface $db = null)
 {
     if ($db === null) {
         $db = Application::Database();
     }
     $this->_db = $db;
     $this->_silentWhenOK = false;
 }
开发者ID:bobozhangshao,项目名称:HeartCare,代码行数:13,代码来源:CBDatabaseChecker.php

示例5: __construct

 /**
  *	Constructor (allows to set non-standard table and key field)
  *	Can be overloaded/supplemented by the child class
  *
  *	@param  DatabaseDriverInterface  $db     [optional] CB Database object
  *	@param  string                   $table  [optional] Name of the table in the db schema relating to child class
  *	@param  string|array             $key    [optional] Name of the primary key field in the table
  */
 public function __construct(DatabaseDriverInterface $db = null, $table = null, $key = null)
 {
     if ($db) {
         $this->_db = $db;
     } else {
         $this->_db = Application::Database();
     }
     if ($table) {
         $this->_tbl = $table;
     }
     if ($key) {
         $this->_tbl_key = $key;
     }
 }
开发者ID:ankaau,项目名称:GathBandhan,代码行数:22,代码来源:Table.php

示例6: showEvents

	/**
	 * prepare frontend events render
	 *
	 * @param string     $return
	 * @param GroupTable $group
	 * @param string     $users
	 * @param string     $invites
	 * @param array      $counters
	 * @param array      $buttons
	 * @param array      $menu
	 * @param cbTabs     $tabs
	 * @param UserTable  $user
	 * @return array|null
	 */
	public function showEvents( &$return, &$group, &$users, &$invites, &$counters, &$buttons, &$menu, &$tabs, $user )
	{
		global $_CB_framework, $_CB_database;

		CBGroupJive::getTemplate( 'events', true, true, $this->element );

		$canModerate			=	( CBGroupJive::isModerator( $user->get( 'id' ) ) || ( CBGroupJive::getGroupStatus( $user, $group ) >= 2 ) );
		$limit					=	(int) $this->params->get( 'groups_events_limit', 15 );
		$limitstart				=	$_CB_framework->getUserStateFromRequest( 'gj_group_events_limitstart{com_comprofiler}', 'gj_group_events_limitstart' );
		$search					=	$_CB_framework->getUserStateFromRequest( 'gj_group_events_search{com_comprofiler}', 'gj_group_events_search' );
		$where					=	null;

		if ( $search && $this->params->get( 'groups_events_search', 1 ) ) {
			$where				.=	"\n AND ( e." . $_CB_database->NameQuote( 'title' ) . " LIKE " . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $search, true ) . '%', false )
								.	" OR e." . $_CB_database->NameQuote( 'event' ) . " LIKE " . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $search, true ) . '%', false )
								.	" OR e." . $_CB_database->NameQuote( 'address' ) . " LIKE " . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $search, true ) . '%', false )
								.	" OR e." . $_CB_database->NameQuote( 'location' ) . " LIKE " . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $search, true ) . '%', false ) . " )";
		}

		$searching				=	( $where ? true : false );

		$query					=	'SELECT COUNT(*)'
								.	"\n FROM " . $_CB_database->NameQuote( '#__groupjive_plugin_events' ) . " AS e"
								.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__comprofiler' ) . " AS cb"
								.	' ON cb.' . $_CB_database->NameQuote( 'id' ) . ' = e.' . $_CB_database->NameQuote( 'user_id' )
								.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__users' ) . " AS j"
								.	' ON j.' . $_CB_database->NameQuote( 'id' ) . ' = cb.' . $_CB_database->NameQuote( 'id' )
								.	"\n WHERE e." . $_CB_database->NameQuote( 'group' ) . " = " . (int) $group->get( 'id' )
								.	"\n AND cb." . $_CB_database->NameQuote( 'approved' ) . " = 1"
								.	"\n AND cb." . $_CB_database->NameQuote( 'confirmed' ) . " = 1"
								.	"\n AND j." . $_CB_database->NameQuote( 'block' ) . " = 0";

		if ( ! $canModerate ) {
			$query				.=	"\n AND ( e." . $_CB_database->NameQuote( 'user_id' ) . " = " . (int) $user->get( 'id' )
								.		' OR e.' . $_CB_database->NameQuote( 'published' ) . ' = 1 )';
		}

		$query					.=	$where;
		$_CB_database->setQuery( $query );
		$total					=	(int) $_CB_database->loadResult();

		if ( ( ! $total ) && ( ! $searching ) && ( ! CBGroupJive::canCreateGroupContent( $user, $group, 'events' ) ) ) {
			return null;
		}

		$pageNav				=	new cbPageNav( $total, $limitstart, $limit );

		$pageNav->setInputNamePrefix( 'gj_group_events_' );

		$guests					=	'SELECT COUNT(*)'
								.	"\n FROM " . $_CB_database->NameQuote( '#__groupjive_plugin_events_attendance' ) . " AS ea"
								.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__comprofiler' ) . " AS eacb"
								.	' ON eacb.' . $_CB_database->NameQuote( 'id' ) . ' = ea.' . $_CB_database->NameQuote( 'user_id' )
								.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__users' ) . " AS eaj"
								.	' ON eaj.' . $_CB_database->NameQuote( 'id' ) . ' = eacb.' . $_CB_database->NameQuote( 'id' )
								.	"\n WHERE ea." . $_CB_database->NameQuote( 'event' ) . " = e." . $_CB_database->NameQuote( 'id' )
								.	"\n AND eacb." . $_CB_database->NameQuote( 'approved' ) . " = 1"
								.	"\n AND eacb." . $_CB_database->NameQuote( 'confirmed' ) . " = 1"
								.	"\n AND eaj." . $_CB_database->NameQuote( 'block' ) . " = 0";

		$now					=	Application::Database()->getUtcDateTime();

		$query					=	'SELECT e.*'
								.	', TIMESTAMPDIFF( SECOND, ' . $_CB_database->Quote( $now ) . ',e.' . $_CB_database->NameQuote( 'start' ) . ' ) AS _start_ordering'
								.	', TIMESTAMPDIFF( SECOND, ' . $_CB_database->Quote( $now ) . ', e.' . $_CB_database->NameQuote( 'end' ) . ' ) AS _end_ordering'
								.	', a.' . $_CB_database->NameQuote( 'id' ) . ' AS _attending'
								.	', ( ' . $guests . ' ) AS _guests'
								.	"\n FROM " . $_CB_database->NameQuote( '#__groupjive_plugin_events' ) . " AS e"
								.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__comprofiler' ) . " AS cb"
								.	' ON cb.' . $_CB_database->NameQuote( 'id' ) . ' = e.' . $_CB_database->NameQuote( 'user_id' )
								.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__users' ) . " AS j"
								.	' ON j.' . $_CB_database->NameQuote( 'id' ) . ' = cb.' . $_CB_database->NameQuote( 'id' )
								.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__groupjive_plugin_events_attendance' ) . " AS a"
								.	' ON a.' . $_CB_database->NameQuote( 'user_id' ) . ' = ' . (int) $user->get( 'id' )
								.	' AND a.' . $_CB_database->NameQuote( 'event' ) . ' = e.' . $_CB_database->NameQuote( 'id' )
								.	"\n WHERE e." . $_CB_database->NameQuote( 'group' ) . " = " . (int) $group->get( 'id' )
								.	"\n AND cb." . $_CB_database->NameQuote( 'approved' ) . " = 1"
								.	"\n AND cb." . $_CB_database->NameQuote( 'confirmed' ) . " = 1"
								.	"\n AND j." . $_CB_database->NameQuote( 'block' ) . " = 0";

		if ( ! $canModerate ) {
			$query				.=	"\n AND ( e." . $_CB_database->NameQuote( 'user_id' ) . " = " . (int) $user->get( 'id' )
								.		' OR e.' . $_CB_database->NameQuote( 'published' ) . ' = 1 )';
		}

		$query					.=	$where
//.........这里部分代码省略.........
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:101,代码来源:cbgroupjiveevents.php

示例7: store

	/**
	 * @param bool $updateNulls
	 * @return bool
	 */
	public function store( $updateNulls = false )
	{
		global $_CB_framework, $_PLUGINS;

		$new					=	( $this->get( 'id' ) ? false : true );
		$old					=	new self();

		$this->set( 'date', $this->get( 'date', Application::Database()->getUtcDateTime() ) );

		if ( isset( $_FILES['file']['tmp_name'] ) && ( ! empty( $_FILES['file']['tmp_name'] ) ) ) {
			$basePath			=	$_CB_framework->getCfg( 'absolute_path' ) . '/images/comprofiler/cbgroupjivefile';
			$filePath			=	$basePath . '/' . (int) $this->group()->get( 'category' ) . '/' . (int) $this->group()->get( 'id' );

			CBGroupJive::createDirectory( $basePath, $this->group()->get( 'category' ), $this->group()->get( 'id' ) );

			$fileExtension		=	strtolower( preg_replace( '/[^-a-zA-Z0-9_]/', '', pathinfo( $_FILES['file']['name'], PATHINFO_EXTENSION ) ) );
			$fileName			=	Get::clean( pathinfo( $_FILES['file']['name'], PATHINFO_FILENAME ), GetterInterface::STRING ) . '.' . $fileExtension;
			$fileId				=	uniqid();

			$newFileName		=	$fileId . '.' . $fileExtension;

			if ( ! move_uploaded_file( $_FILES['file']['tmp_name'], $filePath . '/' . $newFileName ) ) {
				$this->setError( CBTxt::T( 'GROUP_FILE_UPLOAD_FAILED', 'The file [file] failed to upload!', array( '[file]' => $newFileName ) ) );

				return false;
			} else {
				@chmod( $filePath . '/' . $newFileName, 0755 );
			}

			if ( $this->get( 'file' ) && file_exists( $filePath . '/' . $this->get( 'file' ) ) ) {
				@unlink( $filePath . '/' . $this->get( 'file' ) );
			}

			$this->set( 'file', $newFileName );
			$this->set( 'filename', $fileName );

			$params					=	$this->params();

			$params->unsetEntry( 'name' );
			$params->unsetEntry( 'extension' );
			$params->unsetEntry( 'mimetype' );
			$params->unsetEntry( 'filesize' );

			$params->set( 'name', $this->name() );
			$params->set( 'extension', $this->extension() );
			$params->set( 'mimetype', $this->mimeType() );
			$params->set( 'filesize', $this->size( true ) );

			$this->set( 'params', $params->asJson() );
		} elseif ( ! $this->get( 'filename' ) ) {
			$this->set( 'filename', $this->get( 'file' ) );
		}

		if ( ! $new ) {
			$old->load( (int) $this->get( 'id' ) );

			$_PLUGINS->trigger( 'gj_onBeforeUpdateFile', array( &$this, $old ) );
		} else {
			$_PLUGINS->trigger( 'gj_onBeforeCreateFile', array( &$this ) );
		}

		if ( ! parent::store( $updateNulls ) ) {
			return false;
		}

		if ( $old->get( 'id' ) && $this->get( 'file' ) && ( $old->get( 'group' ) != $this->get( 'group' ) ) ) {
			$basePath			=	$_CB_framework->getCfg( 'absolute_path' ) . '/images/comprofiler/cbgroupjivefile';
			$oldPath			=	$basePath . '/' . (int) $old->group()->get( 'category' ) . '/' . (int) $old->group()->get( 'id' );
			$newPath			=	$basePath . '/' . (int) $this->group()->get( 'category' ) . '/' . (int) $this->group()->get( 'id' );

			if ( is_dir( $oldPath ) ) {
				CBGroupJive::createDirectory( $basePath, $this->group()->get( 'category' ), $this->group()->get( 'id' ) );

				if ( file_exists( $oldPath . '/' . $this->get( 'file' ) ) ) {
					@rename( $oldPath . '/' . $this->get( 'file' ), $newPath . '/' . $this->get( 'file' ) );
				}
			}
		}

		if ( ! $new ) {
			$_PLUGINS->trigger( 'gj_onAfterUpdateFile', array( $this, $old ) );
		} else {
			$_PLUGINS->trigger( 'gj_onAfterCreateFile', array( $this ) );
		}

		return true;
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:91,代码来源:FileTable.php

示例8: updateBasketRecomputeTotalizers

 /**
  * Used internally and in promotion plugin
  *
  * @return void
  */
 public function updateBasketRecomputeTotalizers()
 {
     $this->loadPaymentItems();
     $tryAutorecurring = $this->isAnyAutoRecurring();
     if ($this->payment_status == 'NotInitiated') {
         $timeOfBasket = cbpaidTimes::getInstance()->startTime();
         $this->time_initiated = Application::Database()->getUtcDateTime($timeOfBasket);
     } else {
         $timeOfBasket = cbpaidTimes::getInstance()->strToTime($this->time_initiated);
     }
     $this->deleteTotalizers();
     $this->_storeBasketItemsTotalizers($tryAutorecurring, $timeOfBasket);
 }
开发者ID:jasonrgd,项目名称:Digital-Publishing-Platform-Joomla,代码行数:18,代码来源:cbpaidPaymentBasket.php

示例9: updatePaymentStatus

 /**
  * Updates payment status of basket and of corresponding subscriptions if there is a change in status
  *
  * @param  cbpaidPaymentBasket        $paymentBasket         Basket
  * @param  string                     $eventType             type of event (paypal type): 'web_accept', 'subscr_payment', 'subscr_signup', 'subscr_modify', 'subscr_eot', 'subscr_cancel', 'subscr_failed'
  * @param  string                     $paymentStatus         new status (Completed, RegistrationCancelled)
  * @param  cbpaidPaymentNotification  $notification          notification object of the payment
  * @param  int                        $occurrences           renewal occurrences
  * @param  int                        $autorecurring_type    0: not auto-recurring, 1: auto-recurring without payment processor notifications, 2: auto-renewing with processor notifications updating $expiry_date
  * @param  int                        $autorenew_type        0: not auto-renewing (manual renewals), 1: asked for by user, 2: mandatory by configuration
  * @param  boolean|string             $txnIdMultiplePaymentDates  FALSE: unique txn_id for each payment, TRUE: same txn_id can have multiple payment dates, additionally: 'SINGLEPAYMENT' will not look at txn_id at all
  * @param  boolean                    $storePaymentRecord   TRUE: normal case, create payment record if needed. FALSE: offline case where pending payment should not create a payment record.
  * @return void
  */
 public function updatePaymentStatus($paymentBasket, $eventType, $paymentStatus, &$notification, $occurrences, $autorecurring_type, $autorenew_type, $txnIdMultiplePaymentDates, $storePaymentRecord = true)
 {
     global $_CB_framework, $_PLUGINS;
     $pluginsLoaded = false;
     $basketUpdateNulls = false;
     $previousUnifiedStatus = $this->mapPaymentStatus($paymentBasket->payment_status);
     $unifiedStatus = $this->mapPaymentStatus($paymentStatus);
     // get all related subscriptions being paid by this basket:
     $subscriptions = $paymentBasket->getSubscriptions();
     $thisIsReferencePayment = false;
     $user = CBuser::getUserDataInstance((int) $paymentBasket->user_id);
     if ($paymentBasket->payment_status != $paymentStatus || $unifiedStatus == 'Partially-Refunded' || $autorecurring_type) {
         if ($paymentStatus && (in_array($eventType, array('web_accept', 'subscr_payment', 'subscr_signup')) || in_array($unifiedStatus, array('Reversed', 'Refunded', 'Partially-Refunded')))) {
             $paymentBasket->payment_status = $paymentStatus;
         }
         if (in_array($eventType, array('subscr_payment', 'subscr_signup'))) {
             $paymentBasket->recurring = 1;
         }
         if ($autorecurring_type == 0 && in_array($unifiedStatus, array('Completed', 'Processed', 'FreeTrial'))) {
             $paymentBasket->mc_amount1 = null;
             $paymentBasket->mc_amount3 = null;
             $paymentBasket->period1 = null;
             $paymentBasket->period3 = null;
             $basketUpdateNulls = true;
         }
         // if (count($subscriptions) >= 1) {
         $now = $_CB_framework->now();
         $completed = false;
         $thisIsReferencePayment = false;
         $reason = null;
         switch ($unifiedStatus) {
             case 'FreeTrial':
             case 'Completed':
             case 'Processed':
                 // this includes Canceled_Reversal !!! :
                 if ($unifiedStatus == 'FreeTrial') {
                     $paymentBasket->payment_status = 'Completed';
                 }
                 if ($unifiedStatus == 'FreeTrial' || $unifiedStatus == 'Completed') {
                     if ($notification->payment_date) {
                         $time_completed = cbpaidTimes::getInstance()->gmStrToTime($notification->payment_date);
                     } else {
                         $time_completed = $now;
                     }
                     $paymentBasket->time_completed = Application::Database()->getUtcDateTime($time_completed);
                     $completed = true;
                 }
                 if ($paymentStatus == 'Canceled_Reversal') {
                     $paymentBasket->payment_status = 'Completed';
                 }
                 if (is_object($notification) && isset($notification->txn_id)) {
                     // real payment with transaction id: store as reference payment if not already stored:
                     $thisIsReferencePayment = $this->_storePaymentOnce($paymentBasket, $notification, $now, $txnIdMultiplePaymentDates, 'Updating payment record because of new status of payment basket: ' . $unifiedStatus . ($paymentStatus != $unifiedStatus ? ' (new gateway-status: ' . $paymentStatus . ')' : '') . ' because of event received: ' . $eventType . '. Previous status was: ' . $previousUnifiedStatus);
                 } else {
                     // Free trials don't have a notification:
                     $thisIsReferencePayment = true;
                 }
                 if ($thisIsReferencePayment) {
                     // payment not yet processed:
                     $autorenewed = $paymentBasket->recurring == 1 && $unifiedStatus == 'Completed' && $previousUnifiedStatus == 'Completed';
                     for ($i = 0, $n = count($subscriptions); $i < $n; $i++) {
                         $reason = $autorenewed ? 'R' : $subscriptions[$i]->_reason;
                         $subscriptions[$i]->activate($user, $now, $completed, $reason, $occurrences, $autorecurring_type, $autorenew_type, $autorenewed ? 1 : 0);
                     }
                 }
                 break;
             case 'RegistrationCancelled':
             case 'Reversed':
             case 'Refunded':
             case 'Unsubscribed':
                 if ($unifiedStatus == 'RegistrationCancelled') {
                     if (!($previousUnifiedStatus == 'NotInitiated' || $previousUnifiedStatus === 'Pending' && $paymentBasket->payment_method === 'offline')) {
                         return;
                     }
                 }
                 for ($i = 0, $n = count($subscriptions); $i < $n; $i++) {
                     $reason = $subscriptions[$i]->_reason;
                     if ($reason != 'R' || in_array($unifiedStatus, array('Reversed', 'Refunded'))) {
                         // Expired and Cancelled as well as Partially-Refunded are not reverted !		//TBD: really revert on refund everything ? a plan param would be nice here
                         if (!in_array($previousUnifiedStatus, array('Pending', 'In-Progress', 'Denied', 'Reversed', 'Refunded')) && in_array($subscriptions[$i]->status, array('A', 'R', 'I')) && !$subscriptions[$i]->hasPendingPayment($paymentBasket->id)) {
                             // not a cancelled or denied renewal:
                             $subscriptions[$i]->revert($user, $unifiedStatus);
                         }
                     }
                 }
                 if ($unifiedStatus == 'RegistrationCancelled') {
//.........这里部分代码省略.........
开发者ID:jasonrgd,项目名称:Digital-Publishing-Platform-Joomla,代码行数:101,代码来源:cbpaidPayHandler.php

示例10: plug_cbgroupjiveevents_install

function plug_cbgroupjiveevents_install()
{
	global $_CB_database;

	// Grab GJ params to migrate the legacy params:
	$plugin						=	new PluginTable();

	$plugin->load( array( 'element' => 'cbgroupjive' ) );

	$pluginParams				=	new Registry( $plugin->get( 'params' ) );

	if ( $pluginParams->has( 'events_event_content' ) || ( $pluginParams->get( 'events_event_content' ) != null ) ) {
		// Migrate events integration parameters:
		$events					=	new PluginTable();

		$events->load( array( 'element' => 'cbgroupjiveevents' ) );

		$eventsParams			=	new Registry( $events->get( 'params' ) );

		if ( ! $eventsParams->get( 'migrated' ) ) {
			$eventsParams->set( 'groups_events_content_plugins', $pluginParams->get( 'events_event_content' ) );
			$eventsParams->set( 'groups_events_address', $pluginParams->get( 'events_plotting' ) );
			$eventsParams->set( 'groups_events_captcha', $pluginParams->get( 'events_captcha' ) );
			$eventsParams->set( 'groups_events_paging', $pluginParams->get( 'group_tab_paging' ) );
			$eventsParams->set( 'groups_events_limit', $pluginParams->get( 'group_tab_limit' ) );
			$eventsParams->set( 'groups_events_search', $pluginParams->get( 'group_tab_search' ) );
			$eventsParams->set( 'migrated', true );

			$events->set( 'params', $eventsParams->asJson() );

			$events->store();
		}
	}

	$table						=	'#__groupjive_plugin_events';
	$fields						=	$_CB_database->getTableFields( $table );

	if ( isset( $fields[$table]['date'] ) ) {
		$now					=	Application::Database()->getUtcDateTime();

		// Move attending to attendance table:
		$query					=	'SELECT ' . $_CB_database->NameQuote( 'id' )
								.	', ' . $_CB_database->NameQuote( 'attending' )
								.	"\n FROM " . $_CB_database->NameQuote( '#__groupjive_plugin_events' );
		$_CB_database->setQuery( $query );
		$rows					=	$_CB_database->loadAssocList( 'id', 'attending' );

		$attend					=	array();

		foreach ( $rows as $id => $attending ) {
			foreach ( explode( '|*|', $attending ) as $attendee ) {
				$attendee		=	explode( ':', $attendee );
				$userId			=	( isset( $attendee[0] ) ? (int) $attendee[0] : null );
				$attendance		=	( isset( $attendee[1] ) ? (int) $attendee[1] : null );

				if ( $userId && ( $attendance == 1 ) ) {
					$attend[]	=	'( ' . (int) $userId . ', ' . (int) $id . ', ' . $_CB_database->Quote( $now ) . ' )';
				}
			}
		}

		if ( $attend ) {
			$query				=	'INSERT IGNORE INTO '. $_CB_database->NameQuote( '#__groupjive_plugin_events_attendance' )
								.	' ( '
								.		$_CB_database->NameQuote( 'user_id' )
								.		', ' . $_CB_database->NameQuote( 'event' )
								.		', ' . $_CB_database->NameQuote( 'date' )
								.	' ) VALUES ' . implode( ', ', $attend );
			$_CB_database->setQuery( $query );
			$_CB_database->query();
		}

		// Mode date to start:
		$query					=	'UPDATE '. $_CB_database->NameQuote( '#__groupjive_plugin_events' )
								.	"\n SET " . $_CB_database->NameQuote( 'start' ) . " = " . $_CB_database->NameQuote( 'date' );
		$_CB_database->setQuery( $query );
		$_CB_database->query();

		// Remove the old columns:
		$_CB_database->dropColumn( $table, 'latitude' );
		$_CB_database->dropColumn( $table, 'longitude' );
		$_CB_database->dropColumn( $table, 'attending' );
		$_CB_database->dropColumn( $table, 'date' );
	}
}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:85,代码来源:install.cbgroupjiveevents.php

示例11: store

	/**
	 * @param bool $updateNulls
	 * @return bool
	 */
	public function store( $updateNulls = false )
	{
		global $_CB_framework, $_PLUGINS;

		$new						=	( $this->get( 'id' ) ? false : true );
		$old						=	new self();

		$this->set( 'date', $this->get( 'date', Application::Database()->getUtcDateTime() ) );

		if ( isset( $_FILES['image']['tmp_name'] ) && ( ! empty( $_FILES['image']['tmp_name'] ) ) ) {
			static $params		=	null;

			if ( ! $params ) {
				$plugin				=	$_PLUGINS->getLoadedPlugin( 'user/plug_cbgroupjive/plugins', 'cbgroupjivephoto' );
				$params				=	$_PLUGINS->getPluginParams( $plugin );
			}

			$basePath				=	$_CB_framework->getCfg( 'absolute_path' ) . '/images/comprofiler/cbgroupjivephoto';
			$filePath				=	$basePath . '/' . (int) $this->group()->get( 'category' ) . '/' . (int) $this->group()->get( 'id' );

			CBGroupJive::createDirectory( $basePath, $this->group()->get( 'category' ), $this->group()->get( 'id' ) );

			$resample				=	$params->get( 'groups_photo_resample', 1 );
			$aspectRatio			=	$params->get( 'groups_photo_maintain_aspect_ratio', 1 );
			$imageHeight			=	(int) $params->get( 'groups_photo_image_height', 640 );

			if ( ! $imageHeight ) {
				$imageHeight		=	640;
			}

			$imageWidth				=	(int) $params->get( 'groups_photo_image_width', 1280 );

			if ( ! $imageWidth ) {
				$imageWidth			=	1280;
			}

			$thumbHeight			=	(int) $params->get( 'groups_photo_thumbnail_height', 320 );

			if ( ! $thumbHeight ) {
				$thumbHeight		=	320;
			}

			$thumbWidth				=	(int) $params->get( 'groups_photo_thumbnail_width', 640 );

			if ( ! $thumbWidth ) {
				$thumbWidth			=	640;
			}

			$conversionType			=	(int) Application::Config()->get( 'conversiontype', 0 );
			$imageSoftware			=	( $conversionType == 5 ? 'gmagick' : ( $conversionType == 1 ? 'imagick' : 'gd' ) );

			$fileExtension			=	strtolower( preg_replace( '/[^-a-zA-Z0-9_]/', '', pathinfo( $_FILES['image']['name'], PATHINFO_EXTENSION ) ) );
			$fileName				=	Get::clean( pathinfo( $_FILES['image']['name'], PATHINFO_FILENAME ), GetterInterface::STRING ) . '.' . $fileExtension;
			$fileId					=	uniqid();

			try {
				$image				=	new Image( $imageSoftware, $resample, $aspectRatio );

				$image->setName( $fileId );
				$image->setSource( $_FILES['image'] );
				$image->setDestination( $filePath . '/' );

				$image->processImage( $imageWidth, $imageHeight );

				$newFileName		=	$image->getCleanFilename();

				$image->setName( 'tn' . $fileId );

				$image->processImage( $thumbWidth, $thumbHeight );

				if ( $this->get( 'image' ) ) {
					if ( file_exists( $filePath . '/' . $this->get( 'image' ) ) ) {
						@unlink( $filePath . '/' . $this->get( 'image' ) );
					}

					if ( file_exists( $filePath . '/tn' . $this->get( 'image' ) ) ) {
						@unlink( $filePath . '/tn' . $this->get( 'image' ) );
					}
				}

				$this->set( 'image', $newFileName );
				$this->set( 'filename', $fileName );

				$params				=	$this->params();

				$params->unsetEntry( 'name' );
				$params->unsetEntry( 'extension' );
				$params->unsetEntry( 'mimetype' );
				$params->unsetEntry( 'filesize' );
				$params->unsetEntry( 'filesize_thumbnail' );
				$params->unsetEntry( 'height' );
				$params->unsetEntry( 'width' );
				$params->unsetEntry( 'height_thumbnail' );
				$params->unsetEntry( 'width_thumbnail' );

				$params->set( 'name', $this->name() );
//.........这里部分代码省略.........
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:101,代码来源:PhotoTable.php

示例12: _replaceWildCards

 /**
  * Replaces wildcards * into SQL's % and adds them
  * @param  string  $operator  IN+OUT: Input: '=', '<>' or '!=', OUTPUT: 'LIKE' or 'NOT LIKE'
  * @param  string  $value     IN+OUT: Value to search, INPUT: with *, OUTPUT: %+sql-search-escaped
  * @return boolean
  */
 protected function _replaceWildCards(&$operator, &$value)
 {
     $changes = false;
     if (is_array($value)) {
         foreach (array_keys($value) as $k) {
             $changes = $this->_replaceWildCards($operator, $value[$k]) || $changes;
         }
     } else {
         $escSearch = str_replace('|*|', '|`|', $value);
         if (strpos($escSearch, '*') !== false) {
             $escSearch = Application::Database()->getEscaped($escSearch, true);
             $escSearch = str_replace('*', '%', $escSearch);
             $value = str_replace('|`|', '|*|', $escSearch);
             $operator = $this->_operatorToLike($operator);
             $changes = true;
         }
     }
     return $changes;
 }
开发者ID:bobozhangshao,项目名称:HeartCare,代码行数:25,代码来源:cbSqlQueryPart.php

示例13: store

	/**
	 * @param bool $updateNulls
	 * @return bool
	 */
	public function store( $updateNulls = false )
	{
		global $_PLUGINS;

		$new				=	( $this->get( 'id' ) ? false : true );
		$old				=	new self();

		$this->set( 'date', $this->get( 'date', Application::Database()->getUtcDateTime() ) );

		if ( ! $new ) {
			$old->load( (int) $this->get( 'id' ) );

			$_PLUGINS->trigger( 'gj_onBeforeUpdateUser', array( &$this, $old ) );
		} else {
			$_PLUGINS->trigger( 'gj_onBeforeCreateUser', array( &$this ) );
		}

		if ( ! parent::store( $updateNulls ) ) {
			return false;
		}

		// Promote to group owner if status is changed to owner:
		if ( $this->get( 'status' ) == 4 ) {
			$group			=	CBGroupJive::getGroup( $this->get( 'group' ) );

			if ( $group->get( 'id' ) && ( $group->get( 'user_id' ) != $this->get( 'user_id' ) ) ) {
				$group->set( 'user_id', (int) $this->get( 'user_id' ) );

				$group->store();
			}
		}

		if ( ! $new ) {
			$_PLUGINS->trigger( 'gj_onAfterUpdateUser', array( $this, $old ) );
		} else {
			static $params	=	null;

			if ( ! $params ) {
				$plugin		=	$_PLUGINS->getLoadedPlugin( 'user', 'cbgroupjive' );
				$params		=	$_PLUGINS->getPluginParams( $plugin );
			}

			// Set the default notifications:
			$notification	=	new NotificationTable();

			$notification->load( array( 'user_id' => (int) $this->get( 'user_id' ), 'group' => (int) $this->get( 'group' ) ) );

			$notification->set( 'user_id', (int) $this->get( 'user_id' ) );
			$notification->set( 'group', (int) $this->get( 'group' ) );

			$notifications	=	$notification->params();

			$notifications->set( 'user_join', $params->get( 'notifications_default_user_join', 0 ) );
			$notifications->set( 'user_leave', $params->get( 'notifications_default_user_leave', 0 ) );
			$notifications->set( 'user_approve', $params->get( 'notifications_default_user_approve', 0 ) );
			$notifications->set( 'user_cancel', $params->get( 'notifications_default_user_cancel', 0 ) );
			$notifications->set( 'invite_accept', $params->get( 'notifications_default_invite_accept', 0 ) );
			$notifications->set( 'invite_reject', $params->get( 'notifications_default_invite_reject', 0 ) );

			$_PLUGINS->trigger( 'gj_onAfterCreateUser', array( $this, &$notifications ) );

			$notification->set( 'params', $notifications->asJson() );

			$notification->store();
		}

		return true;
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:72,代码来源:UserTable.php

示例14: dateDbOfNow

 /**
  * Returns date( 'Y-m-d H:i:s' or 'Y-m-d' ) but in UTC or if database time is not UTC in the CMS, taking in account system offset for database's NOW()
  *
  * @param  boolean  $time  TRUE if time should be output too ('Y-m-d H:i:s'), FALSE if not ('Y-m-d')
  * @return string 'YYYY-MM-DD HH:mm:ss' if $time = TRUE, 'YYYY-MM-DD' if $time = FALSE
  * @deprecated 2.0 use Application::Database()->getUtcDateTime()
  */
 function dateDbOfNow($time = true)
 {
     static $cache = array();
     if (!isset($cache[$time])) {
         $cache[$time] = Application::Database()->getUtcDateTime(null, $time ? 'datetime' : 'date');
     }
     return $cache[$time];
 }
开发者ID:bobozhangshao,项目名称:HeartCare,代码行数:15,代码来源:CBframework.php

示例15: die

<?php

/**
* Community Builder (TM)
* @version $Id: $
* @package CommunityBuilder
* @copyright (C) 2004-2016 www.joomlapolis.com / Lightning MultiCom SA - and its licensors, all rights reserved
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU/GPL version 2
*/
use CBLib\Application\Application;
use CBLib\Database\DatabaseDriverInterface;
// no direct access
if (!(defined('_VALID_CB') || defined('_JEXEC') || defined('_VALID_MOS'))) {
    die('Direct Access to this location is not allowed.');
}
/**
 * The classes comprofilerDBTable and CBdatabase that were in here have moved to libraries/CBLib/CB/Legacy folder.
 */
/**
 * Here for immense backwards compatibility only
 *
 * @global DatabaseDriverInterface $_CB_Database
 * @deprecated 2.0: Use Application::Database() instead
 */
global $_CB_database;
$_CB_database = Application::Database();
开发者ID:bobozhangshao,项目名称:HeartCare,代码行数:26,代码来源:cb.database.php


注:本文中的CBLib\Application\Application::Database方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。