本文整理汇总了PHP中SJB_System::getIfTrialModeIsOn方法的典型用法代码示例。如果您正苦于以下问题:PHP SJB_System::getIfTrialModeIsOn方法的具体用法?PHP SJB_System::getIfTrialModeIsOn怎么用?PHP SJB_System::getIfTrialModeIsOn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SJB_System
的用法示例。
在下文中一共展示了SJB_System::getIfTrialModeIsOn方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: archive
public static function archive($name = false, $listFilesAndFolders, $export_files_dir, $export_files_dir_name, $backupName, $move = false, $identifier, $type)
{
if (empty($export_files_dir)) {
return;
}
$dir_separator = DIRECTORY_SEPARATOR;
$backupName = 'backup' . $dir_separator . $backupName;
$installFilePath = 'system' . $dir_separator . 'admin-scripts' . $dir_separator . 'miscellaneous' . $dir_separator;
$dbSQLFilePath = 'backup' . $dir_separator;
$old_path = getcwd();
chdir($export_files_dir);
$tar = new Archive_Tar($backupName, 'gz');
if (SJB_System::getIfTrialModeIsOn()) {
$tar->setIgnoreList(array('system/plugins/mobile', 'system/plugins/facebook_app', 'templates/mobile', 'templates/Facebook'));
}
SessionStorage::write('backup_' . $identifier, serialize(array('last_time' => time())));
switch ($type) {
case 'full':
$tar->addModify("{$installFilePath}install.php", '', $installFilePath);
$tar->addModify($dbSQLFilePath . $name, '', $dbSQLFilePath);
$tar->addModify($listFilesAndFolders, '');
SJB_Filesystem::delete($export_files_dir . $dbSQLFilePath . $name);
break;
case 'files':
$tar->addModify("{$installFilePath}install.php", '', $installFilePath);
$tar->addModify($listFilesAndFolders, '');
break;
case 'database':
$tar->addModify($dbSQLFilePath . $listFilesAndFolders, '', $dbSQLFilePath);
SJB_Filesystem::delete($export_files_dir . $dbSQLFilePath . $listFilesAndFolders);
break;
}
chdir($old_path);
return true;
}
示例2: doBackup
public function doBackup()
{
$settings = SJB_Settings::getSettings();
if ($settings['autobackup'] && !SJB_System::getSystemSettings('isDemo') && !SJB_System::getIfTrialModeIsOn()) {
$dirSeparator = DIRECTORY_SEPARATOR;
$scriptPath = explode(SJB_System::getSystemSettings('SYSTEM_URL_BASE'), __FILE__);
$scriptPath = array_shift($scriptPath);
$path = $scriptPath . 'backup' . $dirSeparator;
$identifier = time();
$backupsArr = $this->getAllBackups($path);
$this->deleteBackupAfterExpired($backupsArr);
if ($this->isAutobackup()) {
SessionStorage::destroy('backup_' . $identifier);
SessionStorage::write('backup_' . $identifier, serialize(array('last_time' => time())));
SJB_Session::unsetValue('restore');
SJB_Session::unsetValue('error');
$backupDir = $scriptPath . 'backup' . $dirSeparator;
if (!is_dir($backupDir)) {
mkdir($backupDir);
}
if (!file_exists($backupDir . '.htaccess')) {
$handle = fopen($backupDir . '.htaccess', 'a');
$text = '# Apache 2.4
<IfModule mod_authz_core.c>
<FilesMatch ".*">
Require all denied
</FilesMatch>
</IfModule>
# Apache 2.2
<IfModule !mod_authz_core.c>
<FilesMatch ".*">
Order Allow,Deny
Deny from all
</FilesMatch>
</IfModule>';
fwrite($handle, $text);
fclose($handle);
}
$backupType = SJB_System::getSettingByName('backup_type');
switch ($backupType) {
case 'full':
$this->makeFullBackup($identifier, $scriptPath, $dirSeparator);
break;
case 'database':
$this->makeDatabaseBackup($identifier, $dirSeparator, $scriptPath);
break;
case 'files':
$this->makeFilesBackup($identifier, $scriptPath, $dirSeparator);
break;
}
SJB_Settings::updateSetting('last_autobackup', date("Y-m-d H:i:s"));
}
}
}
示例3: execute
public function execute()
{
$tp = SJB_System::getTemplateProcessor();
$module_name = SJB_Request::getVar('module_name', "", 'GET');
$template_name = SJB_Request::getVar('template_name', "", 'GET');
// не работало с юзерской
if (empty($template_name)) {
$template_name = SJB_Request::getVar('template_name', '');
}
if (empty($module_name)) {
$module_name = SJB_Request::getVar('module_name', '');
}
$theme = SJB_Settings::getValue('TEMPLATE_USER_THEME', 'default');
$template_editor = new SJB_TemplateEditor();
$simple_view = SJB_Request::getVar('simple_view');
if (!$template_editor->doesModuleExists($module_name)) {
$tp->assign('ERROR', "MODULE_DOES_NOT_EXIST");
} else {
if (!$template_editor->doesModuleTemplateExists($module_name, $template_name)) {
$tp->assign('ERROR', "TEMPLATE_DOES_NOT_EXIST");
} else {
if (isset($_REQUEST['action'])) {
$content = SJB_Request::getVar('template_content');
if ($content) {
if (SJB_System::getSystemSettings("isDemo")) {
$tp->assign('ERROR', 'NOT_ALLOWED_IN_DEMO');
} elseif (SJB_System::getIfTrialModeIsOn() && SJB_HelperFunctions::findSmartyRestrictedTagsInContent($tp, $content)) {
$tp->assign('ERROR', 'Php tags are not allowed');
} else {
$result = $template_editor->saveTemplate($template_name, $module_name, $theme, $content);
// if ajax request to save
if ($simple_view) {
if ($result) {
echo '<p class="message">Template saved successfully. </p>';
} else {
echo "ERROR WHILE SAVE TEMPLATE";
}
exit;
}
if ($_REQUEST['action'] == "save_template") {
SJB_HelperFunctions::redirect("?module_name=" . $module_name);
}
}
}
}
echo SJB_System::executeFunction('template_manager', 'add_template');
$modules = $template_editor->getModuleWithTemplatesList();
$tp->assign('module_name', $module_name);
$tp->assign('template_name', $template_name);
$tp->assign('theme', $theme);
$tp->assign('display_name', $modules[$module_name]['display_name']);
$tp->assign('template_display_name', $template_name);
$path_to_template = SJB_TemplatePathManager::getAbsoluteTemplatePath($theme, $module_name, $template_name);
if (!file_exists($path_to_template)) {
$theme = SJB_System::getSystemSettings('SYSTEM_TEMPLATE_DIR');
}
if (false === ($template_content = $template_editor->loadTemplate($template_name, $module_name, $theme))) {
$tp->assign('ERROR', "CANNOT_FETCH_TEMPLATE");
} else {
if (!$template_editor->isTemplateWriteable($module_name, $theme, $template_name) && !SJB_System::getSystemSettings("isDemo")) {
$tp->assign('ERROR', "TEMPLATE_IS_NOT_WRITEABLE");
} else {
$tp->assign('template_content', $template_content);
}
}
$list_modules = SJB_System::getModulesUserList();
$list_functions = array();
$list_params = array();
foreach ($list_modules as $module) {
$functions = SJB_System::getFunctionsUserList($module);
foreach ($functions as $keyF => $func) {
$list_functions[$module][$keyF] = $func;
$params = SJB_System::getParamsList($module, $func);
if (isset($params[0])) {
foreach ($params as $keyP => $param) {
$list_params[$module][$func][$keyP] = $param;
}
}
}
}
$tp->assign('LIST_MODULES', $list_modules);
$tp->assign('LIST_FUNCTIONS', $list_functions);
$tp->assign('LIST_PARAMS', $list_params);
}
}
if ($simple_view) {
$tp->display('edit_template_simple.tpl');
} else {
header('X-XSS-Protection: 0');
$tp->display('edit_template.tpl');
}
}
示例4: execute
public function execute()
{
ini_set('max_execution_time', 0);
$errors = array();
$tp = SJB_System::getTemplateProcessor();
$action = SJB_Request::getVar('action', false);
$dir_separator = DIRECTORY_SEPARATOR;
$script_path = explode(SJB_System::getSystemSettings('SYSTEM_URL_BASE'), __FILE__);
$script_path = array_shift($script_path);
$identifier = SJB_Request::getVar('identifier', time());
$filename = SJB_Request::getVar('filename', false);
$settings = array();
if ($filename) {
SJB_Backup::sendArchiveFile($filename, $script_path . 'backup' . $dir_separator . $filename);
}
if (SJB_Request::getVar('action') == "save") {
$expPeriod = SJB_Request::getVar('backup_expired_period');
if (!empty($expPeriod) && (!is_numeric($expPeriod) || $expPeriod < 0)) {
$errors[] = 'EXP_PERIOD_NOT_VALID';
}
$ftpValid = $this->isFTPDataValid();
if (SJB_Request::getVar('autobackup', false) && SJB_Request::getVar('ftp_backup', false) && !$ftpValid) {
$errors[] = 'FTP_DETAILS_NOT_VALID';
}
if (empty($errors)) {
$backupSettings = $_REQUEST;
foreach ($backupSettings as $setting => $value) {
if (!SJB_Settings::saveSetting($setting, $value)) {
$errors['SETTINGS_SAVED_WITH_PROBLEMS'] = "SETTINGS_SAVED_WITH_PROBLEMS";
}
}
if (empty($errors)) {
$tp->assign('successSaveMessage', true);
}
} else {
$settings = $_REQUEST;
}
}
switch ($action) {
case 'backup':
if (SJB_System::getSystemSettings('isDemo')) {
$i18N = SJB_I18N::getInstance();
$str = $i18N->gettext('Backend', 'Error: You don\'t have permissions for it. This is a Demo version of the software.');
SJB_Session::setValue('error', $str);
break;
}
if (SJB_System::getIfTrialModeIsOn() && $_SERVER['REMOTE_ADDR'] != "91.205.51.231") {
$i18N = SJB_I18N::getInstance();
$str = $i18N->gettext('Backend', 'Error: You don\'t have permissions for it. This is a Trial version of the software.');
SJB_Session::setValue('error', $str);
break;
}
SessionStorage::destroy('backup_' . $identifier);
SessionStorage::write('backup_' . $identifier, serialize(array('last_time' => time())));
SJB_Session::unsetValue('restore');
SJB_Session::unsetValue('error');
$backup_type = SJB_Request::getVar('backup_type');
$backupDir = $script_path . 'backup' . $dir_separator;
try {
$this->prepareBackupDir($backupDir);
} catch (Exception $e) {
SJB_Session::setValue('error', $e->getMessage());
exit;
}
switch ($backup_type) {
case 'full':
SessionStorage::write('backup_' . $identifier, serialize(array('last_time' => time())));
$backupDir = $script_path;
$name = 'db.sql';
SJB_Backup::dump($name, $script_path, $identifier);
$d = dir($script_path);
$contentDir = array();
$folders = array('.', '..', 'backup', '.svn', '.settings', '.cache', 'restore', $name);
while (false !== ($entry = $d->read())) {
if (!in_array($entry, $folders)) {
$contentDir[] = $entry;
}
}
$listFilesAndFolders = !empty($contentDir) ? $contentDir : false;
$backupName = 'full_backup_' . date('Y_m_d__H_i') . '.tar.gz';
$export_files_dir_name = '..' . $dir_separator;
if (SJB_Backup::archive($name, $listFilesAndFolders, $backupDir, $export_files_dir_name, $backupName, true, $identifier, 'full')) {
SessionStorage::write('backup_' . $identifier, serialize(array('name' => $backupName)));
}
exit;
break;
case 'database':
SessionStorage::write('backup_' . $identifier, serialize(array('last_time' => time())));
$name = 'db.sql';
$backupName = 'mysqldump_' . date('Y_m_d__H_i') . '.tar.gz';
$export_files_dir_name = '../backup' . $dir_separator;
SJB_Backup::dump($name, $script_path, $identifier);
if (SJB_Backup::archive(false, $name, $script_path, $export_files_dir_name, $backupName, false, $identifier, 'database')) {
SessionStorage::write('backup_' . $identifier, serialize(array('name' => $backupName)));
}
exit;
break;
case 'files':
SessionStorage::write('backup_' . $identifier, serialize(array('last_time' => time())));
$backupDir = $script_path;
//.........这里部分代码省略.........
示例5: execute
public function execute()
{
$tp = SJB_System::getTemplateProcessor();
$errors = '';
if (!isset($_REQUEST['name'])) {
$_REQUEST['name'] = '';
}
if (!isset($_REQUEST['lang'])) {
$_REQUEST['lang'] = '';
}
$action = SJB_Request::getVar('action', '');
$form_submitted = SJB_Request::getVar('formSubmitted');
if ($action == 'add') {
if (($error = SJB_StaticContentAuxil::isValidNameID($_REQUEST['name'], $_REQUEST['page_id'])) == '') {
if (!SJB_StaticContent::getStaticContentByIdAndLang($_REQUEST['page_id'], $_REQUEST['lang'])) {
$contentInfo = array('id' => $_REQUEST['page_id'], 'name' => $_REQUEST['name'], 'lang' => $_REQUEST['lang']);
if (SJB_StaticContent::addStaticContent($contentInfo)) {
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings("SITE_URL") . '/stat-pages/');
} else {
$errors = SJB_StaticContentAuxil::warning('Error', 'Cannot add new static page');
}
} else {
$errors = SJB_StaticContentAuxil::warning('Error', 'Dublicate pare ID and Language. Please specify another ID or/and Language');
}
} else {
$errors = SJB_StaticContentAuxil::warning('Error', $error);
}
}
if ($action == 'change') {
$staticContent = SJB_StaticContent::getStaticContentByIDAndLang($_REQUEST['page_id'], $_REQUEST['lang']);
if (!$staticContent || $staticContent['sid'] == $_REQUEST['page_sid']) {
$content = SJB_Request::getVar('content');
if ((SJB_System::getSystemSettings('isDemo') || SJB_System::getIfTrialModeIsOn()) && SJB_HelperFunctions::findSmartyRestrictedTagsInContent($tp, $content)) {
$errors = SJB_StaticContentAuxil::warning('Error', 'Php tags are not allowed');
} else {
$contentInfo = array('id' => $_REQUEST['page_id'], 'name' => $_REQUEST['name'], 'content' => $content, 'lang' => $_REQUEST['lang']);
if (SJB_StaticContent::changeStaticContent($contentInfo, $_REQUEST['page_sid'])) {
if ($form_submitted == 'save_content') {
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings("SITE_URL") . '/stat-pages/');
}
} else {
$errors = SJB_StaticContentAuxil::warning('Error', 'Cannot update page');
}
}
} else {
$errors = SJB_StaticContentAuxil::warning('Error', 'Dublicate pare ID and Language. Please specify another ID or/and Language');
}
$action = 'edit';
}
if ($action == 'delete') {
if (SJB_StaticContent::deleteStaticContent($_REQUEST['page_sid'])) {
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings("SITE_URL") . '/stat-pages/');
}
$errors = SJB_StaticContentAuxil::warning('Error', 'Cannot delete static page');
}
$tp->assign('languages', SJB_I18N::getInstance()->getActiveFrontendLanguagesData());
if ($action == 'edit') {
$page = SJB_StaticContent::getStaticContent($_REQUEST['page_sid']);
$tp->assign('page', array_map('htmlspecialchars', $page));
$pageInfo = array('module' => 'static_content', 'function' => 'show_static_content', 'parameters' => array('pageid' => SJB_Request::getVar('pageid', '')));
$tp->assign('pageInfo', $pageInfo);
$tp->assign('page_content', $page['content']);
$tp->assign('page_sid', $_REQUEST['page_sid']);
$tp->assign('page', $page);
$tp->assign('error', $errors);
$tp->display('static_content_change.tpl');
return;
}
$tp->assign('pages', SJB_StaticContent::getStaticContents());
$tp->assign('error', $errors);
$tp->display('static_content.tpl');
}
示例6: editEmailTemplate
protected function editEmailTemplate($sid, &$errors = array())
{
$tplInfo = SJB_EmailTemplateEditor::getEmailTemplateInfoBySID($sid);
if ($tplInfo) {
$tplInfo = array_merge($tplInfo, $_REQUEST);
$emailTemplate = new SJB_EmailTemplate($tplInfo);
$emailTemplate->setSID($sid);
$emailTemplate_edit_form = new SJB_Form($emailTemplate);
$form_is_submitted = SJB_Request::getVar('action');
// php tags are not allowed in trial mode
if (SJB_System::getIfTrialModeIsOn() || SJB_System::getSystemSettings('isDemo')) {
if (SJB_HelperFunctions::findSmartyRestrictedTagsInContent($this->tp, $emailTemplate->getPropertyValue('text'))) {
$errors['Text'] = 'Php tags are not allowed';
}
}
if ($form_is_submitted && $emailTemplate_edit_form->isDataValid($errors)) {
SJB_EmailTemplateEditor::saveEmailTemplate($emailTemplate);
if ($form_is_submitted == 'save_info') {
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/edit-email-templates/' . $emailTemplate->getPropertyValue('group'));
}
$this->successMessage = 'You have successfully saved your changes';
}
$emailTemplate_edit_form->registerTags($this->tp);
// prepare email templates variables info
$this->prepareTemplateVarsInfo(SJB_Array::get($tplInfo, 'group'), SJB_Array::get($tplInfo, 'name'));
$this->tp->assign('form_fields', $emailTemplate_edit_form->getFormFieldsInfo());
$this->tp->assign('tplInfo', $tplInfo);
$this->template = 'edit_email_template.tpl';
} else {
$this->error = 'INVALID_EMAIL_TEMPLATE_SID_WAS_SPECIFIED';
}
}