示例#1
0
 /**
  * function sMain ()
  * Khoi tao 
  **/
 function sMain()
 {
     global $ttH;
     $ttH->func->load_language_admin($this->modules);
     $ttH->temp_act = new XTemplate($ttH->path_html . $this->modules . DS . $this->action . ".tpl");
     $ttH->temp_act->assign('LANG', $ttH->lang);
     $ttH->temp_act->assign('DIR_IMAGE', $ttH->dir_images);
     include $this->modules . "_func.php";
     load_setting();
     $this->dir = create_folder(date("Y_m"));
     $data["link_manage"] = $ttH->admin->get_link_admin($this->modules, $this->action, "manage");
     $data["link_manage_trash"] = $ttH->admin->get_link_admin($this->modules, $this->action, "manage_trash");
     $data["link_add"] = $ttH->admin->get_link_admin($this->modules, $this->action, "add");
     $this->sub = isset($ttH->input["sub"]) ? $ttH->input["sub"] : "manage";
     switch ($this->sub) {
         default:
             $this->sub = "manage";
             $ttH->conf["page_title"] = $ttH->lang[$this->modules][$this->modules . "_manage"];
             $data["main"] = $this->do_manage();
             break;
     }
     $data["class"] = array();
     $data["class"][$this->sub] = ' class="active"';
     $data["page_title"] = $ttH->conf["page_title"];
     $ttH->temp_act->assign('data', $data);
     $ttH->temp_act->parse("main");
     $ttH->output .= $ttH->temp_act->text("main");
 }
示例#2
0
 /**
  * function sMain ()
  * Khoi tao 
  **/
 function sMain()
 {
     global $ttH;
     include $this->modules . "_func.php";
     $this->dir = create_folder(date("Y_m"));
     require_once 'modules/common/include/item.php';
 }
示例#3
0
 function do_add()
 {
     global $ttH;
     $data = array();
     $err = "";
     $dir = create_folder(date("Y_m"));
     if (isset($ttH->post['do_submit'])) {
         /*print_arr($ttH->post);
         		die();*/
         if (empty($ttH->post["list_color"])) {
             $err = $ttH->html->html_alert('Vui lòng chọn màu', "error");
         }
         if (empty($ttH->post["list_size"])) {
             $err = $ttH->html->html_alert('Vui lòng chọn size', "error");
         }
         if (empty($err)) {
             $ok = 0;
             $arr_color = $ttH->post["list_color"];
             $arr_size = $ttH->post["list_size"];
             foreach ($arr_color as $key => $color) {
                 $sql = "select id \n\t\t\t\t\t\t\t\t\tfrom product_combine \n\t\t\t\t\t\t\t\t\twhere type='" . $this->type . "' \n\t\t\t\t\t\t\t\t\tand type_id='" . $this->type_id . "' \n\t\t\t\t\t\t\t\t\tand color_id='" . $arr_color[$key] . "' \n\t\t\t\t\t\t\t\t\tand size_id='" . $arr_size[$key] . "' ";
                 $result = $ttH->db->query($sql);
                 if (!$ttH->db->num_rows($result)) {
                     $col = array();
                     $col["type"] = $this->type;
                     $col["type_id"] = $this->type_id;
                     $col["color_id"] = $arr_color[$key];
                     $col["size_id"] = $arr_size[$key];
                     $okf = $ttH->db->do_insert("product_combine", $col);
                     if ($okf) {
                         $ok++;
                     }
                 }
             }
             if ($ok) {
                 $data = array();
                 $err = $ttH->html->html_alert($ttH->lang["global"]["add_success"], "success");
             } else {
                 $data = $ttH->post;
                 $err = $ttH->html->html_alert($ttH->lang["global"]["add_false"], "error");
             }
         } else {
             $data = $ttH->post;
         }
     }
     $data["err"] = $err;
     $data["link_action"] = $ttH->admin->get_link_admin($this->modules, $this->action, $this->sub) . $this->ext_link;
     $data["link_up"] = $ttH->admin->get_link_admin('library', 'library', 'popup_library') . '&type=1&folder_up=' . $this->modules . '&fldr=' . $dir . '&editor=mce_0';
     $data["list_color"] = list_color("list_color[]", '', " class=\"form-control\"");
     $data["list_size"] = list_size("list_size[]", '', " class=\"form-control\"");
     for ($i = 1; $i <= 5; $i++) {
         $data['index'] = $i;
         $ttH->temp_act->assign('data', $data);
         $ttH->temp_act->parse("add.row");
     }
     $ttH->temp_act->assign('data', $data);
     $ttH->temp_act->parse("add");
     return $ttH->temp_act->text("add");
 }
示例#4
0
 /**
  * Returns the path where the view will be created
  **/
 private function getViewPath($model, $view)
 {
     $view_path = VIEW_PATH . $this->sep . Text::pluralize($model);
     if (!$this->test) {
         create_folder($this->getPath($view_path, ""));
     }
     return $this->getPath($view_path, $view);
 }
示例#5
0
 function add_new_success()
 {
     $user = $this->session->userdata("isLoggedIn");
     if (strtolower($user->type_name) == "student") {
         $this->form_validation->set_rules('semester_id', 'Semester', 'required');
     }
     $this->form_validation->set_rules('subject_id', 'Subject', 'required');
     $this->form_validation->set_rules('filename', 'File Name', 'required');
     if (empty($_FILES['doc_paths']['name'])) {
         $this->form_validation->set_rules('doc_paths', 'Document', 'required');
     }
     if ($this->form_validation->run() == FALSE) {
         $this->add_new();
     } else {
         $data['user_id'] = $this->session->userdata("isLoggedIn")->id;
         if (strtolower($user->type_name) == "student") {
             $data['semester_id'] = $this->input->post('semester_id');
         }
         $data['subject_id'] = $this->input->post('subject_id');
         $data['filename'] = $this->input->post('filename');
         if ($this->input->post('privacy') == "on") {
             $data['privacy'] = 1;
         } else {
             $data['privacy'] = 0;
         }
         if (strtolower($user->type_name) == "student") {
             $path = create_folder($data['user_id'], $data['semester_id'], $data['subject_id']);
         } else {
             $path = create_folder($data['user_id'], NULL, $data['subject_id']);
         }
         $docpath = str_replace('./uploads/', '', $path);
         $data['doc_paths'] = $docpath;
         for ($i = 0; $i < count($_FILES['doc_paths']['name']); $i++) {
             $name = $_FILES['doc_paths']['name'][$i];
             if (strlen($name)) {
                 $fname = time() . '_' . basename($_FILES['doc_paths']['name'][$i]);
                 $fname = str_replace(" ", "_", $fname);
                 $fname = str_replace("%", "_", $fname);
                 $name_ext = end(explode(".", basename($_FILES['doc_paths']['name'][$i])));
                 $name = str_replace('.' . $name_ext, '', basename($_FILES['doc_paths']['name'][$i]));
                 $uploaddir = $path . '/';
                 $uploadfile = $uploaddir . $fname;
                 if (move_uploaded_file($_FILES['doc_paths']['tmp_name'][$i], $uploadfile)) {
                     $doc_paths = $_FILES["doc_paths"];
                     $data['filesize'] = $doc_paths["size"][$i];
                     $data['type'] = $doc_paths["type"][$i];
                     $data['name'] = $doc_paths["name"][$i];
                     $data["uploaded_filename"] = $fname;
                     $this->common_model->insert("documents", $data);
                 } else {
                 }
             }
         }
     }
 }
示例#6
0
 /**
  * function sMain ()
  * Khoi tao 
  **/
 function sMain()
 {
     global $ttH;
     $ttH->func->include_css($ttH->dir_css_global . 'excolor-master/css/excolor.css');
     $ttH->func->include_js($ttH->dir_js . 'excolor-master/prettify.js');
     $ttH->func->include_js($ttH->dir_js . 'excolor-master/jquery.excolor.js');
     $ttH->func->include_js_content("\n\t\t\tjQuery(document).ready( function(\$) {\n\t\t\t\t\$('input.color_picker').excolor({\n\t\t\t\t\troot_path: '" . $ttH->dir_css_global . "excolor-master/img/'\n\t\t\t\t});\n\t\t\t});\n\t\t");
     include $this->modules . "_func.php";
     $this->dir = create_folder(date("Y_m"));
     require_once 'modules/common/include/single.php';
 }
示例#7
0
 /**
  * function sMain ()
  * Khoi tao 
  **/
 function sMain()
 {
     global $ttH;
     $ttH->func->load_language_admin($this->modules);
     $ttH->temp_act = new XTemplate($ttH->path_html . $this->modules . DS . $this->action . ".tpl");
     $ttH->temp_act->assign('LANG', $ttH->lang);
     $ttH->temp_act->assign('DIR_IMAGE', $ttH->dir_images);
     $ttH->func->include_css($ttH->dir_css_global . 'excolor-master/css/excolor.css');
     $ttH->func->include_js($ttH->dir_js . 'excolor-master/prettify.js');
     $ttH->func->include_js($ttH->dir_js . 'excolor-master/jquery.excolor.js');
     $ttH->func->include_js_content("\r\r\n\t\t\tjQuery(document).ready( function(\$) {\r\r\n\t\t\t\t\$('input.color_picker').excolor({\r\r\n\t\t\t\t\troot_path: '" . $ttH->dir_css_global . "excolor-master/img/'\r\r\n\t\t\t\t});\r\r\n\t\t\t});\r\r\n\t\t");
     include $this->modules . "_func.php";
     load_setting();
     /*if(!isset($ttH->data['menu_group']['menu_header_top'])){
     			$ttH->data['menu_group']['menu_header_top'] = 'Menu đầu trang';
     		}*/
     $this->dir = create_folder(date("Y_m"));
     $this->cur_group = isset($ttH->input["group_id"]) && array_key_exists($ttH->input["group_id"], $ttH->data["menu_group"]) ? $ttH->input["group_id"] : $this->cur_group;
     $data["link_manage"] = $ttH->admin->get_link_admin($this->modules, $this->action, "manage");
     $data["link_manage_trash"] = $ttH->admin->get_link_admin($this->modules, $this->action, "manage_trash");
     $data["link_add"] = $ttH->admin->get_link_admin($this->modules, $this->action, "add", array('group_id' => $this->cur_group));
     $this->sub = isset($ttH->input["sub"]) ? $ttH->input["sub"] : "manage";
     switch ($this->sub) {
         case "add":
             $ttH->conf["page_title"] = $ttH->lang[$this->modules][$this->action . "_" . $this->sub];
             $data["main"] = $this->do_add();
             break;
         case "edit":
             $ttH->conf["page_title"] = $ttH->lang[$this->modules][$this->action . "_" . $this->sub];
             $data["main"] = $this->do_edit();
             break;
         case "manage_trash":
             $ttH->conf["page_title"] = $ttH->lang[$this->modules][$this->action . "_" . $this->sub];
             $data["main"] = $this->do_manage("trash");
             break;
         default:
             $this->sub = "manage";
             $ttH->conf["page_title"] = $ttH->lang[$this->modules][$this->action . "_manage"];
             $data["main"] = $this->do_manage();
             break;
     }
     $data["class"] = array();
     $data["class"][$this->sub] = ' class="active"';
     $data["page_title"] = $ttH->conf["page_title"];
     $ttH->temp_act->assign('data', $data);
     $ttH->temp_act->parse("main");
     $ttH->output .= $ttH->temp_act->text("main");
 }
示例#8
0
 function sMain()
 {
     global $ttH;
     include $this->modules . "_func.php";
     $ttH->func->load_language_admin($this->modules);
     $ttH->temp_act = new XTemplate($ttH->path_html . $this->modules . DS . $this->action . ".tpl");
     $ttH->temp_act->assign('LANG', $ttH->lang);
     $this->dir = create_folder(date("Y_m"));
     $this->link_act = "?mod=" . $this->modules . "&act=" . $this->action;
     $ttH->conf["page_title"] = $ttH->lang[$this->modules][$this->modules];
     $data["page_title"] = $ttH->conf["page_title"];
     $data["main"] = $this->do_edit();
     $ttH->temp_act->assign('data', $data);
     $ttH->temp_act->parse("main");
     $ttH->output .= $ttH->temp_act->text("main");
 }
示例#9
0
 /**
  * function sMain ()
  * Khoi tao 
  **/
 function sMain()
 {
     global $ttH;
     $ttH->func->load_language_admin($this->modules);
     $ttH->temp_act = new XTemplate($ttH->path_html . $this->modules . DS . $this->action . ".tpl");
     $ttH->temp_act->assign('LANG', $ttH->lang);
     $ttH->temp_act->assign('DIR_IMAGE', $ttH->dir_images);
     include $this->modules . "_func.php";
     $this->dir = create_folder(date("Y_m"));
     $this->type = isset($ttH->get['type']) ? $ttH->get['type'] : '';
     $this->type_id = isset($ttH->get['type_id']) ? (int) $ttH->get['type_id'] : 0;
     $this->ext_link = '&type=' . $this->type . '&type_id=' . $this->type_id;
     if ($this->type != 'group' && $this->type != 'item' || $this->type_id <= 0) {
         $ttH->html->redirect_rel($ttH->admin->get_link_admin($this->modules, $this->modules, "manage"));
     }
     $data["link_manage"] = $ttH->admin->get_link_admin($this->modules, $this->action, "manage") . $this->ext_link;
     $data["link_manage_trash"] = $ttH->admin->get_link_admin($this->modules, $this->action, "manage_trash") . $this->ext_link;
     $data["link_add"] = $ttH->admin->get_link_admin($this->modules, $this->action, "add") . $this->ext_link;
     $this->sub = isset($ttH->input["sub"]) ? $ttH->input["sub"] : "manage";
     switch ($this->sub) {
         case "add":
             $ttH->conf["page_title"] = $ttH->lang[$this->modules][$this->action . "_" . $this->sub];
             $data["main"] = $this->do_add();
             break;
         case "edit":
             $ttH->conf["page_title"] = $ttH->lang[$this->modules][$this->action . "_" . $this->sub];
             $data["main"] = $this->do_edit();
             break;
         case "manage_trash":
             $ttH->conf["page_title"] = $ttH->lang[$this->modules][$this->action . "_" . $this->sub];
             $data["main"] = $this->do_manage("trash");
             break;
         default:
             $this->sub = "manage";
             $ttH->conf["page_title"] = $ttH->lang[$this->modules][$this->action . "_manage"];
             $data["main"] = $this->do_manage();
             break;
     }
     $data["class"] = array();
     $data["class"][$this->sub] = ' class="active"';
     $data["page_title"] = $ttH->conf["page_title"];
     $ttH->temp_act->assign('data', $data);
     $ttH->temp_act->parse("main");
     $ttH->output .= $ttH->temp_act->text("main");
 }
示例#10
0
function generate_application($app_path)
{
    $app_name = strtolower(end(split(DIRECTORY_SEPARATOR, $app_path)));
    $app_real_path = realpath($app_path);
    p('info', sprintf('will generate application %s in %s ', ucfirst($app_name), $app_real_path));
    create_folder($app_real_path);
    foreach (array('app', 'public', 'config', 'vendor', 'lib', 'log') as $f) {
        create_folder(make_path($app_real_path, $f));
    }
    $medick_path = realpath(make_path(dirname(__FILE__), '..'));
    create_file($app_real_path, 'boot.php', 'boot.php', array('app_real_path' => $app_real_path, 'medick_path' => $medick_path));
    create_file($app_real_path, 'config.xml', make_path('config', $app_name . '.xml'), array('app_name' => $app_name, 'app_real_path' => $app_real_path));
    create_file($app_real_path, 'htaccess', make_path('public', '.htaccess'), array('app_name' => $app_name));
    create_file($app_real_path, 'index.php', make_path('public', 'index.php'), array('app_name' => $app_name, 'app_real_path' => $app_real_path));
    touch(make_path($app_real_path, 'log', 'localhost.log'));
    chmod(make_path($app_real_path, 'log', 'localhost.log'), 0777);
    exit;
}
示例#11
0
    /**
     * function sMain ()
     * Khoi tao 
     **/
    function sMain()
    {
        global $ttH;
        $ttH->func->include_js($ttH->dir_temp . 'js/config/location.js');
        $ttH->func->include_js_content('
			jQuery(document).ready( function($) {
				ttHLocation.list_location_area_load_child();
				ttHLocation.list_location_country_load_child();
				ttHLocation.list_location_province_load_child();
			});
		');
        $ttH->func->include_css($ttH->dir_js . 'gmap3/jquery-autocomplete.css');
        $ttH->func->include_js('http://maps.googleapis.com/maps/api/js?sensor=false');
        $ttH->func->include_js($ttH->dir_js . 'gmap3/gmap3.min.js');
        $ttH->func->include_js($ttH->dir_js . 'gmap3/jquery-autocomplete.js');
        include $this->modules . "_func.php";
        $this->dir = create_folder(date("Y_m"));
        require_once 'modules/common/include/item.php';
    }
示例#12
0
 /**
  * function sMain ()
  * Khoi tao 
  **/
 function sMain()
 {
     global $ttH;
     $ttH->func->load_language_admin($this->modules);
     $ttH->temp_act = new XTemplate($ttH->path_html . $this->modules . DS . $this->action . ".tpl");
     $ttH->temp_act->assign('LANG', $ttH->lang);
     $ttH->temp_act->assign('DIR_IMAGE', $ttH->dir_images);
     $ttH->func->include_js($ttH->dir_temp . 'js/' . $this->modules . '/' . $this->action . ".js");
     include $this->modules . "_func.php";
     load_setting();
     $this->dir = create_folder(date("Y_m"));
     $this->cur_group = isset($ttH->input["group_id"]) && array_key_exists($ttH->input["group_id"], $ttH->data["banner_group"]) ? $ttH->input["group_id"] : $this->cur_group;
     $data["link_manage"] = $ttH->admin->get_link_admin($this->modules, $this->action, "manage", array('group_id' => $this->cur_group));
     $data["link_manage_trash"] = $ttH->admin->get_link_admin($this->modules, $this->action, "manage_trash", array('group_id' => $this->cur_group));
     $data["link_add"] = $ttH->admin->get_link_admin($this->modules, $this->action, "add", array('group_id' => $this->cur_group));
     $this->sub = isset($ttH->input["sub"]) ? $ttH->input["sub"] : "manage";
     switch ($this->sub) {
         case "add":
             $ttH->conf["page_title"] = $ttH->lang[$this->modules][$this->modules . "_" . $this->sub];
             $data["main"] = $this->do_add();
             break;
         case "edit":
             $ttH->conf["page_title"] = $ttH->lang[$this->modules][$this->modules . "_" . $this->sub];
             $data["main"] = $this->do_edit();
             break;
         case "manage_trash":
             $ttH->conf["page_title"] = $ttH->lang[$this->modules][$this->modules . "_" . $this->sub];
             $data["main"] = $this->do_manage("trash");
             break;
         default:
             $this->sub = "manage";
             $ttH->conf["page_title"] = $ttH->lang[$this->modules][$this->modules . "_manage"];
             $data["main"] = $this->do_manage();
             break;
     }
     $data["class"] = array();
     $data["class"][$this->sub] = ' class="active"';
     $data["page_title"] = $ttH->conf["page_title"];
     $ttH->temp_act->assign('data', $data);
     $ttH->temp_act->parse("main");
     $ttH->output .= $ttH->temp_act->text("main");
 }
示例#13
0
 /**
  * function sMain ()
  * Khoi tao 
  **/
 function sMain_sub()
 {
     global $ttH;
     $ttH->func->load_language_admin($this->modules);
     $ttH->temp_act = new XTemplate($ttH->path_html . $this->modules . DS . $this->temp . ".tpl");
     $ttH->temp_act->assign('LANG', $ttH->lang);
     $ttH->temp_act->assign('DIR_IMAGE', $ttH->dir_images);
     require_once "modules/" . $this->modules . "/" . $this->modules . "_func.php";
     $this->dir = create_folder('', $this->folder_upload);
     $data["link_manage"] = $ttH->admin->get_link_admin($this->modules, $this->action, "manage");
     $data["link_manage_trash"] = $ttH->admin->get_link_admin($this->modules, $this->action, "manage_trash");
     $data["link_add"] = $ttH->admin->get_link_admin($this->modules, $this->action, "add");
     $this->sub = isset($ttH->input["sub"]) ? $ttH->input["sub"] : "manage";
     switch ($this->sub) {
         case "add":
             $ttH->conf["page_title"] = $ttH->lang[$this->modules][$this->action . "_" . $this->sub];
             $data["main"] = $this->do_add();
             break;
         case "edit":
             $ttH->conf["page_title"] = $ttH->lang[$this->modules][$this->action . "_" . $this->sub];
             $data["main"] = $this->do_edit();
             break;
         case "manage_trash":
             $ttH->conf["page_title"] = $ttH->lang[$this->modules][$this->action . "_" . $this->sub];
             $data["main"] = $this->do_manage("trash");
             break;
         default:
             $this->sub = "manage";
             $ttH->conf["page_title"] = $ttH->lang[$this->modules][$this->action . "_manage"];
             $data["main"] = $this->do_manage();
             break;
     }
     $data["class"] = array();
     $data["class"][$this->sub] = ' class="active"';
     $data["page_title"] = $ttH->conf["page_title"];
     $ttH->temp_act->assign('data', $data);
     $ttH->temp_act->parse("main");
     $ttH->output .= $ttH->temp_act->text("main");
 }
示例#14
0
 function do_edit()
 {
     global $ttH;
     $err = "";
     $arr_order_shipping = array();
     $sql = "select shipping_id,title,content  \r\r\n\t\t\t\t\t\tfrom order_shipping  \r\r\n\t\t\t\t\t\twhere is_show=1 \r\r\n\t\t\t\t\t\torder by show_order desc, date_create asc";
     //echo $sql;
     $result = $ttH->db->query($sql);
     $html_row = "";
     while ($row = $ttH->db->fetch_row($result)) {
         $arr_order_shipping[$row['shipping_id']] = $row;
     }
     $arr_order_method = array();
     $sql = "select method_id,title,content  \r\r\n\t\t\t\t\t\tfrom order_method  \r\r\n\t\t\t\t\t\twhere is_show=1 \r\r\n\t\t\t\t\t\torder by show_order desc, date_create asc";
     //echo $sql;
     $result = $ttH->db->query($sql);
     $html_row = "";
     while ($row = $ttH->db->fetch_row($result)) {
         $arr_order_method[$row['method_id']] = $row;
     }
     $dir = create_folder(date("Y_m"));
     $order_id = $ttH->input["id"];
     if (isset($ttH->post['do_submit'])) {
         /*print_arr($ttH->post);
         		die();*/
         if (empty($err)) {
             $col = array();
             $arr_key = array('o_full_name', 'o_email', 'o_phone', 'o_address', 'd_full_name', 'd_email', 'd_phone', 'd_address', 'is_status');
             foreach ($arr_key as $key) {
                 $col[$key] = isset($ttH->post[$key]) ? $ttH->post[$key] : '';
             }
             $col["date_update"] = time();
             $ok = $ttH->db->do_update("product_order", $col, " order_id='" . $order_id . "'");
             if ($ok) {
                 $err = $ttH->html->html_alert($ttH->lang["global"]["edit_success"], "success");
             } else {
                 $err = $ttH->html->html_alert($ttH->lang["global"]["edit_false"], "error");
             }
         }
     }
     $sql = "select * from product_order where order_id='" . $order_id . "'";
     $result = $ttH->db->query($sql);
     if ($data = $ttH->db->fetch_row($result)) {
     }
     $data["err"] = $err;
     $data["link_action"] = $ttH->admin->get_link_admin($this->modules, $this->action, $this->sub, array("id" => $order_id));
     $data["link_up"] = $ttH->admin->get_link_admin('library', 'library', 'popup_library') . '&type=1&folder_up=' . $this->modules . '&fldr=' . $dir . '&editor=mce_0&field_id=picture';
     $data["table_cart"] = $this->table_cart($order_id);
     $data["list_status_order"] = list_status_order('is_status', $data['is_status'], " class=\"form-control\"");
     $data['shipping'] = isset($data['shipping']) && array_key_exists($data['shipping'], $arr_order_shipping) ? $arr_order_shipping[$data['shipping']] : array();
     $data['method'] = isset($data['method']) && array_key_exists($data['method'], $arr_order_method) ? $arr_order_method[$data['method']] : array();
     $ttH->temp_act->assign('data', $data);
     $ttH->temp_act->parse("edit");
     return $ttH->temp_act->text("edit");
 }
示例#15
0
     response('wrong path', 400)->send();
     exit;
 }
 $path = $current_path . $_POST['path'];
 $info = pathinfo($path);
 $base_folder = $current_path . fix_dirname($_POST['path']) . "/";
 switch ($info['extension']) {
     case "zip":
         $zip = new ZipArchive();
         if ($zip->open($path) === true) {
             //make all the folders
             for ($i = 0; $i < $zip->numFiles; $i++) {
                 $OnlyFileName = $zip->getNameIndex($i);
                 $FullFileName = $zip->statIndex($i);
                 if (substr($FullFileName['name'], -1, 1) == "/") {
                     create_folder($base_folder . $FullFileName['name']);
                 }
             }
             //unzip into the folders
             for ($i = 0; $i < $zip->numFiles; $i++) {
                 $OnlyFileName = $zip->getNameIndex($i);
                 $FullFileName = $zip->statIndex($i);
                 if (!(substr($FullFileName['name'], -1, 1) == "/")) {
                     $fileinfo = pathinfo($OnlyFileName);
                     if (in_array(strtolower($fileinfo['extension']), $ext)) {
                         copy('zip://' . $path . '#' . $OnlyFileName, $base_folder . $FullFileName['name']);
                     }
                 }
             }
             $zip->close();
         } else {
示例#16
0
 function do_edit()
 {
     global $ttH;
     $err = "";
     $dir = create_folder(date("Y_m"));
     $id = $ttH->input["id"];
     if (isset($ttH->post['do_submit'])) {
         /*print_arr($ttH->post);
         		die();*/
         if (empty($ttH->post["title"])) {
             $err = $ttH->html->html_alert($ttH->lang["global"]["err_invalid_title"], "error");
         }
         if (empty($err)) {
             $col = array();
             $col["date_update"] = time();
             $ok = $ttH->db->do_update("lang", $col, " id='" . $id . "'");
             if ($ok) {
                 $col_l = array();
                 $col_l["title"] = $ttH->post["title"];
                 $col_l["content"] = $ttH->func->input_editor($ttH->post["content"]);
                 $col_l["friendly_link"] = $ttH->post["friendly_link"] ? $ttH->func->get_friendly_link($ttH->post["friendly_link"]) : $ttH->func->get_friendly_link($ttH->post["title"]);
                 $col_l["meta_title"] = $ttH->post["meta_title"] ? $ttH->post["meta_title"] : $ttH->func->meta_title($ttH->post["title"]);
                 $col_l["meta_key"] = $ttH->post["meta_key"] ? $ttH->post["meta_key"] : $ttH->func->meta_key($ttH->post["title"]);
                 $col_l["meta_desc"] = $ttH->post["meta_desc"] ? $ttH->func->meta_desc($ttH->post["meta_desc"]) : $ttH->func->meta_desc($ttH->post["content"]);
                 $ttH->db->do_update("lang_lang", $col_l, " id='" . $id . "' and lang='" . $ttH->conf["lang_cur"] . "'");
                 $err = $ttH->html->html_alert($ttH->lang["global"]["edit_success"], "success");
             } else {
                 $err = $ttH->html->html_alert($ttH->lang["global"]["edit_false"], "error");
             }
         }
     }
     $sql = "select * from lang a, lang_lang al \r\r\n\t\t\t\t\t\twhere a.id=al.id \r\r\n\t\t\t\t\t\tand a.id=" . $id;
     $result = $ttH->db->query($sql);
     if ($data = $ttH->db->fetch_row($result)) {
     }
     $data["err"] = $err;
     $data["link_action"] = $ttH->admin->get_link_admin($this->modules, $this->action, $this->sub, array("id" => $id));
     $data["html_content"] = $ttH->editor->load_editor("content", "content", $data["content"], "", "full", array("folder_up" => $this->modules, "fldr" => $dir));
     $ttH->temp_act->assign('data', $data);
     $ttH->temp_act->parse("edit");
     return $ttH->temp_act->text("edit");
 }
示例#17
0
 /**
  * Delete or create a filder
  * 
  * @param boolean $set <b>true</b> Create a folder
  * <b>false</b> Delete the folder
  */
 public function updateFolder($set)
 {
     if ($this->hasFolder() && !$set) {
         delete_folder($this->hasFolder(), true);
     }
     if (!$this->hasFolder() && $set) {
         create_folder(_("Dateiordner der Gruppe:") . ' ' . $this->name, _("Ablage für Ordner und Dokumente dieser Gruppe"), $this->id, 15);
     }
 }
示例#18
0
                 foreach ($fixed_path_from_filemanager as $k => $paths) {
                     if ($paths != "" && $paths[strlen($paths) - 1] != "/") {
                         $paths .= "/";
                     }
                     $base_dir = $paths . substr_replace($path, '', 0, strlen($current_path));
                     if (is_dir($base_dir)) {
                         deleteDir($base_dir);
                     }
                 }
             }
         }
     }
     break;
 case 'create_folder':
     if ($create_folders) {
         create_folder(fix_path($path, $transliteration), fix_path($path_thumb, $transliteration));
     }
     break;
 case 'rename_folder':
     if ($rename_folders) {
         $name = fix_filename($name, $transliteration);
         $name = str_replace('.', '', $name);
         if (!empty($name)) {
             if (!rename_folder($path, $name, $transliteration)) {
                 die(lang_Rename_existing_folder);
             }
             rename_folder($path_thumb, $name, $transliteration);
             if ($fixed_image_creation) {
                 foreach ($fixed_path_from_filemanager as $k => $paths) {
                     if ($paths != "" && $paths[strlen($paths) - 1] != "/") {
                         $paths .= "/";
示例#19
0
	    <ul class="grid cs-style-2 <?php echo "list-view".$view; ?>" id="main-item-container">
		<?php
		
		$jplayer_ext=array("mp4","flv","webmv","webma","webm","m4a","m4v","ogv","oga","mp3","midi","mid","ogg","wav");
		foreach ($files as $file_array) {
		    $file=$file_array['file'];
			if($file == '.' || (isset($file_array['extension']) && $file_array['extension']!=lang_Type_dir) || ($file == '..' && $subdir == '') || in_array($file, $hidden_folders) || ($filter!='' && $file!=".." && strpos($file,$filter)===false))
			    continue;
			$new_name=fix_filename($file,$transliteration);
			if($file!='..' && $file!=$new_name){
			    //rename
			    rename_folder($current_path.$subdir.$new_name,$new_name,$transliteration);
			    $file=$new_name;
			}
			//add in thumbs folder if not exist 
			if (!file_exists($thumbs_path.$subdir.$file)) create_folder(false,$thumbs_path.$subdir.$file);
			$class_ext = 3;			
			if($file=='..' && trim($subdir) != '' ){
			    $src = explode("/",$subdir);
			    unset($src[count($src)-2]);
			    $src=implode("/",$src);
			    if($src=='') $src="/";
			}
			elseif ($file!='..') {
			    $src = $subdir . $file."/";
			}
			
			?>
			    <li data-name="<?php echo $file ?>" <?php if($file=='..') echo 'class="back"'; else echo 'class="dir"'; ?>><?php 
			    $file_prevent_rename = false;
			    $file_prevent_delete = false;
示例#20
0
 public function update()
 {
     $this->auth->check_login_json();
     $post = $this->input->post();
     if (empty($post)) {
         show_error('参数错误');
     }
     $data = array('code' => '1000', 'msg' => '');
     $this->load->library('form_validation');
     $this->form_validation->set_rules('pcode', ' ', 'max_length[20]');
     $this->form_validation->set_rules('name', ' ', 'required|max_length[50]');
     $this->form_validation->set_rules('price', ' ', 'numeric|max_length[8]');
     $this->form_validation->set_rules('best_price', ' ', 'numeric|max_length[8]');
     $this->form_validation->set_rules('amount', ' ', 'integer|max_length[8]');
     $this->form_validation->set_rules('sale_num', ' ', 'integer|max_length[8]');
     $this->form_validation->set_rules('unit', ' ', 'max_length[30]');
     $this->form_validation->set_rules('weight', ' ', 'numeric|max_length[8]');
     $this->form_validation->set_rules('min_num', ' ', 'integer|max_length[11]');
     $this->form_validation->set_rules('score', ' ', 'integer|max_length[11]');
     $this->form_validation->set_rules('status', ' ', 'integer');
     $this->form_validation->set_rules('recommend', ' ', 'integer');
     $this->form_validation->set_rules('specials', ' ', 'integer');
     $this->form_validation->set_rules('hot', ' ', 'integer');
     $this->form_validation->set_rules('allow_comment', ' ', 'integer');
     $this->form_validation->set_rules('show_home', ' ', 'integer');
     $this->form_validation->set_rules('handpick', ' ', 'integer');
     if ($this->form_validation->run() == FALSE) {
         $this->form_validation->set_error_delimiters('', '');
         $data['code'] = '1010';
         $error['pcode'] = form_error('pcode');
         $error['name'] = form_error('name');
         $error['price'] = form_error('price');
         $error['best_price'] = form_error('best_price');
         $error['amount'] = form_error('amount');
         $error['sale_num'] = form_error('sale_num');
         $error['unit'] = form_error('unit');
         $error['weight'] = form_error('weight');
         $error['min_num'] = form_error('min_num');
         $error['score'] = form_error('score');
         $error['status'] = form_error('status');
         $error['recommend'] = form_error('recommend');
         $error['specials'] = form_error('specials');
         $error['hot'] = form_error('hot');
         $error['allow_comment'] = form_error('allow_comment');
         $error['show_home'] = form_error('show_home');
         $error['handpick'] = form_error('handpick');
         $data['msg'] = $this->lang->line('error_msg');
         $data['error'] = $error;
         echo json_encode($data);
         exit;
     }
     $error = array();
     if ($post['id']) {
         if ($post['pcode']) {
             $where = array('code' => $post['pcode'], 'id !=' => $post['id']);
             if ($this->product->exist($where)) {
                 $error['pcode'] = '编码已存在';
             }
         }
         $where = array('name' => $post['name'], 'id !=' => $post['id']);
         if ($this->product->exist($where)) {
             $error['name'] = '名称已存在';
         }
     } else {
         if ($post['pcode']) {
             $where = array('code' => $post['pcode']);
             if ($this->product->exist($where)) {
                 $error['pcode'] = '编码已存在';
             }
         }
         $where = array('name' => $post['name']);
         if ($this->product->exist($where)) {
             $error['name'] = '名称已存在';
         }
     }
     if (!empty($error)) {
         echo json_encode(array('code' => '1010', 'msg' => $this->lang->line('error_msg'), 'error' => $error));
         exit;
     }
     $row = array('code' => $post['pcode'], 'name' => $post['name'], 'price' => $post['price'] ? $post['price'] : 0, 'best_price' => $post['best_price'] ? $post['best_price'] : 0, 'amount' => $post['amount'] ? $post['amount'] : 0, 'sale_num' => $post['sale_num'] ? $post['sale_num'] : 0, 'type_id' => $post['type_id'], 'cate_id' => $post['cate'], 'brand_id' => $post['brand_id'], 'unit' => $post['unit'], 'weight' => isset($post['weight']) ? floor($post['weight']) : 0, 'min_num' => isset($post['min_num']) ? intval($post['min_num']) : 0, 'score' => isset($post['score']) ? intval($post['score']) : 0, 'info' => $post['info'], 'promise' => $post['promise'], 'status' => isset($post['status']) ? round($post['status'], 2) : 0, 'recommend' => isset($post['recommend']) ? intval($post['recommend']) : 0, 'specials' => isset($post['specials']) ? $post['specials'] : 0, 'hot' => isset($post['hot']) ? intval($post['hot']) : 0, 'allow_comment' => isset($post['allow_comment']) ? intval($post['allow_comment']) : 0, 'show_home' => isset($post['show_home']) ? intval($post['show_home']) : 0, 'handpick' => isset($post['handpick']) ? intval($post['handpick']) : 0);
     if ($post['id']) {
         if (!$this->product->update($row, $post['id'])) {
             $data = array('code' => '1001', 'msg' => $this->lang->line('update_fail'));
         }
         $id = $post['id'];
         $this->product_category_map->delete_by_product($id);
     } else {
         if (!($id = $this->product->insert($row))) {
             $data = array('code' => '1001', 'msg' => $this->lang->line('add_fail'));
         }
     }
     if ($data['code'] == '1000') {
         if (isset($post['cate_id']) && $post['cate_id'] && is_array($post['cate_id']) && !empty($post['cate_id'])) {
             foreach ($post['cate_id'] as $key => $value) {
                 $this->product_category_map->insert(array('product_id' => $id, 'category_id' => $value));
             }
         }
         $data['goto'] = 'admin/products';
         //处理图片
         $this->load->library('image_lib');
         $target = upload_folder('product') . DIRECTORY_SEPARATOR . file_save_dir($id);
         create_folder($target);
         $tmp_folder = upload_folder('temp');
         $target_name = file_save_name($id);
         $unlink = array();
         for ($i = 1; $i <= 5; $i++) {
             if ($post['pro_pic_path_' . $i] && is_file($tmp_folder . DIRECTORY_SEPARATOR . $post['pro_pic_path_' . $i])) {
                 $config['image_library'] = 'gd2';
                 $config['source_image'] = $tmp_folder . DIRECTORY_SEPARATOR . $post['pro_pic_path_' . $i];
                 $config['create_thumb'] = false;
                 $config['maintain_ratio'] = TRUE;
                 $config['new_image'] = $target . DIRECTORY_SEPARATOR . $target_name . '_' . $i . '.png';
                 $config['width'] = 800;
                 $config['height'] = 600;
                 $this->image_lib->initialize($config);
                 $this->image_lib->resize();
                 $config['new_image'] = $target . DIRECTORY_SEPARATOR . $target_name . '_' . $i . '_thumb.png';
                 $config['width'] = 200;
                 $config['height'] = 150;
                 $this->image_lib->initialize($config);
                 $this->image_lib->resize();
                 $unlink[] = $config['source_image'];
             }
         }
         if (!empty($unlink)) {
             foreach ($unlink as $key => $value) {
                 @unlink($value);
             }
         }
     }
     echo json_encode($data);
 }
function create_folder_from_path($folder_path)
{
    global $site;
    $folder_path = trim($folder_path);
    // only public folders
    if (strpos($folder_path, 'public/') === 0) {
        $public_folders = get_folder_list('public');
        $folders = array();
        foreach ($public_folders as $folder) {
            $folders[$folder['objekt_id']] = preg_replace('#^/#', '', $folder['relative_path']);
        }
        $folders[$site->alias(array('key' => 'public', 'keel' => 1))] = 'public';
        $folder_id = (int) array_search($folder_path, $folders);
        // if folder id doesn't exist create folder
        if (!$folder_id) {
            $folder_path_parts = explode('/', $folder_path);
            $folders_to_create = array();
            while ($folder = array_pop($folder_path_parts)) {
                $folders_to_create[] = $folder;
                $folder_id = (int) array_search(implode('/', $folder_path_parts), $folders);
                if ($folder_id) {
                    break;
                }
            }
            $folders_to_create = array_reverse($folders_to_create);
            if ($folder_id) {
                foreach ($folders_to_create as $folder) {
                    $folder_create_result = create_folder($folder, $folder_id);
                    if (!is_int($folder_create_result)) {
                        return $folder_create_result;
                    } else {
                        $folder_id = $folder_create_result;
                    }
                }
                return $folder_id;
            } else {
                return 'cant_create_folder';
            }
        } else {
            return $folder_id;
        }
    } else {
        return 'no_such_folder';
    }
}
示例#22
0
                 foreach ($fixed_path_from_filemanager as $k => $paths) {
                     if ($paths != "" && $paths[strlen($paths) - 1] != "/") {
                         $paths .= "/";
                     }
                     $base_dir = $paths . substr_replace($path, '', 0, strlen($current_path));
                     if (is_dir($base_dir)) {
                         deleteDir($base_dir);
                     }
                 }
             }
         }
     }
     break;
 case 'create_folder':
     if ($create_folders) {
         create_folder(fix_path($path), fix_path($path_thumb));
     }
     break;
 case 'rename_folder':
     if ($rename_folders) {
         $name = fix_filename($name);
         $name = str_replace('.', '', $name);
         if (!empty($name)) {
             if (!rename_folder($path, $name)) {
                 die(lang_Rename_existing_folder);
             }
             rename_folder($path_thumb, $name);
             if ($fixed_image_creation) {
                 foreach ($fixed_path_from_filemanager as $k => $paths) {
                     if ($paths != "" && $paths[strlen($paths) - 1] != "/") {
                         $paths .= "/";
示例#23
0
                         $paths .= "/";
                     }
                     $base_dir = $paths . substr_replace($path, '', 0, strlen($current_path));
                     if (is_dir($base_dir)) {
                         deleteDir($base_dir);
                     }
                 }
             }
         }
     }
     break;
 case 'create_folder':
     if ($create_folders) {
         create_folder(fix_path($path, $transliteration, $convert_spaces, $replace_with), fix_path($path_thumb, $transliteration, $convert_spaces, $replace_with));
         create_folder('', fix_path($path_thumb, $transliteration, $convert_spaces, $replace_with) . '/200');
         create_folder('', fix_path($path_thumb, $transliteration, $convert_spaces, $replace_with) . '/330');
     }
     break;
 case 'rename_folder':
     if ($rename_folders) {
         $name = fix_filename($name, $transliteration, $convert_spaces, $replace_with);
         $name = str_replace('.', '', $name);
         if (!empty($name)) {
             if (!rename_folder($path, $name, $transliteration, $convert_spaces)) {
                 response(trans('fm.Rename_existing_folder'), 403)->send();
                 exit;
             }
             rename_folder($path_thumb, $name, $transliteration, $convert_spaces);
             if ($fixed_image_creation) {
                 foreach ($fixed_path_from_filemanager as $k => $paths) {
                     if ($paths != "" && $paths[strlen($paths) - 1] != "/") {
示例#24
0
    $dirParam = $_GET['dir'];
    if (strlen($dirParam) > 0) {
        if (substr($dirParam, 0, 1) == '/') {
            $FILE_ROOT .= $dirParam;
        } else {
            $FILE_ROOT = $dirParam;
        }
    }
}
$refresh_dirs = false;
$clearUploads = false;
if (strrpos($FILE_ROOT, '/') != strlen($FILE_ROOT) - 1) {
    $FILE_ROOT .= '/';
}
if (isset($_GET['create']) && isset($_GET['dir'])) {
    create_folder();
}
if (isset($_GET['delFile']) && isset($_GET['dir'])) {
    delete_file($_GET['delFile']);
}
if (isset($_GET['delFolder']) && isset($_GET['dir'])) {
    delete_folder($_GET['delFolder']);
}
if (isset($_FILES['upload']) && is_array($_FILES['upload']) && isset($_POST['dirPath'])) {
    $dirPathPost = $_POST['dirPath'];
    if (strlen($dirPathPost) > 0) {
        if (substr($dirPathPost, 0, 1) == '/') {
            $FILE_ROOT .= $dirPathPost;
        } else {
            $FILE_ROOT = $dirPathPost;
        }
示例#25
0
		<?php 
        $jplayer_ext = array("mp4", "flv", "webmv", "webma", "webm", "m4a", "m4v", "ogv", "oga", "mp3", "midi", "mid", "ogg", "wav");
        foreach ($files as $file_array) {
            $file = $file_array['file'];
            if ($file == '.' || isset($file_array['extension']) && $file_array['extension'] != lang_Type_dir || $file == '..' && $subdir == '' || in_array($file, $hidden_folders) || $filter != '' && $file != ".." && strpos($file, $filter) === false) {
                continue;
            }
            $new_name = fix_filename($file, $transliteration);
            if ($file != '..' && $file != $new_name) {
                //rename
                rename_folder($current_path . $subdir . $new_name, $new_name, $transliteration);
                $file = $new_name;
            }
            //add in thumbs folder if not exist
            if (!file_exists($thumbs_path . $subdir . $file)) {
                create_folder(false, $thumbs_path . $subdir . $file);
            }
            $class_ext = 3;
            if ($file == '..' && trim($subdir) != '') {
                $src = explode("/", $subdir);
                unset($src[count($src) - 2]);
                $src = implode("/", $src);
                if ($src == '') {
                    $src = "/";
                }
            } elseif ($file != '..') {
                $src = $subdir . $file . "/";
            }
            ?>
			    <li data-name="<?php 
            echo $file;
示例#26
0
                 foreach ($fixed_path_from_filemanager as $k => $paths) {
                     if ($paths != "" && $paths[strlen($paths) - 1] != "/") {
                         $paths .= "/";
                     }
                     $base_dir = $paths . substr_replace($path, '', 0, strlen($current_path));
                     if (is_dir($base_dir)) {
                         deleteDir($base_dir);
                     }
                 }
             }
         }
     }
     break;
 case 'create_folder':
     if ($create_folders) {
         create_folder(fix_path($path, $transliteration, $convert_spaces, $replace_with), fix_path($path_thumb, $transliteration, $convert_spaces, $replace_with));
     }
     break;
 case 'rename_folder':
     if ($rename_folders) {
         $name = fix_filename($name, $transliteration, $convert_spaces, $replace_with);
         $name = str_replace('.', '', $name);
         if (!empty($name)) {
             if (!rename_folder($path, $name, $transliteration, $convert_spaces)) {
                 response(trans('Rename_existing_folder'), 403)->send();
                 exit;
             }
             rename_folder($path_thumb, $name, $transliteration, $convert_spaces);
             if ($fixed_image_creation) {
                 foreach ($fixed_path_from_filemanager as $k => $paths) {
                     if ($paths != "" && $paths[strlen($paths) - 1] != "/") {
示例#27
0
 function do_edit()
 {
     global $ttH;
     $err = "";
     $dir = create_folder(date("Y_m"));
     $id = $ttH->input["id"];
     $sql = "select * from repository_receipt_import \n\t\t\t\t\t\twhere id='" . $id . "'";
     $result = $ttH->db->query($sql);
     if ($data = $ttH->db->fetch_row($result)) {
     } else {
         $link_go = $ttH->admin->get_link_admin($this->modules_call, $this->action);
         $ttH->html->alert($ttH->lang['global']['not_found_page'], $link_go);
     }
     $arr_admin = $ttH->load_data->data_table('admin', 'id', 'id,full_name', " find_in_set(id,'" . $data['admin_id'] . "," . $data['admin_edit'] . "')>0 ");
     $data['admin_poster'] = isset($arr_admin[$data['admin_id']]) ? $arr_admin[$data['admin_id']] : array();
     $data['admin_editor'] = isset($arr_admin[$data['admin_edit']]) ? $arr_admin[$data['admin_edit']] : array();
     $data["err"] = $err;
     $data["link_action"] = $ttH->admin->get_link_admin($this->modules_call, $this->action, $this->sub, array("id" => $id));
     $data['date_create'] = $ttH->func->get_date_format($data['date_create'], 1);
     $data['date_update'] = $ttH->func->get_date_format($data['date_update'], 1);
     $ttH->temp_act->assign('data', $data);
     $ttH->temp_act->parse("view");
     return $ttH->temp_act->text("view");
 }
示例#28
0
 function do_view()
 {
     global $ttH;
     $ttH->func->include_js($ttH->dir_temp . 'js/' . $this->modules . '/' . $this->modules . '.js');
     $err = "";
     $dir = create_folder(date("Y_m"));
     $receipt_id = $ttH->input["id"];
     $sql = "select is_show from repository_receipt \r\r\n\t\t\t\t\t\twhere receipt_id='" . $receipt_id . "' and is_show=0";
     $result = $ttH->db->query($sql);
     if ($ttH->db->num_rows($result)) {
         if (isset($ttH->post['do_submit'])) {
             /*print_arr($ttH->post);
             		die();*/
             if (empty($err)) {
                 $col = array();
                 $col["is_show"] = 1;
                 $col["admin_finish"] = $ttH->data['admin']["id"];
                 $col["date_update"] = time();
                 $ok = $ttH->db->do_update("repository_receipt", $col, " receipt_id='" . $receipt_id . "'");
                 if ($ok) {
                     /*$sql = "select * 
                     						from repository_receipt_detail 
                     						where receipt_id='".$receipt_id."' 
                     						and is_level=1 ";
                     		//echo $sql;
                     		$result = $ttH->db->query($sql);
                     		while ($row = $ttH->db->fetch_row($result)) {
                     			
                     			// if not has product_combine, Insert product_combine
                     			$ttH->db->query("update product_combine 
                     								set in_stock=(in_stock+".$row["in_stock"]."), 
                     									date_update=".$row["date_update"]." 
                     								where type='".$row["type"]."'
                     								and type_id='".$row["type_id"]."'
                     								and color_id='".$row["color_id"]."'
                     								and size_id='".$row["size_id"]."' ");
                     			if(!$ttH->db->affected()) {
                     				$col_c = $row;
                     				unset($col_c["receipt_id"]);
                     				unset($col_c["is_level"]);
                     				
                     				$ttH->db->do_insert("product_combine", $col_c);	
                     			}
                     			// End
                     		}
                     		
                     		$sql = "select * 
                     						from repository_receipt_detail 
                     						where receipt_id='".$receipt_id."' 
                     						and is_level=0 ";
                     		//echo $sql;
                     		$result = $ttH->db->query($sql);
                     		while ($row = $ttH->db->fetch_row($result)) {
                     			
                     			$ttH->db->query("update product 
                     								set in_stock=(in_stock+".$row["in_stock"]."), 
                     									date_update=".$row["date_update"]." 
                     								where item_id='".$row["type_id"]."' ");
                     		}*/
                     $data = array();
                     $err = $ttH->html->html_alert($ttH->lang["global"]["edit_success"], "success");
                 } else {
                     $data = $ttH->post;
                     $err = $ttH->html->html_alert($ttH->lang["global"]["edit_false"], "error");
                 }
             } else {
                 $data = $ttH->post;
             }
         }
     }
     $sql = "select * from repository_receipt \r\r\n\t\t\t\t\t\twhere receipt_id='" . $receipt_id . "'";
     $result = $ttH->db->query($sql);
     if ($data = $ttH->db->fetch_row($result)) {
         if ($data['is_show'] < 1) {
             $ttH->temp_act->parse("view.alert");
         }
     } else {
         $link_go = $ttH->admin->get_link_admin($this->modules_call, $this->action);
         $ttH->html->alert($ttH->lang['global']['not_found_page'], $link_go);
     }
     $arr_admin = $ttH->load_data->data_table('admin', 'id', 'id,full_name', " find_in_set(id,'" . $data['admin_id'] . "," . $data['admin_edit'] . "," . $data['admin_finish'] . "')>0 ");
     $arr_product = $ttH->load_data->data_table('product_lang', 'item_id', 'item_id,title', " lang='" . $ttH->conf['lang_cur'] . "' ");
     $arr_color = $ttH->load_data->data_table('product_color', 'color_id', 'color_id,color,title', "\tlang='" . $ttH->conf['lang_cur'] . "' order by show_order desc, date_create desc");
     $arr_size = $ttH->load_data->data_table('product_size', 'size_id', 'size_id,title', "\tlang='" . $ttH->conf['lang_cur'] . "' order by show_order desc, date_create desc");
     $data['admin_poster'] = isset($arr_admin[$data['admin_id']]) ? $arr_admin[$data['admin_id']] : array();
     $data['admin_editor'] = isset($arr_admin[$data['admin_edit']]) ? $arr_admin[$data['admin_edit']] : array();
     $data['admin_finish'] = isset($arr_admin[$data['admin_finish']]) ? $arr_admin[$data['admin_finish']] : array();
     //sub
     $arr_sub = array();
     $sql = "select * \r\r\n\t\t\t\t\t\tfrom repository_receipt_detail \r\r\n\t\t\t\t\t\twhere receipt_id='" . $data['receipt_id'] . "' \r\r\n\t\t\t\t\t\tand is_level=1 \r\r\n\t\t\t\t\t\torder by type asc, type_id asc, color_id desc, size_id desc";
     //echo $sql;
     $result = $ttH->db->query($sql);
     if ($num = $ttH->db->num_rows($result)) {
         while ($row = $ttH->db->fetch_row($result)) {
             $row['product'] = isset($arr_product[$row['type_id']]) ? $arr_product[$row['type_id']] : array();
             $row['color'] = isset($arr_color[$row['color_id']]) ? $arr_color[$row['color_id']] : array();
             $row['size'] = isset($arr_size[$row['size_id']]) ? $arr_size[$row['size_id']] : array();
             $row['quantity'] = $ttH->func->format_number($row['quantity']);
             $row['date_create'] = $ttH->func->get_date_format($row['date_create'], 1);
             $row['date_update'] = $ttH->func->get_date_format($row['date_update'], 1);
             $ttH->temp_act->assign('row', $row);
             $ttH->temp_act->parse("view.row_sub.row_sub_item");
             if (!isset($arr_sub[$row['type'] . '_' . $row['type_id']])) {
                 $arr_sub[$row['type'] . '_' . $row['type_id']] = '';
             }
             $arr_sub[$row['type'] . '_' . $row['type_id']] .= $ttH->temp_act->text("view.row_sub.row_sub_item");
             $ttH->temp_act->reset("view.row_sub.row_sub_item");
         }
     } else {
         $ttH->temp_act->assign('row', array("mess" => $ttH->lang["global"]["no_have_data"]));
         $ttH->temp_act->parse("view.row_sub.row_sub_empty");
     }
     $f_stock = $data['receipt_type'] === 'import' ? 'Nhập kho' : 'Xuất kho';
     foreach ($arr_sub as $list_id => $html) {
         $ttH->temp_act->assign('data', array("list_id" => $list_id, "list" => $html, "f_stock" => $f_stock));
         $ttH->temp_act->parse("view.row_sub");
     }
     // end
     $sql = "select * \r\r\n\t\t\t\t\t\tfrom repository_receipt_detail \r\r\n\t\t\t\t\t\twhere receipt_id='" . $data['receipt_id'] . "' \r\r\n\t\t\t\t\t\tand is_level=0 \r\r\n\t\t\t\t\t\torder by type asc, type_id asc, color_id desc, size_id desc";
     //echo $sql;
     $result = $ttH->db->query($sql);
     if ($num = $ttH->db->num_rows($result)) {
         while ($row = $ttH->db->fetch_row($result)) {
             $row['product'] = isset($arr_product[$row['type_id']]) ? $arr_product[$row['type_id']] : array();
             $row['color'] = isset($arr_color[$row['color_id']]) ? $arr_color[$row['color_id']] : array();
             $row['size'] = isset($arr_size[$row['size_id']]) ? $arr_size[$row['size_id']] : array();
             $row['price'] = $ttH->func->get_price_format($row['price']);
             $row['quantity'] = $ttH->func->format_number($row['quantity']);
             $row['view_detail'] = isset($arr_sub[$row['type'] . '_' . $row['type_id']]) ? '<a href="#sub_' . $row['type'] . '_' . $row['type_id'] . '" class="fancybox">Click</a>' : '---';
             $row['date_create'] = $ttH->func->get_date_format($row['date_create'], 1);
             $row['date_update'] = $ttH->func->get_date_format($row['date_update'], 1);
             $ttH->temp_act->assign('row', $row);
             $ttH->temp_act->parse("view.row_item");
         }
     } else {
         $ttH->temp_act->assign('row', array("mess" => $ttH->lang["global"]["no_have_data"]));
         $ttH->temp_act->parse("view.row_empty");
     }
     $data["err"] = $err;
     $data["link_action"] = $ttH->admin->get_link_admin($this->modules_call, $this->action, $this->sub, array("id" => $receipt_id));
     $data['f_stock'] = $f_stock;
     $data['date_create'] = $ttH->func->get_date_format($data['date_create'], 1);
     $data['date_update'] = $ttH->func->get_date_format($data['date_update'], 1);
     $ttH->temp_act->assign('data', $data);
     $ttH->temp_act->parse("view");
     return $ttH->temp_act->text("view");
 }
示例#29
0
function new_thumbnails_creation($targetPath, $targetFile, $name, $current_path, $relative_image_creation, $relative_path_from_current_pos, $relative_image_creation_name_to_prepend, $relative_image_creation_name_to_append, $relative_image_creation_width, $relative_image_creation_height, $fixed_image_creation, $fixed_path_from_filemanager, $fixed_image_creation_name_to_prepend, $fixed_image_creation_to_append, $fixed_image_creation_width, $fixed_image_creation_height)
{
    //create relative thumbs
    $all_ok = true;
    if ($relative_image_creation) {
        foreach ($relative_path_from_current_pos as $k => $path) {
            if ($path != "" && $path[strlen($path) - 1] != "/") {
                $path .= "/";
            }
            if (!file_exists($targetPath . $path)) {
                create_folder($targetPath . $path, false);
            }
            $info = pathinfo($name);
            if (!endsWith($targetPath, $path)) {
                if (!create_img($targetFile, $targetPath . $path . $relative_image_creation_name_to_prepend[$k] . $info['filename'] . $relative_image_creation_name_to_append[$k] . "." . $info['extension'], $relative_image_creation_width[$k], $relative_image_creation_height[$k])) {
                    $all_ok = false;
                }
            }
        }
    }
    //create fixed thumbs
    if ($fixed_image_creation) {
        foreach ($fixed_path_from_filemanager as $k => $path) {
            if ($path != "" && $path[strlen($path) - 1] != "/") {
                $path .= "/";
            }
            $base_dir = $path . substr_replace($targetPath, '', 0, strlen($current_path));
            if (!file_exists($base_dir)) {
                create_folder($base_dir, false);
            }
            $info = pathinfo($name);
            if (!create_img($targetFile, $base_dir . $fixed_image_creation_name_to_prepend[$k] . $info['filename'] . $fixed_image_creation_to_append[$k] . "." . $info['extension'], $fixed_image_creation_width[$k], $fixed_image_creation_height[$k])) {
                $all_ok = false;
            }
        }
    }
    return $all_ok;
}
示例#30
0
     $i++;
     if ($parent == './') {
         $parent = '';
     }
     if (file_exists($current_path . $parent . 'config.php')) {
         require_once $current_path . $parent . 'config.php';
         $cycle = false;
     }
     if ($parent == '') {
         $cycle = false;
     } else {
         $parent = fix_dirname($parent) . '/';
     }
 }
 if (!is_dir($thumbs_path . $subdir)) {
     create_folder(false, $thumbs_path . $subdir);
 }
 if (isset($_GET['popup'])) {
     $popup = $_GET['popup'];
 } else {
     $popup = 0;
 }
 //Sanitize popup
 $popup = !!$popup;
 //view type
 if (!isset($_SESSION['view_type'])) {
     $view = $default_view;
     $_SESSION['view_type'] = $view;
 }
 if (isset($_GET['view'])) {
     $view = $_GET['view'];