Inheritance: extends Admin_Controller
示例#1
1
 /**
  * Gets a default format for the related path.
  * If a default format is not found then the fallback_format_class is used.
  *
  * @access public
  * @author Oliver Lillie
  * @package default
  * @param $path
  * @param $config Config
  * @param $fallback_format_class
  * @param $type
  * @return Format
  */
 public static function getFormatFor($path, $config, $fallback_format_class = 'Format', $type = 'output')
 {
     if (in_array($type, array('input', 'output')) === false) {
         throw new Exception('Unrecognised format type "' . $type . '".');
     }
     $format = null;
     $ext = pathinfo($path, PATHINFO_EXTENSION);
     if (empty($ext) === false) {
         $format = Extensions::toBestGuessFormat($ext);
     }
     //			check the requested class exists
     $class_name = '\\PHPVideoToolkit\\' . $fallback_format_class . (empty($format) === false ? '_' . ucfirst(strtolower($format)) : '');
     if (class_exists($class_name) === false) {
         $requested_class_name = $class_name;
         $class_name = '\\PHPVideoToolkit\\' . $fallback_format_class;
         if (class_exists($class_name) === false) {
             throw new Exception('Requested default format class does not exist, "' . ($requested_class_name === $class_name ? $class_name : $requested_class_name . '" and "' . $class_name . '"') . '".');
         }
     }
     //			check that it extends from the base Format class.
     if ($class_name !== '\\PHPVideoToolkit\\Format' && is_subclass_of($class_name, '\\PHPVideoToolkit\\Format') === false) {
         throw new Exception('The class "' . $class_name . '" is not a subclass of \\PHPVideoToolkit\\Format.');
     }
     return new $class_name($type, $config);
 }
示例#2
0
 /**
  * Return all notes in a category
  *
  * @author Kuldeep Dangi <*****@*****.**>
  */
 public function actionGetCategoryNotes($categoryId)
 {
     $this->result['success'] = true;
     $model = new Extensions();
     if ($categoryId) {
         $this->result['data'] = $model->getNotesByCategory($categoryId);
     } else {
         $this->result['data'] = $model->getAllNotes();
     }
     $this->sendResponse($this->result);
 }
示例#3
0
 /**
  * Update image and previewpdf of all fiels using main pdf.
  *
  * @author Kuldeep Dangi <*****@*****.**>
  */
 public function actionUpdateNotesPdf()
 {
     $notesObj = new Extensions();
     $allNotesArray = array();
     if (!empty($_GET['id'])) {
         $allNotesArray[] = $notesObj->findByPk($_GET['id']);
     } else {
         $allNotesArray = $notesObj->findAll();
     }
     foreach ($allNotesArray as $note) {
         $fileNames = array('image' => str_replace('upload_file/images/', '', $note->image), 'pdf' => $note->pdf, 'pdfPreview' => $note->imagepdf);
         echo '**** Processing for Note ID - ' . $note->extension_id . '********** <br/>';
         $this->processPdf($fileNames);
         echo '**** Processing Completed. **********<br/>';
     }
 }
示例#4
0
 /**
  * Checks if another definition is equal.
  *
  * Two definitions are equal if and only if all of their properties are equal.
  *
  * @param Definition $definition The definition to compare with
  *
  * @return bool True if the definitions are equal, false otherwise
  */
 public function equals(Definition $definition)
 {
     if (get_class($this) !== get_class($definition)) {
         return false;
     }
     if (null !== $this->type xor null !== $definition->type) {
         return false;
     }
     if (null !== $this->type && null !== $definition->type && !$this->type->equals($definition->type)) {
         return false;
     }
     if (null !== $this->moreInfo xor null !== $definition->moreInfo) {
         return false;
     }
     if (null !== $this->moreInfo && null !== $definition->moreInfo && !$this->moreInfo->equals($definition->moreInfo)) {
         return false;
     }
     if (null !== $this->extensions xor null !== $definition->extensions) {
         return false;
     }
     if (count($this->name) !== count($definition->name)) {
         return false;
     }
     if (count($this->description) !== count($definition->description)) {
         return false;
     }
     if (!is_array($this->name) xor !is_array($definition->name)) {
         return false;
     }
     if (!is_array($this->description) xor !is_array($definition->description)) {
         return false;
     }
     if (is_array($this->name)) {
         foreach ($this->name as $language => $value) {
             if (!isset($definition->name[$language])) {
                 return false;
             }
             if ($value !== $definition->name[$language]) {
                 return false;
             }
         }
     }
     if (is_array($this->description)) {
         foreach ($this->description as $language => $value) {
             if (!isset($definition->description[$language])) {
                 return false;
             }
             if ($value !== $definition->description[$language]) {
                 return false;
             }
         }
     }
     if (null !== $this->extensions && null !== $definition->extensions && !$this->extensions->equals($definition->extensions)) {
         return false;
     }
     return true;
 }
示例#5
0
 /**
  * Save a order purchased by user.
  *
  * @param int $userId
  * @param int $extentionId
  *
  * @author Kuldeep Dangi <*****@*****.**>
  */
 public function saveOrder($userId, $extentionId)
 {
     $extentionObj = Extensions::model()->findByPk($extentionId);
     $userObj = Users::model()->findByPk($userId);
     if ($extentionObj && $userObj) {
         $data = array("user_id" => $userObj->user_id, "extension_id" => $extentionObj->extension_id, "extension_name" => $extentionObj->name, "extension_price" => $extentionObj->price, "quantity" => 1, "total_price" => $extentionObj->price, "created_date" => time(), 'added_date' => date('Y-m-d H:i:s'), "status" => 1, "payment_type" => 0, "address_id" => 0);
         $this->attributes = $data;
         if ($this->save()) {
             return true;
         }
     }
     return false;
 }
示例#6
0
 /**
  * @param SimpleXMLElement $xml
  * @return TrackSegment
  * @throws InvalidGPXException
  */
 public static function fromXML(SimpleXMLElement $xml)
 {
     $trackSegment = new TrackSegment();
     if (!empty($xml->trkpt)) {
         $trackPoints = [];
         foreach ($xml->trkpt as $trackPoint) {
             array_push($trackPoints, Waypoint::fromXML($trackPoint));
         }
         $trackSegment->setTrackPoints($trackPoints);
     }
     if (!empty($xml->extensions)) {
         $trackSegment->setExtensions(Extensions::fromXML($xml->extensions[0]));
     }
     return $trackSegment;
 }
示例#7
0
 public function equals(Context $context)
 {
     if ($this->registration !== $context->registration) {
         return false;
     }
     if (null !== $this->instructor xor null !== $context->instructor) {
         return false;
     }
     if (null !== $this->instructor && null !== $context->instructor && !$this->instructor->equals($context->instructor)) {
         return false;
     }
     if (null !== $this->team xor null !== $context->team) {
         return false;
     }
     if (null !== $this->team && null !== $context->team && !$this->team->equals($context->team)) {
         return false;
     }
     if ($this->contextActivities != $context->contextActivities) {
         return false;
     }
     if ($this->revision !== $context->revision) {
         return false;
     }
     if ($this->platform !== $context->platform) {
         return false;
     }
     if ($this->language !== $context->language) {
         return false;
     }
     if (null !== $this->statement xor null !== $context->statement) {
         return false;
     }
     if (null !== $this->statement && null !== $context->statement && !$this->statement->equals($context->statement)) {
         return false;
     }
     if (null !== $this->extensions xor null !== $context->extensions) {
         return false;
     }
     if (null !== $this->extensions && null !== $context->extensions && !$this->extensions->equals($context->extensions)) {
         return false;
     }
     return true;
 }
示例#8
0
 /**
  * Gets a default format for the related path.
  * If a default format is not found then the fallback_format_class is used.
  *
  * @access public
  * @static
  * @author Oliver Lillie
  * @param string $path The file path to get the format for.
  * @param  PHPVideoToolkit\Config $config The config object.
  * @param string $fallback_format_class The fallback class to use of the format for the given path cannot be automatically determined.
  *  If null is given then a RuntimeException is thrown.
  * @param  constant $input_output_type Either Format::INPUT or Format::OUTPUT. Defaults to OUTPUT. It determines the format
  *  mode used to set various commands in the final ffmpeg exec call.
  * @return PHPVideToolkit\Format Returns an object extended from the PHPVideToolkit\Format class.
  * @throws \InvalidArgumentException If the $input_output_type is not valid.
  * @throws \InvalidArgumentException If the specified fallback class is attempted to be used but is not found.
  * @throws \LogicException If the generated class does not extend from PHPVideToolkit\Format.
  */
 public static function getFormatFor($path, $config, $fallback_format_class = 'Format', $type = Format::OUTPUT)
 {
     if (in_array($type, array(Format::OUTPUT, Format::INPUT)) === false) {
         throw new \InvalidArgumentException('Unrecognised format type "' . $type . '".');
     }
     $format = null;
     $ext = pathinfo($path, PATHINFO_EXTENSION);
     if (empty($ext) === false) {
         $format = Extensions::toBestGuessFormat($ext);
     }
     //          check the requested class exists
     $class_name = '\\PHPVideoToolkit\\' . $fallback_format_class . (empty($format) === false ? '_' . ucfirst(strtolower($format)) : '');
     if (class_exists($class_name) === false) {
         if ($fallback_format_class === null) {
             throw new \RuntimeException('It was not possible to generate the format class for `' . $path . '` and a fallback class was not given.');
         }
         $requested_class_name = $class_name;
         $class_name = '\\PHPVideoToolkit\\' . $fallback_format_class;
         if (class_exists($class_name) === false) {
             throw new \InvalidArgumentException('Requested default format class does not exist, "' . ($requested_class_name === $class_name ? $class_name : $requested_class_name . '" and "' . $class_name . '"') . '".');
         }
     }
     //          check that it extends from the base Format class.
     if ($class_name !== '\\PHPVideoToolkit\\Format' && is_subclass_of($class_name, '\\PHPVideoToolkit\\Format') === false) {
         throw new \LogicException('The class "' . $class_name . '" is not a subclass of \\PHPVideoToolkit\\Format.');
     }
     return new $class_name($type, $config);
 }
 public function test_instance()
 {
     $instance = Extensions::get_instance();
     $this->assertInstanceOf('HM\\BackUpWordPress\\Extensions', $instance);
 }
示例#10
0
 /**
  * Load model of a Note.
  *
  * @author Kuldeep Dangi <*****@*****.**>
  */
 public function loadModel($id)
 {
     $model = Extensions::model()->findByPk($id);
     return $model;
 }
示例#11
0
?>
</a>
		<?php 
esc_html_e('BackUpWordPress Extensions', 'backupwordpress');
?>
	</h1>

	<div class="wp-filter">
		<p><?php 
esc_html_e('Extend BackUpWordPress by installing extensions. Extensions allow you to pick and choose the exact features you need whilst also supporting us, the developers, so we can continue working on BackUpWordPress.', 'backupwordpress');
?>
</p>
	</div>

	<?php 
$extensions_data = Extensions::get_instance()->get_edd_data();
// Sort by title.
usort($extensions_data, function ($a, $b) {
    return strcmp($b->title->rendered, $a->title->rendered);
});
/**
 * Include is required for the usage of is_plugin_active()
 * to identify if a plugin is currently activated.
 * This info is further used to display a correct action button
 * depending on plugin's state (i.e. Update Now, Activate, Active).
 */
include_once ABSPATH . 'wp-admin/includes/plugin.php';
$installed_plugins = array();
foreach (get_plugins() as $path => $plugin_info) {
    $installed_plugins[strtolower($plugin_info['Name'])] = array('version' => $plugin_info['Version'], 'path' => $path, 'is_active' => is_plugin_active($path));
}
 /**
  * Delete post action
  */
 public function actiondeletepost()
 {
     // Perms
     if (!Yii::app()->user->checkAccess('op_extensions_deleteposts')) {
         throw new CHttpException(403, Yii::t('error', 'Sorry, You don\'t have the required permissions to enter this section'));
     }
     if (isset($_GET['id']) && ($model = Extensions::model()->findByPk($_GET['id']))) {
         $catid = $model->catid;
         $model->delete();
         Yii::app()->user->setFlash('success', Yii::t('extensions', 'Extension Deleted.'));
         $this->redirect(array('viewcategory', 'id' => $catid));
     } else {
         $this->redirect(array('index'));
     }
 }
                ?>
</td>
										<?php 
            }
            ?>
									</tr>
								<?php 
        }
        ?>
								
							<?php 
    } else {
        ?>
								<tr>
									<td colspan='<?php 
        if (Extensions::model()->canEditPost($model)) {
            ?>
7<?php 
        } else {
            ?>
6<?php 
        }
        ?>
'><?php 
        echo Yii::t('extensions', 'No Files Uploaded Yet.');
        ?>
</td>
								</tr>
							<?php 
    }
    ?>
示例#14
0
 public function addAction()
 {
     if ($this->_request->isPost()) {
         $this->addPage();
     }
     $exts = new Extensions($this->getSiteId());
     $localString = new LocalString($this->getSiteId());
     $langs = $localString->getLangs();
     $extsList = $exts->getExtensions();
     $pagesList = $this->pages->getPagesList();
     if ($this->_request->isPost()) {
         if ($ralativePagesIds = $this->_request->getPost('relative')) {
             for ($i = 0; $i < count($pagesList); $i++) {
                 if (in_array($pagesList[$i]['pg_id'], $ralativePagesIds)) {
                     $pagesList[$i]['selected'] = true;
                 }
             }
         }
         if ($extensionsIds = $this->_request->getPost('extensions')) {
             for ($i = 0; $i < count($extsList); $i++) {
                 if (in_array($extsList[$i]['id'], $extensionsIds)) {
                     $extsList[$i]['selected'] = true;
                 }
             }
         }
     }
     $this->tplVars['page']['pages'] = $pagesList;
     $this->tplVars['page']['langs'] = $langs;
     $this->tplVars['page']['exts'] = $extsList;
     array_push($this->viewIncludes, 'pages/pageAdd.tpl');
 }
    ?>
</h3>
					
					<ul>
					<?php 
    $extensions = Extensions::model()->findAll('authorid=:uid AND status=1', array(':uid' => $model->id));
    ?>
					<?php 
    if (is_array($extensions) && count($extensions)) {
        ?>
						<?php 
        foreach ($extensions as $extension) {
            ?>
							
							<li><?php 
            echo Extensions::model()->getLink($extension->title, $extension->alias, array('title' => $extension->description));
            ?>
</li>
						<?php 
        }
        ?>
	
					<?php 
    } else {
        ?>
						<li><?php 
        echo Yii::t('users', 'No Extensions Submitted.');
        ?>
</li>
					<?php 
    }
示例#16
0
 /**
  * Add a file in response of a wishlist request.
  *
  * @author Kuldeep Dangi <*****@*****.**>
  */
 public function actionAddFile()
 {
     $model = new Extensions();
     $modelUserFeed = new UserFeed();
     if (!empty($_POST['user_id']) && !empty($_POST['reply_to_feed'])) {
         $model->attributes = $_POST;
         $uploadedFiles = CUploadedFile::getInstancesByName('images');
         if ($uploadedFiles && count($uploadedFiles) > 0) {
             $allUploadedFiles = array();
             foreach ($uploadedFiles as $uploadedFile) {
                 $fileName = strtotime($this->getCurrentDateTime()) . '-' . $uploadedFile;
                 $uploadedFile->saveAs(Yii::app()->basePath . '/../../' . Extensions::FILE_UPLOAD_PATH . $fileName);
                 $allUploadedFiles[] = $fileName;
             }
             $savedFileNames = $model->getPdfFromImages($allUploadedFiles);
             $model->pdf = Extensions::FILE_CONVERT_PATH . $savedFileNames['pdf'];
             $model->imagepdf = $savedFileNames['imagepdf'];
             $model->image = Extensions::FILE_IMAGE_PATH . $savedFileNames['image'];
             if ($model->save()) {
                 $modelUserFeed->user_id = $_POST['user_id'];
                 $modelUserFeed->reply_to_feed = $_POST['reply_to_feed'];
                 $modelUserFeed->comment = Extensions::FILE_CONVERT_PATH . $savedFileNames['pdf'];
                 $modelUserFeed->is_file = 1;
                 $modelUserFeed->date_add = time();
                 $modelUserFeed->save();
                 $feedData = $this->loadModel($_POST['reply_to_feed']);
                 $notificationObj = new Notifications();
                 $notificationObj->addNotification(array('byUserId' => $_GET['user_id'], 'user_id' => $feedData->user_id, 'notify_comment' => $feedData->user_feed_id, 'type' => 'WISHLISTUPLOAD'));
                 $userObj = Users::model()->findByPk($feedData->user_id);
                 if ($userObj && !empty($userObj->deviceToken)) {
                     $notificationObj->sendPushNotification(array('deviceToken' => $userObj->deviceToken, 'deviceType' => $userObj->deviceType, 'message' => 6));
                 }
                 $this->result['success'] = true;
             }
         }
     } else {
         $this->result['message'] = 'Invalid Data.';
     }
     $this->sendResponse($this->result);
 }
示例#17
0
文件: Track.php 项目: Crayg/PHPGPX
 /**
  * @param SimpleXMLElement $xml
  * @return Track
  */
 public static function fromXML(SimpleXMLElement $xml)
 {
     $track = new Track();
     if (!empty($xml->name)) {
         $track->setName((string) $xml->name[0]);
     }
     if (!empty($xml->cmt)) {
         $track->setComment((string) $xml->cmt[0]);
     }
     if (!empty($xml->desc)) {
         $track->setDescription((string) $xml->desc[0]);
     }
     if (!empty($xml->src)) {
         $track->setSource((string) $xml->src[0]);
     }
     if (!empty($xml->link)) {
         $links = [];
         foreach ($xml->link as $link) {
             array_push($links, Link::fromXML($link));
         }
         $track->setLinks($links);
     }
     if (!empty($xml->number)) {
         $track->setNumber((int) $xml->number[0]);
     }
     if (!empty($xml->type)) {
         $track->setType((string) $xml->type[0]);
     }
     if (!empty($xml->extensions)) {
         $track->setExtensions(Extensions::fromXML($xml->extensions[0]));
     }
     if (!empty($xml->trkseg)) {
         $trackSegments = [];
         foreach ($xml->trkseg as $trackSegment) {
             array_push($trackSegments, TrackSegment::fromXML($trackSegment));
         }
         $track->setTrackSegments($trackSegments);
     }
     return $track;
 }
示例#18
0
文件: kimai.php 项目: jo91/kimai
$view = new Zend_View();
$view->setBasePath(WEBROOT . '/templates');
// prevent IE from caching the response
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
// ==================================
// = implementing standard includes =
// ==================================
$user = checkUser();
// Jedes neue update schreibt seine Versionsnummer in die Datenbank.
// Beim nächsten Update kommt dann in der Datei /includes/var.php die neue V-Nr. mit.
// der updater.php weiss dann welche Aenderungen an der Datenbank vorgenommen werden muessen.
checkDBversion("..");
$extensions = new Extensions($kga, WEBROOT . '/extensions/');
$extensions->loadConfigurations();
// ============================================
// = initialize currently displayed timeframe =
// ============================================
$timeframe = get_timeframe();
$in = $timeframe[0];
$out = $timeframe[1];
// ============================================
// = load the config =
// ============================================
include 'Config.php';
// ===============================================
// = get time for the probably running stopwatch =
// ===============================================
$current_timer = array();
示例#19
0
文件: GPX.php 项目: Crayg/PHPGPX
 /**
  * @param SimpleXMLElement $xml
  * @return GPX
  * @throws InvalidGPXException
  */
 public static function fromXML(SimpleXMLElement $xml)
 {
     if ($xml->getName() != 'gpx') {
         throw new InvalidGPXException("Root node should be 'gpx'");
     }
     $attributes = $xml->attributes();
     $version = $attributes['version'];
     if ($version != 1.1) {
         throw new InvalidGPXException("Invalid GPX version. This library only supports GPX 1.1");
     }
     if (!($creator = $attributes['creator'])) {
         throw new InvalidGPXException("No creator specified on GPX node.");
     }
     $gpx = new GPX((double) $version, (string) $creator);
     if (!empty($xml->metadata)) {
         $gpx->setMetadata(Metadata::fromXML($xml->metadata[0]));
     }
     if (!empty($xml->wpt)) {
         $waypoints = [];
         foreach ($xml->wpt as $waypoint) {
             array_push($waypoints, Waypoint::fromXML($waypoint));
         }
         $gpx->setWaypoints($waypoints);
     }
     if (!empty($xml->rte)) {
         $routes = [];
         foreach ($xml->rte as $route) {
             array_push($routes, Route::fromXML($route));
         }
         $gpx->setRoutes($routes);
     }
     if (!empty($xml->trk)) {
         $tracks = [];
         foreach ($xml->trk as $track) {
             array_push($tracks, Track::fromXML($track));
         }
         $gpx->setTracks($tracks);
     }
     if (!empty($xml->extensions)) {
         $gpx->setExtensions(Extensions::fromXML($xml->extensions[0]));
     }
     return $gpx;
 }
示例#20
0
文件: Metadata.php 项目: Crayg/PHPGPX
 /**
  * @param SimpleXMLElement $xml
  * @return Metadata
  * @throws InvalidGPXException
  */
 public static function fromXML(SimpleXMLElement $xml)
 {
     $metadata = new Metadata();
     if (!empty($xml->name)) {
         $metadata->setName((string) $xml->name[0]);
     }
     if (!empty($xml->desc)) {
         $metadata->setDescription((string) $xml->desc[0]);
     }
     if (!empty($xml->author)) {
         $metadata->setAuthor(Person::fromXML($xml->author[0]));
     }
     if (!empty($xml->copyright)) {
         $metadata->setCopyright(Copyright::fromXML($xml->copyright[0]));
     }
     if (!empty($xml->link)) {
         $links = [];
         foreach ($xml->link as $link) {
             array_push($links, Link::fromXML($link));
         }
         $metadata->setLinks($links);
     }
     if (!empty($xml->time)) {
         $metadata->setTime(strtotime((string) $xml->time[0]));
     }
     if (!empty($xml->keywords)) {
         $metadata->setKeywords((string) $xml->keywords[0]);
     }
     if (!empty($xml->bounds)) {
         $metadata->setBounds(Bounds::fromXML($xml->bounds0[0]));
     }
     if (!empty($xml->extensions)) {
         $metadata->setExtensions(Extensions::fromXML($xml->extensions[0]));
     }
     return $metadata;
 }
示例#21
0
 /**
  * Process the output format just before the it is compiled into commands.
  *
  * @access protected
  * @author Oliver Lillie
  * @param Format &$output_format 
  * @return void
  */
 protected function _processOutputFormat(Format &$output_format = null, &$save_path, $overwrite)
 {
     //          check to see if we have been set and output format, if not generate an empty one.
     if ($output_format === null) {
         $format = null;
         $ext = pathinfo($save_path, PATHINFO_EXTENSION);
         if (empty($ext) === false) {
             $format = Extensions::toBestGuessFormat($ext);
         }
         $output_format = $this->getDefaultFormat(Format::OUTPUT, $format);
     }
     //          set the media into the format object so that we can update the format options that
     //          require a media object to process.
     $output_format->setMedia($this)->updateFormatOptions($save_path, $overwrite);
 }
示例#22
0
文件: Waypoint.php 项目: Crayg/PHPGPX
 /**
  * @param SimpleXMLElement $xml
  * @return Waypoint
  * @throws InvalidGPXException
  */
 public static function fromXML(SimpleXMLElement $xml)
 {
     $attributes = $xml->attributes();
     if (!($latitude = $attributes['lat'])) {
         throw new InvalidGPXException("No latitude specified on waypoint node.");
     }
     if (!($longitude = $attributes['lon'])) {
         throw new InvalidGPXException("No longitude specified on waypoint node.");
     }
     $waypoint = new Waypoint((double) $latitude, (double) $longitude);
     if (!empty($xml->ele)) {
         $waypoint->setElevation((double) $xml->ele[0]);
     }
     if (!empty($xml->time)) {
         $waypoint->setTime(strtotime((string) $xml->time[0]));
     }
     if (!empty($xml->magvar)) {
         $waypoint->setMagvar((double) $xml->magvar[0]);
     }
     if (!empty($xml->geoidheight)) {
         $waypoint->setGeoidheight((double) $xml->geoidheight[0]);
     }
     if (!empty($xml->name)) {
         $waypoint->setName((string) $xml->name[0]);
     }
     if (!empty($xml->cmt)) {
         $waypoint->setComment((string) $xml->cmt[0]);
     }
     if (!empty($xml->desc)) {
         $waypoint->setDescription((string) $xml->desc[0]);
     }
     if (!empty($xml->src)) {
         $waypoint->setSource((string) $xml->src[0]);
     }
     if (!empty($xml->link)) {
         $links = [];
         foreach ($xml->link as $link) {
             array_push($links, Link::fromXML($link));
         }
         $waypoint->setLinks($links);
     }
     if (!empty($xml->sym)) {
         $waypoint->setSymbol((string) $xml->sym[0]);
     }
     if (!empty($xml->type)) {
         $waypoint->setType((string) $xml->type[0]);
     }
     if (!empty($xml->fix)) {
         $waypoint->setFix((string) $xml->fix[0]);
     }
     if (!empty($xml->sat)) {
         $waypoint->setFix((int) $xml->sat[0]);
     }
     if (!empty($xml->hdop)) {
         $waypoint->setHdop((double) $xml->hdop[0]);
     }
     if (!empty($xml->vdop)) {
         $waypoint->setVdop((double) $xml->vdop[0]);
     }
     if (!empty($xml->pdop)) {
         $waypoint->setPdop((double) $xml->pdop[0]);
     }
     if (!empty($xml->ageofdgpsdata)) {
         $waypoint->setAgeofdgpsdata((double) $xml->ageofdgpsdata[0]);
     }
     if (!empty($xml->dgpsid)) {
         $waypoint->setDgpsid((int) $xml->dgpsid[0]);
     }
     if (!empty($xml->extensions)) {
         $waypoint->setExtensions(Extensions::fromXML($xml->extensions[0]));
     }
     return $waypoint;
 }
示例#23
0
 /**
  * Function set user information to the result
  *
  * @param int $userId
  *
  * @author Kuldeep Dangi <*****@*****.**>
  */
 public function getUserInformation($userId)
 {
     $data = array('info' => array(), 'followers' => array(), 'following' => array(), 'notes' => array());
     if (!empty($userId)) {
         $data['info'] = $this->loadModel($userId);
         if (empty($data['info'])) {
             $this->result['message'] = 'User does not exist.';
         } else {
             $userFollowObj = new UserFollow();
             $extentionObj = new Extensions();
             $data['followers'] = $userFollowObj->getUserFollowers($userId);
             $data['following'] = $userFollowObj->getUserFollowing($userId);
             $data['notes'] = $extentionObj->getNotesByUsers($userId);
             $this->result['data'] = $data;
             $this->result['success'] = true;
         }
     }
     $this->sendResponse($this->result);
 }
示例#24
0
 /**
  * Bootstrap PHPPE environament on remote server by running diagnostics
  */
 function bootstrap($item = "")
 {
     //! check rights
     if (!Core::$user->has("install")) {
         Core::log('A', "Suspicious behavior " . $url . " " . $this->getSiteUrl(), "extensions");
         return "PHPPE-E: " . L("Access denied");
     }
     //! get live image
     $data = file_get_contents("public/index.php");
     if (empty($data)) {
         return "PHPPE-E: " . L("No PHPPE Core?");
     }
     //! we cannot install localy, that would use webserver's user, forbidden to write.
     //! So we must use remote user identity even when host is localhost.
     try {
         //! save PHPPE Core
         //! call diagnostics mode, with and without root privileges
         $r = explode("\n", Tools::ssh("mkdir -p " . escapeshellarg(Core::$user->data['remote']['path'] . "/public") . " \\&\\& \\( cat \\>" . escapeshellarg(Core::$user->data['remote']['path'] . "/public/index.php") . " \\) \\&\\& \\( " . "php " . escapeshellarg(Core::$user->data['remote']['path'] . "/public/index.php") . " --diag \\; sudo php " . escapeshellarg(Core::$user->data['remote']['path'] . "/public/index.php") . " --diag \\)", $data));
     } catch (\Exception $e) {
         return "PHPPE-E: " . $e->getMessage();
     }
     //! check the result
     if (Extensions::isErr($r[0])) {
         Core::log('E', "Failed to bootstrap PHPPE to " . $this->getSiteUrl(), "extensions");
         return "PHPPE-E: " . sprintf(L("Failed to install %s"), "Core") . "\nPHPPE-E: " . $this->getSiteUrl() . "\n\n" . implode("\n", $r);
     }
     Core::log('A', "Installed PHPPE to " . $this->getSiteUrl(), "extensions");
     return "PHPPE-I: " . sprintf(L("Installed %d files from %s"), 1, "public/index.php") . "\nPHPPE-I: " . $this->getSiteUrl() . "\n\n" . implode("\n", $r);
 }
示例#25
0
<?php

// OPEN-GEARS FRAMEWORK [1.0] (MAGURO)
// 2015 © Denis Sedchenko
include 'config.php';
if (!defined("IFCONFIG")) {
    die("<b>OpenGears Load Error</b><br />Failed to load configuration file, check if config.php exists and if 'IFCONFIG' defined.");
}
include CORE . 'kernel.php';
System::Init();
// Load System Extensions
Extensions::load(array('moyService', 'base', 'i18n', 'convert', 'ajaxResponse', 'baseRouter', 'filters'));
try {
    EssentialRouter::Get($_GET);
} catch (ControllerNotFoundException $e) {
    System::$Scope["error"] = $e;
    System::Call("error");
} catch (Exception $e) {
    System::$Scope["error"] = $e;
    System::Call("error", "ServerError");
}
<?php

$options = array();
if (Yii::app()->user->checkAccess('op_extensions_addposts')) {
    $options[Yii::t('extensions', 'Add Extension')] = array('extensions/addpost');
}
if (Yii::app()->user->checkAccess('op_extensions_manage')) {
    $pending = Extensions::model()->count('status=0');
    $options[Yii::t('extensions', '{count} Pending Extensions', array('{count}' => $pending))] = array('extensions/showpending');
}
if (Yii::app()->user->id) {
    $options[Yii::t('extensions', 'My Extensions')] = array('extensions/showmyposts');
}
?>


<div id="nav">
	<div class="boxnavnoborder">	
		<ul class='menunav'>
			<h4><?php 
echo Yii::t('extensions', 'Categories');
?>
</h4>
		<?php 
foreach (ExtensionsCats::model()->getCatsForMember(Yii::app()->language) as $category) {
    ?>
			<li><?php 
    echo CHtml::link($category->title, array('/extensions/category/' . $category->alias, 'lang' => false));
    ?>
 - ( <?php 
    echo $category->count;
示例#27
0
 /**
  * Handle webhook request from instamojo
  *
  * @author Kuldeep Dangi <*****@*****.**>
  */
 public function actionCheckoutApp($userId)
 {
     $cartModel = new Cartdetails();
     $userModel = new Users();
     $userByExtentionId = new UsersBuyExtensions();
     $userObj = Users::model()->findByPk($userId);
     $cartData = $cartModel->getUserCartProductIds($userId);
     $settingsModel = Setting::model()->findByPk(1);
     if (!$userObj || count($cartData) < 1) {
         exit;
     }
     $notficationModel = new Notifications();
     $notficationModel->sendPushNotification(array('deviceToken' => $userObj->deviceToken, 'deviceType' => $userObj->deviceType, 'message' => 3));
     foreach ($cartData as $cartRow) {
         $orderModel = new Order();
         $model = Cartdetails::model()->findByPk($cartRow['id']);
         $extentionObj = Extensions::model()->findByPk($model->productid);
         $nCashAmount = $model->price - $model->price * $settingsModel->commission / 100;
         $data = array("user_id" => $userObj->user_id, "coupondata" => '', "uservalrewdata" => '', "userval" => '', "extension_id" => $model->productid, "rewardpoints" => '', "extension_name" => $extentionObj->name, "extension_price" => $model->price, "quantity" => 1, "total_price" => $model->price, "shipping_fee" => '', "transaction_paypal_id" => $_POST['payment_id'], "commission" => $settingsModel->commission, "total_balance" => $nCashAmount, "created_date" => time(), 'added_date' => $this->getCurrentDateTime(), "status" => 1, "payment_type" => 1, "address_id" => 0);
         $orderModel->attributes = $data;
         if ($orderModel->save()) {
             $userModel = Users::model()->findByPk($extentionObj->user_id);
             $nCash = new Ncash();
             // Ncash deducted from buyer account
             $nCash->deductAmount($userObj->user_id, $model->price);
             // Ncash awarded to buyer
             $nCash->addAmount($userObj->user_id, self::REWARD_ON_NOTE_PURCHASE, 2);
             // Ncash for seller
             $nCash->addAmount($userModel->user_id, $nCashAmount, 5);
             if ($userModel) {
                 $notficationModel->sendPushNotification(array('deviceToken' => $userModel->deviceToken, 'deviceType' => $userModel->deviceType, 'message' => 4));
             }
             $model->used = 1;
             $model->save();
             //increment extention download
             // email notification
             $userBuyExtentionObj = $userByExtentionId->findByAttributes(array('user_id' => $userObj->user_id, 'extension_id' => $model->productid));
             if ($userBuyExtentionObj) {
                 $userBuyExtentionObj->download = $userBuyExtentionObj->download + $settingsModel->download_times;
                 if ($userBuyExtentionObj->expire_time > time()) {
                     $userBuyExtentionObj->expire_time = $userBuyExtentionObj->expire_time + $settingsModel->download_expire;
                 } else {
                     $userBuyExtentionObj->expire_time = time() + $settingsModel->download_expire;
                 }
                 $userBuyExtentionObj->save();
             } else {
                 $userByExtentionId->attributes = array('user_id' => $userObj->user_id, 'extension_id' => $model->productid, 'download' => $settingsModel->download_times, 'expire_time' => time() + $settingsModel->download_expire);
                 $userByExtentionId->save();
             }
         }
         $this->result['success'] = true;
     }
     $this->sendResponse($this->result);
 }
示例#28
0
文件: Route.php 项目: Crayg/PHPGPX
 /**
  * @param SimpleXMLElement $xml
  * @return Route
  * @throws InvalidGPXException
  */
 public static function fromXML(SimpleXMLElement $xml)
 {
     $route = new Route();
     if (!empty($xml->name)) {
         $route->setName((string) $xml->name[0]);
     }
     if (!empty($xml->cmt)) {
         $route->setComment((string) $xml->cmt[0]);
     }
     if (!empty($xml->desc)) {
         $route->setDescription((string) $xml->desc[0]);
     }
     if (!empty($xml->src)) {
         $route->setSource((string) $xml->src[0]);
     }
     if (!empty($xml->link)) {
         $links = [];
         foreach ($xml->link as $link) {
             array_push($links, Link::fromXML($link));
         }
         $route->setLinks($links);
     }
     if (!empty($xml->number)) {
         $route->setNumber((int) $xml->number[0]);
     }
     if (!empty($xml->type)) {
         $route->setType((string) $xml->type[0]);
     }
     if (!empty($xml->extensions)) {
         $route->setExtensions(Extensions::fromXML($xml->extensions[0]));
     }
     if (!empty($xml->rtept)) {
         $routePoints = [];
         foreach ($xml->rtept as $routePoint) {
             array_push($routePoints, Waypoint::fromXML($routePoint));
         }
         $route->setRoutePoints($routePoints);
     }
     return $route;
 }
示例#29
0
 /**
  * Returns the best guess output format object based on the given path.
  *
  * @access protected
  * @author Oliver Lillie
  * @param  string $path The output path of the resulting output.
  * @return object Returns an instance of a Format object or child class.
  */
 protected function _bestGuessOutputFormat($path)
 {
     $format = null;
     $ext = pathinfo($path, PATHINFO_EXTENSION);
     if (empty($ext) === false) {
         $format = Extensions::toBestGuessFormat($ext);
     }
     return $this->_getDefaultFormat('output', $this->_default_output_format, $format);
 }
 /**
  * Download post as pdf
  */
 public function actionword()
 {
     if (isset($_GET['id']) && ($model = Extensions::model()->findByPk($_GET['id']))) {
         $markdown = new MarkdownParser();
         $model->content = $markdown->safeTransform($model->content);
         $this->layout = false;
         $content = $this->render('index', array('content' => $model->content), true);
         Yii::app()->func->downloadAs($model->title, $model->alias, $content, 'word');
     } else {
         $this->redirect(Yii::app()->request->getUrlReferrer());
     }
 }