I cant log into phpMyAdmin - laragon

I have just installed Laragon on my new laptop. I have used Laragon before with no problems.
This time when I came to log in to phpMyAdmin I get "Cannot log in to the MySQL server" as an error.
I followed the instructions as before, and tried using Username:'root' and password:'' which is what it should be. No good, I have tried uninstalling and re-installing. Also no good.
This is my config.inc.php
Any ideas anyone. I have tried a few other configs but to no avail
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* phpMyAdmin sample configuration, you can use it as base for
* manual configuration. For easier setup you can use setup/
*
* All directives are explained in documentation in the doc/ folder
* or at <http://docs.phpmyadmin.net/>.
*
* #package PhpMyAdmin
*/
/*
* This is needed for cookie based authentication to encrypt password in
* cookie
*/
$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
/*
* Servers configuration
*/
$i = 0;
/*
* First server
*/
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
/* Server parameters */
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = true;
$cfg['Servers'][$i]['port'] = 3306;
/*
* Laragon: set phpmyadmin to not timeout so quickly
*/
$cfg['LoginCookieValidity'] = 72000;
/*
* phpMyAdmin configuration storage settings.
*/
/* User used to manipulate with storage */
// $cfg['Servers'][$i]['controlhost'] = '';
// $cfg['Servers'][$i]['controlport'] = '';
// $cfg['Servers'][$i]['controluser'] = 'pma';
// $cfg['Servers'][$i]['controlpass'] = 'pmapass';
/* Storage database and tables */
// $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
// $cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
// $cfg['Servers'][$i]['relation'] = 'pma__relation';
// $cfg['Servers'][$i]['table_info'] = 'pma__table_info';
// $cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
// $cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
// $cfg['Servers'][$i]['column_info'] = 'pma__column_info';
// $cfg['Servers'][$i]['history'] = 'pma__history';
// $cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
// $cfg['Servers'][$i]['tracking'] = 'pma__tracking';
// $cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
// $cfg['Servers'][$i]['recent'] = 'pma__recent';
// $cfg['Servers'][$i]['favorite'] = 'pma__favorite';
// $cfg['Servers'][$i]['users'] = 'pma__users';
// $cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';
// $cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding';
// $cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches';
// $cfg['Servers'][$i]['central_columns'] = 'pma__central_columns';
/* Contrib / Swekey authentication */
// $cfg['Servers'][$i]['auth_swekey_config'] = '/etc/swekey-pma.conf';
/*
* End of servers configuration
*/
/*
* Directories for saving/loading files from server
*/
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
/**
* Whether to display icons or text or both icons and text in table row
* action segment. Value can be either of 'icons', 'text' or 'both'.
*/
//$cfg['RowActionType'] = 'both';
/**
* Defines whether a user should be displayed a "show all (records)"
* button in browse mode or not.
* default = false
*/
//$cfg['ShowAll'] = true;
/**
* Number of rows displayed when browsing a result set. If the result
* set contains more rows, "Previous" and "Next".
* default = 30
*/
//$cfg['MaxRows'] = 50;
/**
* disallow editing of binary fields
* valid values are:
* false allow editing
* 'blob' allow editing except for BLOB fields
* 'noblob' disallow editing except for BLOB fields
* 'all' disallow editing
* default = blob
*/
//$cfg['ProtectBinary'] = 'false';
/**
* Default language to use, if not browser-defined or user-defined
* (you find all languages in the locale folder)
* uncomment the desired line:
* default = 'en'
*/
//$cfg['DefaultLang'] = 'en';
//$cfg['DefaultLang'] = 'de';
/**
* default display direction (horizontal|vertical|horizontalflipped)
*/
//$cfg['DefaultDisplay'] = 'vertical';
/**
* How many columns should be used for table display of a database?
* (a value larger than 1 results in some information being hidden)
* default = 1
*/
//$cfg['PropertiesNumColumns'] = 2;
/**
* Set to true if you want DB-based query history.If false, this utilizes
* JS-routines to display query history (lost by window close)
*
* This requires configuration storage enabled, see above.
* default = false
*/
//$cfg['QueryHistoryDB'] = true;
/**
* When using DB-based query history, how many entries should be kept?
*
* default = 25
*/
//$cfg['QueryHistoryMax'] = 100;
/**
* Should error reporting be enabled for JavaScript errors
*
* default = 'ask'
*/
//$cfg['SendErrorReports'] = 'ask';
/*
* You can find more configuration options in the documentation
* in the doc/ folder or at <http://docs.phpmyadmin.net/>.
*/
?>
Any help please

change this line:
$cfg['Servers'][$i]['host'] = 'localhost';
to this:
$cfg['Servers'][$i]['host'] = '127.0.0.1';
and consider using a password for the root user anyway. I discourage using no password for mysql.

Related

Symfony API-Platform Assert\Choice does not work on setter

My app has a very standard user comment feature with also standard possibility for any visitor to mark comments as inappropriate.
In the resolution process for these marked comments the admin will decide which action to take, between no action, edit the comment or remove it.
The CommentReport entity includes Assert\Choice to allow only the 3 choices above.
The issue is that it is accepting any string.
On the Comment entity the set up is as follows:
....
* graphql={
* "withCustomArgsMutation"={
* "security"="is_granted('ROLE_ADMIN')",
* "mutation"=CommentReputationTypeResolver::class,
* "args"={
* "id"={"type"="ID!"},
* "resolutionType"={"type"="String!"},
* },
* "denormalization_context"={"groups"={"put-resolution"}},
* "normalization_context"={"groups"={"get"}}
* },
.....
/**
* #ORM\OneToMany(targetEntity=CommentReport::class, mappedBy="comment")
* #Groups({"get", "get-admin", "get-owner", "put-resolution"})
*/
private $commentReports;
Then the CommentReports entity:
class CommentReport
{
const RESOLUTION_TYPES = [
'no_action',
'edit',
'remove',
];
.....
/**
* #ORM\Column(type="string", length=10, nullable=true)
* #Assert\NotBlank(
* message="commentReport.resolutionType.notBlank",
* groups={"put-resolution"}
* )
* #Assert\Choice(
* choices=CommentReport::RESOLUTION_TYPES,
* message="commentReport.resolutionType.choice",
* groups={"put-resolution"}
* )
* #Groups({"get-admin", "put-resolution"})
*/
private $resolutionType;
Then on the DeserializeStage the request is intercepted to handle the setting of each individual CommentReport made for that Comment:
/Stage/DeserializeStage.php
if ($this->isAdmin($user) && $resourceClass === 'App\Entity\Comment' && $operationName === 'withCustomArgsMutation') {
// get all comment reports
$commentReports = $deserializeObject->getCommentReports();
foreach($commentReports as $report) {
$report->setResolutionType($context['args']['input']['resolutionType']);
}
}
All of this works but I can input any string and it will be accepted.
Of course, the expected result would be that Symfony would throw an exception for any string not on the RESOLUTION_TYPES array.
For info, this is the front-end mutation that triggers input:
`mutation putCommentReport(
$commentId: ID!
$resolutionType: String!
) {
withCustomArgsMutationComment(input: {
id: $commentId
resolutionType: $resolutionType
}){
comment{
id
}
}
}`;
As #Jeroen van der Laan pointed out, the validation group annotation was missing on the operation, which should be as follows;
App\Entity\Comment
* graphql={
* "withCustomArgsMutation"={
* "security"="is_granted('ROLE_ADMIN')",
* "mutation"=CommentReputationTypeResolver::class,
* "args"={
* "id"={"type"="ID!"},
* "resolutionType"={"type"="String!"},
* },
* "normalization_context"={"groups"={"get"}},
* "validation_groups"={"put-resolution"}
* },
Additionally, the Valid() assertion needs to be added to the CommentReport relation on Comment:
/**
* #ORM\OneToMany(targetEntity=CommentReport::class, mappedBy="comment")
* #Assert\Valid()
* #Groups({"get", "get-admin", "get-owner"})
*/
private $commentReports;

Both ArtBox and TrimBox on a page in iText7

Its not possible to put a artbox and trimbox on a page with iText7.0.5.0
The source states then only a trimbox or a ArtBox can exist on a page.
This is not true, they can exist both on a page.
Line 615 of PdfPage.java
/**
* Sets the TrimBox object, that define the intended dimensions of the finished page after trimming.
*
* #param rectangle the {#link Rectangle} object to set, expressed in default user space units.
* #return this {#link PdfPage} instance.
*/
public PdfPage setTrimBox(Rectangle rectangle) {
if (getPdfObject().getAsRectangle(PdfName.ArtBox) != null) {
getPdfObject().remove(PdfName.ArtBox);
Logger logger = LoggerFactory.getLogger(PdfPage.class);
logger.warn(LogMessageConstant.ONLY_ONE_OF_ARTBOX_OR_TRIMBOX_CAN_EXIST_IN_THE_PAGE);
}
put(PdfName.TrimBox, new PdfArray(rectangle));
return this;
}
/**
* Sets the ArtBox object, that define the extent of the page’s meaningful content
* (including potential white space) as intended by the page’s creator.
*
* #param rectangle the {#link Rectangle} object to set, expressed in default user space units.
* #return this {#link PdfPage} instance.
*/
public PdfPage setArtBox(Rectangle rectangle) {
if (getPdfObject().getAsRectangle(PdfName.TrimBox) != null) {
getPdfObject().remove(PdfName.TrimBox);
Logger logger = LoggerFactory.getLogger(PdfPage.class);
logger.warn(LogMessageConstant.ONLY_ONE_OF_ARTBOX_OR_TRIMBOX_CAN_EXIST_IN_THE_PAGE);
}
put(PdfName.ArtBox, new PdfArray(rectangle));
return this;
}
Proposed solutions:
/**
* Gets the {#link Rectangle} object specified by page's ArtBox, that define the extent of the page’s
* meaningful content (including potential white space) as intended by the page’s creator.
*
* #return the {#link Rectangle} object specified by page's ArtBox, expressed in default user space units.
* CropBox by default.
*/
public Rectangle getArtBox() {
Rectangle artBox = getPdfObject().getAsRectangle(PdfName.ArtBox);
return artBox == null ? getCropBox() : artBox;
}
/**
* Sets the TrimBox object, that define the intended dimensions of the finished page after trimming.
*
* #param rectangle the {#link Rectangle} object to set, expressed in default user space units.
* #return this {#link PdfPage} instance.
*/
public PdfPage setTrimBox(Rectangle rectangle) {
put(PdfName.TrimBox, new PdfArray(rectangle));
return this;
}

Check google reCaptcha service is on or off

I am using simple google recaptcha.
My requirement is that if google api is not available (i.e. if google server is down, know its not usual case) means not getting any reply from google server then while loding the form I will hide the google reCaptcha wrapper and while submitting the form I don't want to validate google recaptcha.
Please suggest How can I achieve this.
Google does not provide that data (assuming they are always up).
But you could go about it this way. Dynamically load the script and check for the event existence in the callback. If no event is available then it failed.
Check out the #example comment for usage.
var setAttributes = function (el, attrs) {
/**
* #method simple for in loop to help with creating elements programatically
* #param {object} el - HTMLElement attributes are getting added to
* #param {object} attrs - object literal with key/values for desired attributes
* #example setAttributes(info,{
* 'id' : 'info'
* 'class' : 'my-class-name'
* });
*/
'use strict';
var key;
for (key in attrs) {
if (attrs.hasOwnProperty(key)) {
el.setAttribute(key, attrs[key]);
}
}
return el;
};
var getScript = function (url, fullPath) {
/**
* #method dynamically add script tags to the page.
* #param {url} string with relative path and file name - do not include extension
* #param {fullPath} string with absolute path
* #example getScript('FrameAdjustChild');
* #example getScript('','https://www.google-analytics.com/analytics.js');
*/
'use strict';
var setAtt, PATH = /js/, /* or wherever you keep your scripts */
el = document.createElement('script'),
attrs = {
defer: true,
src: null,
type: 'text/javascript'
};
/** look for a string based, protocol agnostic, js file url */
if (typeof fullPath === 'string' && fullPath.indexOf('http') === 0) {
attrs.src = fullPath;
}
/** look for any string with at least 1 character and prefix our root js dir, then append extension */
if (typeof url === 'string' && url.length >= 1) {
attrs.src = PATH + url + '.js';
}
setAtt = setAttributes(el,attrs);
el.addEventListener('load', function (event) {
if (event) {
/* status is good */
}
else {
/* status is bad */
}
}, false);
document.body.appendChild(el);
return el;
};

Typo3 extbase json output

I try to create controller that handles ajax requests.
I found out, that I have to add this to my TS config:
ajaxCall = PAGE
ajaxCall {
typeNum = 999
config.disableAllHeaderCode = 1
config.metaCharset = UTF-8
xhtml_cleaning = 0
admPanel = 0
10 = COA
10 < tt_content.list.20.registration_userregistration
}
And my controller looks like this:
/**
* JSONController
*/
class JSONController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController {
/**
* #var string
*/
protected $defaultViewObjectName = 'TYPO3\\CMS\\Extbase\\Mvc\\View\\JsonView';
/**
* action test
*
* #return string
*/
public function testAction() {
$this->view->assign('value', "001");
}
}
This works, I get a blank page with "001" on it. But if I look at the source, there are 4 empty lines, and "001" is in the 5th line.
-empty-
-empty-
-empty-
-empty-
"001"
I have no idea why...
I don't get, why are you using some view for rendering JSON ???
public function testAction() {
$data = array('value'=>'001');
return json_encode($data);
}
Of course you should set Content-type: application/json - where do you prefer - in your TS or directly in the action before return;
Other clue: maybe it's caused by tt_content (just guesing), for JSON actions it's best to include them directly via Bootstrap, first register new FE plugin in your ext_localconf.php:
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'VENDORNAME.' . $_EXTKEY,
'JsonDataPlugin',
array('JSON' => 'test',),
array('JSON' => 'test',)
);
And modify your TS:
myAjaxPage = PAGE
myAjaxPage {
typeNum = 999
10 = USER
10 {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
extensionName = Yourextname
pluginName = JsonDataPlugin
vendorName = VENDORNAME
}
config {
disableAllHeaderCode = 1
additionalHeaders = Content-type:application/json
xhtml_cleaning = 0
admPanel = 0
debug = 0
no_cache = 1
}
}
(don't forget to change Yourextname and VENDORNAME for your own, also clear the system cache)
Finally: Check all your files and make sure that there's no empty lines before <?php and after ?> (the best option is to remove ?> from each file - and let PHP to terminate script at the end of file). Also it can be fixed in the source of TYPO3 as described in other naswer.
Okay, I got it...
I included a file with some functions named user.php
/**
* User service
*
* #var \Whmcs\Registration\Service\User
* #inject
*/
protected $user = NULL;
In this file there were empty lines after the ?> tag. These empty lines were the problem. I deleted them and now everything works fine. :)

Is there a function like _compile_select or get_compiled_select()?

Looks like _compile_select is deprecated and get_compiled_select is not added to 2.1.0. Are there any other functions like those two? And also I am curious. Is there any particular reason to not adding get_compiled_select() to Active Record and removing _compile_select?
I've added get_compiled_select() to DB_active_rec.php and it seems to work without problem, but i wouldn't remove _compile_select() since it's used in many other methods.
The pull request for adding this method is here, with some other useful methods like:
get_compiled_select()
get_compiled_insert()
get_compiled_update()
get_compiled_delete()
https://github.com/EllisLab/CodeIgniter/pull/307
if you want just the method, it's just this:
/**
* Get SELECT query string
*
* Compiles a SELECT query string and returns the sql.
*
* #access public
* #param string the table name to select from (optional)
* #param boolean TRUE: resets AR values; FALSE: leave AR vaules alone
* #return string
*/
public function get_compiled_select($table = '', $reset = TRUE)
{
if ($table != '')
{
$this->_track_aliases($table);
$this->from($table);
}
$select = $this->_compile_select();
if ($reset === TRUE)
{
$this->_reset_select();
}
return $select;
}

Resources