+
+
+ Manage Templates
+
+
+
+ ";
+ public $edit_raw = "
+
+ |
+
+ |
+
+ {do} ({file}) |
+
+
+ |
+
+
+ ";
+
+ public $edit_area = "
+
+ Cansel
+ Save
+ Редактируем: {file}
+
+
+ ";
+
+ //public $dir_from = "/k2shop/k2shop/app/app/3dvisio/k23dvisio/";
+ public $dir_from = "/k2shop/usr/{temp}/php/";
+
+ public $dir_to = "/usr/{temp}/php/";
+
+ public $ext = "htm";
+
+
+
+ public function renderJS() {
+ global $k2;
+ //$k2->site->addJS('ckeditor.js',"/k2shop/k2shop/libs/ckeditor_test/ckeditor.js");
+ $rez = '';
+ return $rez;
+ }
+
+ /**
+ *
+ * @global type $k2
+ * @return type
+ */
+ function showComp(){
+ global $k2;
+ $rez='';
+
+ $dir = $k2->rootdir.$this->dir_from;
+ $dir = str_replace('{temp}', $k2->curtemplate, $dir);
+
+ $dirto = $k2->rootdir.$this->dir_to.$k2->post('file');
+
+ $rez .= $this->edit_form;
+
+ // Открыть заведомо существующий каталог и начать считывать его содержимое
+
+ if (is_dir($dir)) {
+ if ($dh = opendir($dir)) {
+ while (($file = readdir($dh)) !== false) {
+ $filetype = filetype($dir .'/'. $file);
+ if($filetype == "file") {
+ $info = new SplFileInfo($file);
+ $htm = $info->getExtension();
+ $filename = $info->getFilename();
+ if($this->ext !== ''){
+ if($htm == $this->ext){
+ $rez .= $this->edit_raw;
+ $rez = str_replace('{file}', $file, $rez);
+ $rez = str_replace('{do}', 'Main Template', $rez);
+ $rez = str_replace('{icon}', 'fa fa-object-group', $rez);
+ }
+ if($filename == 'userstyle.css'){
+ $rez .= $this->edit_raw;
+ $rez = str_replace('{file}', $file, $rez);
+ $rez = str_replace('{do}', 'Users Style', $rez);
+ $rez = str_replace('{icon}', 'fa fa-paint-brush', $rez);
+ }
+ }else{
+ $rez .= $this->edit_raw;
+ $rez = str_replace('{file}', $file, $rez);
+ }
+ }
+ }
+ closedir($dh);
+ }
+ }
+ $rez .= "
";
+
+
+ $rez .= $this->renderJS();
+ return $rez;
+ }
+
+ /**
+ * чтение шаблона
+ * @global type $k2
+ * @param type $tpl
+ * @return type
+ */
+ function readTpl($files = '')
+ {
+ global $k2;
+
+ $rez = '';
+ //echo $this->dir_to.$files;
+ $dir = $k2->rootdir.$this->dir_from;
+ $dir0 = $k2->rootdir.$this->dir_to;
+ $dir = str_replace('{temp}', $k2->curtemplate, $dir);
+ $dir0 = str_replace('{temp}', $k2->curtemplate, $dir0);
+ //echo $dir;
+ //echo $dir0;
+ if (file_exists($dir0.$files)){
+ $dir = $dir0;
+ //echo 32423;
+ }
+
+
+
+ $info = new SplFileInfo($files);
+ $htm = $info->getExtension();
+ try{
+ $rez = file_get_contents($dir.$files);
+ }catch(PDOException $e) {
+ echo "Error readTpl().file_get_contents().".$tpl."\n";
+ echo $e->getMessage();
+ }
+
+ return $rez;
+ }
+
+ function getFileTpl()
+ {
+ global $k2;
+ $files = $k2->post('file');
+ $theme = $this->readTpl($files);
+ $rez = $this->edit_area;
+ $rez = str_replace('{file}', $files, $rez);
+ $rez = str_replace('{fp}', $theme, $rez);
+
+ return $rez;
+
+ }
+
+
+ function saveFileTpl()
+ {
+ global $k2;
+ $files = $k2->post('file');
+ $info = new SplFileInfo($files);
+
+
+ $htm = $info->getExtension();
+
+ if($htm == 'css'){
+ $files = 'userstyle.css';
+ }
+ $filename = $k2->rootdir.$this->dir_to.$files;
+ $filename = str_replace('{temp}', $k2->curtemplate, $filename);
+
+ file_put_contents ($filename, '');
+
+ if ( is_writeable($filename) ){
+ $fh = fopen($filename, "w+");
+ $params_fm = ["<", ">", """, "#k2-3#?", "#k2-4#?"];
+ $params_to = ["<", ">", '"', '';
+
+ return $rez;
+ }
+
+ function showThemes()
+ {
+ global $k2;
+
+ $rez = $this->style;
+ $rez .= $this->renderJS();
+ $temp = $k2->ins_comp('k2siteadmin','templates');
+
+ $templatesArray = $temp->getThemes();
+
+ $rez .= $this->main_tpl;
+
+ foreach ($templatesArray as $value) {
+ $themes .= $this->theme_tpl;
+
+ if ($value['temp_active'] == 1){
+ $themes = str_replace('{buttons}', $this->button_edit, $themes);
+ } else {
+ $themes = str_replace('{buttons}', $this->button_act.' '.$this->button_del, $themes);
+ }
+ $themes = str_replace('{themeid}', $value['tempid'], $themes);
+ $themes = str_replace('{templatename}', $value['templatename'], $themes);
+ $themes = str_replace('{img_path}', '/'.$value['screenshot'], $themes);
+ }
+ $rez = str_replace('{theme}', $themes, $rez);
+ return $rez;
+ }
+
+ function showThemesTables()
+ {
+ global $k2;
+ $temp = $k2->ins_comp('k2siteadmin','templates');
+ $grid = $k2->ins_comp2('k2phpgrid', $this);
+
+ //echo $k2->curtemplate;
+
+ $this->Vars([
+ 'sel' => 'SELECT tempid, siteid, usl, templatename, comment_temp, temp_active, screenshot FROM k2temp WHERE siteid="'.$k2->site->siteid.'" ',
+ ]);
+ $arr = $this->loadResYML('temp');
+ $rez .= $grid->simpleTable($arr);
+
+ $arr = $this->loadResYML('temp_rel');
+ $rez .= $grid->simpleTable($arr);
+
+// $arr = $this->loadResYML('temp_group');
+// $rez .= $grid->simpleTable($arr);
+
+ return $rez;
+ }
+
+ function actTheme()
+ {
+ global $k2;
+ $temp = $k2->ins_comp('k2siteadmin','templates');
+
+ $rez = $temp->actThemes($k2->post('tempid'));
+ return $rez;
+ }
+
+ function delTheme()
+ {
+ return $rez;
+ }
+
+ function editTheme()
+ {
+ return $rez;
+ }
+
+ // Возвращаем контент
+ function content(){
+ global $k2;
+ if (!$rez = $k2->auth->isAdmin()) {
+ die('У Вас нет прав для редактирования!!!');
+ }
+ $event = $k2->get('event');
+ switch ($event)
+ {
+ case "act":
+ $rez = $this->actTheme();
+ break;
+ case "del":
+ $rez = $this->delTheme();
+ break;
+ case "edit":
+ $rez = $this->editTheme();
+ break;
+ default:
+ //$rez = $this->showThemes();
+ }
+
+ $rez .= $this->showThemesTables();
+ return $rez;
+ }
+
+
+}
\ No newline at end of file
diff --git a/k2shop/k2shop/app/app/k2/k2admineditor/lng/k2admineditor/en.csv b/k2shop/k2shop/app/app/k2/k2admineditor/lng/k2admineditor/en.csv
new file mode 100644
index 0000000..f00fe0d
--- /dev/null
+++ b/k2shop/k2shop/app/app/k2/k2admineditor/lng/k2admineditor/en.csv
@@ -0,0 +1,3 @@
+name| value
+lnTemplateEditor| Template Editor
+lnEdit| Edit
\ No newline at end of file
diff --git a/k2shop/k2shop/app/app/k2/k2admineditor/lng/k2admineditor/ru.csv b/k2shop/k2shop/app/app/k2/k2admineditor/lng/k2admineditor/ru.csv
new file mode 100644
index 0000000..342799c
--- /dev/null
+++ b/k2shop/k2shop/app/app/k2/k2admineditor/lng/k2admineditor/ru.csv
@@ -0,0 +1,3 @@
+name| value
+lnTemplateEditor| Внешний вид
+lnEdit| Редактировать
diff --git a/k2shop/k2shop/app/app/k2/k2admineditor/lng/k2admineditor/ua.csv b/k2shop/k2shop/app/app/k2/k2admineditor/lng/k2admineditor/ua.csv
new file mode 100644
index 0000000..a32371f
--- /dev/null
+++ b/k2shop/k2shop/app/app/k2/k2admineditor/lng/k2admineditor/ua.csv
@@ -0,0 +1,3 @@
+name| value
+lnTemplateEditor| Вигляд
+lnEdit| Редактор шаблону
\ No newline at end of file
diff --git a/k2shop/k2shop/app/app/k2/k2admineditor/lng/k2admineditor_edit/en.csv b/k2shop/k2shop/app/app/k2/k2admineditor/lng/k2admineditor_edit/en.csv
new file mode 100644
index 0000000..27201d9
--- /dev/null
+++ b/k2shop/k2shop/app/app/k2/k2admineditor/lng/k2admineditor_edit/en.csv
@@ -0,0 +1,5 @@
+name| value
+lnIPAddress| IP-address
+lnPort| Port
+lnSorting| Sorting
+lnChecked| Checked
\ No newline at end of file
diff --git a/k2shop/k2shop/app/app/k2/k2admineditor/lng/k2admineditor_edit/ru.csv b/k2shop/k2shop/app/app/k2/k2admineditor/lng/k2admineditor_edit/ru.csv
new file mode 100644
index 0000000..bf2192f
--- /dev/null
+++ b/k2shop/k2shop/app/app/k2/k2admineditor/lng/k2admineditor_edit/ru.csv
@@ -0,0 +1,5 @@
+name|value
+lnIPAddress| IP-адрес
+lnPort| Порт
+lnSorting| Сортировка
+lnChecked| Проверено
\ No newline at end of file
diff --git a/k2shop/k2shop/app/app/k2/k2admineditor/lng/k2admineditor_edit/ua.csv b/k2shop/k2shop/app/app/k2/k2admineditor/lng/k2admineditor_edit/ua.csv
new file mode 100644
index 0000000..f1b7cf2
--- /dev/null
+++ b/k2shop/k2shop/app/app/k2/k2admineditor/lng/k2admineditor_edit/ua.csv
@@ -0,0 +1,5 @@
+name| value
+lnIPAddress| IP-адреса
+lnPort| Порт
+lnSorting| Сортування
+lnChecked| Перевірено
\ No newline at end of file
diff --git a/k2shop/k2shop/app/app/k2/k2admineditor/lng/k2admineditor_themes/en.csv b/k2shop/k2shop/app/app/k2/k2admineditor/lng/k2admineditor_themes/en.csv
new file mode 100644
index 0000000..29d5d3f
--- /dev/null
+++ b/k2shop/k2shop/app/app/k2/k2admineditor/lng/k2admineditor_themes/en.csv
@@ -0,0 +1,6 @@
+name| value
+lnTemplates | Templates list for
+lnTempName | Name
+lnTempUls | Additional conditions
+lnTempComment | Comments
+lnTempActive | Active
\ No newline at end of file
diff --git a/k2shop/k2shop/app/app/k2/k2admineditor/lng/k2admineditor_themes/ru.csv b/k2shop/k2shop/app/app/k2/k2admineditor/lng/k2admineditor_themes/ru.csv
new file mode 100644
index 0000000..f610afa
--- /dev/null
+++ b/k2shop/k2shop/app/app/k2/k2admineditor/lng/k2admineditor_themes/ru.csv
@@ -0,0 +1,6 @@
+name|value
+lnTemplates | Шаблоны для сайта
+lnTempName | Название
+lnTempUls | Доп. условия
+lnTempComment | Комментарии
+lnTempActive | Активен
diff --git a/k2shop/k2shop/app/app/k2/k2admineditor/lng/k2admineditor_themes/ua.csv b/k2shop/k2shop/app/app/k2/k2admineditor/lng/k2admineditor_themes/ua.csv
new file mode 100644
index 0000000..d7a00c5
--- /dev/null
+++ b/k2shop/k2shop/app/app/k2/k2admineditor/lng/k2admineditor_themes/ua.csv
@@ -0,0 +1,17 @@
+name| value
+lmMenu| Меню
+lmName| Назва
+lnIdentifier| Ідентифікатор
+lnNote| Примітка
+lnOn| Увімкнути
+lnMenuItems| Елементи меню
+lnNameMenuItem| Назва пункту меню
+lnIdBeforeMenu| Id попер. меню
+lnCommand| Команда
+lnSorting| Сортування
+lnHint| Підказка
+lnHeader| Заголовок
+lnDescription| Опис
+lnKeywords| Ключові слова
+lnScript| Скрипт
+lnContent| Контент
\ No newline at end of file
diff --git a/k2shop/k2shop/app/app/k2/k2admineditor/res/info.yml b/k2shop/k2shop/app/app/k2/k2admineditor/res/info.yml
new file mode 100644
index 0000000..0b8fc9b
--- /dev/null
+++ b/k2shop/k2shop/app/app/k2/k2admineditor/res/info.yml
@@ -0,0 +1,6 @@
+comp_name: "k2admineditor"
+version: 1.1.1.1
+short_descr:
+description:
+comment:
+cena:
diff --git a/k2shop/k2shop/app/app/k2/k2admineditor/res/menu.yml b/k2shop/k2shop/app/app/k2/k2admineditor/res/menu.yml
new file mode 100644
index 0000000..35cefda
--- /dev/null
+++ b/k2shop/k2shop/app/app/k2/k2admineditor/res/menu.yml
@@ -0,0 +1,26 @@
+0:
+ category:
+ parent: root
+ name: k2admineditor
+ caption: <%lnTemplateEditor%>
+ iconclass: fa fa-database
+
+ elements:
+ editor:
+ name: k2admineditor_edit
+ caption: <%lnEdit%>
+ url: "?adm=k2admineditor_edit"
+ command:
+ iconclass:
+ themes:
+ name: site_themes
+ caption: Темы
+ url: "?adm=k2admineditor_themes"
+ command:
+ iconclass: fa fa-image
+ themes_group:
+ name: themes_group
+ caption: Группы тем
+ url: "?adm=k2admineditor_group"
+ command:
+ iconclass: fa fa-image
diff --git a/k2shop/k2shop/app/app/k2/k2admineditor/res/temp.yml b/k2shop/k2shop/app/app/k2/k2admineditor/res/temp.yml
new file mode 100644
index 0000000..58416b5
--- /dev/null
+++ b/k2shop/k2shop/app/app/k2/k2admineditor/res/temp.yml
@@ -0,0 +1,67 @@
+select: <%sel%>
+table: k2temp
+sortname: tempid
+typeid: 1
+height: 250
+detile: k2temp_rel
+sortorder: asc
+caption: "<%lnTemplates%>: <%sitename%>"
+fields:
+ 0:
+ field: tempid
+ caption: ID
+ width: 40
+ readonly: true
+ align: center
+
+ 1:
+ field: siteid
+ caption: ID
+ width: 40
+ readonly: false
+ hidden: true
+ def_value: <%siteid%>
+ align: center
+
+ 2:
+ field: templatename
+ caption: <%lnTempName%>
+ width: 250
+ readonly: false
+ type_field: DropDown
+ multy: false
+ sql:
+ SELECT temp_id as k, temp_name as v
+ FROM k2temp_list
+
+ 3:
+ field: usl
+ caption: <%lnTempUls%>
+ width: 250
+ readonly: false
+
+ 4:
+ field: comment_temp
+ caption: <%lnTempComment%>
+ width: 250
+ readonly: false
+
+ 5:
+ field: temp_active
+ caption: <%lnTempActive%>
+ width: 80
+ readonly: false
+ align: center
+ type_field: checkbox
+
+ screen:
+ field: screenshot
+ caption: Screenshot
+ width: 300
+ readonly: false
+ params:
+ height: 100
+ type_field: file
+ upload_dir: public/img
+ align: left
+
diff --git a/k2shop/k2shop/app/app/k2/k2admineditor/res/temp_group.yml b/k2shop/k2shop/app/app/k2/k2admineditor/res/temp_group.yml
new file mode 100644
index 0000000..401582d
--- /dev/null
+++ b/k2shop/k2shop/app/app/k2/k2admineditor/res/temp_group.yml
@@ -0,0 +1,25 @@
+select: SELECT temp_groupid, tempgroup_name FROM k2temp_group
+table: k2temp_group
+sortname: temp_groupid
+sortorder: asc
+height: 250px
+caption: Групи тем
+fields:
+ 0:
+ field: temp_groupid
+ caption: ID
+ width: 60
+ readonly: true
+ hidden: true
+ align: center
+ required: true
+
+ 1:
+ field: tempgroup_name
+ caption: Назва групи
+ width: 250
+ readonly: false
+ align: left
+
+
+
diff --git a/k2shop/k2shop/app/app/k2/k2admineditor/res/temp_rel.yml b/k2shop/k2shop/app/app/k2/k2admineditor/res/temp_rel.yml
new file mode 100644
index 0000000..7ad5bda
--- /dev/null
+++ b/k2shop/k2shop/app/app/k2/k2admineditor/res/temp_rel.yml
@@ -0,0 +1,43 @@
+select: SELECT temprelid, tempid, temp_groupid FROM k2temp_rel
+where: " where (tempid='{masterid}') "
+table: k2temp_rel
+height: 250
+sortname: temprelid
+sortorder: asc
+getmaster: true
+masterid: tempid
+caption: связь шаблонов
+fields:
+ 0:
+ field: temprelid
+ caption: ID
+ width: 60
+ hidden: true
+ readonly: true
+ align: center
+ required: true
+
+ 1:
+ field: tempid
+ caption: Шаблон
+ width: 250
+ readonly: true
+# hidden: true
+ type_field: DropDown
+ multy: false
+ sql:
+ SELECT tempid as k, templatename as v
+ FROM k2temp
+
+ 2:
+ field: temp_groupid
+ caption: Группа
+ width: 250
+ readonly: false
+ type_field: DropDown
+ multy: false
+ sql:
+ SELECT temp_groupid as k, tempgroup_name as v
+ FROM k2temp_group
+
+
diff --git a/k2shop/k2shop/app/app/k2/k2adminfunc/k2adminfunc.php b/k2shop/k2shop/app/app/k2/k2adminfunc/k2adminfunc.php
new file mode 100644
index 0000000..b3ce7ca
--- /dev/null
+++ b/k2shop/k2shop/app/app/k2/k2adminfunc/k2adminfunc.php
@@ -0,0 +1,45 @@
+loadResYML('menu');
+
+ return $arr;
+ }
+
+
+ // Обработка команд
+ function admCommands($comm){
+ global $k2;
+ $rez=false;
+
+ $s=$k2->getComp($comm);
+ if ($s[0]<>'k2adminfunc'){
+ return;
+ }
+
+ $comp=$k2->ins_comp($s[0], $s[1]);
+ if ($comp<>'')
+ echo $comp->content();
+
+ return $rez;
+ }
+
+
+
+}
\ No newline at end of file
diff --git a/k2shop/k2shop/app/app/k2/k2adminfunc/k2adminfunc_changedesign.php b/k2shop/k2shop/app/app/k2/k2adminfunc/k2adminfunc_changedesign.php
new file mode 100644
index 0000000..8163e75
--- /dev/null
+++ b/k2shop/k2shop/app/app/k2/k2adminfunc/k2adminfunc_changedesign.php
@@ -0,0 +1,59 @@
+get('id'));
+
+
+ $upd1 = "update k2admin_design set active=0 where (id<>$id)";
+ try{
+ $k2->db->exec($upd1);
+ }catch(PDOException $e) {
+ $rez.="Error SQL: $upd1\n";
+ $rez.=$e->getMessage();
+ }
+
+ $upd2 = "update k2admin_design set active=1 where (id=$id)";
+ try{
+ $k2->db->exec($upd2);
+ }catch(PDOException $e) {
+ $rez.="Error SQL: $upd2\n";
+ $rez.=$e->getMessage();
+ }
+
+ return $rez;
+ }
+
+ // Возвращаем контент
+ function content(){
+ global $k2;
+ $adm=$this->Translate("{lnAdministration}");
+ $settings=$this->Translate("{lnSiteSettings}");
+ $rez=$this->changeDesign();
+
+ $url=$_SERVER['PHP_SELF']."?adm=k2adminfunc_settings&category=$adm&itemmenu=$settings";
+ $rez.=header("Location:$url");
+
+ return $rez;
+
+ }
+
+
+}
diff --git a/k2shop/k2shop/app/app/k2/k2adminfunc/k2adminfunc_changepassword.php b/k2shop/k2shop/app/app/k2/k2adminfunc/k2adminfunc_changepassword.php
new file mode 100644
index 0000000..08e421e
--- /dev/null
+++ b/k2shop/k2shop/app/app/k2/k2adminfunc/k2adminfunc_changepassword.php
@@ -0,0 +1,264 @@
+
+
+ {err}
+
+
+ {oldpasswd}
+
+
+
+
+
+ ";
+
+
+ public $oldpaswd="
+ ";
+
+
+
+
+ public $err = ''; // Ошибка
+
+ protected $userid=''; // id пользователя, для которого сменяется пароль администратором
+
+
+ // Инициализация
+ function init_obj(){
+ global $k2;
+ if (!$k2->auth->isAuth()) {
+ die(''.$this->Translate("{lnRepeatNewPasswd}").' !');
+ }
+ }
+
+
+ // Форма смены пароля
+ function changePasswd(){
+ global $k2;
+ $rez=$this->change_form;
+
+ // Смена пароля самим пользователем
+ if ($this->userid<>''){
+ $rez = str_replace('{oldpasswd}', '', $rez);
+ }else{
+ $rez = str_replace('{oldpasswd}', $this->oldpaswd, $rez);
+ }
+
+ $rez=str_replace('{err}', $this->err, $rez);
+ $rez=str_replace('{NewPasswd}', $this->Translate("{lnNewPasswd}"), $rez);
+ $rez=str_replace('{RepeatNewPasswd}', $this->Translate("{lnRepeatNewPasswd}"), $rez);
+ $rez=str_replace('{OldPasswd}', $this->Translate("{lnOldPasswd}"), $rez);
+ $rez=str_replace('{Save}', $this->Translate("{lnSave}"), $rez);
+ return $rez;
+ }
+
+
+ // Проверка совпадения старого пароля
+ function isOldPasswordChecked($oldpasswd){
+ global $k2;
+ $rez=false;
+
+ $this->err .= '
*'. $this->Translate("{lnNotMatchPasswd}").'!
';
+
+ $login = $k2->auth->login;
+
+ if (trim($login)==''){
+ return false;
+ }
+
+ $sql = "select p.password
+ from k2users p
+ where p.login='$login'";
+
+ foreach ($k2->db->query($sql) as $value) {
+ $rez=$value['password']==md5($oldpasswd);
+ }
+
+
+ return $rez;
+ }
+
+ // Проверка корректности заполненности пароля
+ function check(){
+ global $k2;
+
+ $this->err = '';
+ $rez = true;
+
+
+
+ if ($k2->auth->isAuth()) {
+
+ if (trim($this->userid)==''){
+ if ($k2->post("oldpasswd") == '') {
+ $this->err .= '
* '. $this->Translate("{lnFillOldPasswd}").'.
';
+ $rez = false;
+ }else{
+ // Проверка совпадения старого пароля
+ if (!$this->isOldPasswordChecked($k2->post("oldpasswd"))){
+ $rez=false;
+ }
+ }
+ }
+
+
+ if ($k2->post("passwd1") == '') {
+ $this->err .= '
* '. $this->Translate("{lnFillNewPasswd}").'.
';
+ $rez = false;
+ }
+
+ if ($k2->post("passwd2") == '') {
+ $this->err .= '
* '. $this->Translate("{lnRepeatNewPasswd}").'.
';
+ $rez = false;
+ }
+
+ // Проверка одинаковости пароля
+ if ($k2->post("passwd2") <> $k2->post("passwd1")) {
+ $this->err .= '
**'. $this->Translate("{lnMustMatchPasswd}").'!
';
+ $rez = false;
+ }
+
+
+ }else{
+ $rez=false;
+ }
+
+ return $rez;
+
+ }
+
+
+
+ // Обновление личных данных
+ function updUser()
+ {
+ global $k2;
+
+ // Изменяем текущего пользователя
+ if (trim($this->userid)==''){
+ $login = $k2->auth->login;
+ }else{
+
+// if (!$k2->auth->isAdmin()){
+// die(''. $this->Translate("{lnNotPermittOperation}").'!');
+// }
+
+ $login = $this->userid;
+ }
+
+ if (trim($login)==''){
+ return '';
+ }
+
+ // Изменяем пароль только в том случае, если он указан
+ $passwdfield = '';
+ if ($k2->post("passwd1") != '' && $k2->post("passwd1") == $k2->post("passwd2")) {
+ $passwdfield = "password='" . md5(trim($k2->post("passwd1"))) . "' ";
+
+ $sql = "UPDATE k2users SET " . $passwdfield. " WHERE login='" . $login . "'";
+
+ try {
+ $k2->db->exec($sql);
+
+ // Выходим из системы, если изменения вносил администратор
+ if (trim($this->userid)==''){
+ $k2->auth->unLogin();
+ }
+
+ } catch (PDOException $e) {
+ echo "Ошибка изменения пароля: $sql\n";
+ echo $e->getMessage();
+ }
+
+
+ }
+
+ }
+
+
+
+
+ // Смена пароля
+ function change(){
+ global $k2;
+
+ $rez='';
+
+ if($k2->get('temp')=='ajax'){
+ $check = true;
+ } else {
+ $check = $this->check();
+ }
+
+ if ($check){
+ $rez.=$this->updUser();
+ }else{
+ $rez.=$this->changePasswd();
+ }
+
+ return $rez;
+
+ }
+
+
+
+ // Возвращаем контент
+ function content(){
+ global $k2;
+ $rez='';
+
+ $this->userid=$k2->get('userid');
+
+ $k2->site->pathway->addarr(array('/'=>$this->Translate("{lnMain}"), '/?p=auth'=>$this->Translate("{lnPersonalArea}"),'#'=>$this->Translate("{lnChangePasswd}")));
+ $k2->site->h1=$this->Translate("{lnChangePasswd}");
+
+
+ if ($k2->isPost()){
+ $rez=$this->change();
+ }else{
+ $rez.=$this->changePasswd();
+ }
+
+
+ return $rez;
+ }
+
+
+
+}
\ No newline at end of file
diff --git a/k2shop/k2shop/app/app/k2/k2adminfunc/k2adminfunc_createuser.php b/k2shop/k2shop/app/app/k2/k2adminfunc/k2adminfunc_createuser.php
new file mode 100644
index 0000000..26285b1
--- /dev/null
+++ b/k2shop/k2shop/app/app/k2/k2adminfunc/k2adminfunc_createuser.php
@@ -0,0 +1,35 @@
+ins_comp('k2auth','regform');
+ $rez = $authform->content();
+
+ return $rez;
+
+
+ }
+
+ // Возвращаем контент
+ function content(){
+ $rez = $this->createUserForm();
+ return $rez;
+ }
+
+
+}
\ No newline at end of file
diff --git a/k2shop/k2shop/app/app/k2/k2adminfunc/k2adminfunc_k2sysinfo.php b/k2shop/k2shop/app/app/k2/k2adminfunc/k2adminfunc_k2sysinfo.php
new file mode 100644
index 0000000..b465fe4
--- /dev/null
+++ b/k2shop/k2shop/app/app/k2/k2adminfunc/k2adminfunc_k2sysinfo.php
@@ -0,0 +1,33 @@
+(.*)