function getlist($type, $page) { $url = "http://list.pptv.com/channel_list.html?page={$page}&type={$type}&sort=6"; $content = get_url_contents($url, 'http://list.pptv.com/'); preg_match_all('/<a class="ui-list-ct".+href=\'(.+)\\?.+\'.+title="(.+)".+<img.+data-src2="(.+)"/Uis', $content, $matches); $list = array(); foreach ($matches[2] as $k => $v) { $list[] = array('title' => $v, 'id' => get_encode($matches[1][$k]), 'pic' => $matches[3][$k], 'actor' => '主演', 'director' => '导演', 'area' => '地方', 'year' => '2015'); } return $list; }
function getlist($type, $cate, $page) { $url = "http://list.iqiyi.com/www/{$type}/-{$cate}---------0---11-{$page}-1-iqiyi--.html"; //$url = "http://list.pptv.com/channel_list.html?page={$page}&type={$type}&sort=6"; $content = get_url_contents($url, 'http://list.iqiyi.com/'); //<ul class="site-piclist site-piclist-180236 site-piclist-auto"> preg_match('/<ul class="site-piclist site-piclist-180236 site-piclist-auto">.+<\\/ul>/Uis', $content, $matche); preg_match_all('/<li>.+<a.+title="(.+)".+href="(.*)".+class="site-piclist_pic_link".+<img.+rseat=".+".+src = "(.+)".+\\/>.+<\\/li>/Uis', $matche[0], $matches); $list = array(); foreach ($matches[1] as $k => $v) { $list[] = array('title' => $v, 'id' => get_encode($matches[2][$k]), 'pic' => $matches[3][$k], 'actor' => '主演', 'director' => '导演', 'area' => '地方', 'year' => '2015'); } return $list; }
$lans = C('EDIT_CONF.EDIT_ALLOW_TYPE'); foreach ($lans as $lan => $exts) { foreach ($exts as $ex) { if ($ext == $ex) { $language = $lan; break 2; } } } return $language; } $file = array(); $file['file_utf'] = trim($_REQUEST['file']); $file['file'] = u2g($file['file_utf']); $file['content'] = file($file['file']); $file['encode'] = get_encode($file['file']); $file['line'] = count($file['content']); $file['size'] = dealsize(filesize($file['file'])); $file['chmod'] = substr(sprintf('%o', @fileperms($file['file'])), -4); $file['language'] = get_language(get_ext($file['file'])); if ('GB2312' == $file['encode']) { $file['encode_selected']['UTF-8'] = ''; $file['encode_selected']['GB2312'] = 'selected="selected"'; } else { $file['encode_selected']['UTF-8'] = 'selected="selected"'; $file['encode_selected']['GB2312'] = ''; } // $textarea = array(); $textarea['main']['width'] = C('EDIT_CONF.EDITOR_CONF.WIDTH') - 35; $textarea['main']['height'] = C('EDIT_CONF.EDITOR_CONF.HEIGHT') - 250;
public function departamentos($action){ $cur_page = $this->uri->segment(3); //Verificando el segmento 3 del uri corresponde a la pag o a alguna acción if (is_numeric($cur_page)) { $action = 'list'; }else{ $action = $cur_page;//En este caso no es un número sino //que es la acción: guardado|nuevo|filtrar|guardar... } switch ($action) { //Listando todos los departamentos case 'list': $this->utils->is_logged(); $params_main_content = $this->_config_dpto(false,false,false,$cur_page, $this->per_page, array('accion' => 'todos')); $this->utils->template($this->_list(4),'cargar_data/departamentos', $params_main_content,'Cargar Infraestructura','Departamentos'); break; //Formulario de nuevo Departamento de ti case 'filtrar': $this->utils->is_logged(); $op = $this->input->get('filtro-dpto'); $p_get = get_encode($this->input->get()); $cur_page = $this->uri->segment(5); switch ($op) { case 'todos': $params_main_content = $this->_config_dpto(false,false,false,$cur_page, $this->per_page, array('accion' => 'todos')); break; case 'nombre': $campo_buscar = $this->input->get('buscar'); $params_main_content = $this->_config_dpto(false,false,true,$cur_page, $this->per_page, array('accion' => 'nombre','info' =>$campo_buscar),$p_get); break; } $this->utils->template($this->_list(4),'cargar_data/departamentos', $params_main_content,'Cargar Infraestructura','Departamentos'); break; case 'nuevo': $this->utils->is_logged(); //Info de los Departamentos en el sistema $params_main_content['list_comp_ti'] = $this->basico_model->ids_nombres_comp_ti(); $params_main_content['actualizar'] = false; $this->utils->template($this->_list(4),'cargar_data/nuevo_departamento_view', $params_main_content,'Cargar Infraestructura','Nuevo dpto'); break; //Guardando departamento desde ajax case 'guardar': $p = $this->input->post(); if($this->basico_model->add_dpto_comp_ti($p)){ echo '{"estatus":"ok"}'; }else{ echo '{"estatus":"fail"}'; } break; //Desplegando msj de guardado case 'guardado': $this->utils->is_logged(); $params_main_content = $this->_config_dpto(false,true,false,1, $this->per_page,array('accion'=>'todos')); $this->utils->template($this->_list(4),'cargar_data/departamentos', $params_main_content,'Cargar Infraestructura','Departamentos'); break; //Desplegando formulario lleno para su edición case 'actualizar': $this->utils->is_logged(); $dpto_id = $this->uri->segment(4); //Obteniendo la información del dpto $params_main_content['dpto'] = $this->utilities_model->row_by_id('departamento', 'departamento_id',$dpto_id); //Componentes en el sistema que no estén ya previamente seleccionados $params_main_content['list_comp_ti'] = $this->basico_model->ids_nombres_comp_ti($dpto_id); //Componentes que están asociados al dpto $params_main_content['list_comp_ti_asig'] = $this->basico_model->comp_ti_asig_dpto($dpto_id); $params_main_content['actualizar'] = true; $this->utils->template($this->_list(4),'cargar_data/nuevo_departamento_view', $params_main_content,'Cargar Infraestructura','Actualizar dpto'); break; //Guardar desde actualizado, desde ajax case 'actualizar_guardar': $dpto_id = $this->uri->segment(4); $p = $this->input->post(); $p['dpto_id'] = $dpto_id; if($this->basico_model->update_dpto($p)){ echo '{"estatus":"ok"}'; }else{ echo '{"estatus":"fail"}'; } break; //Desplegando msj de actualizado case 'actualizado': $this->utils->is_logged(); $params_main_content = $this->_config_dpto(true,false,false,1, $this->per_page,array('accion'=>'todos')); $this->utils->template($this->_list(4),'cargar_data/departamentos', $params_main_content,'Cargar Infraestructura','Departamentos'); break; case 'eliminar': $dpto_id = $this->input->post('dpto_id'); //Eliminando lógicamente if($this->utilities_model->update('departamento', array('departamento_id'=>$dpto_id),array('borrado'=>true)) ){ echo '{"estatus":"ok"}'; }else{ echo '{"estatus":"fail"}'; } break; } }
} elseif ('upload' == $action) { //批量上传文件 require ROOT . 'static/template/upload.tpl.php'; } elseif ('editfile' == $action) { //文本编辑 if ('save' !== $_REQUEST['type']) { require ROOT . 'static/template/editfile.tpl.php'; } elseif ('save' == $_REQUEST['type']) { $file = u2g($_REQUEST['file']); $code = urldecode(trim($_REQUEST['code'])); $charset = trim($_REQUEST['charset']); $newname = trim($_REQUEST['newname']); $data = array(); $data['message'] = '<font color="green">目标文件:</font><font color="red">' . g2u($file) . '</font><br />'; if (file_exists($file)) { $oldcharset = get_encode($file); if ('UTF-8' == $charset && 'GB2312' == $oldcharset) { $code = $code; } elseif ('UTF-8' == $charset && 'UTF-8' == $oldcharset) { $code = $code; } elseif ('UTF-8' == $charset && 'UTF-8 BOM' == $oldcharset) { $code = stripBOM($code); //处理UTF-8 BOM 文件头 } elseif ('GB2312' == $charset && 'GB2312' == $oldcharset) { $code = $code; } elseif ('GB2312' == $charset && 'UTF-8' == $oldcharset) { $code = $code; } elseif ('GB2312' == $charset && 'UTF-8 BOM' == $oldcharset) { $code = $code; } if (!empty($newname)) {
$coverfile = ""; foreach ($coverfiles as $i) { $coverfile .= str_replace($path, "", $i) . "|"; } exitme("if (confirm(lang.follow_exist+lang.br+lang.br+'" . str_replace("|", "\\n", $coverfile) . "'+lang.br+lang.do_cover+'?')) {sendcomm('paste',['path','cover','coverfile'],[path,'true','" . $coverfile . "']);}else{reloaddata('{$path}');reloaddata('{$frompath}');}", "eval"); } $eval = "notice(lang.{$action1}+lang.file+lang.success);reloaddata('{$path}');"; $eval .= $action1 == "cut" ? "reloaddata('{$frompath}');setcookie('from','');setcookie('action1','');setcookie('sdir','');setcookie('sfile','');" : ""; exitme($eval, "eval"); } else { if ($action == "readtext") { if (!file_exists($path)) { exit($lang["js"]["not_found"]); } $content = @htmlspecialchars(@file_get_contents($path)); $encode = get_encode($path); header("content-type:text/html;Charset=" . $encode); print <<<END <html> <body style='margin:0px;'> <textarea readonly=true style='width:100%;height:100%;margin:0px;padding:3px;word-wrap:break;word-break: break-all;border:0px;'>{$content}</textarea> </body> </html> END; } else { if ($action == "unpack" && $user["unpack"]) { if (!file_exists($path . $file)) { exitme("notice(lang.not_found)", "eval"); } if (!$key) { exitme("notice(lang.var_error)", "eval");
} $out_str .= "<body style='backgroud-color:#ffffff;'>\n"; $out_str .= "<script language=javascript src=\"js/edit.js\"></script>\n"; $out_str .= "<script language=javascript src=\"js/hash.js\"></script>\n"; $line = @file($path); $content = ""; $lines = ""; $n = count($line); for ($i = 0; $i < $n; $i++) { $content .= htmlspecialchars($line[$i]); } $n += 1000; for ($i = 0; $i < $n; $i++) { $lines .= $i + 1 . "\n"; } $main = deal_temp("js/editor.htm", array("path" => $path, "titleback" => $icon["titleback"], "width" => $sitewidth - 60, "filename" => basename1($path), "size" => dealsize(filesize($path)), "selected_gb2312" => $selected_gb2312, "selected_utf8" => $selected_utf8, "encode" => $encode)); $main = deal_temp("temp/{$tempname}/main.htm", array("sitewidth" => $sitewidth, "title" => "编辑文件 " . basename1($path), "logout" => "<a href='login.php?action=logout' target=_top>退出</a>", "main" => $main, "currentpath" => " ", "username" => $user["name"], "footer" => "")); $encode2 = get_encode("temp/{$tempname}/main.htm"); if ($encode != $encode2) { $s1 = @iconv($encode2, $encode, $out_str); $out_str = $s1 ? $s1 : $out_str; $s1 = @iconv($encode2, $encode, $main); $main = $s1 ? $s1 : $main; } echo $out_str; echo str_replace(array("{lines}", "{content}"), array($lines, $content), $main); echo "<script>RoundCorner('titlediv');RoundCorner('maindiv');</script>"; exit; } } }