public function getAll()
 {
     global $lC_Language, $lC_Vqmod;
     $media = $_GET['media'];
     $lC_DirectoryListing = new lC_DirectoryListing('includes/modules/product_attributes');
     $lC_DirectoryListing->setIncludeDirectories(false);
     $lC_DirectoryListing->setStats(true);
     $localFiles = $lC_DirectoryListing->getFiles();
     $addonFiles = lC_Addons_Admin::getAdminAddonsProductAttributesFiles();
     $files = array_merge((array) $localFiles, (array) $addonFiles);
     $cnt = 0;
     $result = array('aaData' => array());
     $installed_modules = array();
     foreach ($files as $file) {
         include $lC_Vqmod->modCheck($file['path']);
         $class = substr($file['name'], 0, strrpos($file['name'], '.'));
         if (class_exists('lC_ProductAttributes_' . $class)) {
             $moduleClass = 'lC_ProductAttributes_' . $class;
             $mod = new $moduleClass();
             $lC_Language->loadIniFile('modules/product_attributes/' . $class . '.php');
             $title = '<td>' . $lC_Language->get('product_attributes_' . $mod->getCode() . '_title') . '</td>';
             $action = '<td class="align-right vertical-center"><span class="button-group compact">';
             if ($mod->isInstalled()) {
                 $action .= '<a href="' . ((int) ($_SESSION['admin']['access']['modules'] < 4) ? '#' : 'javascript://" onclick="uninstallModule(\'' . $mod->getCode() . '\', \'' . urlencode($mod->getTitle()) . '\')') . '" class="button icon-minus-round icon-red' . ((int) ($_SESSION['admin']['access']['modules'] < 4) ? ' disabled' : NULL) . '">' . ($media === 'mobile-portrait' || $media === 'mobile-landscape' ? NULL : $lC_Language->get('icon_uninstall')) . '</a>';
             } else {
                 $action .= '<a href="' . ((int) ($_SESSION['admin']['access']['modules'] < 3) ? '#' : 'javascript://" onclick="installModule(\'' . $mod->getCode() . '\', \'' . urlencode($lC_Language->get('product_attributes_' . $mod->getCode() . '_title')) . '\')') . '" class="button icon-plus-round icon-green' . ((int) ($_SESSION['admin']['access']['modules'] < 3) ? ' disabled' : NULL) . '">' . ($media === 'mobile-portrait' || $media === 'mobile-landscape' ? NULL : $lC_Language->get('button_install')) . '</a>';
             }
             $action .= '</span></td>';
             $result['aaData'][] = array("{$title}", "{$action}");
             $cnt++;
         }
     }
     $result['total'] = $cnt;
     return $result;
 }
Exemple #2
0
 protected function _initialize()
 {
     global $lC_Vqmod;
     $lC_DirectoryListing = new lC_DirectoryListing(DIR_FS_CATALOG . 'addons');
     $lC_DirectoryListing->setRecursive(true);
     $lC_DirectoryListing->setIncludeDirectories(false);
     $lC_DirectoryListing->setCheckExtension('php');
     $lC_DirectoryListing->setStats(true);
     $enabled = '';
     $lC_Addons_data = array();
     foreach ($lC_DirectoryListing->getFiles() as $addon) {
         $ao = utility::cleanArr($addon);
         if ($ao['name'] != 'controller.php') {
             continue;
         }
         $nameArr = explode('/', $ao['path']);
         $class = $nameArr[count($nameArr) - 2];
         if (file_exists($ao['path'])) {
             include_once $lC_Vqmod->modCheck($ao['path']);
             $aoData = new $class();
             $_SESSION['lC_Addons_data'][$class] = array('type' => $aoData->getAddonType(), 'title' => $aoData->getAddonTitle(), 'description' => $aoData->getAddonDescription(), 'rating' => $aoData->getAddonRating(), 'author' => $aoData->getAddonAuthor(), 'authorWWW' => $aoData->getAddonAuthorWWW(), 'thumbnail' => $aoData->getAddonThumbnail(), 'version' => $aoData->getAddonVersion(), 'compatibility' => $aoData->getCompatibility(), 'installed' => $aoData->isInstalled(), 'mobile' => $aoData->isMobileEnabled(), 'enabled' => $aoData->isEnabled());
             if ($aoData->isEnabled()) {
                 $enabled .= $addon['path'] . ';';
             }
         }
     }
     if ($enabled != '') {
         $enabled = substr($enabled, 0, -1);
     }
     if (!file_exists(DIR_FS_WORK . 'cache/addons.cache')) {
         file_put_contents(DIR_FS_WORK . 'cache/addons.cache', serialize($enabled));
     }
     $this->_data = $_SESSION['lC_Addons_data'];
 }
 public static function getAll()
 {
     global $lC_Language;
     if (!defined('LC_ADMIN_FILE_MANAGER_ROOT_PATH')) {
         define('LC_ADMIN_FILE_MANAGER_ROOT_PATH', substr(DIR_FS_CATALOG, 0, -1));
     }
     $media = $_GET['media'];
     $goto_array = array(array('id' => '', 'text' => $lC_Language->get('top_level')));
     if ($_SESSION['fm_directory'] != LC_ADMIN_FILE_MANAGER_ROOT_PATH) {
         $path_array = explode('/', substr($_SESSION['fm_directory'], strlen(LC_ADMIN_FILE_MANAGER_ROOT_PATH) + 1));
         foreach ($path_array as $value) {
             if (sizeof($goto_array) < 2) {
                 $goto_array[] = array('id' => $value, 'text' => $value);
             } else {
                 $parent = end($goto_array);
                 $goto_array[] = array('id' => $parent['id'] . '/' . $value, 'text' => $parent['id'] . '/' . $value);
             }
         }
     }
     $lC_DirectoryListing = new lC_DirectoryListing($_SESSION['fm_directory']);
     $lC_DirectoryListing->setStats(true);
     $result = array('aaData' => array());
     if ($_SESSION['fm_directory'] != LC_ADMIN_FILE_MANAGER_ROOT_PATH) {
         $files = '<td>' . lc_link_object(lc_href_link_admin(FILENAME_DEFAULT, 'file_manager&goto=' . $goto_array[sizeof($goto_array) - 2]['id']), '<span class="icon-up-fat icon-blue">&nbsp;' . $lC_Language->get('parent_level')) . '</td>';
         $result['aaData'][] = array("{$files}", "", "", "", "", "", "", "");
     }
     $cnt = 0;
     foreach ($lC_DirectoryListing->getFiles() as $file) {
         $file_owner = posix_getpwuid($file['user_id']);
         $group_owner = posix_getgrgid($file['group_id']);
         if ($file['is_directory'] === true) {
             $entry_url = lc_href_link_admin(FILENAME_DEFAULT, 'file_manager&directory=' . $file['name']);
             $files = '<td>' . lc_link_object($entry_url, '<span class="icon-folder icon-orange">&nbsp;' . $file['name']) . '</td>';
         } else {
             $entry_url = lc_href_link_admin(FILENAME_DEFAULT, 'file_manager&entry=' . $file['name'] . '&action=save');
             $files = '<td><a href="javascript:void(0);" onclick="editEntry(\'' . $file['name'] . '\')">' . '<span class="icon-page-list icon-blue">&nbsp;' . $file['name'] . '</a></td>';
         }
         $size = '<td>' . number_format($file['size']) . '</td>';
         $perms = '<td>' . lc_get_file_permissions($file['permissions']) . '</td>';
         $user = '******' . $file_owner['name'] . '</td>';
         $group = '<td>' . $group_owner['name'] . '</td>';
         $write = '<td>' . is_writable($lC_DirectoryListing->getDirectory() . '/' . $file['name']) ? '<span class="icon-tick icon-green">' : '<span class="icon-cross icon-red">' . '</td>';
         $last = '<td>' . lC_DateTime::getShort(@date('Y-m-d H:i:s', $file['last_modified']), true) . '</td>';
         if ($file['is_directory'] === false) {
             $action_links = '<a href="' . ((int) ($_SESSION['admin']['access']['file_manager'] < 3) ? '#' : 'javascript://" onclick="editEntry(\'' . $file['name'] . '\')') . '" class="button icon-pencil' . ((int) ($_SESSION['admin']['access']['file_manager'] < 3) ? ' disabled' : NULL) . '">' . ($media === 'mobile-portrait' || $media === 'mobile-landscape' ? NULL : $lC_Language->get('icon_edit')) . '</a>' . '<a href="' . ((int) ($_SESSION['admin']['access']['file_manager'] < 2) ? '#' : lc_href_link_admin(FILENAME_DEFAULT, 'file_manager&entry=' . $file['name'] . '&action=download')) . '" class="button icon-download with-tooltip' . ((int) ($_SESSION['admin']['access']['file_manager'] < 2) ? ' disabled' : NULL) . '" title="' . $lC_Language->get('icon_download') . '"></a>' . '<a href="' . ((int) ($_SESSION['admin']['access']['file_manager'] < 4) ? '#' : 'javascript://" onclick="deleteEntry(\'' . $file['name'] . '\', \'' . urlencode($file['name']) . '\')"') . '" class="button icon-trash with-tooltip' . ((int) ($_SESSION['admin']['access']['file_manager'] < 4) ? ' disabled' : NULL) . '" title="' . $lC_Language->get('icon_delete') . '"></a>';
         } else {
             $action_links = '<a href="' . ((int) ($_SESSION['admin']['access']['file_manager'] < 4) ? '#' : 'javascript://" onclick="deleteEntry(\'' . $file['name'] . '\', \'' . urlencode($file['name']) . '\')"') . '" class="button icon-trash' . ((int) ($_SESSION['admin']['access']['file_manager'] < 4) ? ' disabled' : NULL) . '" title="' . $lC_Language->get('icon_delete') . '"></a>';
         }
         $action = '<td class="align-right vertical-center"><span class="button-group compact">
                ' . $action_links . '
              </span></td>';
         $result['aaData'][] = array("{$files}", "{$size}", "{$perms}", "{$user}", "{$group}", "{$write}", "{$last}", "{$action}");
         $cnt++;
     }
     $result['total'] = $cnt;
     return $result;
 }
Exemple #4
0
 /**
  * Get the last database backup
  *  
  * @access public      
  * @return array
  */
 private static function __getLastDBBackup()
 {
     $lC_DirectoryListing = new lC_DirectoryListing(DIR_FS_BACKUP);
     $lC_DirectoryListing->setIncludeDirectories(false);
     $lC_DirectoryListing->setStats(true);
     $lC_DirectoryListing->setCheckExtension('zip');
     $lC_DirectoryListing->setCheckExtension('sql');
     $lC_DirectoryListing->setCheckExtension('gz');
     $latest = 0;
     foreach ($lC_DirectoryListing->getFiles() as $file) {
         if ((int) $latest < (int) $file['last_modified']) {
             $latest = $file;
         }
     }
     return $file;
 }
 public static function checkHooks()
 {
     global $lC_Language;
     $list = '';
     foreach (lC_Store_Admin::getInstalledAddons() as $key => $val) {
         $code = $val['code'];
         $title = $val['title'];
         $lC_DirectoryListing = new lC_DirectoryListing(DIR_FS_CATALOG . 'addons/' . $code . '/hooks');
         $lC_DirectoryListing->setRecursive(true);
         $lC_DirectoryListing->setIncludeDirectories(false);
         $lC_DirectoryListing->setAddDirectoryToFilename(true);
         $lC_DirectoryListing->setStats(true);
         $lC_DirectoryListing->setCheckExtension('xml');
         foreach ($lC_DirectoryListing->getFiles() as $file) {
             $status = self::_cacheFileExists($file['path'], 'catalog') == true ? $lC_Language->get('cached_file_exists') . '<span class="icon-tick icon-green icon-size2 margin-left"></span>' : $lC_Language->get('cached_file_not_exists') . '<span class="icon-cross icon-red icon-size2 margin-left"></span>';
             $list .= '<li>' . $title . ' => hooks/' . $file['name'] . ' => ' . $status . '</li>';
         }
         $lC_DirectoryListing = new lC_DirectoryListing(DIR_FS_CATALOG . 'addons/' . $code . '/admin/hooks');
         $lC_DirectoryListing->setRecursive(true);
         $lC_DirectoryListing->setIncludeDirectories(false);
         $lC_DirectoryListing->setAddDirectoryToFilename(true);
         $lC_DirectoryListing->setStats(true);
         $lC_DirectoryListing->setCheckExtension('xml');
         foreach ($lC_DirectoryListing->getFiles() as $file) {
             $status = self::_cacheFileExists($file['path']) == true ? $lC_Language->get('cached_file_exists') . '<span class="icon-tick icon-green icon-size2 margin-left"></span>' : $lC_Language->get('cached_file_not_exists') . '<span class="icon-cross icon-red icon-size2 margin-left"></span>';
             $list .= '<li>' . $title . ' => admin/hooks/' . $file['name'] . ' => ' . $status . '</li>';
         }
     }
     return $list;
 }
Exemple #6
0
 private static function _init()
 {
     global $lC_Vqmod, $lC_Language, $lC_Database;
     $lC_DirectoryListing = new lC_DirectoryListing(DIR_FS_CATALOG . 'addons');
     $lC_DirectoryListing->setRecursive(true);
     $lC_DirectoryListing->setIncludeDirectories(false);
     $lC_DirectoryListing->setCheckExtension('php');
     $lC_DirectoryListing->setStats(true);
     $enabled = '';
     foreach ($lC_DirectoryListing->getFiles() as $addon) {
         $ao = utility::cleanArr($addon);
         if ($ao['name'] != 'controller.php') {
             continue;
         }
         $nameArr = explode('/', $ao['path']);
         $class = $nameArr[count($nameArr) - 2];
         if (file_exists($ao['path'])) {
             include_once $lC_Vqmod->modCheck($ao['path']);
             $aoData = new $class();
             if ($aoData->isAutoInstall()) {
                 if (defined('ADDONS_' . strtoupper($aoData->getAddonType()) . '_' . strtoupper($class) . '_STATUS')) {
                     $isInstalled = $aoData->isInstalled();
                     $isEnabled = $aoData->isEnabled();
                 } else {
                     if (class_exists('lC_Store_Admin')) {
                     } else {
                         include_once $lC_Vqmod->modCheck('includes/applications/store/classes/store.php');
                     }
                     lC_Store_Admin::install($class);
                     $isInstalled = true;
                     $isEnabled = true;
                 }
             } else {
                 $isInstalled = $aoData->isInstalled();
                 $isEnabled = $aoData->isEnabled();
             }
             // language definitions
             if (file_exists(DIR_FS_CATALOG . 'addons/' . $class . '/languages/' . $lC_Language->getCode() . '.xml')) {
                 $lC_Language->injectAddonDefinitions(DIR_FS_CATALOG . 'addons/' . $class . '/languages/' . $lC_Language->getCode() . '.xml', $lC_Language->getCode());
             }
             $_SESSION['lC_Addons_Admin_data'][$class] = array('type' => $aoData->getAddonType(), 'title' => strpos($aoData->getAddonTitle(), '_') > 0 ? $lC_Language->get($aoData->getAddonTitle()) : $aoData->getAddonTitle(), 'description' => strpos($aoData->getAddonDescription(), '_') > 0 ? $lC_Language->get($aoData->getAddonDescription()) : $aoData->getAddonDescription(), 'rating' => $aoData->getAddonRating(), 'author' => $aoData->getAddonAuthor(), 'authorWWW' => $aoData->getAddonAuthorWWW(), 'thumbnail' => $aoData->getAddonThumbnail(), 'version' => $aoData->getAddonVersion(), 'compatibility' => $aoData->getCompatibility(), 'installed' => $isInstalled, 'mobile' => $aoData->isMobileEnabled(), 'auto_install' => $aoData->isAutoInstall(), 'enabled' => $isEnabled);
             if ($isEnabled) {
                 $enabled .= $addon['path'] . ';';
             }
             if ($aoData->isAutoInstall() === true) {
                 self::_autoInstall($class);
             }
         }
     }
     if ($enabled != '') {
         $enabled = substr($enabled, 0, -1);
     }
     if (!file_exists(DIR_FS_WORK . 'cache/addons.cache')) {
         file_put_contents(DIR_FS_WORK . 'cache/addons.cache', serialize($enabled));
     }
     self::$_data = $_SESSION['lC_Addons_Admin_data'];
     // cleanup
     $Qchk = $lC_Database->query("select * from :table_templates_boxes where modules_group LIKE '%|%'");
     $Qchk->bindTable(':table_templates_boxes', TABLE_TEMPLATES_BOXES);
     $Qchk->execute();
     while ($Qchk->next()) {
         $parts = explode('|', $Qchk->value('modules_group'));
         $type = $parts[0];
         $addon = $parts[1];
         if (!file_exists(DIR_FS_CATALOG . 'addons/' . $addon . '/controller.php')) {
             $Qdel = $lC_Database->query('delete from :table_templates_boxes where modules_group = :modules_group');
             $Qdel->bindTable(':table_templates_boxes', TABLE_TEMPLATES_BOXES);
             $Qdel->bindValue(':modules_group', $Qchk->value('modules_group'));
             $Qdel->execute();
         }
     }
     $Qchk->freeResult();
 }