Пример #1
0
function encodestring($str)
{
    // переводим в транслит
    $str = rus2translit($str);
    // в нижний регистр
    $str = strtolower($str);
    // заменям все ненужное нам на "-"
    $str = preg_replace('~[^-a-z0-9_]+~u', '-', $str);
    // удаляем начальные и конечные '-'
    $str = trim($str, "-");
    return $str;
}
Пример #2
0
function SEO($text, $slash = false)
{
    $text = preg_replace('/ \\&\\#?[(0-9a-zA-Z){4}]+\\;/', '', $text);
    $text = remove_accents($text);
    $text = rus2translit($text);
    $entities_match = array('&quot;', '!', '@', '#', '%', '^', '&', '*', '_', '(', ')', '+', '{', '}', '|', ':', '"', '<', '>', '?', '[', ']', '\\', ';', '"', ',', '.', '/', '*', '+', '~', '`', '=', "'");
    $entities_replace = array('', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '');
    $clean_text = str_replace($entities_match, $entities_replace, $text);
    $clean_text = trim($clean_text);
    $clean_text = preg_replace('/ /', '-', $clean_text);
    if ($clean_text != '') {
        $slash = $slash ? '/' : NULL;
    }
    $clean_text = preg_replace('/\\-{2,10}/', '-', $clean_text);
    return $slash . $clean_text;
}
Пример #3
0
                    $stream = "";
                }
            }
        }
        include 'statistick/zagaln.php';
        $url = "arhiv/faculty/" . rus2translit($student[0][3]) . "/" . rus2translit($student[0][2]) . "/Semester " . rus2translit($student[0][4]) . "/Date " . $date;
        //-------------------------------//создаем новый архив
        if ($_POST['arhiv_rar'] == 'on') {
            if (@fopen($url . "/all.zip", "r")) {
                unlink($url . "/all.zip");
            }
            $archive = new PclZip("all.zip");
            $openDIR = opendir("arhiv/faculty/" . rus2translit($student[0][3]) . "/" . rus2translit($student[0][2]) . "/Semester " . rus2translit($student[0][4]) . "/Date " . $date);
            while ($scan = readdir($openDIR)) {
                if ($scan == '.' || $scan == '..') {
                    continue;
                }
                $archive->add("arhiv/faculty/" . rus2translit($student[0][3]) . "/" . rus2translit($student[0][2]) . "/Semester " . rus2translit($student[0][4]) . "/Date " . $date . "/" . $scan, PCLZIP_OPT_REMOVE_PATH, "arhiv/faculty/" . rus2translit($student[0][3]) . "/" . rus2translit($student[0][2]) . "/Semester " . rus2translit($student[0][4]));
            }
            rename("all.zip", "arhiv/faculty/" . rus2translit($student[0][3]) . "/" . rus2translit($student[0][2]) . "/Semester " . rus2translit($student[0][4]) . "/Date " . $date . "/all.zip");
        }
        echo "<br><div class='well'>";
        include "wood_script_old.php";
        echo "</div>";
    }
} else {
    header("Location: index.php");
}
?>
 
<script type="text/javascript" src="script/ser.js"></script>
Пример #4
0
 /**
  * Translit str to normal filename
  * Replace all wrong symbols to '-'
  *
  * @param string $str
  * @return string
  */
 public static function strToFilename($str)
 {
     $str = rus2translit($str);
     $str = strtolower($str);
     return preg_replace('~[^-a-z0-9_]+~u', '_', $str);
 }
Пример #5
0
        $variation_association = $wpdb->get_results("SELECT * FROM `wp_variation_associations` WHERE `id` = '{$variation_assoc_id}' LIMIT 1", ARRAY_A);
        if ($variation_association != null) {
            $variation_association = $variation_association[0];
            $variation_id = $variation_association['variation_id'];
            $delete_variation_sql = "DELETE FROM `wp_variation_associations` WHERE `id` = '{$variation_assoc_id}' LIMIT 1";
            $delete_value_sql = "DELETE FROM `wp_variation_values_associations` WHERE `product_id` = '{$product_id}' AND `variation_id` = '{$variation_id}'";
            $wpdb->query($delete_variation_sql);
            $wpdb->query($delete_value_sql);
            echo "<div class='updated'><p align='center'>" . TXT_WPSC_PRODUCTHASBEENEDITED . "</p></div>";
        }
    }
}
// edit product
if (isset($_POST['submit_action']) && $_POST['submit_action'] == "edit") {
    //transliterate file
    $_FILES['file']['name'] = rus2translit($_FILES['file']['name']);
    //rename the file
    $_FILES['file']['name'] = uniqid('', true) . $_FILES['file']['name'];
    $id = $_POST['prodid'];
    if (function_exists('edit_submit_extra_images')) {
        if ($_FILES['extra_image'] != null) {
            $var = edit_submit_extra_images($id);
        }
    }
    if (function_exists('edit_extra_images')) {
        $var = edit_extra_images($id);
    }
    //$basepath = str_replace("/wp-admin", "" , getcwd()); this defined at the top of the page
    $imagedir = $basepath . "/wp-content/plugins/wp-shopping-cart/images/";
    $product_images = $basepath . "/wp-content/plugins/wp-shopping-cart/product_images/";
    $filedir = $basepath . "/wp-content/plugins/wp-shopping-cart/files/";
Пример #6
0
                                <div class="overlay events"></div>
                                <img title="' . $item->eventLan->title . '" alt="' . $item->eventLan->title . '" class="cq-dd-image" src="';
    if ($item->eventPhotos[0]->photo_path427320 == '') {
        echo Yii::getAlias('@resource/img/news.jpg');
    } else {
        echo $item->eventPhotos[0]->photo_path427320;
    }
    echo '">
                                <figcaption>
                                    <h2>' . $item->eventLan->title . '</h2>
                                    <p>' . getdate(strtotime($item->start_timedate))['mday'] . ' ' . $daterus[getdate(strtotime($item->start_timedate))['mon']] . ' ' . getdate(strtotime($item->start_timedate))['year'] . '</p>
                                    <p class="cta">';
    if (Yii::$app->language == 'ru') {
        echo $item->place;
    } else {
        echo rus2translit($item->place);
    }
    echo '</p>
                                </figcaption>
                            </figure>
                        </a>
                    </div>
                </div>';
}
?>

    </section>

    <section>
        <div class="row">
            <div class="col-8 new_index">
Пример #7
0
if (empty($_POST['name']) || empty($_POST['text']) || empty($_POST['page'])) 
{
?>
Заполнены не все поля!
<?
exit;
}
$name = htmlspecialchars($_POST['name']);
$name = iconv( "utf-8", "windows-1251", $name);
$text = $_POST['text'];
$text = iconv( "utf-8", "windows-1251", $text);
$page = $_POST['page'];
$page = iconv( "utf-8", "windows-1251", $page);

$rusname = rus2translit($name); 

$rusname = strtolower($rusname); 

$date = time();
$proverka = mysql_query("SELECT * FROM pages WHERE page='"._filter($page)."'");
if(mysql_num_rows($proverka) >= 1)
{
m_error("Такая страница уже существует");
exit;
}
$send = mysql_query("INSERT INTO pages VALUES(NULL,'"._filter($name)."','"._filter2($text)."','"._filter($date)."','"._filter($page)."', '0')");

if ($send == 'true')
{
?>
Пример #8
0
for ($i=0;$i<count($discipline);$i++)
		{
		$plan = $contingent->select("select bvm.modulenum,gd.discipline,bvm.moduletheme,BT.SEMESTER from STUDENT2TESTLIST S2T
		    inner join B_TESTLIST BT on (BT.TESTLISTID = S2T.TESTLISTID) inner join B_VARIANT_ITEMS BVI_M on (BVI_M.VARIANTID = BT.VARIANTID) inner join b_variant_module bvm 
			on (BVI_M.VARIANTID = bvm.VARIANTID) inner join B_VARIANT_ITEMS BVI_V on (BVI_V.VARIANTID = BVI_M.PARENTVARIANTID) inner join guide_discipline gd
			on (BVI_V.disciplineid = gd.disciplineid) where BT.TESTLISTID=".$discipline[$i][2]."");
		$zag=$local->select("SELECT count(oc.oc) FROM `oc`,`to`,`zv` WHERE oc.name_user='******'role']."' AND oc.name_user=zv.name_user AND oc.name_user=to.name_user AND oc.num=".$discipline[$i][1]." AND oc.kod=zv.kod AND to.idstyd=zv.idstyd AND to.num=oc.num AND to.value='true';");
		if ($zag[0][0]==0){$zag2[0][0]=1;}else{$zag2[0][0]=$zag[0][0];}
		$o2=$local->select("SELECT count(oc.oc) FROM `oc`,`to`,`zv` WHERE oc.name_user='******'role']."' AND oc.name_user=zv.name_user AND oc.name_user=to.name_user AND oc.num=".$discipline[$i][1]." AND oc.kod=zv.kod AND to.idstyd=zv.idstyd AND to.num=oc.num AND ((to.value='true' AND oc='0(n)')or(to.value='true' AND oc='0'))");$o2=$o2[0][0]."(".(number_format($o2[0][0]/$zag2[0][0]*100,2))."%)";
		$o3=$local->select("SELECT count(oc.oc) FROM `oc`,`to`,`zv` WHERE oc.name_user='******'role']."' AND oc.name_user=zv.name_user AND oc.name_user=to.name_user AND oc.num=".$discipline[$i][1]." AND oc.kod=zv.kod AND to.idstyd=zv.idstyd AND to.num=oc.num AND to.value='true' AND oc>=4 AND oc<=6;");$o3=$o3[0][0]."(".(number_format($o3[0][0]/$zag2[0][0]*100,2))."%)";
		$o4=$local->select("SELECT count(oc.oc) FROM `oc`,`to`,`zv` WHERE oc.name_user='******'role']."' AND oc.name_user=zv.name_user AND oc.name_user=to.name_user AND oc.num=".$discipline[$i][1]." AND oc.kod=zv.kod AND to.idstyd=zv.idstyd AND to.num=oc.num AND to.value='true' AND oc>=7 AND oc<=9;");$o4=$o4[0][0]."(".(number_format($o4[0][0]/$zag2[0][0]*100,2))."%)";
		$o5=$local->select("SELECT count(oc.oc) FROM `oc`,`to`,`zv` WHERE oc.name_user='******'role']."' AND oc.name_user=zv.name_user AND oc.name_user=to.name_user AND oc.num=".$discipline[$i][1]." AND oc.kod=zv.kod AND to.idstyd=zv.idstyd AND to.num=oc.num AND to.value='true' AND oc>=10 AND oc<=12;");$o5=$o5[0][0]."(".(number_format($o5[0][0]/$zag2[0][0]*100,2))."%)";
		$ser_bal = $local->select("SELECT avg(oc.oc) FROM `oc`,`to`,`zv` WHERE oc.name_user='******'role']."' AND oc.name_user=zv.name_user AND oc.name_user=to.name_user AND oc.num=".$discipline[$i][1]." AND oc.kod=zv.kod AND to.idstyd=zv.idstyd AND to.num=oc.num AND to.value='true';");
		$styd = $local->select("SELECT zv.idstyd FROM `oc`,`to`,`zv` WHERE oc.name_user='******'role']."' AND oc.name_user=zv.name_user AND oc.name_user=to.name_user AND oc.num=".$discipline[$i][1]." AND oc.kod=zv.kod AND to.idstyd=zv.idstyd AND to.num=oc.num AND to.value='true';");	
		$pot=0;
						for ($x=0;$x<count($styd);$x++)
						{
						$plans = $contingent->select("select bvm.modulenum,gd.discipline,bvm.moduletheme,S2T.TESTLISTID,S2T.CREDITS_CUR from STUDENT2TESTLIST S2T
						inner join B_TESTLIST BT on (BT.TESTLISTID = S2T.TESTLISTID) inner join B_VARIANT_ITEMS BVI_M on (BVI_M.VARIANTID = BT.VARIANTID) inner join b_variant_module bvm 
						on (BVI_M.VARIANTID = bvm.VARIANTID) inner join B_VARIANT_ITEMS BVI_V on (BVI_V.VARIANTID = BVI_M.PARENTVARIANTID) inner join guide_discipline gd
						on (BVI_V.disciplineid = gd.disciplineid) where BT.TESTLISTID=".$discipline[$i][2]." AND S2T.STUDENTID=".$styd[$x][0]."");
						$pot=$pot+potochna($plans[0][4]);
						}
					if (count($styd)==0){$pot=0;$styd[0][0]=1;}
		$stream.="<tr><td>".($i+1)."</td><td>".course($student[0][4])."</td><td>".$plan[0][1]." - ".$plan[0][0].".".$plan[0][2]."</td><td>".$zag[0][0]."</td><td>".$o2."</td><td>".$o3."</td><td>".$o4."</td><td>".$o5."</td><td>".$ser_bal[0][0]."</td><td>".$pot/count($styd)."<td></td><td></td><td></td></tr>";
		}
$fp2=fopen("arhiv/faculty/".rus2translit($student[0][3])."/".rus2translit($student[0][2])."/Semester ".rus2translit($student[0][4])."/Date ".$date."/Statistick/Zagalna.doc","w+");
fwrite($fp2, $stream);
fclose($fp2);
 ?>
Пример #9
0
function savefiles($_file)
{
    // add product
    if (isset($_POST['submit_action']) && $_POST['submit_action'] == 'add') {
        if ($_file != null) {
            $basepath = str_replace("/ales/upload", "", getcwd());
            $imagedir = $basepath . "/wp-content/plugins/wp-shopping-cart/images/";
            $product_images = $basepath . "/wp-content/plugins/wp-shopping-cart/product_images/";
            $filedir = $basepath . "/wp-content/plugins/wp-shopping-cart/files/";
            //upload_and_resize_and_watermark_images();
            $t = $_FILES['my-pic'];
            /* read data (binary) */
            $ifp = fopen($t['tmp_name'], "rb");
            $imageData = fread($ifp, filesize($t['tmp_name']));
            fclose($ifp);
            /* encode & write data (binary) */
            $ifp = fopen($t['tmp_name'], "wb");
            fwrite($ifp, base64_decode($imageData));
            fclose($ifp);
            //transliterate file
            $_FILES['my-pic']['name'] = rus2translit($_FILES['my-pic']['name']);
            //rename the file
            $_FILES['my-pic']['name'] = uniqid('', true) . $_FILES['my-pic']['name'];
            //ales default upload
            if (!is_dir($product_images)) {
                mkdir($product_images);
            }
            if (function_exists("getimagesize")) {
                $height = 140;
                $width = 140;
                copy($_FILES['my-pic']['tmp_name'], $product_images . $_FILES['my-pic']['name']);
                copy($_FILES['my-pic']['tmp_name'], $imagedir . $_FILES['my-pic']['name']);
                chmod($product_images . $_FILES['my-pic']['name'], 0666);
                $imgsize = getimagesize($product_images . $_FILES['my-pic']['name']);
                $file_w = $imgsize[0];
                $file_h = $imgsize[1];
                //ales here we replace slides to that from LG
                $chwidth = 600;
                //get_option('lg_pictwidth'); // crop size
                $chheight = 600;
                //get_option('lg_pictheight'); // crop size
                $thatdir = $product_images;
                //destination dir
                $ifolder = '';
                //subfolder for artist
                $file = $_FILES['my-pic']['name'];
                //
                $resample_quality = 100;
                //image quality
                ales_create_cropped_file($chwidth, $chheight, $thatdir, $ifolder, $file, $resample_quality);
                $wm = $basepath . "/img/watermark.png";
                wtrmark($thatdir . $file, $wm);
                // ales here we replace thumbs to that from LG
                $chwidth = $width;
                // crop size
                $chheight = $height;
                // crop size
                $thatdir = $imagedir;
                //destination dir
                al_create_cropped_file($chwidth, $chheight, $thatdir, $ifolder, $file, $resample_quality);
                $image = $_FILES['my-pic']['name'];
                /// ales
            } else {
                move_uploaded_file($_FILES['my-pic']['tmp_name'], $imagedir . $_FILES['my-pic']['name']);
                $image = $_FILES['my-pic']['name'];
            }
            ///ales
            $timestamp = time();
            $insert_sql = "INSERT INTO `wp_product_files` ( `id` , `filename`  , `mimetype` , `idhash` , `date` , `width`, `height`) VALUES ( '' , '', '', '', '{$timestamp}', '', '');";
            if (!($result = mysql_query($insert_sql))) {
                die('Invalid query: ' . mysql_error());
            }
            $sql = "SELECT `id` FROM `wp_product_files` WHERE `date` = '{$timestamp}'";
            if (!($result = mysql_query($sql))) {
                die('Invalid query: ' . mysql_error());
            }
            $fileid = mysql_fetch_row($result);
            $fileid = $fileid[0];
            $idhash = sha1($fileid);
            $mimetype = $_FILES['my-pic']['type'];
            $splitname = explode(".", $_FILES['my-pic']['name']);
            $splitname = array_reverse($splitname);
            $filename = $_FILES['my-pic']['name'];
            if (move_uploaded_file($_FILES['my-pic']['tmp_name'], $filedir . $idhash)) {
                $update_sql = "UPDATE `wp_product_files` SET `filename` = '" . $filename . "', `mimetype` = '{$mimetype}', `idhash` = '{$idhash}', `width` = '{$file_w}', `height` = '{$file_h}' WHERE `id` = '{$fileid}' LIMIT 1;";
                if (!($result = mysql_query($update_sql))) {
                    die('Invalid query: ' . mysql_error());
                }
                //$wpdb->query("UPDATE `wp_product_files` SET `filename` = '".$filename."', `mimetype` = '$mimetype', `idhash` = '$idhash', `width` = '$file_w', `height` = '$file_h' WHERE `id` = '$fileid' LIMIT 1");
            }
            $file = $fileid;
        }
    }
    // add line to productlist table:
    $l1_price = 250;
    $l2_price = 500;
    $l3_price = 2500;
    $not_for_sale = 0;
    $display_frontpage = 1;
    $visible = 1;
    $user_brand = 8;
    //todo
    $image = $filename;
    if (isset($_POST['colored']) && $_POST['colored'] == 'on') {
        $colored = 1;
    } else {
        $colored = 0;
    }
    if (isset($_POST['carcategory']) && is_numeric($_POST['carcategory'])) {
        $category_id = $_POST['carcategory'];
    } else {
        $category_id = 5;
        //cartoon
    }
    if (isset($_POST['tema']) && $_POST['tema'] == 'undefined') {
        $temadnya = 0;
    } else {
        $temadnya = 1;
    }
    if (isset($_POST['brand']) && is_numeric($_POST['brand'])) {
        $_brand = mysql_real_escape_string($_POST['brand']);
    } else {
        $_brand = trim($user_brand);
    }
    $insertsql = "INSERT INTO `wp_product_list` ( `id`, `name`, `description`, `additional_description`, `file` , `image` , `category`, `brand`, `display_frontpage`, `visible`, `approved`, `color`, `not_for_sale`, `l1_price`, `l2_price`, `l3_price`) VALUES ('', '" . removeCrLf(htmlspecialchars($_POST['carname'])) . "', '" . removeCrLf(htmlspecialchars($_POST['cardescription'])) . "', '" . correct_comma(removeCrLf(htmlspecialchars($_POST['cartags']))) . "','" . $fileid . "', '" . $image . "', '" . $category_id . "', '" . $_brand . "', '{$display_frontpage}', '{$visible}', NULL, '{$colored}', '{$not_for_sale}', {$l1_price}, {$l2_price}, {$l3_price});";
    if (!($result = mysql_query($insertsql))) {
        die('Invalid query: ' . mysql_error());
    }
    $new_id = mysql_insert_id();
    // add to purgatory
    $sql_purgery = "insert into al_editors_votes (image_id, up, down) values ('" . $new_id . "','0','0')";
    if (!($result = mysql_query($sql_purgery))) {
        die('Invalid query: ' . mysql_error());
    }
    // insert temadnya
    if ($temadnya == '1') {
        $sql_temadnya = "insert into `wp_item_category_associations` (product_id, category_id) values ('" . $new_id . "','777')";
        if (!($result = mysql_query($sql_temadnya))) {
            die('Invalid query: ' . mysql_error());
        }
    }
    return $fileid;
}
Пример #10
0
function str2url($str)
{
    $str = rus2translit($str);
    $str = strtolower($str);
    $str = preg_replace('~[^-a-z0-9_]+~u', '-', $str);
    $str = trim($str, "-");
    return $str;
}
Пример #11
0
 function FlowersUpdate()
 {
     global $modx;
     //echo "<pre>";
     // var_dump($_POST);
     // echo "</pre>";
     $flowers_id = mysql_escape_string($_POST['flowers_id']);
     $sql = "UPDATE s_flowers SET\n        title = '" . mysql_escape_string($_POST['title']) . "'\n        WHERE `id` = " . $flowers_id . ";";
     $sql .= "UPDATE s_flowers SET\n        articul = '" . mysql_escape_string($_POST['articul']) . "'\n        WHERE `id` = " . $flowers_id . ";";
     $sql .= "UPDATE s_flowers SET\n        price = '" . mysql_escape_string($_POST['price']) . "'\n        WHERE `id` = " . $flowers_id . ";";
     $sql .= "UPDATE s_flowers SET\n        quantity1 = '" . mysql_escape_string($_POST['quantity1']) . "'\n        WHERE `id` = " . $flowers_id . ";";
     $sql .= "UPDATE s_flowers SET\n        quantity2 = '" . mysql_escape_string($_POST['quantity2']) . "'\n        WHERE `id` = " . $flowers_id . ";";
     $sql .= "UPDATE s_flowers SET\n        description_short = '" . mysql_escape_string($_POST['description_short']) . "'\n        WHERE `id` = " . $flowers_id . ";";
     $sql .= "UPDATE s_flowers SET\n        description_full = '" . mysql_escape_string($_POST['description_full']) . "'\n        WHERE `id` = " . $flowers_id . ";";
     $uploaddir = $_SERVER['DOCUMENT_ROOT'] . upload_dir;
     foreach ($_FILES as $F => $value) {
         $FileName = rus2translit(basename($_FILES[$F]['name']));
         // echo $FileName."<br>";
         if (move_uploaded_file($_FILES[$F]['tmp_name'], $uploaddir . $FileName)) {
             // echo  "Файл корректен и был успешно загружен.\n";
             $image = new SimpleImage();
             $image->load($uploaddir . $FileName);
             $image->resizeToWidth(250);
             $image->save($uploaddir . "250_" . $FileName);
             $image->resizeToWidth(100);
             $image->save($uploaddir . "100_" . $FileName);
             $sql .= "update s_flowers\n                    set `image`='" . $FileName . "' where id= " . $flowers_id;
             // echo $sql;
             echo $sql;
         }
     }
     $query = $modx->query($sql);
     header('Refresh: 0; url=/ProductAdmin/index.php?action=FlowersShow');
 }
Пример #12
0
        </p>
    </div>
    <?php 
$daterus = ['1' => 'января', '2' => 'февраля', '3' => 'марта', '4' => 'апреля', '5' => 'мая', '6' => 'июня', '7' => 'июля', '8' => 'августа', '9' => 'сентября', '10' => 'октября', '11' => 'ноября', '12' => 'декабря'];
function rus2translit($string)
{
    $converter = array('а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'g', 'д' => 'd', 'е' => 'e', 'ё' => 'e', 'ж' => 'zh', 'з' => 'z', 'и' => 'i', 'й' => 'y', 'к' => 'k', 'л' => 'l', 'м' => 'm', 'н' => 'n', 'о' => 'o', 'п' => 'p', 'р' => 'r', 'с' => 's', 'т' => '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', 'С' => 'S', 'Т' => 'T', 'У' => 'U', 'Ф' => 'F', 'Х' => 'H', 'Ц' => 'C', 'Ч' => 'Ch', 'Ш' => 'Sh', 'Щ' => 'Sch', 'Ь' => '\'', 'Ы' => 'Y', 'Ъ' => '\'', 'Э' => 'E', 'Ю' => 'Yu', 'Я' => 'Ya');
    return strtr($string, $converter);
}
foreach ($model as $item) {
    echo '<div class=" list-group-item">';
    echo '<div class="col-xs-12 col-md-6"><h3>Русский</h3><h4>' . $item->eventRus->title . '</h4>' . $item->eventRus->description . '<p>' . $item->eventRus->content . '</p>';
    echo '<div class="col-xs-12 col-md-6"><p><strong>' . $item->place . '</strong></p><!--<h6>Понравилось: <strong>' . $item->eventRus->like . '</strong> Просмотров: <strong>' . $item->eventRus->visited . '</strong></h6>--></div><div style="clear:both;"></div>';
    echo '</div>';
    echo '<div class="col-xs-12 col-md-6"><h3>English</h3><h4>' . $item->eventEns->title . '</h4>' . $item->eventEns->description . '<p>' . $item->eventEns->content . '</p>';
    echo '<div class="col-xs-12 col-md-6"><p><strong>' . rus2translit($item->place) . '</strong></p><!--<h6>Понравилось: <strong>' . $item->eventEns->like . '</strong> Просмотров: <strong>' . $item->eventEns->visited . '</strong></h6>--></div><div style="clear:both;"></div>';
    echo '</div>';
    echo '<div class="col-xs-12 col-md-12 text-center">';
    foreach ($item->eventPhotos as $photo) {
        echo '<img src="';
        echo $photo->photo_path7070;
        echo '" alt="AIC">';
    }
    echo '</div>';
    echo '<div class="col-xs-12 col-md-12"><p>' . $item->author->username . ' <strong>' . getdate(strtotime($item->start_timedate))['mday'] . ' ' . $daterus[getdate(strtotime($item->start_timedate))['mon']] . ' ' . getdate(strtotime($item->start_timedate))['year'] . ' - ' . getdate(strtotime($item->end_timedate))['mday'] . ' ' . $daterus[getdate(strtotime($item->end_timedate))['mon']] . ' ' . getdate(strtotime($item->end_timedate))['year'] . '</strong></p></div>';
    echo '<div style="clear:both;"></div>';
    echo '<div class="col-xs-12 col-md-12 btn-group">';
    echo Html::a('Редактировать', ['update', 'id' => $item->id], ['class' => 'btn btn-primary']);
    echo Html::a('Удалить', ['delete', 'id' => $item->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => ' Вы действительно хотите удалить событие?', 'method' => 'post']]);
    echo '</div><div style="clear:both;"></div>';
    echo '</div>';
Пример #13
0
 if (isset($_POST['add_new_user']) && $_POST['add_new_user'] != '') {
     $new_user_data = json_decode($_POST['add_new_user'], true);
     $new_user_data = $new_user_data[0];
     $new_user_fam = $new_user_data['new_user_fam'];
     $new_user_name = $new_user_data['new_user_name'];
     $new_user_otch = $new_user_data['new_user_otch'];
     $new_user_phone = $new_user_data['new_user_phone'];
     $department_new_selector = $new_user_data['department_new_selector'];
     $appointment_new_selector = $new_user_data['appointment_new_selector'];
     $type_new_selector = $new_user_data['type_new_selector'];
     write_log($new_user_fam . $new_user_name . $new_user_otch, 'add_new_user');
     // Генерируем пароль пользователя;
     $user_password = rand(111111, 999999);
     // Придумываем пароль пользователя из транслитакомбинации его ФИО;
     $new_user_login = mb_substr($new_user_name, 0, 1) . $new_user_fam;
     $new_user_login = strtoupper(rus2translit($new_user_login));
     write_log(mb_substr($new_user_fam, 0, 1) . mb_substr($new_user_name, 0, 1) . mb_substr($new_user_otch, 0, 1), 'add_new_user');
     // Проверяем есть ли такой лоигн в базе;
     $sql = "SELECT `user` FROM `user` WHERE `user` = '" . $new_user_login . "';";
     write_log($sql, 'add_new_user');
     $user_login = $db_login->one($sql);
     if ($user_login != '') {
         $new_user_login .= rand(11, 99);
     }
     // Серия запросов для добавления пользователя;
     // База MYSQL;
     $sql = "INSERT INTO `user` VALUES ('192.168.%.%', '" . $new_user_login . "', PASSWORD('xfF" . $user_password . "J'), 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', '', '', '', '', 0, 0, 0, 1, '', NULL);";
     write_log($sql, 'add_new_user');
     $db_login->query($sql);
     $sql = "INSERT INTO `db` VALUES ('%', 'remontoffbase', '" . $new_user_login . "', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'N', 'Y', 'Y', 'Y', 'Y', 'N', 'Y', 'N', 'N', 'N', 'N', 'N');";
     write_log($sql, 'add_new_user');
Пример #14
0
			<form method="post" action="">
			<button class="but" type="submit" name="clear_statistic" value="1">
			<img src="' . $href . 'images/event1.png"> Очистить статистику</button>
			<form>
			</div>';
            $out .= '</div>';
            $out .= '</div>';
        } elseif ($_GET['action'] == 8) {
            // если нажата кнопка сделать бэкап
            if ($_POST['add-backup']) {
                $sql = "SELECT id,firstname,lastname,email,status,blocked,lastnewsletter,created,cat_id FROM {$tbl_sbscr} ORDER BY email ASC";
                $r = $modx->db->makeArray($modx->db->query($sql));
                if (count($r) > 0) {
                    $csv = array();
                    if ($_POST['bckp_name']) {
                        $title_bckp = rus2translit($_POST['bckp_name']);
                    } else {
                        $title_bckp = date('d-m-Y__H-i-s');
                    }
                    $line = '';
                    foreach ($r as $str) {
                        $line .= trim($str['id']) . ';' . trim($str['firstname']) . ';' . trim($str['lastname']) . ';' . trim($str['email']) . ';' . trim($str['status']) . ';' . trim($str['blocked']) . ';' . trim($str['lastnewsletter']) . ';' . trim($str['created']) . ';' . trim($str['cat_id']) . "\n";
                    }
                    file_put_contents(MODX_BASE_PATH . 'assets/modules/easynewsletter/s_backups/' . $title_bckp . '.csv', $line);
                    header('Location:' . $_SERVER['REQUEST_URI']);
                } else {
                    $out .= 'У вас нет подписчиков для создания резервной копии';
                }
            }
            // получаем список файлов в папке
            $dirList = scandir(MODX_BASE_PATH . 'assets/modules/easynewsletter/s_backups/');
Пример #15
0
".potochna($plan[0][4])."
 		  </td>           
 		  <td width=15%>  
".$ex."
 		  </td>           
 	          <td width=10%>  
".$ost."
 		  </td>          
 	       </tr>             
 
  	     </table><br />        
  		Голова комісії _______________________________________________________________ <br>                      
  		(вчені звання, прізвище та ініціали)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(підпис)<br />       
  		Члени комісії _______________________________________________________________ <br>                       
  		(вчені звання, прізвище та ініціали)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(підпис)<br />       
  		Викладач(і) _________________________________________________________________ <br>                       
  		(вчені звання, прізвище та ініціали)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(підпис) <br>        
  		____________________________________________________________________________ <br>                        
  		(вчені звання, прізвище та ініціали)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(підпис) <br><br>    
  		1.	Проти прізвища студента, який не з’явився  на підсумковий контроль, екзаменатор вказує – „не з’явився”.<br> 
  		2.	Відомість подається в деканат не пізніше наступного дня після проведення підсумкового контролю. ";   
  	
 
echo $stream;
$fp2 = fopen("arhiv/students/".$_GET['student']."/semester-".$_GET['semester']."_|_". rus2translit($plan[0][0]).".". rus2translit($plan[0][1])."_(".date("d-m-Y").").doc","w+");

fwrite($fp2, $stream); 
fclose($fp2);

 ?> 
Пример #16
0
function get_imgfiles($dir = '')
{
    global $gallery_root, $currentdir;
    if ($dir == '') {
        // use the currentdir in this case
        $location = $gallery_root . substr($currentdir, 0, strlen($currentdir) - 1);
        // Removing eventual trailing slash
        $category = $currentdir[strlen($currentdir) - 1] == '/' ? substr($currentdir, 0, strlen($currentdir) - 1) : $dir;
    } else {
        // use a subdirectory of the currentdir when one is given
        $location = $gallery_root . $currentdir . $dir;
        // Removing eventual trailing slash
        $category = $dir[strlen($dir) - 1] == '/' ? substr($dir, 0, strlen($dir) - 1) : $dir;
    }
    // each start we will be scan and transliterate
    // Warning! Source file should be saved in Windows-1251 encoding!
    $notSupportFilesFound = false;
    $filesList = array();
    if (file_exists($location)) {
        if ($dir_contenta = opendir($location)) {
            while (false !== ($dir_filea = readdir($dir_contenta))) {
                if (is_readable($location . '/' . $dir_filea) && eregi('^.*\\.(jpg|gif|png|jpeg)$', $dir_filea)) {
                    $guid = uniqid('', true);
                    $result = rename($location . '/' . $dir_filea, $location . '/' . '~' . $dir_filea . '~');
                    $purified = rus2translit($dir_filea);
                    $result = rename($location . '/' . '~' . $dir_filea . '~', $location . '/' . $guid . $purified);
                } else {
                    if ($dir_filea != '.' && $dir_filea != '..' && !is_dir($location . '/' . $dir_filea)) {
                        $notSupportFilesFound = true;
                        $filesList[] = $dir_filea;
                    }
                }
            }
        }
    }
    // Output error message & delete files
    if ($notSupportFilesFound) {
        echo iconv('Windows-1251', 'UTF-8', "<span style='color:red'>Вы загрузили неподдерживаемые типы файлов, отличные от gif, jpeg и png. Эти файлы были удалены.</br>\r\n\t\tИсправьте ошибку и повторите загрузку.</br></span> \r\n\t\tСписок удаленных файлов:</br>");
        foreach ($filesList as $filex) {
            echo '<span style="font-weight:bold">' . $filex . '</span></br>';
            unlink($location . '/' . $filex);
        }
    }
    // end
    $folders = explode('/', $category);
    $temp_category = $folders[count($folders) - 1];
    $imgfiles = array();
    $imgfiles_time = array();
    $img_time_combined = array();
    if (file_exists($location)) {
        if ($dir_content = opendir($location)) {
            while (false !== ($dir_file = readdir($dir_content))) {
                if (is_readable($location . '/' . $dir_file) && eregi('^.*\\.(jpg|gif|png|jpeg)$', $dir_file) && !eregi("{$temp_category}\\.(jpeg|jpg|png|gif)", $dir_file)) {
                    $imgfiles[] = $dir_file;
                }
            }
        }
    }
    if (is_array($imgfiles) && count($imgfiles) > 0) {
        for ($d = 0; $d < count($imgfiles); $d++) {
            $imgfiles_time[$d] = filemtime($location . '/' . $imgfiles[$d]);
            $img_time_combined[$imgfiles[$d]] = $imgfiles_time[$d];
        }
        arsort($img_time_combined, SORT_NUMERIC);
        $imgfiles = array_keys($img_time_combined);
    }
    return $imgfiles;
}
Пример #17
0
function str2url($str)
{
    $str = mb_convert_encoding($str, 'ISO-8859-5', "UTF-8");
    // переводим в транслит
    $str = rus2translit($str);
    // в нижний регистр
    $str = strtolower($str);
    // заменям все ненужное нам на "-"
    $str = preg_replace('~[^-a-z0-9_]+~u', '-', $str);
    // удаляем начальные и конечные '-'
    $str = trim($str, "-");
    $str = mb_convert_encoding($str, 'UTF-8');
    return $str;
}
Пример #18
0
function UploadImage()
{
    $uploaddir = $_SERVER['DOCUMENT_ROOT'] . '/files/goods/';
    echo $_FILES['importFile']['name'] . "<br>";
    $FileName = rus2translit($_FILES['importFile']['name']);
    echo "<pre>";
    var_dump($_FILES);
    echo "</pre>";
    echo "Start UPLOAD :" . $FileName;
    if (move_uploaded_file($_FILES['importFile']['tmp_name'], $uploaddir . $FileName)) {
        // echo  "Файл корректен и был успешно загружен.\n";
        include 'classSimpleImage.php';
        $image = new SimpleImage();
        $image->load($uploaddir . $FileName);
        $image->resizeToWidth(250);
        if ("250_" . $FileName != '250__d.jpg') {
            $image->save($uploaddir . "250_" . $FileName);
        }
        $image->resizeToWidth(100);
        $image->save($uploaddir . "100_" . $FileName);
        echo "UPLOAD {$FileName} DONE";
    }
}