Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
# Conflicts:
#	admin/fieldgroups.php
#	admin/templates/default/layout.tpl
#	admin/templates/default/modules.tpl
#	admin/templates/default/tree.tpl
#	changelog.txt
#	includes/classes/ia.base.controller.module.admin.php
#	includes/classes/ia.core.users.php
#	includes/classes/ia.system.php
#	includes/helpers/ia.category.interface.php
#	index.php
#	install/modules/module.install.php
#	js/admin/footer.js
#	templates/_common/tree.tpl
  • Loading branch information
vbezruchkin committed May 17, 2017
2 parents 35c0f8e + aea5859 commit 610b21d
Show file tree
Hide file tree
Showing 190 changed files with 15,362 additions and 9,099 deletions.
8 changes: 4 additions & 4 deletions admin/adminer.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@
switch ($_GET['file']) {
case 'default.css':
header('Content-Type: text/css');
echo file_get_contents(IA_INCLUDES . 'adminer' . IA_DS . 'adminer.css');
echo file_get_contents(IA_INCLUDES . 'adminer/adminer.css');
break;
case 'functions.js':
header('Content-Type: text/javascript; charset=utf-8');
echo file_get_contents(IA_INCLUDES . 'adminer' . IA_DS . 'adminer.js');
echo file_get_contents(IA_INCLUDES . 'adminer/adminer.js');
break;
case 'plus.gif':
case 'cross.gif':
case 'up.gif':
case 'down.gif':
case 'arrow.gif':
header("Content-Type: image/gif");
echo file_get_contents(IA_INCLUDES . 'adminer' . IA_DS . $_GET['file']);
echo file_get_contents(IA_INCLUDES . 'adminer/' . $_GET['file']);
break;
}
}
Expand All @@ -59,5 +59,5 @@

$iaView->display(iaView::NONE);

include IA_INCLUDES . 'adminer' . IA_DS . 'adminer.script' . iaSystem::EXECUTABLE_FILE_EXT;
include IA_INCLUDES . 'adminer/adminer.script' . iaSystem::EXECUTABLE_FILE_EXT;
}
14 changes: 7 additions & 7 deletions admin/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -439,9 +439,9 @@ private function _importPage(&$iaView)
fclose($f);

// process migrations
if (strpos($filename, 'updates' . IA_DS . 'migrations')) {
if (strpos($filename, 'updates/migrations')) {
$migrationProcessed = [
'name' => str_replace(IA_HOME . 'updates' . IA_DS . 'migrations' . IA_DS, '', $filename),
'name' => str_replace(IA_HOME . 'updates/migrations/', '', $filename),
'status' => 'complete',
'date' => (new \DateTime())->format(iaDb::DATETIME_FORMAT),
];
Expand All @@ -462,13 +462,13 @@ private function _importPage(&$iaView)

// generate list of available folders for dump files
$dumpFolders = [
'Migrations' => IA_HOME . 'updates' . IA_DS . 'migrations' . IA_DS,
'Updates' => IA_HOME . 'updates' . IA_DS
'Migrations' => IA_HOME . 'updates/migrations/',
'Updates' => IA_HOME . 'updates/',
];
$packages = $this->_iaDb->onefield('name', "`type` = 'package' AND `status` = 'active'", null, null,
iaItem::getModulesTable());
foreach ($packages as $package) {
$dumpFolders[iaLanguage::get($package)] = IA_MODULES . $package . IA_DS . 'includes' . IA_DS . 'dumps' . IA_DS;
$dumpFolders[iaLanguage::get($package)] = IA_MODULES . $package . '/includes/dumps/';
}

list($migrations, $appliedMigrations) = $this->_getMigrations();
Expand All @@ -483,7 +483,7 @@ private function _importPage(&$iaView)
$dumpFiles[$name][] = [
'filename' => $path . $file,
'title' => substr($file, 0, count($file) - 5),
'applied' => (boolean)(strpos($path, 'updates' . IA_DS . 'migrations') && in_array($file,
'applied' => (boolean)(strpos($path, 'updates/migrations') && in_array($file,
$appliedMigrations))
];
}
Expand All @@ -501,7 +501,7 @@ protected function _getMigrations()

$appliedMigrations = [];
foreach ($migrations as &$migration) {
$migration['filename'] = IA_HOME . 'updates' . IA_DS . 'migrations' . IA_DS . $migration['name'];
$migration['filename'] = IA_HOME . 'updates/migrations/' . $migration['name'];

if ('complete' == $migration['status']) {
$appliedMigrations[$migration['filename']] = $migration['name'];
Expand Down
2 changes: 1 addition & 1 deletion admin/fieldgroups.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ protected function _preSaveEntry(array &$entry, array $data, $action)
}
}

$entry['module'] = $this->_iaCore->factory('item')->getPackageByItem($data['item']);
$entry['module'] = $this->_iaCore->factory('item')->getModuleByItem($data['item']);
$entry['order'] = $this->_iaDb->getMaxOrder(iaField::getTableGroups()) + 1;
}

Expand Down
2 changes: 1 addition & 1 deletion admin/fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ private function _treeActions(array $params)
$key = sprintf(self::TREE_NODE_TITLE, $params['item'], $params['field'], $params['id']);

if ($_POST) {
$packageName = $this->_iaCore->factory('item')->getPackageByItem($params['item']);
$packageName = $this->_iaCore->factory('item')->getModuleByItem($params['item']);

$this->_iaDb->delete(iaDb::convertIds($key, 'key'), iaLanguage::getTable());

Expand Down
2 changes: 1 addition & 1 deletion admin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ protected function _indexPage(&$iaView)
}

// populate statistics
$itemsList = $iaCore->factory('item')->getPackageItems();
$itemsList = $iaCore->factory('item')->getModuleItems();
$validSizes = ['small', 'medium', 'package'];

$iaCore->startHook('adminDashboardStatistics', ['items' => &$itemsList]);
Expand Down
18 changes: 10 additions & 8 deletions admin/languages.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class iaBackendController extends iaAbstractControllerBackend
{
protected $_name = 'languages';

protected $_tooltipsEnabled = true;

protected $_gridColumns = "`id`, `key`, `original`, `value`, `code`, `category`, IF(`original` != `value`, 1, 0) `modified`, 1 `delete`";
protected $_gridFilters = ['key' => 'like', 'value' => 'like', 'category' => 'equal', 'module' => 'equal'];

Expand Down Expand Up @@ -257,14 +259,14 @@ public function getById($id)
return $this->_iaDb->row(iaDb::ALL_COLUMNS_SELECTION, iaDb::convertIds($id), iaLanguage::getLanguagesTable());
}

protected function _assignValues(&$iaView, array &$entryData)
protected function _setPageTitle(&$iaView, array $entryData, $action)
{
$iaView->title(iaLanguage::get(iaCore::ACTION_EDIT == $iaView->get('action') ? 'edit_language' : 'copy_language'));
}

protected function _preSaveEntry(array &$entry, array $data, $action)
{
if (empty($data['title']) || strlen(trim($data['title'])) == 0) {
if (empty($data['title']) || !trim($data['title'])) {
$this->addMessage('title_incorrect');
}

Expand All @@ -276,21 +278,20 @@ protected function _preSaveEntry(array &$entry, array $data, $action)
$this->addMessage('bad_iso_code');
}

if (empty($data['locale']) || strlen(trim($data['locale'])) == 0) {
if (empty($data['locale']) || !trim($data['locale'])) {
$this->addMessage('language_locale_incorrect');
}

if (empty($data['date_format']) || strlen(trim($data['date_format'])) == 0) {
if (empty($data['date_format']) || !trim($data['date_format'])) {
$this->addMessage('language_date_format_incorrect');
}

$entry['title'] = $data['title'];
$entry['code'] = strtolower($data['code']);
$entry['title'] = $data['title'];
$entry['locale'] = $data['locale'];
$entry['date_format'] = $data['date_format'];
$entry['time_format'] = $data['time_format'];
$entry['direction'] = $data['direction'];
$entry['master'] = $entry['default'] = 0;
$entry['author'] = $entry['flagicon'] = '';
$entry['status'] = $data['status'];

return !$this->getMessages();
Expand Down Expand Up @@ -318,7 +319,8 @@ protected function _setDefaultValues(array &$entry)
'code' => '',
'title' => '',
'locale' => 'en_US',
'date_format' => '%b %e, %Y',
'date_format' => '%e %B, %Y',
'time_format' => '%H:%M',
'direction' => 'ltr',
'status' => iaCore::STATUS_INACTIVE
];
Expand Down
33 changes: 26 additions & 7 deletions admin/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ protected function _indexPage(&$iaView)

$installedPlugins = $this->_iaDb->assoc(['name', 'status', 'version'],
iaDb::convertIds(iaModule::TYPE_PLUGIN, 'type'));
$this->_getLocal(IA_MODULES, array('installed' => $installedPlugins));
$this->_getLocal(IA_MODULES, ['installed' => $installedPlugins]);
$this->_getRemotePlugins($start, $limit, $sort);
break;

Expand Down Expand Up @@ -160,7 +160,7 @@ private function _getDocumentation($moduleName, &$iaView)
{
$result = [];

if (file_exists($documentationPath = $this->_folder . $moduleName . IA_DS . 'docs' . IA_DS)) {
if (file_exists($documentationPath = $this->_folder . $moduleName . '/docs/')) {
$docs = scandir($documentationPath);

foreach ($docs as $doc) {
Expand Down Expand Up @@ -194,7 +194,7 @@ private function _getDocumentation($moduleName, &$iaView)
];

$icon = '';
if (file_exists($this->_folder . $moduleName . IA_DS . 'docs' . IA_DS . 'img' . IA_DS . 'icon.png')) {
if (file_exists($this->_folder . $moduleName . '/docs/img/icon.png')) {
$icon = '<tr><td class="plugin-icon"><img src="' . $iaView->assetsUrl . 'modules/' . $moduleName . '/docs/img/icon.png" alt=""></td></tr>';
}
$data = &$this->getHelper()->itemData;
Expand All @@ -211,7 +211,7 @@ private function _getDocumentation($moduleName, &$iaView)
];

$result['info'] = str_replace($search, $replacement,
file_get_contents(IA_ADMIN . 'templates' . IA_DS . $this->_iaCore->get('admin_tmpl') . IA_DS . 'extra_information.tpl'));
file_get_contents(IA_ADMIN . 'templates/' . $this->_iaCore->get('admin_tmpl') . '/extra_information.tpl'));
}

return $result;
Expand Down Expand Up @@ -537,7 +537,9 @@ private function _getList()
'manage' => false,
'import' => false
];
$installed = false;
if (isset($existPackages[$data['name']])) {
$installed = true;
$status = $statuses[$data['name']];
}

Expand All @@ -547,7 +549,7 @@ private function _getList()
$buttons['deactivate'] = true;
$buttons['set_default'] = true;

if (is_dir($this->_folder . $file . IA_DS . 'includes' . IA_DS . 'dumps')) {
if (is_dir($this->_folder . $file . '/includes/dumps')) {
$buttons['import'] = true;
}

Expand Down Expand Up @@ -608,6 +610,7 @@ private function _getList()
'file' => $file,
'price' => 0,
'status' => $status,
'installed' => $installed,
'date_updated' => ($status != 'notinstall') ? $dates[$data['name']] : false,
'install' => true,
'remote' => false
Expand Down Expand Up @@ -920,7 +923,7 @@ private function _getTemplatesList()
*/
private function _download($moduleName)
{
$tempFolder = IA_TMP . 'modules' . IA_DS;
$tempFolder = IA_TMP . 'modules/';
!is_dir($tempFolder) && mkdir($tempFolder);

$filePath = $tempFolder . $moduleName;
Expand All @@ -935,7 +938,7 @@ private function _download($moduleName)
// delete previous folder
is_dir($this->_folder . $moduleName) && unlink($this->_folder . $moduleName);

include_once(IA_INCLUDES . 'utils' . IA_DS . 'pclzip.lib.php');
include_once(IA_INCLUDES . 'utils/pclzip.lib.php');

$pclZip = new PclZip($fileName);
if ($result = $pclZip->extract(PCLZIP_OPT_PATH, $this->_folder . $moduleName)) {
Expand Down Expand Up @@ -1027,7 +1030,21 @@ private function _plugin($module, $folder, array $options = [])
$notes .= PHP_EOL . PHP_EOL . iaLanguage::get('installation_impossible');
}

$installed = false;
if (array_key_exists($module['name'], $options['installed'])) {

if ($row = $this->_iaDb->row_bind(['name', 'config_group'], '`module` = :plugin ORDER BY `order` ASC', ['plugin' => $module['name']], iaCore::getConfigTable())) {
$buttons['config'] = [
'url' => $row['config_group'],
'anchor' => $row['name']
];
}

if ($alias = $this->_iaDb->one_bind('alias', '`name` = :name', ['name' => $module['name']], 'admin_pages')) {
$buttons['manage'] = $alias;
}

$installed = true;
$module['status'] = $options['installed'][$module['name']]['status'];
switch ($module['status']) {
case iaCore::STATUS_ACTIVE:
Expand Down Expand Up @@ -1061,6 +1078,7 @@ private function _plugin($module, $folder, array $options = [])
'file' => $folder,
'buttons' => $buttons,
'status' => !empty($module['status']) ? $module['status'] : '',
'installed' => $installed,
'remote' => false,
'price' => '',
'notes' => $notes,
Expand Down Expand Up @@ -1108,6 +1126,7 @@ private function _template($module, $folder)
'file' => $folder,
'buttons' => $buttons,
'status' => $buttons['reinstall'] ? iaCore::STATUS_ACTIVE : '',
'installed' => $buttons['reinstall'],
'remote' => false,
'price' => '',
'notes' => $this->getHelper()->getNotes(),
Expand Down
2 changes: 1 addition & 1 deletion admin/plans.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ private function _getItemsStatuses()
$className = ucfirst(substr($itemName, 0, -1));
$itemClassInstance = (iaUsers::getItemName() == $itemName)
? $this->_iaCore->factory('users')
: $this->_iaCore->factoryModule($className, $iaItem->getPackageByItem($itemName));
: $this->_iaCore->factoryModule($className, $iaItem->getModuleByItem($itemName));
if ($itemClassInstance && method_exists($itemClassInstance, 'getStatuses')) {
$statuses = $itemClassInstance->getStatuses();
}
Expand Down
Loading

0 comments on commit 610b21d

Please sign in to comment.