示例#1
0
/**
 *  XML ответ на pay запрос
 */
function uc_onpay_answerpay($type, $code, $pay_for, $order_amount, $order_currency, $text, $onpay_id, $key)
{
    $md5 = strtoupper(md5("{$type};{$pay_for};{$onpay_id};{$pay_for};{$order_amount};{$order_currency};{$code};{$key}"));
    $text = encodestring($text);
    echo iconv('cp1251', 'utf-8', "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<result>\n<code>{$code}</code>\n <comment>{$text}</comment>\n<onpay_id>{$onpay_id}</onpay_id>\n <pay_for>{$pay_for}</pay_for>\n<order_id>{$pay_for}</order_id>\n<md5>{$md5}</md5>\n</result>");
    exit;
}
示例#2
0
function mdl_translit($val)
{
    $val = trim($val);
    if (!isset($val[0])) {
        return 'Не задана строка';
    }
    return encodestring($val);
}
示例#3
0
function urlgenerator($fkeys, $fcity, $fdomain)
{
    for ($i = 0; $i < count($fkeys); $i++) {
        for ($j = 0; $j < count($fcity); $j++) {
            $res = encodestring(trim($fkeys[$i]) . "-" . trim($fcity[$j]) . "-{$i}-{$j}");
            $res = "http://" . str_replace(" ", "-", $res) . ".{$fdomain}";
            #echo "&lta href=\"$res\"&gt".trim($fkeys[$i])." ".trim($fcity[$j])."&lt/a&gt<br>";
        }
    }
}
 /**
  * @param DleTags $objDleTags The DB ORM object to process
  */
 protected function process_object($objDleTags)
 {
     $objWpTerms = WpTerms::LoadBySlug($objDleTags->Tag);
     if (!$objWpTerms) {
         // It does not work. even with an appropriate setlocale call and with ISO-8859-1//TRANSLIT too
         //				$strSlug = iconv(QApplication::$EncodingType, 'US-ASCII//TRANSLIT', $objDleTags->Tag);
         $strSlug = encodestring($objDleTags->Tag);
         $objWpTerms = WpTerms::LoadBySlug($strSlug);
         if (!$objWpTerms) {
             // This tag was not copied yet.
             $objWpTerms = new WpTerms();
             $objWpTerms->Initialize();
             // set defaults
             $objWpTerms->Name = $objDleTags->Tag;
             // DLE does not has url-compartible tag name version. it uses the urlencoded from cp1251 one.
             // We do a translit enstead.
             $objWpTerms->Slug = $strSlug;
             $objWpTerms->TermGroup = 0;
             $objWpTerms->Save();
             $this->intTermCount++;
         }
     }
     // check if already copied
     $objWpTermTaxonomy = WpTermTaxonomy::LoadByTermIdTaxonomy($objWpTerms->TermId, "post_tag");
     if (!$objWpTermTaxonomy) {
         $objWpTermTaxonomy = new WpTermTaxonomy();
         $objWpTermTaxonomy->Initialize();
         // set defaults
         $objWpTermTaxonomy->TermId = $objWpTerms->TermId;
         $objWpTermTaxonomy->Description = $objWpTerms->Name;
         $objWpTermTaxonomy->Parent = 0;
         $objWpTermTaxonomy->Taxonomy = "post_tag";
         $objWpTermTaxonomy->Count = 0;
         $objWpTermTaxonomy->Save();
         $this->intTermTaxonomyCount++;
     }
     $objWpPosts = $objDleTags->News->LoadWpPosts();
     if (!$objWpPosts) {
         return;
     }
     $objWpTermRelationships = WpTermRelationships::LoadByObjectIdTermTaxonomyId($objWpPosts->Id, $objWpTermTaxonomy->TermTaxonomyId);
     // check if already copied
     if (!$objWpTermRelationships) {
         $objWpTermRelationships = new WpTermRelationships();
         $objWpTermRelationships->Initialize();
         // set defaults
         $objWpTermRelationships->ObjectId = $objWpPosts->Id;
         $objWpTermRelationships->TermTaxonomyId = $objWpTermTaxonomy->TermTaxonomyId;
         $objWpTermRelationships->TermOrder = 0;
         $objWpTermRelationships->Save();
         $this->intTermRelationshipsCount++;
     }
 }
function push_address($devices, $name, $address)
{
    $table_name = 'app_pushbullet';
    $rec = SQLSelectOne("SELECT * FROM {$table_name} WHERE name='{$devices}'");
    if ($rec['ID']) {
        $p = new PushBullet($rec['apikey']);
        //в push выглядит верно, но на карте не открывает из-за не поддерживаемой кодировки:
        //$p->pushAddress($rec['iden'], $name, $address);
        //$p->pushAddress($rec['iden'], $name, mb_convert_encoding($address, 'utf8', mb_detect_encoding($address)));
        //$p->pushAddress($rec['iden'], $name, iconv(mb_detect_encoding($address), "UTF-8//TRANSLIT", $address));
        //адрес открывает на карте верно, но в push иероглифы:
        //$p->pushAddress($rec['iden'], $name, utf8_encode($address));
        //$p->pushAddress($rec['iden'], $name, mb_convert_encoding($address, 'utf8'));
        //будем использовать транслитерацию пока не починят:
        $p->pushAddress($rec['iden'], $name, encodestring($address));
    }
}
示例#6
0
 /**
  * Создает или перезаписывает наименования объектов для адресной строки
  * с помощью хелпера "text_helper" функции "encodestring";
  * 
  * @param string $type country|region|city
  * @param int $id id_object
  */
 function create_link_object_name($type, $id = "")
 {
     //Получаем данные
     switch ($type) {
         case 'country':
             $this->load->model('models/backend/persistence/Get_objects');
             $data = $this->Get_objects->get_country($id);
             if (!$data) {
                 return FALSE;
             }
             break;
         case 'region':
             $this->load->model('models/backend/persistence/Get_objects');
             $data = $this->Get_objects->get_regions($id);
             if (!$data) {
                 return FALSE;
             }
             break;
         case 'city':
             $this->load->model('models/backend/persistence/Get_objects');
             $data = $this->Get_objects->get_city($id);
             if (!$data) {
                 return FALSE;
             }
             break;
         default:
             return FALSE;
     }
     //Формируем,обрабатываем и енкодим
     $this->load->helper('text_helper');
     foreach ($data as $item) {
         $name_expl = explode('(', $item->name);
         $item->name = encodestring(trim($name_expl[0]), 'eng', 'url');
     }
     //Получить требуемые записи, сформировать массив, заенкодить, отдать на запись
     //Если там есть скобки, енкодить все что до скобок
     $this->load->model('backend/persistence/system/Objects_data');
     return $this->Objects_data->record_link_name($type, $data);
 }
 $cat_url = preg_replace('@.*?:-@smi', '', $cat_url);
 $dir = "export/" . encodestring($cat_name) . '_' . date('d-m-y');
 $fname = $dir . "/" . $cat_url . '_' . date('d-m-y') . '.csv';
 @mkdir($dir);
 $tmpz = explode('/', $_POST['dirz']);
 $full = '';
 foreach ($tmpz as $n) {
     $full .= '/' . $n;
     @mkdir($dir . $full);
 }
 $wr = substr($full, 1);
 //@mkdir($dir."/shop/");
 //@mkdir($dir."/shop/images/");
 #@mkdir($dir."/resized/");
 @chmod($dir, 0777);
 $to = $to . "Артикул;Наименование (Русский);ID страницы (часть URL, используется в ссылках на эту страницу);Цена;Название вида налогов;Скрытый;Можно купить;Старая цена;На складе;Продано;Описание (Русский);Краткое описание (Русский);Сортировка;Заголовок страницы (Русский);Тэг META keywords (Русский);Тэг META description (Русский);Стоимость упаковки;Вес продукта;Бесплатная доставка;Ограничение на минимальный заказ продукта (штук);Файл продукта;Количество дней для скачивания;Количество загрузок (раз);Фотография;Фотография;\n\n        ;" . $cat_name . ";" . encodestring($cat_name) . ";\n";
 $f = fopen($fname, 'a+');
 fwrite($f, $to);
 fclose($f);
 $q = mysql_query("select * from `product` where `cat_id` = '" . $cat_id . "'") or die(mysql_error());
 $i = 0;
 while ($q_r = mysql_fetch_assoc($q)) {
     $pr[$i] = $q_r;
     $i++;
 }
 if ($_POST['rand'] == 'on') {
     shuffle($pr);
 }
 //print_r($pr);die();
 $j = rand(0, 99) + time();
 foreach ($pr as $p) {
示例#8
0
 function z_add()
 {
     $obj = new stdClass();
     $today = date("Y-m-d H:i:s");
     echo $today;
     $obj->parent = $this->ZayavkaParent;
     $obj->template = $this->ZayavkaTemplate;
     $obj->TV['z_cauta_nomer'] = $_GET['z_cauta_nomer'];
     $obj->TV['z_cruis_id'] = $_GET['z_cruis_id'];
     $obj->TV['z_info'] = $_GET['z_info'];
     $obj->TV['z_user_email'] = $_GET['z_user_email'];
     $obj->TV['z_user_name'] = $_GET['z_user_name'];
     $obj->TV['z_user_phone'] = $_GET['z_user_phone'];
     $obj->TV['z_date'] = $today;
     $obj->TV['z_status'] = 'Новая';
     $cruis = GetPageInfo($obj->TV['z_cruis_id']);
     $ship = GetPageInfo($cruis->parent);
     $obj->TV['z_ship_id'] = $ship->id;
     $obj->pagetitle = "z_" . rand(5, 60) . "_" . $obj->TV['z_user_name'] . "_" . $obj->TV['z_ship_id'] . "_" . $obj->TV['z_cruis_id'] . "_" . $obj->TV['z_cauta_nomer'];
     //$obj->pagetitle=$ship;
     $obj->alias = encodestring($obj->pagetitle);
     $obj->url = "zayavki/" . $obj->alias . ".html";
     IncertPage($obj);
 }
示例#9
0
        $rulesFids['body_page_type'] = intval($newArray['page']['page_type']);
        $sql = $NBS->add($rulesFids);
        $db = new MySQL(DB_SERVER, DB_USER, DB_PASSWORD, DB_DATABASE);
        $db->query($sql);
        $NBS->setTable(TB_FILTER);
        $ruleID = $db->lastid();
        if ($newArray['filter_list']['filter']) {
            if ($newArray['filter_list']['filter'][0]) {
                foreach ($newArray['filter_list']['filter'] as $val) {
                    $tmpFilterFids['filter_multi'] = intval($val['filter_multi']);
                    $tmpFilterFids['filter_enter'] = intval($val['filter_enter']);
                    $tmpFilterFids['filter_rule'] = addslashes(encodestring($val['filter_area']));
                    $tmpFilterFids['filter_name'] = addslashes($val['filter_name']);
                    $tmpFilterFids['rule_id'] = $ruleID;
                    $sql = $NBS->add($tmpFilterFids);
                    $db->query($sql);
                }
            } else {
                $tmpFilterFids['filter_multi'] = intval($newArray['filter_list']['filter']['filter_multi']);
                $tmpFilterFids['filter_enter'] = intval($newArray['filter_list']['filter']['filter_enter']);
                $tmpFilterFids['filter_rule'] = addslashes(encodestring($newArray['filter_list']['filter']['filter_area']));
                $tmpFilterFids['filter_name'] = addslashes($newArray['filter_list']['filter']['filter_name']);
                $tmpFilterFids['rule_id'] = $ruleID;
                $sql = $NBS->add($tmpFilterFids);
                $db->query($sql);
            }
        }
        showloading('?module=listRules', '导入采集器配置', '采集器: ' . $_POST['ruleName'] . ' 导入成功,现在返回采集器列表.');
        $tpShowBody = false;
    }
}
示例#10
0
function rus2translit($string)
{
    $converter = array('а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'g', 'д' => 'd', 'е' => 'e', 'ё' => 'e', 'ж' => 'zh', 'з' => 'z', 'и' => 'i', 'й' => 'y', 'к' => 'k', 'л' => 'l', 'м' => 'm', 'н' => 'n', 'о' => 'o', 'п' => 'p', 'р' => 'r', 'с' => 'c', 'т' => 't', 'у' => 'u', 'ф' => 'f', 'х' => 'h', 'ц' => 'c', 'ч' => 'ch', 'ш' => 'sh', 'щ' => 'sch', 'ь' => '\'', 'ы' => 'y', 'ъ' => '\'', 'э' => 'e', 'ю' => 'yu', 'я' => 'ya', 'А' => 'A', 'Б' => 'B', 'В' => 'V', 'Г' => 'G', 'Д' => 'D', 'Е' => 'E', 'Ё' => 'E', 'Ж' => 'Zh', 'З' => 'Z', 'И' => 'I', 'Й' => 'Y', 'К' => 'K', 'Л' => 'L', 'М' => 'M', 'Н' => 'N', 'О' => 'O', 'П' => 'P', 'Р' => 'R', 'С' => 'C', 'Т' => 'T', 'У' => 'U', 'Ф' => 'F', 'Х' => 'H', 'Ц' => 'C', 'Ч' => 'Ch', 'Ш' => 'Sh', 'Щ' => 'Sch', 'Ь' => '_', 'Ы' => 'Y', 'Ъ' => '_', 'Э' => 'E', 'Ю' => 'Yu', 'Я' => 'Ya');
    return strtr($string, $converter);
}
$uploadfile = $_SERVER['DOCUMENT_ROOT'] . "/snipets/business_sale.csv";
$import_file = file_get_contents($uploadfile);
$import_file = explode("|", $import_file);
//массив тв
$tvs = array("old_id", "row_sort", "nazvanie", "user_id", "stoimost", "razm_stoimosti", "opf", "dolya", "tip", "proizv", "srok", "kolsot", "uppersonal", "mestopolojenie", "nalogrejim", "dolg", "invest", "prichini", "nedvijimost", "tep", "moshnosti", "sert", "status", "kommentarii", "konsult", "contact", "date_in", "fastsale", "vid", "inner_id", "tehhar", "fondzp", "prichina", "okypaemost", "nemact", "place", "district", "areatype", "prodano", "special_offer", "special_offer_price", "leasing", "valuation", "vimeo_vid_id", "district", "areatype", "vid_name");
foreach ($import_file as $csvString) {
    $csvArray = explode("#", $csvString);
    //Создаем страницу и записываем параметры
    $product = $modx->newObject('modResource');
    $product->set('pagetitle', $csvArray['2']);
    $product->set('template', 2);
    $product->set('published', 1);
    $product->set('alias', encodestring($csvArray['0'] . "_" . $csvArray['2'] . rand(1, 90000)));
    $product->set('parent', 2);
    $product->setContent('[[*id]][[*opf]]');
    $product->save();
    //пихаем тв
    foreach ($csvArray as $tvNum => $tvValue) {
        if (!$product->setTVValue($tvs[$tvNum], preg_replace('/(^"|"$)/', '', $tvValue))) {
            echo "Не вставляицо тв: {$tvs[$tvNum]} - {$tvValue}";
        } else {
            //echo "Не вставляицо тв: {$tvs[$tvNum]} - {".preg_replace('/(^"|"$)/', '', $tvValue)."}";
        }
        $product->save();
    }
}
示例#11
0
                echo $error;
                ?>
" />
								</form>
							</body>
							<script language="javascript" type="text/javascript">
								document.frm.submit();
							</script>
						</html>
				<?php 
            } else {
                // update
                if ($_SESSION['session_adminID'] != $AdminID) {
                    $qry = " ,AdminRole='" . $AdminRole . "',Status='" . $Status . "'";
                }
                $SQL = "UPDATE admin set UserName='******',Password='******',FirstName='" . $FirstName . "',LastName='" . $LastName . "',Email='" . $Email . "' " . $qry . " WHERE AdminID='" . $AdminID . "'";
                $objDB->sql_query($SQL);
                $success = "Admin Updated SuccessFully";
                $_SESSION['success'] = $success;
                $_SESSION['check'] = 'edit';
                header("Location:" . $AbsoluteURL . "xstore-admin/index.php?p=admin_list");
                exit;
            }
        }
    }
    if ($a == 'delete' && $AdminID != '0') {
        $SQL = "delete from admin where AdminID=" . $AdminID;
        $rsAdmin = $objDB->sql_query($SQL);
        $success = "Admin Deleted SuccessFully";
        $_SESSION['success'] = $success;
        $_SESSION['check'] = 'add';
示例#12
0
use yii\helpers\Html;
use yii\widgets\ListView;
function encodestring($string)
{
    $table = array('А' => 'A', 'Б' => 'B', 'В' => 'V', 'Г' => 'G', 'Д' => 'D', 'Е' => 'E', 'Ё' => 'YO', 'Ж' => 'ZH', 'З' => 'Z', 'И' => 'I', 'Й' => 'J', 'К' => 'K', 'Л' => 'L', 'М' => 'M', 'М' => 'N', 'О' => 'O', 'П' => 'P', 'Р' => 'R', 'С' => 'S', 'Т' => 'T', 'У' => 'U', 'Ф' => 'F', 'Х' => 'H', 'Ц' => 'C', 'Ч' => 'CH', 'Ш' => 'SH', 'Щ' => 'CSH', 'Ь' => '', 'Ы' => 'Y', 'Ъ' => '', 'Э' => 'E', 'Ю' => 'YU', 'Я' => 'YA', 'а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'g', 'д' => 'd', 'е' => 'e', 'ё' => 'yo', 'ж' => 'zh', 'з' => 'z', 'и' => 'i', 'й' => 'j', 'к' => 'k', 'л' => 'l', 'м' => 'm', 'н' => 'n', 'о' => 'o', 'п' => 'p', 'р' => 'r', 'с' => 's', 'т' => 't', 'у' => 'u', 'ф' => 'f', 'х' => 'h', 'ц' => 'c', 'ч' => 'ch', 'ш' => 'sh', 'щ' => 'csh', 'ь' => '', 'ы' => 'y', 'ъ' => '', 'э' => 'e', 'ю' => 'yu', 'я' => 'ya');
    $output = str_replace(array_keys($table), array_values($table), $string);
    return $output;
}
/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Альбом ' . $album->title;
$gridColumns = ['id', ['attribute' => 'title', 'content' => function ($model, $key, $index, $column) {
    return Html::a($model->title, ['album/list-images', 'id' => $model->id]);
}], 'alias'];
?>
<h3>Альбом <?php 
echo $album->title;
?>
</h3>
<div class="images-list">

    <?php 
echo ListView::widget(['dataProvider' => $dataProvider, 'itemView' => '_image']);
?>

</div>

<?php 
echo encodestring($this->title);
示例#13
0
 function ImportUsers()
 {
     global $modx;
     global $table_prefix;
     $uploadfile = "/var/www/virtual-hosts/delo-bg63.aktiwork.ru/snipets/expor_users.csv";
     //херим данные в таблице s_products
     $tmpFile = '/var/www/virtual-hosts/delo-bg63.aktiwork.ru/snipets/tmp.sql';
     //unlink($tmpFile);
     //$fp = fopen($uploadfile, "r"); // Открываем файл в режиме чтения
     $import_file = file_get_contents($uploadfile);
     $import_file = explode("|", $import_file);
     $count = 0;
     $start = true;
     //modx_site_tmplvar_templates - содежит связь между полями и шаблонами
     //modx_site_tmplvar_contentvalues - содежит значения полей в странице
     //modx_site_tmplvars - поля
     //modx_site_content - страницы
     //
     $modx_category_tv = 9;
     // while (!feof($fp))
     foreach ($import_file as $key1 => $mytext) {
         //$kkk++;
         // $kk++;
         //$mytext = fgets($fp);
         $tt = explode("#", $mytext);
         echo "<pre>";
         print_r($tt);
         echo "</pre>";
         //Заголовок
         if ($start) {
             $start = false;
             //Формируем TV
             foreach ($tt as $key => $value) {
                 $value = mysql_escape_string($value);
                 $property[$key] = 0;
                 $sql_tpl_var = "select id from " . $table_prefix . "site_tmplvars where name='" . $value . "'";
                 foreach ($modx->query($sql_tpl_var) as $row_tpl_var) {
                     $property[$key] = $row_tpl_var['id'] + 0;
                 }
                 if ($property[$key] == 0) {
                     $sql_tplvar = "INSERT INTO " . $table_prefix . "site_tmplvars\n(type, name, caption, description,category) VALUES ('text', '{$value}', '{$value}', ''," . $modx_category_tv . ");";
                     $modx->query($sql_tplvar);
                     $property[$key] = $modx->lastInsertId();
                     echo $sql_tplvar . "<br>";
                 }
             }
         } else {
             //импортируем страницы
             $parent = 1120;
             $template = 12;
             //Ищем такую страницу
             $pagetitle = mysql_escape_string($tt[0]) . " " . mysql_escape_string($tt[1]) . " " . mysql_escape_string($tt[2]);
             $alias = encodestring(mysql_escape_string($tt[0]) . "_" . mysql_escape_string($tt[1]) . "_" . mysql_escape_string($tt[2]));
             $url = "users/" . $alias . ".html";
             $product_id = 0;
             $sql_page = "select * from " . $table_prefix . "site_content where pagetitle='" . mysql_escape_string($pagetitle) . "'";
             echo $sql_page;
             foreach ($modx->query($sql_page) as $row_page) {
                 $product_id = $row_page['id'];
             }
             if ($product_id == 0) {
                 $sql_product = "INSERT INTO " . $table_prefix . "site_content\n(id, type, contentType, pagetitle, longtitle,\ndescription, alias, link_attributes,\npublished, pub_date, unpub_date, parent,\nisfolder, introtext, content, richtext,\ntemplate, menuindex, searchable,\ncacheable, createdby, createdon,\neditedby, editedon, deleted, deletedon,\ndeletedby, publishedon, publishedby,\nmenutitle, donthit, privateweb, privatemgr,\ncontent_dispo, hidemenu, class_key, context_key,\ncontent_type, uri, uri_override, hide_children_in_tree,\nshow_in_tree, properties)\nVALUES (NULL, 'document', 'text/html', '" . $pagetitle . "', '', '', '" . encodestring(mysql_escape_string($articul . "-" . $pagetitle)) . "',\n'', true, 0, 0, " . $parent . ", false, '', '', true, " . $template . ", 1, true, true, 1, 1421901846, 0, 0, false, 0, 0, 1421901846, 1, '',\nfalse, false, false, false, false, 'modDocument', 'web', 1,\n '" . $url . "', false, false, true, null\n );\n\n;";
                 echo "------------------------------------------------------";
                 echo "--------------------- ПРОДУКТ ------------------------";
                 echo $sql_product . "<br>";
                 $modx->query($sql_product);
                 $product_id = $modx->lastInsertId();
             }
             //Теперь свойства
             //СОВЙСТВА
             $page_property = null;
             foreach ($tt as $key => $value) {
                 //Ищем есть ли уже такое свойство
                 $tv_id = 0;
                 $sql_tv = "select * from " . $table_prefix . "site_tmplvar_contentvalues where\n (tmplvarid='" . $property[$key] . "')and(contentid='{$product_id}')\n\n";
                 foreach ($modx->query($sql_tv) as $row_tv) {
                     $tv_id = $row_tv['id'];
                 }
                 if ($tv_id == 0) {
                     $sql_modx_vars = "INSERT INTO " . $table_prefix . "site_tmplvar_contentvalues\n(tmplvarid,contentid,value) VALUES ('" . $property[$key] . "','{$product_id}','{$value}');";
                     echo $sql_modx_vars . "<br>";
                     $modx->query($sql_modx_vars);
                 } else {
                     $sql_modx_vars = "update " . $table_prefix . "site_tmplvar_contentvalues\n            set value='{$value}' where  (tmplvarid='" . $property[$key] . "')and(contentid='{$product_id}')";
                     echo $sql_modx_vars . "<br>";
                     $modx->query($sql_modx_vars);
                 }
                 //modx_site_tmplvar_templates - содежит связь между полями и шаблонами
                 //modx_site_tmplvar_contentvalues - содежит значения полей в странице
                 //modx_site_tmplvars - поля
                 //modx_site_content - страницы
             }
         }
         // echo $mytext . "<br />";
         $count++;
         // echo $sql."<br>";
         // $query = $modx->query($sql);
         // echo "---------------------------------------------<br>";
         //  fwrite($fh, $sql);
     }
     //
     //else echo "Ошибка при открытии файла";
     //fclose($fp);
     //fclose($fh);
     echo "Итого: " . $count . "<br>";
     //$cmd='mysql -u '.$database_user.' -p'.$database_password.' '.$database_user.' < '.$tmpFile;
     //echo $cmd;
     //exec($cmd);
 }
示例#14
0
$pg = loadVariable("pg", "");
$bLoggedIn = loadVariable("bLoggedIn", "");
if ($bLoggedIn == 1) {
    $pg = "home";
    $_SESSION["session_adminID"] = $rsUser[0]['AdminID'];
    header("location:index.php?pg='" . $pg . "'");
} else {
    switch ($p) {
        case 'login':
            $heading = "Login";
            switch ($a) {
                case "login":
                    if (loadVariable("UserName", "") != "" && loadVariable("Password", "") != "") {
                        // Get user details
                        $SQL = "Select * from admin where UserName = '******' and Password = '******'";
                        $rsUser = $objDB->select($SQL);
                        if (count($rsUser) <= 0) {
                            $error .= "Your username or password is invalid, please try again.<br>";
                        } elseif ($rsUser[0]["Status"] != 1) {
                            $error .= "Your account is Inactive.<br>";
                        } else {
                            if ($rsUser[0]['Status'] == '1') {
                                $_SESSION["session_adminID"] = $rsUser[0]['AdminID'];
                                $sql = "update admin set LastLogin = '******'Y-m-d H:i:s') . "' where AdminID = '" . $_SESSION["session_adminID"] . "'";
                                $update = $objDB->sql_query($sql);
                                header("Location: index.php?p=home");
                            } else {
                                $error .= "Somthing Wrong.<br>";
                            }
                        }
示例#15
0
 } else {
     //импортируем страницы
     $parent = 2;
     $template = 2;
     //Ищем такую страницу
     $pagetitle = mysql_escape_string($tt[2]);
     $alias = encodestring($tt[0] . "_" . $tt[2]);
     $url = "prodazha/" . $alias . ".html";
     $product_id = 0;
     $sql_page = "select * from " . $table_prefix . "site_content where pagetitle='" . mysql_escape_string($pagetitle) . "'";
     echo $sql_page;
     foreach ($modx->query($sql_page) as $row_page) {
         $product_id = $row_page['id'];
     }
     if ($product_id == 0) {
         $sql_product = "INSERT INTO " . $table_prefix . "site_content\n(id, type, contentType, pagetitle, longtitle,\ndescription, alias, link_attributes,\npublished, pub_date, unpub_date, parent,\nisfolder, introtext, content, richtext,\ntemplate, menuindex, searchable,\ncacheable, createdby, createdon,\neditedby, editedon, deleted, deletedon,\ndeletedby, publishedon, publishedby,\nmenutitle, donthit, privateweb, privatemgr,\ncontent_dispo, hidemenu, class_key, context_key,\ncontent_type, uri, uri_override, hide_children_in_tree,\nshow_in_tree, properties)\nVALUES (NULL, 'document', 'text/html', '" . $pagetitle . "', '', '', '" . encodestring(mysql_escape_string($articul . "-" . $pagetitle)) . "',\n'', true, 0, 0, " . $parent . ", false, '', '', true, " . $template . ", 1, true, true, 1, 1421901846, 0, 0, false, 0, 0, 1421901846, 1, '',\nfalse, false, false, false, false, 'modDocument', 'web', 1,\n '" . $url . "', false, false, true, null\n );\n\n;";
         echo "------------------------------------------------------";
         echo "--------------------- ПРОДУКТ ------------------------";
         echo $sql_product . "<br>";
         $modx->query($sql_product);
         $product_id = $modx->lastInsertId();
     }
     //Теперь свойства
     //СОВЙСТВА
     $page_property = null;
     foreach ($tt as $key => $value) {
         //Ищем есть ли уже такое свойство
         $tv_id = 0;
         $sql_tv = "select * from " . $table_prefix . "site_tmplvar_contentvalues where\n (tmplvarid='" . $property[$key] . "')and(contentid='{$product_id}')\n\n";
         foreach ($modx->query($sql_tv) as $row_tv) {
             $tv_id = $row_tv['id'];
示例#16
0
                echo $error;
                ?>
" />
								</form>
							</body>
							<script language="javascript" type="text/javascript">
								document.frm.submit();
							</script>
						</html>
				<?php 
            } else {
                // update
                if ($_SESSION['session_adminID'] != $UserId) {
                    $qry = ",Status='" . $Status . "'";
                }
                $SQL = "UPDATE user set email='" . $Email . "',password='******',firstname='" . $FirstName . "',lastname='" . $LastName . "' " . $qry . " WHERE UserId='" . $UserId . "'";
                $objDB->sql_query($SQL);
                $success = "User Updated SuccessFully";
                $_SESSION['success'] = $success;
                $_SESSION['check'] = 'edit';
                header("Location:" . $AbsoluteURL . "xstore-admin/index.php?p=user_list");
                exit;
            }
        }
    }
    if ($a == 'delete' && $UserId != '0') {
        $SQL = "delete from user where UserId=" . $UserId;
        $rsAdmin = $objDB->sql_query($SQL);
        $success = "User Deleted SuccessFully";
        $_SESSION['success'] = $success;
        $_SESSION['check'] = 'add';
示例#17
0
 function PayWhenDeliveryDone()
 {
     $result['status'] = 'done';
     /*одготавливаем письмицо в конверте
       1 - заказчику
       2 - администратору
       */
     //$this->ClearCard();
     $card = $this->GetCard();
     print_r($card);
     $products = '';
     $summa = 0;
     foreach ($card as $product) {
         $products .= $product->id . "-" . $product->CardCount . "||";
         $summa += $product->TV['Price'] * $product->CardCount;
     }
     $user_delivery_address = mysql_escape_string($_GET['user_delivery_address']);
     $user_email = mysql_escape_string($_GET['user_email']);
     $user_name = mysql_escape_string($_GET['user_name']);
     $user_phone = mysql_escape_string($_GET['user_phone']);
     $obj = new stdClass();
     $obj->pagetitle = "z_" . rand(5, 60) . "_" . $user_name . "-" . $user_phone;
     $obj->parent = $this->z_parent;
     $obj->template = $this->z_template;
     $obj->TV['z_user_email'] = $user_email;
     $obj->TV['z_user_name'] = $user_name;
     $obj->TV['z_user_phone'] = $user_phone;
     $obj->TV['z_user_delivery_address'] = $user_delivery_address;
     $obj->TV['z_order_product_list'] = $products;
     $obj->TV['z_summa'] = $summa;
     $obj->alias = encodestring($obj->pagetitle);
     $obj->url = "zakazyi/" . $obj->alias . ".html";
     //echo json_encode($card);
     $order_id = IncertPage($obj);
     /*Получаем тело письма из шаблона*/
     include "tpl/tplCustomerEmail.php";
 }
示例#18
0
 function actSave()
 {
     global $ST, $post, $get;
     /*Сохранение*/
     if (!trim($post->get('mod_name'))) {
         echo printJSON(array('msg' => "Введите название! Сохранение невозможно", 'mod_id' => 0, 'mod_content_id' => $post->get('mod_content_id')));
         exit;
     }
     if ($post->get('mod_type') == 1) {
         //Текстовка
         if (!trim($post->get('mod_alias'))) {
             $post->set('mod_alias', '/' . encodestring($post->get('mod_name')) . "/");
         }
     } elseif ($post->get('mod_type') == 0) {
         if (!trim($post->get('mod_alias'))) {
             $post->set('mod_alias', '/' . encodestring($post->get('mod_module_name')) . "/");
         }
     }
     if (!trim($post->get('mod_alias')) && $post->get('mod_type') != 2) {
         echo printJSON(array('msg' => "Введите псевдоним! Сохранение невозможно", 'mod_id' => 0, 'mod_content_id' => $post->get('mod_content_id')));
         exit;
     }
     $content['c_text'] = $post->remove('mod_content');
     $post->set('mod_location', implode('|', $post->getArray('mod_location')));
     //		$post->set('mod_region',implode(',',$post->getArray('mod_region')));
     $post->set('mod_access', implode(',', $post->getArray('mod_access')));
     if ($post->get('mod_type') == 1) {
         $content['c_name'] = $post->get('mod_alias');
         $name = $content['c_name'];
         $i = 0;
         while (true) {
             //если нашли тектовое содержимое с таким названием но другим ид то переименуем согласно алгоритму
             $rs = $ST->select("SELECT * FROM sc_content WHERE c_name='" . SQL::slashes($name) . "' AND c_id!=" . $post->getInt('mod_content_id'));
             if ($rs->next()) {
                 $name = $content['c_name'] . '_' . ++$i;
             } else {
                 break;
             }
         }
         $content['c_name'] = $name;
         $post->set('mod_module_name', '');
         //стираем название модуля
         if ($post->get('mod_content_id')) {
             $rs = $ST->select("SELECT * FROM sc_content WHERE c_id=" . $post->getInt('mod_content_id'));
             if ($rs->next()) {
                 $ST->update('sc_content', $content, 'c_id=' . $post->getInt('mod_content_id'));
             } else {
                 $c_id = $ST->insert('sc_content', $content, 'c_id');
                 $post->set('mod_content_id', $c_id);
             }
         } else {
             $c_id = $ST->insert('sc_content', $content, 'c_id');
             $post->set('mod_content_id', $c_id);
         }
     }
     if ($post->get('mod_type') == 2) {
         $post->set('mod_module_name', '');
     }
     $id = $post->getInt('mod_id');
     if (!$post->get('mod_state')) {
         $post->set('mod_state', 1);
     }
     if ($id) {
         $ST->update('sc_module', $post->get(), "mod_id=" . $id);
     } else {
         if ($post->get('mod_type') != 2) {
             $rs = $ST->select("SELECT * FROM sc_module WHERE mod_alias = '" . SQL::slashes($post->get('mod_alias')) . "' AND mod_type!=2");
             if ($rs->next()) {
                 echo printJSON(array('msg' => "Модуль с таким псевдонимом [{$post->get('mod_alias')}] уже существует ! Сохранение невозможно", 'mod_id' => 0, 'mod_content_id' => 0));
                 exit;
             }
         }
         if ($post->get('mod_id') == '0') {
             $post->remove('mod_id');
         }
         $id = $ST->insert('sc_module', $post->get(), 'mod_id');
         $queryStr = "UPDATE sc_module set mod_position=mod_id where mod_id=" . $id;
         $ST->executeUpdate($queryStr);
     }
     echo printJSON(array('msg' => 'Сохранено', 'mod_id' => $id, 'mod_content_id' => $post->get('mod_content_id'), 'mod_alias' => $post->get('mod_alias')));
     exit;
 }
<div class="goods">
    <?php 
$i = 0;
$i6 = 0;
$c = $this->getUriIntVal('catalog');
foreach ($catalog as $item) {
    $url = "/catalog/goods/{$item['id']}/" . encodestring($item['name']);
    if ($c) {
        $url = "/catalog/{$c}/goods/{$item['id']}/" . encodestring($item['name']);
    }
    ?>
<div class="item   <?php 
    if (isset($in_basket[$item['id']])) {
        ?>
changed<?php 
    }
    ?>
">
            <span class="in_basket">
                <?php 
    echo isset($in_basket[$item['id']]) ? $in_basket[$item['id']] : '';
    ?>
            </span>
            <div class="img_name_desc">
                <div class="lab">
                    <?php 
    if ($item['old_price'] && ($d = round(($item['price'] - $item['old_price']) / $item['old_price'] * 100))) {
        ?>
<span class="discount" title="Скидка"><?php 
        echo $d;
        ?>
示例#20
0
function UpdateModxStructure()
{
    global $modx;
    /*
        - 1 - удалеем все товары с макетами modx_template_category modx_template_product
        - 2 - обновляем autoincrement mysql
        - 3 - заполняем категории
        - 4 - заполняем товары
    INSERT INTO modx_site_content
    (id, type, contentType, pagetitle, longtitle,
            description, alias, link_attributes,
            published, pub_date, unpub_date, parent,
            isfolder, introtext, content, richtext,
            template, menuindex, searchable,
            cacheable, createdby, createdon,
            editedby, editedon, deleted, deletedon,
            deletedby, publishedon, publishedby,
            menutitle, donthit, privateweb, privatemgr,
            content_dispo, hidemenu, class_key, context_key,
            content_type, uri, uri_override, hide_children_in_tree,
            show_in_tree, properties)
            VALUES (NULL, 'document', 'text/html', 'О магазине', 'О магазине', '', 'o-magazine', '', true, 0, 0, 0, false, '', '', true, 2, 1, true, true, 1, 1421901846, 0, 0, false, 0, 0, 1421901846, 1, '', false, false, false, false, false, 'modDocument', 'web', 1, 'o-magazine.html', false, false, true, null);
    */
    // - 1 -
    $sql = "delete from modx_site_content where (template=3)or(template=4)";
    $modx->query($sql);
    // - 2 -
    $sql = "select (max(id)+1) a from modx_site_content";
    // $maxID=0;
    foreach ($modx->query($sql) as $row) {
        //echo  $sql. " ++ ".$row['cc']. " ++<br/>";
        $maxID = $row['a'] + 0;
    }
    $sql = "ALTER TABLE modx_site_content SET AUTO_INCREMENT=" . $maxID;
    $modx->query($sql);
    // - 3 -
    $sql = "select c1.id, c1.title,c1.longtitle,c1.parent,c2.title parent_title from s_category c1\n  left\n   join s_category c2\n  on c2.id=c1.parent\n\n  order by c1.parent";
    foreach ($modx->query($sql) as $row) {
        //echo  $sql. " ++ ".$row['cc']. " ++<br/>";
        $parent = modx_id_category;
        echo $parent . "<br>";
        $sql_parent = "select id from modx_site_content where  pagetitle='" . $row['parent_title'] . "';";
        foreach ($modx->query($sql_parent) as $row_parent) {
            $parent = $row_parent['id'];
        }
        echo $parent . "<br>";
        $sql_incert = "INSERT INTO modx_site_content\n(id, type, contentType, pagetitle, longtitle,\n        description, alias, link_attributes,\n        published, pub_date, unpub_date, parent,\n        isfolder, introtext, content, richtext,\n        template, menuindex, searchable,\n        cacheable, createdby, createdon,\n        editedby, editedon, deleted, deletedon,\n        deletedby, publishedon, publishedby,\n        menutitle, donthit, privateweb, privatemgr,\n        content_dispo, hidemenu, class_key, context_key,\n        content_type, uri, uri_override, hide_children_in_tree,\n        show_in_tree, properties)\n        VALUES (NULL, 'document', 'text/html', '" . $row['title'] . "', '" . $row['title'] . "', '', '" . encodestring($row['title']) . "',\n         '', true, 0, 0, " . $parent . ", false, '', '', true, " . modx_template_category . ", 1, true, true, 1, 1421901846, 0, 0, false, 0, 0, 1421901846, 1, '',\n         false, false, false, false, false, 'modDocument', 'web', 1, '" . encodestring($row['title']) . ".html', false, false, true, null);\n\n;";
        echo $sql_incert;
        $modx->query($sql_incert);
    }
    // - 4 -
    $sql = "select p.title, c.title title_category, m.id from s_products p\njoin s_category c\n  on p.category=c.id\n\n  join modx_site_content m\n  on m.pagetitle=c.title;";
    foreach ($modx->query($sql) as $row) {
        $sql_incert = "INSERT INTO modx_site_content\n    (id, type, contentType, pagetitle, longtitle,\n            description, alias, link_attributes,\n            published, pub_date, unpub_date, parent,\n            isfolder, introtext, content, richtext,\n            template, menuindex, searchable,\n            cacheable, createdby, createdon,\n            editedby, editedon, deleted, deletedon,\n            deletedby, publishedon, publishedby,\n            menutitle, donthit, privateweb, privatemgr,\n            content_dispo, hidemenu, class_key, context_key,\n            content_type, uri, uri_override, hide_children_in_tree,\n            show_in_tree, properties)\n            VALUES (NULL, 'document', 'text/html', '" . $row['title'] . "', '" . $row['title'] . "', '', '" . encodestring($row['title']) . "',\n             '', true, 0, 0, " . $row['id'] . ", false, '', '', true, " . modx_template_product . ", 1, true, true, 1, 1421901846, 0, 0, false, 0, 0, 1421901846, 1, '',\n             false, false, false, false, false, 'modDocument', 'web', 1, '" . encodestring($row['title']) . ".html', false, false, true, null);\n\n    ;";
        echo $sql_incert;
        $modx->query($sql_incert);
    }
    $sql = "\nupdate s_products p1,(select * from modx_site_content o\n        ) t1\n  set p1.doc_id=t1.id, p1.category=t1.parent\n  where p1.title=t1.pagetitle;";
    $modx->query($sql);
    $sql = "\nupdate s_category p1,(select * from modx_site_content o\n        ) t1\n  set p1.doc_id=t1.id\n  where p1.title=t1.pagetitle;";
    $modx->query($sql);
}