function my_unlink($file, $file2 = '') { if (!empty($file) && file_exists($file) && $file2 != $file) { //删除大图 $thumb = get_thumb($file); unlink($file); //删除缩略图 if (!empty($thumb) && file_exists($thumb)) { unlink($thumb); } } }
function delete_file($path = '', $files = array()) { foreach ($files as $file) { if (file_exists($path . $file)) { $thumb = get_thumb($file); if ($thumb != '') { if (file_exists($path . $thumb)) { unlink($path . $thumb); } unlink($path . $file); } } } }
public function index() { import("@.ORG.Page"); $db = M('photo'); if ($wechatid = I('wechatid')) { $map = array('wechatid' => $wechatid); } else { $map = array(); } $count = $db->where($map)->count(); $Page = new Page($count, 20); $list = $db->where($map)->order('id desc')->limit($Page->firstRow . ',' . $Page->listRows)->select(); foreach ($list as $key => $val) { $list[$key]['thumb'] = get_thumb($val['photo']); $list[$key]['uname'] = M('wechatuser')->where(array('wechatid' => $val['wechatid']))->getField('uname'); } $show = $Page->show(); $this->assign('show', $show); $this->assign('list', $list); $this->display(); }
//slider z aktualnosciami foreach( $myposts as $post ) { setup_postdata($post); /*echo get_the_title(); $meta_values = get_post_meta($post->ID, 'pokaz_w_aktualnosciach' ); print_r($meta_values); echo '<div style="display: block; height: 48px; clear:both;"></br></div>'; continue;*/ $opis= short_opis(200); $title = get_the_title(); //$img = 'timthumb.php?src='.get_field("zdjecie").'&w=210&h=210'; $full = get_thumb(); $thumb = site_url().'/resize/138x144x1/r/'. dm_relative($full); $postType = get_post_type(); $postTypeObj = get_post_type_object($postType); $cat = $postTypeObj->labels->name; $catUrl = get_post_type_archive_link($postType); $data = get_the_date("d.m.Y"); $link = get_permalink(); // the_4col_item($thumb, $tytul, $data, $catUrl, $cat, $opis, $link); ?> <li class="dm_przedmioty"> <div class="row">
$field = array('name', 'image', 'ordering', 'alias'); $img = edit_img('../', 'uploads/chuyenmuc/', 'chuyenmuc', 'image', $_POST['tmpimage'], $id, 30, 30); $values = array(format($_POST["name"], 0), format($img, 0), format($_POST['ordering'], 0), format(convert($_POST["name"]), 0)); // updateObject($field=array(),$value=array(),$where) $res = $tbl->updateObject($field, $values, 'id=' . $id); if ($res) { header('location: ' . loadPage('chuyenmuc')); } } else { echo "Lỗi trùng tên. Vui lòng nhập tên khác."; } } $res = $tbl->loadOne('id=' . $id); if ($res) { $row = mysql_fetch_array($res); $thumb_img = get_thumb('uploads/chuyenmuc/', $row['image']); ?> <div id="center-column"> <div class="top-bar"> <h1>Chuyên mục riêng</h1> <div class="breadcrumbs"><a href="<?php echo loadPage('chuyenmuc'); ?> ">Chuyên mục riêng</a> / <a href="#">Sửa</a></div> </div><br /> <div class="table"> <img src="img/bg-th-left.gif" width="8" height="7" alt="" class="left" /> <img src="img/bg-th-right.gif" width="7" height="7" alt="" class="right" />
<div class="ware"> <?php if (is_array($item_detail)) { $i = 0; $__LIST__ = $item_detail; if (count($__LIST__) == 0) { echo ""; } else { foreach ($__LIST__ as $key => $item) { $mod = $i % 2; ++$i; ?> <div class="ware_list"> <div class="ware_pic"><img src="<?php echo attach(get_thumb($item['img'], '_b'), 'item'); ?> " height="50" width="50"></div> <div class="ware_text"> <div class="ware_text1"> <a href="#"><?php echo $item["title"]; ?> </a><br> <span></span> </div> <div class="ware_text2"> <span>数量:<strong><?php echo $item["quantity"]; ?> </strong></span>
while (have_rows('residency_dates')) { the_row(); $start_date_dt = new DateTime(get_sub_field('start_date', $resident_id)); $start_date = $start_date_dt->format('M j, Y'); $end_date_dt = new DateTime(get_sub_field('end_date', $resident_id)); $end_date = $end_date_dt->format('M j, Y'); $start_year = $start_date_dt->format('Y'); $end_year = $end_date_dt->format('Y'); } } } else { $no_link = 'nolink'; $end_date_dt = new DateTime(get_resident_end_date($resident_id)); $end_year = $end_date_dt->format('Y'); } $thumb = get_thumb($resident_id); echo '<div class="resident item shelf-item border-bottom ' . $resident_status . ' ' . $no_link . '"><div class="inner">'; if ($bio) { echo '<a class="wrap value name" href="' . $url . '">'; } echo '<h2 class="link title name">' . $title . '</h2>'; echo '<div class="image">'; if ($bio && $thumb) { echo '<img src="' . $thumb . '"/>'; } echo '</div>'; if ($bio) { echo '</a>'; } echo '<div class="details">'; echo '<div class="left">';
} if (!isset($start)) { $start = 0; } $nume = 0; if (isset($_POST["search"])) { // loadPaging(&$start,&$nume,$limit=20,$where='',$order='order by id desc') // formatCompare($str,$pos=0) $res = $tbl->loadPaging($start, $nume, $limit, 'where name like ' . formatCompare($_POST["key"], 0), 'order by ordering'); } else { // loadPaging(&$start,&$nume,$limit=20,$where='',$order='order by id desc') $res = $tbl->loadPaging($start, $nume, $limit, '', 'order by ordering'); } if ($res) { while ($row = mysql_fetch_array($res)) { $thumb_img = get_thumb('uploads/nsx/', $row['image']); ?> <tr> <td class="first style1"><a href="<?php echo loadPage('editchuyenmuc&id=' . $row['id']); ?> "><?php echo $row['name']; ?> </a></td> <td><a href="<?php echo loadPage('editchuyenmuc&id=' . $row['id']); ?> "><img src="../<?php echo $thumb_img;
?> </b></td> <td valign="top"><img border="0" src="<?php echo pimage_url(get_thumb($portfolio->attachment1)); ?> " alt="attachment1"/></td> </tr> <?php } if ($portfolio->attachment2) { ?> <tr> <td valign="top"><b><?php echo $this->lang->line('Attachement2:'); ?> </b></td> <td valign="top"><img border="0" src="<?php echo pimage_url(get_thumb($portfolio->attachment2)); ?> " alt="attachment2"/></td> </tr> <?php } ?> </tbody></table> </td></tr> <?php } } ?> </tbody></table> </div> <!--SIGN-UP-->
} $search = cbsearch::init_search($type); $search->limit = create_query_limit($page, $limit); $search->key = mysql_clean($request['query']); $results = $search->search(); if ($results) { $the_results = array(); switch ($type) { case "video": default: if ($results) { foreach ($results as $video) { $hq_file = get_hq_video_file($video); $video['title'] = title($video['title']); $video['description'] = mob_description($video['description']); $video['thumbs'] = array('default' => get_thumb($video), 'big' => getSmartyThumb(array('vdetails' => $video, 'size' => 'big'))); $video['videos'] = array('mobile' => get_mob_video(array('video' => $video))); $video['url'] = $video['video_link'] = $video['videoLink'] = videoLink($video); if (has_hq($video)) { $video['videos']['hd'] = $hq_file; } foreach ($blacklist_fields as $field) { unset($video[$field]); } $the_results[] = $video; } } break; case "users": if ($results) { foreach ($results as $user) {
/** * get video content for feed * * @param INT $id * @param ARRAY $content */ function get_content($content, $cond = NULL) { if (is_array($content)) { if ($content['title'] && $content['videoid']) { $the_content = $content; } elseif ($content['videoid']) { $id = $content['videoid']; } else { return false; } } else { $id = $content; } if (!$the_content) { $the_content = $this->get_video($id); } if (!$the_content) { return false; } $video_feed_fields = array('title', 'description', 'duration', 'videoid', 'date_added', 'file_server_path', 'files_thumbs_path', 'file_directory', 'file_thumbs_count', 'tags', 'category', 'privacy', 'userid', 'username', 'email', 'fullname'); $video_feed_fields = apply_filters($video_feed_fields, 'video_content_fields_unsorted'); $video_fields = array(); foreach ($video_feed_fields as $vid_field) { $video_fields[$vid_field] = $the_content[$vid_field]; } $video_fields['link'] = VideoLink($the_content); $video_fields['thumb'] = get_thumb($the_content); $video_fields['sub_title'] = setTime($the_content['duration']); return $video_fields; }
function getdata($limit = "", $where = "", $orderby = "", $field = "*") { global $ORDERSTATE; $temparray = $this->table_order->getdata($limit, $where, $orderby, $field); foreach ($temparray as &$value) { //数据处理 if (empty($value['orderimg'])) { $value['showimg'] = $value['goodsimg']; $value['orderimg'] = $value['goodsimg']; } else { $value['showimg'] = get_thumb($value['orderimg']); } $value['statename'] = $ORDERSTATE[$value['state']]; } return $temparray; }
<?php $index = ["img" => get_thumb($page_img), "title" => "Hidden", "desc" => "This is my Hidden Projects Please don't share with any one", "desc2" => "", "itiration" => sr::hidden()]; ?> @include(get_location("index"))
<?php $index = ["img" => get_thumb($page_img), "title" => "My APIs! - (API أكواد)", "desc" => "My Gift To The World.", "desc2" => "", "itiration" => sr::api()]; ?> @include(get_location("index"))
<?php global $post; setup_postdata($post); $id = $post->ID; $title = $post->post_title; $slug = $post->post_name; $thumb = get_thumb($resident_id, 'thumbnail'); $post_type = $post->post_type; $permalink = get_permalink($id); $classes = $slug . ' ' . $post_type; if ($post_type == 'contributor') { $permalink = get_field('website', $id); } if ($thumb) { $classes .= ' hasthumb'; } else { $classes .= ' nothumb'; } if ($post_type == 'country') { $residents_url = get_permalink(get_page_by_path('residents')->ID); $permalink = $residents_url . '?filter=all&from=' . $slug; } echo '<div class="result item shelf-item border-bottom ' . $classes . '">'; echo '<div class="inner">'; if ($permalink) { echo '<a class="wrap" href="' . $permalink . '">'; } else { echo '<div class="wrap">'; } if ($thumb) {
if (!$uid) { $uid = userid(); } $params = array('userid' => $uid, 'limit' => $get_limit); $videos = $cbvid->action->get_favorites($params); $params['count_only'] = "yes"; $total_rows = $cbvid->action->get_favorites($params); $total_pages = count_pages($total_rows, $get_limit); if ($total_rows > 0) { $new_videos = array(); foreach ($videos as $video) { if (!$video['email']) { $udetails = $userquery->get_user_details($video['userid']); } $video = array_merge($video, $udetails); $video['thumbs'] = array('default' => get_thumb($video)); $video['videos'] = array('mobile' => get_mob_video(array('video' => $video))); $video['url'] = $video['video_link'] = $video['videoLink'] = videoLink($video); $video['avatar'] = $video['user_photo'] = $video['displayPic'] = $userquery->avatar($video); foreach ($blacklist_fields as $field) { unset($video[$field]); } $new_videos[] = $video; } echo json_encode($new_videos); } else { echo json_encode(array('err' => lang('No favorite videos were found'))); } break; case "get_users": case "get_channels":
} $nume = 0; if (isset($_POST["search"])) { // loadPaging(&$start,&$nume,$limit=20,$where='',$order='order by id desc'); // formatCompare($str,$pos=0); $res = $tbl->loadPaging($start, $nume, $limit, 'where proid=' . $_POST["key"], 'order by proid desc'); } else { // loadPaging(&$start,&$nume,$limit=20,$where='',$order='order by id desc'); $res = $tbl->loadPaging($start, $nume, $limit, '', 'order by proid desc'); } if ($res) { while ($row = mysql_fetch_array($res)) { $tbl_pro = new table('products'); $res_pro = $tbl_pro->loadOne('id=' . $row['proid']); $row_pro = mysql_fetch_array($res_pro); $thumb_img = get_thumb('../Images/Products/', $row['image']); ?> <tr> <td class="first style1"> <a href="<?php echo loadPage('editimg&id=' . $row['id']); ?> "><?php echo $row['name']; ?> </a> </td> <td><a href="<?php echo loadPage('editimg&id=' . $row['id']); ?>
$__LIST__ = $img_list; if (count($__LIST__) == 0) { echo ""; } else { foreach ($__LIST__ as $key => $val) { $mod = $i % 2; ++$i; ?> <li class="album_<?php echo $val['id']; ?> "><a href="javascript:void(0)" onclick="del_album(<?php echo $val['id']; ?> );"><img src="__STATIC__/css/admin/bgimg/tv-collapsable.gif" /></a><a><img src="<?php echo attach(get_thumb($val['url'], '_b'), 'item'); ?> " style="width:80px;height:60px; border:solid 1px #000; "/></a></li><?php } } } else { echo ""; } ?> </ul><div class="cb"></div><table width="100%" cellpadding="2" cellspacing="1" class="table_form" id="first_upload_file"><tbody class="uplode_file"><tr><th width="100" align="left"><a href="javascript:void(0);" class="blue" onclick="add_file();"><img src="__STATIC__/css/admin/bgimg/tv-expandable.gif" /></a>上传文件 :</th><td><input type="file" name="imgs[]"></td></tr></tbody></table></div><div class="content_list pad_10 hidden"><table width="100%" cellpadding="2" cellspacing="1" class="table_form"><tr><th width="120"><?php echo L('seo_title'); ?> :</th><td><input type="text" name="seo_title" class="input-text" size="60" value="<?php echo $info["seo_title"]; ?> "></td></tr><tr><th><?php
$__LIST__ = $item; if (count($__LIST__) == 0) { echo ""; } else { foreach ($__LIST__ as $key => $vo) { $mod = $i % 2; ++$i; ?> <li id="cart_item_<?php echo $vo["id"]; ?> "><p class="goods_info"><span class="img"><a href="<?php echo U('item/index', array('id' => $vo['id'])); ?> " ><img src="<?php echo attach(get_thumb($vo['img'], '_m'), $_SESSION['user_token'] . '/item'); ?> " height="80" width="80"></a></span><span class="tit"><a href="<?php echo U('item/index', array('id' => $vo['id'])); ?> " ><?php echo $vo["name"]; echo $vo["spec_1"]; echo $vo["spec_2"]; ?> </a><br><span>价格:</span><span class="price1">¥<?php echo $vo["price"]; ?> </span><br><span>数量:</span><input type ="hidden" id="spec_id_<?php echo $vo["id"]; ?>
</thead> <tbody> <?php if (is_array($order_detail)) { $i = 0; $__LIST__ = $order_detail; if (count($__LIST__) == 0) { echo ""; } else { foreach ($__LIST__ as $key => $vo) { $mod = $i % 2; ++$i; ?> <tr class=""> <td><img width="68" alt="nopic" src="<?php echo attach(get_thumb($vo['img'], '_b'), session('token') . '/item'); ?> "></td> <td class="ltd"> <?php echo $vo["title"]; ?> <?php echo $vo["spec_1"]; ?> <?php echo $vo["spec_2"]; ?> </td>
private function home_page() { $request = $_REQUEST; define('API_HOME_PAGE', 'yes'); global $cbvid; $videos = $cbvid->get_videos(array('featured' => 'yes', 'limit' => 10, 'order' => 'featured_date DESC', 'has_mobile' => 'yes')); global $userquery; $new_videos = array(); if ($videos) { foreach ($videos as $video) { $video['title'] = utf8_encode($video['title']); $video['description'] = utf8_encode($video['description']); $video['thumbs'] = array('default' => get_thumb($video), 'big' => get_thumb($video, 'big'), '640x480' => get_thumb($video, '640x480')); if (function_exists('get_mob_video')) { $video['videos'] = array('mobile' => get_mob_video(array('video' => $video))); if ($video['has_hd'] == 'yes') { $video['videos']['hq'] = get_hq_video_file($video); } } $video['url'] = $video['video_link'] = $video['videoLink'] = videoLink($video); $video['avatar'] = $video['user_photo'] = $video['displayPic'] = $userquery->avatar($video); $video['avatars']['medium'] = $userquery->avatar($video, 'small'); $video['avatars']['xmedium'] = $userquery->avatar($video, 'xmedium'); $video['avatars']['large'] = $userquery->avatar($video, 'large'); $new_videos[] = $video; } } $featured = $new_videos; $categories = $cbvid->getCbCategories(array('cond' => " ( category_id = '1' OR category_id = '16' OR category_id = '26' OR category_id = '15' ) ", 'limit' => 4, 'type' => 'v')); $cat_videos = array(); foreach ($categories as $category) { $cat_vid = array('name' => $category['category_name'], 'id' => $category['category_id']); $videos = $cbvid->get_videos(array('limit' => 10, 'category' => $category['category_id'], 'order' => ' date_added desc ')); $new_videos = array(); if ($videos) { foreach ($videos as $video) { $video['title'] = utf8_encode($video['title']); $video['description'] = utf8_encode($video['description']); $video['thumbs'] = array('default' => get_thumb($video), 'big' => get_thumb($video, 'big'), '640x480' => get_thumb($video, '640x480')); if (function_exists('get_mob_video')) { $video['videos'] = array('mobile' => get_mob_video(array('video' => $video))); if ($video['has_hd'] == 'yes') { $video['videos']['hq'] = get_hq_video_file($video); } } $video['url'] = $video['video_link'] = $video['videoLink'] = videoLink($video); $video['avatar'] = $video['user_photo'] = $video['displayPic'] = $userquery->avatar($video); $video['avatars']['medium'] = $userquery->avatar($video, 'medium'); $video['avatars']['xmedium'] = $userquery->avatar($video, 'xmedium'); $video['avatars']['large'] = $userquery->avatar($video, 'large'); $new_videos[] = $video; } } $cat_vid['videos'] = $new_videos; $cat_videos[] = $cat_vid; } $home = array('featured' => $featured, 'categories' => $cat_videos); //echo json_encode($home); if (!empty($featured) || !empty($cat_videos)) { $data = array('code' => "200", 'status' => "success", "msg" => "Success", "data" => $home); $this->response($this->json($data)); } else { $data = array('code' => "204", 'status' => "success", "msg" => "No Record Found", "data" => ""); $this->response($this->json($data)); } }
/** * Function used to remove video thumbs */ function remove_thumbs($vdetails) { //First lets get list of all thumbs $thumbs = get_thumb($vdetails, 1, true, false, false, true, false); if (!is_default_thumb($thumbs)) { if (is_array($thumbs)) { foreach ($thumbs as $thumb) { if (strstr($thumb, 'timthumb')) { $thumb = $this->convert_tim_thumb_url_to_file($thumb, $file_name = false); } else { $thumb = substr($thumb, 0, -6); } $file = THUMBS_DIR . '/' . $thumb; if (file_exists($file) && is_file($file)) { unlink($file); } } foreach ($thumbs as $thumb) { if (strstr($thumb, 'timthumb')) { $fn = $this->convert_tim_thumb_url_to_file($thumb, $file_name = true); } else { $fn = substr($thumb, 0, -6); } $result = db_select("SELECT * FROM " . tbl("video") . " WHERE file_name = '{$fn}'"); if ($result) { foreach ($result as $result1) { $str = '/' . $result1['file_directory'] . '/'; $file1 = THUMBS_DIR . $str . $thumb; if (file_exists($file1) && is_file($file1)) { unlink($file1); } } } } } else { if (strstr($thumbs, 'timthumb')) { $thumbs_ = $this->convert_tim_thumb_url_to_file($thumbs, $file_name = false); } else { $thumbs_ = substr($thumbs, 0, -6); } $file = THUMBS_DIR . '/' . $thumbs_; if (file_exists($file) && is_file($file)) { unlink($file); } if (strstr($thumbs, 'timthumb')) { $fn = $this->convert_tim_thumb_url_to_file($thumbs, $file_name = true); } else { $fn = substr($thumbs, 0, -6); } $result = db_select("SELECT * FROM " . tbl("video") . " WHERE file_name = '{$fn}'"); if ($result) { foreach ($result as $result1) { $str = '/' . $result1['file_directory'] . '/'; $file1 = THUMBS_DIR . $str . $thumbs; if (file_exists($file1) && is_file($file1)) { unlink($file1); } } } } e(lang("vid_thumb_removed_msg"), 'm'); } }
if (count($__LIST__) == 0) { echo ""; } else { foreach ($__LIST__ as $key => $vo) { $mod = $i % 2; ++$i; ?> <div class="order_form"> <div class="con"> <p class="ware_pic"> <a href="<?php echo U('Item/index', array('id' => $vo['id'])); ?> "> <img src="<?php echo attach(get_thumb($vo['img'], '_s'), 'item'); ?> " width="40"> </a> </p> <p class="ware_text"><a href="<?php echo U('Item/index', array('id' => $vo['id'])); ?> "><?php echo $vo["title"]; ?> </a> </p> <p class="price">价格: <span>¥<?php echo $vo["price"];
/** * ajax删除图片 */ public function ajax_delpic() { $model = D('Pic'); $data['source'] = CONTROLLER_NAME; $data['picid'] = $_POST['pid']; $vo = $model->field('domain,filepath,thumb')->where($data)->find(); //dump($vo);exit; //include "../../Ftp.php"; //是否开启FTP删除 if (false) { import('@.ORG.Ftp'); $ftphost = $_SCONFIG['ftphost']; $ftpport = $_SCONFIG['ftpport']; $ftpuser = $_SCONFIG['ftpuser']; $ftppassword = $_SCONFIG['ftppassword']; $ftp = new ftp($ftphost, $ftpport, $ftpuser, $ftppassword); // 打开FTP连接 $dir = $_FTP[$vo['domain']] . '/' . $vo['filepath']; //删除远程文件 $ftp->del_file($dir); } else { //$dir = $_NFTP[$vo['domain']].'/'.$vo['filepath']; $dir = C('IMG_ROOT') . $vo['filepath']; unlink($dir); if ($vo['thumb']) { $thumbs = explode(',', $vo['thumb']); foreach ($thumbs as $thumb) { $thumb_dir = C('IMG_ROOT') . get_thumb($vo['filepath'], str_ireplace("_", "", $thumb)); //echo $thumb_dir;exit; unlink($thumb_dir); } } } $url = $vo['domain'] . $vo['filepath']; $result = $model->where($data)->delete(); //dump($result);exit; /* if(!$fp=@fopen($url,"r")){ //echo iconv("GBK", "UTF-8", "远程文件不存在!"); }else{ echo "文件删除失败"; exit; } */ if ($result) { $this->history($_POST['pid'], 'deletepic'); $msg['error_code'] = 0; $msg['notice'] = '删除成功'; echo json_encode($msg); exit; } else { $msg['error_code'] = 8002; $msg['notice'] = '删除失败'; echo json_encode($msg); exit; } exit; }
?> </category> <guid isPermaLink="true"><?php echo video_link($video); ?> </guid> <pubDate><?php echo $video['date_added']; ?> </pubDate> <media:player url="<?php echo video_link($video); ?> " /> <media:thumbnail url="<?php echo get_thumb($video); ?> " width="120" height="90" /> <media:title><?php echo substr($video['title'], 0, 50); ?> </media:title> <media:category label="Tags"><?php echo strip_tags(tags($video['tags'], 'video')); ?> </media:category> <media:credit><?php echo $video['username']; ?> </media:credit> <enclosure url="<?php
<?php global $post; setup_postdata($post); $title = get_the_title(); $slug = $post->post_name; $date = get_the_date('F d, Y'); $featured_image = get_thumb($joural_post_id, null); $featured_image_id = get_post_thumbnail_id(); $id = get_the_ID(); $event_classes = 'journal-post single'; $author_f = get_the_author_meta('first_name'); $author_l = get_the_author_meta('last_name'); $author = $author_f . ' ' . $author_l; $images = get_attached_media('image', $id); $show_featured_image = get_field('show_featured_image'); if (get_field('author')) { $author = get_field('author'); } ?> <section <?php section_attr($id, $slug, $event_classes); ?> > <?php get_template_part('partials/nav'); ?> <?php get_template_part('partials/side'); ?>
function aksi($id_user) { // Edit User Prakerin if (post('edit_user')) { // For Admin if ($this->session->userdata('role') == 'admin') { $this->db->where(array("salt" => post("salt"), "user" => post("user"))); $prakerin = $this->db->get("prakerin")->row_array(); $ta = $this->db->get_where("ta", array("hast_ta" => post('tahun')))->row_array(); if ($prakerin) { $self = $prakerin['id_prakerin'] == $id_user; } if (!$prakerin || $self) { $data = array("salt" => post('salt'), "user" => post('user'), "id_ta" => $ta['id_ta'], "id_jurusan" => post('id_jurusan')); if (post('password')) { $data['pass'] = sha1(post('password')); } $this->db->where('id_prakerin', $id_user); $this->db->update('prakerin', $data); $this->all->setMsg("success", "Edit User Prakerin berhasil"); } else { $this->all->setMsg("error", "User, Jurusan dan Tahun Prakerin sudah ada"); } } else { // For User } } // Edit Prakerin if (post('edit_profil_prakerin')) { $perusahaan = $this->db->get_where('perusahaan', array('nama_perusahaan' => post('nama_perusahaan')))->row_array(); $data = array("judul_laporan" => post('judul_laporan'), "id_perusahaan" => $perusahaan['id_perusahaan'], "about_prakerin" => post('about_prakerin'), "tgl_prakerin" => date("Y-m-d")); $this->db->where('id_prakerin', $id_user); $this->db->update('prakerin', $data); if (post('nama_siswa')) { $id_siswa_prakerin = post("id_siswa_prakerin"); $id_alumni = post("id_alumni"); foreach (post('nama_siswa') as $k => $v) { $data1 = array("id_prakerin" => $id_user, "nama_siswa_prakerin" => $v, "id_siswa" => $id_alumni[$k]); if (!$id_alumni[$k]) { $data1["id_siswa"] = null; } if (isset($id_siswa_prakerin[$k])) { $this->db->where("id_siswa_prakerin", $id_siswa_prakerin[$k]); $this->db->update('kel_prakerin', $data1); } elseif ($v) { $this->db->insert('kel_prakerin', $data1); } } } $this->all->setMsg('success', "Berhasil Ubah Data Prakerin"); $_POST = ""; } if (post('asdf')) { alert(post('asdf')); } // Upload hasil laporan if (isset($_FILES['hasil_laporan'])) { $files = $_FILES['hasil_laporan']; $dir = "assets/files/"; $laporan = time() . $files['name']; $prakerin = $this->db->get_where('prakerin', array('id_prakerin' => $id_user))->row_array(); if ($prakerin['hasil_laporan']) { unlink($dir . $prakerin['hasil_laporan']); } if (move_uploaded_file($files['tmp_name'], $dir . $laporan)) { $data['hasil_laporan'] = $laporan; $this->db->where('id_prakerin', $id_user); $this->db->update('prakerin', $data); } } // Upload gallery prakerin if (isset($_FILES['img_prakerin'])) { foreach ($_FILES['img_prakerin']['name'] as $k => $v) { $foto = $_FILES['img_prakerin']; $dir = "assets/prakerin/"; $img = time() . $foto['name'][$k]; if (move_uploaded_file($foto['tmp_name'][$k], $dir . $img)) { // Image manipulation $config['source_image'] = 'assets/prakerin/' . $img; $config['create_thumb'] = TRUE; $this->image_lib->initialize($config); $this->image_lib->resize(); // Insert Database $data = array('id_user' => $id_user, 'title_gallery' => post('title_gallery'), 'img_gallery' => $img, 'thumb_gallery' => get_thumb($img), 'role_gallery' => 'prakerin'); if ($this->session->userdata('role') == 'admin') { $data['status'] = "active"; } $this->db->insert('gallery', $data); } } } // Delete sisa kel prakerin if (post('delete') == "kel_prakerin") { $this->db->where('id_siswa_prakerin', post('id')); $this->db->delete('kel_prakerin'); } // Delete gallery prakerin if (post('delete') == "gallery_prakerin") { $gallery = $this->db->get_where('gallery', array('id_gallery' => post('id')))->row_array(); $dir = "assets/prakerin/"; unlink($dir . $gallery['img_gallery']); unlink($dir . $gallery['thumb_gallery']); $this->db->where('id_gallery', post('id')); $this->db->delete('gallery'); } // Aksi admin if ($this->session->userdata('role') == 'admin') { // Add Prakerin if (post('add_prakerin')) { $this->db->where(array("salt" => post("salt"), "user" => post("user"))); $prakerin = $this->db->get("prakerin")->row_array(); $ta = $this->db->get_where("ta", array("hast_ta" => post('tahun')))->row_array(); $perusahaan = $this->db->get_where('perusahaan', array("nama_perusahaan" => post("nama_perusahaan")))->row_array(); if (!$prakerin) { $data = array("user" => post('user'), "salt" => post('salt'), "pass" => sha1('12345'), "id_jurusan" => post('id_jurusan'), "id_ta" => $ta['id_ta'], "id_perusahaan" => $perusahaan['id_perusahaan'], "status_prakerin" => "active", "tgl_prakerin" => date("Y-m-d")); $this->db->insert('prakerin', $data); $this->db->where(array("salt" => post("salt"), "user" => post("user"))); $prakerin = $this->db->get("prakerin")->row_array(); if (post('nama_siswa')) { $id_alumni = post("id_alumni"); foreach (post('nama_siswa') as $k => $v) { $data1 = array("id_prakerin" => $prakerin['id_prakerin'], "nama_siswa_prakerin" => $v, "id_siswa" => $id_alumni[$k]); if (!$id_alumni[$k]) { $data1["id_siswa"] = null; } if ($v) { $this->db->insert('kel_prakerin', $data1); } } } $this->all->setMsg('success', "Berhasil Tambah Prakerin"); $_POST = ""; } else { $this->all->setMsg('error', "User prakerin sudah ada"); } } /*Edit status prakerin*/ if (post('status') == "prakerin") { $status = explode(".", post('id')); $this->db->where('id_prakerin', $status[0]); $this->db->update('prakerin', array('status_prakerin' => $status[1])); } /*Edit status All galery prakerin*/ if (post('status') == "gallery") { $status = explode(".", post('id')); $this->db->where('id_user', $status[0]); $this->db->update('gallery', array('status' => $status[1])); } /*Edit status gallery prakerin*/ if (post('status') == "gallery_prakerin") { $status = explode(".", post('id')); $this->db->where('id_gallery', $status[0]); $this->db->update('gallery', array('status' => $status[1])); } // Delete prakerin if (post('delete') == "prakerin") { // Delete kel prakerin $prakerin = $this->db->get_where('prakerin', array('id_prakerin' => post('id')))->row_array(); $this->db->where('id_prakerin', $prakerin['id_prakerin']); $this->db->delete("kel_prakerin"); // Delete Prakerin $this->db->where('id_prakerin', post('id')); $this->db->delete('prakerin'); } } }
$currency = ' USD'; $currency_sql = 'price-usd'; } if ($this->uri->segment(1) == 'tr') { $currency = ' TRY'; $currency_sql = 'price-try'; } if ($this->uri->segment(1) == 'ru') { $currency = ' РУБ'; $currency_sql = 'price-rub'; } ?> <table style='border: 1px solid gray'> <tr><td class='f_td'>Фото</td><?php foreach ($comparsion_items as $value) { echo "<td><a href=\"" . base_url() . 'catalog/' . $value[0]['category_alias'] . "/" . $value[0]['subcategory_alias'] . "/" . $value[0]['id'] . "\"><img src='" . base_url() . "assets/img/products/thumbs/" . get_thumb($value[0]['image']) . "'><a href='javascript:void(0)'>Убрать из сравнения</a></td>"; } ?> </tr> <?php if ($comparsion_items[0][0]['name'] != NULL) { ?> <tr><td>Наименование</td><?php foreach ($comparsion_items as $value) { echo "<td>" . $value[0]['name'] . "</td>"; } ?> </tr><?php } if ($comparsion_items[0][0][$currency_sql] != NULL) { ?>
} if (isset($_GET['zip'])) { if (_CACHE) { $F = zip_path(); } else { $F = sys_get_temp_dir() . '/' . basename($_GET['zip']); } set_download_headers(GNAME . ".zip"); send_file($F, 'application/zip'); if (!_CACHE) { unlink($F); } exit; } if (isset($_GET['thumb'])) { get_thumb($_GET['thumb']); exit; } if (isset($_GET['images'])) { header('Content-Type: application/json'); echo json_encode(get_images_list()); exit; } if (isset($_GET['img'])) { $A = null; $B = null; if (isset($_GET['w'])) { $A = $_GET['w']; } if (isset($_GET['h'])) { $B = $_GET['h'];
function del_multi_img($root, $dir, $tbl_name, $field_name, $del) { foreach ($del as $val) { //echo $val; $tbl_ = new table($tbl_name); $res_ = $tbl_->loadOne('id=' . $val); $row_ = mysql_fetch_object($res_); $tmp = explode('(*_^)', $row_->{$field_name}); for ($i = 0; $i < count($tmp); $i++) { $file1 = $root . $tmp[$i]; if (is_file($file1)) { unlink($file1); } $file2 = $root . get_thumb($dir, $tmp[$i]); if (is_file($file2)) { unlink($file2); } } $str = "delete from " . $tbl_name . " where id='{$val}'"; mysql_query($str); } }