code review

This commit is contained in:
Jean-Christian Denis 2023-04-06 22:20:25 +02:00
parent 675906d600
commit dc4980d9aa
Signed by: JcDenis
GPG key ID: 1B5B8C5B90B6C951
3 changed files with 12 additions and 13 deletions

View file

@ -56,7 +56,7 @@ class Core
dcCore::app()->callBehavior('improveAddAction', $list);
foreach ($list as $action) {
if ($action instanceof Action && !isset($this->actions[$action->id()])) {
if (($action instanceof Action) && !isset($this->actions[$action->id()])) {
if (in_array($action->id(), $disabled)) {
$this->disabled[$action->id()] = $action->name();
} else {
@ -96,11 +96,10 @@ class Core
return 0;
}
$cur = dcCore::app()->con->openCursor(dcCore::app()->prefix . dcLog::LOG_TABLE_NAME);
$cur->log_msg = json_encode($this->logs);
$cur->log_table = My::id();
$id = dcCore::app()->log->addLog($cur);
$cur->setField('log_msg', json_encode($this->logs));
$cur->setField('log_table', My::id());
return $id;
return dcCore::app()->log->addLog($cur);
}
public function readLogs(int $id): array

View file

@ -97,7 +97,7 @@ class Install extends dcNsProcess
foreach (['setting_', 'preferences'] as $key) {
$record = dcCore::app()->con->select(
'SELECT * FROM ' . dcCore::app()->prefix . dcNamespace::NS_TABLE_NAME . ' ' .
"WHERE setting_ns = '" . dcCore::app()->con->escape(My::id()) . "' " .
"WHERE setting_ns = '" . dcCore::app()->con->escapeStr(My::id()) . "' " .
"AND setting_id LIKE '" . $key . "%' "
);
@ -105,10 +105,10 @@ class Install extends dcNsProcess
try {
$value = @unserialize($record->f('setting_value'));
$cur = dcCore::app()->con->openCursor(dcCore::app()->prefix . dcNamespace::NS_TABLE_NAME);
$cur->setting_value = json_encode(is_array($value) ? $value : []);
$cur->setField('setting_value', json_encode(is_array($value) ? $value : []));
$cur->update(
"WHERE setting_id = '" . $record->f('setting_id') . "' and setting_ns = '" . dcCore::app()->con->escape($record->f('setting_ns')) . "' " .
'AND blog_id ' . (null === $record->f('blog_id') ? 'IS NULL ' : ("= '" . dcCore::app()->con->escape($record->f('blog_id')) . "' "))
"WHERE setting_id = '" . $record->f('setting_id') . "' and setting_ns = '" . dcCore::app()->con->escapeStr($record->f('setting_ns')) . "' " .
'AND blog_id ' . (null === $record->f('blog_id') ? 'IS NULL ' : ("= '" . dcCore::app()->con->escapeStr($record->f('blog_id')) . "' "))
);
} catch(Exception) {
}

View file

@ -218,7 +218,7 @@ class zip extends Action
$zip->addExclusion($e);
}
$zip->addDirectory(
Path::real($this->module->get('root')),
(string) Path::real($this->module->get('root')),
$this->module->getId(),
true
);