本文整理汇总了PHP中Kit类的典型用法代码示例。如果您正苦于以下问题:PHP Kit类的具体用法?PHP Kit怎么用?PHP Kit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Kit类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: showComponents
/**
*
* @return string
*/
public function showComponents()
{
$html = '';
foreach (KitComponent::getAllByCriteria('kitId=?', array($this->kit->getId())) as $index => $kitComponent) {
$html .= $this->getRow($kitComponent->getQty(), $kitComponent->getComponent()->getSku(), $kitComponent->getComponent()->getName(), 'itemRow');
}
return $html;
}
开发者ID:larryu,项目名称:magento-b2b,代码行数:12,代码来源:Controller.php
示例2: __construct
public function __construct(database $db, User $user, $menu)
{
$this->db =& $db;
$this->user =& $user;
$this->ajax = Kit::GetParam('ajax', _REQUEST, _BOOL, false);
$this->q = Kit::GetParam('q', _REQUEST, _WORD);
$this->userid = Kit::GetParam('userid', _SESSION, _INT);
$usertypeid = Kit::GetParam('usertype', _SESSION, _INT);
if ($menu == '') {
$this->message = __('No menu provided');
return false;
}
if (!($this->theMenu = $user->MenuAuth($menu))) {
$this->message = __('No permissions for this menu.');
return false;
}
// Set some information about this menu
$this->current = 0;
$this->numberItems = count($this->theMenu);
// We dont want to do 0 items
if ($this->numberItems == 0) {
$this->numberItems = -1;
}
$this->message = $this->numberItems . ' menu items loaded';
return true;
}
开发者ID:abbeet,项目名称:server39,代码行数:26,代码来源:menumanager.class.php
示例3: __construct
public function __construct()
{
// Determine if this is an AJAX call or not
$this->ajax = Kit::GetParam('ajax', _REQUEST, _BOOL, false);
// Assume success
$this->success = true;
$this->clockUpdate = false;
$this->focusInFirstInput = true;
$this->appendHiddenSubmit = true;
$this->uniqueReference = '';
$this->buttons = '';
$this->pageSize = 10;
$this->pageNumber = 0;
$this->initialSortColumn = 1;
$this->initialSortOrder = 1;
$this->modal = false;
$this->extra = array();
$this->dialogClass = '';
// Start a DB transaction for all returns from the Web Portal
try {
$dbh = PDOConnect::init();
if (!$dbh->inTransaction()) {
$dbh->beginTransaction();
}
} catch (Exception $e) {
Debug::LogEntry('error', $e->getMessage());
trigger_error(__('Unable to open connection and start transaction'), E_USER_ERROR);
}
return true;
}
开发者ID:abbeet,项目名称:server39,代码行数:30,代码来源:responsemanager.class.php
示例4: Add
public function Add($dataSetId, $heading, $dataTypeId, $listContent, $columnOrder = 0, $dataSetColumnTypeId = 1, $formula = '')
{
Debug::LogEntry('audit', sprintf('IN - DataSetID = %d', $dataSetId), 'DataSetColumn', 'Add');
try {
$dbh = PDOConnect::init();
// Is the column order provided?
if ($columnOrder == 0) {
$SQL = "";
$SQL .= "SELECT IFNULL(MAX(ColumnOrder), 1) AS ColumnOrder ";
$SQL .= " FROM datasetcolumn ";
$SQL .= "WHERE datasetID = :datasetid ";
$sth = $dbh->prepare($SQL);
$sth->execute(array('datasetid' => $dataSetId));
if (!($row = $sth->fetch())) {
return $this->SetError(25005, __('Could not determine the Column Order'));
}
$columnOrder = Kit::ValidateParam($row['ColumnOrder'], _INT);
}
// Insert the data set column
$SQL = "INSERT INTO datasetcolumn (DataSetID, Heading, DataTypeID, ListContent, ColumnOrder, DataSetColumnTypeID, Formula) ";
$SQL .= " VALUES (:datasetid, :heading, :datatypeid, :listcontent, :columnorder, :datasetcolumntypeid, :formula) ";
$sth = $dbh->prepare($SQL);
$sth->execute(array('datasetid' => $dataSetId, 'heading' => $heading, 'datatypeid' => $dataTypeId, 'listcontent' => $listContent, 'columnorder' => $columnOrder, 'datasetcolumntypeid' => $dataSetColumnTypeId, 'formula' => $formula));
$id = $dbh->lastInsertId();
Debug::LogEntry('audit', 'Complete', 'DataSetColumn', 'Add');
return $id;
} catch (Exception $e) {
Debug::LogEntry('error', $e->getMessage());
return $this->SetError(25005, __('Could not add DataSet Column'));
}
}
开发者ID:abbeet,项目名称:server39,代码行数:31,代码来源:datasetcolumn.data.class.php
示例5: handle_form_data
protected function handle_form_data($file, $index)
{
// Handle form data, e.g. $_REQUEST['description'][$index]
// Link the file to the module
$name = $_REQUEST['name'][$index];
$duration = $_REQUEST['duration'][$index];
$layoutId = Kit::GetParam('layoutid', _REQUEST, _INT);
$type = Kit::GetParam('type', _REQUEST, _WORD);
Debug::LogEntry('audit', 'Upload complete for Type: ' . $type . ' and file name: ' . $file->name . '. Name: ' . $name . '. Duration:' . $duration);
// We want to create a module for each of the uploaded files.
// Do not pass in the region ID so that we only assign to the library and not to the layout
try {
$module = ModuleFactory::createForLibrary($type, $layoutId, $this->options['db'], $this->options['user']);
} catch (Exception $e) {
$file->error = $e->getMessage();
exit;
}
// We want to add this item to our library
if (!($storedAs = $module->AddLibraryMedia($file->name, $name, $duration, $file->name))) {
$file->error = $module->GetErrorMessage();
}
// Set new file details
$file->storedas = $storedAs;
// Delete the file
@unlink($this->get_upload_path($file->name));
}
开发者ID:fignew,项目名称:xibo-cms,代码行数:26,代码来源:XiboUploadHandler.php
示例6: __construct
function __construct(database $db, user $user)
{
$this->db =& $db;
$this->user =& $user;
$this->layoutid = Kit::GetParam('layoutid', _REQUEST, _INT);
// Include the layout data class
include_once "lib/data/layout.data.class.php";
//if we have modify selected then we need to get some info
if ($this->layoutid != '') {
// get the permissions
Debug::LogEntry('audit', 'Loading permissions for layoutid ' . $this->layoutid);
$this->auth = $user->LayoutAuth($this->layoutid, true);
if (!$this->auth->view) {
trigger_error(__("You do not have permissions to view this layout"), E_USER_ERROR);
}
$sql = " SELECT layout, description, userid, retired, tags, xml FROM layout ";
$sql .= sprintf(" WHERE layoutID = %d ", $this->layoutid);
if (!($results = $db->query($sql))) {
trigger_error($db->error());
trigger_error(__("Cannot retrieve the Information relating to this layout. The layout may be corrupt."), E_USER_ERROR);
}
if ($db->num_rows($results) == 0) {
$this->has_permissions = false;
}
while ($aRow = $db->get_row($results)) {
$this->layout = Kit::ValidateParam($aRow[0], _STRING);
$this->description = Kit::ValidateParam($aRow[1], _STRING);
$this->retired = Kit::ValidateParam($aRow[3], _INT);
$this->tags = Kit::ValidateParam($aRow[4], _STRING);
$this->xml = $aRow[5];
}
}
}
开发者ID:abbeet,项目名称:server39,代码行数:33,代码来源:preview.class.php
示例7: ValidateQuestion
public function ValidateQuestion($questionNumber, $response)
{
switch ($questionNumber) {
case 0:
if (Kit::ValidateParam($response, _BOOL)) {
$this->a[0] = "Protected";
} else {
$this->a[0] = "Off";
}
return true;
case 1:
$this->a[1] = Kit::ValidateParam($response, _INT, 30);
return true;
case 2:
$this->a[2] = Kit::ValidateParam($response, _INT, 30);
return true;
case 3:
$this->a[3] = Kit::ValidateParam($response, _BOOL);
return true;
case 4:
// TODO: Teach Kit how to validate email addresses?
$this->a[4] = Kit::ValidateParam($response, _PASSWORD);
return true;
case 5:
// TODO: Teach Kit how to validate email addresses?
$this->a[5] = Kit::ValidateParam($response, _PASSWORD);
return true;
case 6:
$this->a[6] = Kit::ValidateParam($response, _INT, 12);
return true;
}
return false;
}
开发者ID:taphier,项目名称:xibo-cms,代码行数:33,代码来源:23.php
示例8: displayPage
function displayPage()
{
$db =& $this->db;
$user =& $this->user;
$error = Kit::GetParam('ErrorMessage', _SESSION, _HTMLSTRING, __('Unknown Error'));
Theme::Set('ErrorMessage', $error);
Theme::Render('error');
}
开发者ID:taphier,项目名称:xibo-cms,代码行数:8,代码来源:error.class.php
示例9: displayPage
function displayPage()
{
$db =& $this->db;
$user =& $this->user;
$error = Kit::GetParam('ErrorMessage', _SESSION, _HTMLSTRING, __('Unknown Error'));
echo __('There has been an application error.');
echo $error;
exit;
}
开发者ID:abbeet,项目名称:server39,代码行数:9,代码来源:error.class.php
示例10: ValidateQuestion
public function ValidateQuestion($questionNumber, $response)
{
switch ($questionNumber) {
case 0:
$this->a[0] = Kit::ValidateParam($response, _BOOL);
return true;
}
return false;
}
开发者ID:fignew,项目名称:xibo-cms,代码行数:9,代码来源:48.php
示例11: coreStop
public static function coreStop($message)
{
$title = 'Oops';
$error = \Kit::translateSystemError($message);
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) and $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
\Components\XHR::returnError($error);
}
exit(include KIT_CORE . '/Etc/SystemTpl/Exception.php');
}
开发者ID:deale,项目名称:dt,代码行数:9,代码来源:ExceptionAbstract.php
示例12: InitLocale
/**
* Gets and Sets the Local
* @return
*/
public static function InitLocale()
{
$localeDir = 'locale';
$default = Config::GetSetting('DEFAULT_LANGUAGE');
global $transEngine;
global $stream;
//Debug::LogEntry('audit', 'IN', 'TranslationEngine', 'InitLocal');
// Try to get the local firstly from _REQUEST (post then get)
$lang = Kit::GetParam('lang', _REQUEST, _WORD, '');
// Build an array of supported languages
$supportedLangs = scandir($localeDir);
if ($lang != '') {
// Set the language
Debug::LogEntry('audit', 'Set the Language from REQUEST [' . $lang . ']', 'TranslationEngine', 'InitLocal');
// Is this language supported?
// if not just use the default (eb_GB).
if (!in_array($lang . '.mo', $supportedLangs)) {
trigger_error(sprintf('Language not supported. %s', $lang));
// Use the default language instead.
$lang = $default;
}
} else {
$langs = Kit::GetParam('HTTP_ACCEPT_LANGUAGE', $_SERVER, _STRING);
if ($langs != '') {
//Debug::LogEntry('audit', ' HTTP_ACCEPT_LANGUAGE [' . $langs . ']', 'TranslationEngine', 'InitLocal');
$langs = explode(',', $langs);
foreach ($langs as $lang) {
// Remove any quality rating (as we aren't interested)
$rawLang = explode(';', $lang);
$lang = str_replace("-", "_", $rawLang[0]);
if (in_array($lang . '.mo', $supportedLangs)) {
//Debug::LogEntry('audit', 'Obtained the Language from HTTP_ACCEPT_LANGUAGE [' . $lang . ']', 'TranslationEngine', 'InitLocal');
break;
}
// Set lang as the default
$lang = $default;
}
} else {
$lang = $default;
}
}
// We have the language
//Debug::LogEntry('audit', 'Creating new file streamer for '. $localeDir . '/' . $lang . '.mo', 'TranslationEngine', 'InitLocal');
if (!($stream = new CachedFileReader($localeDir . '/' . $lang . '.mo'))) {
trigger_error('Unable to translate this language');
$transEngine = false;
return;
}
$transEngine = new gettext_reader($stream);
}
开发者ID:abbeet,项目名称:server39,代码行数:54,代码来源:translationengine.class.php
示例13: audit
/**
* Audit Log
* @param string $entity
* @param int $entityId
* @param string $message
* @param string|object|array $object
*/
public static function audit($entity, $entityId, $message, $object)
{
\Debug::Audit(sprintf('Audit Trail message recorded for %s with id %d. Message: %s', $entity, $entityId, $message));
if (self::$_auditLogStatement == null) {
$dbh = \PDOConnect::newConnection();
self::$_auditLogStatement = $dbh->prepare('
INSERT INTO `auditlog` (logDate, userId, entity, message, entityId, objectAfter)
VALUES (:logDate, :userId, :entity, :message, :entityId, :objectAfter)
');
}
// If we aren't a string then encode
if (!is_string($object)) {
$object = json_encode($object);
}
self::$_auditLogStatement->execute(array('logDate' => time(), 'userId' => \Kit::GetParam('userid', _SESSION, _INT, 0), 'entity' => $entity, 'message' => $message, 'entityId' => $entityId, 'objectAfter' => $object));
}
开发者ID:fignew,项目名称:xibo-cms,代码行数:23,代码来源:Log.php
示例14: UnlinkAllFromMedia
/**
* Unlink all media from the provided media item
* @param int $mediaid The media item to unlink from
*/
public function UnlinkAllFromMedia($mediaid)
{
Debug::LogEntry('audit', 'IN', get_class(), __FUNCTION__);
try {
$dbh = PDOConnect::init();
$mediaid = Kit::ValidateParam($mediaid, _INT, false);
$sth = $dbh->prepare('DELETE FROM `lkmediadisplaygroup` WHERE mediaid = :mediaid');
$sth->execute(array('mediaid' => $mediaid));
return true;
} catch (Exception $e) {
Debug::LogEntry('error', $e->getMessage(), get_class(), __FUNCTION__);
if (!$this->IsError()) {
$this->SetError(1, __('Unknown Error'));
}
return false;
}
}
开发者ID:fignew,项目名称:xibo-cms,代码行数:21,代码来源:lkmediadisplaygroup.data.class.php
示例15: LinkEveryone
/**
* Links everyone to the layout specified
* @param <type> $layoutId
* @param <type> $view
* @param <type> $edit
* @param <type> $del
* @return <type>
*/
public function LinkEveryone($dataSetId, $view, $edit, $del)
{
Debug::LogEntry('audit', 'IN', 'DataSetGroupSecurity', 'LinkEveryone');
try {
$dbh = PDOConnect::init();
// Get the Group ID for Everyone
$sth = $dbh->prepare('SELECT GroupID FROM `group` WHERE IsEveryone = 1');
$sth->execute();
if (!($row = $sth->fetch())) {
throw new Exception('Missing Everyone group');
}
// Link
return $this->Link($dataSetId, Kit::ValidateParam($row['GroupID'], _INT), $view, $edit, $del);
} catch (Exception $e) {
Debug::LogEntry('error', $e->getMessage());
return $this->SetError(25024, __('Could not Link DataSet to Group'));
}
}
开发者ID:abbeet,项目名称:server39,代码行数:26,代码来源:datasetgroupsecurity.data.class.php
示例16: ChangePassword
/**
* Change a users password
* @param <type> $userId
* @param <type> $oldPassword
* @param <type> $newPassword
* @param <type> $retypedNewPassword
* @return <type>
*/
public function ChangePassword($userId, $oldPassword, $newPassword, $retypedNewPassword, $forceChange = false)
{
try {
$dbh = PDOConnect::init();
// Validate
if ($userId == 0) {
$this->ThrowError(26001, __('User not selected'));
}
// We can force the users password to change without having to provide the old one.
// Is this a potential security hole - we must have validated that we are an admin to get to this point
if (!$forceChange) {
// Get the stored hash
$sth = $dbh->prepare('SELECT UserPassword FROM `user` WHERE UserID = :userid');
$sth->execute(array('userid' => $userId));
if (!($row = $sth->fetch())) {
$this->ThrowError(26000, __('Incorrect Password Provided'));
}
$good_hash = Kit::ValidateParam($row['UserPassword'], _STRING);
// Check the Old Password is correct
if ($this->validate_password($oldPassword, $good_hash) === false) {
$this->ThrowError(26000, __('Incorrect Password Provided'));
}
}
// Check the New Password and Retyped Password match
if ($newPassword != $retypedNewPassword) {
$this->ThrowError(26001, __('New Passwords do not match'));
}
// Check password complexity
if (!$this->TestPasswordAgainstPolicy($newPassword)) {
throw new Exception("Error Processing Request", 1);
}
// Generate a new SALT and Password
$hash = $this->create_hash($newPassword);
$sth = $dbh->prepare('UPDATE `user` SET UserPassword = :hash, CSPRNG = 1 WHERE UserID = :userid');
$sth->execute(array('hash' => $hash, 'userid' => $userId));
return true;
} catch (Exception $e) {
Debug::LogEntry('error', $e->getMessage());
if (!$this->IsError()) {
$this->SetError(25000, __('Could not edit Password'));
}
return false;
}
}
开发者ID:abbeet,项目名称:server39,代码行数:52,代码来源:userdata.data.class.php
示例17: Link
/**
* Outputs a help link
* @return
* @param $topic Object[optional]
* @param $category Object[optional]
*/
public static function Link($topic = "", $category = "General")
{
// if topic is empty use the page name
$topic = $topic == '' ? Kit::GetParam('p', _REQUEST, _WORD) : $topic;
$topic = ucfirst($topic);
// Get the link
try {
$dbh = PDOConnect::init();
$sth = $dbh->prepare('SELECT Link FROM help WHERE Topic = :topic and Category = :cat');
$sth->execute(array('topic' => $topic, 'cat' => $category));
if (!($link = $sth->fetchColumn(0))) {
$sth->execute(array('topic' => $topic, 'cat' => 'General'));
$link = $sth->fetchColumn(0);
}
return Config::GetSetting('HELP_BASE') . $link;
} catch (Exception $e) {
return false;
}
}
开发者ID:fignew,项目名称:xibo-cms,代码行数:25,代码来源:helpmanager.class.php
示例18: __construct
function __construct(database $db, user $user)
{
$this->db =& $db;
$this->user =& $user;
$this->layoutid = Kit::GetParam('layoutid', _REQUEST, _INT);
//if we have modify selected then we need to get some info
if ($this->layoutid != '') {
// get the permissions
Debug::LogEntry('audit', 'Loading permissions for layoutid ' . $this->layoutid);
$layout = $this->user->LayoutList(NULL, array('layoutId' => $this->layoutid));
if (count($layout) <= 0) {
trigger_error(__('You do not have permissions to view this layout'), E_USER_ERROR);
}
$layout = $layout[0];
$this->layout = $layout['layout'];
$this->description = $layout['description'];
$this->retired = $layout['retired'];
$this->tags = $layout['tags'];
$this->xml = $layout['xml'];
}
}
开发者ID:fignew,项目名称:xibo-cms,代码行数:21,代码来源:preview.class.php
示例19: LinkEveryone
/**
* Links everyone to the layout specified
* @param <type> $layoutId
* @param <type> $view
* @param <type> $edit
* @param <type> $del
* @return <type>
*/
public function LinkEveryone($layoutId, $regionId, $mediaId, $view, $edit, $del)
{
try {
$dbh = PDOConnect::init();
$sth = $dbh->prepare('SELECT GroupID FROM `group` WHERE IsEveryone = 1');
$sth->execute();
if (!($row = $sth->fetch())) {
throw new Exception("Error Processing Request", 1);
}
$groupId = Kit::ValidateParam($row['GroupID'], _INT);
if (!$this->Link($layoutId, $regionId, $mediaId, $groupId, $view, $edit, $del)) {
throw new Exception("Error Processing Request", 1);
}
return true;
} catch (Exception $e) {
Debug::LogEntry('error', $e->getMessage());
if (!$this->IsError()) {
$this->SetError(1, __('Unknown Error'));
}
return false;
}
}
开发者ID:abbeet,项目名称:server39,代码行数:30,代码来源:layoutmediagroupsecurity.data.class.php
示例20: add
public function add($tag)
{
try {
$dbh = PDOConnect::init();
// See if it exists
$sth = $dbh->prepare('SELECT * FROM `tag` WHERE tag = :tag');
$sth->execute(array('tag' => $tag));
if ($row = $sth->fetch()) {
return Kit::ValidateParam($row['tagId'], _INT);
}
// Insert if not
$sth = $dbh->prepare('INSERT INTO `tag` (tag) VALUES (:tag)');
$sth->execute(array('tag' => $tag));
return $dbh->lastInsertId();
} catch (Exception $e) {
Debug::LogEntry('error', $e->getMessage(), get_class(), __FUNCTION__);
if (!$this->IsError()) {
$this->SetError(1, __('Unknown Error'));
}
return false;
}
}
开发者ID:fignew,项目名称:xibo-cms,代码行数:22,代码来源:tag.data.class.php
注:本文中的Kit类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论