示例#1
0
 /**
  * @param	Settings	$settings
  * @return	array
  */
 public function UpdateSettingsByDomain(&$settings)
 {
     $host = GetCurrentHost();
     if (isset($this->_main[$host]) && is_array($this->_main[$host])) {
         foreach ($this->_main[$host] as $key => $value) {
             if (isset($settings->{$key})) {
                 $settings->{$key} = $value;
             }
         }
     }
 }
示例#2
0
$option_zbusers = null;
if (is_readable($filename = $usersdir . 'c_option.php')) {
    $option_zbusers = (require $filename);
    if (is_array($option_zbusers)) {
        foreach ($option_zbusers as $key => $value) {
            $option[$key] = $value;
        }
    }
}
$blogtitle = $option['ZC_BLOG_SUBNAME'];
$blogname =& $option['ZC_BLOG_NAME'];
$blogsubname =& $option['ZC_BLOG_SUBNAME'];
$blogtheme =& $option['ZC_BLOG_THEME'];
$blogstyle =& $option['ZC_BLOG_CSS'];
$cookiespath = null;
$bloghost = GetCurrentHost($blogpath, $cookiespath);
/**
 *定义命令
 */
$actions = array('login' => 6, 'logout' => 6, 'verify' => 6, 'admin' => 5, 'search' => 6, 'misc' => 6, 'feed' => 6, 'cmt' => 6, 'getcmt' => 6, 'ajax' => 6, 'ArticleEdt' => 4, 'ArticlePst' => 4, 'ArticleDel' => 4, 'ArticlePub' => 3, 'PageEdt' => 2, 'PagePst' => 2, 'PageDel' => 2, 'CategoryEdt' => 2, 'CategoryPst' => 2, 'CategoryDel' => 2, 'CommentEdt' => 5, 'CommentSav' => 5, 'CommentDel' => 5, 'CommentChk' => 5, 'CommentBat' => 5, 'MemberEdt' => 5, 'MemberPst' => 5, 'MemberDel' => 1, 'MemberNew' => 1, 'TagEdt' => 2, 'TagPst' => 2, 'TagDel' => 2, 'TagNew' => 2, 'PluginEnb' => 1, 'PluginDis' => 1, 'UploadPst' => 3, 'UploadDel' => 3, 'ModuleEdt' => 3, 'ModulePst' => 3, 'ModuleDel' => 3, 'ThemeSet' => 1, 'SidebarSet' => 1, 'SettingSav' => 1, 'ArticleMng' => 4, 'PageMng' => 2, 'CategoryMng' => 2, 'SettingMng' => 1, 'TagMng' => 2, 'CommentMng' => 5, 'UploadMng' => 3, 'MemberMng' => 5, 'ThemeMng' => 1, 'PluginMng' => 1, 'ModuleMng' => 1, 'ArticleAll' => 2, 'PageAll' => 2, 'CategoryAll' => 2, 'CommentAll' => 2, 'MemberAll' => 1, 'TagAll' => 2, 'UploadAll' => 2, 'root' => 1);
/**
 *定义数据表
 */
$table = array('Post' => '%pre%post', 'Category' => '%pre%category', 'Comment' => '%pre%comment', 'Tag' => '%pre%tag', 'Upload' => '%pre%upload', 'Counter' => '%pre%counter', 'Module' => '%pre%module', 'Member' => '%pre%member', 'Config' => '%pre%config');
/**
 *定义数据结构
 */
$datainfo = array('Config' => array('ID' => array('conf_ID', 'integer', '', 0), 'Name' => array('conf_Name', 'string', 50, ''), 'Value' => array('conf_Value', 'string', '', '')), 'Post' => array('ID' => array('log_ID', 'integer', '', 0), 'CateID' => array('log_CateID', 'integer', '', 0), 'AuthorID' => array('log_AuthorID', 'integer', '', 0), 'Tag' => array('log_Tag', 'string', 250, ''), 'Status' => array('log_Status', 'integer', '', 0), 'Type' => array('log_Type', 'integer', '', 0), 'Alias' => array('log_Alias', 'string', 250, ''), 'IsTop' => array('log_IsTop', 'boolean', '', false), 'IsLock' => array('log_IsLock', 'boolean', '', false), 'Title' => array('log_Title', 'string', 250, ''), 'Intro' => array('log_Intro', 'string', '', ''), 'Content' => array('log_Content', 'string', '', ''), 'PostTime' => array('log_PostTime', 'integer', '', 0), 'CommNums' => array('log_CommNums', 'integer', '', 0), 'ViewNums' => array('log_ViewNums', 'integer', '', 0), 'Template' => array('log_Template', 'string', 50, ''), 'Meta' => array('log_Meta', 'string', '', '')), 'Category' => array('ID' => array('cate_ID', 'integer', '', 0), 'Name' => array('cate_Name', 'string', 50, ''), 'Order' => array('cate_Order', 'integer', '', 0), 'Count' => array('cate_Count', 'integer', '', 0), 'Alias' => array('cate_Alias', 'string', 50, ''), 'Intro' => array('cate_Intro', 'string', '', ''), 'RootID' => array('cate_RootID', 'integer', '', 0), 'ParentID' => array('cate_ParentID', 'integer', '', 0), 'Template' => array('cate_Template', 'string', 50, ''), 'LogTemplate' => array('cate_LogTemplate', 'string', 50, ''), 'Meta' => array('cate_Meta', 'string', '', '')), 'Comment' => array('ID' => array('comm_ID', 'integer', '', 0), 'LogID' => array('comm_LogID', 'integer', '', 0), 'IsChecking' => array('comm_IsChecking', 'boolean', '', false), 'RootID' => array('comm_RootID', 'integer', '', 0), 'ParentID' => array('comm_ParentID', 'integer', '', 0), 'AuthorID' => array('comm_AuthorID', 'integer', '', 0), 'Name' => array('comm_Name', 'string', 20, ''), 'Content' => array('comm_Content', 'string', '', ''), 'Email' => array('comm_Email', 'string', 50, ''), 'HomePage' => array('comm_HomePage', 'string', 250, ''), 'PostTime' => array('comm_PostTime', 'integer', '', 0), 'IP' => array('comm_IP', 'string', 15, ''), 'Agent' => array('comm_Agent', 'string', '', ''), 'Meta' => array('comm_Meta', 'string', '', '')), 'Counter' => array('ID' => array('coun_ID', 'integer', '', 0), 'MemID' => array('coun_MemID', 'integer', '', 0), 'IP' => array('coun_IP', 'string', 15, ''), 'Agent' => array('coun_Agent', 'string', '', ''), 'Refer' => array('coun_Refer', 'string', 250, ''), 'Title' => array('coun_Title', 'string', 250, ''), 'PostTime' => array('coun_PostTime', 'integer', '', 0), 'Description' => array('coun_Description', 'string', '', ''), 'PostData' => array('coun_PostData', 'string', '', ''), 'AllRequestHeader' => array('coun_AllRequestHeader', 'string', '', '')), 'Module' => array('ID' => array('mod_ID', 'integer', '', 0), 'Name' => array('mod_Name', 'string', 100, ''), 'FileName' => array('mod_FileName', 'string', 50, ''), 'Content' => array('mod_Content', 'string', '', ''), 'HtmlID' => array('mod_HtmlID', 'string', 50, ''), 'Type' => array('mod_Type', 'string', 5, 'div'), 'MaxLi' => array('mod_MaxLi', 'integer', '', 0), 'Source' => array('mod_Source', 'string', 50, 'user'), 'IsHideTitle' => array('mod_IsHideTitle', 'boolean', '', false), 'Meta' => array('mod_Meta', 'string', '', '')), 'Member' => array('ID' => array('mem_ID', 'integer', '', 0), 'Guid' => array('mem_Guid', 'string', 36, ''), 'Level' => array('mem_Level', 'integer', '', 6), 'Status' => array('mem_Status', 'integer', '', 0), 'Name' => array('mem_Name', 'string', 50, ''), 'Password' => array('mem_Password', 'string', 32, ''), 'Email' => array('mem_Email', 'string', 50, ''), 'HomePage' => array('mem_HomePage', 'string', 250, ''), 'IP' => array('mem_IP', 'string', 15, ''), 'PostTime' => array('mem_PostTime', 'integer', '', 0), 'Alias' => array('mem_Alias', 'string', 50, ''), 'Intro' => array('mem_Intro', 'string', '', ''), 'Articles' => array('mem_Articles', 'integer', '', 0), 'Pages' => array('mem_Pages', 'integer', '', 0), 'Comments' => array('mem_Comments', 'integer', '', 0), 'Uploads' => array('mem_Uploads', 'integer', '', 0), 'Template' => array('mem_Template', 'string', 50, ''), 'Meta' => array('mem_Meta', 'string', '', '')), 'Tag' => array('ID' => array('tag_ID', 'integer', '', 0), 'Name' => array('tag_Name', 'string', 250, ''), 'Order' => array('tag_Order', 'integer', '', 0), 'Count' => array('tag_Count', 'integer', '', 0), 'Alias' => array('tag_Alias', 'string', 250, ''), 'Intro' => array('tag_Intro', 'string', '', ''), 'Template' => array('tag_Template', 'string', 50, ''), 'Meta' => array('tag_Meta', 'string', '', '')), 'Upload' => array('ID' => array('ul_ID', 'integer', '', 0), 'AuthorID' => array('ul_AuthorID', 'integer', '', 0), 'Size' => array('ul_Size', 'integer', '', 0), 'Name' => array('ul_Name', 'string', 250, ''), 'SourceName' => array('ul_SourceName', 'string', 250, ''), 'MimeType' => array('ul_MimeType', 'string', 50, ''), 'PostTime' => array('ul_PostTime', 'integer', '', 0), 'DownNums' => array('ul_DownNums', 'integer', '', 0), 'LogID' => array('ul_LogID', 'integer', '', 0), 'Intro' => array('ul_Intro', 'string', '', ''), 'Meta' => array('ul_Meta', 'string', '', '')));
#加载ZBP类 数据库类 配置类
AutoloadClass('ZBlogPHP');
AutoloadClass('DbSql');
示例#3
0
$op_users = null;
if (!ZBP_HOOKERROR && isset($_ENV['ZBP_USER_OPTION']) && is_readable($file_base = $_ENV['ZBP_USER_OPTION'])) {
    $op_users = (require $file_base);
    $GLOBALS['option'] = array_merge($GLOBALS['option'], $op_users);
} elseif (is_readable($file_base = $GLOBALS['usersdir'] . 'c_option.php')) {
    $op_users = (require $file_base);
    $GLOBALS['option'] = array_merge($GLOBALS['option'], $op_users);
}
$GLOBALS['blogtitle'] = $GLOBALS['option']['ZC_BLOG_SUBNAME'];
// 不是漏写!
$GLOBALS['blogname'] =& $GLOBALS['option']['ZC_BLOG_NAME'];
$GLOBALS['blogsubname'] =& $GLOBALS['option']['ZC_BLOG_SUBNAME'];
$GLOBALS['blogtheme'] =& $GLOBALS['option']['ZC_BLOG_THEME'];
$GLOBALS['blogstyle'] =& $GLOBALS['option']['ZC_BLOG_CSS'];
$GLOBALS['cookiespath'] = null;
$GLOBALS['bloghost'] = GetCurrentHost($GLOBALS['blogpath'], $GLOBALS['cookiespath']);
/**
 * 系统实例化
 */
AutoloadClass('ZBlogPHP');
AutoloadClass('DbSql');
AutoloadClass('Config');
$GLOBALS['zbp'] = ZBlogPHP::GetInstance();
$GLOBALS['zbp']->Initialize();
/**
 * 加载主题和插件APP
 */
if (is_readable($file_base = $GLOBALS['usersdir'] . 'theme/' . $GLOBALS['blogtheme'] . '/theme.xml')) {
    $GLOBALS['activedapps'][] = $GLOBALS['blogtheme'];
}
if (is_readable($file_base = $GLOBALS['usersdir'] . 'theme/' . $GLOBALS['blogtheme'] . '/include.php')) {
示例#4
0
 /**
  * @param Settings $settings
  * @return bool
  */
 function UpdateSettingsByDomain(&$settings)
 {
     $host = GetCurrentHost();
     if (strlen($host) == 0 || !$settings || !$this->_dbConnection->Execute($this->_commandCreator->GetSettingsByDomainHost($host))) {
         return false;
     }
     $row = $this->_dbConnection->GetNextRecord();
     if ($row) {
         $settings->WindowTitle = $row->site_name;
         $settings->IncomingMailProtocol = (int) $row->settings_mail_protocol;
         $settings->IncomingMailServer = $row->settings_mail_inc_host;
         $settings->IncomingMailPort = (int) $row->settings_mail_inc_port;
         $settings->OutgoingMailServer = $row->settings_mail_out_host;
         $settings->OutgoingMailPort = (int) $row->settings_mail_out_port;
         $settings->ReqSmtpAuth = (bool) $row->settings_mail_out_auth;
         $settings->AllowDirectMode = (bool) $row->allow_direct_mode;
         $settings->DirectModeIsDefault = (bool) $row->direct_mode_id_def;
         $settings->AttachmentSizeLimit = (int) $row->attachment_size_limit;
         $settings->EnableAttachmentSizeLimit = (bool) $row->allow_attachment_limit;
         $settings->MailboxSizeLimit = (int) $row->mailbox_size_limit;
         $settings->EnableMailboxSizeLimit = (bool) $row->allow_mailbox_limit;
         $settings->TakeImapQuota = (bool) $row->take_quota;
         $settings->AllowUsersChangeEmailSettings = (bool) $row->allow_new_users_change_set;
         $settings->AllowNewUsersRegister = (bool) $row->allow_auto_reg_on_login;
         $settings->AllowUsersAddNewAccounts = (bool) $row->allow_users_add_accounts;
         $settings->AllowUsersChangeAccountsDef = (bool) $row->allow_users_change_account_def;
         $settings->DefaultUserCharset = ConvertUtils::GetCodePageName((int) $row->def_user_charset);
         $settings->AllowUsersChangeCharset = (bool) $row->allow_users_change_charset;
         $settings->DefaultTimeZone = (int) $row->def_user_timezone;
         $settings->AllowUsersChangeTimeZone = (bool) $row->allow_users_change_timezone;
         $settings->MailsPerPage = (int) $row->msgs_per_page;
         $settings->DefaultSkin = $row->skin;
         $settings->AllowUsersChangeSkin = (bool) $row->allow_users_change_skin;
         $settings->DefaultLanguage = $row->lang;
         $settings->AllowUsersChangeLanguage = (bool) $row->allow_users_change_lang;
         $settings->ShowTextLabels = (bool) $row->show_text_labels;
         $settings->AllowAjax = true;
         $settings->AllowDhtmlEditor = (bool) $row->allow_editor;
         $settings->AllowContacts = (bool) $row->allow_contacts;
         $settings->AllowCalendar = (bool) $row->allow_calendar;
         $settings->HideLoginMode = (int) $row->hide_login_mode;
         $settings->DefaultDomainOptional = $row->domain_to_use;
         $settings->AllowLanguageOnLogin = (bool) $row->allow_choosing_lang;
         $settings->AllowAdvancedLogin = (bool) $row->allow_advanced_login;
         $settings->AutomaticCorrectLoginSettings = (bool) $row->allow_auto_detect_and_correct;
         $settings->UseCaptcha = (bool) $row->use_captcha;
         $settings->UseMultipleDomainsSelection = (bool) $row->use_domain_selection;
         $settings->ViewMode = (int) $row->view_mode;
         return true;
     }
     return false;
 }
示例#5
0
 /**
  * 检测当前url,如果不符合设置就跳转到固定域名的链接
  */
 public function RedirectPermanentDomain()
 {
     if ($this->option['ZC_PERMANENT_DOMAIN_ENABLE'] == false) {
         return;
     }
     if ($this->option['ZC_PERMANENT_DOMAIN_REDIRECT'] == false) {
         return;
     }
     if ($this->option['ZC_PERMANENT_DOMAIN_INDISCRIMINATE_HTTPS'] == true) {
         $host = str_replace(array('https://', 'http://'), array('', ''), GetCurrentHost(ZBP_PATH, $null));
         $host2 = str_replace(array('https://', 'http://'), array('', ''), $this->host);
     } else {
         $host = GetCurrentHost(ZBP_PATH, $null);
         $host2 = $this->host;
     }
     if (stripos($host, $host2) === false) {
         $u = GetRequestUri();
         $u = $this->host . substr($u, 1, strlen($u));
         Redirect301($u);
     }
 }