Beispiel #1
0
 public function getUserLevels($id)
 {
     global $lC_Database;
     $modules = array();
     $Qaccess = $lC_Database->query('select module, level from :table_administrators_access where administrators_groups_id = :administrators_groups_id');
     $Qaccess->bindTable(':table_administrators_access', TABLE_ADMINISTRATORS_ACCESS);
     $Qaccess->bindInt(':administrators_groups_id', $id);
     $Qaccess->execute();
     while ($Qaccess->next()) {
         if (strstr($Qaccess->value('module'), '-')) {
             $modules[substr($Qaccess->value('module'), strpos($Qaccess->value('module'), '-') + 1)] = $Qaccess->value('level');
         } else {
             $modules[$Qaccess->value('module')] = $Qaccess->value('level');
         }
     }
     if (array_key_exists('*', $modules)) {
         $modules = array();
         $lC_DirectoryListing = new lC_DirectoryListing('includes/modules/access');
         $lC_DirectoryListing->setIncludeDirectories(false);
         foreach ($lC_DirectoryListing->getFiles() as $file) {
             $modules[substr($file['name'], 0, strrpos($file['name'], '.'))] = '99';
         }
         $modulesPlusAddons = lC_Addons_Admin::getModulesAccessTopAdmin($modules);
         $modules = $modulesPlusAddons;
     }
     return $modules;
 }
 public static function getFormData($id = null)
 {
     global $lC_Language;
     $result = array();
     $lC_DirectoryListing = new lC_DirectoryListing('../includes/modules/variants');
     $lC_DirectoryListing->setIncludeDirectories(false);
     $lC_DirectoryListing->setCheckExtension('php');
     if ($id != null && is_numeric($id)) {
         $result['pvData'] = lC_Product_variants_Admin::getData($id, $lC_Language->getID());
     }
     $modules_array = array();
     foreach ($lC_DirectoryListing->getFiles() as $file) {
         $module = substr($file['name'], 0, strrpos($file['name'], '.'));
         $modules_array[$module] = $module;
     }
     $result['modulesArray'] = $modules_array;
     $result['groupNames'] = '';
     $result['editGroupNames'] = '';
     foreach ($lC_Language->getAll() as $l) {
         if ($id != null && is_numeric($id)) {
             $result['editGroupNames'] .= '<span class="input" style="width:88%"><label for="name[' . $l['id'] . ']" class="button silver-gradient glossy">' . $lC_Language->showImage($l['code']) . '</label>' . lc_draw_input_field('group_name[' . $l['id'] . ']', $result['pvData']['title'], 'id="editGroupName[' . $l['id'] . ']" class="input-unstyled"') . '</span><br />';
         } else {
             $result['groupNames'] .= '<span class="input" style="width:88%"><label for="name[' . $l['id'] . ']" class="button silver-gradient glossy">' . $lC_Language->showImage($l['code']) . '</label>' . lc_draw_input_field('group_name[' . $l['id'] . ']', null, 'class="input-unstyled"') . '</span><br />';
         }
     }
     return $result;
 }
Beispiel #3
0
 public static function getAll()
 {
     global $lC_Language, $lC_Vqmod;
     $media = $_GET['media'];
     $lC_DirectoryListing = new lC_DirectoryListing('includes/modules/image');
     $lC_DirectoryListing->setIncludeDirectories(false);
     $lC_DirectoryListing->setCheckExtension('php');
     $cnt = 0;
     $result = array('aaData' => array());
     foreach ($lC_DirectoryListing->getFiles() as $file) {
         include $lC_Vqmod->modCheck('includes/modules/image/' . $file['name']);
         $class = 'lC_Image_Admin_' . substr($file['name'], 0, strrpos($file['name'], '.'));
         if (class_exists($class)) {
             $module = new $class();
             $name = '<td>' . $module->getTitle() . '</td>';
             $action = '<td class="align-right vertical-center"><span class="button-group">
                <a href="' . ((int) ($_SESSION['admin']['access']['images'] < 3) ? '#' : 'javascript://" onclick="doAction(\'' . str_ireplace('.php', '', $file['name']) . '\', \'' . urlencode(str_ireplace('.php', '', $file['name'])) . '\')') . '" class="button icon-gear' . ((int) ($_SESSION['admin']['access']['images'] < 3) ? ' disabled' : NULL) . '">' . ($media === 'mobile-portrait' || $media === 'mobile-landscape' ? NULL : $lC_Language->get('icon_run')) . '</a>
              </span></td>';
             $result['aaData'][] = array("{$name}", "{$action}");
             $cnt++;
         }
     }
     $result['total'] = $cnt;
     return $result;
 }
 public static function getAll()
 {
     global $lC_Language, $lC_Vqmod;
     $media = $_GET['media'];
     $lC_DirectoryListing = new lC_DirectoryListing('../includes/modules/' . $_GET['set']);
     $lC_DirectoryListing->setIncludeDirectories(false);
     include $lC_Vqmod->modCheck('../includes/classes/modules.php');
     $lC_Language->load('modules-' . $_GET['set'], null, false);
     $result = array('aaData' => array());
     foreach ($lC_DirectoryListing->getFiles() as $file) {
         include $lC_Vqmod->modCheck('../includes/modules/' . $_GET['set'] . '/' . $file['name']);
         $code = substr($file['name'], 0, strrpos($file['name'], '.'));
         $class = 'lC_' . ucfirst($_GET['set']) . '_' . $code;
         if (class_exists($class)) {
             $lC_Language->injectDefinitions('modules/' . $_GET['set'] . '/' . $code . '.xml');
             $module = new $class();
             $name = '<td>' . $module->getTitle() . '</td>';
             $action = '<td class="align-right vertical-center"><span class="button-group compact" style="white-space:nowrap;">';
             if ($module->isInstalled()) {
                 if ($module->hasKeys()) {
                     $action .= '<a href="' . ((int) ($_SESSION['admin']['access']['templates'] < 3) ? '#' : 'javascript://" onclick="editModule(\'' . str_ireplace('.php', '', $file['name']) . '\')') . '" class="button icon-pencil' . ((int) ($_SESSION['admin']['access']['templates'] < 3) ? ' disabled' : NULL) . '">' . ($media === 'mobile-portrait' || $media === 'mobile-landscape' ? NULL : $lC_Language->get('icon_edit')) . '</a>';
                 }
                 $action .= '<a href="' . ((int) ($_SESSION['admin']['access']['templates'] < 3) ? '#' : 'javascript://" onclick="uninstallModule(\'' . str_ireplace('.php', '', $file['name']) . '\', \'' . $module->getTitle() . '\')') . '" class="button icon-minus-round icon-red with-tooltip' . ((int) ($_SESSION['admin']['access']['templates'] < 3) ? ' disabled' : NULL) . '" title="' . $lC_Language->get('icon_uninstall') . '"></a>';
             } else {
                 $action .= '<a href="' . ((int) ($_SESSION['admin']['access']['templates'] < 3) ? '#' : 'javascript://" onclick="installModule(\'' . str_ireplace('.php', '', $file['name']) . '\', \'' . $module->getTitle() . '\')') . '" class="button icon-plus-round icon-green with-tooltip' . ((int) ($_SESSION['admin']['access']['templates'] < 3) ? ' disabled' : NULL) . '" title="' . $lC_Language->get('icon_install') . '"></a>';
             }
             $action .= '<a href="' . ((int) ($_SESSION['admin']['access']['templates'] < 3) ? '#' : 'javascript://" onclick="showInfo(\'' . str_ireplace('.php', '', $file['name']) . '\', \'' . $module->getTitle() . '\')') . '" class="button icon-question-round icon-blue with-tooltip' . ((int) ($_SESSION['admin']['access']['templates'] < 3) ? ' disabled' : NULL) . '" title="' . $lC_Language->get('icon_info') . '"></a>';
             $action .= '</span></td>';
             $result['aaData'][] = array("{$name}", "{$action}");
             $cnt++;
         }
     }
     return $result;
 }
 public static function formData($id = null)
 {
     global $lC_Database, $lC_Language, $lC_Vqmod;
     $lC_DirectoryListing = new lC_DirectoryListing('includes/modules/newsletters');
     $lC_DirectoryListing->setIncludeDirectories(false);
     $modules_array = array();
     foreach ($lC_DirectoryListing->getFiles() as $file) {
         $module = substr($file['name'], 0, strrpos($file['name'], '.'));
         $lC_Language->loadIniFile('modules/newsletters/' . $file['name']);
         include $lC_Vqmod->modCheck('includes/modules/newsletters/' . $file['name']);
         $newsletter_module_class = 'lC_Newsletter_' . $module;
         $lC_NewsletterModule = new $newsletter_module_class();
         $modules_array[$module] = $lC_NewsletterModule->getTitle();
     }
     $result['modulesArray'] = $modules_array;
     if ($id != null) {
         $Qnewsletter = $lC_Database->query('select * from :table_newsletters where newsletters_id = :newsletters_id');
         $Qnewsletter->bindTable(':table_newsletters', TABLE_NEWSLETTERS);
         $Qnewsletter->bindInt(':newsletters_id', $id);
         $Qnewsletter->execute();
         $data = $Qnewsletter->toArray();
         $Qnewsletter->freeResult();
         $result = array_merge((array) $result, (array) $data);
     }
     return $result;
 }
 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;
 }
 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;
 }
Beispiel #8
0
 public static function getAll()
 {
     global $lC_Language, $lC_Vqmod;
     $media = $_GET['media'];
     $lC_DirectoryListing = new lC_DirectoryListing('includes/templates');
     $lC_DirectoryListing->setIncludeDirectories(false);
     $files = $lC_DirectoryListing->getFiles();
     $cnt = 0;
     $result = array('aaData' => array());
     // sort the array of files so the default template is at top
     $default = array();
     $other = array();
     foreach ($files as $file) {
         if (strpos($file['name'], '.') !== (int) 0) {
             $code = substr($file['name'], 0, strrpos($file['name'], '.'));
             if ($code == DEFAULT_TEMPLATE) {
                 $default[] = $file;
             } else {
                 $other[] = $file;
             }
             $sorted = array_merge((array) $default, (array) $other);
         }
     }
     foreach ($sorted as $file) {
         if (strpos($file['name'], '.') !== (int) 0) {
             include $lC_Vqmod->modCheck('includes/templates/' . $file['name']);
             $code = substr($file['name'], 0, strrpos($file['name'], '.'));
             $class = 'lC_Template_' . $code;
             if (class_exists($class)) {
                 $module = new $class();
                 $image = '<a href="' . ((int) ($_SESSION['admin']['access']['templates'] < 3) ? '#' : 'javascript://" onclick="showInfo(\'' . str_ireplace('.php', '', $file['name']) . '\', \'' . $module->getTitle() . '\')') . '" class="' . ((int) ($_SESSION['admin']['access']['templates'] < 3) ? ' disabled' : NULL) . '">' . lc_image(DIR_WS_CATALOG . 'templates/' . $code . '/images/' . $module->getScreenshot(), null, 160, 120) . '</a>';
                 $module_title = $module->getTitle();
                 if ($module->getCode() == DEFAULT_TEMPLATE) {
                     $module_title .= '<small class="tag purple-gradient glossy margin-left">' . $lC_Language->get('default_entry') . '</small>';
                 }
                 $name = '<div class="strong">' . $module_title . '</div><div class="mid-margin-top"><a href="' . $module->getAuthorAddress() . '" target="_blank">' . $module->getAuthorName() . '</a></div><div class="mid-margin-top"><small>' . $module->getMarkup() . ' ' . $module->getMedium() . '</small></div>';
                 $action = '<span class="button-group compact">';
                 if ($module->isInstalled() && $module->isActive()) {
                     if ($module->hasKeys() || $module->getCode() != DEFAULT_TEMPLATE) {
                         $action .= '<a href="' . ((int) ($_SESSION['admin']['access']['templates'] < 3) ? '#' : 'javascript://" onclick="editTemplate(\'' . str_ireplace('.php', '', $file['name']) . '\')') . '" class="button icon-pencil' . ((int) ($_SESSION['admin']['access']['templates'] < 3) ? ' disabled' : NULL) . '">' . ($media === 'mobile-portrait' || $media === 'mobile-landscape' ? NULL : $lC_Language->get('icon_edit')) . '</a>';
                     }
                     if ($module->getCode() != DEFAULT_TEMPLATE) {
                         $action .= '<a href="' . ((int) ($_SESSION['admin']['access']['templates'] < 3) ? '#' : 'javascript://" onclick="uninstallTemplate(\'' . str_ireplace('.php', '', $file['name']) . '\', \'' . $module->getTitle() . '\')') . '" class="button icon-minus-round icon-red with-tooltip' . ((int) ($_SESSION['admin']['access']['templates'] < 3) ? ' disabled' : NULL) . '" title="' . $lC_Language->get('icon_uninstall') . '"></a>';
                     }
                 } else {
                     $action .= '<a href="' . ((int) ($_SESSION['admin']['access']['templates'] < 3) ? '#' : 'javascript://" onclick="installTemplate(\'' . str_ireplace('.php', '', $file['name']) . '\', \'' . $module->getTitle() . '\')') . '" class="button icon-plus-round icon-green with-tooltip' . ((int) ($_SESSION['admin']['access']['templates'] < 3) ? ' disabled' : NULL) . '" title="' . $lC_Language->get('icon_install') . '"></a>';
                 }
                 $action .= '<a href="' . ((int) ($_SESSION['admin']['access']['templates'] < 3) ? '#' : 'javascript://" onclick="showInfo(\'' . str_ireplace('.php', '', $file['name']) . '\', \'' . $module->getTitle() . '\')') . '" class="button icon-camera icon-blue with-tooltip' . ((int) ($_SESSION['admin']['access']['templates'] < 3) ? ' disabled' : NULL) . '" title="' . $lC_Language->get('icon_preview') . '"></a>';
                 $result['aaData'][] = array("{$image}", "{$name}", "{$action}");
                 $cnt++;
             }
         }
     }
     return $result;
 }
Beispiel #9
0
 public function lC_LanguageInstall()
 {
     $lC_DirectoryListing = new lC_DirectoryListing('../includes/languages');
     $lC_DirectoryListing->setIncludeDirectories(false);
     $lC_DirectoryListing->setCheckExtension('xml');
     foreach ($lC_DirectoryListing->getFiles() as $file) {
         $lC_XML = new lC_XML(file_get_contents('../includes/languages/' . $file['name']));
         $lang = $lC_XML->toArray();
         $this->_languages[$lang['language']['data']['code']] = array('name' => $lang['language']['data']['title'], 'code' => $lang['language']['data']['code'], 'charset' => $lang['language']['data']['character_set']);
     }
     unset($lang);
     $language = isset($_GET['language']) && !empty($_GET['language']) ? $_GET['language'] : '';
     $this->set($language);
     $this->loadIniFile();
     $this->loadIniFile(basename($_SERVER['SCRIPT_FILENAME']));
 }
 public function __construct()
 {
     global $lC_Language;
     if (!isset($_GET['set'])) {
         $_GET['set'] = '';
     }
     $lC_DirectoryListing = new lC_DirectoryListing('../includes/modules/' . $_GET['set']);
     $lC_DirectoryListing->setIncludeDirectories(false);
     $_SESSION['modules_location'] = $lC_DirectoryListing->getDirectory();
     switch ($_GET['set']) {
         case 'content':
             $this->_page_title = $lC_Language->get('heading_title_content');
             break;
         case 'boxes':
         default:
             $_GET['set'] = 'boxes';
             $this->_page_title = $lC_Language->get('heading_title_boxes');
             break;
     }
 }
Beispiel #11
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'];
 }
Beispiel #12
0
 public static function getAll()
 {
     global $lC_Language;
     $media = $_GET['media'];
     $lC_DirectoryListing = new lC_DirectoryListing(DIR_FS_BACKUP);
     $lC_DirectoryListing->setIncludeDirectories(false);
     $lC_DirectoryListing->setCheckExtension('zip');
     $lC_DirectoryListing->setCheckExtension('sql');
     $lC_DirectoryListing->setCheckExtension('gz');
     $cnt = 0;
     $result = array('aaData' => array());
     foreach ($lC_DirectoryListing->getFiles() as $file) {
         $downloadLink = lc_href_link_admin(FILENAME_DEFAULT, 'backup&action=download&file=' . $file['name']);
         $check = '<td><input class="batch" type="checkbox" name="batch[]" value="' . $file['name'] . '" id="' . $file['name'] . '"></td>';
         $filename = '<td><a href="' . $downloadLink . '"><span class="icon-download icon-orange with-tooltip" title="' . $lC_Language->icon_download . '">&nbsp;' . $file['name'] . '</a></td>';
         $date = '<td>' . lC_DateTime::getShort(lC_DateTime::fromUnixTimestamp(@filemtime(DIR_FS_BACKUP . $file['name'])), true) . '</td>';
         $size = '<td>' . number_format(@filesize(DIR_FS_BACKUP . $file['name'])) . '</td>';
         $action = '<td class="align-right vertical-center"><span class="button-group compact">
   <a href="' . ((int) ($_SESSION['admin']['access']['backup'] < 3) ? '#' : 'javascript://" onclick="restoreEntry(\'' . $file['name'] . '\')') . '" class="button icon-pencil' . ((int) ($_SESSION['admin']['access']['backup'] < 3) ? ' disabled' : NULL) . '">' . ($media === 'mobile-portrait' || $media === 'mobile-landscape' ? NULL : $lC_Language->get('icon_restore')) . '</a>
   <a href="' . ((int) ($_SESSION['admin']['access']['backup'] < 4) ? '#' : 'javascript://" onclick="deleteEntry(\'' . $file['name'] . '\', \'' . urlencode($file['name']) . '\')') . '" class="button icon-trash with-tooltip' . ((int) ($_SESSION['admin']['access']['backup'] < 4) ? ' disabled' : NULL) . '" title="' . $lC_Language->get('icon_delete') . '"></a>
   </span></td>';
         $result['aaData'][] = array("{$check}", "{$filename}", "{$date}", "{$size}", "{$action}");
         $cnt++;
     }
     $result['total'] = $cnt;
     return $result;
 }
 public static function getAll()
 {
     global $lC_Language, $lC_Template, $lC_Vqmod;
     $media = $_GET['media'];
     $lC_DirectoryListing = new lC_DirectoryListing('includes/modules/order_total');
     $lC_DirectoryListing->setIncludeDirectories(false);
     $files = $lC_DirectoryListing->getFiles();
     $installed_modules = array();
     $result = array('aaData' => array());
     foreach ($files as $file) {
         include $lC_Vqmod->modCheck('includes/modules/order_total/' . $file['name']);
         $class = substr($file['name'], 0, strrpos($file['name'], '.'));
         if (class_exists('lC_OrderTotal_' . $class)) {
             $lC_Language->injectDefinitions('modules/order_total/' . $class . '.xml');
             $module = 'lC_OrderTotal_' . $class;
             $module = new $module();
             $name = '<td>' . $module->_title . '</td>';
             $sort = '<td>' . $module->_sort_order . '</td>';
             if ($module->_title == null) {
                 continue;
             }
             if ($module->isInstalled()) {
                 $action = '<td class="align-right vertical-center"><span class="button-group compact">
                    <a href="' . ((int) ($_SESSION['admin']['access']['modules'] < 3) ? '#' : 'javascript://" onclick="editModule(\'' . $module->_code . '\')') . '" class="button icon-pencil' . ((int) ($_SESSION['admin']['access']['modules'] < 3) ? ' disabled' : NULL) . '">' . ($media === 'mobile-portrait' || $media === 'mobile-landscape' ? NULL : $lC_Language->get('icon_edit')) . '</a>
                    <a href="' . ((int) ($_SESSION['admin']['access']['modules'] < 4) ? '#' : 'javascript://" onclick="uninstallModule(\'' . $module->_code . '\', \'' . urlencode($module->_title) . '\')') . '" class="button icon-minus-round icon-red with-tooltip' . ((int) ($_SESSION['admin']['access']['modules'] < 4) ? ' disabled' : NULL) . '" title="' . $lC_Language->get('icon_uninstall') . '"></a>
                  </span></td>';
             } else {
                 $action = '<td class="align-right vertical-center"><span class="button-group compact">
                    <a href="' . ((int) ($_SESSION['admin']['access']['modules'] < 2) ? '#' : 'javascript://" onclick="installModule(\'' . $module->_code . '\')') . '" class="button icon-plus-round icon-green' . ((int) ($_SESSION['admin']['access']['modules'] < 2) ? ' disabled' : NULL) . '">' . ($media === 'mobile-portrait' || $media === 'mobile-landscape' ? NULL : $lC_Language->get('icon_install')) . '</a>
                  </span></td>';
             }
             $result['aaData'][] = array("{$name}", "{$sort}", "{$action}");
             $result['entries'][] = array('module_class' => $class, 'module_title' => $module->_title);
         }
     }
     return $result;
 }
Beispiel #14
0
 public static function getAll()
 {
     global $lC_Language, $_module;
     $media = $_GET['media'];
     $lC_DirectoryListing = new lC_DirectoryListing(DIR_FS_WORK . 'cache/');
     $lC_DirectoryListing->setIncludeDirectories(false);
     $lC_DirectoryListing->setCheckExtension('cache');
     $cached_files = array();
     foreach ($lC_DirectoryListing->getFiles() as $file) {
         $last_modified = filemtime(DIR_FS_WORK . 'cache/' . $file['name']);
         if (strpos($file['name'], '-') !== false) {
             $code = substr($file['name'], 0, strpos($file['name'], '-'));
         } else {
             $code = substr($file['name'], 0, strpos($file['name'], '.'));
         }
         if (isset($cached_files[$code])) {
             $cached_files[$code]['total']++;
             if ($last_modified > $cached_files[$code]['last_modified']) {
                 $cached_files[$code]['last_modified'] = $last_modified;
             }
         } else {
             $cached_files[$code] = array('total' => 1, 'last_modified' => $last_modified);
         }
     }
     $result = array('aaData' => array());
     foreach ($cached_files as $cache => $stats) {
         $check = '<td><input class="batch" type="checkbox" name="batch[]" value="' . $cache . '" id="' . $cache . '"></td>';
         $block = '<td>' . $cache . '</td>';
         $total = '<td>' . $stats['total'] . '</td>';
         $last = '<td>' . lC_DateTime::getShort(lC_DateTime::fromUnixTimestamp($stats['last_modified']), true) . '</td>';
         $action = '<td><span class="button-group compact">
                <a href="' . ((int) ($_SESSION['admin']['access'][$_module] < 4) ? '#' : 'javascript://" onclick="deleteEntry(\'' . $cache . '\', \'' . urlencode($cache) . '\')') . '" class="button icon-trash' . ((int) ($_SESSION['admin']['access'][$_module] < 4) ? ' disabled' : NULL) . '">' . ($media === 'mobile-portrait' || $media === 'mobile-landscape' ? NULL : $lC_Language->get('icon_delete')) . '</a>
              </span></td>';
         $result['aaData'][] = array("{$check}", "{$block}", "{$total}", "{$last}", "{$action}");
     }
     return $result;
 }
Beispiel #15
0
 public static function getAll()
 {
     global $lC_Language, $lC_Vqmod;
     $media = $_GET['media'];
     $lC_DirectoryListing = new lC_DirectoryListing('includes/modules/statistics');
     $lC_DirectoryListing->setIncludeDirectories(false);
     $lC_DirectoryListing->setCheckExtension('php');
     $cnt = 0;
     foreach ($lC_DirectoryListing->getFiles() as $file) {
         include $lC_Vqmod->modCheck('includes/modules/statistics/' . $file['name']);
         $class = 'lC_Statistics_' . str_replace(' ', '_', ucwords(str_replace('_', ' ', substr($file['name'], 0, strrpos($file['name'], '.')))));
         if (class_exists($class)) {
             $module = new $class();
             $name = '<td>' . lc_link_object(lc_href_link_admin(FILENAME_DEFAULT, 'statistics&module=' . substr($file['name'], 0, strrpos($file['name'], '.'))), $module->getIcon() . '&nbsp;' . $module->getTitle()) . '</td>';
             $action = '<td class="align-right vertical-center"><span class="button-group">
                  <a href="' . ((int) ($_SESSION['admin']['access']['banner_manager'] < 3) ? '#' : lc_href_link_admin(FILENAME_DEFAULT, 'statistics&module=' . substr($file['name'], 0, strrpos($file['name'], '.')))) . '" class="button icon-gear' . ((int) ($_SESSION['admin']['access']['banner_manager'] < 3) ? ' disabled' : NULL) . '">' . ($media === 'mobile-portrait' || $media === 'mobile-landscape' ? NULL : $lC_Language->get('icon_run')) . '</a>
                </span></td>';
             $result['aaData'][] = array("{$name}", "{$action}");
             $cnt++;
         }
     }
     $result['total'] = $cnt;
     return $result;
 }
 public static function getAll()
 {
     global $lC_Language, $lC_Template, $lC_Vqmod;
     $media = $_GET['media'];
     $lC_DirectoryListing = new lC_DirectoryListing('includes/modules/geoip');
     $lC_DirectoryListing->setIncludeDirectories(false);
     $files = $lC_DirectoryListing->getFiles();
     $installed = explode(';', MODULE_SERVICES_INSTALLED);
     $result = array('aaData' => array());
     foreach ($files as $file) {
         include $lC_Vqmod->modCheck('includes/modules/geoip/' . $file['name']);
         $class = substr($file['name'], 0, strrpos($file['name'], '.'));
         if (class_exists('lC_GeoIP_' . $class)) {
             $lC_Language->loadIniFile('modules/geoip/' . $class . '.php');
             $module = 'lC_GeoIP_' . $class;
             $module = new $module();
             $name = '<td>' . $module->getTitle() . '</td>';
             $action = '<td class="align-right vertical-center"><span class="button-group compact" style="white-space:nowrap;">';
             if ($module->isInstalled()) {
                 if (sizeof($module->getKeys()) > 0) {
                     $action .= '<a href="' . ((int) ($_SESSION['admin']['access']['modules'] < 4) ? '#' : 'javascript://" onclick="editModule(\'' . $class . '\')') . '" class="button icon-pencil' . ((int) ($_SESSION['admin']['access']['modules'] < 4) ? ' disabled' : NULL) . '">' . ($media === 'mobile-portrait' || $media === 'mobile-landscape' ? NULL : $lC_Language->get('icon_edit')) . '</a>';
                     $action .= '<a href="' . ((int) ($_SESSION['admin']['access']['modules'] < 2) ? '#' : 'javascript://" onclick="showInfo(\'' . $class . '\', \'' . urlencode($module->getTitle()) . '\')') . '" class="button icon-question-round icon-blue with-tooltip' . ((int) ($_SESSION['admin']['access']['modules'] < 2) ? ' disabled' : NULL) . '" title="' . $lC_Language->get('button_info') . '"></a>';
                 } else {
                     $action .= '<a href="' . ((int) ($_SESSION['admin']['access']['modules'] < 2) ? '#' : 'javascript://" onclick="showInfo(\'' . $class . '\', \'' . urlencode($module->getTitle()) . '\')') . '" class="button icon-question-round icon-blue' . ((int) ($_SESSION['admin']['access']['modules'] < 2) ? ' disabled' : NULL) . '">' . ($media === 'mobile-portrait' || $media === 'mobile-landscape' ? NULL : $lC_Language->get('button_info')) . '</a>';
                 }
                 $action .= '<a href="' . ((int) ($_SESSION['admin']['access']['modules'] < 4) ? '#' : 'javascript://" onclick="uninstallModule(\'' . $class . '\', \'' . urlencode($module->getTitle()) . '\')') . '" class="button icon-minus-round icon-red with-tooltip' . ((int) ($_SESSION['admin']['access']['modules'] < 4) ? ' disabled' : NULL) . '" title="' . $lC_Language->get('icon_uninstall') . '"></a>';
             } else {
                 $action .= '<a href="' . ((int) ($_SESSION['admin']['access']['modules'] < 2) ? '#' : 'javascript://" onclick="showInfo(\'' . $class . '\', \'' . urlencode($module->getTitle()) . '\')') . '" class="button icon-question-round icon-blue' . ((int) ($_SESSION['admin']['access']['modules'] < 2) ? ' disabled' : NULL) . '">' . ($media === 'mobile-portrait' || $media === 'mobile-landscape' ? NULL : $lC_Language->get('button_info')) . '</a>';
                 $action .= '<a href="' . ((int) ($_SESSION['admin']['access']['modules'] < 3) ? '#' : 'javascript://" onclick="installModule(\'' . $class . '\', \'' . urlencode($module->getTitle()) . '\')') . '" class="button icon-plus-round icon-green with-tooltip' . ((int) ($_SESSION['admin']['access']['modules'] < 3) ? ' disabled' : NULL) . '" title="' . $lC_Language->get('icon_install') . '"></a>';
             }
             $action .= '</span></td>';
         }
         $result['aaData'][] = array("{$name}", "{$action}");
     }
     return $result;
 }
Beispiel #17
0
  }
  if (mainOpen) {
    $('#mainMenuContainer').hide();
    $('#recentContainer').hide();
  }
  // get the current menu width in case screen size has changed
  var menuWidth = $("#menu").width();
  // slide to the right
  $('#profileInner').animate({
    "marginLeft" : 0
  });
});

// added to pull in any added modals used across all admin pages
<?php 
$lC_DirectoryListing = new lC_DirectoryListing('templates/' . $_SESSION['template']['code'] . '/modal/');
$lC_DirectoryListing->setCheckExtension('php');
foreach ($lC_DirectoryListing->getFiles() as $file) {
    include 'templates/' . $_SESSION['template']['code'] . '/modal/' . $file['name'];
}
?>
//QR Code JSON
$("#qrcode-tooltip").click(function(){
var jsonLink = '<?php 
echo lc_href_link_admin('rpc.php', 'qrcode&action=getqrcode');
?>
'
  $.getJSON(jsonLink,
    function (data) {
      if (data.rpcStatus != 1) {
        $.modal.alert('<?php 
Beispiel #18
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();
 }
Beispiel #19
0
 public static function getLocalImages()
 {
     $lC_DirectoryListing = new lC_DirectoryListing('../images/products/_upload', true);
     $lC_DirectoryListing->setCheckExtension('gif');
     $lC_DirectoryListing->setCheckExtension('jpg');
     $lC_DirectoryListing->setCheckExtension('png');
     $lC_DirectoryListing->setIncludeDirectories(false);
     $result = array('entries' => array());
     foreach ($lC_DirectoryListing->getFiles() as $file) {
         $result['entries'][] = $file['name'];
     }
     $result['rpcStatus'] = RPC_STATUS_SUCCESS;
     echo json_encode($result);
 }
Beispiel #20
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;
 }
Beispiel #21
0
 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;
 }
Beispiel #22
0
echo lC_Administrators_Index::get_live_data_total('Orders');
?>
</strong> <?php 
echo $lC_Language->get('text_new') . '<br />' . $lC_Language->get('text_orders');
?>
            </a>
          </li>
        </ul>
      </div>
    </div>
  </div>

  <div class="with-padding">
    <div class="columns clearfix">
      <?php 
$lC_DirectoryListing = new lC_DirectoryListing('includes/modules/summary');
$lC_DirectoryListing->setIncludeDirectories(false);
$files = $lC_DirectoryListing->getFiles();
$content = array();
foreach ($files as $file) {
    include $lC_Vqmod->modCheck('includes/modules/summary/' . $file['name']);
    $module = substr($file['name'], 0, strrpos($file['name'], '.'));
    $module_class = 'lC_Summary_' . $module;
    $lC_Summary = new $module_class();
    if ($lC_Summary->hasData()) {
        $content[$lC_Summary->getSortOrder()] = $lC_Summary->getData();
    }
    unset($lC_Summary);
}
ksort($content);
foreach ($content as $block) {
Beispiel #23
0
 public static function import($file, $type)
 {
     global $lC_Database, $lC_Currencies;
     if (file_exists('../includes/languages/' . $file . '.xml')) {
         $lC_XML = new lC_XML(file_get_contents('../includes/languages/' . $file . '.xml'));
         $source = $lC_XML->toArray();
         $language = array('name' => $source['language']['data']['title'], 'code' => $source['language']['data']['code'], 'locale' => $source['language']['data']['locale'], 'charset' => $source['language']['data']['character_set'], 'date_format_short' => $source['language']['data']['date_format_short'], 'date_format_long' => $source['language']['data']['date_format_long'], 'time_format' => $source['language']['data']['time_format'], 'text_direction' => $source['language']['data']['text_direction'], 'currency' => $source['language']['data']['default_currency'], 'numeric_separator_decimal' => $source['language']['data']['numerical_decimal_separator'], 'numeric_separator_thousands' => $source['language']['data']['numerical_thousands_separator'], 'parent_language_code' => isset($source['language']['data']['parent_language_code']) ? $source['language']['data']['parent_language_code'] : '', 'parent_id' => 0);
         if (lC_Currencies_Admin::exists($language['currency']) === false) {
             $language['currency'] = DEFAULT_CURRENCY;
         }
         if (!empty($language['parent_language_code']) && self::exists($language['parent_language_code'])) {
             $language['parent_id'] = self::get($language['parent_language_code'], 'languages_id');
         }
         $definitions = array();
         if (isset($source['language']['definitions']['definition'])) {
             $definitions = $source['language']['definitions']['definition'];
             if (isset($definitions['key']) && isset($definitions['value']) && isset($definitions['group'])) {
                 $definitions = array(array('key' => $definitions['key'], 'value' => $definitions['value'], 'group' => $definitions['group']));
             }
         }
         unset($source);
         $error = false;
         $add_category_and_product_placeholders = true;
         $lC_Database->startTransaction();
         $language_id = self::get($language['code'], 'languages_id');
         if ($language_id !== false) {
             $add_category_and_product_placeholders = false;
             $Qlanguage = $lC_Database->query('update :table_languages set name = :name, code = :code, locale = :locale, charset = :charset, date_format_short = :date_format_short, date_format_long = :date_format_long, time_format = :time_format, text_direction = :text_direction, currencies_id = :currencies_id, numeric_separator_decimal = :numeric_separator_decimal, numeric_separator_thousands = :numeric_separator_thousands, parent_id = :parent_id where languages_id = :languages_id');
             $Qlanguage->bindInt(':languages_id', $language_id);
         } else {
             $Qlanguage = $lC_Database->query('insert into :table_languages (name, code, locale, charset, date_format_short, date_format_long, time_format, text_direction, currencies_id, numeric_separator_decimal, numeric_separator_thousands, parent_id) values (:name, :code, :locale, :charset, :date_format_short, :date_format_long, :time_format, :text_direction, :currencies_id, :numeric_separator_decimal, :numeric_separator_thousands, :parent_id)');
         }
         $Qlanguage->bindTable(':table_languages', TABLE_LANGUAGES);
         $Qlanguage->bindValue(':name', $language['name']);
         $Qlanguage->bindValue(':code', $language['code']);
         $Qlanguage->bindValue(':locale', $language['locale']);
         $Qlanguage->bindValue(':charset', $language['charset']);
         $Qlanguage->bindValue(':date_format_short', $language['date_format_short']);
         $Qlanguage->bindValue(':date_format_long', $language['date_format_long']);
         $Qlanguage->bindValue(':time_format', $language['time_format']);
         $Qlanguage->bindValue(':text_direction', $language['text_direction']);
         $Qlanguage->bindInt(':currencies_id', lC_Currencies_Admin::getData($language['currency'], 'currencies_id'));
         $Qlanguage->bindValue(':numeric_separator_decimal', $language['numeric_separator_decimal']);
         $Qlanguage->bindValue(':numeric_separator_thousands', $language['numeric_separator_thousands']);
         $Qlanguage->bindInt(':parent_id', $language['parent_id']);
         $Qlanguage->setLogging($_SESSION['module'], $language_id !== false ? $language_id : null);
         $Qlanguage->execute();
         if ($lC_Database->isError()) {
             $error = true;
         } else {
             if ($language_id === false) {
                 $language_id = $lC_Database->nextID();
             }
             $default_language_id = lC_Languages_Admin::get(DEFAULT_LANGUAGE, 'languages_id');
             if ($type == 'replace') {
                 $Qdel = $lC_Database->query('delete from :table_languages_definitions where languages_id = :languages_id');
                 $Qdel->bindTable(':table_languages_definitions', TABLE_LANGUAGES_DEFINITIONS);
                 $Qdel->bindInt(':languages_id', $language_id);
                 $Qdel->execute();
                 if ($lC_Database->isError()) {
                     $error = true;
                 }
             }
         }
         if ($error === false) {
             $lC_DirectoryListing = new lC_DirectoryListing('../includes/languages/' . $file);
             $lC_DirectoryListing->setRecursive(true);
             $lC_DirectoryListing->setIncludeDirectories(false);
             $lC_DirectoryListing->setAddDirectoryToFilename(true);
             $lC_DirectoryListing->setCheckExtension('xml');
             foreach ($lC_DirectoryListing->getFiles() as $files) {
                 $definitions = array_merge($definitions, lC_Language_Admin::extractDefinitions($file . '/' . $files['name']));
             }
             foreach ($definitions as $def) {
                 $insert = false;
                 $update = false;
                 if ($type == 'replace') {
                     $insert = true;
                 } else {
                     $Qcheck = $lC_Database->query('select definition_key, content_group from :table_languages_definitions where definition_key = :definition_key and languages_id = :languages_id and content_group = :content_group');
                     $Qcheck->bindTable(':table_languages_definitions', TABLE_LANGUAGES_DEFINITIONS);
                     $Qcheck->bindValue(':definition_key', $def['key']);
                     $Qcheck->bindInt(':languages_id', $language_id);
                     $Qcheck->bindValue(':content_group', $def['group']);
                     $Qcheck->execute();
                     if ($Qcheck->numberOfRows() > 0) {
                         if ($type == 'update') {
                             $update = true;
                         }
                     } elseif ($type == 'add') {
                         $insert = true;
                     }
                 }
                 if ($insert === true || $update === true) {
                     if ($insert === true) {
                         $Qdef = $lC_Database->query('insert into :table_languages_definitions (languages_id, content_group, definition_key, definition_value) values (:languages_id, :content_group, :definition_key, :definition_value)');
                     } else {
                         $Qdef = $lC_Database->query('update :table_languages_definitions set content_group = :content_group, definition_key = :definition_key, definition_value = :definition_value where definition_key = :definition_key and languages_id = :languages_id and content_group = :content_group');
                         $Qdef->bindValue(':definition_key', $def['key']);
                         $Qdef->bindValue(':content_group', $def['group']);
                     }
                     $Qdef->bindTable(':table_languages_definitions', TABLE_LANGUAGES_DEFINITIONS);
                     $Qdef->bindInt(':languages_id', $language_id);
                     $Qdef->bindValue(':content_group', $def['group']);
                     $Qdef->bindValue(':definition_key', $def['key']);
                     $Qdef->bindValue(':definition_value', $def['value']);
                     $Qdef->execute();
                     if ($lC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
         }
         if ($add_category_and_product_placeholders === true) {
             if ($error === false) {
                 $Qcategories = $lC_Database->query('select categories_id, categories_name, categories_menu_name, categories_blurb, categories_keyword from :table_categories_description where language_id = :language_id');
                 $Qcategories->bindTable(':table_categories_description', TABLE_CATEGORIES_DESCRIPTION);
                 $Qcategories->bindInt(':language_id', $default_language_id);
                 $Qcategories->execute();
                 while ($Qcategories->next()) {
                     $Qinsert = $lC_Database->query('insert into :table_categories_description (categories_id, language_id, categories_name) values (:categories_id, :language_id, :categories_name)');
                     $Qinsert->bindTable(':table_categories_description', TABLE_CATEGORIES_DESCRIPTION);
                     $Qinsert->bindInt(':categories_id', $Qcategories->valueInt('categories_id'));
                     $Qinsert->bindInt(':language_id', $language_id);
                     $Qinsert->bindValue(':categories_name', $Qcategories->value('categories_name'));
                     $Qinsert->bindValue(':categories_menu_name', $Qcategories->value('categories_menu_name'));
                     $Qinsert->bindValue(':categories_blurb', $Qcategories->value('categories_blurb'));
                     $Qinsert->bindValue(':categories_keyword', $Qcategories->value('categories_keyword'));
                     $Qinsert->execute();
                     if ($lC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qproducts = $lC_Database->query('select products_id, products_name, products_description, products_keyword, products_tags, products_url from :table_products_description where language_id = :language_id');
                 $Qproducts->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
                 $Qproducts->bindInt(':language_id', $default_language_id);
                 $Qproducts->execute();
                 while ($Qproducts->next()) {
                     $Qinsert = $lC_Database->query('insert into :table_products_description (products_id, language_id, products_name, products_description, products_keyword, products_tags, products_url) values (:products_id, :language_id, :products_name, :products_description, :products_keyword, :products_tags, :products_url)');
                     $Qinsert->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
                     $Qinsert->bindInt(':products_id', $Qproducts->valueInt('products_id'));
                     $Qinsert->bindInt(':language_id', $language_id);
                     $Qinsert->bindValue(':products_name', $Qproducts->value('products_name'));
                     $Qinsert->bindValue(':products_description', $Qproducts->value('products_description'));
                     $Qinsert->bindValue(':products_keyword', $Qproducts->value('products_keyword'));
                     $Qinsert->bindValue(':products_tags', $Qproducts->value('products_tags'));
                     $Qinsert->bindValue(':products_url', $Qproducts->value('products_url'));
                     $Qinsert->execute();
                     if ($lC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qattributes = $lC_Database->query('select products_id, value from :table_product_attributes where languages_id = :languages_id');
                 $Qattributes->bindTable(':table_product_attributes', TABLE_PRODUCT_ATTRIBUTES);
                 $Qattributes->bindInt(':languages_id', $default_language_id);
                 $Qattributes->execute();
                 while ($Qattributes->next()) {
                     $Qinsert = $lC_Database->query('insert into :table_product_attributes (products_id, languages_id, value) values (:products_id, :languages_id, :value)');
                     $Qinsert->bindTable(':table_product_attributes', TABLE_PRODUCT_ATTRIBUTES);
                     $Qinsert->bindInt(':products_id', $Qattributes->valueInt('products_id'));
                     $Qinsert->bindInt(':languages_id', $language_id);
                     $Qinsert->bindValue(':value', $Qattributes->value('value'));
                     $Qinsert->execute();
                     if ($lC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qgroups = $lC_Database->query('select id, title, sort_order, module from :table_products_variants_groups where languages_id = :languages_id');
                 $Qgroups->bindTable(':table_products_variants_groups', TABLE_PRODUCTS_VARIANTS_GROUPS);
                 $Qgroups->bindInt(':languages_id', $default_language_id);
                 $Qgroups->execute();
                 while ($Qgroups->next()) {
                     $Qinsert = $lC_Database->query('insert into :table_products_variants_groups (id, languages_id, title, sort_order, module) values (:id, :languages_id, :title, :sort_order, :module)');
                     $Qinsert->bindTable(':table_products_variants_groups', TABLE_PRODUCTS_VARIANTS_GROUPS);
                     $Qinsert->bindInt(':id', $Qgroups->valueInt('id'));
                     $Qinsert->bindInt(':languages_id', $language_id);
                     $Qinsert->bindValue(':title', $Qgroups->value('title'));
                     $Qinsert->bindInt(':sort_order', $Qgroups->valueInt('sort_order'));
                     $Qinsert->bindValue(':module', $Qgroups->value('module'));
                     $Qinsert->execute();
                     if ($lC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qvalues = $lC_Database->query('select id, products_variants_groups_id, title, sort_order from :table_products_variants_values where languages_id = :languages_id');
                 $Qvalues->bindTable(':table_products_variants_values', TABLE_PRODUCTS_VARIANTS_VALUES);
                 $Qvalues->bindInt(':languages_id', $default_language_id);
                 $Qvalues->execute();
                 while ($Qvalues->next()) {
                     $Qinsert = $lC_Database->query('insert into :table_products_variants_values (id, languages_id, products_variants_groups_id, title, sort_order) values (:id, :languages_id, :products_variants_groups_id, :title, :sort_order)');
                     $Qinsert->bindTable(':table_products_variants_values', TABLE_PRODUCTS_VARIANTS_VALUES);
                     $Qinsert->bindInt(':id', $Qvalues->valueInt('id'));
                     $Qinsert->bindInt(':languages_id', $language_id);
                     $Qinsert->bindInt(':products_variants_groups_id', $Qvalues->valueInt('products_variants_groups_id'));
                     $Qinsert->bindValue(':title', $Qvalues->value('title'));
                     $Qinsert->bindInt(':sort_order', $Qvalues->valueInt('sort_order'));
                     $Qinsert->execute();
                     if ($lC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qmanufacturers = $lC_Database->query('select manufacturers_id, manufacturers_url from :table_manufacturers_info where languages_id = :languages_id');
                 $Qmanufacturers->bindTable(':table_manufacturers_info', TABLE_MANUFACTURERS_INFO);
                 $Qmanufacturers->bindInt(':languages_id', $default_language_id);
                 $Qmanufacturers->execute();
                 while ($Qmanufacturers->next()) {
                     $Qinsert = $lC_Database->query('insert into :table_manufacturers_info (manufacturers_id, languages_id, manufacturers_url) values (:manufacturers_id, :languages_id, :manufacturers_url)');
                     $Qinsert->bindTable(':table_manufacturers_info', TABLE_MANUFACTURERS_INFO);
                     $Qinsert->bindInt(':manufacturers_id', $Qmanufacturers->valueInt('manufacturers_id'));
                     $Qinsert->bindInt(':languages_id', $language_id);
                     $Qinsert->bindValue(':manufacturers_url', $Qmanufacturers->value('manufacturers_url'));
                     $Qinsert->execute();
                     if ($lC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qstatus = $lC_Database->query('select orders_status_id, orders_status_name from :table_orders_status where language_id = :language_id');
                 $Qstatus->bindTable(':table_orders_status', TABLE_ORDERS_STATUS);
                 $Qstatus->bindInt(':language_id', $default_language_id);
                 $Qstatus->execute();
                 while ($Qstatus->next()) {
                     $Qinsert = $lC_Database->query('insert into :table_orders_status (orders_status_id, language_id, orders_status_name) values (:orders_status_id, :language_id, :orders_status_name)');
                     $Qinsert->bindTable(':table_orders_status', TABLE_ORDERS_STATUS);
                     $Qinsert->bindInt(':orders_status_id', $Qstatus->valueInt('orders_status_id'));
                     $Qinsert->bindInt(':language_id', $language_id);
                     $Qinsert->bindValue(':orders_status_name', $Qstatus->value('orders_status_name'));
                     $Qinsert->execute();
                     if ($lC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qstatus = $lC_Database->query('select id, status_name from :table_orders_transactions_status where language_id = :language_id');
                 $Qstatus->bindTable(':table_orders_transactions_status', TABLE_ORDERS_TRANSACTIONS_STATUS);
                 $Qstatus->bindInt(':language_id', $default_language_id);
                 $Qstatus->execute();
                 while ($Qstatus->next()) {
                     $Qinsert = $lC_Database->query('insert into :table_orders_transactions_status (id, language_id, status_name) values (:id, :language_id, :status_name)');
                     $Qinsert->bindTable(':table_orders_transactions_status', TABLE_ORDERS_TRANSACTIONS_STATUS);
                     $Qinsert->bindInt(':id', $Qstatus->valueInt('id'));
                     $Qinsert->bindInt(':language_id', $language_id);
                     $Qinsert->bindValue(':status_name', $Qstatus->value('status_name'));
                     $Qinsert->execute();
                     if ($lC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qstatus = $lC_Database->query('select id, title, css_key from :table_shipping_availability where languages_id = :languages_id');
                 $Qstatus->bindTable(':table_shipping_availability', TABLE_SHIPPING_AVAILABILITY);
                 $Qstatus->bindInt(':languages_id', $default_language_id);
                 $Qstatus->execute();
                 while ($Qstatus->next()) {
                     $Qinsert = $lC_Database->query('insert into :table_shipping_availability (id, languages_id, title, css_key) values (:id, :languages_id, :title, :css_key)');
                     $Qinsert->bindTable(':table_shipping_availability', TABLE_SHIPPING_AVAILABILITY);
                     $Qinsert->bindInt(':id', $Qstatus->valueInt('id'));
                     $Qinsert->bindInt(':languages_id', $language_id);
                     $Qinsert->bindValue(':title', $Qstatus->value('title'));
                     $Qinsert->bindValue(':css_key', $Qstatus->value('css_key'));
                     $Qinsert->execute();
                     if ($lC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qstatus = $lC_Database->query('select weight_class_id, weight_class_key, weight_class_title from :table_weight_classes where language_id = :language_id');
                 $Qstatus->bindTable(':table_weight_classes', TABLE_WEIGHT_CLASS);
                 $Qstatus->bindInt(':language_id', $default_language_id);
                 $Qstatus->execute();
                 while ($Qstatus->next()) {
                     $Qinsert = $lC_Database->query('insert into :table_weight_classes (weight_class_id, weight_class_key, language_id, weight_class_title) values (:weight_class_id, :weight_class_key, :language_id, :weight_class_title)');
                     $Qinsert->bindTable(':table_weight_classes', TABLE_WEIGHT_CLASS);
                     $Qinsert->bindInt(':weight_class_id', $Qstatus->valueInt('weight_class_id'));
                     $Qinsert->bindValue(':weight_class_key', $Qstatus->value('weight_class_key'));
                     $Qinsert->bindInt(':language_id', $language_id);
                     $Qinsert->bindValue(':weight_class_title', $Qstatus->value('weight_class_title'));
                     $Qinsert->execute();
                     if ($lC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qgroup = $lC_Database->query('select id, title, code, size_width, size_height, force_size from :table_products_images_groups where language_id = :language_id');
                 $Qgroup->bindTable(':table_products_images_groups', TABLE_PRODUCTS_IMAGES_GROUPS);
                 $Qgroup->bindInt(':language_id', $default_language_id);
                 $Qgroup->execute();
                 while ($Qgroup->next()) {
                     $Qinsert = $lC_Database->query('insert into :table_products_images_groups (id, language_id, title, code, size_width, size_height, force_size) values (:id, :language_id, :title, :code, :size_width, :size_height, :force_size)');
                     $Qinsert->bindTable(':table_products_images_groups', TABLE_PRODUCTS_IMAGES_GROUPS);
                     $Qinsert->bindInt(':id', $Qgroup->valueInt('id'));
                     $Qinsert->bindInt(':language_id', $language_id);
                     $Qinsert->bindValue(':title', $Qgroup->value('title'));
                     $Qinsert->bindValue(':code', $Qgroup->value('code'));
                     $Qinsert->bindInt(':size_width', $Qgroup->value('size_width'));
                     $Qinsert->bindInt(':size_height', $Qgroup->value('size_height'));
                     $Qinsert->bindInt(':force_size', $Qgroup->value('force_size'));
                     $Qinsert->execute();
                     if ($lC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             // added for permalinks
             if ($error === false) {
                 $Qpermalinks = $lC_Database->query('select * from :table_permalinks where language_id = :language_id');
                 $Qpermalinks->bindTable(':table_permalinks', TABLE_PERMALINKS);
                 $Qpermalinks->bindInt(':language_id', $default_language_id);
                 $Qpermalinks->execute();
                 while ($Qpermalinks->next()) {
                     $Qinsert = $lC_Database->query('insert into :table_permalinks (item_id, language_id, type, query, permalink) values (:item_id, :language_id, :type, :query, :permalink)');
                     $Qinsert->bindTable(':table_permalinks', TABLE_PERMALINKS);
                     $Qinsert->bindInt(':item_id', $Qpermalinks->valueInt('item_id'));
                     $Qinsert->bindInt(':language_id', $language_id);
                     $Qinsert->bindInt(':type', $Qpermalinks->valueInt('type'));
                     $Qinsert->bindValue(':query', $Qpermalinks->value('query'));
                     $Qinsert->bindValue(':permalink', $Qpermalinks->value('permalink'));
                     $Qinsert->execute();
                     if ($lC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
         }
     }
     if ($error === false) {
         $lC_Database->commitTransaction();
         lC_Cache::clear('languages');
         return true;
     } else {
         $lC_Database->rollbackTransaction();
     }
     return false;
 }
Beispiel #24
0
    $enable_ssl = 'true';
    $https_url = parse_url($_POST['HTTPS_WEB_ADDRESS']);
    $https_server = $https_url['scheme'] . '://' . $https_url['host'];
    $https_catalog = $https_url['path'];
    if (isset($https_url['port']) && !empty($https_url['port'])) {
        $https_server .= ':' . $https_url['port'];
    }
    if (substr($https_catalog, -1) != '/') {
        $https_catalog .= '/';
    }
}
$http_work_directory = $_POST['HTTP_WORK_DIRECTORY'];
if (substr($http_work_directory, -1) != '/') {
    $http_work_directory .= '/';
}
$lC_DirectoryListing = new lC_DirectoryListing($http_work_directory . 'cache/');
$lC_DirectoryListing->setIncludeDirectories(false);
$lC_DirectoryListing->setCheckExtension('cache');
foreach ($lC_DirectoryListing->getFiles() as $files) {
    @unlink($lC_DirectoryListing->getDirectory() . '/' . $files['name']);
}
$file_contents = '<?php' . "\n" . '  define(\'HTTP_SERVER\', \'' . $http_server . '\');' . "\n" . '  define(\'HTTPS_SERVER\', \'' . $https_server . '\');' . "\n" . '  define(\'ENABLE_SSL\', ' . $enable_ssl . ');' . "\n" . '  define(\'HTTP_COOKIE_DOMAIN\', \'' . $http_url['host'] . '\');' . "\n" . '  define(\'HTTPS_COOKIE_DOMAIN\', \'' . $https_url['host'] . '\');' . "\n" . '  define(\'HTTP_COOKIE_PATH\', \'' . $http_catalog . '\');' . "\n" . '  define(\'HTTPS_COOKIE_PATH\', \'' . $https_catalog . '\');' . "\n" . '  define(\'DIR_WS_HTTP_CATALOG\', \'' . $http_catalog . '\');' . "\n" . '  define(\'DIR_WS_HTTPS_CATALOG\', \'' . $https_catalog . '\');' . "\n" . '  define(\'DIR_WS_ADMIN\', \'admin/\');' . "\n" . '  define(\'DIR_WS_IMAGES\', \'images/\');' . "\n\n" . '  define(\'DIR_WS_DOWNLOAD_PUBLIC\', \'pub/\');' . "\n" . '  define(\'DIR_FS_CATALOG\', \'' . $dir_fs_document_root . '\');' . "\n" . '  define(\'DIR_FS_ADMIN\', \'' . $dir_fs_document_root . 'admin/\');' . "\n" . '  define(\'DIR_FS_WORK\', \'' . $http_work_directory . '\');' . "\n" . '  define(\'DIR_FS_DOWNLOAD\', DIR_FS_CATALOG . \'download/\');' . "\n" . '  define(\'DIR_FS_DOWNLOAD_PUBLIC\', DIR_FS_CATALOG . \'pub/\');' . "\n" . '  define(\'DIR_FS_BACKUP\', \'' . $dir_fs_document_root . 'admin/backups/\');' . "\n\n" . '  define(\'DB_SERVER\', \'' . $_POST['DB_SERVER'] . '\');' . "\n" . '  define(\'DB_SERVER_USERNAME\', \'' . $_POST['DB_SERVER_USERNAME'] . '\');' . "\n" . '  define(\'DB_SERVER_PASSWORD\', \'' . $_POST['DB_SERVER_PASSWORD'] . '\');' . "\n" . '  define(\'DB_DATABASE\', \'' . $_POST['DB_DATABASE'] . '\');' . "\n" . '  define(\'DB_DATABASE_CLASS\', \'' . $_POST['DB_DATABASE_CLASS'] . '\');' . "\n" . '  define(\'DB_TABLE_PREFIX\', \'' . $_POST['DB_TABLE_PREFIX'] . '\');' . "\n" . '  define(\'USE_PCONNECT\', \'false\');' . "\n" . '  define(\'STORE_SESSIONS\', \'database\');' . "\n" . '?>';
if (file_exists($dir_fs_document_root . 'includes/config.php') && !is_writeable($dir_fs_document_root . 'includes/config.php')) {
    @chmod($dir_fs_document_root . 'includes/config.php', 0777);
} else {
    @touch($dir_fs_document_root . 'includes/config.php');
    @chmod($dir_fs_document_root . 'includes/config.php', 0777);
}
if (file_exists($dir_fs_document_root . 'includes/config.php') && is_writeable($dir_fs_document_root . 'includes/config.php')) {
    $fp = fopen($dir_fs_document_root . 'includes/config.php', 'w');
    fputs($fp, $file_contents);
 /**
  * Get the administrator access modules
  *
  * @access public
  * @return array
  */
 public static function getAccessModules()
 {
     global $lC_Language;
     $lC_DirectoryListing = new lC_DirectoryListing('includes/modules/access');
     $lC_DirectoryListing->setIncludeDirectories(false);
     $modules = array();
     foreach ($lC_DirectoryListing->getFiles() as $file) {
         $module = substr($file['name'], 0, strrpos($file['name'], '.'));
         if (!class_exists('lC_Access_' . ucfirst($module))) {
             $lC_Language->loadIniFile('modules/access/' . $file['name']);
             include $lC_DirectoryListing->getDirectory() . '/' . $file['name'];
         }
         $tmp_module = '';
         if ($module == 'product_variants' || $module == 'product_settings') {
             $tmp_module = $module;
         }
         $module = 'lC_Access_' . ucfirst($module);
         $module = new $module();
         $module_group = lC_Access::getGroupTitle($module->getGroup());
         $module_group = str_replace(" ", "_", $module_group);
         $modules[$module_group][] = array('id' => $tmp_module != '' ? $tmp_module : $module->getModule(), 'text' => $module->getTitle());
     }
     ksort($modules);
     return $modules;
 }
Beispiel #26
0
 }
 if ($lC_Database->isError() === false && $db['DB_INSERT_SAMPLE_DATA'] == 'true') {
     $sql_file = $dir_fs_www_root . '/loadedcommerce_sample_data.sql';
     $lC_Database->importSQL($sql_file, $db['DB_DATABASE'], $db['DB_TABLE_PREFIX']);
 }
 if ($lC_Database->isError() === false) {
     foreach ($lC_Language->extractDefinitions('en_US.xml') as $def) {
         $Qdef = $lC_Database->query('insert into :table_languages_definitions (languages_id, content_group, definition_key, definition_value) values (:languages_id, :content_group, :definition_key, :definition_value)');
         $Qdef->bindTable(':table_languages_definitions', $db['DB_TABLE_PREFIX'] . 'languages_definitions');
         $Qdef->bindInt(':languages_id', 1);
         $Qdef->bindValue(':content_group', $def['group']);
         $Qdef->bindValue(':definition_key', $def['key']);
         $Qdef->bindValue(':definition_value', $def['value']);
         $Qdef->execute();
     }
     $lC_DirectoryListing = new lC_DirectoryListing('../includes/languages/en_US');
     $lC_DirectoryListing->setRecursive(true);
     $lC_DirectoryListing->setIncludeDirectories(false);
     $lC_DirectoryListing->setAddDirectoryToFilename(true);
     $lC_DirectoryListing->setCheckExtension('xml');
     foreach ($lC_DirectoryListing->getFiles() as $files) {
         foreach ($lC_Language->extractDefinitions('en_US/' . $files['name']) as $def) {
             $Qdef = $lC_Database->query('insert into :table_languages_definitions (languages_id, content_group, definition_key, definition_value) values (:languages_id, :content_group, :definition_key, :definition_value)');
             $Qdef->bindTable(':table_languages_definitions', $db['DB_TABLE_PREFIX'] . 'languages_definitions');
             $Qdef->bindInt(':languages_id', 1);
             $Qdef->bindValue(':content_group', $def['group']);
             $Qdef->bindValue(':definition_key', $def['key']);
             $Qdef->bindValue(':definition_value', $def['value']);
             $Qdef->execute();
         }
     }
Beispiel #27
0
 public static function uninstall($key)
 {
     global $lC_Database, $lC_Language, $lC_Vqmod;
     if (file_exists(DIR_FS_CATALOG . 'addons/' . $key . '/controller.php')) {
         include_once DIR_FS_CATALOG . 'addons/' . $key . '/controller.php';
         $addon = new $key();
         $addon->remove();
         $modules_group = $addon->getAddonType() . '|' . $key;
         $lC_DirectoryListing = new lC_DirectoryListing(DIR_FS_CATALOG . 'addons/' . $addon->getAddonCode() . '/modules/' . $addon->getAddonType());
         $lC_DirectoryListing->setCheckExtension('php');
         $code = $addon->getAddonType();
         // check for payment or shipping modules and adjust addon $code to module $code
         if (is_dir(DIR_FS_CATALOG . 'addons/' . $addon->getAddonCode() . '/modules/payment/')) {
             $lC_DirectoryListing = new lC_DirectoryListing(DIR_FS_CATALOG . 'addons/' . $addon->getAddonCode() . '/modules/payment/');
             $lC_DirectoryListing->setCheckExtension('php');
             foreach ($lC_DirectoryListing->getFiles() as $ao) {
                 if (isset($ao['name'])) {
                     $code = substr($ao['name'], 0, strpos($ao['name'], '.'));
                     break;
                 }
             }
         } else {
             if (is_dir(DIR_FS_CATALOG . 'addons/' . $addon->getAddonCode() . '/modules/shipping/')) {
                 $lC_DirectoryListing = new lC_DirectoryListing(DIR_FS_CATALOG . 'addons/' . $addon->getAddonCode() . '/modules/shipping/');
                 $lC_DirectoryListing->setCheckExtension('php');
                 foreach ($lC_DirectoryListing->getFiles() as $ao) {
                     if (isset($ao['name'])) {
                         $code = substr($ao['name'], 0, strpos($ao['name'], '.'));
                         break;
                     }
                 }
             }
         }
         $Qdel = $lC_Database->query('delete from :table_templates_boxes where code = :code and modules_group = :modules_group');
         $Qdel->bindTable(':table_templates_boxes', TABLE_TEMPLATES_BOXES);
         $Qdel->bindValue(':code', $code);
         $Qdel->bindValue(':modules_group', $addon->getAddonType() . '|' . $key);
         $Qdel->execute();
         if ($addon->hasKeys()) {
             $Qdel = $lC_Database->query('delete from :table_configuration where configuration_key in (":configuration_key")');
             $Qdel->bindTable(':table_configuration', TABLE_CONFIGURATION);
             $Qdel->bindRaw(':configuration_key', implode('", "', $addon->getKeys()));
             $Qdel->execute();
         }
         // phsically remove the add-on
         if (isset($key) && empty($key) === false) {
             $_SESSION['deleteAddon'] = $key;
         }
         self::_resetAddons();
         return true;
     }
     return false;
 }
 public static function getData($id)
 {
     global $lC_Database, $lC_Language, $lC_Vqmod;
     $lC_Language->loadIniFile('templates_modules_layout.php');
     $result = array();
     $Qboxes = $lC_Database->query('select id, title from :table_templates_boxes where modules_group = :modules_group order by title');
     $Qboxes->bindTable(':table_templates_boxes', TABLE_TEMPLATES_BOXES);
     $Qboxes->bindValue(':modules_group', $_GET['set']);
     $Qboxes->execute();
     while ($Qboxes->next()) {
         $result['boxes_array'][$Qboxes->valueInt('id')] = $Qboxes->value('title');
     }
     $Qtemplate = $lC_Database->query('select id from :table_templates where code = :code');
     $Qtemplate->bindTable(':table_templates', TABLE_TEMPLATES);
     $Qtemplate->bindValue(':code', $_GET['filter']);
     $Qtemplate->execute();
     $filter_id = $Qtemplate->valueInt('id');
     $pages_array = array(array('id' => $filter_id . '/*', 'text' => '*'));
     $d_boxes = new lC_DirectoryListing('../templates/' . $_GET['filter'] . '/content');
     $d_boxes->setRecursive(true);
     $d_boxes->setAddDirectoryToFilename(true);
     $d_boxes->setCheckExtension('php');
     $d_boxes->setExcludeEntries('.svn');
     foreach ($d_boxes->getFiles(false) as $box) {
         if ($box['is_directory'] === true) {
             $entry = array('id' => $filter_id . '/' . $box['name'] . '/*', 'text' => $box['name'] . '/*');
         } else {
             $page_filename = substr($box['name'], 0, strrpos($box['name'], '.'));
             $entry = array('id' => $filter_id . '/' . $page_filename, 'text' => $page_filename);
         }
         if ($_GET['filter'] != DEFAULT_TEMPLATE && $d_boxes->getSize() > 0) {
             $entry['group'] = '-- ' . $_GET['filter'] . ' --';
         }
         $pages_array[] = $entry;
     }
     if ($_GET['filter'] != DEFAULT_TEMPLATE) {
         $d_boxes = new lC_DirectoryListing('../templates/' . DEFAULT_TEMPLATE . '/content');
         $d_boxes->setRecursive(true);
         $d_boxes->setAddDirectoryToFilename(true);
         $d_boxes->setCheckExtension('php');
         $d_boxes->setExcludeEntries('.svn');
         foreach ($d_boxes->getFiles(false) as $box) {
             if ($box['is_directory'] === true) {
                 $entry = array('id' => $filter_id . '/' . $box['name'] . '/*', 'text' => $box['name'] . '/*');
             } else {
                 $page_filename = substr($box['name'], 0, strrpos($box['name'], '.'));
                 $entry = array('id' => $filter_id . '/' . $page_filename, 'text' => $page_filename);
             }
             $check_entry = $entry;
             $check_entry['group'] = '-- ' . $_GET['filter'] . ' --';
             if (!in_array($check_entry, $pages_array)) {
                 $entry['group'] = '-- ' . DEFAULT_TEMPLATE . ' --';
                 $pages_array[] = $entry;
             }
         }
     }
     $result['pages_array'] = $pages_array;
     require $lC_Vqmod->modCheck('includes/templates/' . $_GET['filter'] . '.php');
     $class = 'lC_Template_' . $_GET['filter'];
     $filter_template = new $class();
     $groups_array = array();
     foreach ($filter_template->getGroups($_GET['set']) as $group) {
         $groups_array[] = array('id' => $group, 'text' => $group);
     }
     $Qgroups = $lC_Database->query('select distinct b2p.boxes_group from :table_templates_boxes_to_pages b2p, :table_templates_boxes b where b2p.templates_id = :templates_id and b2p.templates_boxes_id = b.id and b.modules_group = :modules_group and b2p.boxes_group not in (:boxes_group) order by b2p.boxes_group');
     $Qgroups->bindTable(':table_templates_boxes_to_pages', TABLE_TEMPLATES_BOXES_TO_PAGES);
     $Qgroups->bindTable(':table_templates_boxes', TABLE_TEMPLATES_BOXES);
     $Qgroups->bindInt(':templates_id', $filter_id);
     $Qgroups->bindValue(':modules_group', $_GET['set']);
     $Qgroups->bindRaw(':boxes_group', '"' . implode('", "', $filter_template->getGroups($_GET['set'])) . '"');
     $Qgroups->execute();
     while ($Qgroups->next()) {
         if ($Qgroups->value('boxes_group') == null) {
             continue;
         }
         $groups_array[] = array('id' => $Qgroups->value('boxes_group'), 'text' => $Qgroups->value('boxes_group'));
     }
     if (!empty($groups_array)) {
         array_unshift($groups_array, array('id' => null, 'text' => $lC_Language->get('please_select')));
         $result['groups_dropdown'] = lc_draw_pull_down_menu('group', $groups_array, null, 'class="input with-small-padding"') . '&nbsp;&nbsp;';
     }
     if ($id != null) {
         $Qlayout = $lC_Database->query('select b2p.*, b.id as box_id, b.title as box_title, b.code as box_code from :table_templates_boxes_to_pages b2p, :table_templates_boxes b where b2p.id = :id and b2p.templates_boxes_id = b.id');
         $Qlayout->bindTable(':table_templates_boxes_to_pages', TABLE_TEMPLATES_BOXES_TO_PAGES);
         $Qlayout->bindTable(':table_templates_boxes', TABLE_TEMPLATES_BOXES);
         $Qlayout->bindInt(':id', $id);
         $Qlayout->execute();
         $result['modules_selected'] = $Qlayout->value('box_id');
         $result['pages_selected'] = $Qlayout->valueInt('templates_id') . '/' . $Qlayout->value('content_page');
         $result['page_specific'] = $Qlayout->valueInt('page_specific') === 1 ? true : false;
         $result['group_selected'] = $Qlayout->value('boxes_group');
         $result['sort_order'] = $Qlayout->valueInt('sort_order');
         $Qlayout->freeResult;
     }
     return $result;
 }