Ejemplo n.º 1
0
 function delete_image()
 {
     $id = $this->input->post('del_id_img');
     $table = $this->input->post('del_table');
     $field = $this->input->post('del_field');
     $GetFile = GetValue($field, $table, array("id" => "where/" . $id));
     $GetThumb = GetThumb($GetFile);
     if ($table != "admin") {
         if (file_exists("./" . $this->config->item('path_upload') . "/" . $GetFile)) {
             unlink("./" . $this->config->item('path_upload') . "/" . $GetFile);
         }
         if (file_exists("./" . $this->config->item('path_upload') . "/" . $GetThumb)) {
             unlink("./" . $this->config->item('path_upload') . "/" . $GetThumb);
         }
     } else {
         if (file_exists("./" . $this->config->item('path_upload') . "/foto/" . $GetFile)) {
             unlink("./" . $this->config->item('path_upload') . "/foto/" . $GetFile);
         }
         if (file_exists("./" . $this->config->item('path_upload') . "/foto/" . $GetThumb)) {
             unlink("./" . $this->config->item('path_upload') . "/foto/" . $GetThumb);
         }
     }
     $data[$field] = "";
     $this->db->where("id", $id);
     $this->db->update($table, $data);
 }
Ejemplo n.º 2
0
 function DelImage()
 {
     $CI =& get_instance();
     $webmaster_id = $this->auth();
     $mz_function = new mz_function();
     $id = $CI->input->post('del_id_img');
     $table = $CI->input->post('del_table');
     $field = $CI->input->post('del_field');
     $GetFile = GetValue($field, $table, array("id" => "where/" . $id));
     $GetThumb = GetThumb($GetFile);
     if (file_exists("./" . $CI->config->item('path_upload') . "/" . $GetFile)) {
         unlink("./" . $CI->config->item('path_upload') . "/" . $GetFile);
     }
     if (file_exists("./" . $CI->config->item('path_upload') . "/" . $GetThumb)) {
         unlink("./" . $CI->config->item('path_upload') . "/" . $GetThumb);
     }
     $data[$field] = "";
     $this->db->where("id", $id);
     $this->db->update($table, $data);
 }
Ejemplo n.º 3
0
 /**
  * Function used to create value array for email templates
  * @param video_details ARRAY
  */
 function set_share_email($details)
 {
     $this->email_template_vars = array('{video_title}' => $details['title'], '{video_description}' => $details['description'], '{video_tags}' => $details['tags'], '{video_date}' => cbdate(DATE_FORMAT, strtotime($details['date_added'])), '{video_link}' => video_link($details), '{video_thumb}' => GetThumb($details));
     $this->action->share_template_name = 'share_video_template';
     $this->action->val_array = $this->email_template_vars;
 }
Ejemplo n.º 4
0
 function update_employee()
 {
     $webmaster_id = permission();
     $id = $this->input->post('id');
     $GetColumns = GetColumns("hris_persons");
     foreach ($GetColumns as $r) {
         if ($this->input->post($r['Field'] . "_file") || isset($_FILES[$r['Field']]['name'])) {
             if ($_FILES[$r['Field']]['name']) {
                 $data[$r['Field']] = InputFile($r['Field'], 1000);
                 if ($data[$r['Field']] == "2") {
                     $this->session->set_flashdata("message", lang('msg_err_size'));
                     redirect($this->filename . '/detail/' . $id);
                 } else {
                     if ($data[$r['Field']] == "3") {
                         $this->session->set_flashdata("message", lang('msg_err_ext'));
                         redirect($this->filename . '/detail/' . $id);
                     }
                 }
                 $file_old = $this->input->post($r['Field'] . "_file");
                 if (file_exists("./" . $this->config->item('path_upload') . "/" . $file_old) && $file_old) {
                     unlink("./" . $this->config->item('path_upload') . "/" . $file_old);
                 }
                 $thumb = GetThumb($file_old);
                 if (file_exists("./" . $this->config->item('path_upload') . "/" . $thumb) && $thumb) {
                     unlink("./" . $this->config->item('path_upload') . "/" . $thumb);
                 }
             }
         } else {
             $data[$r['Field']] = $this->input->post($r['Field']);
             $data[$r['Field'] . "_temp"] = $this->input->post($r['Field'] . "_temp");
             if ($r['Field'] == "userpass") {
                 if ($data[$r['Field']] != $data[$r['Field'] . "_temp"]) {
                     $data[$r['Field']] = md5($this->config->item('encryption_key') . $data[$r['Field']]);
                 }
             }
             if (!$data[$r['Field']] && !$data[$r['Field'] . "_temp"]) {
                 unset($data[$r['Field']]);
             }
             unset($data[$r['Field'] . "_temp"]);
         }
     }
     $dt = date("Y-m-d H:i:s");
     //$data['group_shift'] = $this->input->post("group_shift");
     //print_mz($data);
     if ($id > 0) {
         //Insert ke tabel history
         /*$q = GetAll($this->tabel, array("id"=> "where/".$id));
         		$history = $q->result_array();
         		$history[0]['modify_date'] = date("Y-m-d H:i:s");
         		$this->db->insert($this->tabel."_history", $history[0]);*/
         //$data['modify_user_id'] = $webmaster_id;
         $this->db->where("person_id", $id);
         $this->db->update("hris_persons", $data);
         $this->exe_shift($id, $this->input->post('group_shift_active'));
         //Admin Log
         //$logs = $this->db->last_query();
         //$this->model_admin_all->LogActivities($webmaster_id,$this->tabel,$this->db->insert_id(),$logs,lang($this->filename),$data[$this->title_table],$this->filename,"Add");
         //$this->session->set_flashdata("message", lang('edit')." ".$this->title." ".lang('msg_sukses'));
     } else {
         //$data['create_user_id'] = $webmaster_id;
         $data['created_dttm'] = $dt;
         $this->db->insert("hris_persons", $data);
         $id = $this->db->insert_id();
         //Admin Log
         //$logs = $this->db->last_query();
         //$this->model_admin_all->LogActivities($webmaster_id,$this->tabel,$this->db->insert_id(),$logs,lang($this->filename),$data[$this->title_table],$this->filename,"Add");
         //$this->session->set_flashdata("message", lang('add')." ".$this->title." ".lang('msg_sukses'));
     }
     $this->list_employee();
 }
Ejemplo n.º 5
0
 /**
  * Get playlist thumb
  * 
  * return a group of playlist thumbs
  * 
  * @param PID playlistid
  * @return THUMBS Array 
  */
 function getPlaylistThumb($pid)
 {
     $pid = (int) $pid;
     $array = array();
     $items = $this->get_playlist_items($pid, NULL, 3);
     global $cbvid, $cbaudio;
     $array = array();
     if ($items) {
         foreach ($items as $item) {
             $item['type'] == 'v';
             $array[] = GetThumb($item['object_id']);
         }
     } else {
         return array(TEMPLATEURL . '/images/playlist-default.png');
     }
     $array = array_unique($array);
     rsort($array);
     return $array;
 }
function AdminNewsEditTopic()
{
    global $news_access_edittopics;
    if (!isset($_GET['id']) || !$news_access_edittopics) {
        System::admin()->AccessDenied();
    }
    AddCenterBox('Редактирование раздела');
    UseScript('jquery_ui', 'colorbox?theme=admin');
    $id = SafeEnv($_GET['id'], 11, int);
    System::database()->Select('news_topics', "`id`='" . $id . "'");
    $topic = System::database()->FetchRow();
    FormRow('Название раздела', System::admin()->Edit('topic_name', SafeDB($topic['title'], 255, str), false, 'maxlength="255" style="width:400px;" class="autofocus"'));
    FormTextRow('Описание (HTML)', System::admin()->HtmlEditor('topic_description', SafeDB($topic['description'], 255, str), 600, 200));
    $image = SafeDB($topic['image'], 255, str);
    list($width, $height) = SafeDB(explode(':', System::config('news/topics_tmb_size')), 11, int);
    FormRow('Изображение', System::admin()->FileManager('topic_image', $image) . '<br>
		<a href="' . $image . '" class="filemanager_topic_image colorbox" data-content="href:path" target="_blank">
			<img src="' . GetThumb($image, $width, $height) . '" class="filemanager_topic_image" data-content="src:tmb" style="margin-top: 5px; max-width: 250px;">
		</a>');
    AddForm('<form name="topicsform" action="' . ADMIN_FILE . '?exe=news&a=savetopic&id=' . $id . '" method="post" enctype="multipart/form-data" name="topicsform">', System::admin()->Button('Отмена', 'onclick="history.go(-1);"') . System::admin()->Submit('Сохранить'));
}
Ejemplo n.º 7
0
 function UploadThumb($flv, $thumbid)
 {
     $file = $_FILES["upload_thumb_{$thumbid}"]['tmp_name'];
     $ext = GetExt($_FILES["upload_thumb_{$thumbid}"]['name']);
     if (!empty($file) && $ext == 'jpg') {
         $image = new ResizeImage();
         if ($image->ValidateImage($file, $ext)) {
             $thumb = BASEDIR . '/files/thumbs/' . GetThumb($flv, $thumbid);
             move_uploaded_file($file, $thumb);
             $image->CreateThumb($thumb, $thumb, THUMB_WIDTH, $ext, THUMB_HEIGHT, false);
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
Ejemplo n.º 8
0
 function typeinput($table, $key, $type, $related = "", $value = "", $title_related = "")
 {
     $typeinput = "";
     if ($type == "Text") {
         //Text
         if ($key == "userpass" || $key == "passwd") {
             $data_input = array('name' => $key, 'value' => $value, 'class' => 'span5 required', 'type' => 'password');
         } else {
             $data_input = array('name' => $key, 'value' => $value, 'class' => 'span5 required');
         }
         $typeinput = form_input($data_input);
     } else {
         if ($type == "Label") {
             //Label
             $typeinput = "<label class='search'>" . $value . "</label>";
             //$typeinput .= "<input type='hidden' id='".$key."' name='".$key."' value='".$value."'>";
         } else {
             if ($type == "Dropdown") {
                 //Dropdown
                 $GetMultiLang = $this->_ci->get_value("is_multi_lang", "config", "tabel='" . $table . "'");
                 if ($related == 'kg_menu_admin' || $related == 'kg_menu') {
                     $filter = $GetMultiLang ? array('id_lang' => 'where/' . $this->_ci->session->userdata("ses_id_lang"), 'id_parents' => "order/asc", 'id' => "order/asc") : array('id_parents' => "order/asc", 'id' => "order/asc");
                 } else {
                     $filter = $GetMultiLang ? array('id_lang' => 'where/' . $this->_ci->session->userdata("ses_id_lang")) : array();
                 }
                 //print_r($filter);
                 $opt_list = array();
                 $opt_list[] = "-- Select Value --";
                 if ($related) {
                     $Opt = $this->_ci->model_admin_all->GetAll($related, $filter);
                     foreach ($Opt->result_array() as $r) {
                         if ($related == 'kg_menu_admin' || $related == 'kg_menu') {
                             if ($r['id_parents'] != 0) {
                                 $filter = array("id" => "where/" . $r['id_parents'], 'id_lang' => 'where/' . $this->_ci->session->userdata("ses_id_lang"));
                                 $qu = GetAll($related, $filter);
                                 $row = $qu->row_array();
                                 if ($title_related) {
                                     $opt_list[$r['id']] = $row['title'] . '&nbsp;--&nbsp;' . $r[$title_related];
                                 } else {
                                     $opt_list[$r['id']] = $row['title'] . '&nbsp;--&nbsp;' . $r['title'];
                                 }
                             } else {
                                 if ($title_related) {
                                     $opt_list[$r['id']] = $r[$title_related];
                                 } else {
                                     $opt_list[$r['id']] = $r['title'];
                                 }
                             }
                         } else {
                             if ($title_related) {
                                 $opt_list[$r['id']] = $r[$title_related];
                             } else {
                                 $opt_list[$r['id']] = $r['title'];
                             }
                         }
                     }
                 } else {
                     $GetTypeData = $this->_ci->model_admin_all->GetTypeDataByField($table, $key);
                     $exp = explode("'", $GetTypeData);
                     for ($i = 1; $i < count($exp); $i += 2) {
                         $opt_list[$exp[$i]] = $exp[$i];
                     }
                 }
                 $typeinput = form_dropdown($key, $opt_list, $value, "class='span5'");
             } else {
                 if ($type == "File") {
                     //File
                     $data_input = array('name' => $key, 'type' => 'file', 'class' => 'span5');
                     $typeinput = form_input($data_input);
                     $ext_file = strrchr($value, '.');
                     $img = $value;
                     if (strtolower($ext_file) == ".jpg" || strtolower($ext_file) == ".jpeg" || strtolower($ext_file) == ".png") {
                         $img = "<img src='" . base_url() . $this->_ci->config->item('path_upload') . "/" . GetThumb($value) . "' class='img_detail'>";
                         $typeinput .= "<div id='" . $key . "img' style='margin-left:100px;'>" . $img . "<br><a class='del_img' alt='" . $key . "'>" . lang('delete_file') . "</a></div>";
                     } else {
                         if ($img) {
                             $typeinput .= "<div id='" . $key . "img' style='margin-left:100px;'>" . $img . "<br><a class='del_img' alt='" . $key . "'>" . lang('delete_file') . "</a></div>";
                         }
                     }
                     if (!$value) {
                         $value = "-";
                     }
                     $typeinput .= "<input type='hidden' id='" . $key . "_file' name='" . $key . "_file' value='" . $value . "'>";
                 } else {
                     if ($type == "Textarea") {
                         //Textarea
                         $data_input = array('name' => $key, 'id' => $key, 'value' => $value, 'cols' => 10, 'rows' => 5, 'class' => 'span5');
                         $typeinput = form_textarea($data_input);
                         $typeinput .= "<script>\n            \t\tCKEDITOR.replace( '" . $key . "',\n            \t\t\t\t{\n\t\t\t\t\t\tskin : 'office2003',\n\t\t\t\t\t\tfilebrowserBrowseUrl : '" . base_url() . "assets/mz_ckfinder/ckfinder.html',\n\t\t\t\t\t\t\t\t\t\t\t filebrowserImageBrowseUrl : '" . base_url() . "assets/mz_ckfinder/ckfinder.html?Type=Images',\n\t\t\t\t\t\t\t\t\t\t\t filebrowserFlashBrowseUrl : '" . base_url() . "assets/mz_ckfinder/ckfinder.html?Type=Flash',\n\t\t\t\t\t\t\t\t\t\t\t filebrowserUploadUrl : '" . base_url() . "assets/mz_ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',\n\t\t\t\t\t\t\t\t\t\t\t filebrowserImageUploadUrl : '" . base_url() . "assets/mz_ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',\n\t\t\t\t\t\t\t\t\t\t\t filebrowserFlashUploadUrl : '" . base_url() . "assets/mz_ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash',\n\t\t\t\t\t\ttoolbar :\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t['Source','-','Preview','Templates','Cut','Copy','Paste'],['Bold','Italic','Underline','Strike','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','NumberedList','BulletedList','Subscript','Superscript','-'],\n\t\t\t\t\t\t\t'/',\n\t\t\t\t\t\t\t['Link','Unlink','-','Image','Flash','Table','HorizontalRule','Smiley','SpecialChar'],['TextColor','BGColor','-','Font','FontSize','PasteFromWord']\n\t\t\t\t\t\t]\n\t\t\t\t\t});\n            \t</script>";
                     } else {
                         if ($type == "Checkbox") {
                             //Checkbox
                             if ($value == 1) {
                                 $checked = true;
                             } else {
                                 $checked = false;
                             }
                             $data_input = array('name' => $key, 'value' => 1, 'checked' => $checked);
                             $typeinput = form_checkbox($data_input);
                         } else {
                             if ($type == "Hidden") {
                                 //Hidden
                                 $data_input = array('name' => $key, 'id' => $key, 'value' => $value, 'type' => 'hidden', 'class' => 'span5');
                                 $typeinput = form_input($data_input);
                             } else {
                                 if ($type == "Date") {
                                     //Date
                                     $value = $value == '' || $value == '0000-00-00 00:00:00' ? now() : strtotime($value);
                                     $data_input = array('name' => $key, 'id' => $key, 'value' => date('Y-m-d', $value), 'type' => 'text', 'class' => 'span5');
                                     $typeinput = form_input($data_input) . " <span style='font-size: 11px'>format : yyyy-mm-dd</span>";
                                     $typeinput .= "<script>\n\t\t\t            \t\t\$(document).ready(function() {\n\t\t\t\t\t\t\t\t\t\$('#" . $key . "').DatePicker({\n\t\t\t\t\t\t\t\t\t\tformat:'Y-m-d',\n\t\t\t\t\t\t\t\t\t\tdate: \$('#" . $key . "').val(),\n\t\t\t\t\t\t\t\t\t\tcurrent: \$('#" . $key . "').val(),\n\t\t\t\t\t\t\t\t\t\tstarts: 1,\n\t\t\t\t\t\t\t\t\t\tposition: 'right',\n\t\t\t\t\t\t\t\t\t\tonBeforeShow: function(){\n\t\t\t\t\t\t\t\t\t\t\t\$('#" . $key . "').DatePickerSetDate(\$('#" . $key . "').val(), true);\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tonChange: function(formated, dates){\n\t\t\t\t\t\t\t\t\t\t\t\$('#" . $key . "').val(formated);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}); \n\t\t\t            \t</script>";
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return $typeinput;
 }
function IndexNewsTopics()
{
    $title = 'Разделы новостей';
    System::site()->SetTitle($title);
    System::site()->BreadCrumbAdd($title);
    $topics = IndexNewsGetTopics();
    if (count($topics) == 0) {
        System::site()->AddTextBox('Разделы новостей', '<p align="center">Разделов новостей пока нет.</p>');
    } else {
        System::site()->AddTemplatedBox('Разделы новостей', 'module/news_topics.html');
        System::site()->AddBlock('news_topics', true, true, 'newstopic');
        foreach ($topics as $topic) {
            $vars = array();
            $image = SafeDB($topic['image'], 255, str);
            if ($image == '' || substr($image, 0, 7) == 'http://') {
                $vars['image'] = $image;
                $vars['image_url'] = false;
            } else {
                $size = ImageSize($image);
                list($width, $height) = SafeDB(explode(':', System::config('news/topics_tmb_size')), 11, int);
                if ($size['width'] > $width) {
                    $vars['image'] = GetThumb($image, $width, $height);
                    $vars['image_url'] = $image;
                } else {
                    $vars['image'] = $image;
                    $vars['image_url'] = false;
                }
            }
            $vars['url'] = Ufu('index.php?name=news&topic=' . SafeDB($topic['id'], 11, int), 'news/{topic}/');
            $vars['desc'] = SafeDB($topic['description'], 255, str);
            $vars['title'] = SafeDB($topic['title'], 255, str);
            $vars['num_news'] = SafeDB($topic['counter'], 11, int);
            System::site()->AddSubBlock('news_topics', true, $vars);
        }
    }
}