本文整理汇总了PHP中LogUtil::getErrorMessagesText方法的典型用法代码示例。如果您正苦于以下问题:PHP LogUtil::getErrorMessagesText方法的具体用法?PHP LogUtil::getErrorMessagesText怎么用?PHP LogUtil::getErrorMessagesText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LogUtil
的用法示例。
在下文中一共展示了LogUtil::getErrorMessagesText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_contentpagepath
function smarty_function_contentpagepath($params, $view)
{
if (!isset($params['pageId'])) {
return $smarty->trigger_error('contentpagepath: pageId parameter required');
}
$pageId = (int) $params['pageId'];
$language = isset($params['language']) ? $params['language'] : null;
$path = ModUtil::apiFunc('Content', 'Page', 'getPagePath', array('pageId' => $params['pageId']));
if ($path === false) {
return $smarty->trigger_error(LogUtil::getErrorMessagesText());
}
$result = "<span class=\"content-path\">";
$first = true;
foreach ($path as $page) {
$result .= ($first ? '' : ' / ') . $page['title'];
$first = false;
}
$result .= " [{$pageId}]";
$info = '';
if (!empty($language)) {
$info .= $language;
}
if (!empty($info)) {
$result .= " ({$info})";
}
$result .= " </span>";
if (array_key_exists('assign', $params)) {
$view->assign($params['assign'], $result);
} else {
return $result;
}
}
示例2: smarty_function_mediashare_breadcrumb
function smarty_function_mediashare_breadcrumb($params, &$smarty)
{
$dom = ZLanguage::getModuleDomain('mediashare');
if (!isset($params['albumId'])) {
$smarty->trigger_error(__f('Missing [%1$s] in \'%2$s\'', array('albumId', 'mediashare_breadcrumb'), $dom));
return false;
}
$mode = isset($params['mode']) ? $params['mode'] : 'view';
$breadcrumb = pnModAPIFunc('mediashare', 'user', 'getAlbumBreadcrumb', array('albumId' => (int) $params['albumId']));
if ($breadcrumb === false) {
$smarty->trigger_error(LogUtil::getErrorMessagesText());
return false;
}
$urlType = $mode == 'edit' ? 'edit' : 'user';
$url = pnModUrl('mediashare', $urlType, 'view', array('aid' => 0));
$result = "<div class=\"mediashare-breadcrumb\">";
$first = true;
foreach ($breadcrumb as $album) {
$url = DataUtil::formatForDisplay(pnModUrl('mediashare', $urlType, 'view', array('aid' => $album['id'])));
$result .= ($first ? '' : ' » ') . "<a href=\"{$url}\">" . htmlspecialchars($album['title']) . "</a>";
$first = false;
}
$result .= "</div>";
if (isset($params['assign'])) {
$smarty->assign($params['assign'], $result);
}
return $result;
}
示例3: mediashareSourceBrowserUpload
function mediashareSourceBrowserUpload(&$args)
{
if (!SecurityUtil::confirmAuthKey()) {
return LogUtil::registerAuthidError();
}
$dom = ZLanguage::getModuleDomain('mediashare');
$albumId = mediashareGetIntUrl('aid', $args, 0);
// Check access
if (!mediashareAccessAlbum($albumId, mediashareAccessRequirementAddMedia, '')) {
return LogUtil::registerPermissionError();
}
// Get parent album information
if (!($album = pnModAPIFunc('mediashare', 'user', 'getAlbum', array('albumId' => $albumId)))) {
return false;
}
// Start fetching media items
$imageNum = (int) FormUtil::getPassedValue('imagenum');
$statusSet = array();
for ($i = 1; $i <= $imageNum; ++$i) {
$uploadInfo = $_FILES["upload{$i}"];
$width = FormUtil::getPassedValue("width{$i}");
$height = FormUtil::getPassedValue("height{$i}");
if (isset($uploadInfo['error']) && $uploadInfo['error'] != 0 && $uploadInfo['name'] != '') {
$statusSet[] = array('ok' => false, 'message' => $uploadInfo['name'] . ': ' . mediashareUploadErrorMsg($uploadInfo['error']));
} else {
if ($uploadInfo['size'] > 0) {
$result = pnModAPIFunc('mediashare', 'source_browser', 'addMediaItem', array('albumId' => $albumId, 'uploadFilename' => $uploadInfo['tmp_name'], 'fileSize' => $uploadInfo['size'], 'filename' => $uploadInfo['name'], 'mimeType' => $uploadInfo['type'], 'title' => null, 'keywords' => null, 'description' => null, 'width' => $width, 'height' => $height));
if ($result === false) {
$status = array('ok' => false, 'message' => LogUtil::getErrorMessagesText());
} else {
$status = array('ok' => true, 'message' => $result['message'], 'mediaId' => $result['mediaId']);
}
$statusSet = array_merge($statusSet, array($status));
}
}
}
// Quick count of uploaded images + getting IDs for further editing
$editMediaIds = array();
$acceptedImageNum = 0;
foreach ($statusSet as $status) {
if ($status['ok']) {
++$acceptedImageNum;
$editMediaIds[] = $status['mediaId'];
}
}
$album['imageCount'] += $acceptedImageNum;
// Update for showing only
if ($acceptedImageNum == 0) {
$statusSet[] = array('ok' => false, 'message' => __('No media items', $dom));
}
if (($items = pnModAPIFunc('mediashare', 'user', 'getMediaItems', array('mediaIdList' => $editMediaIds))) === false) {
return false;
}
$render =& pnRender::getInstance('mediashare', false);
$render->assign('statusSet', $statusSet);
$render->assign('items', $items);
return $render->fetch('mediashare_source_browser_uploadet.html');
}
示例4: update
function update($force)
{
if ($force || count($this->items) == 0) {
$albums = pnModAPIFunc('mediashare', 'user', 'getAllAlbums', array('albumId' => 1, 'access' => $this->access, 'onlyMine' => $this->onlyMine));
if ($albums === false) {
pn_exit(LogUtil::getErrorMessagesText());
}
foreach ($albums as $album) {
$this->addItem($album['title'], $album['id']);
}
}
}
示例5: mediashare_ajax_getitems
/**
* Mediashare AJAX handler
*
* @copyright (C) 2007, Jorn Wildt
* @link http://www.elfisk.dk
* @version $Id$
* @license See license.txt
*/
function mediashare_ajax_getitems($args)
{
$items = pnModAPIFunc('mediashare', 'user', 'getMediaItems', array('albumId' => FormUtil::getPassedValue('aid')));
if ($items === false) {
AjaxUtil::error(LogUtil::getErrorMessagesText(' - '), '403 Forbidden');
}
$mediaItems = array();
foreach ($items as $item) {
$mediaItems[] = array('id' => $item['id'], 'isExternal' => $item['mediaHandler'] == 'extapp', 'thumbnailRef' => $item['thumbnailRef'], 'previewRef' => $item['previewRef'], 'title' => $item['title']);
}
return array('mediaItems' => $mediaItems);
}
示例6: dragContent
/**
* dragContent
* This function stores the moving of content items in the edit page mode
*
* @param id int id of page to toggle
* @param active string "true"/"false"
* @return mixed true or Ajax error
*/
public function dragContent($args)
{
$this->checkAjaxToken();
$this->throwForbiddenUnless(SecurityUtil::checkPermission('Content::', '::', ACCESS_EDIT), LogUtil::getErrorMsgPermission());
$ok = ModUtil::apiFunc('Content', 'Content', 'dragContent',
array('pageId' => $this->request->getPost()->get('pid', null),
'contentId' => $this->request->getPost()->get('cid', null),
'contentAreaIndex' => $this->request->getPost()->get('cai', null),
'position' => $this->request->getPost()->get('pos', null)));
if (!$ok) {
return new Zikula_Response_Ajax(array('ok' => false, 'message' => LogUtil::getErrorMessagesText()));
}
return new Zikula_Response_Ajax(array('ok' => true, 'message' => $this->__('Ok')));
}
示例7: smarty_function_mediashare_albumSelector
function smarty_function_mediashare_albumSelector($params, &$smarty)
{
$dom = ZLanguage::getModuleDomain('mediashare');
if (!isset($params['albumId'])) {
$smarty->trigger_error(__f('Missing [%1$s] in \'%2$s\'', array('albumId', 'mediashare_albumSelector'), $dom));
return false;
}
$albumId = $params['albumId'];
$id = isset($params['id']) ? $params['id'] : 'album';
$name = isset($params['name']) ? $params['name'] : $id;
$excludeAlbumId = isset($params['excludeAlbumId']) ? $params['excludeAlbumId'] : null;
$onlyMine = isset($params['onlyMine']) ? $params['onlyMine'] : false;
$access = isset($params['access']) ? constant($params['access']) : 0xff;
$albums = pnModAPIFunc('mediashare', 'user', 'getAllAlbums', array('albumId' => 1, 'excludeAlbumId' => $excludeAlbumId, 'access' => $access, 'onlyMine' => $onlyMine));
if ($albums === false) {
$smarty->trigger_error(LogUtil::getErrorMessagesText());
return false;
}
if (isset($params['onchange'])) {
$onChangeHtml = " onchange=\"{$params['onchange']}\"";
} else {
$onChangeHtml = '';
}
if (isset($params['id'])) {
$idHtml = " id=\"{$id}\"";
} else {
$idHtml = '';
}
$html = "<select name=\"{$name}\"{$onChangeHtml}{$idHtml}>\n";
foreach ($albums as $album) {
$title = $album['title'];
$id = (int) $album['id'];
$level = $album['nestedSetLevel'] - 1;
$indent = '';
for ($i = 0; $i < $level; ++$i) {
$indent .= '+ ';
}
$selectedHtml = $id == $albumId ? ' selected="selected"' : '';
$html .= "<option value=\"{$id}\"{$selectedHtml}>{$indent}{$title}</option>\n";
}
$html .= "</select>";
if (isset($params['assign'])) {
$smarty->assign($params['assign'], $html);
}
return $html;
}
示例8: mediashare_external_finditem
/**
* Find / paste
*/
function mediashare_external_finditem($args)
{
// FIXME access check
$albumId = mediashareGetIntUrl('aid', $args, 1);
$mediaId = mediashareGetIntUrl('mid', $args, 0);
$mode = FormUtil::getPassedValue('mode');
$cmd = FormUtil::getPassedValue('cmd');
$onlyMine = mediashareGetIntUrl('onlymine', $args, 0);
$uploadFailed = false;
if ($cmd == 'selectAlbum') {
$mediaId = 0;
} else {
if (isset($_POST['selectButton'])) {
$file = isset($_FILES['upload']) ? $_FILES['upload'] : null;
if (!empty($file) && $file['error'] == 0 && mediashareAccessAlbum($albumId, mediashareAccessRequirementEditAlbum)) {
$result = pnModAPIFunc('mediashare', 'source_browser', 'addMediaItem', array('albumId' => $albumId, 'uploadFilename' => $file['tmp_name'], 'fileSize' => $file['size'], 'filename' => $file['name'], 'mimeType' => $file['type'], 'title' => null, 'keywords' => null, 'description' => null, 'width' => 0, 'height' => 0));
if ($result === false) {
$uploadFailed = true;
} else {
$mediaId = $result['mediaId'];
}
}
if (!$uploadFailed) {
return pnRedirect(pnModUrl('mediashare', 'external', 'pasteitem', array('aid' => $albumId, 'mid' => $mediaId, 'mode' => $mode)));
}
}
}
$mediaItem = pnModAPIFunc('mediashare', 'user', 'getMediaItem', array('mediaId' => $mediaId));
$render =& pnRender::getInstance('mediashare', false);
mediashareExternalLoadTheme($render);
$render->assign('albumId', $albumId);
$render->assign('mediaId', $mediaId);
$render->assign('mediaItem', $mediaItem);
$render->assign('mode', $mode);
$render->assign('onlyMine', $onlyMine);
$render->assign('hasEditAccess', mediashareAccessAlbum($albumId, mediashareAccessRequirementEditAlbum));
if ($uploadFailed) {
$render->assign('uploadErrorMessage', LogUtil::getErrorMessagesText());
}
echo $render->fetch('mediashare_external_finditem.html');
return true;
}
示例9: smarty_function_mediashare_templateSelector
function smarty_function_mediashare_templateSelector($params, &$smarty)
{
$id = isset($params['id']) ? $params['id'] : 'album';
$selectedTemplate = $smarty->get_template_vars($id);
$name = isset($params['name']) ? $params['name'] : $id;
$templates = pnModAPIFunc('mediashare', 'user', 'getAllTemplates');
if ($templates === false) {
$smarty->trigger_error(LogUtil::getErrorMessagesText());
return false;
}
if (isset($params['onchange']) && $params['onchange']) {
$onChangeHtml = ' onchange="' . $params['onchange'] . '"';
} else {
$onChangeHtml = '';
}
if (isset($params['readonly']) && $params['readonly']) {
$readonlyHtml = ' disabled="disabled"';
} else {
$readonlyHtml = '';
}
if (isset($params['id']) && $params['id']) {
$idHtml = " id=\"{$id}\"";
} else {
$idHtml = '';
}
$html = "<select name=\"{$name}\"{$onChangeHtml}{$idHtml}{$readonlyHtml}>\n";
foreach ($templates as $template) {
$title = DataUtil::formatForDisplay($template['title']);
$value = $template['title'];
$selectedHtml = strcasecmp($value, $selectedTemplate) == 0 ? ' selected="selected"' : '';
$html .= "<option value=\"{$value}\"{$selectedHtml}>{$title}</option>\n";
}
$html .= "</select>";
if (isset($params['assign'])) {
$smarty->assign($params['assign'], $html);
}
return $html;
}
示例10: dragContent
/**
* dragContent
* This function stores the moving of content items in the edit page mode
*
* @param id int id of page to toggle
* @param active string "true"/"false"
* @return mixed true or Ajax error
*/
public function dragContent($args)
{
$this->checkAjaxToken();
$this->throwForbiddenUnless(SecurityUtil::checkPermission('Content::', '::', ACCESS_EDIT), LogUtil::getErrorMsgPermission());
$pageId = $this->request->getPost()->get('pid', null);
$cid = $this->request->getPost()->get('cid', null);
$cidDOM = $this->request->getPost()->get('cidDOM', null);
$contentAreas = $this->request->getPost()->get('contentAreas', null);
foreach ($contentAreas as $caIdx => $contentArea) {
foreach ($contentArea as $ciIdx => $contentItem) {
if ($contentItem == $cidDOM) {
$cai = $caIdx;
$pos = $ciIdx;
}
}
}
// update the actual content item position
$ok = ModUtil::apiFunc('Content', 'Content', 'dragContent', array('pageId' => $pageId, 'contentId' => $cid, 'contentAreaIndex' => $cai, 'position' => $pos));
if (!$ok) {
return new Zikula_Response_Ajax(array('ok' => false, 'message' => LogUtil::getErrorMessagesText()));
}
return new Zikula_Response_Ajax(array('ok' => true, 'message' => $this->__('Ok')));
}
示例11: decode
function decode(&$render)
{
$dom = ZLanguage::getModuleDomain('mediashare');
$this->clearValidation($render);
$value = FormUtil::getPassedValue($this->inputName, null, 'POST');
$albumId = FormUtil::getPassedValue("{$this->inputName}_album", null, 'POST');
$newAlbum = FormUtil::getPassedValue("{$this->inputName}_newalbum", null, 'POST');
if (!empty($newAlbum)) {
if (mediashareAccessAlbum($albumId, mediashareAccessRequirementAddAlbum, '')) {
$newAlbumID = pnModAPIFunc('mediashare', 'edit', 'addAlbum', array('title' => $newAlbum, 'keywords' => '', 'summary' => '', 'description' => '', 'template' => null, 'parentAlbumId' => $albumId));
if ($newAlbumID === false) {
$this->setError(LogUtil::getErrorMessagesText());
} else {
$albumId = $newAlbumID;
}
} else {
$this->setError(__('You do not have access to this feature', $dom));
}
}
$file = isset($_FILES["{$this->inputName}_upload"]) ? $_FILES["{$this->inputName}_upload"] : null;
if (!empty($file) && $file['error'] == 0) {
if (mediashareAccessAlbum($albumId, mediashareAccessRequirementAddMedia, '')) {
$result = pnModAPIFunc('mediashare', 'source_browser', 'addMediaItem', array('albumId' => $albumId, 'uploadFilename' => $file['tmp_name'], 'fileSize' => $file['size'], 'filename' => $file['name'], 'mimeType' => $file['type'], 'title' => null, 'keywords' => null, 'description' => null, 'width' => 0, 'height' => 0));
if ($result === false) {
$this->setError(LogUtil::getErrorMessagesText());
} else {
$value = $result['mediaId'];
}
} else {
$this->setError(__('You do not have access to this feature', $dom));
}
}
$this->selectedItemId = $value;
}
示例12: mediashareSourceZipUpload
function mediashareSourceZipUpload(&$args)
{
if (!SecurityUtil::confirmAuthKey()) {
return LogUtil::registerAuthidError();
}
$dom = ZLanguage::getModuleDomain('mediashare');
$albumId = mediashareGetIntUrl('aid', $args, 0);
// Check access
if (!mediashareAccessAlbum($albumId, mediashareAccessRequirementAddMedia, '')) {
return LogUtil::registerPermissionError();
}
// Get parent album information
if (!($album = pnModAPIFunc('mediashare', 'user', 'getAlbum', array('albumId' => $albumId)))) {
return false;
}
// Start fetching media items
$imageNum = (int) FormUtil::getPassedValue('imagenum');
$statusSet = array();
$args['albumId'] = $albumId;
for ($i = 1; $i <= $imageNum; ++$i) {
$uploadInfo = $_FILES["upload{$i}"];
$args['width'] = FormUtil::getPassedValue("width{$i}");
$args['height'] = FormUtil::getPassedValue("height{$i}");
if (isset($uploadInfo['error']) && $uploadInfo['error'] != 0 && $uploadInfo['name'] != '') {
$statusSet[] = array('ok' => false, 'message' => $uploadInfo['name'] . ': ' . mediashareUploadErrorMsg($uploadInfo['error']));
} else {
if ($uploadInfo['size'] > 0) {
$zip = zip_open($uploadInfo['tmp_name']);
if (!$zip) {
return LogUtil::registerError(__('Could not open the ZIP.', $dom));
}
while ($zipEntry = zip_read($zip)) {
// echo "Name: ".zip_entry_name($zipEntry)."\n";
// echo "Actual Filesize: ".zip_entry_filesize($zipEntry)."\n";
// echo "Compressed Size: ".zip_entry_compressedsize($zipEntry)."\n";
// echo "Compression Method: ".zip_entry_compressionmethod($zipEntry)."\n";
// echo "<br>\n";
if (zip_entry_filesize($zipEntry) > 0) {
$result = mediashareSourceZipAddFile($zip, $zipEntry, $args);
if ($result === false) {
$status = array('ok' => false, 'message' => LogUtil::getErrorMessagesText());
} else {
$status = array('ok' => true, 'message' => $result['message'], 'mediaId' => $result['mediaId']);
}
$statusSet = array_merge($statusSet, array($status));
}
}
zip_close($zip);
}
}
}
// Quick count of uploaded images + getting IDs for further editing
$editMediaIds = array();
$acceptedImageNum = 0;
foreach ($statusSet as $status) {
if ($status['ok']) {
++$acceptedImageNum;
$editMediaIds[] = $status['mediaId'];
}
}
$album['imageCount'] += $acceptedImageNum;
// Update for showing only
if ($acceptedImageNum == 0) {
$statusSet[] = array('ok' => false, 'message' => __('No media items', $dom));
}
if (($items = pnModAPIFunc('mediashare', 'user', 'getMediaItems', array('mediaIdList' => $editMediaIds))) === false) {
return false;
}
$render =& pnRender::getInstance('mediashare', false);
$render->assign('statusSet', $statusSet);
$render->assign('items', $items);
return $render->fetch('mediashare_source_zip_uploadet.html');
}
示例13: mediashareSourceYoutubeSave
function mediashareSourceYoutubeSave(&$args)
{
if (!SecurityUtil::confirmAuthKey()) {
return LogUtil::registerAuthidError();
}
$dom = ZLanguage::getModuleDomain('mediashare');
$albumId = mediashareGetIntUrl('aid', $args, 0);
// Check access
if (!mediashareAccessAlbum($albumId, mediashareAccessRequirementAddMedia, '')) {
return LogUtil::registerPermissionError();
}
// Get parent album information
if (!($album = pnModAPIFunc('mediashare', 'user', 'getAlbum', array('albumId' => $albumId)))) {
return false;
}
// Start fetching media items
$imageNum = (int) FormUtil::getPassedValue('imagenum');
$statusSet = array();
$args['albumId'] = $albumId;
for ($i = 1; $i <= $imageNum; ++$i) {
$videoytcode = FormUtil::getPassedValue("videoytcode{$i}");
$args['width'] = FormUtil::getPassedValue("width{$i}");
$args['height'] = FormUtil::getPassedValue("height{$i}");
$result = mediashareSourceYoutubeAdd($videoytcode, $args);
if ($result === false) {
$status = array('ok' => false, 'message' => LogUtil::getErrorMessagesText());
} else {
$status = array('ok' => true, 'message' => $result['message'], 'mediaId' => $result['mediaId']);
}
$statusSet = array_merge($statusSet, array($status));
}
// Quick count of uploaded images + getting IDs for further editing
$editMediaIds = array();
$acceptedImageNum = 0;
foreach ($statusSet as $status) {
if ($status['ok']) {
++$acceptedImageNum;
$editMediaIds[] = $status['mediaId'];
}
}
$album['imageCount'] += $acceptedImageNum;
// Update for showing only
if ($acceptedImageNum == 0) {
$statusSet[] = array('ok' => false, 'message' => __('No media items', $dom));
}
if (($items = pnModAPIFunc('mediashare', 'user', 'getMediaItems', array('mediaIdList' => $editMediaIds))) === false) {
return false;
}
$render =& pnRender::getInstance('mediashare', false);
$render->assign('statusSet', $statusSet);
$render->assign('items', $items);
return $render->fetch('mediashare_source_youtube_added.html');
}
示例14: mediashareErrorAPIRemote
function mediashareErrorAPIRemote()
{
$msg = LogUtil::getErrorMessagesText();
echo "__#GR2PROTO__\nstatus=1\nstatus_text={$msg}";
return true;
}
示例15: output
/**
* Encode data in JSON and return.
*
* This functions can add a new authid if requested to do so (default).
* If the supplied args is not an array, it will be converted to an
* array with 'data' as key.
* Authid field will always be named 'authid'. Any other field 'authid'
* will be overwritten!
* Script execution stops here
*
* @param mixed $args String or array of data.
* @param boolean $createauthid Create a new authid and send it back to the calling javascript.
* @param boolean $xjsonheader Send result in X-JSON: header for prototype.js.
* @param boolean $statusmsg Include statusmsg in output.
* @param string $code Optional error code, default '200 OK'.
*
* @deprecated since 1.3.0
*
* @return void
*/
public static function output($args, $createauthid = false, $xjsonheader = false, $statusmsg = true, $code = '200 OK')
{
if (!System::isLegacyMode()) {
$response = new Zikula_Response_Ajax($args);
echo $response;
System::shutDown();
}
// Below for reference - to be deleted.
// check if an error message is set
$msgs = LogUtil::getErrorMessagesText('<br />');
if ($msgs != false && !empty($msgs)) {
self::error($msgs);
}
$data = !is_array($args) ? array('data' => $args) : $args;
if ($statusmsg === true) {
// now check if a status message is set
$msgs = LogUtil::getStatusMessagesText('<br />');
$data['statusmsg'] = $msgs;
}
if ($createauthid === true) {
$data['authid'] = SecurityUtil::generateAuthKey(ModUtil::getName());
}
// convert the data to UTF-8 if not already encoded as such
// Note: this isn't strict test but relying on the site language pack encoding seems to be a good compromise
if (ZLanguage::getEncoding() != 'utf-8') {
$data = DataUtil::convertToUTF8($data);
}
$output = json_encode($data);
header("HTTP/1.0 $code");
header('Content-type: application/json');
if ($xjsonheader == true) {
header('X-JSON:(' . $output . ')');
}
echo $output;
System::shutdown();
}