Example #1
0
 public function execute()
 {
     $ou = SJB_UserManager::getOnlineUsers();
     $onlineUsers = array();
     $totalOnlineUsers = 0;
     $userGroups = SJB_UserGroupManager::createTemplateStructureForUserGroups();
     foreach ($userGroups as $userGroup) {
         $onlineUsers[$userGroup["id"]]["count"] = 0;
         $onlineUsers[$userGroup["id"]]["caption"] = $userGroup["caption"];
     }
     foreach ($ou as $value) {
         $onlineUsers[$value["type"]]["count"]++;
         $totalOnlineUsers++;
     }
     $theme = SJB_Settings::getValue('TEMPLATE_USER_THEME', 'default');
     $themePath = SJB_TemplatePathManager::getAbsoluteThemePath($theme);
     // FLAGGED LISTINGS
     $allListingTypes = SJB_ListingTypeManager::getAllListingTypesInfo();
     $totalFlagsNum = array();
     foreach ($allListingTypes as $type) {
         $totalFlagsNum[$type['id']] = SJB_ListingManager::getFlagsNumberByListingTypeSID($type['sid'], $filter = null, $groupByListingSID = true);
     }
     $files = $this->getCssFiles($themePath);
     $tp = SJB_System::getTemplateProcessor();
     $tp->assign('totalFlagsNum', $totalFlagsNum);
     $tp->assign('usersInfo', SJB_UserManager::getUsersInfo());
     $tp->assign('groupsInfo', SJB_UserManager::getGroupsInfo());
     $tp->assign('listingsInfo', SJB_ListingManager::getListingsInfo());
     $tp->assign('listingTypesInfo', SJB_ListingTypeManager::getAllListingTypesInfo());
     $tp->assign('invoicesInfo', SJB_InvoiceManager::getInvoicesInfo());
     $tp->assign('unpaidInvoices', SJB_InvoiceManager::getTotalUnpaidInvoices());
     $tp->assign('totalInvoices', SJB_InvoiceManager::getTotalInvoices());
     $i18n = SJB_I18N::getInstance();
     $lang = $i18n->getLanguageData($i18n->getCurrentLanguage());
     $tp->assign("today", strftime($lang['date_format'], time()));
     // ранее были данные за период: месяц (последние 30 дней), неделя (последние 7 дней)
     // теперь - текущий месяц и текущая неделя
     $currMonth = strftime($lang['date_format'], mktime(0, 0, 0, date("m"), 1, date("Y")));
     $currWeek = strftime($lang['date_format'], mktime(0, 0, 0, date("m"), date("d") - date("N") + 1, date("Y")));
     $tp->assign("weekAgo", $currWeek);
     $tp->assign("monthAgo", $currMonth);
     $tp->assign('onlineUsers', $onlineUsers);
     $tp->assign('totalOnlineUsers', $totalOnlineUsers);
     if (count($files) > 0) {
         $tp->assign("file", $files[0]);
     }
     $tp->display("index.tpl");
 }
Example #2
0
 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $theme = SJB_Settings::getValue('TEMPLATE_USER_THEME', 'default');
     $themePath = SJB_TemplatePathManager::getAbsoluteThemePath($theme);
     $files = $this->getCssFiles($themePath);
     $tp->assign("action", SJB_Request::getVar("action"));
     switch (SJB_Request::getVar("action")) {
         case "save":
             if (SJB_System::getSystemSettings("isDemo")) {
                 $tp->assign('ERROR', "NOT_ALLOWED_IN_DEMO");
             } else {
                 $fp = fopen($_REQUEST["file"], "w");
                 fwrite($fp, $_REQUEST["file_content"]);
                 fclose($fp);
             }
         case "edit":
             $tp->assign("file_content", file_get_contents($_REQUEST["file"]));
             $tp->assign("cssFile", $_REQUEST["file"]);
             break;
     }
     $tp->assign("files", $files);
     $tp->display("edit_css.tpl");
 }
Example #3
0
 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $theme = SJB_Settings::getValue('TEMPLATE_USER_THEME', 'default');
     $tp->assign('theme', $theme);
     $errors = array();
     $message = '';
     $alternativeText = SJB_Request::getVar('logoAlternativeText', '');
     switch (SJB_Request::getVar('action', '')) {
         case 'save':
             if (isset($_FILES['logo']['error'])) {
                 if ($_FILES['logo']['error'] == UPLOAD_ERR_OK) {
                     if (SJB_System::getSystemSettings('isDemo')) {
                         $errors[] = 'NOT_ALLOWED_IN_DEMO';
                     } else {
                         $themePath = SJB_TemplatePathManager::getAbsoluteThemePath($theme);
                         if (move_uploaded_file($_FILES['logo']['tmp_name'], "{$themePath}main/images/logo.png")) {
                             $message = 'Logo has been uploaded successfully';
                         }
                     }
                 } else {
                     switch ($_FILES['logo']['error']) {
                         case UPLOAD_ERR_INI_SIZE:
                             $errors[] = 'File size exceeds system limit. Please check the file size limits on your hosting or upload another file.';
                             break;
                         case UPLOAD_ERR_FORM_SIZE:
                             $errors[] = 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form';
                             break;
                         case UPLOAD_ERR_PARTIAL:
                             $errors[] = 'The uploaded file was only partially uploaded';
                             break;
                         case UPLOAD_ERR_NO_FILE:
                             // Разрешим изменять текст без аплоада лого
                             break;
                         case UPLOAD_ERR_NO_TMP_DIR:
                             $errors[] = 'Missing a temporary folder';
                             break;
                         case UPLOAD_ERR_CANT_WRITE:
                             $errors[] = 'Failed to write file to disk';
                             break;
                         default:
                             $errors[] = 'File upload error';
                     }
                     if ($alternativeText == SJB_Settings::getSettingByName('logoAlternativeText')) {
                         $errors[] = 'Upload a logo or enter alternative text';
                     }
                 }
             }
             if (SJB_Settings::getSettingByName('logoAlternativeText') === false) {
                 SJB_Settings::addSetting('logoAlternativeText', $alternativeText);
             } else {
                 if ($alternativeText != SJB_Settings::getSettingByName('logoAlternativeText')) {
                     SJB_Settings::updateSetting('logoAlternativeText', $alternativeText);
                     if (!$message) {
                         $message = 'Alternative text has been updated successfully';
                     } else {
                         $message = 'Logo and Alternative text has been uploaded successfully';
                     }
                 }
             }
             break;
     }
     $tp->assign('errors', $errors);
     $tp->assign('message', $message);
     $tp->assign('uploadMaxFilesize', SJB_UploadFileManager::getIniUploadMaxFilesize());
     $tp->assign('logoAlternativeText', SJB_Request::getVar('logoAlternativeText', SJB_Settings::getSettingByName('logoAlternativeText')));
     $tp->display('upload_logo.tpl');
 }
Example #4
0
 function copyEntireTheme($copiedThemeName, $newThemeName)
 {
     $newThemePath = SJB_TemplatePathManager::getAbsoluteThemePath($copiedThemeName);
     $copiedThemePath = SJB_TemplatePathManager::getAbsoluteThemePath($newThemeName);
     SJB_Filesystem::copy($newThemePath, $copiedThemePath);
     SJB_Filesystem::mkpath(SJB_TemplatePathManager::getAbsoluteThemeCachePath($newThemeName));
     $themeFields = SJB_FormBuilderManager::getFieldsByTheme($copiedThemeName);
     foreach ($themeFields as $themeField) {
         SJB_FormBuilderManager::insertField($newThemeName, $themeField);
     }
     $screenFile = $copiedThemePath . "main/images/{$copiedThemeName}.png";
     $newScreenFile = $copiedThemePath . "main/images/{$newThemeName}.png";
     if (file_exists($screenFile)) {
         rename($screenFile, $newScreenFile);
     }
     $listingTypes = SJB_ListingTypeDBManager::getAllListingTypesInfo();
     foreach ($listingTypes as $listingType) {
         SJB_Settings::addSetting("display_layout_{$listingType['id']}_{$newThemeName}", SJB_Settings::getSettingByName("display_layout_{$listingType['id']}_{$copiedThemeName}"));
     }
 }