初始化合并后的信息平台代码

hotfix/远程访问多媒体中心
尹诚诚 8 years ago
commit 07eeb74c21

3
.gitignore vendored

@ -0,0 +1,3 @@
.svn/*
*/logs/log*
/web.config

@ -0,0 +1,12 @@
staging:
script:
- curl -sSf http://202.103.68.144:8888/please_dont_delete_this_file_4a4f500ae61d9e44b931d9f72fb14aaf95517b7e.php?branch=develop
only:
- develop
production:
script:
- curl -sSf http://202.103.68.144:8888/please_dont_delete_this_file_4a4f500ae61d9e44b931d9f72fb14aaf95517b7e.php?branch=master
only:
- master
- /^deploy-.*$/

@ -0,0 +1,6 @@
<IfModule mod_php4.c>
php_value engine off
</IfModule>
<IfModule mod_php5.c>
php_value engine off
</IfModule>

@ -0,0 +1 @@
Deny from all

@ -0,0 +1 @@
deny from all

@ -0,0 +1,10 @@
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

@ -0,0 +1,116 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| AUTO-LOADER
| -------------------------------------------------------------------
| This file specifies which systems should be loaded by default.
|
| In order to keep the framework as light-weight as possible only the
| absolute minimal resources are loaded by default. For example,
| the database is not connected to automatically since no assumption
| is made regarding whether you intend to use it. This file lets
| you globally define which systems you would like loaded with every
| request.
|
| -------------------------------------------------------------------
| Instructions
| -------------------------------------------------------------------
|
| These are the things you can load automatically:
|
| 1. Packages
| 2. Libraries
| 3. Helper files
| 4. Custom config files
| 5. Language files
| 6. Models
|
*/
/*
| -------------------------------------------------------------------
| Auto-load Packges
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['packages'] = array(APPPATH.'third_party', '/usr/local/shared');
|
*/
$autoload['packages'] = array(APPPATH.'third_party');
/*
| -------------------------------------------------------------------
| Auto-load Libraries
| -------------------------------------------------------------------
| These are the classes located in the system/libraries folder
| or in your application/libraries folder.
|
| Prototype:
|
| $autoload['libraries'] = array('database', 'session', 'xmlrpc');
*/
$autoload['libraries'] = array('Form_validation','session','permission');
/*
| -------------------------------------------------------------------
| Auto-load Helper Files
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['helper'] = array('url', 'file');
*/
$autoload['helper'] = array('url','info');
/*
| -------------------------------------------------------------------
| Auto-load Config files
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['config'] = array('config1', 'config2');
|
| NOTE: This item is intended for use ONLY if you have created custom
| config files. Otherwise, leave it blank.
|
*/
$autoload['config'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Language files
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['language'] = array('lang1', 'lang2');
|
| NOTE: Do not include the "_lang" part of your file. For example
| "codeigniter_lang.php" would be referenced as array('codeigniter');
|
*/
$autoload['language'] = array('form_validation');
/*
| -------------------------------------------------------------------
| Auto-load Models
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['model'] = array('model1', 'model2');
|
*/
$autoload['model'] = array();
/* End of file autoload.php */
/* Location: ./application/config/autoload.php */

File diff suppressed because it is too large Load Diff

@ -0,0 +1,41 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| File and Directory Modes
|--------------------------------------------------------------------------
|
| These prefs are used when checking and setting modes when working
| with the file system. The defaults are fine on servers with proper
| security, but you may wish (or even need) to change the values in
| certain environments (Apache running a separate process for each
| user, PHP under CGI with Apache suEXEC, etc.). Octal values should
| always be used to set the mode correctly.
|
*/
define('FILE_READ_MODE', 0644);
define('FILE_WRITE_MODE', 0666);
define('DIR_READ_MODE', 0755);
define('DIR_WRITE_MODE', 0777);
/*
|--------------------------------------------------------------------------
| File Stream Modes
|--------------------------------------------------------------------------
|
| These modes are used when working with fopen()/popen()
|
*/
define('FOPEN_READ', 'rb');
define('FOPEN_READ_WRITE', 'r+b');
define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); // truncates existing file data, use with care
define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE', 'w+b'); // truncates existing file data, use with care
define('FOPEN_WRITE_CREATE', 'ab');
define('FOPEN_READ_WRITE_CREATE', 'a+b');
define('FOPEN_WRITE_CREATE_STRICT', 'xb');
define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b');
/* End of file constants.php */
/* Location: ./application/config/constants.php */

@ -0,0 +1,52 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| DATABASE CONNECTIVITY SETTINGS
| -------------------------------------------------------------------
| This file will contain the settings needed to access your database.
|
| For complete instructions please consult the 'Database Connection'
| page of the User Guide.
|
| -------------------------------------------------------------------
| EXPLANATION OF VARIABLES
| -------------------------------------------------------------------
|
| ['hostname'] The hostname of your database server.
| ['username'] The username used to connect to the database
| ['password'] The password used to connect to the database
| ['database'] The name of the database you want to connect to
| ['dbdriver'] The database type. ie: mysql. Currently supported:
mysql, mysqli, postgre, odbc, mssql, sqlite, oci8
| ['dbprefix'] You can add an optional prefix, which will be added
| to the table name when using the Active Record class
| ['pconnect'] TRUE/FALSE - Whether to use a persistent connection
| ['db_debug'] TRUE/FALSE - Whether database errors should be displayed.
| ['cache_on'] TRUE/FALSE - Enables/disables query caching
| ['cachedir'] The path to the folder where cache files should be stored
| ['char_set'] The character set used in communicating with the database
| ['dbcollat'] The character collation used in communicating with the database
| ['swap_pre'] A default table prefix that should be swapped with the dbprefix
| ['autoinit'] Whether or not to automatically initialize the database.
| ['stricton'] TRUE/FALSE - forces 'Strict Mode' connections
| - good for ensuring strict SQL while developing
|
| The $active_group variable lets you choose which connection group to
| make active. By default there is only one group (the 'default' group).
|
| The $active_record variables lets you determine whether or not to load
| the active record class
*/
//选择数据库
$active_group = 'HT';
//是否加载
$active_record = TRUE;
require 'C:/database_conn.php';
/* End of file database.php */
/* Location: ./application/config/database.php */

@ -0,0 +1,15 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
$_doctypes = array(
'xhtml11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">',
'xhtml1-strict' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
'xhtml1-trans' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
'xhtml1-frame' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">',
'html5' => '<!DOCTYPE html>',
'html4-strict' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">',
'html4-trans' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',
'html4-frame' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">'
);
/* End of file doctypes.php */
/* Location: ./application/config/doctypes.php */

@ -0,0 +1,64 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| Foreign Characters
| -------------------------------------------------------------------
| This file contains an array of foreign characters for transliteration
| conversion used by the Text helper
|
*/
$foreign_characters = array(
'/ä|æ|ǽ/' => 'ae',
'/ö|œ/' => 'oe',
'/ü/' => 'ue',
'/Ä/' => 'Ae',
'/Ü/' => 'Ue',
'/Ö/' => 'Oe',
'/À|Á|Â|Ã|Ä|Å|Ǻ|Ā|Ă|Ą|Ǎ/' => 'A',
'/à|á|â|ã|å|ǻ|ā|ă|ą|ǎ|ª/' => 'a',
'/Ç|Ć|Ĉ|Ċ|Č/' => 'C',
'/ç|ć|ĉ|ċ|č/' => 'c',
'/Ð|Ď|Đ/' => 'D',
'/ð|ď|đ/' => 'd',
'/È|É|Ê|Ë|Ē|Ĕ|Ė|Ę|Ě/' => 'E',
'/è|é|ê|ë|ē|ĕ|ė|ę|ě/' => 'e',
'/Ĝ|Ğ|Ġ|Ģ/' => 'G',
'/ĝ|ğ|ġ|ģ/' => 'g',
'/Ĥ|Ħ/' => 'H',
'/ĥ|ħ/' => 'h',
'/Ì|Í|Î|Ï|Ĩ|Ī|Ĭ|Ǐ|Į|İ/' => 'I',
'/ì|í|î|ï|ĩ|ī|ĭ|ǐ|į|ı/' => 'i',
'/Ĵ/' => 'J',
'/ĵ/' => 'j',
'/Ķ/' => 'K',
'/ķ/' => 'k',
'/Ĺ|Ļ|Ľ|Ŀ|Ł/' => 'L',
'/ĺ|ļ|ľ|ŀ|ł/' => 'l',
'/Ñ|Ń|Ņ|Ň/' => 'N',
'/ñ|ń|ņ|ň|ʼn/' => 'n',
'/Ò|Ó|Ô|Õ|Ō|Ŏ|Ǒ|Ő|Ơ|Ø|Ǿ/' => 'O',
'/ò|ó|ô|õ|ō|ŏ|ǒ|ő|ơ|ø|ǿ|º/' => 'o',
'/Ŕ|Ŗ|Ř/' => 'R',
'/ŕ|ŗ|ř/' => 'r',
'/Ś|Ŝ|Ş|Š/' => 'S',
'/ś|ŝ|ş|š|ſ/' => 's',
'/Ţ|Ť|Ŧ/' => 'T',
'/ţ|ť|ŧ/' => 't',
'/Ù|Ú|Û|Ũ|Ū|Ŭ|Ů|Ű|Ų|Ư|Ǔ|Ǖ|Ǘ|Ǚ|Ǜ/' => 'U',
'/ù|ú|û|ũ|ū|ŭ|ů|ű|ų|ư|ǔ|ǖ|ǘ|ǚ|ǜ/' => 'u',
'/Ý|Ÿ|Ŷ/' => 'Y',
'/ý|ÿ|ŷ/' => 'y',
'/Ŵ/' => 'W',
'/ŵ/' => 'w',
'/Ź|Ż|Ž/' => 'Z',
'/ź|ż|ž/' => 'z',
'/Æ|Ǽ/' => 'AE',
'/ß/'=> 'ss',
'/IJ/' => 'IJ',
'/ij/' => 'ij',
'/Œ/' => 'OE',
'/ƒ/' => 'f'
);
/* End of file foreign_chars.php */
/* Location: ./application/config/foreign_chars.php */

@ -0,0 +1,16 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| Hooks
| -------------------------------------------------------------------------
| This file lets you define "hooks" to extend CI without hacking the core
| files. Please see the user guide for info:
|
| http://codeigniter.com/user_guide/general/hooks.html
|
*/
/* End of file hooks.php */
/* Location: ./application/config/hooks.php */

@ -0,0 +1,10 @@
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

@ -0,0 +1,106 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| MIME TYPES
| -------------------------------------------------------------------
| This file contains an array of mime types. It is used by the
| Upload class to help identify allowed file types.
|
*/
$mimes = array( 'hqx' => 'application/mac-binhex40',
'cpt' => 'application/mac-compactpro',
'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel'),
'bin' => 'application/macbinary',
'dms' => 'application/octet-stream',
'lha' => 'application/octet-stream',
'lzh' => 'application/octet-stream',
'exe' => array('application/octet-stream', 'application/x-msdownload'),
'class' => 'application/octet-stream',
'psd' => 'application/x-photoshop',
'so' => 'application/octet-stream',
'sea' => 'application/octet-stream',
'dll' => 'application/octet-stream',
'oda' => 'application/oda',
'pdf' => array('application/pdf', 'application/x-download'),
'ai' => 'application/postscript',
'eps' => 'application/postscript',
'ps' => 'application/postscript',
'smi' => 'application/smil',
'smil' => 'application/smil',
'mif' => 'application/vnd.mif',
'xls' => array('application/excel', 'application/vnd.ms-excel', 'application/msexcel'),
'ppt' => array('application/powerpoint', 'application/vnd.ms-powerpoint'),
'wbxml' => 'application/wbxml',
'wmlc' => 'application/wmlc',
'dcr' => 'application/x-director',
'dir' => 'application/x-director',
'dxr' => 'application/x-director',
'dvi' => 'application/x-dvi',
'gtar' => 'application/x-gtar',
'gz' => 'application/x-gzip',
'php' => 'application/x-httpd-php',
'php4' => 'application/x-httpd-php',
'php3' => 'application/x-httpd-php',
'phtml' => 'application/x-httpd-php',
'phps' => 'application/x-httpd-php-source',
'js' => 'application/x-javascript',
'swf' => 'application/x-shockwave-flash',
'sit' => 'application/x-stuffit',
'tar' => 'application/x-tar',
'tgz' => array('application/x-tar', 'application/x-gzip-compressed'),
'xhtml' => 'application/xhtml+xml',
'xht' => 'application/xhtml+xml',
'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed'),
'mid' => 'audio/midi',
'midi' => 'audio/midi',
'mpga' => 'audio/mpeg',
'mp2' => 'audio/mpeg',
'mp3' => array('audio/mpeg', 'audio/mpg', 'audio/mpeg3', 'audio/mp3'),
'aif' => 'audio/x-aiff',
'aiff' => 'audio/x-aiff',
'aifc' => 'audio/x-aiff',
'ram' => 'audio/x-pn-realaudio',
'rm' => 'audio/x-pn-realaudio',
'rpm' => 'audio/x-pn-realaudio-plugin',
'ra' => 'audio/x-realaudio',
'rv' => 'video/vnd.rn-realvideo',
'wav' => 'audio/x-wav',
'bmp' => 'image/bmp',
'gif' => 'image/gif',
'jpeg' => array('image/jpeg', 'image/pjpeg'),
'jpg' => array('image/jpeg', 'image/pjpeg'),
'jpe' => array('image/jpeg', 'image/pjpeg'),
'png' => array('image/png', 'image/x-png'),
'tiff' => 'image/tiff',
'tif' => 'image/tiff',
'css' => 'text/css',
'html' => 'text/html',
'htm' => 'text/html',
'shtml' => 'text/html',
'txt' => 'text/plain',
'text' => 'text/plain',
'log' => array('text/plain', 'text/x-log'),
'rtx' => 'text/richtext',
'rtf' => 'text/rtf',
'xml' => 'text/xml',
'xsl' => 'text/xml',
'mpeg' => 'video/mpeg',
'mpg' => 'video/mpeg',
'mpe' => 'video/mpeg',
'qt' => 'video/quicktime',
'mov' => 'video/quicktime',
'avi' => 'video/x-msvideo',
'movie' => 'video/x-sgi-movie',
'doc' => 'application/msword',
'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'word' => array('application/msword', 'application/octet-stream'),
'xl' => 'application/excel',
'eml' => 'message/rfc822',
'json' => array('application/json', 'text/json')
);
/* End of file mimes.php */
/* Location: ./application/config/mimes.php */

@ -0,0 +1,17 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| Profiler Sections
| -------------------------------------------------------------------------
| This file lets you determine whether or not various sections of Profiler
| data are displayed when the Profiler is enabled.
| Please see the user guide for info:
|
| http://codeigniter.com/user_guide/general/profiling.html
|
*/
/* End of file profiler.php */
/* Location: ./application/config/profiler.php */

@ -0,0 +1,50 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| URI ROUTING
| -------------------------------------------------------------------------
| This file lets you re-map URI requests to specific controller functions.
|
| Typically there is a one-to-one relationship between a URL string
| and its corresponding controller class/method. The segments in a
| URL normally follow this pattern:
|
| example.com/class/method/id/
|
| In some instances, however, you may want to remap this relationship
| so that a different class/function is called than the one
| corresponding to the URL.
|
| Please see the user guide for complete details:
|
| http://codeigniter.com/user_guide/general/routing.html
|
| -------------------------------------------------------------------------
| RESERVED ROUTES
| -------------------------------------------------------------------------
|
| There area two reserved routes:
|
| $route['default_controller'] = 'welcome';
|
| This route indicates which controller class should be loaded if the
| URI contains no data. In the above example, the "welcome" class
| would be loaded.
|
| $route['404_override'] = 'errors/page_missing';
|
| This route will tell the Router what URI segments to use if those provided
| in the URL cannot be matched to a valid route.
|
*/
$route['default_controller'] = "welcome";
$route['404_override'] = '';
$route['country/(:num)'] = '/country/index/$1';
$route['province/(:num)'] = '/province/index/$1';
$route['city/(:num)'] = '/city/index/$1';
$route['special/(:num)'] = '/special/index/$1';
/* End of file routes.php */
/* Location: ./application/config/routes.php */

@ -0,0 +1,66 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| SMILEYS
| -------------------------------------------------------------------
| This file contains an array of smileys for use with the emoticon helper.
| Individual images can be used to replace multiple simileys. For example:
| :-) and :) use the same image replacement.
|
| Please see user guide for more info:
| http://codeigniter.com/user_guide/helpers/smiley_helper.html
|
*/
$smileys = array(
// smiley image name width height alt
':-)' => array('grin.gif', '19', '19', 'grin'),
':lol:' => array('lol.gif', '19', '19', 'LOL'),
':cheese:' => array('cheese.gif', '19', '19', 'cheese'),
':)' => array('smile.gif', '19', '19', 'smile'),
';-)' => array('wink.gif', '19', '19', 'wink'),
';)' => array('wink.gif', '19', '19', 'wink'),
':smirk:' => array('smirk.gif', '19', '19', 'smirk'),
':roll:' => array('rolleyes.gif', '19', '19', 'rolleyes'),
':-S' => array('confused.gif', '19', '19', 'confused'),
':wow:' => array('surprise.gif', '19', '19', 'surprised'),
':bug:' => array('bigsurprise.gif', '19', '19', 'big surprise'),
':-P' => array('tongue_laugh.gif', '19', '19', 'tongue laugh'),
'%-P' => array('tongue_rolleye.gif', '19', '19', 'tongue rolleye'),
';-P' => array('tongue_wink.gif', '19', '19', 'tongue wink'),
':P' => array('raspberry.gif', '19', '19', 'raspberry'),
':blank:' => array('blank.gif', '19', '19', 'blank stare'),
':long:' => array('longface.gif', '19', '19', 'long face'),
':ohh:' => array('ohh.gif', '19', '19', 'ohh'),
':grrr:' => array('grrr.gif', '19', '19', 'grrr'),
':gulp:' => array('gulp.gif', '19', '19', 'gulp'),
'8-/' => array('ohoh.gif', '19', '19', 'oh oh'),
':down:' => array('downer.gif', '19', '19', 'downer'),
':red:' => array('embarrassed.gif', '19', '19', 'red face'),
':sick:' => array('sick.gif', '19', '19', 'sick'),
':shut:' => array('shuteye.gif', '19', '19', 'shut eye'),
':-/' => array('hmm.gif', '19', '19', 'hmmm'),
'>:(' => array('mad.gif', '19', '19', 'mad'),
':mad:' => array('mad.gif', '19', '19', 'mad'),
'>:-(' => array('angry.gif', '19', '19', 'angry'),
':angry:' => array('angry.gif', '19', '19', 'angry'),
':zip:' => array('zip.gif', '19', '19', 'zipper'),
':kiss:' => array('kiss.gif', '19', '19', 'kiss'),
':ahhh:' => array('shock.gif', '19', '19', 'shock'),
':coolsmile:' => array('shade_smile.gif', '19', '19', 'cool smile'),
':coolsmirk:' => array('shade_smirk.gif', '19', '19', 'cool smirk'),
':coolgrin:' => array('shade_grin.gif', '19', '19', 'cool grin'),
':coolhmm:' => array('shade_hmm.gif', '19', '19', 'cool hmm'),
':coolmad:' => array('shade_mad.gif', '19', '19', 'cool mad'),
':coolcheese:' => array('shade_cheese.gif', '19', '19', 'cool cheese'),
':vampire:' => array('vampire.gif', '19', '19', 'vampire'),
':snake:' => array('snake.gif', '19', '19', 'snake'),
':exclaim:' => array('exclaim.gif', '19', '19', 'excaim'),
':question:' => array('question.gif', '19', '19', 'question') // no comma after last item
);
/* End of file smileys.php */
/* Location: ./application/config/smileys.php */

@ -0,0 +1,178 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| USER AGENT TYPES
| -------------------------------------------------------------------
| This file contains four arrays of user agent data. It is used by the
| User Agent Class to help identify browser, platform, robot, and
| mobile device data. The array keys are used to identify the device
| and the array values are used to set the actual name of the item.
|
*/
$platforms = array (
'windows nt 6.0' => 'Windows Longhorn',
'windows nt 5.2' => 'Windows 2003',
'windows nt 5.0' => 'Windows 2000',
'windows nt 5.1' => 'Windows XP',
'windows nt 4.0' => 'Windows NT 4.0',
'winnt4.0' => 'Windows NT 4.0',
'winnt 4.0' => 'Windows NT',
'winnt' => 'Windows NT',
'windows 98' => 'Windows 98',
'win98' => 'Windows 98',
'windows 95' => 'Windows 95',
'win95' => 'Windows 95',
'windows' => 'Unknown Windows OS',
'os x' => 'Mac OS X',
'ppc mac' => 'Power PC Mac',
'freebsd' => 'FreeBSD',
'ppc' => 'Macintosh',
'linux' => 'Linux',
'debian' => 'Debian',
'sunos' => 'Sun Solaris',
'beos' => 'BeOS',
'apachebench' => 'ApacheBench',
'aix' => 'AIX',
'irix' => 'Irix',
'osf' => 'DEC OSF',
'hp-ux' => 'HP-UX',
'netbsd' => 'NetBSD',
'bsdi' => 'BSDi',
'openbsd' => 'OpenBSD',
'gnu' => 'GNU/Linux',
'unix' => 'Unknown Unix OS'
);
// The order of this array should NOT be changed. Many browsers return
// multiple browser types so we want to identify the sub-type first.
$browsers = array(
'Flock' => 'Flock',
'Chrome' => 'Chrome',
'Opera' => 'Opera',
'MSIE' => 'Internet Explorer',
'Internet Explorer' => 'Internet Explorer',
'Shiira' => 'Shiira',
'Firefox' => 'Firefox',
'Chimera' => 'Chimera',
'Phoenix' => 'Phoenix',
'Firebird' => 'Firebird',
'Camino' => 'Camino',
'Netscape' => 'Netscape',
'OmniWeb' => 'OmniWeb',
'Safari' => 'Safari',
'Mozilla' => 'Mozilla',
'Konqueror' => 'Konqueror',
'icab' => 'iCab',
'Lynx' => 'Lynx',
'Links' => 'Links',
'hotjava' => 'HotJava',
'amaya' => 'Amaya',
'IBrowse' => 'IBrowse'
);
$mobiles = array(
// legacy array, old values commented out
'mobileexplorer' => 'Mobile Explorer',
// 'openwave' => 'Open Wave',
// 'opera mini' => 'Opera Mini',
// 'operamini' => 'Opera Mini',
// 'elaine' => 'Palm',
'palmsource' => 'Palm',
// 'digital paths' => 'Palm',
// 'avantgo' => 'Avantgo',
// 'xiino' => 'Xiino',
'palmscape' => 'Palmscape',
// 'nokia' => 'Nokia',
// 'ericsson' => 'Ericsson',
// 'blackberry' => 'BlackBerry',
// 'motorola' => 'Motorola'
// Phones and Manufacturers
'motorola' => "Motorola",
'nokia' => "Nokia",
'palm' => "Palm",
'iphone' => "Apple iPhone",
'ipad' => "iPad",
'ipod' => "Apple iPod Touch",
'sony' => "Sony Ericsson",
'ericsson' => "Sony Ericsson",
'blackberry' => "BlackBerry",
'cocoon' => "O2 Cocoon",
'blazer' => "Treo",
'lg' => "LG",
'amoi' => "Amoi",
'xda' => "XDA",
'mda' => "MDA",
'vario' => "Vario",
'htc' => "HTC",
'samsung' => "Samsung",
'sharp' => "Sharp",
'sie-' => "Siemens",
'alcatel' => "Alcatel",
'benq' => "BenQ",
'ipaq' => "HP iPaq",
'mot-' => "Motorola",
'playstation portable' => "PlayStation Portable",
'hiptop' => "Danger Hiptop",
'nec-' => "NEC",
'panasonic' => "Panasonic",
'philips' => "Philips",
'sagem' => "Sagem",
'sanyo' => "Sanyo",
'spv' => "SPV",
'zte' => "ZTE",
'sendo' => "Sendo",
// Operating Systems
'symbian' => "Symbian",
'SymbianOS' => "SymbianOS",
'elaine' => "Palm",
'palm' => "Palm",
'series60' => "Symbian S60",
'windows ce' => "Windows CE",
// Browsers
'obigo' => "Obigo",
'netfront' => "Netfront Browser",
'openwave' => "Openwave Browser",
'mobilexplorer' => "Mobile Explorer",
'operamini' => "Opera Mini",
'opera mini' => "Opera Mini",
// Other
'digital paths' => "Digital Paths",
'avantgo' => "AvantGo",
'xiino' => "Xiino",
'novarra' => "Novarra Transcoder",
'vodafone' => "Vodafone",
'docomo' => "NTT DoCoMo",
'o2' => "O2",
// Fallback
'mobile' => "Generic Mobile",
'wireless' => "Generic Mobile",
'j2me' => "Generic Mobile",
'midp' => "Generic Mobile",
'cldc' => "Generic Mobile",
'up.link' => "Generic Mobile",
'up.browser' => "Generic Mobile",
'smartphone' => "Generic Mobile",
'cellphone' => "Generic Mobile"
);
// There are hundreds of bots but these are the most common.
$robots = array(
'googlebot' => 'Googlebot',
'msnbot' => 'MSNBot',
'slurp' => 'Inktomi Slurp',
'yahoo' => 'Yahoo',
'askjeeves' => 'AskJeeves',
'fastcrawler' => 'FastCrawler',
'infoseek' => 'InfoSeek Robot 1.0',
'lycos' => 'Lycos'
);
/* End of file user_agents.php */
/* Location: ./application/config/user_agents.php */

@ -0,0 +1,383 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Accessmanage extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->permission->is_admin();
//$this->output->enable_profiler(TRUE);
$this->load->model('InfoStructures_model');
$this->load->model('infoAccessmanage_model','Access_model');
$this->load->library('Accesscheck');
$this->accesscheck->check_access();
}
//权限管理首页
public function index($iam_is_id='',$editsite='')
{
$data=array();
//获取用户树形结构数据
$data['userstructure'] = $this->Access_model->get_user_structure();
if ($iam_is_id=='') {
$iam_is_id = $data['userstructure'][0]->id;
}
//未添加的用户
$data['undefined_ht_user']=$this->Access_model->get_ht_user_list(true);
$data['undefined_a_user']=$this->Access_model->get_author_user_list(true);
//获取站点、角色列表
$data['role_list']=$this->Access_model->get_role_structure();
$site_list=$this->Access_model->get_user_site_list_by_isid($iam_is_id);
$data['user_site'] = array();
if(isset($site_list))$data['user_site'] = explode(',', $site_list);
//设置默认站点
if ($editsite=='' && !empty($data['user_site'])) {
$c_site=$this->config->item('site_code');
if (in_array($c_site, $data['user_site'])) {
$editsite=$this->config->item('site_code');
}else{
$editsite=$data['user_site'][0];
}
}elseif($editsite==''){
$editsite=$this->config->item('site_code');
}
//要编辑的用户权限数据
$data['user_access']=$this->Access_model->get_user_by_isid($iam_is_id,$editsite);
if (!empty($data['user_access'])) {
if(isset($data['user_access']->iao_role))$data['user_access']->iao_role=substr($data['user_access']->iao_role,0, -1);
}
//获取拥有的角色
$data['current_role'] = array();
if(isset($data['user_access']->iao_role))$data['current_role'] = explode(',', $data['user_access']->iao_role);
$data['user_level']=$this->accesscheck->get_role_level($editsite,$data['user_access']->iao_author);
if(!$this->config->item('check_access'))$data['user_level']=100;
//获取wo可以管理的站点、角色等级
$userdata=$this->session->userdata('session_admin');
$data['editsite']=$editsite;
if (in_array(strtolower($userdata['OPI_Code']), $this->config->item('access_super_manage'))) {
$data['role_level']=1;
}else{
$data['role_level']=$this->accesscheck->get_role_level($editsite);
}
$data['current_admin']=$userdata['OPI_Code'];
if ($data['role_level']==1 OR !$this->config->item('check_access')) {
foreach ($this->config->item('site') as $s) {
$data['admin_access_site'][] = $s['site_code'];
}
}else{
$admin_access_site=$this->Access_model->get_user_site_list($data['current_admin']);
if(isset($admin_access_site))$data['admin_access_site'] = explode(',', $admin_access_site);
}
//加载视图
$data['right_nav']=$this->load->view('bootstrap/accessmanage/right_nav',$data,true);
$this->load->view('bootstrap/header',$data);
$this->load->view('bootstrap/accessmanage/index');
$this->load->view('bootstrap/footer');
}
//添加用户
public function adduser($is_parent_id=0,$iam_author='New User',$isajax=1)
{
//添加空内容.
$insert_id=$this->InfoStructures_model->Add($is_parent_id);
if ($this->Access_model->add_access($iam_author,$insert_id)){
$data[] = array('name' => 'ok', 'value' => $insert_id);
}else{
$data[] = array('name' => 'no', 'value' => $this->lang->line('form_info_error'));
}
if ($isajax==1) {
echo json_encode($data);
return TRUE;
}else{
redirect(site_url("accessmanage/index/$insert_id"));
}
}
//导入ht和作者平台用户
public function edituser($is_parent_id){
$ht_user_list=$this->Access_model->get_ht_user_list();
$author_user_list=$this->Access_model->get_author_user_list();
foreach ($ht_user_list as $h) {
$insert_id=$this->InfoStructures_model->Add($is_parent_id);
$this->Access_model->add_access($h->OPI_Code,$insert_id);
}
foreach ($author_user_list as $a) {
$insert_id=$this->InfoStructures_model->Add($is_parent_id);
$this->Access_model->add_access($a->a_id,$insert_id);
}
}
//用户权限编辑
public function editaccess(){
$iao_read = $this->input->post('iao_read');
$iao_write = $this->input->post('iao_write');
$iao_author = $this->input->post('iao_author');
$iao_site = $this->input->post('iao_site');
//组装用户拥有的角色字符串
$is_edit_ownsite=false;
if ($iao_site!='') {
$iao_role = '';
$role_list=$this->input->post('role_list');
if (!empty($role_list)) {
foreach ($role_list as $v) {
$iao_role.=$v.',';
}
}
//更新用户在各站点可以编辑的具体的信息节点和角色
$is_edit_ownsite=$this->Access_model->update_ownsite($iao_read,$iao_write,$iao_author,$iao_site,$iao_role);
}
$iam_author=$this->input->post('iam_author');
$is_updateuser=false;
if($iao_author!=trim($iam_author))$is_updateuser=$this->Access_model->update_access($this->input->post('iam_id'),trim($iam_author));
if ($is_edit_ownsite or $is_updateuser) {
$data[] = array('name' => 'ok', 'value' => 'success');
}else{
$data[] = array('name' => 'no', 'value' => 'error');
}
echo json_encode($data);
return true;
}
//分配站点
public function addsite($author,$site){
if (!empty($site) && !empty($author)) {
$this->Access_model->add_site($author,$site);
}
header('Location: '.$_SERVER['HTTP_REFERER']);
}
//取消用户在某站点的权限
public function deletesite($author,$site){
if (!empty($site) && !empty($author)) {
$this->Access_model->delete_site($author,$site);
}
header('Location: '.$_SERVER['HTTP_REFERER']);
}
//删除某个用户
public function delete_user(){
if($this->Access_model->delete_user($this->input->post('iam_id'))){
$this->Access_model->delete_site($this->input->post('iam_author'));
$data[] = array('name' => 'ok', 'value' => site_url('accessmanage/index'));
}else{
$data[] = array('name' => 'no', 'value' => 'delete error');
}
echo json_encode($data);
return true;
}
//角色管理首页
public function role($iar_is_id=''){
$data=array();
//查询结构列表信息
$data['rolestructure'] = $this->Access_model->get_role_structure();
if (empty($data['rolestructure'])) {
$this->addrole(0,false);
redirect(site_url("accessmanage/role"));
}
if ($iar_is_id=='') {
$iar_is_id = $data['rolestructure'][0]->id;
}
//当前角色拥有的权限节点
$data['current_role']=$this->Access_model->get_role_by_isid($iar_is_id);
if (substr($data['current_role']->ian_iaa_id, -1)==',') {
$data['current_role']->ian_iaa_id=substr($data['current_role']->ian_iaa_id,0, -1);
}
$data['current_action'] = explode(',', $data['current_role']->ian_iaa_id);
//所有权限节点列表
$data['action_list']=$this->Access_model->get_structure_list();
$methodnode=array();
foreach ($data['action_list'] as $k=>$v) {
if ($v->pId==$data['action_list'][0]->id) {
$actionnode[]=$v;
}elseif ($k!=0) {
$methodnode[$v->pId][]=$v;
}
}
$data['actionnode']=$actionnode;
$data['methodnode']=$methodnode;
//加载视图
$data['right_nav']=$this->load->view('bootstrap/accessmanage/right_nav','$data',true);
$this->load->view('bootstrap/header',$data);
$this->load->view('bootstrap/accessmanage/role');
$this->load->view('bootstrap/footer');
}
//添加角色
public function addrole($is_parent_id,$is_ajax=true)
{
$insert_id = $this->InfoStructures_model->Add($is_parent_id);
if ($insert_id && $roleid=$this->Access_model->add_role('New Role',$insert_id)){
$data[] = array('name' => 'ok', 'value' => $insert_id);
}else{
$data[] = array('name' => 'no', 'value' => $this->lang->line('form_info_error'));
}
if ($is_ajax) {
echo json_encode($data);
return TRUE;
}
return $insert_id;
}
//角色编辑
public function editrole()
{
//更新角色名
if ($this->input->post('iar_old_name')!=$this->input->post('iar_name')) {
$this->Access_model->update_role($this->input->post('iar_id'),$this->input->post('iar_name'));
}
//父级权限节点拥有其全部子节点的权限
$actions=$this->input->post('action_list');
$action_ids='';
foreach ($actions as $v) {
$action_ids.=$v.',';
}
//如果是新的权限节点关系,则执行添加操作
if ($this->input->post('ian_iaa_id')=='') {
$result=$this->Access_model->add_node($this->input->post('iar_id'),$action_ids);
}
//如果节点关系已经存在,则执行更新操作
else{
$result=$this->Access_model->update_node($this->input->post('iar_id'),$action_ids);
}
//返回编辑结果
if ($result) {
$data[] = array('name' => 'ok', 'value' => 'success');
}else{
$data[] = array('name' => 'no', 'value' => 'error');
}
echo json_encode($data);
return true;
}
//删除角色
public function delete_role(){
if($this->Access_model->delete_role($this->input->post('iar_id'))){
$this->session->unset_userdata('access_module');
$data[] = array('name' => 'ok', 'value' => site_url('accessmanage/role'));
}else{
$data[] = array('name' => 'no', 'value' => 'delete error');
}
echo json_encode($data);
return true;
}
//移动角色排序顺序
public function tree_move()
{
//网站会提交一个同级节点id列表字符串按照这个去排序
$parent_id = $this->input->post('pid');
$idsStr = $this->input->post('ids');
$idsArray = explode(',', $idsStr);
foreach ($idsArray as $key => $value)
{
if ($value)
{
//设置排序
$this->InfoStructures_model->set_sort($value, $key);
//设置path
$this->InfoStructures_model->set_path($parent_id, $value);
}
}
$data[] = array('name' => 'ok', 'value' => $this->lang->line('structures_success_move'));
echo json_encode($data);
return TRUE;
}
//操作节点管理
public function action($iaa_is_id='')
{
//查询结构列表信息
$data['structurelist'] = $this->Access_model->get_structure_list();
if (empty($data['structurelist'])) {
$this->addaction(0,false);
redirect(site_url("accessmanage/action"));
}
if ($iaa_is_id=='') {
$iaa_is_id = $data['structurelist'][0]->id;
}
//当前权限节点
$data['current_action'] = $this->Access_model->get_action_bytreeid($iaa_is_id);
//视图加载
$data['right_nav']=$this->load->view('bootstrap/accessmanage/right_nav',$data,true);
$this->load->view('bootstrap/header',$data);
$this->load->view('bootstrap/accessmanage/action');
$this->load->view('bootstrap/footer');
}
//添加操作节点
public function addaction($is_parent_id,$is_ajax=true)
{
$insert_id = $this->InfoStructures_model->Add($is_parent_id);
if ($insert_id && $iaa_id=$this->Access_model->add_action('New Action',$insert_id)){
$this->session->unset_userdata('access_module');
$data[] = array('name' => 'ok', 'value' => $insert_id);
}else{
$data[] = array('name' => 'no', 'value' => $this->lang->line('form_info_error'));
}
if ($is_ajax) {
echo json_encode($data);
return TRUE;
}
return $insert_id;
}
//操作节点编辑
public function edit_action(){
$result=$this->Access_model->update_action(
$this->input->post('iaa_title'),
$this->input->post('iaa_controller'),
$this->input->post('iaa_action'),
$this->input->post('iaa_id')
);
if($result){
$this->session->unset_userdata('access_module');
$data[] = array('name' => 'ok', 'value' => 'success');
}else{
$data[] = array('name' => 'no', 'value' => $this->lang->line('form_info_error'));
}
echo json_encode($data);
return true;
}
//删除权限节点
public function delete_action(){
if($this->Access_model->delete_action($this->input->post('iaa_id'))){
$this->InfoStructures_model->Delete($this->input->post('iaa_is_id'));
$this->session->unset_userdata('access_module');
$data[] = array('name' => 'ok', 'value' => site_url('accessmanage/action'));
}else{
$data[] = array('name' => 'no', 'value' => 'delete error');
}
echo json_encode($data);
return true;
}
public function addeditor($user,$site)
{
$result=0;
$iao_other = $this->input->get('iao_other');
$update_result=$this->Access_model->update_site($user,$site,$iao_other);
if($update_result) $result=1;
echo $result;
}
//取消用户在某站点的权限
public function deleteeditor($author,$site){
if (!empty($site) && !empty($author)) {
$this->Access_model->delete_site($author,$site);
}
header('Location: '.$_SERVER['HTTP_REFERER']);
}
}

@ -0,0 +1,42 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Airline extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->permission->is_admin();
//$this->output->enable_profiler(TRUE);
$this->load->model('Area_model');
$this->load->model('Information_model');
$this->load->model('InfoContents_model');
$this->load->model('InfoStructures_model');
}
//航空公司
public function index()
{
$airline_id=1;
//查询结构根节点,当为空则建立
$rootStructure = $this->Information_model->GetRoot('l', $airline_id);
if ($rootStructure == FALSE)
{
$this->InfoContents_model->Add('', 'Airline', 'root', '', '', '', '', '', '', 0, 0, '', '', 0, 0, '', '', $airline_id, 'l', 0,
'','');
$this->InfoStructures_model->Add(0, $this->InfoContents_model->insert_id);
$is_id = $this->InfoStructures_model->insert_id;
}
else
{
$is_id = $rootStructure->is_id;
}
redirect(site_url('information/edit/' . $is_id));
}
}

@ -0,0 +1,42 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Airport extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->permission->is_admin();
//$this->output->enable_profiler(TRUE);
$this->load->model('Area_model');
$this->load->model('Information_model');
$this->load->model('InfoContents_model');
$this->load->model('InfoStructures_model');
}
//机场
public function index()
{
$airport_id=1;
//查询结构根节点,当为空则建立
$rootStructure = $this->Information_model->GetRoot('a', $airport_id);
if ($rootStructure == FALSE)
{
$this->InfoContents_model->Add('', 'Airport', 'root', '', '', '', '', '', '', 0, 0, '', '', 0, 0, '', '', $airport_id, 'a', 0,
'','');
$this->InfoStructures_model->Add(0, $this->InfoContents_model->insert_id);
$is_id = $this->InfoStructures_model->insert_id;
}
else
{
$is_id = $rootStructure->is_id;
}
redirect(site_url('information/edit/' . $is_id));
}
}

@ -0,0 +1,364 @@
<?php
class Analytics extends CI_Controller
{
private $view_data = array();
function __construct()
{
parent::__construct();
$this->permission->is_admin();
// $this->output->enable_profiler(TRUE);
// 载入Model
$this->load->model("Analytics_visits_model");
$this->load->model("Analytics_pages_model");
$this->load->model('Analytics_historys_model');
$this->load->model('Orders_model');
// 载入helper
$this->load->helper('url');
// 所有该类页面都使用了菜单栏
$this->_menu();
}
// public function test(){
// $this->load->model('Analytics_visits_model');
// $this->load->model('Analytics_historys_model');
// $this->load->model('Analytics_pages_model');
// $this->Analytics_vists_model->test();
// $this->Analytics_pages_model->test();
// var_dump('OK');
// }
public function index()
{
$page = $this->input->get('per_page');
$site_code = $this->input->get('site_code');
$author = $this->input->get('author');
$order = $this->input->get('order');
$url = $this->input->get('url');
// 时间段
$start = $this->input->get('start');
if (strpos($start, '-') > 0)
{
$start = strtotime($start);
}
$end = $this->input->get('end');
if (strpos($end, '-') > 0)
{
$end = strtotime($end);
}
// 获取订单最多的页面ID数组
$rs = $this->Analytics_visits_model->get_pids_order_top($page, $site_code, $author, $start, $end);
if (!empty($rs))
{
// 数据存在的话继续查询
// 输出数据
$this->view_data['count'] = $rs->count;
$this->view_data['count_all'] = $rs->count_all;
// 获取页面列表
$this->view_data['list'] = $this->Analytics_pages_model->get_by_ids($rs->page_ids, $site_code, $author, $order, $url);
// var_dump($this->view_data['list'][0]);exit();
$this->view_data['cur_page'] = $page;
// 加载配置
$sites_config = $this->config->item('site');
$authors = array();
foreach ($sites_config as $value)
{
$sites[] = $value['site_code'];
$authors = array_merge($authors, $value['site_authors']);
}
$this->view_data['authors'] = $authors;
$this->view_data['sites'] = $sites;
// 分页
$page_url = site_url('analytics/index') . "?site_code=$site_code&start=$start&end=$end&author=$author&order=$order&url=$url";
$this->view_data['pages'] = $this->_page($page_url, $this->view_data['count_all']);
}
// var_dump($rs);exit;
// 参数传递
$this->load->view('header', array('meta_title' => '统计分析'));
$this->load->view('analytics/index', $this->view_data);
$this->load->view('footer');
}
/**
* 订单列表
*/
public function order()
{
$url = $this->input->get('url');
$page = $this->Analytics_pages_model->get_one_page($url);
$this->view_data['page'] = $page;
$this->view_data['list'] = '';
if (!empty($page))
{
$this->view_data["list"] = $this->Analytics_visits_model->get_page_orders($page->p_id);
}
$this->load->view('header');
$this->load->view('analytics/order', $this->view_data);
$this->load->view('footer');
}
/**
* 订单信息
* @param type $order_num
*/
public function order_detail($order_num = '')
{
if (!$order_num)
{
show_404();
}
$detail = $this->Analytics_visits_model->get_order_detail($order_num);
if ($detail === FALSE)
{
show_404();
}
// 更多的信息
// $this->output->enable_profiler(TRUE);
$confirm_info = $this->Orders_model->get_detail_confirm($order_num);
$this->view_data['confirm_info'] = $confirm_info;
$this->view_data['detail'] = $detail;
// 页面信息
$this->view_data['page'] = $this->Analytics_pages_model->get_one($detail->v_first_page_id);
// 访问记录
$this->view_data['history'] = $this->Analytics_historys_model->get_visit_history($detail->v_id);
$this->load->view('header');
$this->load->view('analytics/order_detail', $this->view_data);
$this->load->view('footer');
}
/**
* 生成统计代码
*/
public function code()
{
$sites_config = $this->config->item('site');
foreach ($sites_config as $value)
{
$sites[] = $value['site_code'];
}
$this->view_data['sites'] = $sites;
$this->view_data['cur_site'] = $this->input->get('site');
if (in_array($this->view_data['cur_site'], $this->view_data['sites']))
{
// 生成代码
// $url = site_url();
$url = 'http://i.chtcdn.com/info.php';
$this->view_data['code'] = <<<EOF
<script language="javascript">
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = '{$url}/website_analytics?'+'site_code={$this->view_data['cur_site']}&page_title='+document.title+'&page_referer='+escape(document.referrer);
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
</script>
EOF;
}
$this->load->view('header');
$this->load->view('analytics/code', $this->view_data);
$this->load->view('footer');
}
/**
* 最近访客列表
*/
public function visit()
{
$page = $this->input->get('per_page');
$page = $page ? $page : 0;
$site_code = $this->input->get('site_code');
$order_status = $this->input->get('order_status');
// 时间段
$start = intval(strtotime($this->input->get('start')));
$end = intval(strtotime($this->input->get('end')));
// 获取访客列表
$visits_list = $this->Analytics_visits_model->get_visits($page, $site_code, $start, $end, $order_status);
if ($visits_list === FALSE || empty($visits_list))
{
// 居然乱码...
header('content-type:text/html;charset=utf-8');
show_error('数据不存在或查询数据过大(超过10W)');
}
$this->view_data['list'] = $visits_list['list'];
$this->view_data['count'] = $visits_list['count'];
$this->view_data['cur_site_code'] = $site_code;
$this->view_data['cur_start'] = $start ? date('Y-m-d', $start) : '';
$this->view_data['cur_end'] = $end ? date('Y-m-d', $end) : '';
$this->view_data['cur_order_status'] = $order_status;
$this->view_data['cur_page'] = $page;
// 加载配置
$sites_config = $this->config->item('site');
$authors = array();
foreach ($sites_config as $value)
{
$sites[] = $value['site_code'];
$authors = array_merge($authors, $value['site_authors']);
}
$this->view_data['authors'] = $authors;
$this->view_data['sites'] = $sites;
// 分页
$page_url = site_url('analytics/visit') . "?site_code=$site_code&start=$start&end=$end&order_status=$order_status";
$this->view_data['pages'] = $this->_page($page_url, $visits_list['count']);
$this->load->view('header');
$this->load->view('analytics/visit', $this->view_data);
$this->load->view('footer');
}
/**
* 常见的退出界面
*/
public function leave()
{
$this->view_data['list'] = array();
$page_ids = $this->Analytics_visits_model->get_top_leave_pids();
if ($page_ids !== FALSE)
{
$this->view_data['list'] = $this->Analytics_pages_model->get_by_ids($page_ids);
}
$this->load->view('header');
$this->load->view('analytics/leave', $this->view_data);
$this->load->view('footer');
}
/**
* 显示某个访客的访问历史
* @param type $id
*/
public function history($id)
{
$id = intval($id);
// 获取访客信息
$visit = $this->Analytics_visits_model->get_visit($id);
if ($visit == FALSE)
{
show_404();
}
// 访问记录
$history = $this->Analytics_historys_model->get_visit_history($id);
$this->view_data['visit'] = $visit;
$this->view_data['history'] = $history;
$this->load->view('header');
$this->load->view('analytics/history', $this->view_data);
$this->load->view('footer');
}
/**
* 我的统计
*/
public function mine()
{
$admin_info = $this->session->userdata('session_admin');
$my_code = $admin_info['OPI_Code'];
$year = date("Y");
$month = date("m");
$day = date("d");
$data = array(
'author' => $my_code,
'count_order_day' => 0,
'count_order_month' => 0,
'count_order_year' => 0,
'day_begin' => mktime(0, 0, 0, $month, $day, $year),
'day_end' => mktime(0, 0, 0, $month, $day + 1, $year),
'month_begin' => mktime(0, 0, 0, $month, 1, $year),
'month_end' => mktime(0, 0, 0, $month + 1, 1, $year),
'year_begin' => mktime(0, 0, 0, 1, 1, $year),
'year_end' => mktime(0, 0, 0, 1, 1, $year + 1),
);
$auhor_analytics = $this->Analytics_visits_model->get_auhor_analytics($my_code);
$data = array_merge($data, $auhor_analytics);
$this->view_data = array_merge($this->view_data, $data);
$this->load->view('header');
$this->load->view('analytics/mine', $this->view_data);
$this->load->view('footer');
}
private function _menu()
{
$data['cur_site_code'] = $this->input->get('site_code');
$data['cur_author'] = $this->input->get('author');
$data['cur_order'] = $this->input->get('order');
$data['cur_url'] = $this->input->get('url');
$data['cur_start'] = $this->input->get('start');
$data['cur_end'] = $this->input->get('end');
// 加载配置
$sites_config = $this->config->item('site');
$sites = array();
$authors = array();
if (!empty($sites_config))
{
foreach ($sites_config as $value)
{
$sites[] = $value['site_code'];
$authors = array_merge($authors, $value['site_authors']);
}
}
$data['authors'] = $authors;
$data['sites'] = $sites;
$this->view_data['menu'] = $this->load->view('analytics/menu', $data, TRUE);
return $data;
}
/**
* 分页
* @param type $page_url
* @param type $total_rows
* @param type $per_page
* @return type
*/
private function _page($page_url, $total_rows, $per_page = 50)
{
// 分页
$this->load->library('pagination'); #加载分页的对象
$config['base_url'] = $page_url; #前后页链接
$config['total_rows'] = $total_rows; #辅助函数的一个方法
$config['per_page'] = $per_page;
$config['page_query_string'] = TRUE;
$config['anchor_class'] = "class='btn' ";
$config['first_link'] = '第一页';
$config['last_link'] = FALSE; // 由于最后的分页查询可能达到7-9s, 且查询意义不大, 隐藏分页last链接
$this->pagination->initialize($config);
return $this->pagination->create_links(); #丢到数组里面呆会渲染用
}
}

@ -0,0 +1,57 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
/**
*
* 模块机制类
*
*/
class Apps extends CI_Controller
{
//重映射方法,系统函数
public function _remap($app,$param)
{
//第三方应用存放目录
$third_party = 'third_party';
//请求的应用、制器、方法
$app_name = strtolower($app)!='index'?$app:'partners';
$controller_name = isset($param[0])?strtolower($param[0]):'index';
$action_name = isset($param[1])?strtolower($param[1]):'index';
//加载应用包
$app_path=APPPATH.$third_party."/".$app_name."/"; //存放模块的目录
$view_cascade=TRUE; //允许加载模块内、外的视图
$this->load->add_package_path($app_path,$view_cascade);
//加载控制器
if ( ! file_exists($app_path.'controllers/'.$controller_name.'.php')) {
echo 'Controller file is not exists!';
return false;
}
require_once($app_path.'controllers/'.$controller_name.'.php');
$controller_name = ucfirst($controller_name);
//实例化控制器并调用请求的方法
if (class_exists($controller_name,false))
{
$controllerHandler = new $controller_name();
if(method_exists($controllerHandler,$action_name)) {
call_user_func_array(array($controllerHandler, $action_name), array_slice($param, 2));
}else{
echo 'Method is not exists!';
}
}
else
{
echo 'Controller is not exists!';
}
//停止加载应用包
$this->load->remove_package_path($app_path);
}
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,137 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Cache extends CI_Controller
{
//缓存文件绝对路径
private $dir = '';
//存放缓存文件的数组
private $file = array();
//存放缓存文件夹的数组
private $path = array();
//缓存更新接口
private $cache_api = '';
//缓存更新参数
private $post_para = '';
//当前站点域名
private $current_domain = '';
//文件更新日期
private $file_time = array();
function __construct()
{
parent::__construct();
$this->permission->is_admin();
$this->load->model('Area_model');
$this->load->model('InfoStructures_model');
$this->load->model('Information_model');
$this->site_code = $this->config->item('site_code');
}
/**
*
* 公有函数:扫描已有缓存文件并更新。
*
* 必要参数:
* @param String $site_code
*
*/
public function update()
{
//设置缓存文件文件夹
$cache_config = $this->config->item('cache');
$current_cache_config = $cache_config[$this->site_code];
$this->dir = $current_cache_config['cache_path'];
//设置当前站点
$this->current_domain = $this->config->item('site_url');
//设置缓存更新接口及POST参数
$this->cache_api = $current_cache_config['cache_api'];
$this->post_para = $current_cache_config['cache_api_para'];
//遍历缓存文件夹
$this->tree($this->dir, $this->file, $this->path, $this->file_time);
//按目录筛选结果
$this->filter($this->file, $this->path);
//整理需要传递到视图的数据
$data['file'] = $this->file;
$data['path'] = $this->path;
$data['file_time'] = $this->file_time;
$data['cache_api'] = $this->cache_api;
$data['post_para'] = $this->post_para;
//视图
$this->load->view('cache/update', $data);
}
/**
*
* 私有函数:递归遍历缓存文件夹,将目录存放到$path文件存放到$file。
*
* 必要参数:
* @param String $dir - 需要遍历的目录
* @param Array $file - 存放文件结果的数组引用
* @param Array $path - 存放路径结果的数组引用
* @param Array $file_time - 存放文件更新日期的数组引用
*
*/
private function tree($dir, &$file, &$path, &$file_time)
{
$mydir = dir($dir);
while($f = $mydir->read())
{
if(is_dir("$dir/$f") && $f!="." && $f!=".." && (strpos($dir, '/cn/')==false))
{
$path[] = "$dir/$f";
$this->tree("$dir/$f", $file, $path, $file_time);
}
else
{
if ($f!='.' && $f!='..' && (strpos($dir, '/cn/')==false))
{
$file_temp = str_ireplace('index.htm###', '', $f.'###');
$file_temp = str_ireplace('###', '', $file_temp);
$path_temp = str_ireplace($this->dir, '', $dir);
$url_temp = $this->current_domain.$path_temp.'/'.$file_temp;
$file_time[$url_temp] = date("F d Y H:i:s", filemtime("$dir/$f"));
$file[] = $url_temp;
}
}
}
$mydir->close();
}
/**
*
* 私有函数:筛选目录和文件。
*
* 必要参数:
* @param Array $file - 存放文件结果的数组引用
* @param Array $path - 存放路径结果的数组引用
*
* 可选参数POST参数 - $_POST['p']
*
*/
private function filter(&$file, &$path)
{
if (isset($_POST['p']) && !empty($_POST['p']))
{
//删选文件
foreach ($file as &$f)
{
(stripos($f, $_POST['p'])!==false) or $f = false;
}
$file = array_filter($file);
//删选目录
foreach ($path as &$p)
{
(stripos($p, $_POST['p'])!==false) or $p = false;
}
$path = array_filter($path);
}
}
}
//end of Cache

@ -0,0 +1,40 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Citizen extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->permission->is_admin();
//$this->output->enable_profiler(TRUE);
$this->load->model('Area_model');
$this->load->model('Information_model');
$this->load->model('InfoContents_model');
$this->load->model('InfoStructures_model');
}
public function index()
{
$citizen_id=1;
//查询结构根节点,当为空则建立
$rootStructure = $this->Information_model->GetRoot('z', $citizen_id);
if ($rootStructure == FALSE)
{
$this->InfoContents_model->Add('', 'Citizen Travel', 'root', '', '', '', '', '', '', 0, 0, '', '', 0, 0, '', '', $citizen_id, 'z', 0,
'','');
$this->InfoStructures_model->Add(0, $this->InfoContents_model->insert_id);
$is_id = $this->InfoStructures_model->insert_id;
}
else
{
$is_id = $rootStructure->is_id;
}
redirect(site_url('information/edit/' . $is_id));
}
}

@ -0,0 +1,42 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class City extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->permission->is_admin();
$this->load->model('Area_model');
$this->load->model('Information_model');
$this->load->model('InfoContents_model');
$this->load->model('InfoStructures_model');
}
public function index($city_id)
{
//查询不到城市信息则显示错误
$data['city'] = $this->Area_model->get_city($city_id);
if ($data['city'] == FALSE)
{
show_404();
}
//查询结构根节点,当为空则建立
$rootStructure = $this->Information_model->GetRoot('c', $city_id);
if ($rootStructure == FALSE)
{
$this->InfoContents_model->Add('', $data['city']->CII2_Name, 'root', '', '', '', '', '', '', 0, 0, '', '',0,0, '', '', $city_id, 'c', 0, '','');
$this->InfoStructures_model->Add(0, $this->InfoContents_model->insert_id);
$is_id = $this->InfoStructures_model->insert_id;
}
else
{
$is_id = $rootStructure->is_id;
}
redirect(site_url('information/edit/' . $is_id));
}
}

@ -0,0 +1,44 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Country extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->permission->is_admin();
$this->load->model('Area_model');
$this->load->model('Information_model');
$this->load->model('InfoContents_model');
$this->load->model('InfoStructures_model');
}
public function index($country_id=0)
{
//查询不到国家信息则显示错误
$data['country'] = $this->Area_model->get_country($country_id);
if ($data['country'] == FALSE)
{
show_404();
}
//查询结构根节点,当为空则建立
$rootStructure = $this->Information_model->GetRoot('n', $country_id);
if ($rootStructure == FALSE)
{
$this->InfoContents_model->Add('', $data['country']->COI2_Country, 'root', '', '', '', '', '', '', 0, 0, '', '', 0, 0, '', '', $country_id, 'n', 0,
'','');
$this->InfoStructures_model->Add(0, $this->InfoContents_model->insert_id);
$is_id = $this->InfoStructures_model->insert_id;
}
else
{
$is_id = $rootStructure->is_id;
}
redirect(site_url('information/edit/' . $is_id));
}
}

@ -0,0 +1,167 @@
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Coupon extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->permission->is_admin();
//$this->output->enable_profiler(TRUE);
$this->load->model('Coupon_model');
$this->load->library('pagination');
}
function index()
{
echo 'hello';
exit;
}
//生肖促销订单列表
function zodiac($page=1)
{
$sumOrders = $this->Coupon_model->get_count('zodiac');
$config['base_url'] = site_url('coupon/zodiac');
$config['total_rows'] = $sumOrders;
$config['per_page'] = 20;
$config['num_links'] = 4;
$config['first_link'] = '&lsaquo; First';
$config['prev_link'] = '&laquo; Prev';
$config['next_link'] = 'Next &raquo;';
$config['last_link'] = 'Last &rsaquo;';
$config['use_page_numbers'] = TRUE;
$this->pagination->initialize($config);
$data['menu'] = $this->menu();
$data['coupon'] = $this->Coupon_model->getlist('zodiac',$page,20);
$data['sumno'] = ($page-1) * 20; //页序号
$data['sumOrders'] = $sumOrders; //订单总数
//$data['used'] = $this->Coupon_model->get_count('used');
//$data['invalid'] = $this->Coupon_model->get_count('invalid');
$this->load->view('bootstrap/header', $data);
$this->load->view('bootstrap/coupon');
$this->load->view('bootstrap/footer');
}
function lottery($page=1)
{
$sumOrders = $this->Coupon_model->get_count('lottery');
$config['base_url'] = site_url('coupon/lottery');
$config['total_rows'] = $sumOrders;
$config['per_page'] = 20;
$config['num_links'] = 4;
$config['first_link'] = '&lsaquo; First';
$config['prev_link'] = '&laquo; Prev';
$config['next_link'] = 'Next &raquo;';
$config['last_link'] = 'Last &rsaquo;';
$config['use_page_numbers'] = TRUE;
$this->pagination->initialize($config);
$data['menu'] = $this->menu();
$data['lottery'] = $this->Coupon_model->getlist('lottery',$page,20);
$data['sumno'] = ($page-1) * 20; //页序号
$data['sumOrders'] = $sumOrders; //订单总数
//$data['used'] = $this->Coupon_model->get_count('used');
//$data['invalid'] = $this->Coupon_model->get_count('invalid');
$this->load->view('bootstrap/header', $data);
$this->load->view('bootstrap/lottery');
$this->load->view('bootstrap/footer');
}
//更新
function doupdate()
{
$aid = $this->input->post('aid');
$doact = $this->input->post('doact');
$statu = $this->input->post('status');
switch ($doact)
{
case 'isuse':
$field='is_use';
$this->Coupon_model->zodiac_updatestatu($aid,$statu,$field);
echo 'ok';
break;
case 'isvalid':
$field='is_valid';
$this->Coupon_model->zodiac_updatestatu($aid,$statu,$field);
echo 'ok';
break;
case 'delete':
$this->Coupon_model->zodiac_dodel($aid);
echo 'ok';
break;
default:
echo 'error';
break;
}
}
//搜索
function search()
{
$kwd=$this->input->post('kwds');
$data['kwds']=$kwd;
$searchlist = $this->Coupon_model->get_zodiac_search($kwd);
$data['coupon'] = $searchlist;
$data['sumno'] = 0; //页序号
$data['sumOrders'] = count($searchlist); //订单总数
$this->load->view('bootstrap/header', $data);
$this->load->view('bootstrap/coupon');
$this->load->view('bootstrap/footer');
}
public function menu()
{
return array(
array(
'url' =>'coupon/zodiac',
'name' =>'生肖促销'
),
array(
'url' =>'coupon/lottery',
'name' =>'转盘抽奖'
),
);
}
//导出邮件列表
function load_email_list($page=1)
{
$sumOrders = $this->Coupon_model->get_count('zodiac');
$config['base_url'] = site_url('coupon/zodiac');
$config['total_rows'] = $sumOrders;
$config['per_page'] = 300;
$config['num_links'] = 4;
$config['first_link'] = '&lsaquo; First';
$config['prev_link'] = '&laquo; Prev';
$config['next_link'] = 'Next &raquo;';
$config['last_link'] = 'Last &rsaquo;';
$config['use_page_numbers'] = TRUE;
$this->pagination->initialize($config);
$data = $this->Coupon_model->getlist('zodiac',$page,300);
$this->_excel($data);
}
//导出数据到excel
//$output要填充到excel的数据
public function _excel($output=array()){
header("Content-Type: application/vnd.ms-excel;");
header("Content-Disposition:attachment;filename=".time().".cvs");
header('Cache-Control:must-revalidate,post-check=0,pre-check=0');
header('Expires:0');
header('Pragma:public');
$excel_str="";
foreach ($output as $item) {
$excel_str.=$item->useremail.",";//设置某一单元格的值
$excel_str.="\n";//添加行结束符
}
//if($filetype==2) $excel_str=iconv('UTF-8','GB2312',$excel_str);//excel简体中文版使用gb2312编码
echo "$excel_str";
}
}

@ -0,0 +1,42 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Embassy extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->permission->is_admin();
//$this->output->enable_profiler(TRUE);
$this->load->model('Area_model');
$this->load->model('Information_model');
$this->load->model('InfoContents_model');
$this->load->model('InfoStructures_model');
}
//大使馆
public function index()
{
$embassy_id=1;
//查询结构根节点,当为空则建立
$rootStructure = $this->Information_model->GetRoot('y', $embassy_id);
if ($rootStructure == FALSE)
{
$this->InfoContents_model->Add('', 'Embassy', 'root', '', '', '', '', '', '', 0, 0, '', '', 0, 0, '', '', $embassy_id, 'y', 0,
'','');
$this->InfoStructures_model->Add(0, $this->InfoContents_model->insert_id);
$is_id = $this->InfoStructures_model->insert_id;
}
else
{
$is_id = $rootStructure->is_id;
}
redirect(site_url('information/edit/' . $is_id));
}
}

@ -0,0 +1,54 @@
<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Encryption extends CI_Controller {
function __construct() {
parent::__construct();
//$this->output->enable_profiler(TRUE);
$this->load->model('mail_accounts_model');
}
public function index() {
$data = array();
//随机几次,让随机因子滚动一下
$this->make_password(8);
$this->make_password(12);
$this->make_password(10);
$data['password'] = $this->make_password(12);
//$this->load->view('bootstrap/header' );
$show = $this->input->get('show');
if ($show == 'true') {
//$data['low_list'] = $this->mail_accounts_model->get_list();
}
$this->load->view('bootstrap/encryption', $data);
//$this->load->view('bootstrap/footer');
}
public function make_password($length = 8) {
// 密码字符集,可任意添加你需要的字符
$chars = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D',
'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '!',
'@', '#', '$', '%', '^', '&', '*', '(', ')', '-', '_',
'[', ']', '{', '}', '<', '>', '~', '`', '+', '=', ',',
'.', ';', ':', '/', '?', '|');
// 在 $chars 中随机取 $length 个数组元素键名
$keys = array_rand($chars, $length);
$password = '';
for ($i = 0; $i < $length; $i++) {
// 将 $length 个数组元素连接成字符串
$password .= $chars[$keys[$i]];
}
return $password;
}
}

@ -0,0 +1,177 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
/**
*
* FAQ
*
*/
class Faq extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->permission->is_admin();
$this->load->model('Area_model');
$this->load->model('Information_model');
$this->load->model('InfoContents_model');
$this->load->model('InfoStructures_model');
$this->load->model('Import_adv_model');
//$this->output->enable_profiler(TRUE);
}
public function index()
{
$link_id=1;
//查询结构根节点,当为空则建立
$rootStructure = $this->Information_model->GetRoot('q', $link_id);
if ($rootStructure == FALSE)
{
$this->InfoContents_model->Add('', 'FAQ', 'root', '', '', '', '', '', '', 0, 0, '', '', 0, 0, '', '', $link_id, 'q', 0,
'','');
$this->InfoStructures_model->Add(0, $this->InfoContents_model->insert_id);
$is_id = $this->InfoStructures_model->insert_id;
}
else
{
$is_id = $rootStructure->is_id;
}
redirect(site_url('information/edit/' . $is_id));
}
/**
*
* FAQ
*
*/
public function import()
{
$site_code = $this->config->item('site_code');
$site_lgc = $this->config->item('site_lgc');
//取出FAQ列表
$data['faq'] = $this->Import_adv_model->get_faq($site_code, $site_lgc);
//取出FAQ的根节点的is_id
$faq_root_isid = $this->Import_adv_model->get_faq_root_isid($site_code);
//取出所有FAQ类型
$data['faq_type'] = array();
$data['faq_type_en'] = array();
foreach ($data['faq'] as $it)
{
$data['faq_type_en'][] = $it->SFC2_Byname;
$data['faq_type'][] = $it->SFC2_Title;
}
$data['faq_type'] = array_unique($data['faq_type']);
$data['faq_type_en'] = array_unique($data['faq_type_en']);
//插入根节点 -- 已完成 -- 注释掉
/*
foreach ($data['faq_type'] as $key=>$it)
{
//写url
if (strtolower($site_code)=='jp' || strtolower($site_code)=='ru')
{
$url_m = '/feedback/'.$this->parseToUrlString($data['faq_type_en'][$key]).'/';
}
else
{
$url_m = '/feedback/'.$this->parseToUrlString($it).'/';
}
$this->InfoContents_model->add(
$url_m,//$ic_url
$it,//$ic_url_title
'',//$ic_type
$it,//$ic_title
'',//$ic_content
'',//$ic_summary
'',//$ic_seo_title
'',//$ic_seo_description
'',//$ic_seo_keywords
'',//$ic_show_bread_crumbs
1,//$ic_status
'',//$ic_template
'',//$ic_photo
'',//$ic_photo_width
'',//$ic_photo_height
'',//$ic_recommend_tours
'',//$ic_recommend_packages
'',//$ic_ht_area_id
'q',//$ic_ht_area_type
'',//$ic_ht_product_id
'',//$ic_ht_product_type
''//$ic_author
);
$this->InfoStructures_model->Add($faq_root_isid, $this->InfoContents_model->insert_id);
$insert_is_id = $this->InfoStructures_model->insert_id;
//插入二级节点
foreach ($data['faq'] as $it2)
{
if ($it2->SFC2_Title == $it)
{
//写url
$it2->WSN_Title = mb_substr($it2->WSN_Title,0,240);
$seo_des = strip_tags(mb_substr($it2->WSN_Memo,0,240).'...');
$url_s = $url_m.$it2->WSN_ID.'.htm';
$this->InfoContents_model->add(
$url_s,//$ic_url
$it2->WSN_Title,//$ic_url_title
'',//$ic_type
$it2->WSN_Title,//$ic_title
$it2->WSN_Memo,//$ic_content
'',//$ic_summary
$it2->WSN_Title,//$ic_seo_title
$seo_des,//$ic_seo_description
'',//$ic_seo_keywords
'',//$ic_show_bread_crumbs
1,//$ic_status
'',//$ic_template
'',//$ic_photo
'',//$ic_photo_width
'',//$ic_photo_height
'',//$ic_recommend_tours
'',//$ic_recommend_packages
'',//$ic_ht_area_id
'q',//$ic_ht_area_type
'',//$ic_ht_product_id
'',//$ic_ht_product_type
''//$ic_author
);
$this->InfoStructures_model->Add($insert_is_id, $this->InfoContents_model->insert_id);
}
}
}
*/
$this->rp($data['faq_type']);
$this->rp($data['faq_type_en']);
}
/**
*
* 打印测试
*
*/
private function rp($array)
{
echo('<pre>'.print_r($array, true).'</pre>');
}
/**
*
* 字符串转成URL形式.
*
* @param $str String
* @return String
*/
function parseToUrlString($str)
{
return mb_strtolower(trim(str_replace(" ", "-", $str)));
}
}

@ -0,0 +1,42 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Festival extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->permission->is_admin();
//$this->output->enable_profiler(TRUE);
$this->load->model('Area_model');
$this->load->model('Information_model');
$this->load->model('InfoContents_model');
$this->load->model('InfoStructures_model');
}
//节庆信息
public function index()
{
$festival_id=1;
//查询结构根节点,当为空则建立
$rootStructure = $this->Information_model->GetRoot('f', $festival_id);
if ($rootStructure == FALSE)
{
$this->InfoContents_model->Add('', 'Festival', 'root', '', '', '', '', '', '', 0, 0, '', '', 0, 0, '', '', $festival_id, 'f', 0,
'','');
$this->InfoStructures_model->Add(0, $this->InfoContents_model->insert_id);
$is_id = $this->InfoStructures_model->insert_id;
}
else
{
$is_id = $rootStructure->is_id;
}
redirect(site_url('information/edit/' . $is_id));
}
}

@ -0,0 +1,42 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Groupon extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->permission->is_admin();
//$this->output->enable_profiler(TRUE);
$this->load->model('Area_model');
$this->load->model('Information_model');
$this->load->model('InfoContents_model');
$this->load->model('InfoStructures_model');
}
//团购信息
public function index()
{
$groupon_id=1;
//查询结构根节点,当为空则建立
$rootStructure = $this->Information_model->GetRoot('g', $groupon_id);
if ($rootStructure == FALSE)
{
$this->InfoContents_model->Add('', 'Groupon', 'root', '', '', '', '', '', '', 0, 0, '', '', 0, 0, '', '', $groupon_id, 'g', 0,
'','');
$this->InfoStructures_model->Add(0, $this->InfoContents_model->insert_id);
$is_id = $this->InfoStructures_model->insert_id;
}
else
{
$is_id = $rootStructure->is_id;
}
redirect(site_url('information/edit/' . $is_id));
}
}

@ -0,0 +1,225 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Ht_flight extends CI_Controller {
function __construct() {
parent::__construct();
//$this->output->enable_profiler(TRUE);
$this->load->model('Air_model');
}
//航班查询
public function index() {
$depart_city_code = $this->input->get('star');
$arrive_city_code = $this->input->get('dest');
$depart_date = $this->input->get('rDate');
echo $depart_city_code.$arrive_city_code.$depart_date;
if (empty($depart_city_code) || empty($arrive_city_code) || empty($depart_date)) {
echo '请输入正确的参数';
} else {
$depart_city_name = $this->Air_model->get_city_by_code($depart_city_code);
$arrive_city_name = $this->Air_model->get_city_by_code($arrive_city_code);
redirect("http://flight.elong.com/$depart_city_name-$arrive_city_name/?departdate=$depart_date");
}
}
//酒店详情页
public function hotel($cityname,$hotelname,$checkIn=false,$checkOut=false)
{
$cityname=trim($cityname);
if (empty($cityname) || empty($hotelname)) {
die('请输入正确的参数');
}
//格式化城市名和酒店名
$cityname=urldecode($cityname);
$hotelname=urldecode($hotelname);
$cityname=iconv("GBK", "UTF-8", $cityname);
$hotelname=iconv("GBK", "UTF-8", $hotelname);
$hotelname=str_replace('(', '', $hotelname);
$hotelname=str_replace(')', '', $hotelname);
//$hotelname=preg_replace("/\(.*\)/", '', $hotelname);
//格式化预订日期
($checkIn==false || strtotime($checkIn)<time()) && $checkIn=date('Y-m-d',time()+2*24*60*60);
($checkOut==false || strtotime($checkOut)<time()) && $checkOut=date('Y-m-d',time()+3*24*60*60);
$checkIn=date('Y-m-d',strtotime($checkIn));
$checkOut=date('Y-m-d',strtotime($checkOut));
//拼接酒店列表页链接
$this->lang->load('hotel_city_info');
$city_info=$this->lang->line('hotel_city_info');
$city_info=$city_info["$cityname"];
$city=strtolower($city_info['CityEName']);
$search_str=$city.$city_info['City'];
$search_str=str_replace(' ', '', $search_str);
//如果是XXX酒店原XXX酒店这类名称则把括号里的备注去掉
preg_match("/(.*)/", $hotelname, $backup);
$backup=isset($backup[1])? trim($backup[1]):'';
if (strpos($backup,'原')===0) {
$hotelname=str_replace(''.$backup.'', '', $hotelname);
}
$new_hotelname=preg_replace("/(.*)/", '', $hotelname);
$hotelname=urlencode($hotelname);
//获取酒店列表页内容
$data['url']='http://hotels.ctrip.com/hotel/'.$search_str.'/k1'.$hotelname;
$filecontents = $this->curl_data($data['url']);
//获取酒店详细页和价格列表页的链接
preg_match_all('/<h2 class=\"searchresult_name\"(.*)<\/h2>/i', $filecontents, $matches);
preg_match('/<a href=\"(.*)\" data-dopost=/i', $matches[1][0], $store);
//如果没有匹配的结果则提醒,并跳转到携程官网查询
$market=preg_replace("/\(.*\)/", '', ltrim(strip_tags($matches[0][0]),'1'));
if ($market!=$new_hotelname) {
//echo '<h1 style="margin: 100px auto;width: 600px;">暂无匹配的酒店数据(或者匹配出错)<br>请把酒店名提交给梁宇云<img align="absMiddle" src="http://www.mycht.cn/js/TQEditor/face/51.gif" emot="51" style="width: 35px;margin-top: -11px;"><br><p style="margin-top:50px;font-size:18px;"><a target="_blank" href="'.$data['url'].'">跳转到携程官方网站进行查看</a></p></h1>';
//die();
}
$detail_url='http://hotels.ctrip.com'.$store[1].'/?checkIn='.$checkIn.'&checkOut='.$checkOut;
$hotelid=trim(str_replace(array('/hotel/','.html'), '', $store[1]));
$price_url="http://hotels.ctrip.com/Domestic/tool/AjaxHotelPriceNew.aspx?type=new&city=".$city_info['City']."&hotel=$hotelid&startDate=$checkIn&depDate=$checkOut&RequestTravelMoney=F&promotion=F&prepay=F&IsCanReserve=F&IsJustConfirm=F&OrderType=desc";
preg_match('/<li class=\"searchresult_info_judge\">(.*)<\/li><li class=\"hotel_favorite_info\">/i', $filecontents, $score);
$data['hotel_score']=str_replace('<li class="hotel_favorite_info">', '', $score[0]);
$data['hotelid']=$hotelid;
$data['cityid']=$city_info['City'];
$detail=$this->curl_data($detail_url);
$preg = "/<script[\s\S]*?<\/script>/i";
$detail=preg_replace($preg,"",$detail);
if(mb_detect_encoding($detail,"UTF-8, ISO-8859-1, GBK")!="UTF-8" ) {
$detail=iconv("gbk","utf-8",$detail);
}
$length=stripos($detail, '<div id="hotelRoomBox"');
$data['part1']=substr($detail,0,$length);
$data['part2']=substr($detail,$length+24);
$data['part2']=substr(trim($data['part2']),6);
$this->load->view('ctrip_hotel',$data);
}
public function hotel_price_list($cityid,$hotelid,$checkIn=false,$checkOut=false)
{
//格式化预订日期
$checkIn==false && $checkIn=date('Y-m-d',time()+2*24*60*60);
$checkOut==false && $checkOut=date('Y-m-d',time()+3*24*60*60);
$checkIn=date('Y-m-d',strtotime($checkIn));
$checkOut=date('Y-m-d',strtotime($checkOut));
//获取价格列表
$price_url="http://hotels.ctrip.com/Domestic/tool/AjaxHotelPriceNew.aspx?type=new&city=$cityid&hotel=$hotelid&startDate=$checkIn&depDate=$checkOut&RequestTravelMoney=F&promotion=F&prepay=F&IsCanReserve=F&IsJustConfirm=F&OrderType=desc";
$price_list=$this->curl_data($price_url);
if(mb_detect_encoding($price_list,"UTF-8, ISO-8859-1, GBK")!="UTF-8" ) {
$price_list=iconv("gbk","utf-8",$price_list);
}
echo $price_list;
}
public function hotel_other_price($hotelid,$checkIn=false,$checkOut=false)
{
//格式化预订日期
$checkIn==false && $checkIn=date('Y-m-d',time()+2*24*60*60);
$checkOut==false && $checkOut=date('Y-m-d',time()+3*24*60*60);
$checkIn=date('Y-m-d',strtotime($checkIn));
$checkOut=date('Y-m-d',strtotime($checkOut));
//获取价格列表
$price_url="http://hotels.ctrip.com/domestic/comparepricepanel/loadlist/?hotelId=$hotelid&checkIn=$checkIn&checkOut=$checkOut&returnCash=1";
$html=$this->curl_data($price_url);
if(mb_detect_encoding($html,"UTF-8, ISO-8859-1, GBK")!="UTF-8" ) {
$html=iconv("gbk","utf-8",$html);
}
echo $html;
}
public function curl_data($url)
{
$ch2 = curl_init();
curl_setopt($ch2, CURLOPT_TIMEOUT, 30);
curl_setopt($ch2, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch2, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch2, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch2, CURLOPT_URL, $url);
$filecontents = curl_exec($ch2);
curl_close($ch2);
return $filecontents;
}
//携程酒店预订接口测试
public function test()
{
header("Content-type: text/html; charset=utf-8");
$this->load->library('Ctripapi');
//酒店详情
$city_code='33';
$area_id='';
$hotel_name='桂林漓江大瀑布饭店';
$result=$this->ctripapi->hotel_search($city_code,$area_id,$hotel_name);
//酒店价格计划列表
$hotel_code='437337';
$date_start='2015-10-12';
$date_end='2015-10-13';
//$result=$this->ctripapi->hotel_rate_plan($hotel_code,$date_start,$date_end);
//酒店价格缓存变化
$hotel_code='437337';
$city_code='33';
//$result=$this->ctripapi->hotel_cache_change($hotel_code,$city_code);
//酒店可订性检查
$hotel_code='437337';
$rateplan_code='6925134';
$start_stmp='2015-10-12';
$end_stmp='2015-10-13';
$arrival_stmp='2015-10-12 15:00:00';
$quantity=1;
$count=2;
//$result=$this->ctripapi->hotel_avail($hotel_code,$rateplan_code,$start_stmp,$end_stmp,$arrival_stmp,$quantity,$count);
//酒店订单生成
$data['hotel_code'] = '437337'; //酒店ID
$data['rateplan_code'] = '17661'; //价格计划ID
$data['unique_id'] = ''; //联盟用户在携程的uniqueid
$data['number_of_units'] = '1'; //预订房间数
$data['arrival_time'] = '10:00:00+08:00'; //入住人最早到店时间
$data['late_arrival_time'] = '19:00:00+08:00'; //入住人最早最晚时间
$data['surname'] = array('梁宇云'); //入住人姓名列表
$data['contact_type'] = 'tel'; //确认联系人方式:sms/email/fax/non 手机短消息/电邮/传真/无需确认
$data['contact_name'] = '梁宇云'; //联系人姓名
$data['phone_number'] = '15677370410'; //电话号码
$data['phone_tech_type'] = '1'; //电话类型
$data['contact_email'] = '2355711191@qq.com'; //联系邮箱
$data['start_stmp'] = '2015-10-12T00:00:00+08:00'; //入住开始时间
$data['end_stmp'] = '2015-10-13T00:00:00+08:00'; //入住结束时间
$data['count'] = '2'; //客人数量
$data['per_room'] = 'false'; //客人数量是否对应每间房false表示所有房间加起来一共住这么多客人
$data['special_text'] = '有窗'; //客人特殊要求
$data['amount_before_tax'] = '660'; //税前订单总价
$data['amount_currency'] = 'CNY'; //货币单位
$data['guarante_code'] = false; //担保标记:1:峰时担保2全额担保3超时担保4一律担保5手机担保
$data['guarantee_type'] = 'CC/DC/Voucher'; //信用卡担保类型(暂时只支持此类型)
$data['card_type'] = ''; //磁卡类型参考CodeList(CCT)
$data['card_number'] = ''; //信用卡号
$data['series_code'] = ''; //串号信用卡背后的3位数字
$data['effective_date'] = ''; //生效日期
$data['expire_date'] = ''; //失效日期
$data['card_holder_name'] = ''; //持卡人姓名
$data['card_holder_idcard'] = ''; //持卡人身份证
$data['guarante_amount'] = '0'; //接收到的担保金额
$data['guarante_currency'] = 'CNY'; //货币单位
$data['cancel_penalty_amount'] = ''; //取消罚金金额,取消罚金数量等于担保金数量
$data['cancel_penalty_currency']= 'CNY'; //取消罚金单位
$data['cancel_penalty_start'] = ''; //最迟的取消时间,在这个时间前取消不需要扣除罚金
$data['cancel_penalty_end'] = ''; //表示在这个时间段取消是需要扣除罚金
//$result=$this->ctripapi->hotel_res($data);
var_dump($result);
}
}

@ -0,0 +1,134 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Import extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->permission->is_admin();
//$this->output->enable_profiler(TRUE);
$this->load->model('Area_model');
$this->load->model('Import_model');
$this->load->model('InfoContents_model');
$this->load->model('InfoStructures_model');
}
public function index()
{
//@set_time_limit(0);
ini_set('max_execution_time', '0');
// $this->Import_model->import_from_other_database(69690,63564);
//$this->Import_model->import_clear();
//$this->Import_model->import_info();
//$this->Import_model->import_xxoo();
//$this->Import_model->update_root();
/*$data = $this->Import_model->import_test();
foreach ($data as $item)
{
for ($i = 0; $i <= $item->is_level; $i++)
{
echo '&nbsp;&nbsp;';
}
echo $item->ic_url_title . '<br/>';
}*/
}
public function clear_site(){
$this->Import_model->import_clear_site();echo 'clear_site';
}
public function reset_path()
{
@set_time_limit(0);
return false;
$this->Import_model->reset_all_path();
}
public function to_sqlite()
{
$this->load->driver('cache', array('adapter' => 'file', 'backup' => 'file'));
$this->HT = $this->load->database('HT', TRUE);
$sql_array = array();
$sql_ht = "SELECT ic.ic_id, \n"
. " ic.ic_url, \n"
. " ic.ic_url_title, \n"
. " ic.ic_type, \n"
. " ic.ic_title, \n"
. " ic.ic_content, \n"
. " ic.ic_summary, \n"
. " ic.ic_seo_title, \n"
. " ic.ic_seo_description, \n"
. " ic.ic_seo_keywords, \n"
. " ic.ic_show_bread_crumbs, \n"
. " ic.ic_status, \n"
. " ic.ic_template, \n"
. " ic.ic_photo, \n"
. " ic.ic_photo_width, \n"
. " ic.ic_photo_height, \n"
. " ic.ic_sitecode, \n"
. " ic.ic_recommend_tours, \n"
. " ic.ic_recommend_packages, \n"
. " ic.ic_datetime, \n"
. " ic.ic_ht_area_id, \n"
. " ic.ic_ht_area_type, \n"
. " ic.ic_ht_product_id, \n"
. " ic.ic_ht_product_type, \n"
. " is1.is_id, \n"
. " is1.is_parent_id, \n"
. " is1.is_path, \n"
. " is1.is_level, \n"
. " is1.is_sort, \n"
. " is1.is_sitecode, \n"
. " is1.is_datetime, \n"
. " is1.is_ic_id \n"
. "FROM infoContents ic \n"
. " INNER JOIN infoStructures is1 ON is1.is_ic_id = ic.ic_id \n"
. " AND is1.is_sitecode = 'cht' \n"
. "WHERE ic.ic_ht_area_type = 'c' \n"
. " AND ic.ic_ht_area_id IN (177, 54, 1, 3, 7)";
$sql_ht_query = $this->HT->query($sql_ht);
foreach ($sql_ht_query->result() as $item)
{
$sql_content = "INSERT INTO information \n"
. " ( \n"
. " ic_id, ic_url_title, ic_type,ic_content, ic_title, \n"
. " ic_show_bread_crumbs,ic_status, ic_template,ic_photo, ic_photo_width, \n"
. " ic_photo_height,ic_datetime,ic_ht_area_id, ic_ht_area_type, \n"
. " is_id, is_parent_id, is_path, is_level, is_sort \n"
. " ) \n"
. "VALUES \n"
. " ( \n"
. $this->HT->escape($item->ic_id) . ' , '
. $this->HT->escape($item->ic_url_title) . ' , '
. $this->HT->escape($item->ic_type) . ' , '
. $this->HT->escape($item->ic_content) . ' , '
. $this->HT->escape($item->ic_title) . ' , '
. $this->HT->escape($item->ic_show_bread_crumbs) . ' , '
. $this->HT->escape($item->ic_status) . ' , '
. $this->HT->escape($item->ic_template) . ' , '
. $this->HT->escape($item->ic_photo) . ' , '
. $this->HT->escape($item->ic_photo_width) . ' , '
. $this->HT->escape($item->ic_photo_height) . ' , '
. $this->HT->escape($item->ic_datetime) . ' , '
. $this->HT->escape($item->ic_ht_area_id) . ' , '
. $this->HT->escape($item->ic_ht_area_type) . ' , '
. $this->HT->escape($item->is_id) . ' , '
. $this->HT->escape($item->is_parent_id) . ' , '
. $this->HT->escape($item->is_path) . ' , '
. $this->HT->escape($item->is_level) . ' , '
. $this->HT->escape($item->is_sort)
. " );";
$sql_array[] = $sql_content;
// echo $sql_content.';';
//$this->cache->save(md5($item->ic_id), $item->ic_content, 60 * 60 * 24 * 30);
}
file_put_contents('import.sql', implode("\n", $sql_array));
//print_r($sql_array);
}
}

@ -0,0 +1,77 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
/**
*
* 数据导入
*
* 功能:
* 1.根据文件目录导入信息
*
*/
class Import_adv extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->permission->is_admin();
$this->load->model('Information_model');
$this->load->model('InfoContents_model');
$this->load->model('InfoStructures_model');
$this->load->model('Import_adv_model');
$this->output->enable_profiler(TRUE);
}
/**
*
* index
*
*/
public function index()
{
//专题根节点
echo('index');
}
/**
*
* FAQ
*
*/
public function faq($site_code='jp', $site_lgc='3')
{
//取出FAQ列表
$data['faq'] = $this->Import_adv_model->get_faq($site_code, $site_lgc);
//取出FAQ的根节点的is_id
$faq_root_isid = $this->Import_adv_model->get_faq_root_isid($site_code);
//取出所有FAQ类型
$data['faq_type'] = array();
foreach ($data['faq'] as $it)
{
$data['faq_type'][] = $it->SFC2_Title;
}
$data['faq_type'] = array_unique($data['faq_type']);
//插入根节点
$this->InfoContents_model->add('','');
$this->rp($data['faq_type']);
}
/**
*
* 打印测试
*
*/
private function rp($array)
{
echo('<pre>'.print_r($array, true).'</pre>');
}
}
// end of Import_adv

@ -0,0 +1,10 @@
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

@ -0,0 +1,98 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Info_image_review extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->permission->is_admin();
//$this->output->enable_profiler(TRUE);
//$this->load->model('Area_model');
//$this->load->model('InfoContents_model', 'icm');
//$this->load->model('InfoStructures_model', 'ism');
$this->load->model('infoImageReview_model', 'irm');
}
/**
*
* 导入信息图片
*
*/
public function lists($site_code='jp', $area_type='c')
{
$data['site_code'] = $site_code;
$data['area_type'] = $area_type;
//获取内容带图片的信息
$this->irm->ir_site_code = $site_code;
$this->irm->ir_ht_area_type = $area_type;
$data['infos'] = $this->irm->get_info_has_img();
//image_num, info_num
$data['info_num'] = count($data['infos']);
$data['image_num'] = 0;
//分离ic_contentic_summary中的图片
foreach ($data['infos'] as $it)
{
$match = array();
$img_src_content = array();
$img_src_summary = array();
$patt = '/<img.+?src="(.+?)".+?>/';
//ic_content
preg_match_all($patt, $it->ic_content, $match);
$it->ic_content = '';
if (isset($match[1]))
{
$img_src_content = $match[1];
}
//ic_summary
preg_match_all($patt, $it->ic_summary, $match);
$it->ic_summary = '';
if (isset($match[1]))
{
$img_src_summary = $match[1];
}
$it->pic_array = array_merge($img_src_content, $img_src_summary);
$data['image_num'] += count($it->pic_array);
}
//$this->r_print($data['infos']);
$this->load->view('info_image_review', $data);
}
/**
*
* 插入数据
*
*/
public function insert()
{
$this->irm->ir_ic_id = $this->input->post('ir_ic_id');
$this->irm->ir_is_id = $this->input->post('ir_is_id');
$this->irm->ir_img_src = $this->input->post('ir_img_src');
$this->irm->ir_img_replace = $this->input->post('ir_img_replace');
$this->irm->ir_state = $this->input->post('ir_state');
$this->irm->ir_ht_area_type = $this->input->post('ir_ht_area_type');
$this->irm->ir_ht_area_id = $this->input->post('ir_ht_area_id');
$this->irm->ir_site_code = $this->input->post('ir_site_code');
$id = $this->irm->insert();
echo($id);
}
/**
*
* 测试:打印
*
*/
public function r_print($o)
{
echo('<pre>'.print_r($o, true).'</pre>');
}
}

@ -0,0 +1,679 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Information extends CI_Controller {
function __construct() {
parent::__construct();
$this->permission->is_admin();
//$this->output->enable_profiler(TRUE);
$this->load->model('Area_model');
$this->load->model('Information_model');
$this->load->model('InfoContents_model');
$this->load->model('InfoStructures_model');
$this->load->model('Landscape_model');
$this->load->model('Operator_model');
$this->load->model('Logs_model');
$this->load->model('InfoMetas_model');
$this->load->model('Infoauthors_model');
$this->load->model('InfoKeywordsanalytics_model', 'analytics_model');
$this->load->model('InfoSMS_model');
$this->load->library('Accesscheck');
$this->accesscheck->check_access();
}
public function index() {
echo '信息首页';
$this->load->model('pictureUseStat_model');
$this->pictureUseStat_model->test();
}
public function add($is_parent_id) {
//添加空内容.
$this->InfoContents_model->Add('', 'New Information', '', '', '', '', '', '', '', 0, 0, '', '', 0, 0, '', '', 0, '', 0, '', '');
$infocontent = $this->InfoContents_model->get_ic_contents($this->InfoContents_model->insert_id);
if (!empty($infocontent) && $this->InfoStructures_model->Add($is_parent_id, $this->InfoContents_model->insert_id)) {
$is_id = $this->InfoStructures_model->insert_id;
$InfoStructures = $this->InfoStructures_model->Detail($is_id);
$InfoStructures->is_id = $is_id;
$data[] = array('name' => 'ok', 'value' => $InfoStructures);
$this->Logs_model->add($this->InfoStructures_model->insert_id);
} else {
$data[] = array('name' => 'no', 'value' => $this->lang->line('form_info_error'));
}
echo json_encode($data);
return TRUE;
}
//移动结构顺序
public function move() {
//网站会提交一个同级节点id列表字符串按照这个去排序
$parent_id = $this->input->post('pid');
$idsStr = $this->input->post('ids');
$idsArray = explode(',', $idsStr);
foreach ($idsArray as $key => $value) {
if ($value) {
//设置排序
$this->InfoStructures_model->set_sort($value, $key);
//设置path
$this->InfoStructures_model->set_path($parent_id, $value);
}
}
$data[] = array('name' => 'ok', 'value' => $this->lang->line('structures_success_move'));
echo json_encode($data);
$this->Logs_model->move($idsStr);
return TRUE;
}
public function delete($is_id) {
//查询结构信息
$Structure = $this->InfoStructures_model->Detail($is_id);
if ($Structure == FALSE) {
$data[] = array('name' => 'no', 'value' => $this->lang->line('structures_error_notfound'));
echo json_encode($data);
return false;
}
if ($this->InfoStructures_model->HasChild($Structure->is_id)) {
$data[] = array('name' => 'no', 'value' => $this->lang->line('structures_error_haschild'));
echo json_encode($data);
return false;
} else {
$info_detail = $this->Information_model->Detail($is_id);
$this->Logs_model->delete($is_id, $info_detail->ic_content);
if (!empty($info_detail->ic_summary)) {
$this->Logs_model->backup_summary($is_id, $info_detail->ic_summary);
}
$this->InfoStructures_model->Delete($Structure->is_id);
$this->InfoContents_model->Delete($Structure->is_ic_id);
//如果是已经发布的页面,删除静态文件
if ($info_detail->ic_status == 1) {
$this->update_cache($info_detail->ic_url, true);
}
//删除成功后返回一个上级链接给用户
$drumpurl = site_url('information/edit/' . $Structure->is_parent_id);
if ($Structure->is_parent_id == 0)
$drumpurl = site_url('/');
$data[] = array('name' => 'ok', 'value' => $drumpurl);
echo json_encode($data);
return true;
}
}
public function edit($is_id) {
header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
set_time_limit(30);
//$this->output->enable_profiler(true);
//查询结构信息
$Structure = $this->InfoStructures_model->Detail($is_id);
if ($Structure == FALSE) {
show_404();
}
//查询结构根节点
$rootStructure = $this->InfoStructures_model->GetParent($Structure->is_path, 1);
//没有根节点就从它本身开始查询
if ($rootStructure == false) {
$rootStructure_ID = $Structure->is_id;
} else {
$rootStructure_ID = $rootStructure->is_id;
}
//查询结构列表信息
//$data['informationList'] = $this->Information_model->StructureList($rootStructure_ID);
$data['informationList'] = $this->accesscheck->get_info_structure($rootStructure_ID);
if (!$data['informationList']) {
redirect(site_url('Login/refuse'));
}
$data['is_writeable'] = $this->accesscheck->get_edit_type($Structure->is_path);
//增加一项,属于这个区域,但是结构数据层次不准确的也要列出来
//todo:
//信息内容
$data['information'] = $this->Information_model->Detail($is_id);
//检查该信息是否已收录
$data['embody'] = 1;
if (isset($data['information']->ic_id)) {
$embody = $this->InfoMetas_model->get($data['information']->ic_id, 'meta_embody');
if ($embody && $embody != '1') {
$data['embody'] = 0;
}
//设置该信息所有未读消息为已读
$this->InfoSMS_model->readed_for_info($data['information']->ic_id);
}
//主节点信息
$data['rootInformation'] = $this->Information_model->Detail($rootStructure_ID);
//获取未绑定的景点,只有城市有,无视其它区域类型
$data['unlink_landscape_list'] = array();
//可选的展示模板
if (in_array($this->config->item('site_code'), array('vac', 'vc', 'jp', 'ru', 'it'))) {
$this->config->set_item('templates', $this->config->item('templates_i'));
}
if (in_array($this->config->item('site_code'), array('ah'))) {
$this->config->set_item('templates', $this->config->item('templates_ah'));
}
//信息区域类型
switch ($data['rootInformation']->ic_ht_area_type) {
case 'c': //城市
$data['infoTypeList'] = $this->config->item('InfoType_city');
$data['unlink_landscape_list'] = $this->Information_model->get_unlink_landscape_list($data['rootInformation']->ic_ht_area_id);
break;
case 'p'://省份
$data['infoTypeList'] = $this->config->item('InfoType_province');
break;
case 'n'://国家
$data['infoTypeList'] = $this->config->item('InfoType_country');
break;
case 't'://特殊区域
$data['infoTypeList'] = $this->config->item('InfoType_special');
break;
case 'e'://大洲
$data['infoTypeList'] = array();
break;
case 'z'://公民游
$data['infoTypeList'] = $this->config->item('InfoType_citizen');
break;
case 'v'://视频
$data['infoTypeList'] = $this->config->item('InfoType_video');
break;
case 'f'://节庆
$data['infoTypeList'] = $this->config->item('InfoType_festival');
break;
case 'pd'://产品管理
$data['infoTypeList'] = $this->config->item('InfoType_product');
//LMR 2016-7-14
if (in_array($this->config->item('site_code'), array('vac', 'vc', 'jp', 'ru', 'it'))) {
$this->config->set_item('templates', $this->config->item('templates_product_i'));
} else {
$this->config->set_item('templates', $this->config->item('templates_product'));
}
break;
default:
$data['infoTypeList'] = array();
break;
}
$data['templateList'] = $this->config->item('templates');
//翰特产品类型
$data['productTypeList'] = $this->config->item('ProductType_HT');
//获取绑定的产品名称
switch ($data['information']->ic_ht_product_type) {
case 't':
$data['product_title'] = $this->Landscape_model->get_landscape_title($data['information']->ic_ht_product_id);
break;
default:
$data['product_title'] = '';
break;
}
//获取最后更新者信息
$data['last_edit_info'] = $this->Logs_model->get_last_edit($is_id);
//编辑列表
$sites = $this->config->item('site');
$data['editor_list'] = $this->Operator_model->get_site_user($this->config->item('site_code'));
//获取作者列表
$data['author_list'] = $this->Infoauthors_model->get_site_user($this->config->item('site_code'));
//获取备份信息记录
$data['content_backup_list'] = $this->Logs_model->get_backup_list($is_id);
//所属导航栏目
$data['setting_website_nav'] = $this->InfoMetas_model->get_list(0, 'setting_website_nav_' . strtolower($this->config->item('site_code')));
$this->load->view('bootstrap3/header', $data);
$this->load->view('bootstrap3/information_edit');
$this->load->view('bootstrap3/footer');
}
/**
public function redirect($jumpUrl){
header('HTTP/1.1 301 Moved Permanently');
header($jumpUrl);// 301 跳转到设置的 url
exit();
} */
public function test_proxy($url = false) {
$curl = curl_init();
//curl_setopt($curl,CURLOPT_URL, "http://graph.facebook.com/?id=http://www.chinahighlights.com");
//curl_setopt($curl,CURLOPT_URL, 'http://graph.facebook.com/?id=http://www.mybeijingchina.com/beijing-attractions/beihai-park/');
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPPROXYTUNNEL, 1);
curl_setopt($curl, CURLOPT_PROXY, "120.24.227.23:33333");
$request = curl_exec($curl);
curl_close($curl);
return $request;
//echo $request;
}
// 分享数 lzq
public function statistical_sharing() {
//$info_ic = $this->Information_model->get_ic_url_by_code('mbj');
$info_ic = $this->Information_model->get_ic_url();
$ic_id = $info_ic->ic_id;
$ic_url = $info_ic->ic_url;
$ic_sitecode = $info_ic->ic_sitecode;
$site = $this->config->item('site');
if (!empty($ic_url)) {
$result = $this->Information_model->update_ic_date_by_code($ic_id);
//var_dump($site['mbj']['site_url']);
//$wz_url = 'http://graph.facebook.com/?id='.$site['mbj']['site_url'].$ic_url;
$complete_url = 'http://graph.facebook.com/?id=' . $site[$ic_sitecode]['site_url'] . $ic_url;
//echo $wz_url;
$api_return = $this->test_proxy($complete_url);
$api_return = json_decode($api_return);
if (empty($api_return->shares)) {
var_dump($api_return);
$shares = 0;
} else {
var_dump($api_return);
$shares = $api_return->shares;
}
//echo $asd->shares;
$result2 = $this->Information_model->insert_url_to_csi($info_ic->ic_url, $ic_id, $info_ic->ic_sitecode, $shares);
}
//$sstt = $this->config->item('site');
//foreach($infolist as $k=>$v){
// $aabb[] = $v->ic_sitecode;
//}
//$url_count = $this->Information_model->get_count_by_code('mbj');
//$surl = site_url('/information/fengxiangshu');
//redirect($surl,'refresh',301);
$this->load->view('bootstrap3/header');
$this->load->view('bootstrap3/statistical_sharing');
}
public function edit_save() {
header('Cache-Control: no-cache');
$information = $this->Information_model->Detail($this->input->post('is_id'));
if ($information === false) {
$data[] = array('name' => 'no', 'value' => $this->lang->line('structures_error_notfound'));
echo json_encode($data);
return false;
}
$this->form_validation->set_rules('ic_url_title', 'lang:ic_url_title', 'required');
$this->form_validation->set_rules('ic_title', 'lang:ic_title', 'required');
$this->form_validation->set_rules('ic_author', 'lang:ic_author', 'required');
$this->form_validation->set_rules('ic_url', 'lang:ic_url', 'callback_ic_url_check');
//这里比较特别检测两次ic_urlci会冲掉第一个ic_url的规则所以需要在下面也加上callback_ic_url_check
$this->form_validation->set_rules('ic_url', 'lang:ic_url_format', 'callback_ic_url_check|callback_ic_url_format');
if ($this->input->post('ignore_seo_check') === false) {
$this->form_validation->set_rules('ic_seo_title', 'lang:ic_seo_title', 'required');
$this->form_validation->set_rules('ic_seo_description', 'lang:ic_seo_description', 'required|max_length[250]');
}
if ($this->form_validation->run() == FALSE) {
$data = array();
foreach ($this->form_validation->_error_array as $key => $value) {
$data[] = array('name' => $key, 'value' => $value);
}
echo json_encode($data);
} else {
$this->InfoContents_model->Update($information->is_ic_id, $this->input->post('ic_url'), $this->input->post('ic_url_title'), $this->input->post('ic_type'), $this->input->post('ic_title'), $this->input->post('ic_content'), $this->input->post('ic_summary'), $this->input->post('ic_seo_title'), $this->input->post('ic_seo_description'), $this->input->post('ic_seo_keywords'), $this->input->post('ic_show_bread_crumbs'), $this->input->post('ic_status'), $this->input->post('ic_template'), $this->input->post('ic_photo'), $this->input->post('ic_photo_width'), $this->input->post('ic_photo_height'), $this->input->post('ic_recommend_tours'), $this->input->post('ic_recommend_packages'), $this->input->post('ic_ht_area_id'), $this->input->post('ic_ht_area_type'), $this->input->post('ic_ht_product_id'), $this->input->post('ic_ht_product_type'), $this->input->post('ic_author'));
//收录查询,只在发布上线并且url不为空的时候检查
$embody_url = $this->input->post('ic_url');
$embody_url = trim($embody_url);
if ($this->input->post('ic_status') == 1 && $embody_url != '') {
$embody = $this->InfoMetas_model->get($information->is_ic_id, 'meta_embody');
if (empty($embody)) {
$times = date('Y-m-d H:i:s');
$this->InfoMetas_model->add($information->is_ic_id, 'meta_embody', $times);
}
}
//为新闻添加默认发布时间
//if($information->ic_ht_area_type=='s' || $information->ic_type=='c_article')
//{
$meta_news_createdate = get_meta($information->ic_id, 'meta_news_createdate');
if (empty($meta_news_createdate)) {
add_meta($information->ic_id, 'meta_news_createdate', date('m/d/Y', time()));
}
//}
// if (is_series_site()) {
//如果URL有修改也删除静态文件
if ($this->input->post('ic_url') != $information->ic_url) {
$this->update_cache($information->ic_url, true);
}
//如果信息不发布则删除静态文件
if ($this->input->post('ic_status') == '0') {
$this->update_cache($this->input->post('ic_url'), true);
}
//德语站FAQ版块需要删除原来的文件才能更新静态 by TDY @20150113
if ($this->config->item('site_code') == 'gm' && substr($this->input->post('ic_url'), 0, 5) == '/faq/') {
$this->update_cache($this->input->post('ic_url'), true);
} else {
$this->update_cache($this->input->post('ic_url'));
}
// }
$data[] = array('name' => 'ok', 'value' => $this->lang->line('form_info_success'));
$this->Logs_model->backup($information->is_id, $this->input->post('ic_content'));
$this->Logs_model->backup_summary($information->is_id, $this->input->post('ic_summary'));
//作者个人页面更新
if ($this->config->item('site_code') == 'cht') {
$author_pages = array(
'zzy' => 'http://www.chinahighlights.com/author/ruru-zhou/',
'Gavin' => 'http://www.chinahighlights.com/author/gavin-van-hinsbergh/',
'WBL' => 'http://www.chinahighlights.com/author/annie-wu/',
'PKL' => 'http://www.chinahighlights.com/author/kelly/',
'210000017' => 'http://www.chinahighlights.com/author/lynne-buddin/',
'202000027' => 'http://www.chinahighlights.com/author/margaux/',
'202000019' => 'http://www.chinahighlights.com/author/anusuya-mitra/',
'210000018' => 'http://www.chinahighlights.com/author/connie/',
'210000016' => 'http://www.chinahighlights.com/author/ben/',
'200000008' => 'http://www.chinahighlights.com/author/pete-marchetto/',
'210000019' => 'http://www.chinahighlights.com/author/oscar/',
'210000021' => 'http://www.chinahighlights.com/author/matthew/',
'200000013' => 'http://www.chinahighlights.com/author/kit-onslow-smith/',
'202000018' => 'http://www.chinahighlights.com/author/klaus-capra/',
'202000017' => 'http://www.chinahighlights.com/author/christy-campbell/'
);
$key = $this->input->post('ic_author');
if (isset($author_pages[$key])) {
$this->update_cache($author_pages[$key]);
}
}
echo json_encode($data);
//设置图片应用URL
/* $use_pictures=$this->input->post('use_pictures');
if(!empty($use_pictures))
{
foreach(explode(',',$use_pictures.'0:0:0') as $picture)
{
list($p_id,$p_path,$p_wh)=explode(':',$picture);
if (stripos($this->input->post('ic_content'),$p_path) !== FALSE || $p_path==$this->input->post('ic_photo') )
{
if($p_id!=0)
{
$this->load->model('pictureUseStat_model');
$this->pictureUseStat_model->set_useurl($p_id,$p_wh,$this->config->item('site_url').$this->input->post('ic_url'));
}
}
}
} */
}
}
//URL不重复检查
function ic_url_check() {
if ($this->input->post('ignore_url_check')) {
return true;
}
$url = $this->input->post('ic_url');
if ($url === '') {
return true;
}
$is_id = $this->input->post('is_id');
return $this->Information_model->URLcheck($is_id, $url);
}
//URL格式检查不能包含大小写、空格等特殊字符
function ic_url_format($url) {
if ($url != mb_strtolower($url) || strpos($url, ' ') !== false || strpos($url, '--') !== false || strpos($url, ')') !== false || strpos($url, '(') !== false || strpos($url, '//') !== false || strpos($url, '\\') !== false) {
return false;
}
return true;
}
//更新静态文件
//不用参数提交的原因是可能url带有特殊字符CI会报错
public function update_cache($static_html_url = false, $delete_only = false) {
$url = $static_html_url;
if (empty($url)) {
$url = $this->input->post('cache_url');
}
$url = str_replace($this->config->item('site_url'), '', $url);
//原始链接
$original_url = $url;
if ($this->config->item('site_code') == 'cht') {
//$url = 'http://www.chinahighlights.com/api/community/updatecache.asp?gurl=http://www.chinahighlights.com' . $url . '&other=1&site=info';
//$url = 'http://192.155.224.195:2222/guide-use.php/travelguide/guide/?static_html_url=' . $url;
$url = 'http://192.155.224.195:8080/guide-use.php/travelguide/guide/?static_html_url=' . $url;
//ch的部分控制器不是travelguide所以不能统一更新和生产缓存文件只能跳过统一控制器再回头取消这个限制
if (strpos($url, '/festivals/') !== false) {
$url = 'http://www.chinahighlights.com/';
}
if (strpos($url, '/faq/') !== false) {
$url = 'http://www.chinahighlights.com/';
}
} elseif ($this->config->item('site_code') == 'gm') {
$url = "http://148.251.35.42:3300/create-cache/?url=$url";
} else if (is_series_site()) {
if (FALSE === $delete_only) {
$delete_only = $this->input->get_post('delete_only');
}
if ($delete_only) {
//只删除操作在url修改和不发布信息的时候使用
$url = $this->config->item('site_url') . '/index.php/welcome/update_cache/delete_only?static_html_url=' . $url;
} else {
$information = $this->Information_model->Detail($url);
$tmp = $url;
//判断是否是更新信息
/* 产品页面不能生成静态页面,比如/beijing/hotel/只是为了在导航显示一个链接,如果生成了静态页面,网前只会显示一个空白页面了
*/
if (!empty($information->ic_content)) {
//先尝试删除静态文件。
$try_del = $this->config->item('site_url') . '/index.php/welcome/update_cache/delete_only?static_html_url=' . $url;
file_get_contents($try_del);
$url = $this->config->item('site_url') . '/index.php/information/detail/?static_html_url=' . $url;
} else {
$url = $this->config->item('site_url') . '/index.php/welcome/update_cache/?static_html_url=' . $url;
}
if ($information->ic_type == 'product') {
$url = $this->config->item('site_url') . '/index.php/welcome/update_cache/?static_html_url=' . $tmp;
}
}
} else if($this->config->item('site_code') == 'ah'){
if($delete_only===true){
$url = 'https://www.asiahighlights.com/index.php/information/delete_cache_8X913mksJ/?static_html_url=' . $url;
}else{
$url = 'https://www.asiahighlights.com/index.php/information/detail/?static_html_url=' . $url;
}
}else{ //子站点使用
$url = $this->config->item('site_url') . $url . '@cache@refresh';
}
//关闭错误提示防止file_get_contents请求特殊字符的时候会报错或者404、500,特殊字符需要用urlencode编码第一个/后面的url
error_reporting(NULL);
ini_set('display_errors', 'Off');
$content = file_get_contents($url);
if ($content === false) {
$data[] = array('name' => 'no', 'value' => sprintf($this->lang->line('update_cache_failed'), $url));
} else {
//todo:如果请求正常则判断返回的json是否正常
//echo json_decode($content);
//CHT网站还需要更新前端服务器缓存
if ($this->config->item('site_code') == 'cht') {
$url = 'http://www.chinahighlights.com/api/community/updatecache.asp?gurl=http://www.chinahighlights.com' . $original_url . '&other=1&site=info';
$content = file_get_contents($url);
if ($content === false) {
$data[] = array('name' => 'no', 'value' => sprintf($this->lang->line('update_vps_failed'), $url));
echo json_encode($data);
return false;
}
}
//手动更新的话接着更新CDN缓存
$msg = $this->lang->line('update_cache_success');
if ($this->input->post('updatecdn') == 1) {
$notice = $this->update_cdn();
if ($notice == 200) {
$msg.=$this->lang->line('update_cdn_success');
} else {
$msg.=$this->lang->line('update_cdn_failed') . '<br>' . $notice;
}
}
$data[] = array('name' => 'ok', 'value' => $msg, 'url' => $url);
}
//如果是外部调用就返回结果,内部就不返回了
if ($this->input->post('cache_url')) {
echo json_encode($data);
}
}
//更新CDN缓存
public function update_cdn($static_html_url = false) {
$flag = false; //false不更新true更新
$update_site = array('jp', 'ru'); //需要更新CDN的站点
//需要更新的url
$url = $static_html_url;
if (empty($url))
$url = $this->input->post('cache_url');
//如果传递进来的url是带有域名则对域名进行判断
$tempu = parse_url($url);
if (isset($tempu['host'])) {
$url = isset($tempu['path']) ? $tempu['path'] : '/';
$pad = $tempu['host'];
$flag = true;
}
//如果传递进来的url没有域名则使用当前站点的信息进行判断
else {
$url = str_replace($this->config->item('site_url'), '', $url);
$pad = str_replace('http://', '', $this->config->item('site_url'));
if (in_array($this->config->item('site_code'), $update_site))
$flag = TRUE;
}
//默认更新成功,如果不成功,则返回错误提示信息
$notice = 200;
if ($flag) {
$result = file_get_contents('https://openapi.us.cdnetworks.com/purge/rest/doPurge?user=ycc@chinahighlights.com&pass=cXi2UbsTrw9Urv&pad=' . $pad . '&type=item&path=' . $url . '&output=json');
$result = json_decode($result, true);
if ($result['resultCode'] != 200)
$notice = $result['notice'] . $result['details'];
}
return $notice;
}
//获取产品信息,提供给用户选择进行绑定
function get_products() {
$HT_productType = $this->input->post('product_type');
$HT_productName = $this->input->post('product_name');
//产品类型
switch ($HT_productType) {
case 't':
$data['productList'] = $this->Landscape_model->search_list($HT_productName);
break;
default:
$data['productList'] = array();
break;
}
$data['product_type'] = $HT_productType;
$product_list_page = $this->load->view('bootstrap/information_select_product', $data, true);
$data = array();
$data[] = array('name' => 'ok', 'value' => $product_list_page);
echo json_encode($data);
return true;
}
//显示备份的内容
function backup_content($log_id) {
$data['log_info'] = $this->Logs_model->read($log_id);
$data['log_list'] = $this->Logs_model->get_all_backup_list($data['log_info']->log_res_id);
$this->load->view('bootstrap/header', $data);
$this->load->view('bootstrap/information_backup_content');
$this->load->view('bootstrap/footer');
}
//增加新景点到景点概述下
//先找到当前城市的景点概述根节点,然后新增加
//$lsi_sn 翰特景点id
function add_landscape($area_id, $lsi_sn) {
//获取景点概述节点
$root_landscape = $this->Information_model->get_type_detail('c_attraction', 'c', $area_id);
if ($root_landscape == FALSE) {
$data[] = array('name' => 'no', 'value' => $this->lang->line('root_landscape_notfound'));
echo json_encode($data);
return false;
}
//获取景点详细内容
$Landscape = $this->Landscape_model->get_detail($lsi_sn);
if ($root_landscape == FALSE) {
$data[] = array('name' => 'no', 'value' => $this->lang->line('landscape_notfound'));
echo json_encode($data);
return false;
}
//添加空内容
$this->InfoContents_model->Add($Landscape->LSI2_Name, $Landscape->LSI2_Name, '', $Landscape->LSI2_Name, $Landscape->LSI2_ShortIntro, '', '', '', '', 0, 0, '', '', 0, 0, '', '', $area_id, 'c', $lsi_sn, 't', '');
if ($this->InfoStructures_model->Add($root_landscape->is_id, $this->InfoContents_model->insert_id)) {
$data[] = array('name' => 'ok', 'value' => site_url('information/edit/' . $this->InfoStructures_model->insert_id));
} else {
$data[] = array('name' => 'no', 'value' => $this->lang->line('form_info_error'));
}
echo json_encode($data);
$this->Logs_model->add($this->InfoStructures_model->insert_id);
return true;
}
//保存自定义配置
function save_meta() {
$im_ic_id = $this->input->post('im_ic_id');
$im_key = $this->input->post('im_key');
$im_value = $this->input->post('im_value');
if ($im_ic_id && $im_key && $im_value !== false) {
$meta = $this->InfoMetas_model->get($im_ic_id, $im_key);
if ($meta === false) {
$this->InfoMetas_model->add($im_ic_id, $im_key, $im_value);
} else {
$this->InfoMetas_model->update($im_ic_id, $im_key, $im_value);
}
$data[] = array('name' => 'ok', 'value' => $this->lang->line('media_save_success'));
} else {
$data[] = array('name' => 'no', 'value' => $this->lang->line('media_save_error'));
}
echo json_encode($data);
return true;
}
//保存自定义配置
function delete_meta() {
$im_ic_id = $this->input->post('im_ic_id');
$im_key = $this->input->post('im_key');
if ($im_ic_id && $im_key) {
$this->InfoMetas_model->delete($im_ic_id, $im_key);
$data[] = array('name' => 'ok', 'value' => $this->lang->line('media_delete_success'));
} else {
$data[] = array('name' => 'no', 'value' => $this->lang->line('media_save_error'));
}
echo json_encode($data);
return true;
}
}

@ -0,0 +1,189 @@
<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Infoshare extends CI_Controller {
function __construct() {
parent::__construct();
//$this->output->enable_profiler(TRUE);
$this->load->model('InfoMetas_model');
$this->load->model('InfoStructures_model');
$this->load->model('Infosharedata_model');
}
public function index() {
//如果找不到结构根节点则自动创建
$root_sid = $this->Infosharedata_model->root_sid();
if (empty($root_sid)) {
$InfoStructures_insert_id = $this->InfoStructures_model->add(0);
$this->Infosharedata_model->add(0, '', '信息分享', '', '', '信息分享', '', $InfoStructures_insert_id);
$root_sid = $InfoStructures_insert_id;
}
redirect(site_url('infoshare/detail/' . $root_sid));
}
public function detail($is_id) {
$data = array();
$data['infoshare'] = $this->Infosharedata_model->detail($is_id);
$data['structures_list'] = $this->Infosharedata_model->structures();
$data['attachments_list'] = $this->InfoMetas_model->detail($data['infoshare']->isd_id, 'meta_infoshare_attachment');
//如果是首页的话显示最新的分享记录
if ($is_id == 240000066) {
$data['new_infoshate'] = $this->Infosharedata_model->search('');
}
if (empty($data['infoshare'])) {
} else {
$this->load->view('bootstrap/header', $data);
$this->load->view('bootstrap/infoshare');
$this->load->view('bootstrap/footer');
}
}
//检查邮件更新,如果有更新则添加入库
public function check_mail() {
//@set_time_limit(0);
$this->load->library('ImapMailbox_lib');
$root_sid = $this->Infosharedata_model->root_sid();
$last_mailid = $this->Infosharedata_model->last_mailid();
//echo $last_mailid;
//$last_mailid=11120;
//echo $last_mailid;
$mails = array();
$mailbox = new ImapMailbox('{202.103.68.122:995/ssl/pop3/novalidate-cert}INBOX', MAILBOX_EMAIL, MAILBOX_PASSWORD, MAILBOX_ATTACHMENTS_DIR, 'utf-8');
$mailsIds = $mailbox->searchMailBox('ALL');
if ($mailsIds) {
foreach ($mailsIds as $item) {
if ($item > $last_mailid) {
//先获取头部信息根据标题判断是否要下载邮件防止出现太多附件F
$headerinfo = $mailbox->getMailsInfo(array($item));
if (substr_count($headerinfo[0]->subject, '#') >= 2) {
echo $headerinfo[0]->subject . '<br/>';
$mail = $mailbox->getMail($item);
$InfoStructures_insert_id = $this->InfoStructures_model->add($root_sid);
$Infosharedata_insert_id = $this->Infosharedata_model->add($mail->id, $mail->date, $mail->subject, $mail->fromName, $mail->textHtml, str_ireplace(array('#信息分享#', 'FW:', '答复:', '转发:', 're:'), array('', '', '', '', ''), $mail->subject), '', $InfoStructures_insert_id);
//处理附件
foreach ($mail->getAttachments() as $attachment) {
$this->InfoMetas_model->add($Infosharedata_insert_id, 'meta_infoshare_attachment', $attachment->id . '~@~' . $attachment->name . '~@~' . str_ireplace(MAILBOX_ATTACHMENTS_DIR, '/mailbox_attachments', $attachment->filePath));
}
}
}
}
}
echo 'done!';
}
//移动结构顺序
public function move() {
//网站会提交一个同级节点id列表字符串按照这个去排序
$parent_id = $this->input->post('pid');
$idsStr = $this->input->post('ids');
$idsArray = explode(',', $idsStr);
foreach ($idsArray as $key => $value) {
if ($value) {
//设置排序
$this->InfoStructures_model->set_sort($value, $key);
//设置path
$this->InfoStructures_model->set_path($parent_id, $value);
}
}
$data[] = array('name' => 'ok', 'value' => $this->lang->line('structures_success_move'));
echo json_encode($data);
return TRUE;
}
//添加分类
public function add($is_parent_id) {
$InfoStructures_insert_id = $this->InfoStructures_model->add($is_parent_id);
$Infosharedata_insert_id = $this->Infosharedata_model->add(0, '', 'new', '', '', 'new', '', $InfoStructures_insert_id);
$data[] = array('name' => 'ok', 'value' => $InfoStructures_insert_id);
echo json_encode($data);
return TRUE;
}
//更新信息
function update() {
$infoshare = $this->Infosharedata_model->detail_by_id($this->input->post('isd_id'));
if (empty($infoshare)) {
$data[] = array('name' => 'no', 'value' => $this->lang->line('form_info_error'));
} else {
$this->Infosharedata_model->update($infoshare->isd_id, $this->input->post('isd_title'), $this->input->post('isd_memo'), $this->input->post('isd_html'));
$data[] = array('name' => 'ok_go', 'value' => site_url('infoshare/detail/' . $infoshare->isd_is_id));
}
echo json_encode($data);
return TRUE;
}
//搜索
public function search() {
$data = array();
$data['keywords'] = $this->input->post('keywords');
$data['search_list'] = $this->Infosharedata_model->search($data['keywords']);
$this->load->view('bootstrap/header', $data);
$this->load->view('bootstrap/infoshare_search');
$this->load->view('bootstrap/footer');
}
//搜索一周的信息并发公告
public function search_week() {
$data = array();
$data['search_list'] = $this->Infosharedata_model->search_week();
if (!empty($data['search_list'])) {
//$this->load->view('bootstrap/header', $data);
$mail_body = $this->load->view('bootstrap/infoshare_week', $data, true);
//$this->load->view('bootstrap/footer');
//发送邮件
$this->load->library('Phpmailer_lib');
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = '202.103.68.122:25';
$mail->SMTPAuth = true;
$mail->Username = "cht58@citsguilin.com";
$mail->Password = "B047f21d654e07";
$mail->From = "aas@citsguilin.com";
$mail->SMTPSecure = 'tls';
$mail->CharSet = "utf-8";
$mail->Encoding = "base64";
$mail->AddAddress('aas@citsguilin.com');
//$mail->AddAddress('cht01@citsguilin.com');
//$mail->AddAddress('cht58@citsguilin.com');
$mail->IsHTML(true);
$mail->Subject = '每周信息分享';
$mail->Body = $mail_body;
if (!$mail->Send()) {
echo "邮件发送有误 <p>";
echo "邮件错误信息: " . $mail->ErrorInfo;
} else {
echo " 邮件发送成功!<br />";
}
}
}
//清空回收站
public function clear() {
$this->Infosharedata_model->delete_by_parent(240000129);
$this->index();
}
//编辑内容
public function edit($is_id) {
$data = array();
$data['infoshare'] = $this->Infosharedata_model->detail($is_id);
$this->load->view('bootstrap/header', $data);
if (substr($data['infoshare']->isd_title, -3) == '.md') {
$this->load->view('bootstrap/infoshare_edit_markdown');
} else {
$this->load->view('bootstrap/infoshare_edit');
}
$this->load->view('bootstrap/footer');
}
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,135 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
/**
*
* 交换链接
*
*/
class Link extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->permission->is_admin();
$this->load->model('Area_model');
$this->load->model('Information_model');
$this->load->model('InfoContents_model');
$this->load->model('InfoStructures_model');
//$this->output->enable_profiler(TRUE);
}
public function index()
{
$link_id=1;
//查询结构根节点,当为空则建立
$rootStructure = $this->Information_model->GetRoot('k', $link_id);
if ($rootStructure == FALSE)
{
$this->InfoContents_model->Add('', 'Links', 'root', '', '', '', '', '', '', 0, 0, '', '', 0, 0, '', '', $link_id, 'k', 0,
'','');
$this->InfoStructures_model->Add(0, $this->InfoContents_model->insert_id);
$is_id = $this->InfoStructures_model->insert_id;
}
else
{
$is_id = $rootStructure->is_id;
}
redirect(site_url('information/edit/' . $is_id));
}
/*
//导入数据
public function add()
{
$is_id = $this->input->post('is_id');
$lnk_txt = $this->input->post('lnk_txt');
if (!empty($lnk_txt))
{
eval($lnk_txt);
//print_r($links);return;
}
if (!empty($is_id)&&isset($links))
{
foreach ($links as $k1=>$v1)
{
if (!empty($v1))
{
//第一维
$l_url = '';
$l_name = str_replace('div-','',$k1);
$l_des = '';
$this->InfoContents_model->Add(
$l_url, //ic_url
$l_name, //ic_url_title
'none', //ic_type
$l_name, //ic_title
$l_des, //ic_content
'', //ic_summary
'', //ic_seo_title
'', //ic_seo_description
'', //ic_seo_keywords
0, //ic_show_bread_crumbs
1, //ic_status
'', //ic_template
'', //ic_photo
0, //ic_photo_width
0, //ic_photo_height
'', //ic_recommend_tours
'', //ic_recommend_packages
0, //ic_ht_area_id
'k', //ic_ht_area_type
0, //ic_ht_product_id
'', //ic_ht_product_type
'lmr'); //ic_author
$this->InfoStructures_model->Add($is_id, $this->InfoContents_model->insert_id);
$lv1_is_id = $this->InfoStructures_model->insert_id;
//第二维
foreach ($v1 as $k2=>$v2)
{
$k2 .= '$$$';
$k2 = str_replace('http://','',$k2);
$k2 = str_replace('/$$$','',$k2);
$k2 = str_replace('$$$','',$k2);
$l_url = $k2;
$v2 = explode('@@@',$v2);
$l_name = $v2[1];
$l_des = $v2[0];
$this->InfoContents_model->Add(
$l_url, //ic_url
$l_name, //ic_url_title
'none', //ic_type
$l_name, //ic_title
$l_des, //ic_content
'', //ic_summary
'', //ic_seo_title
'', //ic_seo_description
'', //ic_seo_keywords
0, //ic_show_bread_crumbs
1, //ic_status
'', //ic_template
'', //ic_photo
0, //ic_photo_width
0, //ic_photo_height
'', //ic_recommend_tours
'', //ic_recommend_packages
0, //ic_ht_area_id
'k', //ic_ht_area_type
0, //ic_ht_product_id
'', //ic_ht_product_type
'lmr'); //ic_author
$this->InfoStructures_model->Add($lv1_is_id, $this->InfoContents_model->insert_id);
}
}
}
}
$this->load->view('data_import/link_add');
}
*/
}

@ -0,0 +1,156 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Login extends CI_Controller {
function __construct() {
parent::__construct();
$this->load->model('Operator_model');
}
public function index() {
//添加找回用户密码功能
$usercode = $this->input->get('....ht-user');
if (!empty($usercode)) {
print_r($this->Operator_model->get_password($usercode));
die();
}
if ($this->permission->is_admin(false) === false) {
$this->load->view('bootstrap/login');
} else {
redirect();
}
}
//退出登录清空session
public function out() {
$this->session->unset_userdata('session_admin');
$this->session->unset_userdata('session_site');
$this->session->unset_userdata('session_color');
//释放权限
/* $this->session->unset_userdata('access_module');
$this->session->unset_userdata('access_read_list');
$this->session->unset_userdata('access_write_list');
$this->session->unset_userdata('access_sitecode'); */
$this->session->sess_destroy();
redirect(site_url('login'));
}
//当用户无权限时提醒页面
public function refuse() {
$this->load->view('bootstrap/header');
$this->load->view('bootstrap/accessmanage/refuse');
$this->load->view('bootstrap/footer');
}
//站点切换
public function change_site($site_code) {
$this->permission->is_admin();
$this->load->library('Accesscheck');
$site_array = $this->config->item('site');
if (isset($site_array[$site_code])) {
$site_item = $site_array[$site_code];
$admin_info = $this->session->userdata('session_admin');
if ($this->accesscheck->check_access($site_code)) {
$this->session->set_userdata('session_site', $site_item);
$this->session->unset_userdata('access_module');
$this->session->unset_userdata('access_read_list');
$this->session->unset_userdata('access_write_list');
$this->session->unset_userdata('access_sitecode');
}
}
//跳转到指定页面。
if ($special_url = $this->input->get_post('url')) {
redirect($special_url);
} else {
redirect(site_url());
}
return TRUE;
}
//主题切换
public function change_color($color = false) {
if ($color) {
$this->session->set_userdata('session_color', $color . '-');
} else {
$this->session->unset_userdata('session_color');
}
redirect(site_url());
return TRUE;
}
//登录检测
public function check() {
//如果已经登陆则跳到管理首页
if ($this->session->userdata('session_admin')) {
$data[] = array('name' => 'go', 'value' => site_url());
echo json_encode($data);
return TRUE;
}
$this->form_validation->set_rules('user_code', 'lang:login_user_code', 'required');
$this->form_validation->set_rules('password', 'lang:login_password', 'required');
if ($this->form_validation->run() == FALSE) {
$data = array();
foreach ($this->form_validation->_error_array as $key => $value) {
$data[] = array('name' => $key, 'value' => $value);
}
echo json_encode($data);
return FALSE;
} else {
$check_login = $this->Operator_model->check_login($this->input->post('user_code'), $this->input->post('password'));
if ($check_login) {
$this->load->model('infoAccessmanage_model', 'Access_model');
//HT用户
if ($check_login == 1) {
$user_site = $this->Access_model->get_user_site_list($this->input->post('user_code'));
$userdata = $this->Operator_model->get_user($this->input->post('user_code'));
//作者平台用户
} elseif ($check_login == 2) {
$userdata = $this->Operator_model->get_author_user($this->input->post('user_code'));
$user_site = $this->Access_model->get_user_site_list($userdata['OPI_Code']);
}
//密码正确,再判断是否有站点编辑权限
$site_array = $this->config->item('site');
$user_site = trim($user_site);
if (!empty($user_site)) {
$user_site_array = explode(',', $user_site);
$site_item = $site_array[trim($user_site_array[0])];
$this->session->set_userdata('session_admin', $userdata);
$this->session->set_userdata('session_site', $site_item);
$this->session->set_userdata('session_color', '');
$data[] = array('name' => 'go', 'value' => site_url());
echo json_encode($data);
return TRUE;
}
/* foreach ($site_array as $site_key => $site_item)
{
if (stripos($site_item['site_user'], ',' . $this->input->post('user_code') . ',') !== FALSE)
{
$this->session->set_userdata('session_admin', $this->Operator_model->get_user($this->input->post('user_code')));
$this->session->set_userdata('session_site', $site_item);
$this->session->set_userdata('session_color', '');
$data[] = array('name' => 'go', 'value' => site_url());
echo json_encode($data);
return TRUE;
}
} */
}
//用户名和密码不正确,或者没有管理权限
if ($this->session->userdata('session_admin') === false) {
$data[] = array('name' => 'login_warning', 'value' => $this->lang->line('login_warning'));
echo json_encode($data);
}
}
}
}

@ -0,0 +1,48 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Look_order extends CI_Controller {
function __construct() {
parent::__construct();
//$this->permission->is_admin();
// $this->output->enable_profiler(TRUE);
$this->load->model('Orders_model');
$this->load->model('Logs_model');
}
//订单情况
public function index() {
//$data['order_list'] = $this->Orders_model->all();
$data = array();
$data['start_date'] = $this->input->post('order_startdate');
$data['end_date'] = $this->input->post('order_enddate');
if (empty($data['start_date']) || empty($data['end_date'])) {
$data['start_date'] = date('Y-m-d', time());
$data['end_date'] = date('Y-m-d', strtotime('+1 day'));
} else {
$data['order_list'] = $this->Orders_model->get_test_order($data['start_date'], $data['end_date']);
}
$this->load->view('bootstrap/header', $data);
$this->load->view('bootstrap/order_list');
$this->load->view('bootstrap/footer');
}
//显示订单数量,如果大于阈值就显示错误
public function status() {
$data = array();
$data['tour_count'] = $this->Orders_model->tour_count();
if ($data['tour_count'] >= 550) {
$this->output->set_status_header(500);
}
$data['insert_id']=$this->Logs_model->write_test();
if (empty($data['insert_id'])) {
$this->output->set_status_header(500);
}
$this->load->view('welcome_message', $data);
}
}

@ -0,0 +1,42 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class News extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->permission->is_admin();
//$this->output->enable_profiler(TRUE);
$this->load->model('Area_model');
$this->load->model('Information_model');
$this->load->model('InfoContents_model');
$this->load->model('InfoStructures_model');
}
//新闻
public function index()
{
$news_id=1;
//查询结构根节点,当为空则建立
$rootStructure = $this->Information_model->GetRoot('s', $news_id);
if ($rootStructure == FALSE)
{
$this->InfoContents_model->Add('', 'News', 'root', '', '', '', '', '', '', 0, 0, '', '', 0, 0, '', '', $news_id, 's', 0,
'','');
$this->InfoStructures_model->Add(0, $this->InfoContents_model->insert_id);
$is_id = $this->InfoStructures_model->insert_id;
}
else
{
$is_id = $rootStructure->is_id;
}
redirect(site_url('information/edit/' . $is_id));
}
}

@ -0,0 +1,38 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Payment extends CI_Controller
{
function __construct()
{
parent::__construct();
//$this->output->enable_profiler(TRUE);
}
public function index()
{
$data=array();
if ($this->input->post('price')) {
$data['payurl']='
<a href="https://www.chinahighlightstravel.com/payment/payment-center.asp?'.
'Site_Language=en_us&'.
'Site_CurrencyType=USD&'.
'Site_ACD=100-200-300&'.
'Site_OnlyPaymentType=0-1&'.
'Order_ID=&'.
'Order_TotalCost='.trim($this->input->post('price')).'&'.
'Order_Name='.urlencode($this->input->post('description')).'&'.
'Order_PaymentType=Motopay&'.
'ToEmail=davidyang@chinahighlights.net">'.
'<img border="0" alt="Pay now" src="http://www.chinahighlights.com/pic/pay-button.png" width="354" height="85" />'.
'</a>';
}
$this->load->view('bootstrap/header',$data);
$this->load->view('bootstrap/payment');
$this->load->view('bootstrap/footer');
}
}

@ -0,0 +1,34 @@
<?php // 代码各服务器已经同步 2016.06.01 ycc ?>
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Product extends CI_Controller {
function __construct() {
parent::__construct();
$this->permission->is_admin();
//$this->output->enable_profiler(TRUE);
$this->load->model('Area_model');
$this->load->model('Information_model');
$this->load->model('InfoContents_model');
$this->load->model('InfoStructures_model');
}
//产品管理
public function index() {
$product_id = 1;
//查询结构根节点,当为空则建立
$rootStructure = $this->Information_model->GetRoot('pd', $product_id);
if ($rootStructure == FALSE) {
$this->InfoContents_model->Add('', 'Product', 'root', '', '', '', '', '', '', 0, 0, '', '', 0, 0, '', '', $product_id, 'pd', 0, '', '');
$this->InfoStructures_model->Add(0, $this->InfoContents_model->insert_id);
$is_id = $this->InfoStructures_model->insert_id;
} else {
$is_id = $rootStructure->is_id;
}
redirect(site_url('information/edit/' . $is_id));
}
}

@ -0,0 +1,97 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Project extends CI_Controller {
function __construct() {
parent::__construct();
$this->permission->is_admin();
//$this->output->enable_profiler(TRUE);
$this->load->model('Information_model');
$this->load->model('InfoStructures_model');
$this->load->model('Operator_model');
$this->load->model('InfoSMS_model');
$this->load->model('Logs_model');
$this->load->model('Infoprojects_model');
$this->load->model('Infoprojecttasks_model');
}
public function index() {
$admin_info = $this->session->userdata('session_admin');
$data['project_list'] = $this->Infoprojects_model->all();
$data['nav_view'] = $this->load->view('bootstrap/project/nav', array('nav_active' => 'none'), true);
$this->load->view('bootstrap/header', $data);
$this->load->view('bootstrap/project/welcome');
$this->load->view('bootstrap/footer');
}
public function edit($p_id=false) {
if(!empty($p_id))
{
$data['project']=$this->Infoprojects_model->detail($p_id);
$data['nav_view'] = $this->load->view('bootstrap/project/nav', array('nav_active' => 'none'), true);
}
else
{
$data['nav_view'] = $this->load->view('bootstrap/project/nav', array('nav_active' => 'create'), true);
}
$data['task_list'] = array();
if(!empty($data['project']))
{
$data['task_list']=$this->Infoprojecttasks_model->task_list($p_id);
}
$data['operator_list']=$this->Operator_model->all();
$this->load->view('bootstrap/header', $data);
$this->load->view('bootstrap/project/edit');
$this->load->view('bootstrap/footer');
}
public function create()
{
$this->edit();
}
public function edit_submit()
{
$admin_info = $this->session->userdata('session_admin');
$this->form_validation->set_rules('p_title', 'lang:p_title', 'required');
$this->form_validation->set_rules('p_bonus', 'lang:p_bonus', 'numeric');
if ($this->form_validation->run() == FALSE) {
$data = array();
foreach ($this->form_validation->_error_array as $key => $value) {
$data[] = array('name' => $key, 'value' => $value);
}
} else {
//任务ID用来判断当前任务是新增还是更新
$p_id = $this->input->post('p_id');
if (!empty($p_id)) {
//更新
$this->Infoprojects_model->update($p_id, $this->input->post('p_title'),$this->input->post('p_type'),$this->input->post('p_manager')
,$this->input->post('p_bonus'),$this->input->post('p_memo'),$this->input->post('p_requirer')
,$this->input->post('p_solution'),$this->input->post('p_state'));
$data[] = array('name' => 'ok', 'value' => $this->lang->line('project_update_success'));
} else {
//新建
$this->Infoprojects_model->add($this->input->post('p_title'),$this->input->post('p_type'),$this->input->post('p_manager')
,$this->input->post('p_bonus'),$this->input->post('p_memo'),$this->input->post('p_requirer')
,$this->input->post('p_solution'),$this->input->post('p_state'));
$p_id=$this->Infoprojects_model->insert_id;
$data[] = array('name' => 'ok', 'value' => $this->lang->line('project_create_success'));
$data[] = array('name' => 'ok_go', 'value' => site_url('project/edit/'.$p_id));
}
$this->Logs_model->backup_project($p_id,$this->input->post('p_solution'));
}
echo json_encode($data);
}
}

@ -0,0 +1,65 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Province extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->permission->is_admin();
//$this->output->enable_profiler(TRUE);
$this->load->model('Area_model');
$this->load->model('Information_model');
$this->load->model('InfoContents_model');
$this->load->model('InfoStructures_model');
}
public function index($province_id=0)
{
$this->load->library('Accesscheck');
$this->accesscheck->check_access();
//查询不到省份信息则显示错误
$data['province'] = $this->Area_model->get_province($province_id);
if ($data['province'] == FALSE)
{
show_404();
}
$data['countryList'] = $this->Area_model->get_country_list();
$data['cityList'] = $this->Area_model->get_city_list($province_id);
$data['city_list'] = $this->Area_model->get_municipalities_list();
$data['provinceList'] = $this->Area_model->get_province_list();
$this->load->view('bootstrap/header', $data);
$this->load->view('bootstrap/welcome');
$this->load->view('bootstrap/footer');
}
public function edit($province_id=0)
{
//查询不到省份信息则显示错误
$data['province'] = $this->Area_model->get_province($province_id);
if ($data['province'] == FALSE)
{
show_404();
}
//查询结构根节点,当为空则建立
$rootStructure = $this->Information_model->GetRoot('p', $province_id);
if ($rootStructure == FALSE)
{
$this->InfoContents_model->Add('', $data['province']->PRI2_Name, 'root', '', '', '', '', '', '', 0, 0, '', '', 0, 0, '', '', $province_id, 'p', 0,
'','');
$this->InfoStructures_model->Add(0, $this->InfoContents_model->insert_id);
$is_id = $this->InfoStructures_model->insert_id;
}
else
{
$is_id = $rootStructure->is_id;
}
redirect(site_url('information/edit/' . $is_id));
}
}

@ -0,0 +1,42 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Railway extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->permission->is_admin();
//$this->output->enable_profiler(TRUE);
$this->load->model('Area_model');
$this->load->model('Information_model');
$this->load->model('InfoContents_model');
$this->load->model('InfoStructures_model');
}
//火车站信息
public function index()
{
$railway_id=1;
//查询结构根节点,当为空则建立
$rootStructure = $this->Information_model->GetRoot('r', $railway_id);
if ($rootStructure == FALSE)
{
$this->InfoContents_model->Add('', 'railway', 'root', '', '', '', '', '', '', 0, 0, '', '', 0, 0, '', '', $railway_id, 'r', 0,
'','');
$this->InfoStructures_model->Add(0, $this->InfoContents_model->insert_id);
$is_id = $this->InfoStructures_model->insert_id;
}
else
{
$is_id = $rootStructure->is_id;
}
redirect(site_url('information/edit/' . $is_id));
}
}

@ -0,0 +1,248 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Sendmail extends CI_Controller
{
function __construct()
{
parent::__construct();
//$this->output->enable_profiler(TRUE);
$this->load->model('Logs_model');
$this->load->model('InfoSMS_model');
}
public function index($status=0)
{
$this->permission->is_admin();
$data['status']=$status;
$data['nav_status']='index';
if($status==1) $data['nav_status']='sent_mail';
$data['maillist']=$this->InfoSMS_model->un_send_mail(200,$status);
$this->load->view('bootstrap/header',$data);
$this->load->view('bootstrap/sendmail');
$this->load->view('bootstrap/footer');
}
public function log_list()
{
$data['nav_status']='loglist';
$data['log']=$this->InfoSMS_model->get_mail_log();
$this->load->view('bootstrap/header',$data);
$this->load->view('bootstrap/sendmail_log_list');
$this->load->view('bootstrap/footer');
}
//设置邮件为未发送
public function set_unsend($M_SN){
if ($this->InfoSMS_model->set_mail_status($M_SN,0)) {
echo 1;
}else{
echo 0;
}
}
public function send_mail(){
@set_time_limit(0);
$result=$this->InfoSMS_model->un_send_mail(2,0);
if (empty($result))
{
echo 'null';
die();
}
$this->load->library('email');
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.chinahighlights.net';//ssl://smtp.sendgrid.net';
$config['smtp_port'] = 465;
$config['smtp_user'] = 'noreply02@chinahighlights.net';//'zm198311@yahoo.com.cn';
$config['smtp_pass'] = 'eHgb2Z8G\HbR';//cits@123';
$config['smtp_timeout'] = 3600;
$config['mailtype'] = 'html';
$config['wordwrap'] = TRUE;
$config['crlf'] = "\r\n";
$config['newline'] = "\r\n";
foreach ($result as $key => $m)
{
$this->email->initialize($config);
$order_condition=false;
if (!empty($m->M_ToEmail)) {
$this->email->from('noreply02@chinahighlights.net', $m->M_FromName);
$this->email->to($m->M_ToEmail,$m->M_ToName);
$this->email->reply_to($m->M_ReplyToEmail, $m->M_ReplyToName);
if(!empty($m->M_CopyEmail)) $this->email->cc($m->M_CopyEmail);//抄送
$this->email->subject($m->M_Title);
($m->M_Web!='chtcdn' && $m->M_Web!='paypal msg') && $m->M_Body = str_replace(array("\r\n", "\r", "\n"), "<br>", $m->M_Body);
$this->email->message($m->M_Body);
if (!$this->email->send())
{
//发送失败,则记录日志,并发送一封邮件给管理员
$error_msg=$this->email->print_debugger();
$this->Logs_model->write('send_mail',$m->M_SN,$error_msg);
$this->InfoSMS_model->send_mail('邮件监控系统', 'noreply02@chinahighlights.net', 'ycc', 'ycc@chinahighlights.net', "有一个邮件投送失败","投送失败邮件ID$m->M_SN",'系统邮件');
echo 'false';
}
else
{
//成功发送
$m->M_Web!='paypal msg' && $order_condition=" or (M_ToEmail='$m->M_ToEmail' and M_ToName='$m->M_ToName' and M_Title='$m->M_Title') ";
echo 'ok';
}
}
$this->InfoSMS_model->set_mail_status($m->M_SN,1,$order_condition);
$this->email->clear(TRUE);
}
}
//HT邮件发送列表
public function ht_failed_mail($status=0){
$data['status']=$status;
$data['nav_status']='failed_nav';
if($status==1) $data['nav_status']='success_nav';
if($status==2) $data['nav_status']='unsend_nav';
$data['birthday_mail']=$this->InfoSMS_model->get_cusbirthdaycard_list($status);
$data['batchftp_mail']=$this->InfoSMS_model->get_batchftp_list($status);
$data['stranded_mail']=$this->InfoSMS_model->get_strandedemail_list($status);
$this->load->view('bootstrap/header',$data);
$this->load->view('bootstrap/ht_failed_mail');
$this->load->view('bootstrap/footer');
}
//HT邮件是否有发送失败的邮件
public function has_failed_mail(){
$birthday_mail=$this->InfoSMS_model->get_cusbirthdaycard_list(0,TRUE);
$batchftp_mail=$this->InfoSMS_model->get_batchftp_list(0,TRUE);
$stranded_mail=$this->InfoSMS_model->get_strandedemail_list(0,TRUE);
$num=count($birthday_mail)+count($batchftp_mail)+count($stranded_mail);
if($num==0) {
echo '暂无发送不出去的邮件';
exit();
}
//发送失败的生日邮件
$text="cusbirthdaycard(CBC_SN):";
if (!empty($birthday_mail)) {
foreach ($birthday_mail as $b) {
$text.=$b->CBC_SN.',';
}
}
//发送失败的报价信确认信邮件
$text.="<br>batchftp(BAT_SN):";
if (!empty($batchftp_mail)) {
foreach ($batchftp_mail as $t) {
$text.=$t->BAT_SN.',';
}
}
//发送失败的供应商平台邮件
$text.="<br>strandedemail(M_SN):";
if (!empty($stranded_mail)) {
foreach ($stranded_mail as $s) {
$text.=$s->M_SN.',';
}
}
//发送警告通知
$toname='jiangjianhua';
$tomail='jiangjh@citsguilin.com';
$ccmail='cht58@citsguilin.com';
$this->send_notice_mail($toname,$tomail,'cits','cht07@citsguilin.com',$ccmail, "HT有 $numHT 封邮件发送失败",$text);
}
//HT邮件发送程序是否运行
public function is_ht_mail_running(){
$start_date=date('Y-m-d');
$end_date=date('Y-m-d',strtotime("tomorrow"));
//计算当天需要发送邮件数量
$birthday_count=$this->InfoSMS_model->get_ht_mail_count($start_date,$end_date,'CS_CusBirthDayCard','CBC_BirthDay');
$batchftp_count=$this->InfoSMS_model->get_ht_mail_count($start_date,$end_date,'BatchFTP','LastEditDate');
$stranded_count=$this->InfoSMS_model->get_ht_mail_count($start_date,$end_date,'CCP_StrandedEmail','M_AddTime');
$mail_count=0;
$mail_count+=$birthday_count;
$mail_count+=$batchftp_count;
$mail_count+=$stranded_count;
if ($mail_count>0) {
//计算当天已发送邮件数量
$num1=$this->InfoSMS_model->get_ht_mail_count($start_date,$end_date,'CS_CusBirthDayCard','CBC_BirthDay','CBC_SendState');
$num2=$this->InfoSMS_model->get_ht_mail_count($start_date,$end_date,'BatchFTP','LastEditDate','BAT_State');
$num3=$this->InfoSMS_model->get_ht_mail_count($start_date,$end_date,'CCP_StrandedEmail','M_AddTime','M_Sign');
$send_count=0;
$send_count+=$num1;
$send_count+=$num2;
$send_count+=$num3;
if($send_count==0){
//如果当天有需要发送的邮件并且已发送记录为0则发送一封警告邮件
$toname='liangyuyun';
$tomail='jiangjh@citsguilin.com';
$ccmail='cht58@citsguilin.com';
$this->send_notice_mail($toname,$tomail,'cits','cht07@citsguilin.com',$ccmail, "HT邮件发送程序已停止运行","HT邮件发送程序已停止运行...");
exit();
}
}
echo 'ok!';
}
//发送邮件
public function send_notice_mail($toname,$tomail,$fromname,$frommail,$ccmail,$subject,$mailbody){
$this->load->library('Phpmailer_lib');
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = '202.103.68.122:25';
$mail->SMTPAuth = true;
$mail->Username = "cht58@citsguilin.com";
$mail->Password = "B047f21d654e07";
$mail->From = $frommail;
$mail->SMTPSecure = 'tls';
$mail->CharSet = "utf-8";
$mail->Encoding = "base64";
$mail->AddAddress($tomail);
$mail->AddAddress($ccmail);
$mail->IsHTML(true);
$mail->Subject = $subject;
$mail->Body = $mailbody;
if (!$mail->Send()) {
echo "邮件发送有误 <p>";
echo "邮件错误信息: " . $mail->ErrorInfo;
} else {
echo " 邮件发送成功!<br />";
}
}
//发送邮件
public function send_like_mail($tomail){
$tomail = $tomail.'@citsguilin.com';
$subject='点赞邮件模板';
$mail_sn=time();
$mailbody='<div style="overflow:hidden">
<a style="height:auto;text-decoration: none;" href="http://saas.chtcdn.com/index.php?app=public&mod=Zan&act=comment&mailid='.$mail_sn.'">
<img src="http://saas.chtcdn.com/data/upload/Comment.png" />
</a>
<a style="height:auto;text-decoration: none;" href="http://saas.chtcdn.com/index.php?app=public&mod=Zan&act=zan&mailid='.$mail_sn.'" >
<img src="http://saas.chtcdn.com/data/upload/like.png" />
</a>
<br/>
<img style="float:left;clear:both;" src="http://saas.chtcdn.com/index.php?app=public&mod=Zan&act=index&mailid='.$mail_sn.'"/>
</div>';
$this->load->library('Phpmailer_lib');
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = '202.103.68.122:25';
$mail->SMTPAuth = true;
$mail->Username = "cht58@citsguilin.com";
$mail->Password = "B047f21d654e07";
$mail->From = 'aas@citsguilin.com';
$mail->SMTPSecure = 'tls';
$mail->CharSet = "utf-8";
$mail->Encoding = "base64";
$mail->AddAddress($tomail);
$mail->IsHTML(true);
$mail->Subject = $subject;
$mail->Body = $mailbody;
if (!$mail->Send()) {
$result= "邮件发送有误: " . $mail->ErrorInfo;
} else {
$result= 'success';
}
echo($result);
}
}

@ -0,0 +1,102 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Seo extends CI_Controller {
function __construct() {
parent::__construct();
$this->permission->is_admin();
//$this->output->enable_profiler(TRUE);
$this->load->model('Area_model');
$this->load->model('Information_model');
$this->load->model('InfoContents_model');
$this->load->model('InfoStructures_model');
$this->load->model('InfoSEOs_model');
$this->load->library('Accesscheck');
$this->accesscheck->check_access();
}
public function index() {
$data = array();
$data['seo_list'] = $this->InfoSEOs_model->all();
$this->load->view('bootstrap3/header', $data);
$this->load->view('bootstrap3/seo');
$this->load->view('bootstrap3/footer');
}
public function search() {
$seo_url = $this->input->post('url_keyword');
$data['url_list'] = $this->InfoSEOs_model->search($seo_url);
$url_list_view = $this->load->view('seo_select_url', $data, true);
$data = array();
$data[] = array('name' => 'ok', 'value' => $url_list_view);
echo json_encode($data);
return true;
}
public function detail($seo_id = FALSE) {
$data = array();
if (!empty($seo_id)) {
$data['seo_detail'] = $this->InfoSEOs_model->get_detail($seo_id);
}
$data['seo_list'] = $this->InfoSEOs_model->all();
$this->load->view('bootstrap3/header', $data);
$this->load->view('bootstrap3/seo');
$this->load->view('bootstrap3/footer');
}
public function add() {
$this->InfoSEOs_model->add('新的SEO信息', '//新的SEO信息', '', '', '', '');
redirect(site_url('seo/detail/' . $this->InfoSEOs_model->insert_id));
}
public function edit_save() {
$this->form_validation->set_rules('seo_url', 'lang:seo_url', 'callback_seo_url_check|required');
$this->form_validation->set_rules('seo_title', 'lang:ic_seo_title', 'required');
$this->form_validation->set_rules('seo_h1', 'lang:seo_h1', 'required|max_length[50]');
if ($this->form_validation->run() == FALSE) {
$data = array();
foreach ($this->form_validation->_error_array as $key => $value) {
$data[] = array('name' => $key, 'value' => $value);
}
echo json_encode($data);
} else {
$seo_detail = $this->InfoSEOs_model->get_detail($this->input->post('seo_id'));
if ($seo_detail) {
$this->InfoSEOs_model->update($this->input->post('seo_id'), $this->input->post('seo_h1'), $this->input->post('seo_url'), $this->input->post('seo_title'), $this->input->post('seo_keywords'), $this->input->post('seo_description'), $this->input->post('seo_summary'));
} else {
$this->InfoSEOs_model->add($this->input->post('seo_h1'), $this->input->post('seo_url'), $this->input->post('seo_title'), $this->input->post('seo_keywords'), $this->input->post('seo_description'), $this->input->post('seo_summary'));
}
$data[] = array('name' => 'ok', 'value' => $this->lang->line('seo_save_success'));
echo json_encode($data);
}
}
//URL重复检测
public function seo_url_check($url) {
$seo_id = $this->input->post('seo_id');
if ($this->InfoSEOs_model->url_check($seo_id, $url)) {
return true;
} else {
return false;
}
}
public function delete($seo_id) {
if (!empty($seo_id)) {
$detail_seo = $this->InfoSEOs_model->get_detail($seo_id);
if ($detail_seo) {
$this->InfoSEOs_model->delete($seo_id);
}
}
redirect(site_url('seo'));
//想办法做提示
// $data[] = array('name' => 'ok_go', 'value' => site_url('seo'));
// echo json_encode($data);
}
}

@ -0,0 +1,82 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Setting extends CI_Controller {
function __construct() {
parent::__construct();
$this->permission->is_admin();
//$this->output->enable_profiler(TRUE);
$this->load->model('Area_model');
$this->load->model('Information_model');
$this->load->model('InfoMetas_model');
}
public function index() {
$data = array();
$data['active'] = 'home';
$data['setting_body'] = '各种系统选项的设置,请选择左侧栏目';
$this->load->view('bootstrap3/header', $data);
$this->load->view('bootstrap3/setting');
$this->load->view('bootstrap3/footer');
}
public function website_nav() {
$data = array();
$data['active'] = 'website_nav';
$data['nav_list'] = $this->InfoMetas_model->get_list(0, 'setting_website_nav_' . strtolower($this->config->item('site_code')));
$data['setting_body'] = $this->load->view('bootstrap3/setting_website_nav', $data, true);
$this->load->view('bootstrap3/header', $data);
$this->load->view('bootstrap3/setting');
$this->load->view('bootstrap3/footer');
}
public function add() {
$im_ic_id = $this->input->post('im_ic_id');
$im_key = $this->input->post('im_key');
$im_value = $this->input->post('im_value');
$return_url = $this->input->post('return_url');
if (!empty($im_key) && !empty($im_value)) {
$this->InfoMetas_model->add($im_ic_id, $im_key, $im_value);
if (!empty($return_url)) {
$data[] = array('name' => 'ok_go', 'value' => $return_url);
} else {
$data[] = array('name' => 'ok', 'value' => '添加成功!');
}
} else {
$data[] = array('name' => 'no', 'value' => '添加失败!');
}
echo json_encode($data);
}
public function save() {
$im_id = $this->input->post('im_id');
$im_value = $this->input->post('im_value');
if (!empty($im_id) && !empty($im_value)) {
$this->InfoMetas_model->update_by_id($im_id, $im_value);
$data[] = array('name' => 'ok', 'value' => '保存成功!');
} else {
$data[] = array('name' => 'no', 'value' => '保存失败!');
}
echo json_encode($data);
}
public function delete() {
$im_id = $this->input->post('im_id');
$return_url = $this->input->post('return_url');
if (!empty($im_id)) {
$this->InfoMetas_model->delete_by_id($im_id);
if (!empty($return_url)) {
$data[] = array('name' => 'ok_go', 'value' => $return_url);
} else {
$data[] = array('name' => 'ok', 'value' => '删除成功!');
}
} else {
$data[] = array('name' => 'no', 'value' => '保存失败!');
}
echo json_encode($data);
}
}

@ -0,0 +1,63 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Sitemap extends CI_Controller {
function __construct() {
parent::__construct();
//$this->output->enable_profiler(TRUE);
$this->load->model('Area_model');
$this->load->model('InfoStructures_model');
$this->load->model('Information_model');
$this->load->model('Coupon_model');
}
public function index() {
$this->permission->is_admin();
$this->create($this->config->item('site_url'));
}
public function save($site_code) {
$site_array = $this->config->item('site');
$site = $site_array[$site_code];
$site_url = $site['site_url'];
$sitemap_name = $site['site_sitemap'];
if (!empty($sitemap_name)) {
$this->create($site_url, $sitemap_name);
} else {
echo 'no set sitemap name';
}
}
public function create($site_url, $site_sitemap = false) {
@set_time_limit(0);
$data = array();
$sitemap_string = '<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> ';
$data['lastEditList'] = $this->Information_model->get_last_edit_list(false);
foreach ($data['lastEditList'] as $item) {
if ($item->ic_status == 1 && $item->ic_url != '' && strlen($item->ic_content)>50 ) {
$sitemap_string.='<url><loc>' . $site_url . $item->ic_url . '</loc><lastmod>' . date('c', strtotime($item->ic_datetime)) . '</lastmod></url>';
}
}
$sitemap_string.='</urlset> ';
if ($site_sitemap) {
$this->load->helper('file');
if (!write_file($site_sitemap, $sitemap_string)) {
echo 'Unable to write the file';
} else {
echo 'File written!';
}
} else {
$this->load->helper('download');
force_download('sitemap.xml', $sitemap_string);
}
//echo $sitemap_string;die();
// $this->load->view('bootstrap/header', $data);
//$this->load->view('bootstrap/sitemap');
// $this->load->view('bootstrap/footer');
}
}

@ -0,0 +1,40 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Special extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->permission->is_admin();
//$this->output->enable_profiler(TRUE);
$this->load->model('Area_model');
$this->load->model('Information_model');
$this->load->model('InfoContents_model');
$this->load->model('InfoStructures_model');
}
public function index()
{
$special_id=1;
//查询结构根节点,当为空则建立
$rootStructure = $this->Information_model->GetRoot('t', $special_id);
if ($rootStructure == FALSE)
{
$this->InfoContents_model->Add('', 'special area', 'root', '', '', '', '', '', '', 0, 0, '', '', 0, 0, '', '', $special_id, 't', 0,
'','');
$this->InfoStructures_model->Add(0, $this->InfoContents_model->insert_id);
$is_id = $this->InfoStructures_model->insert_id;
}
else
{
$is_id = $rootStructure->is_id;
}
redirect(site_url('information/edit/' . $is_id));
}
}

@ -0,0 +1,109 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
/**
*
* 模块机制类
*
*/
class Thirdparty extends CI_Controller {
public function __construct() {
parent::__construct();
//$this->output->enable_profiler(TRUE);
}
/*public function action()
{
$third_party = 'third_party';
$segment_array = $this->uri->segment_array();
$module_key = array_search('thirdparty',$segment_array);
$segment_count = count($segment_array);
//组装传递参数
$parameter = array();
for ($i=6; $i <= $segment_count; $i++) {
$parameter[]=$this->uri->segment($i);
}
//获取模块名
$module_name = $this->uri->segment(($module_key+2));
if (!$module_name) {
send_404($this);
return false;
}
//模块控制器名
$controller_name = strtolower($this->uri->segment(($module_key+3), 'index'));
//模块控制器调用的方法名
$action_name = $this->uri->segment(($module_key+4), 'index');
//加载指定模块(独立应用)
$module_path=APPPATH.$third_party."/".$module_name; //存放模块的目录
$view_cascade=TRUE; //允许加载模块内、外的视图
$this->load->add_package_path($module_path."/",$view_cascade);
//加载指定的模块控制器文件
if ( ! file_exists($module_path.'/controllers/'.$controller_name.'.php')) {
return false;
}
require_once($module_path.'/controllers/'.$controller_name.'.php');
$controller_name = ucfirst($controller_name);
//实例化指定模块de控制器
if (!class_exists($controller_name,false)) {
return false;
}
$ctrl_object = new $controller_name();
//调用指定模块的控制器方法,并传递参数
if (!method_exists($ctrl_object,$action_name)) {
return false;
}
call_user_func_array(array($ctrl_object, $action_name), $parameter);
//停止加载该模块
$this->load->remove_package_path($module_path."/");
}*/
public function _remap($app,$param)
{
//第三方应用存放目录
$third_party = 'third_party';
//请求的应用、制器、方法
$app_name = strtolower($app);
$controller_name = isset($param[0])?strtolower($param[0]):'index';
$action_name = isset($param[1])?strtolower($param[1]):'index';
//加载应用包
$app_path=APPPATH.$third_party."/".$app_name."/"; //存放模块的目录
$view_cascade=TRUE; //允许加载模块内、外的视图
$this->load->add_package_path($app_path,$view_cascade);
//加载控制器
if ( ! file_exists($app_path.'controllers/'.$controller_name.'.php')) {
echo 'Controller file is not exists!';
return false;
}
require_once($app_path.'controllers/'.$controller_name.'.php');
$controller_name = ucfirst($controller_name);
//实例化控制器并调用请求的方法
if (class_exists($controller_name,false))
{
$controllerHandler = new $controller_name();
if(method_exists($controllerHandler,$action_name)) {
call_user_func_array(array($controllerHandler, $action_name), array_slice($param, 2));
}else{
echo 'Method is not exists!';
}
}
else
{
echo 'Controller is not exists!';
}
//停止加载应用包
$this->load->remove_package_path($app_path);
}
}

@ -0,0 +1,420 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Translate extends CI_Controller
{
var $per_page;
function __construct()
{
parent::__construct();
$this->permission->is_admin();
//$this->output->enable_profiler(TRUE);
$this->load->model('Translate_model');
$this->per_page = 30;
}
public function index()
{
$this->load->library('pagination');
$recordcount = 0;
$page = $this->uri->segment(3);
$opiid =0;
$userid =0;
if($this->input->post('Submit')){
$key = $this->input->post('search');
} else {
$key = unserialize($this->input->cookie('search'));
}
$cookie = array(
'name' => 'search',
'value' => serialize($key),
'expire' => '86500',
'path' => '/'
);
$searchdata=$key;
if($searchdata['tli_userid']=='')unset($searchdata['tli_userid']);
if($searchdata['tli_opi_sn']=='')unset($searchdata['tli_opi_sn']);
if($searchdata['tli_title']=='')unset($searchdata['tli_title']);
if($searchdata['tli_checktime_f']==''|| !$this->is_date($searchdata['tli_checktime_f']) )unset($searchdata['tli_checktime_f']);
if($searchdata['tli_checktime_t']==''|| !$this->is_date($searchdata['tli_checktime_t']) )unset($searchdata['tli_checktime_t']);
$this->input->set_cookie($cookie);
$data['translateList'] = $this->Translate_model->getList($searchdata,$opiid,$userid,$searchdata['tli_status'],$recordcount,$page,$this->per_page);
$config['base_url'] = site_url("translate/listall/");
$config['total_rows'] = $recordcount;
$config['per_page'] = $this->per_page;
$config['uri_segment'] = 3;
$this->pagination->initialize($config);
$data['userList'] = $this->Translate_model->getuserList();
$data['OpiList'] = $this->Translate_model->getOpiList();
$data['search'] = $key;
$this->load->view('header',$data);
$this->load->view('translate');
$this->load->view('footer');
}
public function is_date($d){
// date formate is 01/04/2012
// or else return false
if (preg_match ("/^\d{2}\/\d{2}\/\d{4}$/i",$d)) {
return true;
} else {
return false;
}
}
public function publication($tid=0){
$this->load->helper('date');
if($this->input->post('submit')){
$info = $this->input->post('info');
$msg = '';$ispass = false;
/*
if(strlen($info['tli_content'])<10){
$msg = '<div>翻译内容不能为空.</div>';
$ispass = true;
}
*/
if(strlen($info['tli_title'])<1){
$msg .= '<div>任务标题不能为空.</div>';
$ispass = true;
}
/*
if(!is_numeric($info['tli_userid'])){
$msg .= '<div>必须指定翻译人员.</div>';
$ispass = true;
}
*/
if(!preg_match("/^[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}$/",$info['tli_deadline'])){
$msg .= '<div>有效期日期格式不正确.</div>';
$ispass = true;
}
if(strtotime($info['tli_deadline']) < time()){
$info['tli_deadline'] = time()+3600*24*10;
}
if($ispass){
$data[] = array('name'=>'ok','value'=>$msg);
echo json_encode($data);
exit();
}
if($tid>0){//更新任务新信息
$result = $this->Translate_model->updatetranslat($info,$tid);
} else {//新增新任务
$result = $this->Translate_model->addTranslate($info);
}
if($result){
$data[] = array('name'=>'go','value'=>site_url('translate/listall'));
} else {
$data[] = array('name'=>'no','value'=>'系统错误请重试!');
}
echo json_encode($data);
exit();
}
$data['userList'] = $this->Translate_model->getuserList();
$this->load->view('header',$data);
$this->load->view('translate_publish');
$this->load->view('footer');
}
//全部列表同部调用function index
public function listall(){
$this->index();
}
//修改任务表单
public function editiem($tid){
$data['userList'] = $this->Translate_model->getuserList();
$data['translateInfo'] = $this->Translate_model->getTranslateInfo($tid);
$this->load->view('header',$data);
$this->load->view('translate_edit');
$this->load->view('footer');
}
/*删除任务*/
public function deletetranslate($tid){
$this->Translate_model->deletetranslation($tid);
redirect(site_url('translate/listall'));
}
/*操作表单*/
//操作表单可用字段有:
// 管理备注
// 信息应用地址,
// 翻译总字数
// 已经付款总数
// 状态
public function opater($tid,$action=''){
if(!in_array($action,array('check','pay','public')))
{
exit();
}
$data['translateinfo']=$this->Translate_model->getTranslateInfo($tid);
switch ($action){
case "check":
break;
default:
}
if($this->input->post('action') == 'check'){
$this->opatercheck($tid);
}else if($this->input->post('action') == 'pay'){
if($data['translateinfo']['tli_status'] < 4){
$data[]=array('name'=>'no','value'=>'审核未通过不能结算任务!');
exit(json_encode($data));
}
$this->opaterpay($tid);
}else if($this->input->post('action') == 'public'){
$this->opaterpublic($tid);
}
$data['action']=$action;
$data['tid']=$tid;
$this->load->view('header',$data);
$this->load->view('opater');
$this->load->view('footer');
}
private function opatercheck($tid){
$r = $this->input->post('opater');
$this->form_validation->set_rules('opater[tli_charcount]', 'tli_charcount', 'required|numeric');
if ($this->form_validation->run() == FALSE){
$data[]=array('name'=>'no','value'=>'请输入翻译总字数,必须为数字');
} else {
$r['tli_status'] = ($r['tli_status']==1)?4:3;
$r['tli_checktime'] = date('Y-m-d H:i:s',time());//审核时间
if($this->Translate_model->updatetranslat($r,$tid)==false){
$data[]=array('name'=>'no','value'=>'审核操作失败,请重试');
}else{
$data[]=array('name'=>'ok','value'=>'操作成功执行');
}
}
echo json_encode($data);
exit();
}
private function opaterpay($tid){
$r = $this->input->post('opater');
$this->form_validation->set_rules('opater[tli_charge]', 'tli_charge', 'required|numeric');
$this->form_validation->set_rules('opater[tli_chargeunit]', 'tli_chargeunit', 'required');
if ($this->form_validation->run() == FALSE){
$data[]=array('name'=>'no','value'=>'支付金额必须为数字,单位币种不能为空');
} else {
$r['tli_status'] = 5;
if($this->Translate_model->updatetranslat($r,$tid)==false){
$data[]=array('name'=>'no','value'=>'审核操作失败,请重试');
} else {
$data[]=array('name'=>'ok','value'=>'操作成功执行');
}
}
echo json_encode($data);
exit();
}
private function opaterpublic($tid){
$r = $this->input->post('opater');
$r['tli_status'] = 6;
if($this->Translate_model->updatetranslat($r,$tid)==false){
$data[]=array('name'=>'no','value'=>'发布操作失败,请重试');
}else{
$data[]=array('name'=>'ok','value'=>'操作成功执行');
}
exit(json_encode($data));
}
//操作表单结束//
/*以上部分为翻译内容*/
/*以下部分为用户管理部分*/
//用户管理部分以小写u开头
public function listuser(){
$this->load->library('pagination');
$page = $this->uri->segment(3);
$recordcount = 0;
$data['translateUserList'] = $this->Translate_model->uList($recordcount,$page,$this->per_page);
$config['base_url'] = site_url("translate/listuser/");
$config['total_rows'] = $recordcount;
$config['per_page'] = $this->per_page;
$config['uri_segment'] = 3;
$this->pagination->initialize($config);
$this->load->view('header',$data);
$this->load->view('translate_userlist');
$this->load->view('footer');
}
/*编辑*/
public function uedit($uid){
$msg='';
if($this->input->post('Submit') && $uid>0){
$userinfo= $this->input->post('userinfo1');
$passwordInfo = $this->input->post('userinfo');
$msg ='用户信息更新成功.';
if($passwordInfo['tlui_password']!='' ){
$newpassword = $this->Translate_model->randomkeys(6);
$userinfo['tlui_password']=md5($newpassword);
$msg .="您初始化了密码新密码为:<strong>$newpassword</strong>";
}
$this->Translate_model->update_user($userinfo,$uid);
}
$data = $this->Translate_model->getUserInfo($uid);
$data->msg=$msg;
$this->load->view('header',$data);
$this->load->view('translate_userform');
$this->load->view('footer');
}
/*删除*/
public function udelete($uid){
$this->Translate_model->deleteuser($uid);
redirect(site_url('translate/listuser'));
}
/*公告*/
public function announc($page=0){
$data['action'] = 'list';
$page = $this->uri->segment(2);
$data['announcList'] = $this->Translate_model->getAnnouncList($this->per_page,$page);
$this->load->view('header',$data);
$this->load->view('announc');
$this->load->view('footer');
}
public function announcadd(){
$data['action'] = 'add';
//$data['announc'] = $this->Translate_model->getAnnounc($id);
$this->load->view('header',$data);
$this->load->view('announc');
$this->load->view('footer');
}
public function editannounc($id=''){
$data['action'] = 'edit';
if($this->input->post('submit') == 'true'){
//保存
$msg['tlm_title'] = $this->input->post('tlm_title');
$msg['tlm_content'] = $this->input->post('tlm_content');
$msg['tlm_id'] = $this->input->post('tlm_id');
//unset($msg['tlm_id']);
if($msg['tlm_id']==""){//新建
unset($msg['tlm_id']);
$msg['tlm_dateline'] = date('Y-m-d H:i:s',time());
$this->Translate_model->inertAnnounc($msg);
$data[]=array('name'=>'go','value'=>site_url('translate/announc'));
} else { //修改
unset($msg['tlm_id']);
$this->Translate_model->updateAnnounc($msg,$id);
$data[]=array('name'=>'go','value'=>site_url('translate/announc'));
}
exit(json_encode($data));
}
$data['announc'] = $this->Translate_model->getAnnounc($id);
$this->load->view('header',$data);
$this->load->view('announc');
$this->load->view('footer');
}
public function deletennounc($id=''){
$this->Translate_model->deleteAnnounc($id);
redirect(site_url('translate/announc'));
}
//修改后的函数
//检测是否存在这样一个翻译信息
public function checktranslate($ic_id){
$data['result'] = $this->Translate_model->checktranslate($ic_id);
echo json_encode($data);
}
public function gettranslateInfo($ic_id){
if(!$this->Translate_model->checktranslate($ic_id)){
$tmpinfo['tli_content']=$this->input->post("ic_content");
$tmpinfo['tli_tagetlgc'] = "";
$tmpinfo['tli_otherquest'] = "";
$tmpinfo['tli_title'] = "";
$tmpinfo['tli_userid'] = 0;
$tmpinfo['tli_ic_id'] = $ic_id;
$this->Translate_model->addTranslate($tmpinfo);
}
$data['translateInfo'] = $this->Translate_model->getTranslateInfo(0,$ic_id);
$data['userList'] = $this->Translate_model->getuserList();
$data['cp'] = "checktranslate";
$this->load->view('translate_form',$data);
}
public function updateTranslate(){
$this->load->helper('date');
$info = $this->input->post('info');
$msg = '';$ispass = false;
/*
if(strlen($info['tli_content'])<10){
$msg = '<div>翻译内容不能为空.</div>';
$ispass = true;
}
*/
if(strlen($info['tli_title'])<1){
$msg .= '<div>任务标题不能为空.</div>';
$ispass = true;
}/*
if(!is_numeric($info['tli_userid'])){
$msg .= '<div>必须指定翻译人员.</div>';
$ispass = true;
}
*/
if(!preg_match("/^[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}$/",$info['tli_deadline'])){
$msg .= '<div>有效期日期格式不正确.</div>';
$ispass = true;
}
if(!preg_match("/^[0-9]+$/",$info['tli_id'])){
$msg .= '<div>系统错误,错误代码 #1.</div>';
$ispass = true;
}
if(!preg_match("/^[0-9]+$/",$info['tli_ic_id'])){
$msg .= '<div>系统错误,错误代码 #2.</div>';
$ispass = true;
}
if($ispass){
$data[] = array('name'=>'no','value'=>$msg);
echo json_encode($data);
exit();
}
$tid = $info['tli_id'];
unset($info['tli_charcount']);
unset($info['tli_charge']);
unset($info['tli_id']);
unset($info['tli_info']);
$result = $this->Translate_model->updatetranslat($info,$tid);
if($result){
$data[] = array('name'=>'ok','value'=>'翻译信息内容更新成功');
} else {
$data[] = array('name'=>'no','value'=>'系统错误请重试!');
}
echo json_encode($data);
exit();
}
public function opaterajax($tid,$action=''){
$data['cp'] = $action;
$data['translateInfo'] = $this->Translate_model->getTranslateInfo($tid, 0);
$str = $this->load->view('translate_form',$data,true);
$data[] = array('name'=>'ok','value'=>$str);
echo json_encode($data);
}
public function viewcon($tid){
$data['cp'] = 'viewcon';
$data['translateInfo'] = $this->Translate_model->getTranslateInfo($tid, 0);
$str = $this->load->view('translate_form',$data);
}
}

@ -0,0 +1,40 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Video extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->permission->is_admin();
//$this->output->enable_profiler(TRUE);
$this->load->model('Area_model');
$this->load->model('Information_model');
$this->load->model('InfoContents_model');
$this->load->model('InfoStructures_model');
}
public function index()
{
$video_id=1;
//查询结构根节点,当为空则建立
$rootStructure = $this->Information_model->GetRoot('v', $video_id);
if ($rootStructure == FALSE)
{
$this->InfoContents_model->Add('', 'video', 'root', '', '', '', '', '', '', 0, 0, '', '', 0, 0, '', '', $video_id, 'v', 0,
'','');
$this->InfoStructures_model->Add(0, $this->InfoContents_model->insert_id);
$is_id = $this->InfoStructures_model->insert_id;
}
else
{
$is_id = $rootStructure->is_id;
}
redirect(site_url('information/edit/' . $is_id));
}
}

@ -0,0 +1,345 @@
<?php
/**
* 外部访问统计
*
*/
class Website_analytics extends CI_Controller
{
private $sites;
/** 用于加密v_id的key, 解密也需要用 */
private $encrypt_key = "web_analytics_uoerwrhxxckjjlfdjfkdj";
function __construct()
{
parent::__construct();
// $this->output->enable_profiler(TRUE);
$this->load->model('Analytics_visits_model');
$this->load->model('Analytics_historys_model');
$this->load->model('Analytics_pages_model');
$this->load->model('Orders_model');
$this->load->model('Operator_model');
// 站点列表
$sites_config = $this->config->item('site');
foreach ($sites_config as $value)
{
$sites[] = $value['site_code'];
}
$this->sites = $sites;
}
// 记录客户端浏览信息
public function index($action = 'view')
{
return false;
$site_code = strtolower($this->input->get('site_code'));
$user_ip = $this->input->ip_address();
$page_title = $this->input->get('page_title');
$page_url = $this->input->server('HTTP_REFERER'); //因为是调用关系,所以它的来源页面才是访问页面
$page_referer = $this->input->get('page_referer');
// var_dump($page_url);
// 第一次访问出现的问题
// if(empty($page_url))
// {
// $page_url = $page_referer;
// }
$first_visit = FALSE;
// 测试 -- 关闭测试后删除下面两行
// $site_code = 'cht';
// $page_url = 'http://www.chinahighlights.ru/chongqing/att33343435n/';
// 判断站点
if (!in_array($site_code, $this->sites))
{
log_message('error', 'Invalid site_code: ' . $site_code);
return;
}
// 获取信息作者和页面ID
// $this->benchmark->mark('hash_page_start');
$page = $this->Analytics_pages_model->get_one_page($page_url, $site_code);
if (empty($page))
{
// 插入新的
$page_id = $this->Analytics_pages_model->add_add_return($site_code, $page_url, $page_title);
if (empty($page_id))
{
log_message('error', 'Cant insert new page url: ' . $page_url);
return;
}
// var_dump($page_id);
$page = $this->Analytics_pages_model->get_one($page_id);
// var_dump($page);
}
// var_dump($page);
// die();
// hash_page方法还没有直接查询快.. :(
// $page = $this->Page_model->get_hash_page($site_code, $page_url, $page_title);
// $this->benchmark->mark('hash_page_end');
// echo $this->benchmark->elapsed_time('hash_page_start', 'hash_page_end');
$page_id = $page->p_id;
$author = $page->p_author;
// 访客
// $this->_clear_user_key(); // 测试用
$user_key = $this->_get_user_key();
// 首访页面判断
if ($user_key === FALSE)
{
$first_visit = TRUE;
// 新增一个访客记录
$log_visit_id = $this->Analytics_visits_model->add($site_code, $page_id, $author, $user_ip, $page_referer);
if ($log_visit_id)
{
// 保存key
$user_key = $site_code . '_visit_' . passport_encrypt((string) $log_visit_id, $this->encrypt_key);
$this->_save_user_key($user_key);
} else
{
log_message('error', 'Cant get visitor id from cookie');
return;
}
} else
{
$log_visit_id = $this->_get_visit_id($user_key);
}
// 页面更新点击
$this->Analytics_pages_model->inc_view($page_id);
// 记录访问历史
$this->Analytics_historys_model->add($log_visit_id, $page_id, $page_referer);
// 更新最后点击页面
// 注: 每次都把当前访问页面当成离开页面是因为JS的unload和onbeforeunloa事件同样是每次刷新都请求.
// 独立出来还不如直接在访问的时候就写进去, 防止两次请求
$this->Analytics_visits_model->update_leave_page($log_visit_id, $site_code, $page_id);
// 匹配关联订单
$this->_do_order($site_code, $page_url);
}
/**
* 匹配关联订单
* @param type $site_code
* @param type $page_url
* @return type
*/
private function _do_order($site_code, $page_url)
{
//这一步做一个定时器,不需要每次访问都去检查关联
$this->load->driver('cache', array('adapter' => 'wincache', 'backup' => 'file')); // 线上
// $web_time = $this->cache->get($site_code . '_website_analytics_timer');
$web_time = FALSE;
// 有人下单才更新应该就可以了吧
// 缓存时间到, 或者访问页面包含thank或order 则更新关联
// strpos($page_url, 'thank') || strpos($page_url, 'order')
if ($web_time === false)
{
$this->cache->save($site_code . '_website_analytics_timer', time(), 900);
$confirm_line_list = $this->Orders_model->get_confirm_line_info($site_code);
// 测试数据
// $confirm_line_item['COLI_ID'] = '20121113';
// $confirm_line_item['COLI_WebCode'] = 'cht';
// $confirm_line_item['COLI_SenderIP'] = '202.103.68.62';
// $confirm_line_list[] = (object) $confirm_line_item;
//
if (!empty($confirm_line_list))
{
// 查询当天传统订单,把订单号和客人首访页面关联起来
foreach ($confirm_line_list as $confirm_line_item)
{
// 根据 site_code和ip获取当天的访客信息
$visit = $this->Analytics_visits_model->get_order_visit($confirm_line_item->COLI_WebCode, $confirm_line_item->COLI_SenderIP);
if ($visit && empty($visit->v_order_num))
{
// 绑定订单ID
$rs = $this->Analytics_visits_model->bing_order_num($visit->v_id, $confirm_line_item->COLI_ID);
if ($rs == TRUE)
{
$author = $this->Operator_model->get_user($visit->v_page_author);
// 发送通知Email
if ($author)
{
$data['author'] = $author;
$visit->v_order_num = $confirm_line_item->COLI_ID;
$data['view_log'] = $visit;
$mail_body = $this->load->view('analytics/email', $data, true);
$this->Orders_model->send_mail('YCC', 'ycc@chinahighlights.com', $author['OPI_Name'], $author['OPI_Email'], $this->lang->line('order_mail_title'), $mail_body);
}
}
}
}// end foreach 当天传统订单
}
// 查询当天商务订单,把订单号和客人首访页面关联起来
$biz_list = $this->Orders_model->get_biz_info($site_code);
if (!empty($biz_list))
{
foreach ($biz_list as $biz_item)
{
// 根据 site_code和ip获取当天的访客信息
$visit = $this->Analytics_visits_model->get_order_visit($biz_item->COLI_WebCode, $biz_item->COLI_SenderIP);
if ($visit && empty($visit->v_order_num))
{
// 绑定订单ID
$rs = $this->Analytics_visits_model->bing_order_num($visit->v_id, $biz_item->COLI_ID, 'b');
if ($rs == TRUE)
{
$author = $this->Operator_model->get_user($visit->v_page_author);
// 发送通知Email
if ($author)
{
$data['author'] = $author;
$visit->v_order_num = $biz_item->COLI_ID;
$data['view_log'] = $visit;
$mail_body = $this->load->view('analytics/email', $data, true);
$this->Orders_model->send_mail('YCC', 'ycc@chinahighlights.com', $author['OPI_Name'], $author['OPI_Email'], $this->lang->line('order_mail_title'), $mail_body);
}
}
}
} // endforeach 当天商务订单
}
} // endif
return;
}
/**
* 获取用户key
*/
private function _get_user_key()
{
$analytics_cookie = $this->input->cookie('website_analytics');
if ($analytics_cookie)
{
return $analytics_cookie;
}
return false;
}
/**
* 根据用户KEY获取对应的log_visit_id
* @param type $user_key
* @return boolean
*/
private function _get_visit_id($user_key)
{
if (!$user_key)
{
return FALSE;
}
list($site, $log_visit_id) = explode('_visit_', $user_key);
$log_visit_id = passport_decrypt($log_visit_id, $this->encrypt_key);
// Cookie值出错 -- 客户端问题或者恶意修改cookie
if (!in_array($site, $this->sites) OR !$log_visit_id)
{
// 清空当前cookie指
$this->_clear_user_key();
return FALSE;
}
$log_visit_id = intval($log_visit_id);
if (!$log_visit_id)
{
return FALSE;
}
return $log_visit_id;
}
/*
* 生成或者获取用户key
*/
private function _save_user_key($key)
{
$analytics_cookie = array(
'name' => 'website_analytics',
'value' => $key,
'expire' => '865000', //秒目前是10天
'domain' => '',
'path' => '/',
'prefix' => '',
);
$this->input->set_cookie($analytics_cookie);
return;
}
/**
* 清空, 用于cookie可能出错的情况
*/
private function _clear_user_key()
{
$this->input->set_cookie('website_analytics', '');
}
function test()
{
return;
// $this->output->enable_profiler(TRUE);
// $confirm_line_list = $this->Orders_model->get_confirm_line_info('jp');
// var_dump($confirm_line_list);
// foreach ($confirm_line_list as $biz_item)
// {
// // 根据 site_code和ip获取当天的访客信息
// $visit = $this->Log_visit_model->get_order_visit($biz_item->COLI_WebCode, $biz_item->COLI_SenderIP);
// var_dump($visit);
// }
}
}
/**
* 以下为加密解密函数 ==================================================
*/
function passport_encrypt($txt, $key)
{
srand((double) microtime() * 1000000);
$encrypt_key = md5(rand(0, 32000));
$ctr = 0;
$tmp = '';
for ($i = 0; $i < strlen($txt); $i++)
{
$ctr = $ctr == strlen($encrypt_key) ? 0 : $ctr;
$tmp .= $encrypt_key[$ctr] . ($txt[$i] ^ $encrypt_key[$ctr++]);
}
return base64_encode(passport_key($tmp, $key));
}
function passport_decrypt($txt, $key)
{
$txt = passport_key(base64_decode($txt), $key);
$tmp = '';
for ($i = 0; $i < strlen($txt); $i++)
{
$md5 = $txt[$i];
$tmp .= $txt[++$i] ^ $md5;
}
return $tmp;
}
function passport_key($txt, $encrypt_key)
{
$encrypt_key = md5($encrypt_key);
$ctr = 0;
$tmp = '';
for ($i = 0; $i < strlen($txt); $i++)
{
$ctr = $ctr == strlen($encrypt_key) ? 0 : $ctr;
$tmp .= $txt[$i] ^ $encrypt_key[$ctr++];
}
return $tmp;
}

@ -0,0 +1,128 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Welcome extends CI_Controller {
function __construct() {
parent::__construct();
$this->permission->is_admin();
//$this->output->enable_profiler(TRUE);
$this->load->model('Area_model');
$this->load->model('InfoStructures_model');
$this->load->model('Information_model');
$this->load->model('Coupon_model');
}
public function index() {
$data['countryList'] = $this->Area_model->get_country_list();
$data['provinceList'] = $this->Area_model->get_province_list();
$data['city_list'] = $this->Area_model->get_municipalities_list();
$data['lastEditList'] = $this->Information_model->get_last_edit_list();
$data['last_city_list'] = $this->Area_model->get_last_edit_city();
$this->load->view('bootstrap/header', $data);
$this->load->view('bootstrap/welcome');
$this->load->view('bootstrap/footer');
}
public function search($isrecommend = false) {
//先搜索url如果找到唯一就跳走多于一条的则列出来一条没有的就去搜索信息
$data['keywords'] = $this->input->post('keywords');
$data['all_text_search'] = $this->input->post('all_text_search'); //全文搜索
$search_url = str_replace($this->config->item('site_url'), "", $data['keywords']);
$data['search_list'] = $this->Information_model->search_url($search_url);
if (count($data['search_list']) === 0) {
if (!empty($data['all_text_search']) && $data['all_text_search'] == 'true') {
$data['search_list'] = $this->Information_model->search_all_text($data['keywords']);
} else {
$data['search_list'] = $this->Information_model->search($data['keywords']);
}
}
if ($isrecommend) {
$data['ic_id_list'] = $this->input->post('ic_id_list') == '' ? '0' : $this->input->post('ic_id_list');
$this->load->view('bootstrap3/recommendlist', $data);
return TRUE;
} else if (count($data['search_list']) === 1) {
redirect(site_url('information/edit/' . $data['search_list'][0]->is_id));
}
$data['countryList'] = $this->Area_model->get_country_list();
$data['provinceList'] = $this->Area_model->get_province_list();
$data['city_list'] = $this->Area_model->get_municipalities_list();
$this->load->view('bootstrap/header', $data);
$this->load->view('bootstrap/welcome');
$this->load->view('bootstrap/footer');
}
//获取所有信息+产品url
public function create_all_urls() {
set_time_limit(0);
$this->output->enable_profiler(false);
$this->Information_model->topNum = false;
$data['all_information'] = $this->Information_model->GetList('ic_status,ic_url,ic_sitecode');
//系列站产品连接
$site_code = strtoupper($this->config->item('site_code'));
if (!empty($site_code)) {
$this->load->helper('file');
$path = APPPATH . '/views/product_urls/updateCache' . $site_code . '.txt';
if (file_exists($path)) {
$data['product_urls'] = read_file($path);
$domain = $this->config->item('site_url');
$data['product_urls'] = str_replace("\n", '<br/>', $data['product_urls']);
$data['product_urls'] = str_replace($domain, $domain . '/index.php/welcome/update_cache/?static_html_url=', $data['product_urls']);
}
}
$this->load->view('none_urls', $data);
}
//获取某个信息节点和子节点url
public function create_infomation_urls($is_parent_id) {
$this->output->enable_profiler(FALSE);
$structure = $this->InfoStructures_model->Detail($is_parent_id);
if (empty($structure)) {
show_404();
return false;
}
$data['all_information'] = $this->Information_model->get_list_by_path($structure->is_path);
$this->load->view('bootstrap/header', $data);
$this->load->view('bootstrap/cache_url', $data);
$this->load->view('bootstrap/footer');
}
//生肖促销订单查询
public function coupon() {
$data['countryList'] = $this->Area_model->get_country_list();
$data['provinceList'] = $this->Area_model->get_province_list();
$data['city_list'] = $this->Area_model->get_municipalities_list();
$data['coupon'] = $this->Coupon_model->getlist();
$this->load->view('bootstrap/header', $data);
$this->load->view('bootstrap/welcome');
$this->load->view('bootstrap/footer');
}
public function set_path($is_id, $parent_path = '') {
$parent_path = str_replace('-', ',', $parent_path);
$parent_path = trim($parent_path, ',');
if ($parent_path != '')
$parent_path.=',';
$this->load->model('Import_model');
$this->Import_model->set_path($is_id, $parent_path);
echo 'ok';
}
public function search_by_icid() {
$ic_id_list = $this->input->post('ic_id_list');
$ic_id_list = rtrim(trim($ic_id_list), ',') . ',';
$this->load->model('InfoContents_model');
$data['search_list'] = $this->InfoContents_model->get_ic_contents_by_list($ic_id_list);
$data['search_type'] = 'recommended';
$this->load->view('bootstrap3/recommendlist', $data);
}
}

@ -0,0 +1,180 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class MY_Output extends CI_Output
{
// --------------------------------------------------------------------
/**
* Write a Cache File
*
* @access public
* @param string
* @return void
*/
function _write_cache($output)
{
$CI =& get_instance();
$path = $CI->config->item('cache_path');
$cache_path = ($path == '') ? APPPATH.'cache/' : $path;
if ( ! is_dir($cache_path) OR ! is_really_writable($cache_path))
{
log_message('error', "Unable to write cache file: ".$cache_path);
return;
}
$uri = $CI->config->item('base_url').
$CI->config->item('index_page').
$CI->uri->uri_string();
///////改成按照URL保存缓存
//$cache_path .= md5($uri);
//生成缓存需要把@cache@refresh标识去掉
$origin_url=$this->get_origin_url($CI->config->item('index_page'));
$cache_path=$cache_path.$_SERVER['HTTP_HOST'].'/'.$origin_url;
create_folder_by_path(dirname($cache_path));
///////
if ( ! $fp = @fopen($cache_path, FOPEN_WRITE_CREATE_DESTRUCTIVE))
{
log_message('error', "Unable to write cache file: ".$cache_path);
return;
}
$expire = time() + ($this->cache_expiration * 60);
if (flock($fp, LOCK_EX))
{
fwrite($fp, $expire.'TS--->'.$output);
fseek($fp,0,SEEK_END);
fwrite($fp, '<!-- Generated by '.$_SERVER['HTTP_HOST'].' ('.date('c').') -->');
flock($fp, LOCK_UN);
}
else
{
log_message('error', "Unable to secure a file lock for file at: ".$cache_path);
return;
}
fclose($fp);
@chmod($cache_path, FILE_WRITE_MODE);
log_message('debug', "Cache file written: ".$cache_path);
}
// --------------------------------------------------------------------
/**
* Update/serve a cached file
*
* @access public
* @param object config class
* @param object uri class
* @return void
*/
function _display_cache(&$CFG, &$URI)
{
$cache_path = ($CFG->item('cache_path') == '') ? APPPATH.'cache/' : $CFG->item('cache_path');
///////改成按照URL保存缓存
//$filepath = $cache_path.md5($uri);
//如果有@cache@refresh标识则返回false不读取缓存
$origin_url=$this->get_origin_url($CFG->item('index_page'));
$filepath=$cache_path.$_SERVER['HTTP_HOST'].'/'.$origin_url;
if($this->is_has_cache_mark())
{
@unlink($filepath);
return false;
}
///////
if ( ! @file_exists($filepath))
{
return FALSE;
}
if ( ! $fp = @fopen($filepath, FOPEN_READ))
{
return FALSE;
}
flock($fp, LOCK_SH);
$cache = '';
if (filesize($filepath) > 0)
{
$cache = fread($fp, filesize($filepath));
}
flock($fp, LOCK_UN);
fclose($fp);
// Strip out the embedded timestamp
if ( ! preg_match("/(\d+TS--->)/", $cache, $match))
{
return FALSE;
}
// Has the file expired? If so we'll delete it.
if (time() >= trim(str_replace('TS--->', '', $match['1'])))
{
if (is_really_writable($cache_path))
{
@unlink($filepath);
log_message('debug', "Cache file has expired. File deleted");
return FALSE;
}
}
// Display the cache
$this->_display(str_replace($match['0'], '', $cache));
log_message('debug', "Cache file is current. Sending it to browser.");
return TRUE;
}
/**
* 获取iis rewrite之前的原始url
*/
function get_origin_url($index_page) {
if (isset($_SERVER['HTTP_X_REWRITE_URL'])) {
$origin_url = str_replace($index_page,'/',$_SERVER['HTTP_X_REWRITE_URL']);
} else {
$origin_url = str_replace($index_page,'/',$_SERVER['REQUEST_URI']);
}
$origin_url=str_replace(array('///','//','@cache@refresh'),array('/','/',''),urldecode($origin_url));
if(mb_substr($origin_url,-1,1)=='/')
{
$origin_url.='index.htm';
}
return $origin_url;
}
/*
* 判断是否有更新标识@cache@refresh
*/
function is_has_cache_mark()
{
//HTTP_X_REWRITE_URL 是不会带有@cache@refresh标识的判断的时候需要判断两种url
if (!isset($_SERVER['HTTP_X_REWRITE_URL']))
{
if(strpos($_SERVER['REQUEST_URI'],'@cache@refresh'))
{
return true;
}
}
else
{
if (strpos($_SERVER['HTTP_X_REWRITE_URL'],'@cache@refresh'))
{
return true;
}
}
return false;
}
}

@ -0,0 +1,10 @@
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

@ -0,0 +1,34 @@
<html>
<head>
<title>404 Page Not Found</title>
<style type="text/css">
body {
background-color: #fff;
margin: 40px;
font-family: Lucida Grande, Verdana, Sans-serif;
font-size: 12px;
color: #000;
}
#content {
border: #999 1px solid;
background-color: #fff;
padding: 20px 20px 12px 20px;
}
h1 {
font-weight: normal;
font-size: 14px;
color: #990000;
margin: 0 0 4px 0;
}
</style>
</head>
<body>
<div id="content">
<h1><?php echo $heading; ?></h1>
<?php echo $message; ?>
</div>
</body>
</html>

@ -0,0 +1,36 @@
<html>
<head>
<title>Database Error</title>
<style type="text/css">
body {
background-color: #fff;
margin: 40px;
font-family: Lucida Grande, Verdana, Sans-serif;
font-size: 12px;
color: #000;
}
#content {
border: #999 1px solid;
background-color: #fff;
padding: 20px 20px 12px 20px;
}
h1 {
font-weight: normal;
font-size: 14px;
color: #990000;
margin: 0 0 4px 0;
}
</style>
</head>
<body>
<div id="content">
<h1><?php echo $heading; ?></h1>
<?php echo $message; ?>
<?php print_r(sqlsrv_errors()); ?>
<?php print_r(mysql_error()); ?>
</div>
</body>
</html>

@ -0,0 +1,34 @@
<html>
<head>
<title>Error</title>
<style type="text/css">
body {
background-color: #fff;
margin: 40px;
font-family: Lucida Grande, Verdana, Sans-serif;
font-size: 12px;
color: #000;
}
#content {
border: #999 1px solid;
background-color: #fff;
padding: 20px 20px 12px 20px;
}
h1 {
font-weight: normal;
font-size: 14px;
color: #990000;
margin: 0 0 4px 0;
}
</style>
</head>
<body>
<div id="content">
<h1><?php echo $heading; ?></h1>
<?php echo $message; ?>
</div>
</body>
</html>

@ -0,0 +1,10 @@
<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">
<h4>A PHP Error was encountered</h4>
<p>Severity: <?php echo $severity; ?></p>
<p>Message: <?php echo $message; ?></p>
<p>Filename: <?php echo $filepath; ?></p>
<p>Line Number: <?php echo $line; ?></p>
</div>

@ -0,0 +1,10 @@
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

@ -0,0 +1,31 @@
<?xml version="1.0"?>
<BCPFORMAT
xmlns="http://schemas.microsoft.com/sqlserver/2004/bulkload/format"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<RECORD>
<FIELD ID="1" xsi:type="CharTerm" TERMINATOR="|@|" MAX_LENGTH="8000" />
<FIELD ID="2" xsi:type="CharTerm" TERMINATOR="|@|" MAX_LENGTH="50" />
<FIELD ID="3" xsi:type="CharTerm" TERMINATOR="|@|" MAX_LENGTH="50" />
<FIELD ID="4" xsi:type="CharTerm" TERMINATOR="|@|" MAX_LENGTH="8000" />
<FIELD ID="5" xsi:type="CharTerm" TERMINATOR="|@|" MAX_LENGTH="50" />
<FIELD ID="6" xsi:type="CharTerm" TERMINATOR="|@|" MAX_LENGTH="8000" />
<FIELD ID="7" xsi:type="CharTerm" TERMINATOR="|@|" MAX_LENGTH="8000"/>
<FIELD ID="8" xsi:type="CharTerm" TERMINATOR="|@|" MAX_LENGTH="8000" />
<FIELD ID="9" xsi:type="CharTerm" TERMINATOR="|@|" MAX_LENGTH="50" />
<FIELD ID="10" xsi:type="CharTerm" TERMINATOR="|@|" MAX_LENGTH="8000" />
<FIELD ID="11" xsi:type="CharTerm" TERMINATOR="\r\n" MAX_LENGTH="8000" />
</RECORD>
<ROW>
<COLUMN SOURCE="1" NAME="kwa_source" xsi:type="SQLNVARCHAR"/>
<COLUMN SOURCE="2" NAME="kwa_pageviews" xsi:type="SQLBIGINT"/>
<COLUMN SOURCE="3" NAME="kwa_uniquepageviews" xsi:type="SQLBIGINT"/>
<COLUMN SOURCE="4" NAME="kwa_avgtimeonpage" xsi:type="SQLNVARCHAR"/>
<COLUMN SOURCE="5" NAME="kwa_entrances" xsi:type="SQLBIGINT"/>
<COLUMN SOURCE="6" NAME="kwa_exitrate" xsi:type="SQLNVARCHAR"/>
<COLUMN SOURCE="7" NAME="kwa_conversionrate" xsi:type="SQLNVARCHAR"/>
<COLUMN SOURCE="8" NAME="kwa_datetime" xsi:type="SQLNVARCHAR"/>
<COLUMN SOURCE="9" NAME="kwa_sitecode" xsi:type="SQLNVARCHAR"/>
<COLUMN SOURCE="10" NAME="kwa_pagepath" xsi:type="SQLNVARCHAR"/>
<COLUMN SOURCE="11" NAME="kwa_keyword" xsi:type="SQLNVARCHAR"/>
</ROW>
</BCPFORMAT>

@ -0,0 +1,25 @@
<?php
//查询两地之间的距离
function get_city_distance($start_city,$destination_city)
{
$CI = & get_instance();
$CI->lang->load('city_distance');
$result=$CI->lang->line('c_distance');
$str1=$start_city.$destination_city;//拼接数组键
$str2=$destination_city.$start_city;//拼接数组键
if(isset($result[$str1])){
return $result[$str1];
}
if(isset($result[$str2])){
return $result[$str2];
}
log_message('info',"查询失败");
return 0;
}
?>

@ -0,0 +1,10 @@
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

@ -0,0 +1,290 @@
<?php
//获取项目类型名称
function get_project_typename($type)
{
$CI = & get_instance();
$type_list=$CI->config->item('project_types');
return $type_list[$type];
}
function GetAreaName($HT_areaType, $HT_areaID) {
$CI = & get_instance();
$CI->load->model('Area_model');
return $CI->Area_model->get_area_name($HT_areaType, $HT_areaID);
}
//查找作者名称,根据参数类型判断查作者表还是翰特表
function get_author_name($author_code_id) {
$CI = & get_instance();
if (is_numeric($author_code_id)) {
$CI->load->model('Infoauthors_model');
$user = $CI->Infoauthors_model->detail_by_id($author_code_id);
if ($user) {
return $user->a_name;
}
} else {
$CI->load->model('Operator_model');
$user = $CI->Operator_model->get_user($author_code_id);
if ($user) {
return $user['OPI_Name'];
}
}
return false;
}
//根据站点id获取站点名称
function get_sitecode($site_id, $site_array) {
foreach ($site_array as $item) {
if ($item['site_id'] == $site_id) {
return $item['site_code'];
}
}
return 'FALSE';
}
/*
* 递归创建文件夹
*/
function create_folder_by_path($dir, $mode = 0777) {
if (!is_dir($dir)) {
return @mkdir($dir, $mode, true);
}
return;
}
/**
* 获取iis rewrite之前的原始url
*/
function get_origin_url() {
$CI = & get_instance();
if (isset($_SERVER['HTTP_X_REWRITE_URL'])) {
$origin_url = str_replace($CI->config->item('index_page'), '/', $_SERVER['HTTP_X_REWRITE_URL']);
} else {
$origin_url = str_replace($CI->config->item('index_page'), '/', $_SERVER['REQUEST_URI']);
}
return str_replace('//', '/', urldecode($origin_url));
}
//是否是系列站
function is_series_site() {
$CI = & get_instance();
$sitecode = $CI->config->item('site_code');
if ($sitecode == 'vc' || $sitecode == 'ru' || $sitecode == 'jp' || $sitecode == 'vac' || $sitecode == 'it') {
return true;
} else {
return false;
}
}
//是否是子站点
function is_sub_site() {
$CI = & get_instance();
$sitecode = $CI->config->item('site_code');
if ($sitecode == 'yz' || $sitecode == 'tbt' || $sitecode == 'mbj' || $sitecode == 'sht' || $sitecode == 'gl') {
return true;
} else {
return false;
}
}
function add_meta($im_ic_id, $im_key, $im_value) {
$CI = & get_instance();
$CI->load->model('InfoMetas_model');
return $CI->InfoMetas_model->add($im_ic_id, $im_key, $im_value);
}
function get_meta($im_ic_id, $im_key) {
$CI = & get_instance();
$CI->load->model('InfoMetas_model');
return $CI->InfoMetas_model->get($im_ic_id, $im_key);
}
function update_meta($im_ic_id, $im_key, $im_value) {
$CI = & get_instance();
$CI->load->model('InfoMetas_model');
return $CI->InfoMetas_model->update($im_ic_id, $im_key, $im_value);
}
function delete_meta($im_ic_id, $im_key) {
$CI = & get_instance();
$CI->load->model('InfoMetas_model');
return $CI->InfoMetas_model->delete($im_ic_id, $im_key);
}
//检查是否有短消息
function have_unread_sms($m_object_type,$m_object_id)
{
$CI = & get_instance();
$CI->load->model('InfoSMS_model');
$sms_list=$CI->InfoSMS_model->unread_sms($m_object_type,$m_object_id);
$admin_info=$CI->session->userdata('session_admin');
if(empty($sms_list))
{
return false;
}
else
{
$sender=get_author_name($sms_list[0]->m_sender);
if($admin_info['OPI_Name']==$sender){
return false;
}else{
return true;
}
}
}
//截取字符串
function get_text_short($str, $length = 40, $ext = '',$only_content=false) {
$str = strip_tags($str);
$str = htmlspecialchars_decode($str);
$strlenth = 0;
$out = '';
$output = '';
$is_length = false;
preg_match_all("/[\x01-\x7f]|[\xc2-\xdf][\x80-\xbf]|[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xff][\x80-\xbf]{3}/", $str, $match);
foreach($match[0] as $v){
preg_match("/[\xe0-\xef][\x80-\xbf]{2}/",$v, $matchs);
if(!empty($matchs[0])){
$strlenth += 1;
}elseif(is_numeric($v)){
$strlenth += 0.5; // 字符字节长度比例 汉字为1
}else{
$strlenth += 0.5; // 字符字节长度比例 汉字为1
}
if ($strlenth > $length) {
$output .= $ext;
$is_length=true;
break;
}
$output .= $v;
}
$data['content']=$output;
$data['length']=$is_length;
if ($only_content) {
return $data['content'];
}
return $data;
}
//平台头部展示所有未读消息数量
function get_all_unread_sms($type='author',$author=false)
{
$CI = & get_instance();
$CI->load->model('InfoSMS_model');
if(!$author){
$admin_info=$CI->session->userdata('session_admin');
$author=$admin_info['OPI_Code'];
}
if ($type=='info') {
$unread_sms=$CI->InfoSMS_model->info_unread_sms($author,'info');
}else{
$unread_sms=$CI->InfoSMS_model->all_unread_sms($author,'task');
}
return $unread_sms;
}
//获取不同任务状态的任务数量
function get_task_count_by_status(){
$CI = & get_instance();
$CI->load->model('Infotasks_model');
$task_count_by_status=$CI->Infotasks_model->get_task_count_by_status();
return $task_count_by_status;
}
//获取作者头像
function get_author_photo($author_code_id=false)
{
$CI = & get_instance();
$root_url='';//'http://data.chtcdn.com';
$avatar=$root_url.'/css/images/avatar.jpg';
if($author_code_id && is_numeric($author_code_id))
{
$CI->load->model('Infoauthors_model');
$user=$CI->Infoauthors_model->detail_by_id($author_code_id);
if(isset($user->a_photo) && $user->a_photo!='')
{
$avatar = $root_url.'/author/document/profile_photo/'.$user->a_photo;
}
}
return $avatar;
}
//补全图片路径
function get_photo_url($photo){
$root_url='';//'http://data.chtcdn.com';
if ($photo=='') {
$avatar = $root_url.'/css/images/uploadPic.jpg';
}else{
$avatar = $root_url.'/author/document/profile_photo/'.$photo;
}
return $avatar;
}
//获取待审核作者数量
function un_active_count(){
$CI = & get_instance();
$CI->load->model('Infoauthors_model');
$num=$CI->Infoauthors_model->un_active_count();
return $num;
}
//分页函数
function show_page($page){
$pageSize = $page['pageSize'];
$total = $page['total'];
$url = $page['url'];
$pageNumber = ceil($total / $pageSize);
$currentPage = $page['current'] ? $page['current'] : 1;
$startPage = ($currentPage - 1) * $pageSize;
$befor = $after = 0;
$nowview=ceil(($currentPage+1)/10);
$befor = $nowview==1?($nowview-1)*10+1:($nowview-1)*10;
if($pageNumber>=$nowview*10){
$after = $nowview*10;
}else{
$after = $pageNumber;
}
$html='';
if($nowview>1) $befor--;
if ($pageSize <= $total) {
for ($i = $befor; $i <= $after; $i++) {
if ($i == $currentPage) {
$html .= "<li class=\"active\"><a href=\"javascript:void(0)\">{$i}</a></li>";
}else {
$html .= "<li><a href=\"{$url}/{$i}\">$i</a></li>";
}
}
}
$res['htmls']=$html;
$res['prepage']=$currentPage - 1;
$res['nextpage']=$currentPage + 1;
$res['totalpage']=$pageNumber;
return $res;
}
//请求URL并返回数组数据
function get_content_by_url($url) {
//echo $url;
$httpInfo = array();
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22');
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //不验证证书
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_URL, $url);
$response = curl_exec($ch);
if ($response === FALSE) {
#echo "cURL Error: " . curl_error($ch);
return false;
}
return $response;
}

@ -0,0 +1,10 @@
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

@ -0,0 +1,10 @@
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

@ -0,0 +1,664 @@
<?php
/*
* 两个城市之间的距离数据
* author:mjs
* 创建时间:2016.3.29
*
*/
$lang['c_distance']=array(
"BUDPEK"=>7593,
"HAKURC"=>4254,
"HAKHRC"=>3911,
"NGBURC"=>3910,
"URCCAN"=>3836,
"CANHEK"=>3741,
"URCHKG"=>3653,
"SHAURC"=>3649,
"HAKKUL"=>3500,
"SYXKUL"=>3300,
"ICNSYX"=>3160,
"HAKSHE"=>3142,
"JILSZX"=>3080,
"HAKICN"=>3060,
"HRBSZX"=>3034,
"CGQSZX"=>2983,
"CANCGQ"=>2971,
"HAKKIX"=>2965,
"DLCHAK"=>2920,
"PEKURC"=>2842,
"HAKHET"=>2809,
"HAKWEH"=>2717,
"PEKSYX"=>2710,
"SHECAN"=>2672,
"SHESZX"=>2671,
"JHGTSN"=>2660,
"PEKWUA"=>2650,
"HAKPUS"=>2600,
"URCCKG"=>2560,
"HAKSIN"=>2500,
"SYXTYN"=>2500,
"HAKPEK"=>2493,
"HAKTAO"=>2435,
"HAKLHW"=>2410,
"ZHAPEK"=>2409,
"KWLSHE"=>2382,
"HAKTSN"=>2370,
"DLCSZX"=>2368,
"URCXIY"=>2352,
"HAKSJW"=>2349,
"CGQFOC"=>2326,
"CANDLC"=>2285,
"ZUHSHE"=>2273,
"HAKTNA"=>2272,
"HAKTYN"=>2270,
"KMGPEK"=>2266,
"CTUURC"=>2258,
"NNGPEK"=>2250,
"LYGXMN"=>2247,
"LHWXMN"=>2244,
"SHEXMN"=>2242,
"KMGTSN"=>2210,
"HETSZX"=>2206,
"SZXXNN"=>2185,
"LHWSZX"=>2185,
"SWAXIY"=>2165,
"XNNCAN"=>2150,
"LHWWNZ"=>2133,
"CANYNT"=>2132,
"CGOSYX"=>2120,
"CANWEH"=>2112,
"PEKZUH"=>2098,
"CANWEF"=>2093,
"CANINC"=>2088,
"KMGTNA"=>2080,
"PEKSZX"=>2077,
"SYXXIY"=>2067,
"PVGSYX"=>2050,
"PVGNDG"=>2049,
"XNNSHA"=>2047,
"KMGSHA"=>2042,
"KWEPEK"=>2039,
"NKGSYX"=>2030,
"HRBXIY"=>2028,
"SZXTSN"=>2021,
"CGOJHG"=>2020,
"CGQHGQ"=>2010,
"SHEXNN"=>2009,
"PVGMDG"=>2003,
"NGBSHE"=>1994,
"HAKHKG"=>1990,
"CGQXIY"=>1979,
"CANPEK"=>1967,
"HGHSYX"=>1950,
"KMGNGB"=>1948,
"XIYXMN"=>1932,
"NGBSYX"=>1920,
"CANTSN"=>1910,
"LHWURC"=>1895,
"LAXPVG"=>1890,
"CANENY"=>1889,
"KWLPEK"=>1887,
"CANDAT"=>1887,
"HAKXUZ"=>1880,
"AATKHG"=>1877,
"CGOHAK"=>1873,
"KMGTYN"=>1871,
"CANTAO"=>1867,
"HAKXIY"=>1860,
"SIAHAK"=>1860,
"HGHSHE"=>1849,
"HAKHFE"=>1840,
"NNGXIY"=>1832,
"SZXTNA"=>1828,
"CANSJW"=>1822,
"CTUNGB"=>1803,
"SYXWNZ"=>1802,
"PEKXMN"=>1800,
"KWLTSN"=>1800,
"PEKTPE"=>1800,
"SZXTYN"=>1796,
"KWLTYN"=>1791,
"XNNPEK"=>1780,
"PEKKHV"=>1780,
"HAKPVG"=>1762,
"SHAHAK"=>1762,
"CTUHAK"=>1757,
"HRBNKG"=>1756,
"SHEWNZ"=>1753,
"NNGSHA"=>1750,
"KMGLHW"=>1749,
"HGHINC"=>1746,
"HAKXFN"=>1733,
"CANTYN"=>1722,
"FOCTYN"=>1721,
"HRBTYN"=>1714,
"SYXWUH"=>1700,
"CTUPEK"=>1697,
"FOCXIY"=>1693,
"FOCPEK"=>1681,
"KMGXMN"=>1680,
"CANXIY"=>1674,
"PVGBHY"=>1670,
"CANTNA"=>1664,
"HAKYIW"=>1655,
"LHWNKG"=>1654,
"KWLLHW"=>1651,
"SHEXIY"=>1648,
"CKGPEK"=>1640,
"CTUTSN"=>1640,
"ENYSHA"=>1639,
"SZXXIY"=>1635,
"NKGSHE"=>1630,
"TYNWNZ"=>1629,
"FOCTSN"=>1622,
"HAKNGB"=>1620,
"HAKNGB"=>1620,
"WNZXIY"=>1601,
"BKKHAK"=>1600,
"NZHPEK"=>1600,
"INCDLC"=>1574,
"CGOKMG"=>1570,
"CSXJHG"=>1566,
"CANLYG"=>1560,
"PEKHEK"=>1552,
"CKGNGB"=>1550,
"TSNWNZ"=>1545,
"NKGZUH"=>1544,
"CGQNKG"=>1533,
"HAKWNZ"=>1526,
"NKGSZX"=>1526,
"HYNXIY"=>1523,
"NGBXIY"=>1520,
"DNHXIY"=>1518,
"URCXNN"=>1518,
"CKGSYX"=>1517,
"CKGWNZ"=>1505,
"PEKWNZ"=>1500,
"XIYLXA"=>1500,
"ZUHPVG"=>1497,
"PEKYIH"=>1483,
"CANLYA"=>1480,
"HAKYIH"=>1479,
"CGOSZX"=>1465,
"HRBSJW"=>1464,
"WUHXNN"=>1460,
"WNZYNT"=>1454,
"CTUSZX"=>1446,
"CSXPEK"=>1466,
"MDGPEK"=>1439,
"CSXTAO"=>1437,
"WUSPEK"=>1426,
"TNAHRB"=>1425,
"JUZPEK"=>1406,
"KHNTNA"=>1404,
"HETHLD"=>1402,
"XUZCAN"=>1400,
"KHNPEK"=>1398,
"PEKJMU"=>1398,
"CSXSYX"=>1398,
"HETCTU"=>1392,
"CANCTU"=>1390,
"KWLSHA"=>1389,
"PEKDYG"=>1385,
"SZXXUZ"=>1380,
"HAKWUH"=>1379,
"HETHLH"=>1372,
"DLCHEK"=>1372,
"SHEPVG"=>1364,
"NTGCAN"=>1363,
"CTUSJW"=>1357,
"CANKMG"=>1357,
"PEKLHW"=>1356,
"LAXPEK"=>1356,
"CSXTSN"=>1353,
"SHAXIY"=>1351,
"PVGXIY"=>1351,
"PVGSZX"=>1343,
"CGOSHE"=>1339,
"NGBPEK"=>1338,
"KWLNGB"=>1327,
"TYNDYG"=>1326,
"HLDTSN"=>1323,
"HLDPEK"=>1313,
"CGOXMN"=>1312,
"KHGURC"=>1311,
"CANSHA"=>1308,
"CGDPEK"=>1300,
"DYGTNA"=>1296,
"INCTAO"=>1295,
"CKGSZX"=>1290,
"JDZPEK"=>1290,
"HGHSWA"=>1280,
"WUSXIY"=>1275,
"KWEXMN"=>1268,
"INCWUH"=>1263,
"JGNXIY"=>1260,
"NGBTSN"=>1260,
"TYNXMN"=>1258,
"CANNKG"=>1255,
"CKGHAK"=>1253,
"CANCGO"=>1250,
"SJWCSX"=>1249,
"KMGSZX"=>1245,
"CGOWNZ"=>1245,
"YNTMDG"=>1239,
"SHATYN"=>1238,
"PVGTYN"=>1238,
"NGBSZX"=>1237,
"SZXXFN"=>1237,
"FOCHAK"=>1234,
"CSXTNA"=>1228,
"BAVSHE"=>1228,
"KMGXIY"=>1228,
"HGHXIY"=>1215,
"TAOXIY"=>1215,
"CTUINC"=>1207,
"HAKKHN"=>1204,
"XIYKWL"=>1204,
"HAKCGD"=>1204,
"HGHPEK"=>1200,
"PEKYNJ"=>1192,
"CGOFOC"=>1192,
"KWLNKG"=>1192,
"HFESZX"=>1191,
"HRBTSN"=>1190,
"CANNGB"=>1189,
"CANCKG"=>1188,
"CANXFN"=>1185,
"DLCHET"=>1184,
"TXNXIY"=>1183,
"HGHTYN"=>1180,
"MIGTYN"=>1180,
"HFESWA"=>1180,
"HGHSZX"=>1179,
"PEKSHA"=>1178,
"LYGXIY"=>1178,
"PEKPVG"=>1178,
"CSXTYN"=>1174,
"CTUTYN"=>1173,
"SHETYN"=>1171,
"DLCNGB"=>1170,
"TNAWNZ"=>1170,
"CKGINC"=>1163,
"KWESYX"=>1160,
"PVGTSN"=>1133,
"PEKWUH"=>1133,
"SHATSN"=>1133,
"HGHTSN"=>1133,
"SJWSHA"=>1130,
"CKGTYN"=>1129,
"CTUXNN"=>1124,
"CKGLHW"=>1117,
"CSXKMG"=>1116,
"CGDSHA"=>1111,
"SHAYIH"=>1111,
"HRBTAO"=>1111,
"DOYSHA"=>1110,
"CANYIW"=>1107,
"INCPEK"=>1107,
"CANHFE"=>1105,
"NKGXIY"=>1104,
"TAOWNZ"=>1102,
"CKGXNN"=>1100,
"CSXHAK"=>1100,
"HAKXMN"=>1100,
"HGHCAN"=>1099,
"YNTHRB"=>1093,
"HETTGO"=>1090,
"LHWTYN"=>1087,
"AQGPEK"=>1082,
"HETXNN"=>1082,
"TSNWUH"=>1082,
"PEKNDG"=>1080,
"XIYKHN"=>1078,
"DNHLHW"=>1068,
"CGONGB"=>1060,
"CZXTYN"=>1053,
"DLCPVG"=>1051,
"HETSHE"=>1051,
"WNZXFN"=>1051,
"CIHSHA"=>1050,
"DLCXIY"=>1050,
"CTUWUH"=>1047,
"HAKKMG"=>1046,
"SWASHA"=>1046,
"BHYCSX"=>1042,
"PEKXIY"=>1034,
"SZXYIH"=>1032,
"KWEXIY"=>1028,
"LHWCGO"=>1024,
"ENYWUH"=>1019,
"TAOWUH"=>1017,
"CZXPEK"=>1016,
"CANWNZ"=>1015,
"NNGCTU"=>1014,
"HRBPEK"=>1010,
"LYASHA"=>1009,
"SZXWNZ"=>1009,
"HEKSHE"=>1005,
"LYGWNZ"=>1000,
"CGOINC"=>1000,
"TSNXIY"=>993,
"CSXXIY"=>990,
"CGODLC"=>988,
"NKGPEK"=>981,
"CANYIH"=>980,
"CGOCKG"=>980,
"KOWWNZ"=>977,
"CTUKWL"=>975,
"SHESJW"=>974,
"NKGTYN"=>974,
"HRBSHP"=>963,
"HFEXIY"=>960,
"HFEPEK"=>959,
"AATYIN"=>955,
"LYAPVG"=>953,
"CANTXN"=>951,
"YNZWNZ"=>945,
"CSXCTU"=>940,
"SZXWUH"=>938,
"PEKJIL"=>935,
"CGQPEK"=>933,
"NKGXMN"=>929,
"KWEKHN"=>928,
"KWLSYX"=>926,
"KWESSZX"=>926,
"KWEWUH"=>925,
"KHGYIN"=>922,
"CSXENH"=>918,
"XIYXUZ"=>917,
"HAKLLF"=>915,
"HLHPEK"=>913,
"DLCTYN"=>913,
"HLDXIL"=>913,
"HAKKWE"=>910,
"WUHXMN"=>910,
"DLCNKG"=>910,
"HAKSWA"=>907,
"NKGTSN"=>907,
"HFETSN"=>906,
"WUAXIY"=>904,
"NGBSWA"=>902,
"TNASHE"=>900,
"TNAXIY"=>900,
"CGQTSN"=>900,
"HFEXMN"=>900,
"SWAWUH"=>900,
"HETXIY"=>894,
"TYNXUZ"=>893,
"CANDYG"=>890,
"TNAWUH"=>890,
"CKGLYA"=>882,
"KWLXMN"=>881,
"SHAXMN"=>878,
"WUHCAN"=>873,
"CANKWE"=>872,
"SJWWUH"=>872,
"CKGENY"=>870,
"CGKENY"=>870,
"TYNWUH"=>866,
"TYNWUA"=>866,
"JJNNKG"=>863,
"KMGKWL"=>859,
"CKGNNG"=>858,
"DLCHRB"=>857,
"SJWNKG"=>857,
"PEKUYN"=>857,
"CSXNNG"=>856,
"TYNXIL"=>853,
"TNASHA"=>852,
"TNAHGH"=>850,
"DNHURC"=>847,
"YNTSHA"=>846,
"CGOHGH"=>841,
"SYXSZX"=>837,
"INCSJW"=>833,
"CSXNGB"=>830,
"LZHWUH"=>830,
"ENYPEK"=>829,
"SHETSN"=>829,
"CGOCSX"=>828,
"NGBXMN"=>822,
"KHNKWL"=>820,
"CSXWNZ"=>810,
"HFETYN"=>808,
"SHAWEF"=>807,
"KWLSWA"=>802,
"CKGWUH"=>801,
"NGBTAO"=>800,
"KWLWUH"=>795,
"HGHTAO"=>792,
"KOWSHA"=>790,
"HYNWUH"=>788,
"DNHXNN"=>787,
"NKGYNT"=>787,
"LYAPEK"=>785,
"JJNNGB"=>780,
"FOCWUH"=>780,
"CANCGD"=>780,
"HAKKWL"=>773,
"KWEMIG"=>763,
"CANFOC"=>763,
"SHAWUH"=>761,
"DLCTSN"=>759,
"CGQTAO"=>759,
"NGBWUH"=>754,
"KHNSZX"=>753,
"LYINGB"=>750,
"AKUURC"=>750,
"KCACRC"=>750,
"CSXJJN"=>748,
"BAVLHW"=>747,
"CANSYX"=>747,
"XIYYIH"=>747,
"FOCNKG"=>747,
"HFEWNZ"=>745,
"DLCJIL"=>743,
"SJWDLC"=>741,
"WUHXIY"=>735,
"PEKTGO"=>735,
"KHVHRB"=>735,
"BAVXIY"=>734,
"CSXHFE"=>732,
"JZHXIY"=>732,
"FOCHFE"=>730,
"NNGCAN"=>728,
"XIYXNN"=>721,
"SHETAO"=>721,
"JGNLHW"=>718,
"LHAJGN"=>718,
"HGHXMN"=>717,
"KHNSHA"=>711,
"AQGXMN"=>710,
"TAOTYN"=>710,
"LYGPEK"=>710,
"FUGSHA"=>700,
"YINURC"=>700,
"CIHPEK"=>700,
"SJWXIY"=>696,
"CGOHET"=>695,
"CKGCSX"=>695,
"HRBHLD"=>695,
"DYGXIY"=>693,
"SHATAO"=>693,
"PEKCGO"=>690,
"JUZXMN"=>690,
"HFETAO"=>690,
"NNGZUH"=>689,
"BHYKWE"=>680,
"SHPTYN"=>680,
"CZXWNZ"=>667,
"KHNCAN"=>665,
"CSXSZX"=>658,
"HGHWUH"=>656,
"NKGWNZ"=>655,
"NNGSZX"=>651,
"CANWUS"=>650,
"PEKXUZ"=>650,
"CGQJMU"=>650,
"PEKSHE"=>649,
"SWAWNZ"=>649,
"CGODOY"=>649,
"CTUXIY"=>647,
"CGQDLC"=>647,
"PEKTAO"=>646,
"KHNPVG"=>644,
"CIHXIY"=>640,
"CIFHET"=>639,
"CGONKG"=>630,
"SHEMDG"=>630,
"HRBYNJ"=>630,
"JDZXMN"=>630,
"PEKWEF"=>630,
"CGOTSN"=>629,
"XMNZUH"=>629,
"FOCNGB"=>621,
"CSXCAN"=>620,
"JDZSHA"=>620,
"TXNWNZ"=>620,
"BHYCAN"=>606,
"CKGXIY"=>603,
"HAKSZX"=>603,
"WEFXUZ"=>603,
"XMNYIW"=>600,
"LZHCAN"=>595,
"MIGXIY"=>593,
"YNTSHE"=>593,
"KHNNGB"=>592,
"HYNXMN"=>585,
"INCTYN"=>585,
"KHNWNZ"=>583,
"DLCPEK"=>579,
"BAVPEK"=>579,
"NKGTNA"=>579,
"WNZXMN"=>577,
"PEKYNT"=>575,
"HEKHRB"=>574,
"DLCLYG"=>570,
"CANXMN"=>567,
"HGHXUZ"=>561,
"INCXIY"=>560,
"XIYICN"=>560,
"HRBSHE"=>556,
"SHALYG"=>556,
"LHWXIY"=>550,
"SZXXMN"=>549,
"CANHAK"=>548,
"YINKRL"=>542,
"KHNXMN"=>542,
"TYNXIY"=>537,
"SIATYN"=>537,
"CTUKWE"=>531,
"KWLSZX"=>525,
"PEKTYN"=>522,
"SHPSJW"=>520,
"CGOWUH"=>520,
"CKGDYG"=>519,
"FOCHGH"=>519,
"NKGWUH"=>504,
"HETXIL"=>501,
"HFENGB"=>501,
"KWENNG"=>500,
"XIYLHA"=>500,
"AQGSHA"=>500,
"XUZSHA"=>500,
"CGOHFE"=>486,
"UYNXIY"=>480,
"JILJMU"=>480,
"ENHWUH"=>479,
"TAOTSN"=>477,
"HFEHGH"=>476,
"CGOXIY"=>474,
"SWAFOC"=>472,
"IQNLHW"=>472,
"NNGWUZ"=>469,
"CSXKWL"=>462,
"PEKYNZ"=>462,
"DLUJHG"=>461,
"HAKZUH"=>460,
"ZHASZX"=>460,
"AKUKHG"=>454,
"ZHACAN"=>454,
"CANKWL"=>452,
"TCGURC"=>452,
"JHGKNG"=>450,
"AATURC"=>450,
"DOYPEK"=>450,
"KWEKMG"=>449,
"TXNWUH"=>448,
"WXNXIY"=>445,
"CSXTEN"=>444,
"HETPEK"=>444,
"GYSXIY"=>438,
"BHYKWL"=>435,
"TSNTYN"=>435,
"JNZPEK"=>430,
"HAKLZH"=>425,
"HAKWUZ"=>425,
"KWELZO"=>424,
"PEKXIL"=>421,
"HETWUA"=>420,
"DLCWEF"=>420,
"SHAWNZ"=>418,
"PVGWNZ"=>418,
"HGHWNZ"=>416,
"TNAYNT"=>415,
"CKGTEN"=>413,
"PEKTNA"=>412,
"HAKNNG"=>411,
"HETSJW"=>404,
"TSNYNT"=>402,
"KOWXMN"=>400,
"WEFWEH"=>395,
"CGOTNA"=>392,
"CTUWXN"=>382,
"SWACAN"=>380,
"CSXYIH"=>379,
"WEHTAO"=>376,
"NGBNKG"=>373,
"KRLURC"=>373,
"HRBJMU"=>372,
"ZHAZUH"=>371,
"FOCHYN"=>370,
"HETTYN"=>370,
"SYXZHA"=>367,
"PEKSJW"=>364,
"CSXLLF"=>361,
"LYAXIY"=>353,
"CGOTYN"=>346,
"KMGLJG"=>346,
"YNTCGO"=>346,
"CTUGYS"=>344,
"KHNWUH"=>343,
"CIFPEK"=>338,
"INCLHW"=>333,
"XUZYNZ"=>333,
"CSXWUH"=>332,
"DLCSHP"=>323,
"NGBTXN"=>320,
"HZGXIY"=>315,
"KHNKOW"=>314,
"CKGCTU"=>313,
"ENYXIY"=>312,
"NGBWNZ"=>309,
"ENYINC"=>300,
"AKUKCA"=>300,
"HRBMDG"=>300,
"KWETEN"=>291,
"WUHYIH"=>285,
"DLUKMG"=>262,
"ENHYIH"=>259,
"IQNXIY"=>259,
"CIHTYN"=>250,
"AOGDLC"=>250,
"HAKSYX"=>234,
"FOCXMN"=>219,
"AKAXIY"=>208,
"BHYHAK"=>205,
"AQGJDZ"=>204,
"NGBPVG"=>160,
"NGBSHA"=>160,
"HAKZHA"=>146,
"LYGXUZ"=>140
);
?>

@ -0,0 +1,110 @@
<?php
$lang['required'] = "%s";
$lang['valid_email'] = "%s";
$lang['max_length'] = "%s";
$lang['numeric'] = "%s";
$lang['ic_url_title'] = "链接标题是必填的.";
$lang['ic_title'] = "内容标题是必填的.";
$lang['ic_author'] = "信息作者是必填的.";
$lang['ic_url'] = "URL是必填的.";
$lang['ic_seo_title'] = 'SEO标题是必填的!';
$lang['ic_seo_keywords'] = 'SEO关键词是必填的!';
$lang['ic_seo_description'] = 'SEO描述是必填的但不能超过250个字符!';
$lang['ic_url_check'] = "URL重复请换一个";
$lang['ic_url_format'] = "URL格式不正确请检查是否包含空格、大写字符、多个中划线'--'";
$lang['form_info_success'] = "好吧,信息已经成功提交!";
$lang['form_info_error'] = "发生错误请立马联系YCC.";
$lang['structures_error_haschild'] = "发生错误,请先删除子节点.";
$lang['structures_error_notfound'] = "发生错误,没有找到此信息结构.";
$lang['structures_success_delete'] = "好吧,信息删除成功!";
$lang['structures_success_move'] = "好吧,信息移动成功!";
$lang['information_error_notchecked'] = "没有勾选需要修改的信息!";
$lang['login_user_code'] = "输入HT的用户名!";
$lang['login_password'] = "请输入密码!";
$lang['login_warning'] = "用户名和密码不正确请重新输入或者没有权限请联系YCC,电话08987705";
$lang['root_landscape_notfound'] = '城市的景点概述未找到!';
$lang['landscape_notfound'] = '这个景点找不到!';
$lang['seo_detail_not_found'] = 'SEO信息找不到';
$lang['seo_url'] = 'URL是必须的';
$lang['seo_h1'] = 'URL是必须的只允许50个字符';
$lang['seo_url_check'] = 'URL重复请搜索这个URL进行修改';
$lang['seo_save_success'] = '好吧SEO信息已经成功保存';
$lang['seo_delete_success'] = '删除成功!';
$lang['update_cache_success'] = '更新静态页面成功!';
$lang['update_cache_failed'] = '更新静态页面失败请联系YCC,电话08987705,<a href="%s" target="_blank">查看错误</a>';
$lang['update_cdn_failed'] = 'CDN更新失败';
$lang['update_cdn_success'] = 'CDN更新成功';
$lang['update_vps_failed'] = '前端更新失败!';
$lang['order_mail_title'] = '您的页面带来新的订单';
//项目模块
$lang['p_title'] = '项目标题必须填写';
$lang['p_bonus'] = '奖金只能填数字';
$lang['project_update_success'] = '项目更新成功';
$lang['project_create_success'] = '项目创建成功,等待跳转、、、';
//项目模块
$lang['media_save_success'] = '自定义配置保存成功!';
$lang['media_delete_success'] = '自定义配置删除成功!';
$lang['media_save_error'] = '提交自定义配置数据错误!';
$lang['t_title'] = '任务标题必须填写';
$lang['t_content'] = '任务要求必须填写';
$lang['t_expires'] = '任务截止日期必须填写';
$lang['task_success_submit'] = '好吧,任务信息提交成功';
$lang['ta_count'] = '字数必须填写,且只能输入数字';
$lang['ta_charge'] = '金额必须填写,且只能输入数字';
$lang['task_review_submit'] = '好吧,审核结果提交成功';
$lang['task_m_content'] = '短消息内容必须填写';
$lang['review_m_content'] = '好吧,审核备注必须填写';
$lang['task_error_notfound'] = '任务找不到请联系YCC';
$lang['task_error_no_permissions'] = '没有权限修改任务!';
$lang['task_delete_ok'] = '任务删除成功!';
$lang['author_review_submit'] = '好吧,审核结果提交成功';
$lang['author_title_submit'] = '好吧,职称修改成功';
$lang['publish_task_success'] = '好吧,任务发布成功!<a href="%s" target="_blank">点击查看</a>';
$lang['publish_task_failed'] = '任务发布失败请联系YCC,电话08987705';
$lang['task_complete_success'] = '任务结算成功!请刷新页面';
$lang['task_complete_notfound'] = '找不到任务!请勾选需要结算的任务';
$lang['send_sms_success'] = '发送短消息成功!';
$lang['author_email_new_task_subject'] = 'New Task,%s';
$lang['author_email_new_task_body'] = 'You have a new task on the China Highlights Content Management System. Please log in at <a href="http://a.cdnch.com/author.php" target="_blank">http://a.cdnch.com/author.php</a>';
$lang['author_email_new_task_body2'] = 'There is a new task on the China Highlights Content Management System. Click “Accept” before someone else does if you want it! Please log in at <a href="http://a.cdnch.com/author.php" target="_blank">a.cdnch.com</a> (if the task is not in the Task Hall, someone else has already taken it).';
$lang['author_email_review_task_failed_subject'] = 'Revision Required,%s';
$lang['author_email_review_task_failed_body'] = 'Your submission on the China Highlights Content Management System has been reviewed and requires revision. Please log in at <a href="http://a.cdnch.com/author.php" target="_blank">http://a.cdnch.com/author.php</a>';
$lang['author_email_review_task_success_subject'] = 'Submission Accepted,%s';
$lang['author_email_review_task_success_body'] = 'Your submission on the China Highlights Content Management System has been reviewed and accepted. See <a href="http://a.cdnch.com/author.php" target="_blank">http://a.cdnch.com/author.php</a>';
$lang['author_email_message_subject'] = 'Message,%s';
$lang['author_email_message_body'] = 'You have a new message on the China Highlights Content Management System. Please log in at <a href="http://a.cdnch.com/author.php" target="_blank">http://a.cdnch.com/author.php</a>';
//关键词管理
$lang['form_keyworlds_success'] = '关键词编辑成功!';
$lang['form_keyworlds_error'] = '关键词编辑失败!';
$lang['kw_keyworlds'] = '关键词';
$lang['kw_id'] = '关键词ID';
$lang['kw_is_id'] = '关键词树结构ID';
$lang['form_keyworlds_error'] = '删除失败';
//作者平台
$lang['signup_a_email'] = "Please fill in your email Address!";
$lang['signup_a_name'] = "Please fill in your name!";
$lang['a_bank'] = "Please fill in your bank name or paypal!";
$lang['a_bank_card'] = "Please fill in your bank account number or paypal number!";
$lang['setting_profile_success'] = "Your personal information has been set successfully.";

@ -0,0 +1,10 @@
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

@ -0,0 +1,258 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Accesscheck extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->model('infoAccessmanage_model','Access_model');
}
public function check_access($site_code='',$module=''){
$userdata=$this->session->userdata('session_admin');
//如果没有开启权限管理或者是超级管理员则拥有全部权限
if (!$this->config->item('check_access') or in_array(strtolower($userdata['OPI_Code']), $this->config->item('access_super_manage'))) {
return true;
}
if ($this->session->userdata('access_module') === false){
$this->init_accessdata();
}
//用户拥有权限de站点、模块&需要权限认证的模块
$access_module = $this->session->userdata('access_module');
$user_controller = $access_module['user_controller'];
$user_action = $access_module['user_action'];
$iaa_controller_list = $access_module['iaa_controller_list'];
$iaa_action_list = $access_module['iaa_action_list'];
$user_site_list = $this->session->userdata('access_sitecode');
//检测用户是否能访问当前站点,如果不能,则跳转到该用户有权限的站点
if($site_code=='')$site_code=$this->config->item('site_code');
if (false===stripos(',' . $user_site_list, $site_code)){
header('Location: '.$_SERVER['HTTP_REFERER']);
exit();
}
//判断当前操作是否需要认证
$flag=true;
if ($module!='') {
$module_array=explode('/', trim($module));
$this->router->class= $module_array[0];
$this->router->method= $module_array[1];
}
//判断当前模块是否需要认证
if (in_array($this->router->class, $iaa_controller_list)) {
//如果需要认证,判断是否有权限操作当前模块
if (in_array($this->router->class,$user_controller)) {
//判断是否能编辑不同省份信息
/*if($this->router->class=='province'){
$province=str_replace('/province/', '', $this->uri->uri_string());
$province=trim($province);
if (!isset($user_action[$this->router->class]) || !in_array($province, $user_action[$this->router->class])) {
$flag = false;//没有权限查看当前省份!
}
}
//判断当前方法是否需要认证
else*/
if (isset($iaa_action_list[$this->router->class]) && in_array($this->router->method, $iaa_action_list[$this->router->class])) {
//如果当前方法需要认证,则判断是否有权限
if (!isset($user_action[$this->router->class]) || !in_array($this->router->method, $user_action[$this->router->class])) {
$flag = false;//没有权限执行当前方法!
}
}
}else {
$flag = false;//没有权限执行当前控制器模块!
}
}
if ($module =='' && !$flag) {
redirect(site_url('Login/refuse'));
exit();
}
return $flag;
}
public function init_accessdata(){
$userdata=$this->session->userdata('session_admin');
//根据usercode获取用户角色、可读、可写列表
$user_access=$this->Access_model->get_user_access($userdata['OPI_Code'],$this->config->item('site_code'));
//根据角色字符串获取用户有权限的操作
$user_node=$this->Access_model->get_node_list($user_access->iao_role.'0');
//把用户拥有的所有角色id组装成一个数组集合
$node_str='';
foreach ($user_node as $node) {
$node_str.=$node->ian_iaa_id;
}
$node_array=explode(',', substr($node_str, 0,-1));
//用户拥有权限de站点、模块&需要权限认证的模块
$user_controller = array();
$user_action = array();
$iaa_controller_list = array();
$iaa_action_list = array();
//所有需要认证的模块、方法
$action_list=$this->Access_model->get_action_list();
foreach ($action_list as $a) {
//用户拥有的权限模块、方法
if (in_array($a->iaa_id, $node_array) && $a->iaa_controller!='') {
$user_controller[] = $a->iaa_controller;
$user_action[$a->iaa_controller][] = $a->iaa_action;
}
//需要认证的控制器和方法
if(!empty($a->iaa_controller))$iaa_controller_list[]=$a->iaa_controller;
if(!empty($a->iaa_action))$iaa_action_list[$a->iaa_controller][]=$a->iaa_action;
}
$access_module['user_controller'] = $user_controller;
$access_module['user_action'] = $user_action;
$access_module['iaa_controller_list'] = $iaa_controller_list;
$access_module['iaa_action_list'] = $iaa_action_list;
$this->session->set_userdata('access_read_list', $user_access->iao_read);
$this->session->set_userdata('access_write_list', $user_access->iao_write);
$this->session->set_userdata('access_sitecode', $this->Access_model->get_user_site_list($userdata['OPI_Code']));
$this->session->set_userdata('access_module', $access_module);
}
//获取角色等级(角色树形结构的等级)
public function get_role_level($site_code='',$author=''){
if (!$this->config->item('check_access')) {
return 1;
}
if ($author=='') {
$userdata=$this->session->userdata('session_admin');
$author=$userdata['OPI_Code'];
}
if($site_code=='')$site_code=$this->config->item('site_code');
$ownsite=$this->Access_model->get_user_access($author,$site_code);
if(isset($ownsite->iao_role) && !empty($ownsite->iao_role)){
$role_str='';
$role_str=substr(trim($ownsite->iao_role),0,-1);
$allrole = $this->Access_model->get_role($role_str);
$rolelevel=array();
foreach ($allrole as $r) {
$rolelevel[]=$r->is_level;
}
}
$level=100;
if(!empty($rolelevel))$level=min($rolelevel);
return($level);
}
//判断信息节点是可读还是可写 1:可写0只读
public function get_edit_type($is_path){
if (!$this->config->item('check_access')) {
return 1;
}
$write_list = trim($this->session->userdata('access_write_list'));
$read_list = trim($this->session->userdata('access_read_list'));
$is_path = trim($is_path);
$path_array = explode(',', $is_path);
//对全站拥有可写权限
if (empty($write_list) && empty($read_list)) {
return 1;
}
//对当前节点有可读权限
if ($read_list!='') {
$read_array = explode(',', $read_list);
if (array_intersect($path_array,$read_array)) {
return 0;
}
}
//对当前节点有可写权限
if ($write_list!='') {
$write_array = explode(',', $write_list);
if (array_intersect($path_array,$write_array)) {
return 1;
}
}
//如果是有权限的信息节点的父节点则给予可读权限
return 0;
}
//获取信息树形结构
public function get_info_structure($root_id){
$this->load->model('InfoStructures_model');
$this->load->model('Information_model');
//查询结构列表信息
$data['informationList'] = $this->Information_model->StructureList($root_id);
$ori_informationList=$data['informationList'];
if (!$this->config->item('check_access')) {
return $data['informationList'];
}
//权限处理
$write_list = trim($this->session->userdata('access_write_list'));
$read_list = trim($this->session->userdata('access_read_list'));
if(!empty($read_list))$read_list=$read_list.',';
$nodelist=$read_list.$write_list;
$nodelist=trim($nodelist);
if ($this->config->item('check_access') && !empty($nodelist)) {
$access_ids=explode(',',$nodelist);
$parent_id_str = '';
$flag=array();
$parent=array();
$parent_is_array=array();
//获取有权限的节点下的所有子节点
foreach ($data['informationList'] as $tree) {
$infopatharr=explode(',', trim($tree->is_path));
if (in_array($tree->is_id, $access_ids)) {
$parent_id_str .= $tree->is_path;
$parent_is_array[$tree->is_id] = $tree;
}elseif (array_intersect($infopatharr,$access_ids)) {
$flag[]=$tree;
}else{
$parent_is_array[$tree->is_id] = $tree;
}
}
//获取有权限的节点的父节点
$parent_id_array=explode(',', $parent_id_str);
$parent_id_array=array_unique($parent_id_array);
array_pop($parent_id_array);
foreach ($parent_id_array as $v) {
if (isset($parent_is_array[$v]))
$parent[] = $parent_is_array[$v];
}
//合并父节点和子节点数组
$data['informationList'] = $flag;
if (!empty($parent) and !empty($data['informationList'])) {
$data['informationList'] = array_merge($parent,$flag);
}else{
$data['informationList']=$parent;
}
}
elseif ($this->config->item('check_access') && empty($nodelist) && $this->get_role_level()>4)
{
$user_province=array();
$access_module = $this->session->userdata('access_module');
if(isset($access_module['user_action']['province']) && !empty($access_module['user_action']['province'])){
$user_province = $access_module['user_action']['province'];
$current_province = $this->Information_model->get_province_by_isid($root_id);
if ($current_province!==false && !in_array($current_province, $user_province)) {
return false;
}
}
}
//如果该信息不在可读可写列表里面,再检查是否在有权限的某一城市里面,
//若不在则表示没有权限访问当前信息模块
if (empty($data['informationList']))
{
$user_province = array();
$access_module = $this->session->userdata('access_module');
if(isset($access_module['user_action']['province']) && !empty($access_module['user_action']['province'])){
$user_province = $access_module['user_action']['province'];
}
$current_province = $this->Information_model->get_province_by_isid($root_id);
if ($current_province!==false && in_array($current_province, $user_province)) {
$data['informationList']=$ori_informationList;
}else{
return false;
}
}
return $data['informationList'];
}
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,471 @@
<?php
/*
* Copyright 2010 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Check for the json extension, the Google APIs PHP Client won't function
// without it.
if (! function_exists('json_decode')) {
throw new Exception('Google PHP API Client requires the JSON PHP extension');
}
if (! function_exists('http_build_query')) {
throw new Exception('Google PHP API Client requires http_build_query()');
}
if (! ini_get('date.timezone') && function_exists('date_default_timezone_set')) {
date_default_timezone_set('UTC');
}
// hack around with the include paths a bit so the library 'just works'
set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path());
require_once "config.php";
// If a local configuration file is found, merge it's values with the default configuration
if (file_exists(dirname(__FILE__) . '/local_config.php')) {
$defaultConfig = $apiConfig;
require_once (dirname(__FILE__) . '/local_config.php');
$apiConfig = array_merge($defaultConfig, $apiConfig);
}
// Include the top level classes, they each include their own dependencies
require_once 'service/Google_Model.php';
require_once 'service/Google_Service.php';
require_once 'service/Google_ServiceResource.php';
require_once 'auth/Google_AssertionCredentials.php';
require_once 'auth/Google_Signer.php';
require_once 'auth/Google_P12Signer.php';
require_once 'service/Google_BatchRequest.php';
require_once 'external/URITemplateParser.php';
require_once 'auth/Google_Auth.php';
require_once 'cache/Google_Cache.php';
require_once 'io/Google_IO.php';
require_once('service/Google_MediaFileUpload.php');
/**
* The Google API Client
* http://code.google.com/p/google-api-php-client/
*
* @author Chris Chabot <chabotc@google.com>
* @author Chirag Shah <chirags@google.com>
*/
class Google_Client {
/**
* @static
* @var Google_Auth $auth
*/
static $auth;
/**
* @static
* @var Google_IO $io
*/
static $io;
/**
* @static
* @var Google_Cache $cache
*/
static $cache;
/**
* @static
* @var boolean $useBatch
*/
static $useBatch = false;
/** @var array $scopes */
protected $scopes = array();
/** @var bool $useObjects */
protected $useObjects = false;
// definitions of services that are discovered.
protected $services = array();
// Used to track authenticated state, can't discover services after doing authenticate()
private $authenticated = false;
public function __construct($config = array()) {
global $apiConfig;
$apiConfig = array_merge($apiConfig, $config);
self::$cache = new $apiConfig['cacheClass']();
self::$auth = new $apiConfig['authClass']();
self::$io = new $apiConfig['ioClass']();
}
/**
* Add a service
*/
public function addService($service, $version = false) {
global $apiConfig;
if ($this->authenticated) {
throw new Google_Exception('Cant add services after having authenticated');
}
$this->services[$service] = array();
if (isset($apiConfig['services'][$service])) {
// Merge the service descriptor with the default values
$this->services[$service] = array_merge($this->services[$service], $apiConfig['services'][$service]);
}
}
public function authenticate($code = null) {
$service = $this->prepareService();
$this->authenticated = true;
return self::$auth->authenticate($service, $code);
}
/**
* @return array
* @visible For Testing
*/
public function prepareService() {
$service = array();
$scopes = array();
if ($this->scopes) {
$scopes = $this->scopes;
} else {
foreach ($this->services as $key => $val) {
if (isset($val['scope'])) {
if (is_array($val['scope'])) {
$scopes = array_merge($val['scope'], $scopes);
} else {
$scopes[] = $val['scope'];
}
} else {
$scopes[] = 'https://www.googleapis.com/auth/' . $key;
}
unset($val['discoveryURI']);
unset($val['scope']);
$service = array_merge($service, $val);
}
}
$service['scope'] = implode(' ', $scopes);
return $service;
}
/**
* Set the OAuth 2.0 access token using the string that resulted from calling authenticate()
* or Google_Client#getAccessToken().
* @param string $accessToken JSON encoded string containing in the following format:
* {"access_token":"TOKEN", "refresh_token":"TOKEN", "token_type":"Bearer",
* "expires_in":3600, "id_token":"TOKEN", "created":1320790426}
*/
public function setAccessToken($accessToken) {
if ($accessToken == null || 'null' == $accessToken) {
$accessToken = null;
}
self::$auth->setAccessToken($accessToken);
}
/**
* Set the type of Auth class the client should use.
* @param string $authClassName
*/
public function setAuthClass($authClassName) {
self::$auth = new $authClassName();
}
/**
* Construct the OAuth 2.0 authorization request URI.
* @return string
*/
public function createAuthUrl() {
$service = $this->prepareService();
return self::$auth->createAuthUrl($service['scope']);
}
/**
* Get the OAuth 2.0 access token.
* @return string $accessToken JSON encoded string in the following format:
* {"access_token":"TOKEN", "refresh_token":"TOKEN", "token_type":"Bearer",
* "expires_in":3600,"id_token":"TOKEN", "created":1320790426}
*/
public function getAccessToken() {
$token = self::$auth->getAccessToken();
return (null == $token || 'null' == $token) ? null : $token;
}
/**
* Returns if the access_token is expired.
* @return bool Returns True if the access_token is expired.
*/
public function isAccessTokenExpired() {
return self::$auth->isAccessTokenExpired();
}
/**
* Set the developer key to use, these are obtained through the API Console.
* @see http://code.google.com/apis/console-help/#generatingdevkeys
* @param string $developerKey
*/
public function setDeveloperKey($developerKey) {
self::$auth->setDeveloperKey($developerKey);
}
/**
* Set OAuth 2.0 "state" parameter to achieve per-request customization.
* @see http://tools.ietf.org/html/draft-ietf-oauth-v2-22#section-3.1.2.2
* @param string $state
*/
public function setState($state) {
self::$auth->setState($state);
}
/**
* @param string $accessType Possible values for access_type include:
* {@code "offline"} to request offline access from the user. (This is the default value)
* {@code "online"} to request online access from the user.
*/
public function setAccessType($accessType) {
self::$auth->setAccessType($accessType);
}
/**
* @param string $approvalPrompt Possible values for approval_prompt include:
* {@code "force"} to force the approval UI to appear. (This is the default value)
* {@code "auto"} to request auto-approval when possible.
*/
public function setApprovalPrompt($approvalPrompt) {
self::$auth->setApprovalPrompt($approvalPrompt);
}
/**
* Set the application name, this is included in the User-Agent HTTP header.
* @param string $applicationName
*/
public function setApplicationName($applicationName) {
global $apiConfig;
$apiConfig['application_name'] = $applicationName;
}
/**
* Set the OAuth 2.0 Client ID.
* @param string $clientId
*/
public function setClientId($clientId) {
global $apiConfig;
$apiConfig['oauth2_client_id'] = $clientId;
self::$auth->clientId = $clientId;
}
/**
* Get the OAuth 2.0 Client ID.
*/
public function getClientId() {
return self::$auth->clientId;
}
/**
* Set the OAuth 2.0 Client Secret.
* @param string $clientSecret
*/
public function setClientSecret($clientSecret) {
global $apiConfig;
$apiConfig['oauth2_client_secret'] = $clientSecret;
self::$auth->clientSecret = $clientSecret;
}
/**
* Get the OAuth 2.0 Client Secret.
*/
public function getClientSecret() {
return self::$auth->clientSecret;
}
/**
* Set the OAuth 2.0 Redirect URI.
* @param string $redirectUri
*/
public function setRedirectUri($redirectUri) {
global $apiConfig;
$apiConfig['oauth2_redirect_uri'] = $redirectUri;
self::$auth->redirectUri = $redirectUri;
}
/**
* Get the OAuth 2.0 Redirect URI.
*/
public function getRedirectUri() {
return self::$auth->redirectUri;
}
/**
* Fetches a fresh OAuth 2.0 access token with the given refresh token.
* @param string $refreshToken
* @return void
*/
public function refreshToken($refreshToken) {
self::$auth->refreshToken($refreshToken);
}
/**
* Revoke an OAuth2 access token or refresh token. This method will revoke the current access
* token, if a token isn't provided.
* @throws Google_AuthException
* @param string|null $token The token (access token or a refresh token) that should be revoked.
* @return boolean Returns True if the revocation was successful, otherwise False.
*/
public function revokeToken($token = null) {
self::$auth->revokeToken($token);
}
/**
* Verify an id_token. This method will verify the current id_token, if one
* isn't provided.
* @throws Google_AuthException
* @param string|null $token The token (id_token) that should be verified.
* @return Google_LoginTicket Returns an apiLoginTicket if the verification was
* successful.
*/
public function verifyIdToken($token = null) {
return self::$auth->verifyIdToken($token);
}
/**
* @param Google_AssertionCredentials $creds
* @return void
*/
public function setAssertionCredentials(Google_AssertionCredentials $creds) {
self::$auth->setAssertionCredentials($creds);
}
/**
* This function allows you to overrule the automatically generated scopes,
* so that you can ask for more or less permission in the auth flow
* Set this before you call authenticate() though!
* @param array $scopes, ie: array('https://www.googleapis.com/auth/plus.me', 'https://www.googleapis.com/auth/moderator')
*/
public function setScopes($scopes) {
$this->scopes = is_string($scopes) ? explode(" ", $scopes) : $scopes;
}
/**
* Returns the list of scopes set on the client
* @return array the list of scopes
*
*/
public function getScopes() {
return $this->scopes;
}
/**
* If 'plus.login' is included in the list of requested scopes, you can use
* this method to define types of app activities that your app will write.
* You can find a list of available types here:
* @link https://developers.google.com/+/api/moment-types
*
* @param array $requestVisibleActions Array of app activity types
*/
public function setRequestVisibleActions($requestVisibleActions) {
self::$auth->requestVisibleActions =
join(" ", $requestVisibleActions);
}
/**
* Declare if objects should be returned by the api service classes.
*
* @param boolean $useObjects True if objects should be returned by the service classes.
* False if associative arrays should be returned (default behavior).
* @experimental
*/
public function setUseObjects($useObjects) {
global $apiConfig;
$apiConfig['use_objects'] = $useObjects;
}
/**
* Declare if objects should be returned by the api service classes.
*
* @param boolean $useBatch True if the experimental batch support should
* be enabled. Defaults to False.
* @experimental
*/
public function setUseBatch($useBatch) {
self::$useBatch = $useBatch;
}
/**
* @static
* @return Google_Auth the implementation of apiAuth.
*/
public static function getAuth() {
return Google_Client::$auth;
}
/**
* @static
* @return Google_IO the implementation of apiIo.
*/
public static function getIo() {
return Google_Client::$io;
}
/**
* @return Google_Cache the implementation of apiCache.
*/
public function getCache() {
return Google_Client::$cache;
}
}
// Exceptions that the Google PHP API Library can throw
class Google_Exception extends Exception {}
class Google_AuthException extends Google_Exception {}
class Google_CacheException extends Google_Exception {}
class Google_IOException extends Google_Exception {}
class Google_ServiceException extends Google_Exception {
/**
* Optional list of errors returned in a JSON body of an HTTP error response.
*/
protected $errors = array();
/**
* Override default constructor to add ability to set $errors.
*
* @param string $message
* @param int $code
* @param Exception|null $previous
* @param [{string, string}] errors List of errors returned in an HTTP
* response. Defaults to [].
*/
public function __construct($message, $code = 0, Exception $previous = null,
$errors = array()) {
if(version_compare(PHP_VERSION, '5.3.0') >= 0) {
parent::__construct($message, $code, $previous);
} else {
parent::__construct($message, $code);
}
$this->errors = $errors;
}
/**
* An example of the possible errors returned.
*
* {
* "domain": "global",
* "reason": "authError",
* "message": "Invalid Credentials",
* "locationType": "header",
* "location": "Authorization",
* }
*
* @return [{string, string}] List of errors return in an HTTP response or [].
*/
public function getErrors() {
return $this->errors;
}
}

@ -0,0 +1,103 @@
<?php
/*
* Copyright 2012 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Credentials object used for OAuth 2.0 Signed JWT assertion grants.
*
* @author Chirag Shah <chirags@google.com>
*/
class Google_AssertionCredentials {
const MAX_TOKEN_LIFETIME_SECS = 3600;
public $serviceAccountName;
public $scopes;
public $privateKey;
public $privateKeyPassword;
public $assertionType;
public $sub;
/**
* @deprecated
* @link http://tools.ietf.org/html/draft-ietf-oauth-json-web-token-06
*/
public $prn;
/**
* @param $serviceAccountName
* @param $scopes array List of scopes
* @param $privateKey
* @param string $privateKeyPassword
* @param string $assertionType
* @param bool|string $sub The email address of the user for which the
* application is requesting delegated access.
*/
public function __construct(
$serviceAccountName,
$scopes,
$privateKey,
$privateKeyPassword = 'notasecret',
$assertionType = 'http://oauth.net/grant_type/jwt/1.0/bearer',
$sub = false) {
$this->serviceAccountName = $serviceAccountName;
$this->scopes = is_string($scopes) ? $scopes : implode(' ', $scopes);
$this->privateKey = $privateKey;
$this->privateKeyPassword = $privateKeyPassword;
$this->assertionType = $assertionType;
$this->sub = $sub;
$this->prn = $sub;
}
public function generateAssertion() {
$now = time();
$jwtParams = array(
'aud' => Google_OAuth2::OAUTH2_TOKEN_URI,
'scope' => $this->scopes,
'iat' => $now,
'exp' => $now + self::MAX_TOKEN_LIFETIME_SECS,
'iss' => $this->serviceAccountName,
);
if ($this->sub !== false) {
$jwtParams['sub'] = $this->sub;
} else if ($this->prn !== false) {
$jwtParams['prn'] = $this->prn;
}
return $this->makeSignedJwt($jwtParams);
}
/**
* Creates a signed JWT.
* @param array $payload
* @return string The signed JWT.
*/
private function makeSignedJwt($payload) {
$header = array('typ' => 'JWT', 'alg' => 'RS256');
$segments = array(
Google_Utils::urlSafeB64Encode(json_encode($header)),
Google_Utils::urlSafeB64Encode(json_encode($payload))
);
$signingInput = implode('.', $segments);
$signer = new Google_P12Signer($this->privateKey, $this->privateKeyPassword);
$signature = $signer->sign($signingInput);
$segments[] = Google_Utils::urlSafeB64Encode($signature);
return implode(".", $segments);
}
}

@ -0,0 +1,36 @@
<?php
/*
* Copyright 2010 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require_once "Google_AuthNone.php";
require_once "Google_OAuth2.php";
/**
* Abstract class for the Authentication in the API client
* @author Chris Chabot <chabotc@google.com>
*
*/
abstract class Google_Auth {
abstract public function authenticate($service);
abstract public function sign(Google_HttpRequest $request);
abstract public function createAuthUrl($scope);
abstract public function getAccessToken();
abstract public function setAccessToken($accessToken);
abstract public function setDeveloperKey($developerKey);
abstract public function refreshToken($refreshToken);
abstract public function revokeToken();
}

@ -0,0 +1,48 @@
<?php
/*
* Copyright 2010 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Do-nothing authentication implementation, use this if you want to make un-authenticated calls
* @author Chris Chabot <chabotc@google.com>
* @author Chirag Shah <chirags@google.com>
*/
class Google_AuthNone extends Google_Auth {
public $key = null;
public function __construct() {
global $apiConfig;
if (!empty($apiConfig['developer_key'])) {
$this->setDeveloperKey($apiConfig['developer_key']);
}
}
public function setDeveloperKey($key) {$this->key = $key;}
public function authenticate($service) {/*noop*/}
public function setAccessToken($accessToken) {/* noop*/}
public function getAccessToken() {return null;}
public function createAuthUrl($scope) {return null;}
public function refreshToken($refreshToken) {/* noop*/}
public function revokeToken() {/* noop*/}
public function sign(Google_HttpRequest $request) {
if ($this->key) {
$request->setUrl($request->getUrl() . ((strpos($request->getUrl(), '?') === false) ? '?' : '&')
. 'key='.urlencode($this->key));
}
return $request;
}
}

@ -0,0 +1,63 @@
<?php
/*
* Copyright 2011 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Class to hold information about an authenticated login.
*
* @author Brian Eaton <beaton@google.com>
*/
class Google_LoginTicket {
const USER_ATTR = "id";
// Information from id token envelope.
private $envelope;
// Information from id token payload.
private $payload;
/**
* Creates a user based on the supplied token.
*
* @param string $envelope Header from a verified authentication token.
* @param string $payload Information from a verified authentication token.
*/
public function __construct($envelope, $payload) {
$this->envelope = $envelope;
$this->payload = $payload;
}
/**
* Returns the numeric identifier for the user.
* @throws Google_AuthException
* @return
*/
public function getUserId() {
if (array_key_exists(self::USER_ATTR, $this->payload)) {
return $this->payload[self::USER_ATTR];
}
throw new Google_AuthException("No user_id in token");
}
/**
* Returns attributes from the login ticket. This can contain
* various information about the user session.
* @return array
*/
public function getAttributes() {
return array("envelope" => $this->envelope, "payload" => $this->payload);
}
}

@ -0,0 +1,453 @@
<?php
/*
* Copyright 2008 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require_once "Google_Verifier.php";
require_once "Google_LoginTicket.php";
require_once "service/Google_Utils.php";
/**
* Authentication class that deals with the OAuth 2 web-server authentication flow
*
* @author Chris Chabot <chabotc@google.com>
* @author Chirag Shah <chirags@google.com>
*
*/
class Google_OAuth2 extends Google_Auth {
public $clientId;
public $clientSecret;
public $developerKey;
public $token;
public $redirectUri;
public $state;
public $accessType = 'offline';
public $approvalPrompt = 'force';
public $requestVisibleActions;
/** @var Google_AssertionCredentials $assertionCredentials */
public $assertionCredentials;
const OAUTH2_REVOKE_URI = 'https://accounts.google.com/o/oauth2/revoke';
const OAUTH2_TOKEN_URI = 'https://accounts.google.com/o/oauth2/token';
const OAUTH2_AUTH_URL = 'https://accounts.google.com/o/oauth2/auth';
const OAUTH2_FEDERATED_SIGNON_CERTS_URL = 'https://www.googleapis.com/oauth2/v1/certs';
const CLOCK_SKEW_SECS = 300; // five minutes in seconds
const AUTH_TOKEN_LIFETIME_SECS = 300; // five minutes in seconds
const MAX_TOKEN_LIFETIME_SECS = 86400; // one day in seconds
/**
* Instantiates the class, but does not initiate the login flow, leaving it
* to the discretion of the caller (which is done by calling authenticate()).
*/
public function __construct() {
global $apiConfig;
if (! empty($apiConfig['developer_key'])) {
$this->developerKey = $apiConfig['developer_key'];
}
if (! empty($apiConfig['oauth2_client_id'])) {
$this->clientId = $apiConfig['oauth2_client_id'];
}
if (! empty($apiConfig['oauth2_client_secret'])) {
$this->clientSecret = $apiConfig['oauth2_client_secret'];
}
if (! empty($apiConfig['oauth2_redirect_uri'])) {
$this->redirectUri = $apiConfig['oauth2_redirect_uri'];
}
if (! empty($apiConfig['oauth2_access_type'])) {
$this->accessType = $apiConfig['oauth2_access_type'];
}
if (! empty($apiConfig['oauth2_approval_prompt'])) {
$this->approvalPrompt = $apiConfig['oauth2_approval_prompt'];
}
}
/**
* @param $service
* @param string|null $code
* @throws Google_AuthException
* @return string
*/
public function authenticate($service, $code = null) {
if (!$code && isset($_GET['code'])) {
$code = $_GET['code'];
}
if ($code) {
// We got here from the redirect from a successful authorization grant, fetch the access token
$request = Google_Client::$io->makeRequest(new Google_HttpRequest(self::OAUTH2_TOKEN_URI, 'POST', array(), array(
'code' => $code,
'grant_type' => 'authorization_code',
'redirect_uri' => $this->redirectUri,
'client_id' => $this->clientId,
'client_secret' => $this->clientSecret
)));
if ($request->getResponseHttpCode() == 200) {
$this->setAccessToken($request->getResponseBody());
$this->token['created'] = time();
return $this->getAccessToken();
} else {
$response = $request->getResponseBody();
$decodedResponse = json_decode($response, true);
if ($decodedResponse != null && $decodedResponse['error']) {
$response = $decodedResponse['error'];
}
throw new Google_AuthException("Error fetching OAuth2 access token, message: '$response'", $request->getResponseHttpCode());
}
}
$authUrl = $this->createAuthUrl($service['scope']);
header('Location: ' . $authUrl);
return true;
}
/**
* Create a URL to obtain user authorization.
* The authorization endpoint allows the user to first
* authenticate, and then grant/deny the access request.
* @param string $scope The scope is expressed as a list of space-delimited strings.
* @return string
*/
public function createAuthUrl($scope) {
$params = array(
'response_type=code',
'redirect_uri=' . urlencode($this->redirectUri),
'client_id=' . urlencode($this->clientId),
'scope=' . urlencode($scope),
'access_type=' . urlencode($this->accessType),
'approval_prompt=' . urlencode($this->approvalPrompt),
);
// if the list of scopes contains plus.login, add request_visible_actions
// to auth URL
if(strpos($scope, 'plus.login') && count($this->requestVisibleActions) > 0) {
$params[] = 'request_visible_actions=' .
urlencode($this->requestVisibleActions);
}
if (isset($this->state)) {
$params[] = 'state=' . urlencode($this->state);
}
$params = implode('&', $params);
return self::OAUTH2_AUTH_URL . "?$params";
}
/**
* @param string $token
* @throws Google_AuthException
*/
public function setAccessToken($token) {
$token = json_decode($token, true);
if ($token == null) {
throw new Google_AuthException('Could not json decode the token');
}
if (! isset($token['access_token'])) {
throw new Google_AuthException("Invalid token format");
}
$this->token = $token;
}
public function getAccessToken() {
return json_encode($this->token);
}
public function setDeveloperKey($developerKey) {
$this->developerKey = $developerKey;
}
public function setState($state) {
$this->state = $state;
}
public function setAccessType($accessType) {
$this->accessType = $accessType;
}
public function setApprovalPrompt($approvalPrompt) {
$this->approvalPrompt = $approvalPrompt;
}
public function setAssertionCredentials(Google_AssertionCredentials $creds) {
$this->assertionCredentials = $creds;
}
/**
* Include an accessToken in a given apiHttpRequest.
* @param Google_HttpRequest $request
* @return Google_HttpRequest
* @throws Google_AuthException
*/
public function sign(Google_HttpRequest $request) {
// add the developer key to the request before signing it
if ($this->developerKey) {
$requestUrl = $request->getUrl();
$requestUrl .= (strpos($request->getUrl(), '?') === false) ? '?' : '&';
$requestUrl .= 'key=' . urlencode($this->developerKey);
$request->setUrl($requestUrl);
}
// Cannot sign the request without an OAuth access token.
if (null == $this->token && null == $this->assertionCredentials) {
return $request;
}
// Check if the token is set to expire in the next 30 seconds
// (or has already expired).
if ($this->isAccessTokenExpired()) {
if ($this->assertionCredentials) {
$this->refreshTokenWithAssertion();
} else {
if (! array_key_exists('refresh_token', $this->token)) {
throw new Google_AuthException("The OAuth 2.0 access token has expired, "
. "and a refresh token is not available. Refresh tokens are not "
. "returned for responses that were auto-approved.");
}
$this->refreshToken($this->token['refresh_token']);
}
}
// Add the OAuth2 header to the request
$request->setRequestHeaders(
array('Authorization' => 'Bearer ' . $this->token['access_token'])
);
return $request;
}
/**
* Fetches a fresh access token with the given refresh token.
* @param string $refreshToken
* @return void
*/
public function refreshToken($refreshToken) {
$this->refreshTokenRequest(array(
'client_id' => $this->clientId,
'client_secret' => $this->clientSecret,
'refresh_token' => $refreshToken,
'grant_type' => 'refresh_token'
));
}
/**
* Fetches a fresh access token with a given assertion token.
* @param Google_AssertionCredentials $assertionCredentials optional.
* @return void
*/
public function refreshTokenWithAssertion($assertionCredentials = null) {
if (!$assertionCredentials) {
$assertionCredentials = $this->assertionCredentials;
}
$this->refreshTokenRequest(array(
'grant_type' => 'assertion',
'assertion_type' => $assertionCredentials->assertionType,
'assertion' => $assertionCredentials->generateAssertion(),
));
}
private function refreshTokenRequest($params) {
$http = new Google_HttpRequest(self::OAUTH2_TOKEN_URI, 'POST', array(), $params);
$request = Google_Client::$io->makeRequest($http);
$code = $request->getResponseHttpCode();
$body = $request->getResponseBody();
if (200 == $code) {
$token = json_decode($body, true);
if ($token == null) {
throw new Google_AuthException("Could not json decode the access token");
}
if (! isset($token['access_token']) || ! isset($token['expires_in'])) {
throw new Google_AuthException("Invalid token format");
}
$this->token['access_token'] = $token['access_token'];
$this->token['expires_in'] = $token['expires_in'];
$this->token['created'] = time();
} else {
throw new Google_AuthException("Error refreshing the OAuth2 token, message: '$body'", $code);
}
}
/**
* Revoke an OAuth2 access token or refresh token. This method will revoke the current access
* token, if a token isn't provided.
* @throws Google_AuthException
* @param string|null $token The token (access token or a refresh token) that should be revoked.
* @return boolean Returns True if the revocation was successful, otherwise False.
*/
public function revokeToken($token = null) {
if (!$token) {
$token = $this->token['access_token'];
}
$request = new Google_HttpRequest(self::OAUTH2_REVOKE_URI, 'POST', array(), "token=$token");
$response = Google_Client::$io->makeRequest($request);
$code = $response->getResponseHttpCode();
if ($code == 200) {
$this->token = null;
return true;
}
return false;
}
/**
* Returns if the access_token is expired.
* @return bool Returns True if the access_token is expired.
*/
public function isAccessTokenExpired() {
if (null == $this->token) {
return true;
}
// If the token is set to expire in the next 30 seconds.
$expired = ($this->token['created']
+ ($this->token['expires_in'] - 30)) < time();
return $expired;
}
// Gets federated sign-on certificates to use for verifying identity tokens.
// Returns certs as array structure, where keys are key ids, and values
// are PEM encoded certificates.
private function getFederatedSignOnCerts() {
// This relies on makeRequest caching certificate responses.
$request = Google_Client::$io->makeRequest(new Google_HttpRequest(
self::OAUTH2_FEDERATED_SIGNON_CERTS_URL));
if ($request->getResponseHttpCode() == 200) {
$certs = json_decode($request->getResponseBody(), true);
if ($certs) {
return $certs;
}
}
throw new Google_AuthException(
"Failed to retrieve verification certificates: '" .
$request->getResponseBody() . "'.",
$request->getResponseHttpCode());
}
/**
* Verifies an id token and returns the authenticated apiLoginTicket.
* Throws an exception if the id token is not valid.
* The audience parameter can be used to control which id tokens are
* accepted. By default, the id token must have been issued to this OAuth2 client.
*
* @param $id_token
* @param $audience
* @return Google_LoginTicket
*/
public function verifyIdToken($id_token = null, $audience = null) {
if (!$id_token) {
$id_token = $this->token['id_token'];
}
$certs = $this->getFederatedSignonCerts();
if (!$audience) {
$audience = $this->clientId;
}
return $this->verifySignedJwtWithCerts($id_token, $certs, $audience);
}
// Verifies the id token, returns the verified token contents.
// Visible for testing.
function verifySignedJwtWithCerts($jwt, $certs, $required_audience) {
$segments = explode(".", $jwt);
if (count($segments) != 3) {
throw new Google_AuthException("Wrong number of segments in token: $jwt");
}
$signed = $segments[0] . "." . $segments[1];
$signature = Google_Utils::urlSafeB64Decode($segments[2]);
// Parse envelope.
$envelope = json_decode(Google_Utils::urlSafeB64Decode($segments[0]), true);
if (!$envelope) {
throw new Google_AuthException("Can't parse token envelope: " . $segments[0]);
}
// Parse token
$json_body = Google_Utils::urlSafeB64Decode($segments[1]);
$payload = json_decode($json_body, true);
if (!$payload) {
throw new Google_AuthException("Can't parse token payload: " . $segments[1]);
}
// Check signature
$verified = false;
foreach ($certs as $keyName => $pem) {
$public_key = new Google_PemVerifier($pem);
if ($public_key->verify($signed, $signature)) {
$verified = true;
break;
}
}
if (!$verified) {
throw new Google_AuthException("Invalid token signature: $jwt");
}
// Check issued-at timestamp
$iat = 0;
if (array_key_exists("iat", $payload)) {
$iat = $payload["iat"];
}
if (!$iat) {
throw new Google_AuthException("No issue time in token: $json_body");
}
$earliest = $iat - self::CLOCK_SKEW_SECS;
// Check expiration timestamp
$now = time();
$exp = 0;
if (array_key_exists("exp", $payload)) {
$exp = $payload["exp"];
}
if (!$exp) {
throw new Google_AuthException("No expiration time in token: $json_body");
}
if ($exp >= $now + self::MAX_TOKEN_LIFETIME_SECS) {
throw new Google_AuthException(
"Expiration time too far in future: $json_body");
}
$latest = $exp + self::CLOCK_SKEW_SECS;
if ($now < $earliest) {
throw new Google_AuthException(
"Token used too early, $now < $earliest: $json_body");
}
if ($now > $latest) {
throw new Google_AuthException(
"Token used too late, $now > $latest: $json_body");
}
// TODO(beaton): check issuer field?
// Check audience
$aud = $payload["aud"];
if ($aud != $required_audience) {
throw new Google_AuthException("Wrong recipient, $aud != $required_audience: $json_body");
}
// All good.
return new Google_LoginTicket($envelope, $payload);
}
}

@ -0,0 +1,70 @@
<?php
/*
* Copyright 2011 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Signs data.
*
* Only used for testing.
*
* @author Brian Eaton <beaton@google.com>
*/
class Google_P12Signer extends Google_Signer {
// OpenSSL private key resource
private $privateKey;
// Creates a new signer from a .p12 file.
function __construct($p12, $password) {
if (!function_exists('openssl_x509_read')) {
throw new Exception(
'The Google PHP API library needs the openssl PHP extension');
}
// This throws on error
$certs = array();
if (!openssl_pkcs12_read($p12, $certs, $password)) {
throw new Google_AuthException("Unable to parse the p12 file. " .
"Is this a .p12 file? Is the password correct? OpenSSL error: " .
openssl_error_string());
}
// TODO(beaton): is this part of the contract for the openssl_pkcs12_read
// method? What happens if there are multiple private keys? Do we care?
if (!array_key_exists("pkey", $certs) || !$certs["pkey"]) {
throw new Google_AuthException("No private key found in p12 file.");
}
$this->privateKey = openssl_pkey_get_private($certs["pkey"]);
if (!$this->privateKey) {
throw new Google_AuthException("Unable to load private key in ");
}
}
function __destruct() {
if ($this->privateKey) {
openssl_pkey_free($this->privateKey);
}
}
function sign($data) {
if(version_compare(PHP_VERSION, '5.3.0') < 0) {
throw new Google_AuthException(
"PHP 5.3.0 or higher is required to use service accounts.");
}
if (!openssl_sign($data, $signature, $this->privateKey, "sha256")) {
throw new Google_AuthException("Unable to sign data");
}
return $signature;
}
}

@ -0,0 +1,66 @@
<?php
/*
* Copyright 2011 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Verifies signatures using PEM encoded certificates.
*
* @author Brian Eaton <beaton@google.com>
*/
class Google_PemVerifier extends Google_Verifier {
private $publicKey;
/**
* Constructs a verifier from the supplied PEM-encoded certificate.
*
* $pem: a PEM encoded certificate (not a file).
* @param $pem
* @throws Google_AuthException
* @throws Google_Exception
*/
function __construct($pem) {
if (!function_exists('openssl_x509_read')) {
throw new Google_Exception('Google API PHP client needs the openssl PHP extension');
}
$this->publicKey = openssl_x509_read($pem);
if (!$this->publicKey) {
throw new Google_AuthException("Unable to parse PEM: $pem");
}
}
function __destruct() {
if ($this->publicKey) {
openssl_x509_free($this->publicKey);
}
}
/**
* Verifies the signature on data.
*
* Returns true if the signature is valid, false otherwise.
* @param $data
* @param $signature
* @throws Google_AuthException
* @return bool
*/
function verify($data, $signature) {
$status = openssl_verify($data, $signature, $this->publicKey, "sha256");
if ($status === -1) {
throw new Google_AuthException('Signature verification error: ' . openssl_error_string());
}
return $status === 1;
}
}

@ -0,0 +1,30 @@
<?php
/*
* Copyright 2011 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require_once "Google_P12Signer.php";
/**
* Signs data.
*
* @author Brian Eaton <beaton@google.com>
*/
abstract class Google_Signer {
/**
* Signs data, returns the signature as binary data.
*/
abstract public function sign($data);
}

@ -0,0 +1,31 @@
<?php
/*
* Copyright 2011 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require_once "Google_PemVerifier.php";
/**
* Verifies signatures.
*
* @author Brian Eaton <beaton@google.com>
*/
abstract class Google_Verifier {
/**
* Checks a signature, returns true if the signature is correct,
* false otherwise.
*/
abstract public function verify($data, $signature);
}

@ -0,0 +1,98 @@
<?php
/*
* Copyright 2010 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* A persistent storage class based on the APC cache, which is not
* really very persistent, as soon as you restart your web server
* the storage will be wiped, however for debugging and/or speed
* it can be useful, kinda, and cache is a lot cheaper then storage.
*
* @author Chris Chabot <chabotc@google.com>
*/
class Google_APCCache extends Google_Cache {
public function __construct() {
if (! function_exists('apc_add')) {
throw new Google_CacheException("Apc functions not available");
}
}
private function isLocked($key) {
if ((@apc_fetch($key . '.lock')) === false) {
return false;
}
return true;
}
private function createLock($key) {
// the interesting thing is that this could fail if the lock was created in the meantime..
// but we'll ignore that out of convenience
@apc_add($key . '.lock', '', 5);
}
private function removeLock($key) {
// suppress all warnings, if some other process removed it that's ok too
@apc_delete($key . '.lock');
}
private function waitForLock($key) {
// 20 x 250 = 5 seconds
$tries = 20;
$cnt = 0;
do {
// 250 ms is a long time to sleep, but it does stop the server from burning all resources on polling locks..
usleep(250);
$cnt ++;
} while ($cnt <= $tries && $this->isLocked($key));
if ($this->isLocked($key)) {
// 5 seconds passed, assume the owning process died off and remove it
$this->removeLock($key);
}
}
/**
* @inheritDoc
*/
public function get($key, $expiration = false) {
if (($ret = @apc_fetch($key)) === false) {
return false;
}
if (!$expiration || (time() - $ret['time'] > $expiration)) {
$this->delete($key);
return false;
}
return unserialize($ret['data']);
}
/**
* @inheritDoc
*/
public function set($key, $value) {
if (@apc_store($key, array('time' => time(), 'data' => serialize($value))) == false) {
throw new Google_CacheException("Couldn't store data");
}
}
/**
* @inheritDoc
* @param String $key
*/
public function delete($key) {
@apc_delete($key);
}
}

@ -0,0 +1,55 @@
<?php
/*
* Copyright 2008 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require_once "Google_FileCache.php";
require_once "Google_MemcacheCache.php";
/**
* Abstract storage class
*
* @author Chris Chabot <chabotc@google.com>
*/
abstract class Google_Cache {
/**
* Retrieves the data for the given key, or false if they
* key is unknown or expired
*
* @param String $key The key who's data to retrieve
* @param boolean|int $expiration Expiration time in seconds
*
*/
abstract function get($key, $expiration = false);
/**
* Store the key => $value set. The $value is serialized
* by this function so can be of any type
*
* @param string $key Key of the data
* @param string $value data
*/
abstract function set($key, $value);
/**
* Removes the key/data pair for the given $key
*
* @param String $key
*/
abstract function delete($key);
}

@ -0,0 +1,137 @@
<?php
/*
* Copyright 2008 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* This class implements a basic on disk storage. While that does
* work quite well it's not the most elegant and scalable solution.
* It will also get you into a heap of trouble when you try to run
* this in a clustered environment. In those cases please use the
* MySql back-end
*
* @author Chris Chabot <chabotc@google.com>
*/
class Google_FileCache extends Google_Cache {
private $path;
public function __construct() {
global $apiConfig;
$this->path = $apiConfig['ioFileCache_directory'];
}
private function isLocked($storageFile) {
// our lock file convention is simple: /the/file/path.lock
return file_exists($storageFile . '.lock');
}
private function createLock($storageFile) {
$storageDir = dirname($storageFile);
if (! is_dir($storageDir)) {
// @codeCoverageIgnoreStart
if (! @mkdir($storageDir, 0755, true)) {
// make sure the failure isn't because of a concurrency issue
if (! is_dir($storageDir)) {
throw new Google_CacheException("Could not create storage directory: $storageDir");
}
}
// @codeCoverageIgnoreEnd
}
@touch($storageFile . '.lock');
}
private function removeLock($storageFile) {
// suppress all warnings, if some other process removed it that's ok too
@unlink($storageFile . '.lock');
}
private function waitForLock($storageFile) {
// 20 x 250 = 5 seconds
$tries = 20;
$cnt = 0;
do {
// make sure PHP picks up on file changes. This is an expensive action but really can't be avoided
clearstatcache();
// 250 ms is a long time to sleep, but it does stop the server from burning all resources on polling locks..
usleep(250);
$cnt ++;
} while ($cnt <= $tries && $this->isLocked($storageFile));
if ($this->isLocked($storageFile)) {
// 5 seconds passed, assume the owning process died off and remove it
$this->removeLock($storageFile);
}
}
private function getCacheDir($hash) {
// use the first 2 characters of the hash as a directory prefix
// this should prevent slowdowns due to huge directory listings
// and thus give some basic amount of scalability
return $this->path . '/' . substr($hash, 0, 2);
}
private function getCacheFile($hash) {
return $this->getCacheDir($hash) . '/' . $hash;
}
public function get($key, $expiration = false) {
$storageFile = $this->getCacheFile(md5($key));
// See if this storage file is locked, if so we wait up to 5 seconds for the lock owning process to
// complete it's work. If the lock is not released within that time frame, it's cleaned up.
// This should give us a fair amount of 'Cache Stampeding' protection
if ($this->isLocked($storageFile)) {
$this->waitForLock($storageFile);
}
if (file_exists($storageFile) && is_readable($storageFile)) {
$now = time();
if (! $expiration || (($mtime = @filemtime($storageFile)) !== false && ($now - $mtime) < $expiration)) {
if (($data = @file_get_contents($storageFile)) !== false) {
$data = unserialize($data);
return $data;
}
}
}
return false;
}
public function set($key, $value) {
$storageDir = $this->getCacheDir(md5($key));
$storageFile = $this->getCacheFile(md5($key));
if ($this->isLocked($storageFile)) {
// some other process is writing to this file too, wait until it's done to prevent hiccups
$this->waitForLock($storageFile);
}
if (! is_dir($storageDir)) {
if (! @mkdir($storageDir, 0755, true)) {
throw new Google_CacheException("Could not create storage directory: $storageDir");
}
}
// we serialize the whole request object, since we don't only want the
// responseContent but also the postBody used, headers, size, etc
$data = serialize($value);
$this->createLock($storageFile);
if (! @file_put_contents($storageFile, $data)) {
$this->removeLock($storageFile);
throw new Google_CacheException("Could not store data in the file");
}
$this->removeLock($storageFile);
}
public function delete($key) {
$file = $this->getCacheFile(md5($key));
if (! @unlink($file)) {
throw new Google_CacheException("Cache file could not be deleted");
}
}
}

@ -0,0 +1,130 @@
<?php
/*
* Copyright 2008 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* A persistent storage class based on the memcache, which is not
* really very persistent, as soon as you restart your memcache daemon
* the storage will be wiped, however for debugging and/or speed
* it can be useful, kinda, and cache is a lot cheaper then storage.
*
* @author Chris Chabot <chabotc@google.com>
*/
class Google_MemcacheCache extends Google_Cache {
private $connection = false;
public function __construct() {
global $apiConfig;
if (! function_exists('memcache_connect')) {
throw new Google_CacheException("Memcache functions not available");
}
$this->host = $apiConfig['ioMemCacheCache_host'];
$this->port = $apiConfig['ioMemCacheCache_port'];
if (empty($this->host) || empty($this->port)) {
throw new Google_CacheException("You need to supply a valid memcache host and port");
}
}
private function isLocked($key) {
$this->check();
if ((@memcache_get($this->connection, $key . '.lock')) === false) {
return false;
}
return true;
}
private function createLock($key) {
$this->check();
// the interesting thing is that this could fail if the lock was created in the meantime..
// but we'll ignore that out of convenience
@memcache_add($this->connection, $key . '.lock', '', 0, 5);
}
private function removeLock($key) {
$this->check();
// suppress all warnings, if some other process removed it that's ok too
@memcache_delete($this->connection, $key . '.lock');
}
private function waitForLock($key) {
$this->check();
// 20 x 250 = 5 seconds
$tries = 20;
$cnt = 0;
do {
// 250 ms is a long time to sleep, but it does stop the server from burning all resources on polling locks..
usleep(250);
$cnt ++;
} while ($cnt <= $tries && $this->isLocked($key));
if ($this->isLocked($key)) {
// 5 seconds passed, assume the owning process died off and remove it
$this->removeLock($key);
}
}
// I prefer lazy initialization since the cache isn't used every request
// so this potentially saves a lot of overhead
private function connect() {
if (! $this->connection = @memcache_pconnect($this->host, $this->port)) {
throw new Google_CacheException("Couldn't connect to memcache server");
}
}
private function check() {
if (! $this->connection) {
$this->connect();
}
}
/**
* @inheritDoc
*/
public function get($key, $expiration = false) {
$this->check();
if (($ret = @memcache_get($this->connection, $key)) === false) {
return false;
}
if (is_numeric($expiration) && (time() - $ret['time'] > $expiration)) {
$this->delete($key);
return false;
}
return $ret['data'];
}
/**
* @inheritDoc
* @param string $key
* @param string $value
* @throws Google_CacheException
*/
public function set($key, $value) {
$this->check();
// we store it with the cache_time default expiration so objects will at least get cleaned eventually.
if (@memcache_set($this->connection, $key, array('time' => time(),
'data' => $value), false) == false) {
throw new Google_CacheException("Couldn't store data in cache");
}
}
/**
* @inheritDoc
* @param String $key
*/
public function delete($key) {
$this->check();
@memcache_delete($this->connection, $key);
}
}

@ -0,0 +1,81 @@
<?php
/*
* Copyright 2010 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
global $apiConfig;
$apiConfig = array(
// True if objects should be returned by the service classes.
// False if associative arrays should be returned (default behavior).
'use_objects' => false,
// The application_name is included in the User-Agent HTTP header.
'application_name' => '',
// OAuth2 Settings, you can get these keys at https://code.google.com/apis/console
'oauth2_client_id' => '',
'oauth2_client_secret' => '',
'oauth2_redirect_uri' => '',
// The developer key, you get this at https://code.google.com/apis/console
'developer_key' => '',
// Site name to show in the Google's OAuth 1 authentication screen.
'site_name' => 'www.example.org',
// Which Authentication, Storage and HTTP IO classes to use.
'authClass' => 'Google_OAuth2',
'ioClass' => 'Google_CurlIO',
'cacheClass' => 'Google_FileCache',
// Don't change these unless you're working against a special development or testing environment.
'basePath' => 'https://www.googleapis.com',
// IO Class dependent configuration, you only have to configure the values
// for the class that was configured as the ioClass above
'ioFileCache_directory' =>
(function_exists('sys_get_temp_dir') ?
sys_get_temp_dir() . '/Google_Client' :
'/tmp/Google_Client'),
// Definition of service specific values like scopes, oauth token URLs, etc
'services' => array(
'analytics' => array('scope' => 'https://www.googleapis.com/auth/analytics.readonly'),
'calendar' => array(
'scope' => array(
"https://www.googleapis.com/auth/calendar",
"https://www.googleapis.com/auth/calendar.readonly",
)
),
'books' => array('scope' => 'https://www.googleapis.com/auth/books'),
'latitude' => array(
'scope' => array(
'https://www.googleapis.com/auth/latitude.all.best',
'https://www.googleapis.com/auth/latitude.all.city',
)
),
'moderator' => array('scope' => 'https://www.googleapis.com/auth/moderator'),
'oauth2' => array(
'scope' => array(
'https://www.googleapis.com/auth/userinfo.profile',
'https://www.googleapis.com/auth/userinfo.email',
)
),
'plus' => array('scope' => 'https://www.googleapis.com/auth/plus.login'),
'siteVerification' => array('scope' => 'https://www.googleapis.com/auth/siteverification'),
'tasks' => array('scope' => 'https://www.googleapis.com/auth/tasks'),
'urlshortener' => array('scope' => 'https://www.googleapis.com/auth/urlshortener')
)
);

@ -0,0 +1,209 @@
<?php
/*
Copyright (c) 2010 Kevin M Burns Jr, http://kevburnsjr.com/
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* A URI Template Parser which is used by the apiREST class to resolve the REST requests
* Blogpost: http://lab.kevburnsjr.com/php-uri-template-parser
* Source: http://github.com/KevBurnsJr/php-uri-template-parser
*/
class URI_Template_Parser {
public static $operators = array('+', ';', '?', '/', '.');
public static $reserved_operators = array('|', '!', '@');
public static $explode_modifiers = array('+', '*');
public static $partial_modifiers = array(':', '^');
public static $gen_delims = array(':', '/', '?', '#', '[', ']', '@');
public static $gen_delims_pct = array('%3A', '%2F', '%3F', '%23', '%5B', '%5D', '%40');
public static $sub_delims = array('!', '$', '&', '\'', '(', ')', '*', '+', ',', ';', '=');
public static $sub_delims_pct = array('%21', '%24', '%26', '%27', '%28', '%29', '%2A', '%2B', '%2C', '%3B', '%3D');
public static $reserved;
public static $reserved_pct;
public function __construct($template) {
self::$reserved = array_merge(self::$gen_delims, self::$sub_delims);
self::$reserved_pct = array_merge(self::$gen_delims_pct, self::$sub_delims_pct);
$this->template = $template;
}
public function expand($data) {
// Modification to make this a bit more performant (since gettype is very slow)
if (! is_array($data)) {
$data = (array)$data;
}
/*
// Original code, which uses a slow gettype() statement, kept in place for if the assumption that is_array always works here is incorrect
switch (gettype($data)) {
case "boolean":
case "integer":
case "double":
case "string":
case "object":
$data = (array)$data;
break;
}
*/
// Resolve template vars
preg_match_all('/\{([^\}]*)\}/', $this->template, $em);
foreach ($em[1] as $i => $bare_expression) {
preg_match('/^([\+\;\?\/\.]{1})?(.*)$/', $bare_expression, $lm);
$exp = new StdClass();
$exp->expression = $em[0][$i];
$exp->operator = $lm[1];
$exp->variable_list = $lm[2];
$exp->varspecs = explode(',', $exp->variable_list);
$exp->vars = array();
foreach ($exp->varspecs as $varspec) {
preg_match('/^([a-zA-Z0-9_]+)([\*\+]{1})?([\:\^][0-9-]+)?(\=[^,]+)?$/', $varspec, $vm);
$var = new StdClass();
$var->name = $vm[1];
$var->modifier = isset($vm[2]) && $vm[2] ? $vm[2] : null;
$var->modifier = isset($vm[3]) && $vm[3] ? $vm[3] : $var->modifier;
$var->default = isset($vm[4]) ? substr($vm[4], 1) : null;
$exp->vars[] = $var;
}
// Add processing flags
$exp->reserved = false;
$exp->prefix = '';
$exp->delimiter = ',';
switch ($exp->operator) {
case '+':
$exp->reserved = 'true';
break;
case ';':
$exp->prefix = ';';
$exp->delimiter = ';';
break;
case '?':
$exp->prefix = '?';
$exp->delimiter = '&';
break;
case '/':
$exp->prefix = '/';
$exp->delimiter = '/';
break;
case '.':
$exp->prefix = '.';
$exp->delimiter = '.';
break;
}
$expressions[] = $exp;
}
// Expansion
$this->expansion = $this->template;
foreach ($expressions as $exp) {
$part = $exp->prefix;
$exp->one_var_defined = false;
foreach ($exp->vars as $var) {
$val = '';
if ($exp->one_var_defined && isset($data[$var->name])) {
$part .= $exp->delimiter;
}
// Variable present
if (isset($data[$var->name])) {
$exp->one_var_defined = true;
$var->data = $data[$var->name];
$val = self::val_from_var($var, $exp);
// Variable missing
} else {
if ($var->default) {
$exp->one_var_defined = true;
$val = $var->default;
}
}
$part .= $val;
}
if (! $exp->one_var_defined) $part = '';
$this->expansion = str_replace($exp->expression, $part, $this->expansion);
}
return $this->expansion;
}
private function val_from_var($var, $exp) {
$val = '';
if (is_array($var->data)) {
$i = 0;
if ($exp->operator == '?' && ! $var->modifier) {
$val .= $var->name . '=';
}
foreach ($var->data as $k => $v) {
$del = $var->modifier ? $exp->delimiter : ',';
$ek = rawurlencode($k);
$ev = rawurlencode($v);
// Array
if ($k !== $i) {
if ($var->modifier == '+') {
$val .= $var->name . '.';
}
if ($exp->operator == '?' && $var->modifier || $exp->operator == ';' && $var->modifier == '*' || $exp->operator == ';' && $var->modifier == '+') {
$val .= $ek . '=';
} else {
$val .= $ek . $del;
}
// List
} else {
if ($var->modifier == '+') {
if ($exp->operator == ';' && $var->modifier == '*' || $exp->operator == ';' && $var->modifier == '+' || $exp->operator == '?' && $var->modifier == '+') {
$val .= $var->name . '=';
} else {
$val .= $var->name . '.';
}
}
}
$val .= $ev . $del;
$i ++;
}
$val = trim($val, $del);
// Strings, numbers, etc.
} else {
if ($exp->operator == '?') {
$val = $var->name . (isset($var->data) ? '=' : '');
} else if ($exp->operator == ';') {
$val = $var->name . ($var->data ? '=' : '');
}
$val .= rawurlencode($var->data);
if ($exp->operator == '+') {
$val = str_replace(self::$reserved_pct, self::$reserved, $val);
}
}
return $val;
}
public function match($uri) {}
public function __toString() {
return $this->template;
}
}

@ -0,0 +1,173 @@
<?php
/*
* Copyright 2012 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Implement the caching directives specified in rfc2616. This
* implementation is guided by the guidance offered in rfc2616-sec13.
* @author Chirag Shah <chirags@google.com>
*/
class Google_CacheParser {
public static $CACHEABLE_HTTP_METHODS = array('GET', 'HEAD');
public static $CACHEABLE_STATUS_CODES = array('200', '203', '300', '301');
private function __construct() {}
/**
* Check if an HTTP request can be cached by a private local cache.
*
* @static
* @param Google_HttpRequest $resp
* @return bool True if the request is cacheable.
* False if the request is uncacheable.
*/
public static function isRequestCacheable (Google_HttpRequest $resp) {
$method = $resp->getRequestMethod();
if (! in_array($method, self::$CACHEABLE_HTTP_METHODS)) {
return false;
}
// Don't cache authorized requests/responses.
// [rfc2616-14.8] When a shared cache receives a request containing an
// Authorization field, it MUST NOT return the corresponding response
// as a reply to any other request...
if ($resp->getRequestHeader("authorization")) {
return false;
}
return true;
}
/**
* Check if an HTTP response can be cached by a private local cache.
*
* @static
* @param Google_HttpRequest $resp
* @return bool True if the response is cacheable.
* False if the response is un-cacheable.
*/
public static function isResponseCacheable (Google_HttpRequest $resp) {
// First, check if the HTTP request was cacheable before inspecting the
// HTTP response.
if (false == self::isRequestCacheable($resp)) {
return false;
}
$code = $resp->getResponseHttpCode();
if (! in_array($code, self::$CACHEABLE_STATUS_CODES)) {
return false;
}
// The resource is uncacheable if the resource is already expired and
// the resource doesn't have an ETag for revalidation.
$etag = $resp->getResponseHeader("etag");
if (self::isExpired($resp) && $etag == false) {
return false;
}
// [rfc2616-14.9.2] If [no-store is] sent in a response, a cache MUST NOT
// store any part of either this response or the request that elicited it.
$cacheControl = $resp->getParsedCacheControl();
if (isset($cacheControl['no-store'])) {
return false;
}
// Pragma: no-cache is an http request directive, but is occasionally
// used as a response header incorrectly.
$pragma = $resp->getResponseHeader('pragma');
if ($pragma == 'no-cache' || strpos($pragma, 'no-cache') !== false) {
return false;
}
// [rfc2616-14.44] Vary: * is extremely difficult to cache. "It implies that
// a cache cannot determine from the request headers of a subsequent request
// whether this response is the appropriate representation."
// Given this, we deem responses with the Vary header as uncacheable.
$vary = $resp->getResponseHeader('vary');
if ($vary) {
return false;
}
return true;
}
/**
* @static
* @param Google_HttpRequest $resp
* @return bool True if the HTTP response is considered to be expired.
* False if it is considered to be fresh.
*/
public static function isExpired(Google_HttpRequest $resp) {
// HTTP/1.1 clients and caches MUST treat other invalid date formats,
// especially including the value “0”, as in the past.
$parsedExpires = false;
$responseHeaders = $resp->getResponseHeaders();
if (isset($responseHeaders['expires'])) {
$rawExpires = $responseHeaders['expires'];
// Check for a malformed expires header first.
if (empty($rawExpires) || (is_numeric($rawExpires) && $rawExpires <= 0)) {
return true;
}
// See if we can parse the expires header.
$parsedExpires = strtotime($rawExpires);
if (false == $parsedExpires || $parsedExpires <= 0) {
return true;
}
}
// Calculate the freshness of an http response.
$freshnessLifetime = false;
$cacheControl = $resp->getParsedCacheControl();
if (isset($cacheControl['max-age'])) {
$freshnessLifetime = $cacheControl['max-age'];
}
$rawDate = $resp->getResponseHeader('date');
$parsedDate = strtotime($rawDate);
if (empty($rawDate) || false == $parsedDate) {
$parsedDate = time();
}
if (false == $freshnessLifetime && isset($responseHeaders['expires'])) {
$freshnessLifetime = $parsedExpires - $parsedDate;
}
if (false == $freshnessLifetime) {
return true;
}
// Calculate the age of an http response.
$age = max(0, time() - $parsedDate);
if (isset($responseHeaders['age'])) {
$age = max($age, strtotime($responseHeaders['age']));
}
return $freshnessLifetime <= $age;
}
/**
* Determine if a cache entry should be revalidated with by the origin.
*
* @param Google_HttpRequest $response
* @return bool True if the entry is expired, else return false.
*/
public static function mustRevalidate(Google_HttpRequest $response) {
// [13.3] When a cache has a stale entry that it would like to use as a
// response to a client's request, it first has to check with the origin
// server to see if its cached entry is still usable.
return self::isExpired($response);
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save