coding style fixes

This commit is contained in:
Abdulrahman
2019-05-03 23:52:08 +03:00
parent 87c5631b40
commit f142da94f3
62 changed files with 12149 additions and 11750 deletions

View File

@@ -8,9 +8,9 @@
*/
// not for directly open
if (!defined('IN_COMMON'))
if (! defined('IN_COMMON'))
{
exit();
exit();
}
@@ -18,50 +18,50 @@ if (!defined('IN_COMMON'))
// Configuration values
//
$config_values = array();
$config_values = [];
// do it like this :
//$config_values = array('name', 'value', 'option', 'display_order', 'type', 'plg_id', 'dynamic');
// General settings
$config_values[] = array('sitename', $config_sitename, '<input type=\"text\" id=\"sitename\" name=\"sitename\" value=\"{con.sitename}\" size=\"50\" />', 1, 'general', 0, 0);
$config_values[] = array('siteurl', $config_siteurl, '<input type=\"text\" id=\"siteurl\" name=\"siteurl\" value=\"{con.siteurl}\" size=\"50\" style=\"direction:ltr\" />', 2, 'general', 0, 0);
$config_values[] = array('sitemail', $config_sitemail, '<input type=\"text\" id=\"sitemail\" name=\"sitemail\" value=\"{con.sitemail}\" size=\"25\" style=\"direction:ltr\" />', 3, 'general', 0, 0);
$config_values[] = array('sitemail2', $config_sitemail, '<input type=\"text\" id=\"sitemail2\" name=\"sitemail2\" value=\"{con.sitemail2}\" size=\"25\" style=\"direction:ltr\" />', '4', 'general', 0, 0);
$config_values[] = array('del_f_day', '0', '<input type=\"text\" id=\"del_f_day\" name=\"del_f_day\" value=\"{con.del_f_day}\" size=\"6\" style=\"text-align:center\" />{lang.DELF_CAUTION}', 5, 'advanced', 0, 0);
$config_values[] = array('language', getlang(), '<select name=\"language\" id=\"language\">\r\n {lngfiles}\r\n </select>', 6, 'groups', 0, 0);
$config_values[] = array('time_zone', $config_time_zone, '<select name=\"time_zone\" id=\"time_zone\">\r\n {time_zones}\r\n </select>', 10, 'general', 0, 0);
$config_values[] = array('siteclose', '0', '<label>{lang.YES}<input type=\"radio\" id=\"siteclose\" name=\"siteclose\" value=\"1\" <IF NAME=\"con.siteclose==1\"> checked=\"checked\"</IF> /></label><label>{lang.NO}<input type=\"radio\" id=\"siteclose\" name=\"siteclose\" value=\"0\" <IF NAME=\"con.siteclose==0\"> checked=\"checked\"</IF> /></label>', 7, 'general', 0, 0);
$config_values[] = array('closemsg', 'sits is closed now', '<input type=\"text\" id=\"closemsg\" name=\"closemsg\" value=\"{con.closemsg}\" size=\"68\" />', 8, 'general', 0, 0);
$config_values[] = array('user_system', '1', '<select id=\"user_system\" name=\"user_system\">{authtypes}</select>', 9, 'advanced', 0, 0);
$config_values[] = array('register', '1', '<label>{lang.YES}<input type=\"radio\" id=\"register\" name=\"register\" value=\"1\" <IF NAME=\"con.register==1\"> checked=\"checked\"</IF> /></label>\r\n <label>{lang.NO}<input type=\"radio\" id=\"register\" name=\"register\" value=\"0\" <IF NAME=\"con.register==0\"> checked=\"checked\"</IF> /></label>', 10, 'general', 0, 0);
$config_values[] = array('enable_userfile', '1', '<label>{lang.YES}<input type=\"radio\" id=\"enable_userfile\" name=\"enable_userfile\" value=\"1\" <IF NAME=\"con.enable_userfile==1\"> checked=\"checked\"</IF> /></label>\r\n <label>{lang.NO}<input type=\"radio\" id=\"enable_userfile\" name=\"enable_userfile\" value=\"0\" <IF NAME=\"con.enable_userfile==0\"> checked=\"checked\"</IF> /></label>', 11, 'groups', 0, 0);
$config_values[] = array('mod_writer', '0', '<label>{lang.YES}<input type=\"radio\" id=\"mod_writer\" name=\"mod_writer\" value=\"1\" <IF NAME=\"con.mod_writer==1\"> checked=\"checked\"</IF> /></label>\r\n <label>{lang.NO}<input type=\"radio\" id=\"mod_writer\" name=\"mod_writer\" value=\"0\" <IF NAME=\"con.mod_writer==0\"> checked=\"checked\"</IF> /></label>\r\n [ {lang.MOD_WRITER_EX} ]', 12, 'advanced', 0, 0);
$config_values[] = ['sitename', $config_sitename, '<input type=\"text\" id=\"sitename\" name=\"sitename\" value=\"{con.sitename}\" size=\"50\" />', 1, 'general', 0, 0];
$config_values[] = ['siteurl', $config_siteurl, '<input type=\"text\" id=\"siteurl\" name=\"siteurl\" value=\"{con.siteurl}\" size=\"50\" style=\"direction:ltr\" />', 2, 'general', 0, 0];
$config_values[] = ['sitemail', $config_sitemail, '<input type=\"text\" id=\"sitemail\" name=\"sitemail\" value=\"{con.sitemail}\" size=\"25\" style=\"direction:ltr\" />', 3, 'general', 0, 0];
$config_values[] = ['sitemail2', $config_sitemail, '<input type=\"text\" id=\"sitemail2\" name=\"sitemail2\" value=\"{con.sitemail2}\" size=\"25\" style=\"direction:ltr\" />', '4', 'general', 0, 0];
$config_values[] = ['del_f_day', '0', '<input type=\"text\" id=\"del_f_day\" name=\"del_f_day\" value=\"{con.del_f_day}\" size=\"6\" style=\"text-align:center\" />{lang.DELF_CAUTION}', 5, 'advanced', 0, 0];
$config_values[] = ['language', getlang(), '<select name=\"language\" id=\"language\">\r\n {lngfiles}\r\n </select>', 6, 'groups', 0, 0];
$config_values[] = ['time_zone', $config_time_zone, '<select name=\"time_zone\" id=\"time_zone\">\r\n {time_zones}\r\n </select>', 10, 'general', 0, 0];
$config_values[] = ['siteclose', '0', '<label>{lang.YES}<input type=\"radio\" id=\"siteclose\" name=\"siteclose\" value=\"1\" <IF NAME=\"con.siteclose==1\"> checked=\"checked\"</IF> /></label><label>{lang.NO}<input type=\"radio\" id=\"siteclose\" name=\"siteclose\" value=\"0\" <IF NAME=\"con.siteclose==0\"> checked=\"checked\"</IF> /></label>', 7, 'general', 0, 0];
$config_values[] = ['closemsg', 'sits is closed now', '<input type=\"text\" id=\"closemsg\" name=\"closemsg\" value=\"{con.closemsg}\" size=\"68\" />', 8, 'general', 0, 0];
$config_values[] = ['user_system', '1', '<select id=\"user_system\" name=\"user_system\">{authtypes}</select>', 9, 'advanced', 0, 0];
$config_values[] = ['register', '1', '<label>{lang.YES}<input type=\"radio\" id=\"register\" name=\"register\" value=\"1\" <IF NAME=\"con.register==1\"> checked=\"checked\"</IF> /></label>\r\n <label>{lang.NO}<input type=\"radio\" id=\"register\" name=\"register\" value=\"0\" <IF NAME=\"con.register==0\"> checked=\"checked\"</IF> /></label>', 10, 'general', 0, 0];
$config_values[] = ['enable_userfile', '1', '<label>{lang.YES}<input type=\"radio\" id=\"enable_userfile\" name=\"enable_userfile\" value=\"1\" <IF NAME=\"con.enable_userfile==1\"> checked=\"checked\"</IF> /></label>\r\n <label>{lang.NO}<input type=\"radio\" id=\"enable_userfile\" name=\"enable_userfile\" value=\"0\" <IF NAME=\"con.enable_userfile==0\"> checked=\"checked\"</IF> /></label>', 11, 'groups', 0, 0];
$config_values[] = ['mod_writer', '0', '<label>{lang.YES}<input type=\"radio\" id=\"mod_writer\" name=\"mod_writer\" value=\"1\" <IF NAME=\"con.mod_writer==1\"> checked=\"checked\"</IF> /></label>\r\n <label>{lang.NO}<input type=\"radio\" id=\"mod_writer\" name=\"mod_writer\" value=\"0\" <IF NAME=\"con.mod_writer==0\"> checked=\"checked\"</IF> /></label>\r\n [ {lang.MOD_WRITER_EX} ]', 12, 'advanced', 0, 0];
// Cookies settings
$cookie_data = get_cookies_settings();
$config_values[] = array('cookie_name', $cookie_data['cookie_name'], '<input type=\"text\" id=\"cookie_name\" name=\"cookie_name\" value=\"{con.cookie_name}\" size=\"20\" style=\"direction:ltr\" />', '13', 'advanced', 0, 0);
$config_values[] = array('cookie_path', $cookie_data['cookie_path'], '<input type=\"text\" id=\"cookie_path\" name=\"cookie_path\" value=\"{con.cookie_path}\" size=\"20\" style=\"direction:ltr\" />', '14', 'advanced', 0, 0);
$config_values[] = array('cookie_domain', $cookie_data['cookie_domain'], '<input type=\"text\" id=\"cookie_domain\" name=\"cookie_domain\" value=\"{con.cookie_domain}\" size=\"20\" style=\"direction:ltr\" />', '15', 'advanced', 0, 0);
$config_values[] = array('cookie_secure', ($cookie_data['cookie_secure'] ? '1' : '0'), '<label>{lang.YES}<input type=\"radio\" id=\"cookie_secure\" name=\"cookie_secure\" value=\"1\" <IF NAME=\"con.cookie_secure==1\"> checked=\"checked\"</IF> /></label>\r\n <label>{lang.NO}<input type=\"radio\" id=\"cookie_secure\" name=\"cookie_secure\" value=\"0\" <IF NAME=\"con.cookie_secure==0\"> checked=\"checked\"</IF> /></label>', '16', 'advanced', 0, 0);
$cookie_data = get_cookies_settings();
$config_values[] = ['cookie_name', $cookie_data['cookie_name'], '<input type=\"text\" id=\"cookie_name\" name=\"cookie_name\" value=\"{con.cookie_name}\" size=\"20\" style=\"direction:ltr\" />', '13', 'advanced', 0, 0];
$config_values[] = ['cookie_path', $cookie_data['cookie_path'], '<input type=\"text\" id=\"cookie_path\" name=\"cookie_path\" value=\"{con.cookie_path}\" size=\"20\" style=\"direction:ltr\" />', '14', 'advanced', 0, 0];
$config_values[] = ['cookie_domain', $cookie_data['cookie_domain'], '<input type=\"text\" id=\"cookie_domain\" name=\"cookie_domain\" value=\"{con.cookie_domain}\" size=\"20\" style=\"direction:ltr\" />', '15', 'advanced', 0, 0];
$config_values[] = ['cookie_secure', ($cookie_data['cookie_secure'] ? '1' : '0'), '<label>{lang.YES}<input type=\"radio\" id=\"cookie_secure\" name=\"cookie_secure\" value=\"1\" <IF NAME=\"con.cookie_secure==1\"> checked=\"checked\"</IF> /></label>\r\n <label>{lang.NO}<input type=\"radio\" id=\"cookie_secure\" name=\"cookie_secure\" value=\"0\" <IF NAME=\"con.cookie_secure==0\"> checked=\"checked\"</IF> /></label>', '16', 'advanced', 0, 0];
// Upload settings
$config_values[] = array('total_size', '10000000000', '<input type=\"text\" id=\"total_size\" name=\"total_size\" value=\"{con.total_size}\" size=\"20\" style=\"direction:ltr\" />', 17, 'upload', 0, 0);
$config_values[] = array('foldername', 'uploads', '<input type=\"text\" id=\"foldername\" name=\"foldername\" value=\"{con.foldername}\" size=\"20\" style=\"direction:ltr\" />', 18, 'upload', 0, 0);
$config_values[] = array('prefixname', '', '<input type=\"text\" id=\"prefixname\" name=\"prefixname\" value=\"{con.prefixname}\" size=\"20\" style=\"direction:ltr\" />', 19, 'upload', 0, 0);
$config_values[] = array('decode', '1', '<select id=\"decode\" name=\"decode\">\r\n <option <IF NAME=\"con.decode==0\">selected=\"selected\"</IF> value=\"0\">{lang.NO_CHANGE}</option>\r\n <option <IF NAME=\"con.decode==2\">selected=\"selected\"</IF> value=\"2\">{lang.CHANGE_MD5}</option>\r\n <option <IF NAME=\"con.decode==1\">selected=\"selected\"</IF> value=\"1\">{lang.CHANGE_TIME}</option>\r\n <!-- another config decode options -->\r\n </select>', 20, 'upload', 0, 0);
$config_values[] = array('id_form', $config_urls_type, '<select id=\"id_form\" name=\"id_form\">\r\n <option <IF NAME=\"con.id_form==id\">selected=\"selected\"</IF> value=\"id\">{lang.IDF}</option>\r\n <option <IF NAME=\"con.id_form==filename\">selected=\"selected\"</IF> value=\"filename\">{lang.IDFF}</option>\r\n<option <IF NAME=\"con.id_form==direct\">selected=\"selected\"</IF> value=\"direct\">{lang.IDFD}</option>\r\n </select>', 21, 'upload', 0, 0);
$config_values[] = array('id_form_img', $config_urls_type, '<select id=\"id_form_img\" name=\"id_form_img\">\r\n <option <IF NAME=\"con.id_form_img==id\">selected=\"selected\"</IF> value=\"id\">{lang.IDF_IMG}</option>\r\n <option <IF NAME=\"con.id_form_img==filename\">selected=\"selected\"</IF> value=\"filename\">{lang.IDFF_IMG}</option>\r\n<option <IF NAME=\"con.id_form_img==direct\">selected=\"selected\"</IF> value=\"direct\">{lang.IDFD_IMG}</option>\r\n </select>', 21, 'upload', 0, 0);
$config_values[] = array('filesnum', '3', '<input type=\"text\" id=\"filesnum\" name=\"filesnum\" value=\"{con.filesnum}\" size=\"6\" style=\"text-align:center\" />', 22, 'groups', 0, 0);
$config_values[] = array('sec_down', '5', '<input type=\"text\" id=\"sec_down\" name=\"sec_down\" value=\"{con.sec_down}\" size=\"6\" style=\"text-align:center\" />', 23, 'groups', 0, 0);
$config_values[] = array('del_url_file', '1', '<label>{lang.YES}<input type=\"radio\" id=\"del_url_file\" name=\"del_url_file\" value=\"1\" <IF NAME=\"con.del_url_file==1\"> checked=\"checked\"</IF> /></label>\r\n <label>{lang.NO}<input type=\"radio\" id=\"del_url_file\" name=\"del_url_file\" value=\"0\" <IF NAME=\"con.del_url_file==0\"> checked=\"checked\"</IF> /></label>', 24, 'upload', 0, 0);
$config_values[] = array('safe_code', '0', '<label>{lang.YES}<input type=\"radio\" id=\"safe_code\" name=\"safe_code\" value=\"1\" <IF NAME=\"con.safe_code==1\"> checked=\"checked\"</IF> /></label>\r\n <label>{lang.NO}<input type=\"radio\" id=\"safe_code\" name=\"safe_code\" value=\"0\" <IF NAME=\"con.safe_code==0\"> checked=\"checked\"</IF> /></label>', 25, 'upload', 0, 0);
$config_values[] = array('www_url', '0', '<label>{lang.YES}<input type=\"radio\" id=\"www_url\" name=\"www_url\" value=\"1\" <IF NAME=\"con.www_url==1\"> checked=\"checked\"</IF> /></label>\r\n <label>{lang.NO}<input type=\"radio\" id=\"www_url\" name=\"www_url\" value=\"0\" <IF NAME=\"con.www_url==0\"> checked=\"checked\"</IF> /></label>', 26, 'upload', 0, 0);
$config_values[] = array('thumbs_imgs', '1', '<input type=\"text\" id=\"thmb_dim_w\" name=\"thmb_dim_w\" value=\"{thmb_dim_w}\" size=\"2\" style=\"text-align:center\" /> * <input type=\"text\" id=\"thmb_dim_h\" name=\"thmb_dim_h\" value=\"{thmb_dim_h}\" size=\"2\" style=\"text-align:center\" /> ', 27, 'upload', 0, 0);
$config_values[] = array('write_imgs', '0' , '<label>{lang.YES}<input type=\"radio\" id=\"write_imgs\" name=\"write_imgs\" value=\"1\" <IF NAME=\"con.write_imgs==1\"> checked=\"checked\"</IF> /></label>\r\n <label>{lang.NO}<input type=\"radio\" id=\"write_imgs\" name=\"write_imgs\" value=\"0\" <IF NAME=\"con.write_imgs==0\"> checked=\"checked\"</IF> /></label>\r\n <br /><img src=\"{STAMP_IMG_URL}\" alt=\"Seal photo\" style=\"margin-top:4px;border:1px groove #FF865E;\" />\r\n ', 28, 'groups', 0, 0);
$config_values[] = array('livexts', 'swf', '<input type=\"text\" id=\"livexts\" name=\"livexts\" value=\"{con.livexts}\" size=\"62\" style=\"direction:ltr\" />{lang.COMMA_X}', '29', 'upload', 0, 0);
$config_values[] = array('usersectoupload', '10', '<input type=\"text\" id=\"usersectoupload\" name=\"usersectoupload\" value=\"{con.usersectoupload}\" size=\"10\" />', 44, 'groups', 0, 0);
$config_values[] = array('filesnum_show', '1', '<label>{lang.YES}<input type=\"radio\" id=\"filesnum_show\" name=\"filesnum_show\" value=\"1\" <IF NAME=\"con.filesnum_show==1\"> checked=\"checked\"</IF> /></label>\r\n <label>{lang.NO}<input type=\"radio\" id=\"filesnum_show\" name=\"filesnum_show\" value=\"0\" <IF NAME=\"con.filesnum_show==0\"> checked=\"checked\"</IF> /></label>', 22, 'upload', 0, 0);
$config_values[] = ['total_size', '10000000000', '<input type=\"text\" id=\"total_size\" name=\"total_size\" value=\"{con.total_size}\" size=\"20\" style=\"direction:ltr\" />', 17, 'upload', 0, 0];
$config_values[] = ['foldername', 'uploads', '<input type=\"text\" id=\"foldername\" name=\"foldername\" value=\"{con.foldername}\" size=\"20\" style=\"direction:ltr\" />', 18, 'upload', 0, 0];
$config_values[] = ['prefixname', '', '<input type=\"text\" id=\"prefixname\" name=\"prefixname\" value=\"{con.prefixname}\" size=\"20\" style=\"direction:ltr\" />', 19, 'upload', 0, 0];
$config_values[] = ['decode', '1', '<select id=\"decode\" name=\"decode\">\r\n <option <IF NAME=\"con.decode==0\">selected=\"selected\"</IF> value=\"0\">{lang.NO_CHANGE}</option>\r\n <option <IF NAME=\"con.decode==2\">selected=\"selected\"</IF> value=\"2\">{lang.CHANGE_MD5}</option>\r\n <option <IF NAME=\"con.decode==1\">selected=\"selected\"</IF> value=\"1\">{lang.CHANGE_TIME}</option>\r\n <!-- another config decode options -->\r\n </select>', 20, 'upload', 0, 0];
$config_values[] = ['id_form', $config_urls_type, '<select id=\"id_form\" name=\"id_form\">\r\n <option <IF NAME=\"con.id_form==id\">selected=\"selected\"</IF> value=\"id\">{lang.IDF}</option>\r\n <option <IF NAME=\"con.id_form==filename\">selected=\"selected\"</IF> value=\"filename\">{lang.IDFF}</option>\r\n<option <IF NAME=\"con.id_form==direct\">selected=\"selected\"</IF> value=\"direct\">{lang.IDFD}</option>\r\n </select>', 21, 'upload', 0, 0];
$config_values[] = ['id_form_img', $config_urls_type, '<select id=\"id_form_img\" name=\"id_form_img\">\r\n <option <IF NAME=\"con.id_form_img==id\">selected=\"selected\"</IF> value=\"id\">{lang.IDF_IMG}</option>\r\n <option <IF NAME=\"con.id_form_img==filename\">selected=\"selected\"</IF> value=\"filename\">{lang.IDFF_IMG}</option>\r\n<option <IF NAME=\"con.id_form_img==direct\">selected=\"selected\"</IF> value=\"direct\">{lang.IDFD_IMG}</option>\r\n </select>', 21, 'upload', 0, 0];
$config_values[] = ['filesnum', '3', '<input type=\"text\" id=\"filesnum\" name=\"filesnum\" value=\"{con.filesnum}\" size=\"6\" style=\"text-align:center\" />', 22, 'groups', 0, 0];
$config_values[] = ['sec_down', '5', '<input type=\"text\" id=\"sec_down\" name=\"sec_down\" value=\"{con.sec_down}\" size=\"6\" style=\"text-align:center\" />', 23, 'groups', 0, 0];
$config_values[] = ['del_url_file', '1', '<label>{lang.YES}<input type=\"radio\" id=\"del_url_file\" name=\"del_url_file\" value=\"1\" <IF NAME=\"con.del_url_file==1\"> checked=\"checked\"</IF> /></label>\r\n <label>{lang.NO}<input type=\"radio\" id=\"del_url_file\" name=\"del_url_file\" value=\"0\" <IF NAME=\"con.del_url_file==0\"> checked=\"checked\"</IF> /></label>', 24, 'upload', 0, 0];
$config_values[] = ['safe_code', '0', '<label>{lang.YES}<input type=\"radio\" id=\"safe_code\" name=\"safe_code\" value=\"1\" <IF NAME=\"con.safe_code==1\"> checked=\"checked\"</IF> /></label>\r\n <label>{lang.NO}<input type=\"radio\" id=\"safe_code\" name=\"safe_code\" value=\"0\" <IF NAME=\"con.safe_code==0\"> checked=\"checked\"</IF> /></label>', 25, 'upload', 0, 0];
$config_values[] = ['www_url', '0', '<label>{lang.YES}<input type=\"radio\" id=\"www_url\" name=\"www_url\" value=\"1\" <IF NAME=\"con.www_url==1\"> checked=\"checked\"</IF> /></label>\r\n <label>{lang.NO}<input type=\"radio\" id=\"www_url\" name=\"www_url\" value=\"0\" <IF NAME=\"con.www_url==0\"> checked=\"checked\"</IF> /></label>', 26, 'upload', 0, 0];
$config_values[] = ['thumbs_imgs', '1', '<input type=\"text\" id=\"thmb_dim_w\" name=\"thmb_dim_w\" value=\"{thmb_dim_w}\" size=\"2\" style=\"text-align:center\" /> * <input type=\"text\" id=\"thmb_dim_h\" name=\"thmb_dim_h\" value=\"{thmb_dim_h}\" size=\"2\" style=\"text-align:center\" /> ', 27, 'upload', 0, 0];
$config_values[] = ['write_imgs', '0' , '<label>{lang.YES}<input type=\"radio\" id=\"write_imgs\" name=\"write_imgs\" value=\"1\" <IF NAME=\"con.write_imgs==1\"> checked=\"checked\"</IF> /></label>\r\n <label>{lang.NO}<input type=\"radio\" id=\"write_imgs\" name=\"write_imgs\" value=\"0\" <IF NAME=\"con.write_imgs==0\"> checked=\"checked\"</IF> /></label>\r\n <br /><img src=\"{STAMP_IMG_URL}\" alt=\"Seal photo\" style=\"margin-top:4px;border:1px groove #FF865E;\" />\r\n ', 28, 'groups', 0, 0];
$config_values[] = ['livexts', 'swf', '<input type=\"text\" id=\"livexts\" name=\"livexts\" value=\"{con.livexts}\" size=\"62\" style=\"direction:ltr\" />{lang.COMMA_X}', '29', 'upload', 0, 0];
$config_values[] = ['usersectoupload', '10', '<input type=\"text\" id=\"usersectoupload\" name=\"usersectoupload\" value=\"{con.usersectoupload}\" size=\"10\" />', 44, 'groups', 0, 0];
$config_values[] = ['filesnum_show', '1', '<label>{lang.YES}<input type=\"radio\" id=\"filesnum_show\" name=\"filesnum_show\" value=\"1\" <IF NAME=\"con.filesnum_show==1\"> checked=\"checked\"</IF> /></label>\r\n <label>{lang.NO}<input type=\"radio\" id=\"filesnum_show\" name=\"filesnum_show\" value=\"0\" <IF NAME=\"con.filesnum_show==0\"> checked=\"checked\"</IF> /></label>', 22, 'upload', 0, 0];
//KLIVE
//$config_values[] = array('imagefolder', 'uploads', '<input type=\"text\" id=\"imagefolder\" name=\"imagefolder\" value=\"{con.imagefolder}\" size=\"40\">', '10', 'KLIVE', '0', '0');
@@ -69,28 +69,28 @@ $config_values[] = array('filesnum_show', '1', '<label>{lang.YES}<input type=\"r
//$config_values[] = array('imagefoldere', '1', '<label>{lang.YES}<input type=\"radio\" id=\"imagefoldere\" name=\"imagefoldere\" value=\"1\" <IF NAME=\"con.imagefoldere\"> checked=\"checked\"</IF>></label><label>{lang.NO}<input type=\"radio\" id=\"imagefoldere\" name=\"imagefoldere\" value=\"0\" <IF NAME=\"con.imagefoldere\"> <ELSE> checked=\"checked\"</IF>></label>', '30', 'KLIVE', '0', '0');
// Interface settings
$config_values[] = array('welcome_msg', $lang['INST_MSGINS'], '<input type=\"text\" id=\"welcome_msg\" name=\"welcome_msg\" value=\"{con.welcome_msg}\" size=\"68\" />', 30, 'interface', 0, 0);
$config_values[] = array('allow_stat_pg', '1', '<label>{lang.YES}<input type=\"radio\" id=\"allow_stat_pg\" name=\"allow_stat_pg\" value=\"1\" <IF NAME=\"con.allow_stat_pg==1\"> checked=\"checked\"</IF> /></label>\r\n <label>{lang.NO}<input type=\"radio\" id=\"allow_stat_pg\" name=\"allow_stat_pg\" value=\"0\" <IF NAME=\"con.allow_stat_pg==0\"> checked=\"checked\"</IF> /></label>', 31, 'interface', 0, 0);
$config_values[] = array('allow_online', '0', '<label>{lang.YES}<input type=\"radio\" id=\"allow_online\" name=\"allow_online\" value=\"1\" <IF NAME=\"con.allow_online==1\"> checked=\"checked\"</IF> /></label>\r\n <label>{lang.NO}<input type=\"radio\" id=\"allow_online\" name=\"allow_online\" value=\"0\" <IF NAME=\"con.allow_online==0\"> checked=\"checked\"</IF> /></label>', 32, 'interface', 0, 0);
$config_values[] = array('statfooter', '0' , '<label>{lang.YES}<input type=\"radio\" id=\"statfooter\" name=\"statfooter\" value=\"1\" <IF NAME=\"con.statfooter==1\"> checked=\"checked=\"</IF> /></label>\r\n <label>{lang.NO}<input type=\"radio\" id=\"statfooter\" name=\"statfooter\" value=\"0\" <IF NAME=\"con.statfooter==0\"> checked=\"checked\"</IF> /></label>', 33, 'interface', 0, 0);
$config_values[] = ['welcome_msg', $lang['INST_MSGINS'], '<input type=\"text\" id=\"welcome_msg\" name=\"welcome_msg\" value=\"{con.welcome_msg}\" size=\"68\" />', 30, 'interface', 0, 0];
$config_values[] = ['allow_stat_pg', '1', '<label>{lang.YES}<input type=\"radio\" id=\"allow_stat_pg\" name=\"allow_stat_pg\" value=\"1\" <IF NAME=\"con.allow_stat_pg==1\"> checked=\"checked\"</IF> /></label>\r\n <label>{lang.NO}<input type=\"radio\" id=\"allow_stat_pg\" name=\"allow_stat_pg\" value=\"0\" <IF NAME=\"con.allow_stat_pg==0\"> checked=\"checked\"</IF> /></label>', 31, 'interface', 0, 0];
$config_values[] = ['allow_online', '0', '<label>{lang.YES}<input type=\"radio\" id=\"allow_online\" name=\"allow_online\" value=\"1\" <IF NAME=\"con.allow_online==1\"> checked=\"checked\"</IF> /></label>\r\n <label>{lang.NO}<input type=\"radio\" id=\"allow_online\" name=\"allow_online\" value=\"0\" <IF NAME=\"con.allow_online==0\"> checked=\"checked\"</IF> /></label>', 32, 'interface', 0, 0];
$config_values[] = ['statfooter', '0' , '<label>{lang.YES}<input type=\"radio\" id=\"statfooter\" name=\"statfooter\" value=\"1\" <IF NAME=\"con.statfooter==1\"> checked=\"checked=\"</IF> /></label>\r\n <label>{lang.NO}<input type=\"radio\" id=\"statfooter\" name=\"statfooter\" value=\"0\" <IF NAME=\"con.statfooter==0\"> checked=\"checked\"</IF> /></label>', 33, 'interface', 0, 0];
//$config_values[] = array('gzip', '0', '<label>{lang.YES}<input type=\"radio\" id=\"gzip\" name=\"gzip\" value=\"1\" <IF NAME=\"con.gzip==1\"> checked=\"checked\"</IF> /></label>\r\n <label>{lang.NO}<input type=\"radio\" id=\"gzip\" name=\"gzip\" value=\"0\" <IF NAME=\"con.gzip==0\"> checked=\"checked\"</IF> /></label>', 34, 'interface', 0, 0);
$config_values[] = array('googleanalytics', '', '<input type=\"text\" id=\"googleanalytics\" name=\"googleanalytics\" value=\"{con.googleanalytics}\" size=\"10\" />', 35, 'interface', 0, 0);
$config_values[] = array('enable_captcha', '1', '<label>{lang.YES}<input type=\"radio\" id=\"enable_captcha\" name=\"enable_captcha\" value=\"1\" <IF NAME=\"con.enable_captcha==1\"> checked=\"checked\"</IF> /></label>\r\n <label>{lang.NO}<input type=\"radio\" id=\"enable_captcha\" name=\"enable_captcha\" value=\"0\" <IF NAME=\"con.enable_captcha==0\"> checked=\"checked\"</IF> /></label>', 36, 'interface', 0, 0);
$config_values[] = ['googleanalytics', '', '<input type=\"text\" id=\"googleanalytics\" name=\"googleanalytics\" value=\"{con.googleanalytics}\" size=\"10\" />', 35, 'interface', 0, 0];
$config_values[] = ['enable_captcha', '1', '<label>{lang.YES}<input type=\"radio\" id=\"enable_captcha\" name=\"enable_captcha\" value=\"1\" <IF NAME=\"con.enable_captcha==1\"> checked=\"checked\"</IF> /></label>\r\n <label>{lang.NO}<input type=\"radio\" id=\"enable_captcha\" name=\"enable_captcha\" value=\"0\" <IF NAME=\"con.enable_captcha==0\"> checked=\"checked\"</IF> /></label>', 36, 'interface', 0, 0];
// System settings [ invisible configs ]
$config_values[] = array('thmb_dims', '100*100', '', 0, 0, 0);
$config_values[] = array('style', 'bootstrap', '', 0, '0', 0, 0);
$config_values[] = array('new_version', '', '', 0, 0, 0);
$config_values[] = array('db_version', LAST_DB_VERSION, '', 0, 0, 0);
$config_values[] = array('last_online_time_update', time(), '', 0, 0, 1);
$config_values[] = array('klj_clean_files_from', '0', '', 0, 0, 1);
$config_values[] = array('style_depend_on', '', '', 0, 0, 0);
$config_values[] = array('most_user_online_ever', '', '', 0, 0, 1);
$config_values[] = array('expand_menu', '0', '', 0, 0, 1);
$config_values[] = array('firstime', '0', '', 0, 0, 1);
$config_values[] = array('ftp_info', '', '', 0, 0, 0);
$config_values[] = array('queue', '', '', 0, 0, 1);
$config_values[] = array('default_group', '3', '', 0, 0, 1);
$config_values[] = ['thmb_dims', '100*100', '', 0, 0, 0];
$config_values[] = ['style', 'bootstrap', '', 0, '0', 0, 0];
$config_values[] = ['new_version', '', '', 0, 0, 0];
$config_values[] = ['db_version', LAST_DB_VERSION, '', 0, 0, 0];
$config_values[] = ['last_online_time_update', time(), '', 0, 0, 1];
$config_values[] = ['klj_clean_files_from', '0', '', 0, 0, 1];
$config_values[] = ['style_depend_on', '', '', 0, 0, 0];
$config_values[] = ['most_user_online_ever', '', '', 0, 0, 1];
$config_values[] = ['expand_menu', '0', '', 0, 0, 1];
$config_values[] = ['firstime', '0', '', 0, 0, 1];
$config_values[] = ['ftp_info', '', '', 0, 0, 0];
$config_values[] = ['queue', '', '', 0, 0, 1];
$config_values[] = ['default_group', '3', '', 0, 0, 1];
//
// Extensions
@@ -98,50 +98,50 @@ $config_values[] = array('default_group', '3', '', 0, 0, 1);
// do it like this :
//$ext_values[group_id] = array('ext'=>sizeInKB);
$ext_values = array();
$ext_values = [];
#admins
$ext_values[1] = array(
'gif' => 2097152,
'png' => 2097152,
'jpg' => 2097152,
'jpeg' => 2097152,
'bmp' => 2097152,
'zip' => 2097152,
'rar' => 2097152,
);
#guests
$ext_values[2] = array(
'gif' => 2097152,
'png' => 2097152,
'jpg' => 2097152,
'jpeg' => 2097152,
'bmp' => 2097152,
'zip' => 2097152,
'rar' => 2097152,
);
#users
$ext_values[3] = array(
'gif' => 2097152,
'png' => 2097152,
'jpg' => 2097152,
'jpeg' => 2097152,
'bmp' => 2097152,
'zip' => 2097152,
'rar' => 2097152,
);
//admins
$ext_values[1] = [
'gif' => 2097152,
'png' => 2097152,
'jpg' => 2097152,
'jpeg' => 2097152,
'bmp' => 2097152,
'zip' => 2097152,
'rar' => 2097152,
];
//guests
$ext_values[2] = [
'gif' => 2097152,
'png' => 2097152,
'jpg' => 2097152,
'jpeg' => 2097152,
'bmp' => 2097152,
'zip' => 2097152,
'rar' => 2097152,
];
//users
$ext_values[3] = [
'gif' => 2097152,
'png' => 2097152,
'jpg' => 2097152,
'jpeg' => 2097152,
'bmp' => 2097152,
'zip' => 2097152,
'rar' => 2097152,
];
//
// ACLs
//
$acls_values = array();
$acls_values = [];
//$acls_values['name of acl'] = array(admins, guests, users);
$acls_values['enter_acp'] = array(1, 0, 0);
$acls_values['access_fileuser'] = array(1, 0, 1);
$acls_values['access_fileusers'] = array(1, 1, 1);
$acls_values['access_stats'] = array(1, 1, 1);
$acls_values['access_call'] = array(1, 1, 1);
$acls_values['access_report'] = array(0, 0, 0);
$acls_values['enter_acp'] = [1, 0, 0];
$acls_values['access_fileuser'] = [1, 0, 1];
$acls_values['access_fileusers'] = [1, 1, 1];
$acls_values['access_stats'] = [1, 1, 1];
$acls_values['access_call'] = [1, 1, 1];
$acls_values['access_report'] = [0, 0, 0];

View File

@@ -7,24 +7,22 @@
*
*/
/*
* Requirements of Kleeja
*/
// Requirements of Kleeja
define('MIN_PHP_VERSION', '7.0');
define('MIN_MYSQL_VERSION', '4.2.2');
//version of latest changes at db
define ('LAST_DB_VERSION' , '9');
define ('LAST_DB_VERSION', '9');
//set no errors
define('MYSQL_NO_ERRORS', true);
// Detect choosing another lang while installing
if(ig('change_lang'))
if (ig('change_lang'))
{
if (ip('lang'))
{
header('Location: ' . $_SERVER['PHP_SELF'] . '?step=' . p('step_is') . '&lang=' . p('lang'));
}
if (ip('lang'))
{
header('Location: ' . $_SERVER['PHP_SELF'] . '?step=' . p('step_is') . '&lang=' . p('lang'));
}
}
// Including current language
@@ -34,48 +32,48 @@ $lang = array_merge($lang, require $_path . 'lang/' . getlang() . '/install.php'
$IN_DEV = false;
// Exceptions for development
if(file_exists($_path . '.svn/entries') || file_exists('dev.txt'))
if (file_exists($_path . '.svn/entries') || file_exists('dev.txt'))
{
define('DEV_STAGE', true);
$IN_DEV = true;
define('DEV_STAGE', true);
$IN_DEV = true;
}
/**
* Return current language of installing wizard
* @param bool $link
* @param bool $link
* @return mixed|string
*/
function getlang ($link = false)
{
global $_path;
global $_path;
if (ig('lang'))
{
$lang = preg_replace('/[^a-z0-9]/i', '', g('lang', 'str', 'en'));
if (ig('lang'))
{
$lang = preg_replace('/[^a-z0-9]/i', '', g('lang', 'str', 'en'));
$ln = file_exists($_path . 'lang/' . $lang . '/install.php') ? $lang : 'en';
}
else
{
$ln = 'en';
}
$ln = file_exists($_path . 'lang/' . $lang . '/install.php') ? $lang : 'en';
}
else
{
$ln = 'en';
}
return $link ? 'lang=' . $ln : $ln;
return $link ? 'lang=' . $ln : $ln;
}
function getjquerylink()
{
global $_path;
global $_path;
if(file_exists($_path . 'admin/Masmak/js/jquery.min.js'))
{
return $_path . 'admin/Masmak/js/jquery.min.js';
}
else
{
return 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js';
}
if (file_exists($_path . 'admin/Masmak/js/jquery.min.js'))
{
return $_path . 'admin/Masmak/js/jquery.min.js';
}
else
{
return 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js';
}
}
/**
@@ -83,15 +81,15 @@ function getjquerylink()
*/
function gettpl($tplname)
{
global $lang, $_path;
global $lang, $_path;
$tpl = preg_replace('/{{([^}]+)}}/', '<?php \\1 ?>', file_get_contents('style/' . $tplname));
ob_start();
eval('?> ' . $tpl . '<?php ');
$stpl = ob_get_contents();
ob_end_clean();
$tpl = preg_replace('/{{([^}]+)}}/', '<?php \\1 ?>', file_get_contents('style/' . $tplname));
ob_start();
eval('?> ' . $tpl . '<?php ');
$stpl = ob_get_contents();
ob_end_clean();
return $stpl;
return $stpl;
}
/**
@@ -99,49 +97,52 @@ function gettpl($tplname)
*/
function do_config_export($srv, $usr, $pass, $nm, $prf, $fpath = '')
{
global $_path;
global $_path;
if(!in_array($type, array('mysql', 'mysqli')))
{
$type = 'mysql';
}
if (! in_array($type, ['mysql', 'mysqli']))
{
$type = 'mysql';
}
$data = '<?php' . "\n\n" . '//fill these variables with your data' . "\n";
//$data .= '$db_type = \'' . $type . "'; //mysqli or mysql \n";
$data .= '$dbserver = \'' . str_replace("'", "\'", $srv) . "'; //database server \n";
$data .= '$dbuser = \'' . str_replace("'", "\'", $usr) . "' ; // database user \n";
$data .= '$dbpass = \'' . str_replace("'", "\'", $pass) . "'; // database password \n";
$data .= '$dbname = \'' . str_replace("'", "\'", $nm) . "'; // database name \n";
//$data .= '$db_type = \'' . $type . "'; //mysqli or mysql \n";
$data .= '$dbserver = \'' . str_replace("'", "\'", $srv) . "'; //database server \n";
$data .= '$dbuser = \'' . str_replace("'", "\'", $usr) . "' ; // database user \n";
$data .= '$dbpass = \'' . str_replace("'", "\'", $pass) . "'; // database password \n";
$data .= '$dbname = \'' . str_replace("'", "\'", $nm) . "'; // database name \n";
$data .= '$dbprefix = \'' . str_replace("'", "\'", $prf) . "'; // if you use prefix for tables , fill it \n";
//$data .= '$adminpath = \'admin.php\';// if you renamed your acp file , please fill the new name here \n';
//$data .= "\n\n\n";
//$data .= "//for integration with script must change user systen from admin cp \n";
//$data .= '$script_path = \'' . str_replace("'", "\'", $fpath) . "'; // path of script (./forums) \n";
//$data .= "\n\n";
//$data .= '?'.'>';
//$data .= '$adminpath = \'admin.php\';// if you renamed your acp file , please fill the new name here \n';
//$data .= "\n\n\n";
//$data .= "//for integration with script must change user systen from admin cp \n";
//$data .= '$script_path = \'' . str_replace("'", "\'", $fpath) . "'; // path of script (./forums) \n";
//$data .= "\n\n";
//$data .= '?'.'>';
$written = false;
if (is_writable($_path))
{
$fh = @fopen($_path . 'config.php', 'wb');
if ($fh)
{
fwrite($fh, $data);
fclose($fh);
$written = false;
$written = true;
}
}
if (is_writable($_path))
{
$fh = @fopen($_path . 'config.php', 'wb');
if(!$written)
{
header('Content-Type: text/x-delimtext; name="config.php"');
header('Content-disposition: attachment; filename=config.php');
echo $data;
exit;
}
if ($fh)
{
fwrite($fh, $data);
fclose($fh);
return true;
$written = true;
}
}
if (! $written)
{
header('Content-Type: text/x-delimtext; name="config.php"');
header('Content-disposition: attachment; filename=config.php');
echo $data;
exit;
}
return true;
}
@@ -150,8 +151,8 @@ function do_config_export($srv, $usr, $pass, $nm, $prf, $fpath = '')
*/
function get_microtime()
{
list($usec, $sec) = explode(' ', microtime());
return ((float) $usec + (float) $sec);
list($usec, $sec) = explode(' ', microtime());
return ((float) $usec + (float) $sec);
}
/**
@@ -159,35 +160,37 @@ function get_microtime()
*/
function inst_get_config($name)
{
global $SQL, $dbprefix;
global $SQL, $dbprefix;
if(!$SQL)
{
global $dbserver, $dbuser, $dbpass, $dbname;
if(!isset($dbserver))
{
return false;
}
if (! $SQL)
{
global $dbserver, $dbuser, $dbpass, $dbname;
if (! isset($dbserver))
{
return false;
}
$SQL = new KleejaDatabase($dbserver, $dbuser, $dbpass, $dbname);
}
}
if(!$SQL)
{
return false;
}
if (! $SQL)
{
return false;
}
$sql = "SELECT value FROM `{$dbprefix}config` WHERE `name` = '" . $name . "'";
$result = $SQL->query($sql);
if($SQL->num_rows($result) == 0)
{
return false;
}
else
{
$current_ver = $SQL->fetch_array($result);
return $current_ver['value'];
}
$sql = "SELECT value FROM `{$dbprefix}config` WHERE `name` = '" . $name . "'";
$result = $SQL->query($sql);
if ($SQL->num_rows($result) == 0)
{
return false;
}
else
{
$current_ver = $SQL->fetch_array($result);
return $current_ver['value'];
}
}
@@ -197,46 +200,56 @@ function inst_get_config($name)
*/
function get_cookies_settings()
{
$server_port = !empty($_SERVER['SERVER_PORT']) ? (int) $_SERVER['SERVER_PORT'] : (int) @getenv('SERVER_PORT');
$server_name = $server_name = (!empty($_SERVER['HTTP_HOST'])) ? strtolower($_SERVER['HTTP_HOST']) : ((!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : @getenv('SERVER_NAME'));
$server_port = ! empty($_SERVER['SERVER_PORT']) ? (int) $_SERVER['SERVER_PORT'] : (int) @getenv('SERVER_PORT');
$server_name = $server_name = (! empty($_SERVER['HTTP_HOST'])) ? strtolower($_SERVER['HTTP_HOST']) : ((! empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : @getenv('SERVER_NAME'));
// HTTP HOST can carry a port number...
if (strpos($server_name, ':') !== false)
$server_name = substr($server_name, 0, strpos($server_name, ':'));
// HTTP HOST can carry a port number...
if (strpos($server_name, ':') !== false)
{
$server_name = substr($server_name, 0, strpos($server_name, ':'));
}
$cookie_secure = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? true : false;
$cookie_name = 'klj_' . strtolower(substr(str_replace('0', 'z', base_convert(md5(mt_rand()), 16, 35)), 0, 5));
$cookie_secure = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? true : false;
$cookie_name = 'klj_' . strtolower(substr(str_replace('0', 'z', base_convert(md5(mt_rand()), 16, 35)), 0, 5));
$name = (!empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : getenv('PHP_SELF');
if (!$name)
$name = (!empty($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : @getenv('REQUEST_URI');
$name = (! empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : getenv('PHP_SELF');
$script_path = trim(dirname(str_replace(array('\\', '//'), '/', $name)));
if (! $name)
{
$name = (! empty($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : @getenv('REQUEST_URI');
}
$script_path = trim(dirname(str_replace(['\\', '//'], '/', $name)));
if ($script_path !== '/')
{
if (substr($script_path, -1) == '/')
$script_path = substr($script_path, 0, -1);
if ($script_path !== '/')
{
if (substr($script_path, -1) == '/')
{
$script_path = substr($script_path, 0, -1);
}
$script_path = str_replace(array('../', './'), '', $script_path);
if ($script_path[0] != '/')
$script_path = '/' . $script_path;
}
$script_path = str_replace(['../', './'], '', $script_path);
$cookie_domain = $server_name;
if (strpos($cookie_domain, 'www.') === 0)
{
$cookie_domain = str_replace('www.', '.', $cookie_domain);
}
if ($script_path[0] != '/')
{
$script_path = '/' . $script_path;
}
}
return array(
'server_name' => $server_name,
'cookie_secure' => $cookie_secure,
'cookie_name' => $cookie_name,
'cookie_domain' => $cookie_domain,
'cookie_path' => str_replace('/install', '', $script_path),
);
$cookie_domain = $server_name;
if (strpos($cookie_domain, 'www.') === 0)
{
$cookie_domain = str_replace('www.', '.', $cookie_domain);
}
return [
'server_name' => $server_name,
'cookie_secure' => $cookie_secure,
'cookie_name' => $cookie_name,
'cookie_domain' => $cookie_domain,
'cookie_path' => str_replace('/install', '', $script_path),
];
}

View File

@@ -8,15 +8,15 @@
*/
// not for directly open
if (!defined('IN_COMMON'))
if (! defined('IN_COMMON'))
{
exit();
exit();
}
if(empty($install_sqls) || !is_array($install_sqls))
if (empty($install_sqls) || ! is_array($install_sqls))
{
$install_sqls = array();
$install_sqls = [];
}
$install_sqls['ALTER_DATABASE_UTF'] = "
@@ -238,10 +238,10 @@ CREATE TABLE `{$dbprefix}filters` (
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=1 ;
";
$install_sqls['stats_insert'] = "INSERT INTO `{$dbprefix}stats` VALUES (0,0,1,0,0," . time() . ",0,0,0,0,'',0,0,0,0,'','','','')";
$install_sqls['users_insert'] = "INSERT INTO `{$dbprefix}users` (`id`,`name`,`group_id`,`password`,`password_salt`,`mail`,`founder`,`clean_name`) VALUES (1,'" . $user_name . "', 1, '" . $user_pass . "','" . $user_salt . "', '" . $user_mail . "', 1,'" . $clean_name . "')";
$install_sqls['stats_insert'] = "INSERT INTO `{$dbprefix}stats` VALUES (0,0,1,0,0," . time() . ",0,0,0,0,'',0,0,0,0,'','','','')";
$install_sqls['users_insert'] = "INSERT INTO `{$dbprefix}users` (`id`,`name`,`group_id`,`password`,`password_salt`,`mail`,`founder`,`clean_name`) VALUES (1,'" . $user_name . "', 1, '" . $user_pass . "','" . $user_salt . "', '" . $user_mail . "', 1,'" . $clean_name . "')";
$install_sqls['TeamMsg_insert'] = "INSERT INTO `{$dbprefix}call` (`name`,`text`,`mail`,`time`,`ip`) VALUES ('" . $SQL->escape($lang['KLEEJA_TEAM_MSG_NAME']) . "', '" . $SQL->escape($lang['KLEEJA_TEAM_MSG_TEXT']) . "','info@kleeja.com', " . time() . ", '127.0.0.1')";
$install_sqls['groups_insert'] = "INSERT INTO `{$dbprefix}groups` (`group_id`, `group_name`, `group_is_default`, `group_is_essential`) VALUES
$install_sqls['groups_insert'] = "INSERT INTO `{$dbprefix}groups` (`group_id`, `group_name`, `group_is_default`, `group_is_essential`) VALUES
(1, '{lang.ADMINS}', 0, 1),
(2, '{lang.GUESTS}', 0, 1),
(3, '{lang.USERS}', 1, 1);";

View File

@@ -5,13 +5,13 @@
$update_sqls = array
(
'files_size_big' => "ALTER TABLE `{$dbprefix}files` CHANGE `size` `size` BIGINT(20) NOT NULL DEFAULT '0';",
'group_size_big' => "ALTER TABLE `{$dbprefix}groups_exts` CHANGE `size` `size` BIGINT(20) NOT NULL DEFAULT '0';",
'files_index_type' => "ALTER TABLE `{$dbprefix}files` ADD INDEX `type` (`type`);",
'id_form_img' => 'INSERT INTO `'.$dbprefix.'config` (`name`, `value`, `option`, `display_order`, `type`, `plg_id`, `dynamic`) VALUES (\'id_form_img\', X\'6964\', \'<select id=\"id_form_img\" name=\"id_form_img\">\r\n <option <IF NAME=\"con.id_form_img==id\">selected=\"selected\"</IF> value=\"id\">{lang.IDF_IMG}</option>\r\n <option <IF NAME=\"con.id_form_img ==filename\">selected=\"selected\"</IF> value=\"filename\">{lang.IDFF_IMG}</option>\r\n<option <IF NAME=\"con.id_form_img ==direct\">selected=\"selected\"</IF> value=\"direct\">{lang.IDFD_IMG}</option>\r\n </select>\n\', \'21\', X\'75706C6F6164\', \'0\', \'0\');',
);
$update_sqls =
[
'files_size_big' => "ALTER TABLE `{$dbprefix}files` CHANGE `size` `size` BIGINT(20) NOT NULL DEFAULT '0';",
'group_size_big' => "ALTER TABLE `{$dbprefix}groups_exts` CHANGE `size` `size` BIGINT(20) NOT NULL DEFAULT '0';",
'files_index_type' => "ALTER TABLE `{$dbprefix}files` ADD INDEX `type` (`type`);",
'id_form_img' => 'INSERT INTO `' . $dbprefix . 'config` (`name`, `value`, `option`, `display_order`, `type`, `plg_id`, `dynamic`) VALUES (\'id_form_img\', X\'6964\', \'<select id=\"id_form_img\" name=\"id_form_img\">\r\n <option <IF NAME=\"con.id_form_img==id\">selected=\"selected\"</IF> value=\"id\">{lang.IDF_IMG}</option>\r\n <option <IF NAME=\"con.id_form_img ==filename\">selected=\"selected\"</IF> value=\"filename\">{lang.IDFF_IMG}</option>\r\n<option <IF NAME=\"con.id_form_img ==direct\">selected=\"selected\"</IF> value=\"direct\">{lang.IDFD_IMG}</option>\r\n </select>\n\', \'21\', X\'75706C6F6164\', \'0\', \'0\');',
];
//$update_functions = array
@@ -29,4 +29,4 @@ $update_sqls = array
//(
// 'note .......',
// 'note 2 .......',
//);
//);

View File

@@ -42,9 +42,9 @@ if (! function_exists('mysqli_connect'))
if(file_exists($_path . 'config.php'))
if (file_exists($_path . 'config.php'))
{
include_once ($_path . 'config.php');
include_once $_path . 'config.php';
}
include_once $_path . 'includes/functions.php';
@@ -58,9 +58,9 @@ include_once 'includes/functions_install.php';
/**
* print header
*/
if (!ip('lang'))
if (! ip('lang'))
{
echo gettpl('header.html');
echo gettpl('header.html');
}
@@ -72,53 +72,58 @@ switch (g('step', 'str'))
default:
case 'language':
if(ig('ln') && g('ln', 'str', '') !== '')
{
// header('Location: ./?step=official&lang=' . g('ln'));
echo '<meta http-equiv="refresh" content="0;url=./?step=what_is_kleeja&lang=' . g('ln') . '">';
exit;
}
if (ig('ln') && g('ln', 'str', '') !== '')
{
// header('Location: ./?step=official&lang=' . g('ln'));
echo '<meta http-equiv="refresh" content="0;url=./?step=what_is_kleeja&lang=' . g('ln') . '">';
echo gettpl('lang.html');
exit;
}
echo gettpl('lang.html');
break;
case 'what_is_kleeja':
echo gettpl('what_is_kleeja.html');
echo gettpl('what_is_kleeja.html');
break;
case 'official':
echo gettpl('official.html');
echo gettpl('official.html');
break;
case 'choose' :
$install_or_no = $php_ver = true;
$install_or_no = $php_ver = true;
//check version of PHP
if (! function_exists('version_compare')
//check version of PHP
if (! function_exists('version_compare')
|| version_compare(PHP_VERSION, MIN_PHP_VERSION, '<'))
{
$php_ver = false;
}
{
$php_ver = false;
}
if(file_exists($_path . 'config.php'))
{
include_once $_path . 'config.php';
if(!empty($dbuser) && !empty($dbname))
{
$d = inst_get_config('language');
if (file_exists($_path . 'config.php'))
{
include_once $_path . 'config.php';
if(!empty($d))
{
$install_or_no = false;
}
}
}
if (! empty($dbuser) && ! empty($dbname))
{
$d = inst_get_config('language');
if (! empty($d))
{
$install_or_no = false;
}
}
}
echo gettpl('choose.html');
echo gettpl('choose.html');
break;
}
@@ -127,5 +132,3 @@ break;
* print footer
*/
echo gettpl('footer.html');

View File

@@ -16,11 +16,12 @@
* include important files
*/
define('IN_COMMON', true);
$_path = "../";
$_path = '../';
define('PATH', $_path);
if(file_exists($_path . 'config.php'))
if (file_exists($_path . 'config.php'))
{
include_once $_path . 'config.php';
include_once $_path . 'config.php';
}
include_once $_path . 'includes/functions_display.php';
include_once $_path . 'includes/functions_alternative.php';
@@ -30,7 +31,7 @@ include_once $_path . 'includes/mysqli.php';
include_once 'includes/functions_install.php';
#an alias class for plugins class
//an alias class for plugins class
class Plugins
{
private static $instance;
@@ -43,56 +44,60 @@ class Plugins
return self::$instance;
}
function run($name){ return null; }
public function run($name)
{
return null;
}
}
if(!ig('step'))
if (! ig('step'))
{
//if anyone request this file directly without passing index.php we will return him to index.php
header('Location: index.php');
exit;
//if anyone request this file directly without passing index.php we will return him to index.php
header('Location: index.php');
exit;
}
//
// Kleeja must be safe ..
//
if(!empty($dbuser) && !empty($dbname) && !(ig('step') && in_array(g('step'), array('c','check', 'data', 'end', 'wizard'))))
if (! empty($dbuser) && ! empty($dbname) && ! (ig('step') && in_array(g('step'), ['c','check', 'data', 'end', 'wizard'])))
{
$d = inst_get_config('language');
if(!empty($d))
{
header('Location: index.php');
exit;
}
$d = inst_get_config('language');
if (! empty($d))
{
header('Location: index.php');
exit;
}
}
/**
* Print header
*/
if(ip('dbsubmit') && !is_writable($_path))
if (ip('dbsubmit') && ! is_writable($_path))
{
// soon
// soon
}
else
{
echo gettpl('header.html');
echo gettpl('header.html');
}
/*
//navigate ..
*/
// //navigate ..
switch (g('step'))
{
default:
case 'license':
$contentof_license = "GPL version 2
$contentof_license = 'GPL version 2
GNU General Public License, Free Software Foundation
The GNU General Public License is a Free Software license. Like any Free Software license, it grants to you the four following freedoms:
1. The freedom to run the program for any purpose.
@@ -103,7 +108,7 @@ You may exercise the freedoms specified here provided that you comply with the e
You must conspicuously and appropriately publish on each copy distributed an appropriate copyright notice and disclaimer of warranty and keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of the GNU General Public License along with the Program. Any translation of the GNU General Public License must be accompanied by the GNU General Public License.
If you modify your copy or copies of the program or any portion of it, or develop a program based upon it, you may distribute the resulting work provided you do so under the GNU General Public License. Any translation of the GNU General Public License must be accompanied by the GNU General Public License.
If you copy or distribute the program, you must accompany it with the complete corresponding machine-readable source code or with a written offer, valid for at least three years, to furnish the complete corresponding machine-readable source code.
Any of the above conditions can be waived if you get permission from the copyright holder.";
Any of the above conditions can be waived if you get permission from the copyright holder.';
$contentof_license = nl2br($contentof_license);
echo gettpl('license.html');
@@ -111,278 +116,326 @@ break;
case 'f':
$check_ok = true;
$advices = $register_globals = $get_magic_quotes_gpc = false;
$check_ok = true;
$advices = $register_globals = $get_magic_quotes_gpc = false;
if (@ini_get('register_globals') == '1' || strtolower(@ini_get('register_globals')) == 'on')
{
$register_globals = true;
}
if( (function_exists("get_magic_quotes_gpc") && get_magic_quotes_gpc()) ||
(@ini_get('magic_quotes_sybase') && (strtolower(@ini_get('magic_quotes_sybase')) != "off")) )
{
$get_magic_quotes_gpc = true;
}
if (@ini_get('register_globals') == '1' || strtolower(@ini_get('register_globals')) == 'on')
{
$register_globals = true;
}
if($register_globals || $get_magic_quotes_gpc)
{
$advices = true;
}
if ( (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) ||
(@ini_get('magic_quotes_sybase') && (strtolower(@ini_get('magic_quotes_sybase')) != 'off')) )
{
$get_magic_quotes_gpc = true;
}
echo gettpl('check.html');
if ($register_globals || $get_magic_quotes_gpc)
{
$advices = true;
}
echo gettpl('check.html');
break;
case 'c':
// after submit, generate config file
if(ip('dbsubmit'))
{
//lets do it
do_config_export(
p('db_server'),
p('db_user'),
p('db_pass'),
p('db_name'),
p('db_prefix')
);
}
// after submit, generate config file
if (ip('dbsubmit'))
{
//lets do it
do_config_export(
p('db_server'),
p('db_user'),
p('db_pass'),
p('db_name'),
p('db_prefix')
);
}
$no_config = !file_exists($_path . 'config.php') ? false : true;
$writeable_path = is_writable($_path) ? true : false;
$no_config = ! file_exists($_path . 'config.php') ? false : true;
$writeable_path = is_writable($_path) ? true : false;
echo gettpl('configs.html');
echo gettpl('configs.html');
break;
case 'check':
$submit_disabled = $no_connection = $mysql_ver = false;
$submit_disabled = $no_connection = $mysql_ver = false;
//config.php
if(!empty($dbname) && !empty($dbuser))
{
//connect .. for check
//config.php
if (! empty($dbname) && ! empty($dbuser))
{
//connect .. for check
$SQL = new KleejaDatabase($dbserver, $dbuser, $dbpass, $dbname);
if (!$SQL->is_connected())
{
$no_connection = true;
}
else
{
if (!empty($SQL->mysql_version()) && version_compare($SQL->mysql_version(), MIN_MYSQL_VERSION, '<'))
{
$mysql_ver = $SQL->mysql_version();
}
}
}
if (! $SQL->is_connected())
{
$no_connection = true;
}
else
{
if (! empty($SQL->mysql_version()) && version_compare($SQL->mysql_version(), MIN_MYSQL_VERSION, '<'))
{
$mysql_ver = $SQL->mysql_version();
}
}
}
//try to chmod them
if(function_exists('chmod'))
{
//try to chmod them
if (function_exists('chmod'))
{
@chmod($_path . 'cache', 0755);
@chmod($_path . 'uploads', 0755);
@chmod($_path . 'uploads/thumbs', 0755);
}
}
echo gettpl('check_all.html');
echo gettpl('check_all.html');
break;
case 'data' :
if (ip('datasubmit'))
{
if (ip('datasubmit'))
{
//check data ...
if (empty(p('sitename')) || empty(p('siteurl')) || empty(p('sitemail'))
|| empty(p('username')) || empty(p('password')) || empty(p('password2')) || empty(p('email')) )
{
echo $lang['EMPTY_FIELDS'];
echo $footer_inst;
exit();
}
//check data ...
if (empty(p('sitename')) || empty(p('siteurl')) || empty(p('sitemail'))
|| empty(p('username')) || empty(p('password')) || empty(p('password2')) || empty(p('email')) )
{
echo $lang['EMPTY_FIELDS'];
echo $footer_inst;
//fix bug #r1777 (alta3rq revision)
if(!empty(p('password')) && !empty(p('password2')) && p('password') != p('password2'))
{
echo $lang['PASS_NEQ_PASS2'];
echo $footer_inst;
exit();
}
if (strpos(p('email'),'@') === false)
{
echo $lang['WRONG_EMAIL'];
echo $footer_inst;
exit();
}
exit();
}
//connect .. for check
//fix bug #r1777 (alta3rq revision)
if (! empty(p('password')) && ! empty(p('password2')) && p('password') != p('password2'))
{
echo $lang['PASS_NEQ_PASS2'];
echo $footer_inst;
exit();
}
if (strpos(p('email'), '@') === false)
{
echo $lang['WRONG_EMAIL'];
echo $footer_inst;
exit();
}
//connect .. for check
$SQL = new KleejaDatabase($dbserver, $dbuser, $dbpass, $dbname);
include_once '../includes/usr.php';
include_once '../includes/functions_alternative.php';
$usrcp = new usrcp;
include_once '../includes/usr.php';
include_once '../includes/functions_alternative.php';
$usrcp = new usrcp;
$user_salt = substr(kleeja_base64_encode(pack("H*", sha1(mt_rand()))), 0, 7);
$user_pass = $usrcp->kleeja_hash_password(p('password') . $user_salt);
$user_name = $SQL->escape(p('username'));
$user_mail = $SQL->escape(p('email'));
$config_sitename = $SQL->escape(p('sitename'));
$config_siteurl = $SQL->escape(p('siteurl'));
$config_sitemail = $SQL->escape(p('sitemail'));
$config_time_zone = $SQL->escape(p('time_zone'));
//$config_style = ip('style') ? $SQL->escape(p('style')) : '';
$config_urls_type = in_array(p('urls_type'), array('id', 'filename', 'direct')) ? p('urls_type') : 'id';
$clean_name = $usrcp->cleanusername($SQL->escape($user_name));
$user_salt = substr(kleeja_base64_encode(pack('H*', sha1(mt_rand()))), 0, 7);
$user_pass = $usrcp->kleeja_hash_password(p('password') . $user_salt);
$user_name = $SQL->escape(p('username'));
$user_mail = $SQL->escape(p('email'));
$config_sitename = $SQL->escape(p('sitename'));
$config_siteurl = $SQL->escape(p('siteurl'));
$config_sitemail = $SQL->escape(p('sitemail'));
$config_time_zone = $SQL->escape(p('time_zone'));
//$config_style = ip('style') ? $SQL->escape(p('style')) : '';
$config_urls_type = in_array(p('urls_type'), ['id', 'filename', 'direct']) ? p('urls_type') : 'id';
$clean_name = $usrcp->cleanusername($SQL->escape($user_name));
/// ok .. we will get sqls now ..
include 'includes/install_sqls.php';
include 'includes/default_values.php';
/// ok .. we will get sqls now ..
include 'includes/install_sqls.php';
include 'includes/default_values.php';
$err = $dots = 0;
$errors = '';
$err = $dots = 0;
$errors = '';
//do important alter before
$SQL->query($install_sqls['ALTER_DATABASE_UTF']);
//do important alter before
$SQL->query($install_sqls['ALTER_DATABASE_UTF']);
$sqls_done = $sql_err = array();
foreach($install_sqls as $name=>$sql_content)
{
if($name == 'DROP_TABLES' || $name == 'ALTER_DATABASE_UTF')
{
continue;
}
$sqls_done = $sql_err = [];
if($SQL->query($sql_content))
{
if ($name == 'call') $sqls_done[] = $lang['INST_CRT_CALL'];
elseif ($name == 'reports') $sqls_done[] = $lang['INST_CRT_REPRS'];
elseif ($name == 'stats') $sqls_done[] = $lang['INST_CRT_STS'];
elseif ($name == 'users') $sqls_done[] = $lang['INST_CRT_USRS'];
elseif ($name == 'users') $sqls_done[] = $lang['INST_CRT_ADM'];
elseif ($name == 'files') $sqls_done[] = $lang['INST_CRT_FLS'];
elseif ($name == 'config') $sqls_done[] = $lang['INST_CRT_CNF'];
elseif ($name == 'exts') $sqls_done[] = $lang['INST_CRT_EXT'];
elseif ($name == 'online') $sqls_done[] = $lang['INST_CRT_ONL'];
elseif ($name == 'hooks') $sqls_done[] = $lang['INST_CRT_HKS'];
elseif ($name == 'plugins') $sqls_done[] = $lang['INST_CRT_PLG'];
elseif ($name == 'lang') $sqls_done[] = $lang['INST_CRT_LNG'];
else
{
$sqls_done[] = $name . '...';
}
}
else
{
$errors .= implode(':', $SQL->get_error()) . '' . "\n___\n";
$sql_err[] = $lang['INST_SQL_ERR'] . ' : ' . $name . '[basic]';
$err++;
}
foreach ($install_sqls as $name=>$sql_content)
{
if ($name == 'DROP_TABLES' || $name == 'ALTER_DATABASE_UTF')
{
continue;
}
}#for
if ($SQL->query($sql_content))
{
if ($name == 'call')
{
$sqls_done[] = $lang['INST_CRT_CALL'];
}
elseif ($name == 'reports')
{
$sqls_done[] = $lang['INST_CRT_REPRS'];
}
elseif ($name == 'stats')
{
$sqls_done[] = $lang['INST_CRT_STS'];
}
elseif ($name == 'users')
{
$sqls_done[] = $lang['INST_CRT_USRS'];
}
elseif ($name == 'users')
{
$sqls_done[] = $lang['INST_CRT_ADM'];
}
elseif ($name == 'files')
{
$sqls_done[] = $lang['INST_CRT_FLS'];
}
elseif ($name == 'config')
{
$sqls_done[] = $lang['INST_CRT_CNF'];
}
elseif ($name == 'exts')
{
$sqls_done[] = $lang['INST_CRT_EXT'];
}
elseif ($name == 'online')
{
$sqls_done[] = $lang['INST_CRT_ONL'];
}
elseif ($name == 'hooks')
{
$sqls_done[] = $lang['INST_CRT_HKS'];
}
elseif ($name == 'plugins')
{
$sqls_done[] = $lang['INST_CRT_PLG'];
}
elseif ($name == 'lang')
{
$sqls_done[] = $lang['INST_CRT_LNG'];
}
else
{
$sqls_done[] = $name . '...';
}
}
else
{
$errors .= implode(':', $SQL->get_error()) . '' . "\n___\n";
$sql_err[] = $lang['INST_SQL_ERR'] . ' : ' . $name . '[basic]';
$err++;
}
}//for
if($err == 0)
{
//add configs
foreach($config_values as $cn)
{
if(empty($cn[6]))
{
$cn[6] = 0;
}
if ($err == 0)
{
//add configs
foreach ($config_values as $cn)
{
if (empty($cn[6]))
{
$cn[6] = 0;
}
$sql = "INSERT INTO `{$dbprefix}config` (`name`, `value`, `option`, `display_order`, `type`, `plg_id`, `dynamic`) VALUES ('$cn[0]', '$cn[1]', '$cn[2]', '$cn[3]', '$cn[4]', '$cn[5]', '$cn[6]');";
if(!$SQL->query($sql))
{
$errors .= implode(':', $SQL->get_error()) . '' . "\n___\n";
$sql_err[] = $lang['INST_SQL_ERR'] . ' : [configs_values] ' . $cn;
$err++;
}
}
$sql = "INSERT INTO `{$dbprefix}config` (`name`, `value`, `option`, `display_order`, `type`, `plg_id`, `dynamic`) VALUES ('$cn[0]', '$cn[1]', '$cn[2]', '$cn[3]', '$cn[4]', '$cn[5]', '$cn[6]');";
//add groups configs
foreach($config_values as $cn)
{
if($cn[4] != 'groups' or !$cn[4])
{
continue;
}
if (! $SQL->query($sql))
{
$errors .= implode(':', $SQL->get_error()) . '' . "\n___\n";
$sql_err[] = $lang['INST_SQL_ERR'] . ' : [configs_values] ' . $cn;
$err++;
}
}
$itxt = '';
foreach(array(1, 2, 3) as $im)
{
$itxt .= ($itxt == '' ? '' : ','). "($im, '$cn[0]', '$cn[1]')";
}
//add groups configs
foreach ($config_values as $cn)
{
if ($cn[4] != 'groups' or ! $cn[4])
{
continue;
}
$sql = "INSERT INTO `{$dbprefix}groups_data` (`group_id`, `name`, `value`) VALUES " . $itxt . ";";
if(!$SQL->query($sql))
{
$errors .= implode(':', $SQL->get_error()) . '' . "\n___\n";
$sql_err[] = $lang['INST_SQL_ERR'] . ' : [groups_configs_values] ' . $cn;
$err++;
}
}
$itxt = '';
//add exts
foreach($ext_values as $gid=>$exts)
{
$itxt = '';
foreach($exts as $t=>$v)
{
$itxt .= ($itxt == '' ? '' : ','). "('$t', $gid, $v)";
}
foreach ([1, 2, 3] as $im)
{
$itxt .= ($itxt == '' ? '' : ',') . "($im, '$cn[0]', '$cn[1]')";
}
$sql = "INSERT INTO `{$dbprefix}groups_exts` (`ext`, `group_id`, `size`) VALUES " . $itxt . ";";
if(!$SQL->query($sql))
{
$errors .= implode(':', $SQL->get_error()) . '' . "\n___\n";
$sql_err[] = $lang['INST_SQL_ERR'] . ' : [ext_values] ' . $gid;
$err++;
}
}
$sql = "INSERT INTO `{$dbprefix}groups_data` (`group_id`, `name`, `value`) VALUES " . $itxt . ';';
//add acls
foreach($acls_values as $cn=>$ct)
{
$it = 1;
$itxt = '';
foreach($ct as $ctk)
{
$itxt .= ($itxt == '' ? '' : ','). "('$cn', '$it', '$ctk')";
$it++;
}
if (! $SQL->query($sql))
{
$errors .= implode(':', $SQL->get_error()) . '' . "\n___\n";
$sql_err[] = $lang['INST_SQL_ERR'] . ' : [groups_configs_values] ' . $cn;
$err++;
}
}
//add exts
foreach ($ext_values as $gid=>$exts)
{
$itxt = '';
foreach ($exts as $t=>$v)
{
$itxt .= ($itxt == '' ? '' : ',') . "('$t', $gid, $v)";
}
$sql = "INSERT INTO `{$dbprefix}groups_exts` (`ext`, `group_id`, `size`) VALUES " . $itxt . ';';
if (! $SQL->query($sql))
{
$errors .= implode(':', $SQL->get_error()) . '' . "\n___\n";
$sql_err[] = $lang['INST_SQL_ERR'] . ' : [ext_values] ' . $gid;
$err++;
}
}
//add acls
foreach ($acls_values as $cn=>$ct)
{
$it = 1;
$itxt = '';
foreach ($ct as $ctk)
{
$itxt .= ($itxt == '' ? '' : ',') . "('$cn', '$it', '$ctk')";
$it++;
}
$sql = "INSERT INTO `{$dbprefix}groups_acl` (`acl_name`, `group_id`, `acl_can`) VALUES " . $itxt . ";";
if(!$SQL->query($sql))
{
$errors .= implode(':', $SQL->get_error()) . '' . "\n___\n";
$sql_err[] = $lang['INST_SQL_ERR'] . ' : [acl_values] ' . $cn;
$err++;
}
$it++;
}
}
$sql = "INSERT INTO `{$dbprefix}groups_acl` (`acl_name`, `group_id`, `acl_can`) VALUES " . $itxt . ';';
echo gettpl('sqls_done.html');
if (! $SQL->query($sql))
{
$errors .= implode(':', $SQL->get_error()) . '' . "\n___\n";
$sql_err[] = $lang['INST_SQL_ERR'] . ' : [acl_values] ' . $cn;
$err++;
}
$it++;
}
}
}
else
{
$urlsite = 'http://' . $_SERVER['HTTP_HOST'] . str_replace('install', '', dirname($_SERVER['PHP_SELF']));
echo gettpl('data.html');
}
echo gettpl('sqls_done.html');
}
else
{
$urlsite = 'http://' . $_SERVER['HTTP_HOST'] . str_replace('install', '', dirname($_SERVER['PHP_SELF']));
echo gettpl('data.html');
}
break;
case 'end' :
echo gettpl('end.html');
//for safe ..
//@rename("install.php", "install.lock");
echo gettpl('end.html');
//for safe ..
//@rename("install.php", "install.lock");
break;
}
@@ -391,6 +444,3 @@ break;
* print footer
*/
echo gettpl('footer.html');

View File

@@ -16,11 +16,12 @@
* include important files
*/
define('IN_COMMON', true);
$_path = "../";
$_path = '../';
define('PATH', $_path);
if(file_exists($_path . 'config.php'))
if (file_exists($_path . 'config.php'))
{
include_once $_path . 'config.php';
include_once $_path . 'config.php';
}
include_once $_path . 'includes/functions.php';
@@ -31,20 +32,21 @@ include_once $_path . 'includes/mysqli.php';
include_once 'includes/functions_install.php';
$order_update_files = array(
'1.7_to_2.0' => 9,
// filename => db_version
);
$order_update_files = [
'1.7_to_2.0' => 9,
// filename => db_version
];
$SQL = new KleejaDatabase($dbserver, $dbuser, $dbpass, $dbname);
//
// Is current db is up-to-date ?
//
$config['db_version'] = inst_get_config('db_version');
if($config['db_version'] == false)
if ($config['db_version'] == false)
{
$SQL->query("INSERT INTO `{$dbprefix}config` (`name` ,`value`) VALUES ('db_version', '')");
$SQL->query("INSERT INTO `{$dbprefix}config` (`name` ,`value`) VALUES ('db_version', '')");
}
@@ -54,9 +56,9 @@ $IN_UPDATE = true;
/**
* print header
*/
if (!ip('action_file_do'))
if (! ip('action_file_do'))
{
echo gettpl('header.html');
echo gettpl('header.html');
}
@@ -69,141 +71,146 @@ switch (g('step', 'str', 'action_file'))
default:
case 'action_file':
if (ip('action_file_do'))
{
if (p('action_file_do', 'str', '') !== '')
{
echo '<meta http-equiv="refresh" content="0;url=' . $_SERVER['PHP_SELF'] . '?step=update_now&action_file_do=' . p('action_file_do') . '&amp;' . getlang(1) . '">';
}
}
else
{
//get fles
$s_path = "includes/update_files";
$dh = opendir($s_path);
$upfiles = array();
if (ip('action_file_do'))
{
if (p('action_file_do', 'str', '') !== '')
{
echo '<meta http-equiv="refresh" content="0;url=' . $_SERVER['PHP_SELF'] . '?step=update_now&action_file_do=' . p('action_file_do') . '&amp;' . getlang(1) . '">';
}
}
else
{
//get fles
$s_path = 'includes/update_files';
$dh = opendir($s_path);
$upfiles = [];
while (($file = readdir($dh)) !== false)
{
if(substr($file, -3) == 'php')
{
$file = str_replace('.php','', $file);
$db_ver = $order_update_files[$file];
while (($file = readdir($dh)) !== false)
{
if (substr($file, -3) == 'php')
{
$file = str_replace('.php', '', $file);
$db_ver = $order_update_files[$file];
// var_dump($db_ver);
// var_dump($db_ver);
if((empty($config['db_version']) || $db_ver > $config['db_version']))
{
if ((empty($config['db_version']) || $db_ver > $config['db_version']))
{
$upfiles[$db_ver] = $file;
}
}
}
@closedir($dh);
}
}
@closedir($dh);
ksort($upfiles);
echo gettpl('update_list.html');
}
ksort($upfiles);
echo gettpl('update_list.html');
}
break;
case 'update_now':
if(!ig('action_file_do'))
{
echo '<meta http-equiv="refresh" content="0;url=' . $_SERVER['PHP_SELF'] . '?step=action_file&' . getlang(1) . '">';
exit();
}
if(ig('complet_up_func'))
{
define('C_U_F', true);
}
$file_for_up = 'includes/update_files/' . preg_replace('/[^a-z0-9_\-\.]/i', '', g('action_file_do')) . '.php';
if(!file_exists($file_for_up))
{
echo '<span style="color:red;">' . $lang['INST_ERR_NO_SELECTED_UPFILE_GOOD'] . ' [ ' . $file_for_up . ' ]</span><br />';
}
else
{
//get it
require $file_for_up;
$complete_update = true;
$update_msgs_arr = array();
if($config['db_version'] >= LAST_DB_VERSION && !defined('DEV_STAGE'))
{
$update_msgs_arr[] = '<span style="color:green;">' . $lang['INST_UPDATE_CUR_VER_IS_UP']. '</span>';
$complete_update = false;
}
//
//is there any sqls
//
if(($complete_update || (defined('DEV_STAGE')) && !defined('C_U_F')))
{
$SQL->show_errors = false;
if(isset($update_sqls) && sizeof($update_sqls) > 0)
{
$err = '';
foreach($update_sqls as $name=>$sql_content)
{
$err = '';
$SQL->query($sql_content);
$err = $SQL->get_error();
if (! ig('action_file_do'))
{
echo '<meta http-equiv="refresh" content="0;url=' . $_SERVER['PHP_SELF'] . '?step=action_file&' . getlang(1) . '">';
if(strpos($err[1], 'Duplicate') !== false || $err[0] == '1062' || $err[0] == '1060')
{
$update_msgs_arr[] = '<span style="color:green;">' . $lang['INST_UPDATE_CUR_VER_IS_UP']. '</span>';
$complete_update = false;
}
}
}
}
exit();
}
//
//is there any functions
//
if($complete_update || defined('DEV_STAGE') || defined('C_U_F'))
{
if(isset($update_functions) && sizeof($update_functions) > 0)
{
foreach($update_functions as $n)
{
if(is_callable($n))
{
$n();
if (ig('complet_up_func'))
{
define('C_U_F', true);
}
$file_for_up = 'includes/update_files/' . preg_replace('/[^a-z0-9_\-\.]/i', '', g('action_file_do')) . '.php';
if (! file_exists($file_for_up))
{
echo '<span style="color:red;">' . $lang['INST_ERR_NO_SELECTED_UPFILE_GOOD'] . ' [ ' . $file_for_up . ' ]</span><br />';
}
else
{
//get it
require $file_for_up;
$complete_update = true;
$update_msgs_arr = [];
if ($config['db_version'] >= LAST_DB_VERSION && ! defined('DEV_STAGE'))
{
$update_msgs_arr[] = '<span style="color:green;">' . $lang['INST_UPDATE_CUR_VER_IS_UP'] . '</span>';
$complete_update = false;
}
//
//is there any sqls
//
if (($complete_update || (defined('DEV_STAGE')) && ! defined('C_U_F')))
{
$SQL->show_errors = false;
if (isset($update_sqls) && sizeof($update_sqls) > 0)
{
$err = '';
foreach ($update_sqls as $name=>$sql_content)
{
$err = '';
$SQL->query($sql_content);
$err = $SQL->get_error();
if (strpos($err[1], 'Duplicate') !== false || $err[0] == '1062' || $err[0] == '1060')
{
$update_msgs_arr[] = '<span style="color:green;">' . $lang['INST_UPDATE_CUR_VER_IS_UP'] . '</span>';
$complete_update = false;
}
}
}
}
//
//is there any notes
//
$NOTES_CUP = false;
if($complete_update || defined('DEV_STAGE'))
{
if(isset($update_notes) && sizeof($update_notes) > 0)
{
$i=1;
$NOTES_CUP = array();
foreach($update_notes as $n)
{
$NOTES_CUP[$i] = $n;
++$i;
}
}
}
}
}
//
//is there any functions
//
if ($complete_update || defined('DEV_STAGE') || defined('C_U_F'))
{
if (isset($update_functions) && sizeof($update_functions) > 0)
{
foreach ($update_functions as $n)
{
if (is_callable($n))
{
$n();
}
}
}
}
//
//is there any notes
//
$NOTES_CUP = false;
if ($complete_update || defined('DEV_STAGE'))
{
if (isset($update_notes) && sizeof($update_notes) > 0)
{
$i =1;
$NOTES_CUP = [];
foreach ($update_notes as $n)
{
$NOTES_CUP[$i] = $n;
++$i;
}
}
$sql = "UPDATE `{$dbprefix}config` SET `value` = '" . LAST_DB_VERSION . "' WHERE `name` = 'db_version'";
$SQL->query($sql);
}
}
echo gettpl('update_end.html');
}
echo gettpl('update_end.html');
}
break;
}