code
stringlengths 1
2.01M
| repo_name
stringlengths 3
62
| path
stringlengths 1
267
| language
stringclasses 231
values | license
stringclasses 13
values | size
int64 1
2.01M
|
|---|---|---|---|---|---|
<?php
defined('IN_PHPCMS') or exit('No permission resources.');
pc_base::load_sys_class('model', '', 0);
class applications_model extends model {
public function __construct() {
$this->db_config = pc_base::load_config('database');
$this->db_setting = 'default';
$this->table_name = 'applications';
parent::__construct();
}
}
?>
|
108wo
|
phpsso_server/phpcms/model/applications_model.class.php
|
PHP
|
asf20
| 348
|
<?php
?>
|
108wo
|
phpsso_server/phpcms/languages/zh-cn/system_menu.lang.php
|
PHP
|
asf20
| 11
|
<?php
$LANG['nameerror'] = '用户名不能为空。';
$LANG['checkcode'] = '验证码';
$LANG['click_change_validate'] = '单击更换验证码';
$LANG['code_error'] = '验证码错误';
$LANG['input_code'] = '请输入验证码';
$LANG['jump_message'] = '如果您的浏览器没有自动跳转,请点击这里';
$LANG['alert_message'] = '提示信息';
$LANG['go_history'] = '[点这里返回上一页]';
$LANG['register_setting'] = '注册配置';
$LANG['uc_setting'] = 'UCenter配置';
$LANG['sp4_password_compatible'] = 'php2008 sp4密码兼容';
$LANG['denyed_username'] = '禁止注册的用户名:';
$LANG['denyed_username_setting'] = '可以设置通配符,每个关键字一行,可使用通配符 * 如 陈*桥';
$LANG['denyed_email'] = '禁止注册的email:';
$LANG['denyed_email_setting'] = '可以设置通配符,每个email一行,可使用通配符 * 如 *@snda.com';
$LANG['uc_notice'] = '如果开启UCenter接口,以下所有项均为必填项。';
$LANG['enable'] = '是否启用:';
$LANG['uc_api_host'] = 'Ucenter api 地址:';
$LANG['uc_host_notice'] = '如 http://www.domain.com/ucenter 最后不要带斜线';
$LANG['uc_ip_notice'] = '一般不用填写,遇到无法同步时,请填写ucenter主机的IP地址';
$LANG['uc_db_host'] = 'Ucenter 数据库主机名:';
$LANG['uc_db_username'] = 'Ucenter 数据库用户名:';
$LANG['uc_db_password'] = 'Ucenter 数据库密码:';
$LANG['uc_dbname'] = 'Ucenter 数据库名:';
$LANG['uc_db_pre'] = 'Ucenter 数据库表前缀:';
$LANG['uc_db_charset'] = 'Ucenter 数据库字符集:';
$LANG['please_select'] = '请选择';
$LANG['uc_test_database'] = '测试数据连连接';
$LANG['uc_appid'] = '应用id(APP ID):';
$LANG['uc_key'] = 'Ucenter 通信密钥:';
$LANG['sp4_password_key'] = 'php2008 SP4 config.inc中 define(\'PASSWORD_KEY\', \'\'); 中的值(可以为空)';
$LANG['between_6_to_20'] = '应该为6-20位之间';
$LANG['password_can_not_be_empty'] = '密码不能为空。';
$LANG['means_code'] = '请输入重复密码。';
$LANG['login_succeeded'] = '登陆成功!';
$LANG['logout_succeeded'] = '退出成功';
$LANG['add_admin'] = '添加管理员';
$LANG['listadmins'] = '管理员列表';
$LANG['lastlogintime'] = '最后登陆';
$LANG['landing_ip'] = '登陆IP';
$LANG['subminiature_tube'] = '超级管理员';
$LANG['administrator'] = '管理员';
$LANG['least_there_is_a_super_administrator'] = '最少有一个超级管理员。';
$LANG['input'] = '请输入';
$LANG['connecting_please_wait'] = '请稍候...';
$LANG['charset'] = '字符集';
$LANG['synlogin'] = '同步登陆';
$LANG['apifilename'] = '通信文件';
$LANG['the_password_cannot_be_empty'] = '原密码不能为空。';
$LANG['new_password_cannot_be_empty'] = '新密码不能为空。';
$LANG['the_two_passwords_are_not_the_same_admin_zh'] = '两次密码不同。';
$LANG['old_password_incorrect'] = '原密码错误。';
$LANG['email_format_incorrect'] = '电子邮箱格式错误';
$LANG['format_incorrect'] = '格式错误';
$LANG['notice_format'] = '请注意格式';
$LANG['right'] = '正确';
$LANG['old_password_incorrect'] = '原密码错误。';
$LANG['not_change_the_password_please_leave_a_blank'] = '不修改密码请留空。';
$LANG['change_password'] = '修改密码';
$LANG['current_password'] = '原密码';
$LANG['new_password'] = '新密码';
$LANG['re_password'] = '重复密码';
$LANG['inputpassword'] = '请输入密码';
$LANG['bootos_x'] = '再次输入';
$LANG['modification_succeed'] = '修改管理员信息';
$LANG['application_list'] = '应用列表';
$LANG['application_add'] = '添加应用';
$LANG['application_edit'] = '编辑应用';
$LANG['application_name'] = '应用名';
$LANG['application_url'] = '应用地址';
$LANG['application_url_msg'] = '应用的访问地址,请以"/"结尾。如:http://www.phpcms.cn/';
$LANG['application_ip'] = '应用ip';
$LANG['application_ip_msg'] = '当应用URL无法访问时,使用IP进行访问。';
$LANG['application_status'] = '应用状态';
$LANG['application_apifilename'] = '通信文件';
$LANG['application_charset'] = '字符集';
$LANG['application_synlogin'] = '同步登陆';
$LANG['communications_status'] = '通信状态';
$LANG['authkey'] = '通信密钥';
$LANG['automatic_generation'] = '自动生成';
$LANG['regip'] = '注册ip';
$LANG['can_not_be_empty'] = '不能为空';
$LANG['exist'] = '已存在';
$LANG['application_not_exist'] = '应用不存在';
$LANG['can_not_be_empty'] = '不能为空';
$LANG['is_succeed'] = '是否成功';
$LANG['notice_num'] = '通信次数';
$LANG['notice_dateline'] = '通信时间';
$LANG['notice_status'] = '通信状态';
$LANG['table_size'] = '表大小';
$LANG['index_size'] = '索引大小';
$LANG['notice_data'] = '通信数据';
$LANG['notice_id'] = '消息ID';
$LANG['notice_success'] = '通信成功';
$LANG['notice_fail'] = '通信失败';
$LANG['notice_data'] = '通信数据';
$LANG['cache_size'] = '缓存大小';
$LANG['last_modify_time'] = '最后修改时间';
$LANG['clean_applist_cache'] = '更新应用列表缓存';
$LANG['credit_add'] = '添加积分规则';
$LANG['credit_manage'] = '管理积分规则';
$LANG['pleace_select'] = '请选择';
$LANG['change_credit'] = '积分兑换';
$LANG['change_position'] = '兑换方向';
$LANG['change_rate'] = '兑换比率';
$LANG['testing_communication'] = '通信测试中...';
$LANG['communication_success'] = '通信成功';
$LANG['communication_failure'] = '通信失败';
$LANG['view'] = '查看';
$LANG['change_pos'] = '兑换方向';
$LANG['change_rate'] = '兑换比例';
$LANG['id'] = 'ID';
$LANG['credit_update'] = '更新积分规则';
$LANG['avatar'] = '头像';
$LANG['version_info'] = '版本信息';
$LANG['application_info'] = '应用信息';
$LANG['member_info'] = '用户信息';
$LANG['member_total'] = '用户总计';
$LANG['member_today'] = '今日新增:';
$LANG['queue_info'] = '消息队列';
$LANG['system_info'] = '系统信息';
$LANG['server_info'] = '服务器环境';
$LANG['host_info'] = '主机名';
$LANG['php_info'] = 'PHP信息';
$LANG['mysql_info'] = 'Mysql信息';
$LANG['mysql_version'] = 'Mysql版本';
$LANG['service_info'] = '开发团队';
$LANG['development_team'] = '技术团队';
$LANG['design_team'] = '美工团队';
$LANG['phpcms_chenzhouyu'] = '陈周瑜';
$LANG['phpcms_wangtiecheng'] = '王铁成';
$LANG['phpcms_dongfeilong'] = '董飞龙';
$LANG['connect_success'] = '连接成功!';
$LANG['connect_failed'] = '连接失败!';
|
108wo
|
phpsso_server/phpcms/languages/zh-cn/admin.lang.php
|
PHP
|
asf20
| 6,648
|
<?php
$LANG['illegal_operation'] = '非法操作!';
$LANG['illegal_action'] = '非法动作参数!请返回';
$LANG['illegal_parameters'] = '非法参数!';
$LANG['operation_success'] = '操作成功!';
$LANG['operation_failure'] = '操作失败!';
$LANG['total'] = '总数:';
$LANG['first'] = '首页';
$LANG['success'] = '成功';
$LANG['previous'] = '上一页';
$LANG['next'] = '下一页';
$LANG['last'] = '尾页';
$LANG['page'] = '页次:';
$LANG['serial'] = '第';
$LANG['page'] = '页:';
$LANG['User_name_could_not_find'] = '用户名没有找到。';
$LANG['user_not_exist'] = '用户不存在';
$LANG['incorrect_password'] = '密码错误。';
$LANG['unknown_error'] = '未知错误。';
$LANG['user_already_exist'] = '用户已存在。';
$LANG['password_len_error'] = '密码必须为6-20位之间';
$LANG['database_error'] = '数据库错误';
$LANG['relogin'] = '您还没有登陆或登陆已经过期,请重新登陆。';
$LANG['eaccess'] = '权限不足。';
$LANG['select_all'] = '全选';
$LANG['username'] = '用户名';
$LANG['password'] = '密 码';
$LANG['email'] = '电子邮箱';
$LANG['email_already_exist'] = '电子邮箱已经存在';
$LANG['application'] = '应用';
$LANG['regtime'] = '注册时间';
$LANG['regip'] = '注册ip';
$LANG['lastlogintime'] = '最后登录';
$LANG['operation'] = '操作';
$LANG['edit'] = '编辑';
$LANG['delete'] = '删除';
$LANG['commend'] = '推荐';
$LANG['search'] = '搜索';
$LANG['type'] = '类型';
$LANG['submit'] = '提交';
$LANG['cancel'] = '取消';
$LANG['loging'] = '登 录';
$LANG['yes'] = '是';
$LANG['no'] = '否';
$LANG['phpsso'] = 'PHP用户管理中心';
$LANG['manage_center'] = '管理中心';
$LANG['loading'] = '加载中';
$LANG['hellow'] = '您好!';
$LANG['logout'] = '退出';
$LANG['site_index'] = '站点首页';
$LANG['index'] = '首页';
$LANG['member_search'] = '会员搜索';
$LANG['first_page'] = '首页';
$LANG['account_setting'] = '账号设置';
$LANG['member_manage'] = '用户管理';
$LANG['member_add'] = '添加用户';
$LANG['member_edit'] = '修改用户';
$LANG['member_delete'] = '删除用户';
$LANG['uid'] = '用户ID';
$LANG['application_manage'] = '应用管理';
$LANG['communicate_info'] = '通信信息';
$LANG['admin_manage'] = '管理员管理';
$LANG['credit_change'] = '积分兑换';
$LANG['system_setting'] = '系统设置';
$LANG['clean_cache'] = '更新缓存';
$LANG['admin_manage'] = '管理员管理';
$LANG['sure_delete'] = '您确定要删除吗?';
$LANG['expand'] = '展开';
$LANG['spread_or_closed'] = '展开与关闭';
$LANG['local'] = '当前位置: 首页 > ';
$LANG['no_language'] = '没有语言包';
$LANG['other'] = '其他';
$LANG['ucenter_error_code'] = 'ucenter返回错误,错误代码:{code}。';
?>
|
108wo
|
phpsso_server/phpcms/languages/zh-cn/system.lang.php
|
PHP
|
asf20
| 2,885
|
<?php
param::set_cookie('username', '');
param::set_cookie('userid', '');
|
108wo
|
phpsso_server/api/logout.php
|
PHP
|
asf20
| 75
|
<?php
$username = isset($_GET['username']) && trim($_GET['username']) ? trim($_GET['username']) : exit('-1');
$password = isset($_GET['password']) && trim($_GET['password']) ? trim($_GET['password']) : exit('-1');
$url = isset($_GET['url']) && trim($_GET['url']) ? trim(urldecode($_GET['url'])) : exit('-1');
$name = isset($_GET['name']) && trim($_GET['name']) ? trim($_GET['name']) : exit('-1');
$authkey = isset($_GET['authkey']) && trim($_GET['authkey']) ? trim($_GET['authkey']) : exit('-1');
$apifilename = isset($_GET['apifilename']) && trim($_GET['apifilename']) ? trim($_GET['apifilename']) : exit('-1');
$charset = isset($_GET['charset']) && trim($_GET['charset']) ? trim($_GET['charset']) : exit('-1');
$type = isset($_GET['type']) && trim($_GET['type']) ? trim($_GET['type']) : 'other';
$synlogin = isset($_GET['synlogin']) && trim($_GET['synlogin']) ? trim($_GET['synlogin']) : '1';
$db = pc_base::load_model('admin_model');
$memberinfo = $db->get_one(array('username'=>$username));
if(!empty($memberinfo)) {
if(md5(md5($password).$memberinfo['encrypt']) == $memberinfo['password']) {
$appdb = pc_base::load_model('applications_model');
$appdata['authkey'] = $authkey;
$appdata['apifilename'] = $apifilename;
$appdata['charset'] = $charset;
$appdata['type'] = $type;
$appdata['synlogin'] = $synlogin;
$appdata['url'] = $url;
$appdata['name'] = $name;
$appid = $appdb->insert($appdata, 1);
if($appid > 0) {
$applist = $appdb->listinfo('', '', 1, 100, 'appid');
setcache('applist', $applist, 'admin');
echo $appid;exit;
} else {
exit('-3');
}
} else {
exit('-2');
}
} else {
exit('-2');
}
?>
|
108wo
|
phpsso_server/api/install.php
|
PHP
|
asf20
| 1,702
|
<?php
error_reporting(0);
define('PHPCMS_PATH', dirname(__FILE__).'/../');
include PHPCMS_PATH.'/phpcms/base.php';
define('UC_KEY', pc_base::load_config('system', 'uc_key'));
define('API_RETURN_SUCCEED', '1');
define('API_RETURN_FAILED', '-1');
define('API_RETURN_FORBIDDEN', '-2');
$get = $post = array();
$code = @$_GET['code'];
parse_str(authcode($code, 'DECODE', UC_KEY), $get);
if(SYS_TIME - $get['time'] > 3600) exit('Authracation has expiried');
if(empty($get)) exit('Invalid Request');
include dirname(__FILE__).'/uc_client/lib/xml.class.php';
$post = xml_unserialize(file_get_contents('php://input'));
$action = $get['action'];
if(in_array($get['action'], array('test', 'deleteuser', 'renameuser', 'gettag', 'synlogin', 'synlogout', 'updatepw', 'updatebadwords', 'updatehosts', 'updateapps', 'updateclient', 'updatecredit', 'getcreditsettings', 'updatecreditsettings'))) {
$uc_note = new uc_note();
header('Content-type: text/html; charset='.pc_base::load_config('system', 'charset'));
echo $uc_note->$get['action']($get, $post);
exit();
} else {
exit(API_RETURN_FAILED);
}
class uc_note {
private $member_db, $uc_db, $applist;
function __construct() {
$this->member_db = pc_base::load_model('member_model');
pc_base::load_sys_class('uc_model', 'model', 0);
$db_config = get_uc_database();
$this->uc_db = new uc_model($db_config);
$this->applist = getcache('applist', 'admin');
}
//测试通信
public function test() {
return API_RETURN_SUCCEED;
}
//删除用户
public function deleteuser($get,$post) {
pc_base::load_app_func('global', 'admin');
pc_base::load_app_class('messagequeue', 'admin' , 0);
$ids = new_stripslashes($get['ids']);
$s = $this->member_db->select("ucuserid in ($ids)", "uid");
$this->member_db->delete("ucuserid in ($ids)");
$noticedata['uids'] = array();
if ($s) {
foreach ($s as $key=>$v) {
$noticedata['uids'][$key] = $v['uid'];
}
} else {
return API_RETURN_FAILED;
}
messagequeue::add('member_delete', $noticedata);
return API_RETURN_SUCCEED;
}
//更改用户密码
public function updatepw($get,$post) {
$username = $get['username'];
$r = $this->uc_db->get_one(array('username'=>$username));
if ($r) {
$this->member_db->update(array('password'=>$r['password'], 'random'=>$r['salt']), array('username'=>$username));
}
return API_RETURN_SUCCEED;
}
//更改一个用户的用户名
public function renameuser($get, $post) {
return API_RETURN_SUCCEED;
}
//同步登录
public function synlogin($get,$post) {
header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');
$uid = intval($get['uid']);
if (empty($uid)) return API_RETURN_FAILED;
//获取UC中用户的信息
$r = $this->uc_db->get_one(array('uid'=>$uid));
if ($data = $this->member_db->get_one(array('ucuserid'=>$uid))) {//当用户存在时,获取用户的登陆信息
$this->member_db->update(array('lastip'=>$r['lastloginip'], 'lastdate'=>$r['lastlogindate']), array('uid'=>$data['uid']));
} else { //当用户不存在是注册新用户
$datas = $data = array('username'=>$r['username'], 'password'=>$r['password'], 'random'=>$r['salt'], 'email'=>$r['email'], 'regip'=>$r['regip'], 'regdate'=>$r['regdate'], 'lastdate'=>$r['lastlogindate'], 'appname'=>'ucenter', 'type'=>'app');
$datas['ucuserid'] = $uid;
$datas['lastip'] = $r['lastloginip'];
if ($s = $this->member_db->get_one(array('username'=>$r['username']))) {
$this->member_db->update($datas, array('uid'=>$s['uid']));
$data['uid'] = $s;
} else {
$data['uid'] = $this->member_db->insert($datas, true);
}
//向所有的应用中发布新用户注册通知
pc_base::load_app_func('global', 'admin');
pc_base::load_app_class('messagequeue', 'admin' , 0);
messagequeue::add('member_add', $data);
}
//输出应用登陆
$res = '';
foreach($this->applist as $v) {
if (!$v['synlogin']) continue;
$f = strstr($v['url'].$v['apifilename'], '?') ? '&' : '?';
$res .= '<script type="text/javascript" src="'.$v['url'].$v['apifilename'].$f.'time='.SYS_TIME.'&code='.urlencode(sys_auth('action=synlogin&username=&uid='.$data['uid'].'&password=&time='.SYS_TIME, 'ENCODE', $v['authkey'])).'" reload="1"></script>';
}
header("Content-type: text/javascript");
return format_js($res);
}
//同步退出登录
public function synlogout($get, $post) {
$res = '';
foreach($this->applist as $v) {
if($v['appid'] != $this->appid) {
$f = strstr($v['url'].$v['apifilename'], '?') ? '&' : '?';
$res .= '<script type="text/javascript" src="'.$v['url'].$v['apifilename'].$f.'time='.SYS_TIME.'&code='.urlencode(sys_auth('action=synlogout&time='.SYS_TIME, 'ENCODE', $v['authkey'])).'" reload="1"></script>';
}
}
header("Content-type: text/javascript");
return format_js($res);
}
//当 UCenter 的应用程序列表变更时
public function updateapps() {
return API_RETURN_SUCCEED;
}
}
function authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) {
$ckey_length = 4;
$key = md5($key ? $key : UC_KEY);
$keya = md5(substr($key, 0, 16));
$keyb = md5(substr($key, 16, 16));
$keyc = $ckey_length ? ($operation == 'DECODE' ? substr($string, 0, $ckey_length): substr(md5(microtime()), -$ckey_length)) : '';
$cryptkey = $keya.md5($keya.$keyc);
$key_length = strlen($cryptkey);
$string = $operation == 'DECODE' ? base64_decode(substr($string, $ckey_length)) : sprintf('%010d', $expiry ? $expiry + time() : 0).substr(md5($string.$keyb), 0, 16).$string;
$string_length = strlen($string);
$result = '';
$box = range(0, 255);
$rndkey = array();
for($i = 0; $i <= 255; $i++) {
$rndkey[$i] = ord($cryptkey[$i % $key_length]);
}
for($j = $i = 0; $i < 256; $i++) {
$j = ($j + $box[$i] + $rndkey[$i]) % 256;
$tmp = $box[$i];
$box[$i] = $box[$j];
$box[$j] = $tmp;
}
for($a = $j = $i = 0; $i < $string_length; $i++) {
$a = ($a + 1) % 256;
$j = ($j + $box[$a]) % 256;
$tmp = $box[$a];
$box[$a] = $box[$j];
$box[$j] = $tmp;
$result .= chr(ord($string[$i]) ^ ($box[($box[$a] + $box[$j]) % 256]));
}
if($operation == 'DECODE') {
if((substr($result, 0, 10) == 0 || substr($result, 0, 10) - time() > 0) && substr($result, 10, 16) == substr(md5(substr($result, 26).$keyb), 0, 16)) {
return substr($result, 26);
} else {
return '';
}
} else {
return $keyc.str_replace('=', '', base64_encode($result));
}
}
function uc_serialize($arr, $htmlon = 0) {
include_once UC_CLIENT_ROOT.'./lib/xml.class.php';
return xml_serialize($arr, $htmlon);
}
function uc_unserialize($s) {
include_once UC_CLIENT_ROOT.'./lib/xml.class.php';
return xml_unserialize($s);
}
|
108wo
|
phpsso_server/api/uc.php
|
PHP
|
asf20
| 6,908
|
<?php
$session_storage = 'session_'.pc_base::load_config('system','session_storage');
pc_base::load_sys_class($session_storage);
session_start();
$checkcode = pc_base::load_sys_class('checkcode');
if (isset($_GET['code_len']) && intval($_GET['code_len'])) $checkcode->code_len = intval($_GET['code_len']);
if (isset($_GET['font_size']) && intval($_GET['font_size'])) $checkcode->font_size = intval($_GET['font_size']);
if (isset($_GET['width']) && intval($_GET['width'])) $checkcode->width = intval($_GET['width']);
if (isset($_GET['height']) && intval($_GET['height'])) $checkcode->height = intval($_GET['height']);
if (isset($_GET['font']) && trim(urldecode($_GET['font']))) $checkcode->font = trim(urldecode($_GET['font']));
if (isset($_GET['font_color']) && trim(urldecode($_GET['font_color']))) $checkcode->font_color = trim(urldecode($_GET['font_color']));
if (isset($_GET['background']) && trim(urldecode($_GET['background']))) $checkcode->background = trim(urldecode($_GET['background']));
$checkcode->doimage();
$_SESSION['code']=$checkcode->get_code();
?>
|
108wo
|
phpsso_server/api/checkcode.php
|
PHP
|
asf20
| 1,079
|
<?php
/*
[UCenter] (C)2001-2009 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$Id: mail.php 753 2008-11-14 06:48:25Z cnteacher $
*/
!defined('IN_UC') && exit('Access Denied');
class mailcontrol extends base {
function __construct() {
$this->mailcontrol();
}
function mailcontrol() {
parent::__construct();
$this->init_input();
}
function onadd() {
$this->load('mail');
$mail = array();
$mail['appid'] = UC_APPID;
$mail['uids'] = explode(',', $this->input('uids'));
$mail['emails'] = explode(',', $this->input('emails'));
$mail['subject'] = $this->input('subject');
$mail['message'] = $this->input('message');
$mail['charset'] = $this->input('charset');
$mail['htmlon'] = intval($this->input('htmlon'));
$mail['level'] = abs(intval($this->input('level')));
$mail['frommail'] = $this->input('frommail');
$mail['dateline'] = $this->time;
return $_ENV['mail']->add($mail);
}
}
?>
|
108wo
|
phpsso_server/api/uc_client/control/mail.php
|
PHP
|
asf20
| 993
|
<?php
/*
[UCenter] (C)2001-2009 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$Id: pm.php 836 2008-12-05 02:25:48Z monkey $
*/
!defined('IN_UC') && exit('Access Denied');
define('PMLIMIT1DAY_ERROR', -1);
define('PMFLOODCTRL_ERROR', -2);
define('PMMSGTONOTFRIEND', -3);
define('PMSENDREGDAYS', -4);
class pmcontrol extends base {
function __construct() {
$this->pmcontrol();
}
function pmcontrol() {
parent::__construct();
$this->load('user');
$this->load('pm');
}
function oncheck_newpm() {
$this->init_input();
$this->user['uid'] = intval($this->input('uid'));
$more = $this->input('more');
$result = $_ENV['pm']->check_newpm($this->user['uid'], $more);
if($more == 3) {
require_once UC_ROOT.'lib/uccode.class.php';
$this->uccode = new uccode();
$result['lastmsg'] = $this->uccode->complie($result['lastmsg']);
}
return $result;
}
function onsendpm() {
$this->init_input();
$fromuid = $this->input('fromuid');
$msgto = $this->input('msgto');
$subject = $this->input('subject');
$message = $this->input('message');
$replypmid = $this->input('replypmid');
$isusername = $this->input('isusername');
if($fromuid) {
$user = $_ENV['user']->get_user_by_uid($fromuid);
$user = daddslashes($user, 1);
if(!$user) {
return 0;
}
$this->user['uid'] = $user['uid'];
$this->user['username'] = $user['username'];
} else {
$this->user['uid'] = 0;
$this->user['username'] = '';
}
if($replypmid) {
$isusername = 1;
$pms = $_ENV['pm']->get_pm_by_pmid($this->user['uid'], $replypmid);
if($pms[0]['msgfromid'] == $this->user['uid']) {
$user = $_ENV['user']->get_user_by_uid($pms[0]['msgtoid']);
$msgto = $user['username'];
} else {
$msgto = $pms[0]['msgfrom'];
}
}
$msgto = array_unique(explode(',', $msgto));
$isusername && $msgto = $_ENV['user']->name2id($msgto);
$blackls = $_ENV['pm']->get_blackls($this->user['uid'], $msgto);
if($fromuid) {
if($this->settings['pmsendregdays']) {
if($user['regdate'] > $this->time - $this->settings['pmsendregdays'] * 86400) {
return PMSENDREGDAYS;
}
}
$this->load('friend');
if(count($msgto) > 1 && !($is_friend = $_ENV['friend']->is_friend($fromuid, $msgto, 3))) {
return PMMSGTONOTFRIEND;
}
$pmlimit1day = $this->settings['pmlimit1day'] && $_ENV['pm']->count_pm_by_fromuid($this->user['uid'], 86400) > $this->settings['pmlimit1day'];
if($pmlimit1day || ($this->settings['pmfloodctrl'] && $_ENV['pm']->count_pm_by_fromuid($this->user['uid'], $this->settings['pmfloodctrl']))) {
if(!$_ENV['friend']->is_friend($fromuid, $msgto, 3)) {
if(!$_ENV['pm']->is_reply_pm($fromuid, $msgto)) {
if($pmlimit1day) {
return PMLIMIT1DAY_ERROR;
} else {
return PMFLOODCTRL_ERROR;
}
}
}
}
}
$lastpmid = 0;
foreach($msgto as $uid) {
if(!$fromuid || !in_array('{ALL}', $blackls[$uid])) {
$blackls[$uid] = $_ENV['user']->name2id($blackls[$uid]);
if(!$fromuid || isset($blackls[$uid]) && !in_array($this->user['uid'], $blackls[$uid])) {
$lastpmid = $_ENV['pm']->sendpm($subject, $message, $this->user, $uid, $replypmid);
}
}
}
return $lastpmid;
}
function ondelete() {
$this->init_input();
$this->user['uid'] = intval($this->input('uid'));
$id = $_ENV['pm']->deletepm($this->user['uid'], $this->input('pmids'));
return $id;
}
function ondeleteuser() {
$this->init_input();
$this->user['uid'] = intval($this->input('uid'));
$id = $_ENV['pm']->deleteuidpm($this->user['uid'], $this->input('touids'));
return $id;
}
function onreadstatus() {
$this->init_input();
$this->user['uid'] = intval($this->input('uid'));
$_ENV['pm']->set_pm_status($this->user['uid'], $this->input('uids'), $this->input('pmids'), $this->input('status'));
}
function onignore() {
$this->init_input();
$this->user['uid'] = intval($this->input('uid'));
return $_ENV['pm']->set_ignore($this->user['uid']);
}
function onls() {
$this->init_input();
$pagesize = $this->input('pagesize');
$folder = $this->input('folder');
$filter = $this->input('filter');
$page = $this->input('page');
$folder = in_array($folder, array('newbox', 'inbox', 'outbox', 'searchbox')) ? $folder : 'inbox';
if($folder != 'searchbox') {
$filter = $filter ? (in_array($filter, array('newpm', 'privatepm', 'systempm', 'announcepm')) ? $filter : '') : '';
}
$msglen = $this->input('msglen');
$this->user['uid'] = intval($this->input('uid'));
if($folder != 'searchbox') {
$pmnum = $_ENV['pm']->get_num($this->user['uid'], $folder, $filter);
$start = $this->page_get_start($page, $pagesize, $pmnum);
} else {
$pmnum = $pagesize;
$start = ($page - 1) * $pagesize;
}
if($pagesize > 0) {
$pms = $_ENV['pm']->get_pm_list($this->user['uid'], $pmnum, $folder, $filter, $start, $pagesize);
if(is_array($pms) && !empty($pms)) {
foreach($pms as $key => $pm) {
if($msglen) {
$pms[$key]['message'] = htmlspecialchars($_ENV['pm']->removecode($pms[$key]['message'], $msglen));
} else {
unset($pms[$key]['message']);
}
unset($pms[$key]['folder']);
}
}
$result['data'] = $pms;
}
$result['count'] = $pmnum;
return $result;
}
function onviewnode() {
$this->init_input();
$this->user['uid'] = intval($this->input('uid'));
$pmid = $_ENV['pm']->pmintval($this->input('pmid'));
$type = $this->input('type');
$pm = $_ENV['pm']->get_pmnode_by_pmid($this->user['uid'], $pmid, $type);
if($pm) {
require_once UC_ROOT.'lib/uccode.class.php';
$this->uccode = new uccode();
$pm['message'] = $this->uccode->complie($pm['message']);
return $pm;
}
}
function onview() {
$this->init_input();
$this->user['uid'] = intval($this->input('uid'));
$touid = $this->input('touid');
$pmid = $_ENV['pm']->pmintval($this->input('pmid'));
$daterange = $this->input('daterange');
if(empty($pmid)) {
$daterange = empty($daterange) ? 1 : $daterange;
$today = $this->time - ($this->time + $this->settings['timeoffset']) % 86400;
if($daterange == 1) {
$starttime = $today;
} elseif($daterange == 2) {
$starttime = $today - 86400;
} elseif($daterange == 3) {
$starttime = $today - 172800;
} elseif($daterange == 4) {
$starttime = $today - 604800;
} elseif($daterange == 5) {
$starttime = 0;
}
$endtime = $this->time;
$pms = $_ENV['pm']->get_pm_by_touid($this->user['uid'], $touid, $starttime, $endtime);
} else {
$pms = $_ENV['pm']->get_pm_by_pmid($this->user['uid'], $pmid);
}
require_once UC_ROOT.'lib/uccode.class.php';
$this->uccode = new uccode();
$status = FALSE;
foreach($pms as $key => $pm) {
$pms[$key]['message'] = $this->uccode->complie($pms[$key]['message']);
!$status && $status = $pm['msgtoid'] && $pm['new'];
}
$status && $_ENV['pm']->set_pm_status($this->user['uid'], $touid, $pmid);
return $pms;
}
function onblackls_get() {
$this->init_input();
$this->user['uid'] = intval($this->input('uid'));
return $_ENV['pm']->get_blackls($this->user['uid']);
}
function onblackls_set() {
$this->init_input();
$this->user['uid'] = intval($this->input('uid'));
$blackls = $this->input('blackls');
return $_ENV['pm']->set_blackls($this->user['uid'], $blackls);
}
function onblackls_add() {
$this->init_input();
$this->user['uid'] = intval($this->input('uid'));
$username = $this->input('username');
return $_ENV['pm']->update_blackls($this->user['uid'], $username, 1);
}
function onblackls_delete($arr) {
$this->init_input();
$this->user['uid'] = intval($this->input('uid'));
$username = $this->input('username');
return $_ENV['pm']->update_blackls($this->user['uid'], $username, 2);
}
}
?>
|
108wo
|
phpsso_server/api/uc_client/control/pm.php
|
PHP
|
asf20
| 8,108
|
<?php
/*
[UCenter] (C)2001-2009 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$Id: domain.php 753 2008-11-14 06:48:25Z cnteacher $
*/
!defined('IN_UC') && exit('Access Denied');
class domaincontrol extends base {
function __construct() {
$this->domaincontrol();
}
function domaincontrol() {
parent::__construct();
$this->init_input();
$this->load('domain');
}
function onls() {
return $_ENV['domain']->get_list(1, 9999, 9999);
}
}
?>
|
108wo
|
phpsso_server/api/uc_client/control/domain.php
|
PHP
|
asf20
| 511
|
<?php
/*
[UCenter] (C)2001-2009 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$Id: user.php 968 2009-10-29 02:06:45Z zhaoxiongfei $
*/
!defined('IN_UC') && exit('Access Denied');
define('UC_USER_CHECK_USERNAME_FAILED', -1);
define('UC_USER_USERNAME_BADWORD', -2);
define('UC_USER_USERNAME_EXISTS', -3);
define('UC_USER_EMAIL_FORMAT_ILLEGAL', -4);
define('UC_USER_EMAIL_ACCESS_ILLEGAL', -5);
define('UC_USER_EMAIL_EXISTS', -6);
class usercontrol extends base {
function __construct() {
$this->usercontrol();
}
function usercontrol() {
parent::__construct();
$this->load('user');
$this->app = $this->cache['apps'][UC_APPID];
}
// -1 未开启
function onsynlogin() {
$this->init_input();
$uid = $this->input('uid');
if($this->app['synlogin']) {
if($this->user = $_ENV['user']->get_user_by_uid($uid)) {
$synstr = '';
foreach($this->cache['apps'] as $appid => $app) {
if($app['synlogin'] && $app['appid'] != $this->app['appid']) {
$synstr .= '<script type="text/javascript" src="'.$app['url'].'/api/uc.php?time='.$this->time.'&code='.urlencode($this->authcode('action=synlogin&username='.$this->user['username'].'&uid='.$this->user['uid'].'&password='.$this->user['password']."&time=".$this->time, 'ENCODE', $app['authkey'])).'"></script>';
}
}
return $synstr;
}
}
return '';
}
function onsynlogout() {
$this->init_input();
if($this->app['synlogin']) {
$synstr = '';
foreach($this->cache['apps'] as $appid => $app) {
if($app['synlogin'] && $app['appid'] != $this->app['appid']) {
$synstr .= '<script type="text/javascript" src="'.$app['url'].'/api/uc.php?time='.$this->time.'&code='.urlencode($this->authcode('action=synlogout&time='.$this->time, 'ENCODE', $app['authkey'])).'"></script>';
}
}
return $synstr;
}
return '';
}
function onregister() {
$this->init_input();
$username = $this->input('username');
$password = $this->input('password');
$email = $this->input('email');
$questionid = $this->input('questionid');
$answer = $this->input('answer');
$regip = $this->input('regip');
$random = $this->input('random');
if(($status = $this->_check_username($username)) < 0) {
return $status;
}
if(($status = $this->_check_email($email)) < 0) {
return $status;
}
$uid = $_ENV['user']->add_user($username, $password, $email, $random, 0, $questionid, $answer, $regip);
return $uid;
}
function onedit() {
$this->init_input();
$username = $this->input('username');
$oldpw = $this->input('oldpw');
$newpw = $this->input('newpw');
$email = $this->input('email');
$ignoreoldpw = $this->input('ignoreoldpw');
$questionid = $this->input('questionid');
$answer = $this->input('answer');
$salt = $this->input('salt');
if($email && ($status = $this->_check_email($email, $username)) < 0) {
return $status;
}
$status = $_ENV['user']->edit_user($username, $oldpw, $newpw, $email, $salt, $ignoreoldpw, $questionid, $answer);
if($newpw && $status > 0) {
$this->load('note');
$_ENV['note']->add('updatepw', 'username='.urlencode($username).'&password=');
$_ENV['note']->send();
}
return $status;
}
function onlogin() {
$this->init_input();
$isuid = $this->input('isuid');
$username = $this->input('username');
$password = $this->input('password');
$checkques = $this->input('checkques');
$questionid = $this->input('questionid');
$answer = $this->input('answer');
if($isuid == 1) {
$user = $_ENV['user']->get_user_by_uid($username);
} elseif($isuid == 2) {
$user = $_ENV['user']->get_user_by_email($username);
} else {
$user = $_ENV['user']->get_user_by_username($username);
}
$passwordmd5 = preg_match('/^\w{32}$/', $password) ? $password : md5($password);
if(empty($user)) {
$status = -1;
} elseif($user['password'] != md5($passwordmd5.$user['salt'])) {
$status = -2;
} elseif($checkques && $user['secques'] != '' && $user['secques'] != $_ENV['user']->quescrypt($questionid, $answer)) {
$status = -3;
} else {
$status = $user['uid'];
}
$merge = $status != -1 && !$isuid && $_ENV['user']->check_mergeuser($username) ? 1 : 0;
return array($status, $user['username'], $password, $user['email'], $merge);
}
function oncheck_email() {
$this->init_input();
$email = $this->input('email');
return $this->_check_email($email);
}
function oncheck_username() {
$this->init_input();
$username = $this->input('username');
if(($status = $this->_check_username($username)) < 0) {
return $status;
} else {
return 1;
}
}
function onget_user() {
$this->init_input();
$username = $this->input('username');
if(!$this->input('isuid')) {
$status = $_ENV['user']->get_user_by_username($username);
} else {
$status = $_ENV['user']->get_user_by_uid($username);
}
if($status) {
return array($status['uid'],$status['username'],$status['email']);
} else {
return 0;
}
}
function ongetprotected() {
$protectedmembers = $this->db->fetch_all("SELECT uid,username FROM ".UC_DBTABLEPRE."protectedmembers GROUP BY username");
return $protectedmembers;
}
function ondelete() {
$this->init_input();
$uid = $this->input('uid');
return $_ENV['user']->delete_user($uid);
}
function onaddprotected() {
$this->init_input();
$username = $this->input('username');
$admin = $this->input('admin');
$appid = $this->app['appid'];
$usernames = (array)$username;
foreach($usernames as $username) {
$user = $_ENV['user']->get_user_by_username($username);
$uid = $user['uid'];
$this->db->query("REPLACE INTO ".UC_DBTABLEPRE."protectedmembers SET uid='$uid', username='$username', appid='$appid', dateline='{$this->time}', admin='$admin'", 'SILENT');
}
return $this->db->errno() ? -1 : 1;
}
function ondeleteprotected() {
$this->init_input();
$username = $this->input('username');
$appid = $this->app['appid'];
$usernames = (array)$username;
foreach($usernames as $username) {
$this->db->query("DELETE FROM ".UC_DBTABLEPRE."protectedmembers WHERE username='$username' AND appid='$appid'");
}
return $this->db->errno() ? -1 : 1;
}
function onmerge() {
$this->init_input();
$oldusername = $this->input('oldusername');
$newusername = $this->input('newusername');
$uid = $this->input('uid');
$password = $this->input('password');
$email = $this->input('email');
if(($status = $this->_check_username($newusername)) < 0) {
return $status;
}
$uid = $_ENV['user']->add_user($newusername, $password, $email, $uid);
$this->db->query("UPDATE ".UC_DBTABLEPRE."pms SET msgfrom='$newusername' WHERE msgfromid='$uid' AND msgfrom='$oldusername'");
$this->db->query("DELETE FROM ".UC_DBTABLEPRE."mergemembers WHERE appid='".$this->app['appid']."' AND username='$oldusername'");
return $uid;
}
function onmerge_remove() {
$this->init_input();
$username = $this->input('username');
$this->db->query("DELETE FROM ".UC_DBTABLEPRE."mergemembers WHERE appid='".$this->app['appid']."' AND username='$username'");
return NULL;
}
function _check_username($username) {
$username = addslashes(trim(stripslashes($username)));
if(!$_ENV['user']->check_username($username)) {
return UC_USER_CHECK_USERNAME_FAILED;
} elseif(!$_ENV['user']->check_usernamecensor($username)) {
return UC_USER_USERNAME_BADWORD;
} elseif($_ENV['user']->check_usernameexists($username)) {
return UC_USER_USERNAME_EXISTS;
}
return 1;
}
function _check_email($email, $username = '') {
if(empty($this->settings)) {
$this->settings = $this->cache('settings');
}
if(!$_ENV['user']->check_emailformat($email)) {
return UC_USER_EMAIL_FORMAT_ILLEGAL;
} elseif(!$_ENV['user']->check_emailaccess($email)) {
return UC_USER_EMAIL_ACCESS_ILLEGAL;
} elseif(!$this->settings['doublee'] && $_ENV['user']->check_emailexists($email, $username)) {
return UC_USER_EMAIL_EXISTS;
} else {
return 1;
}
}
function onuploadavatar() {
}
function onrectavatar() {
}
function flashdata_decode($s) {
}
}
?>
|
108wo
|
phpsso_server/api/uc_client/control/user.php
|
PHP
|
asf20
| 8,330
|
<?php
/*
[UCenter] (C)2001-2009 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$Id: friend.php 753 2008-11-14 06:48:25Z cnteacher $
*/
!defined('IN_UC') && exit('Access Denied');
class friendcontrol extends base {
function __construct() {
$this->friendcontrol();
}
function friendcontrol() {
parent::__construct();
$this->init_input();
$this->load('friend');
}
function ondelete() {
$uid = intval($this->input('uid'));
$friendids = $this->input('friendids');
$id = $_ENV['friend']->delete($uid, $friendids);
return $id;
}
function onadd() {
$uid = intval($this->input('uid'));
$friendid = $this->input('friendid');
$comment = $this->input('comment');
$id = $_ENV['friend']->add($uid, $friendid, $comment);
return $id;
}
function ontotalnum() {
$uid = intval($this->input('uid'));
$direction = intval($this->input('direction'));
$totalnum = $_ENV['friend']->get_totalnum_by_uid($uid, $direction);
return $totalnum;
}
function onls() {
$uid = intval($this->input('uid'));
$page = intval($this->input('page'));
$pagesize = intval($this->input('pagesize'));
$totalnum = intval($this->input('totalnum'));
$direction = intval($this->input('direction'));
$pagesize = $pagesize ? $pagesize : UC_PPP;
$totalnum = $totalnum ? $totalnum : $_ENV['friend']->get_totalnum_by_uid($uid);
$data = $_ENV['friend']->get_list($uid, $page, $pagesize, $totalnum, $direction);
return $data;
}
}
?>
|
108wo
|
phpsso_server/api/uc_client/control/friend.php
|
PHP
|
asf20
| 1,532
|
<?php
/*
[UCenter] (C)2001-2009 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$Id: app.php 884 2008-12-16 01:13:31Z monkey $
*/
!defined('IN_UC') && exit('Access Denied');
class appcontrol extends base {
function __construct() {
$this->appcontrol();
}
function appcontrol() {
parent::__construct();
$this->load('app');
}
function onls() {
$this->init_input();
$applist = $_ENV['app']->get_apps('appid, type, name, url, tagtemplates, viewprourl, synlogin');
$applist2 = array();
foreach($applist as $key => $app) {
$app['tagtemplates'] = $this->unserialize($app['tagtemplates']);
$applist2[$app['appid']] = $app;
}
return $applist2;
}
function onadd() {
}
function onucinfo() {
}
function _random($length, $numeric = 0) {
}
function _generate_key() {
}
function _format_notedata($notedata) {
}
}
?>
|
108wo
|
phpsso_server/api/uc_client/control/app.php
|
PHP
|
asf20
| 925
|
<?php
/*
[UCenter] (C)2001-2009 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$Id: feed.php 883 2008-12-16 00:51:21Z zhaoxiongfei $
*/
!defined('IN_UC') && exit('Access Denied');
class feedcontrol extends base {
function __construct() {
$this->feedcontrol();
}
function feedcontrol() {
parent::__construct();
$this->init_input();
}
function onadd() {
$this->load('misc');
$appid = intval($this->input('appid'));
$icon = $this->input('icon');
$uid = intval($this->input('uid'));
$username = $this->input('username');
$body_data = $_ENV['misc']->array2string($this->input('body_data'));
$title_data = $_ENV['misc']->array2string($this->input('title_data'));
$title_template = $this->_parsetemplate($this->input('title_template'));
$body_template = $this->_parsetemplate($this->input('body_template'));
$body_general = $this->input('body_general');
$target_ids = $this->input('target_ids');
$image_1 = $this->input('image_1');
$image_1_link = $this->input('image_1_link');
$image_2 = $this->input('image_2');
$image_2_link = $this->input('image_2_link');
$image_3 = $this->input('image_3');
$image_3_link = $this->input('image_3_link');
$image_4 = $this->input('image_4');
$image_4_link = $this->input('image_4_link');
$hash_template = md5($title_template.$body_template);
$hash_data = md5($title_template.$title_data.$body_template.$body_data);
$dateline = $this->time;
$this->db->query("INSERT INTO ".UC_DBTABLEPRE."feeds SET appid='$appid', icon='$icon', uid='$uid', username='$username',
title_template='$title_template', title_data='$title_data', body_template='$body_template', body_data='$body_data', body_general='$body_general',
image_1='$image_1', image_1_link='$image_1_link', image_2='$image_2', image_2_link='$image_2_link',
image_3='$image_3', image_3_link='$image_3_link', image_4='$image_4', image_4_link='$image_4_link',
hash_template='$hash_template', hash_data='$hash_data', target_ids='$target_ids', dateline='$dateline'");
return $this->db->insert_id();
}
function ondelete() {
$start = $this->input('start');
$limit = $this->input('limit');
$end = $start + $limit;
$this->db->query("DELETE FROM ".UC_DBTABLEPRE."feeds WHERE feedid>'$start' AND feedid<'$end'");
}
function onget() {
$this->load('misc');
$limit = intval($this->input('limit'));
$delete = $this->input('delete');
$feedlist = $this->db->fetch_all("SELECT * FROM ".UC_DBTABLEPRE."feeds ORDER BY feedid DESC LIMIT $limit");
if($feedlist) {
$maxfeedid = $feedlist[0]['feedid'];
foreach($feedlist as $key => $feed) {
$feed['body_data'] = $_ENV['misc']->string2array($feed['body_data']);
$feed['title_data'] = $_ENV['misc']->string2array($feed['title_data']);
$feedlist[$key] = $feed;
}
}
if(!empty($feedlist)) {
if(!isset($delete) || $delete) {
$this->_delete(0, $maxfeedid);
}
}
return $feedlist;
}
function _delete($start, $end) {
$this->db->query("DELETE FROM ".UC_DBTABLEPRE."feeds WHERE feedid>='$start' AND feedid<='$end'");
}
function _parsetemplate($template) {
$template = str_replace(array("\r", "\n"), '', $template);
$template = str_replace(array('<br>', '<br />', '<BR>', '<BR />'), "\n", $template);
$template = str_replace(array('<b>', '<B>'), '[B]', $template);
$template = str_replace(array('<i>', '<I>'), '[I]', $template);
$template = str_replace(array('<u>', '<U>'), '[U]', $template);
$template = str_replace(array('</b>', '</B>'), '[/B]', $template);
$template = str_replace(array('</i>', '</I>'), '[/I]', $template);
$template = str_replace(array('</u>', '</U>'), '[/U]', $template);
$template = htmlspecialchars($template);
$template = nl2br($template);
$template = str_replace(array('[B]', '[I]', '[U]', '[/B]', '[/I]', '[/U]'), array('<b>', '<i>', '<u>', '</b>', '</i>', '</u>'), $template);
return $template;
}
}
?>
|
108wo
|
phpsso_server/api/uc_client/control/feed.php
|
PHP
|
asf20
| 4,028
|
<?php
/*
[UCenter] (C)2001-2009 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$Id: tag.php 753 2008-11-14 06:48:25Z cnteacher $
*/
!defined('IN_UC') && exit('Access Denied');
class tagcontrol extends base {
function __construct() {
$this->tagcontrol();
}
function tagcontrol() {
parent::__construct();
$this->init_input();
$this->load('tag');
$this->load('misc');
}
function ongettag() {
$appid = $this->input('appid');
$tagname = $this->input('tagname');
$nums = $this->input('nums');
if(empty($tagname)) {
return NULL;
}
$return = $apparray = $appadd = array();
if($nums && is_array($nums)) {
foreach($nums as $k => $num) {
$apparray[$k] = $k;
}
}
$data = $_ENV['tag']->get_tag_by_name($tagname);
if($data) {
$apparraynew = array();
foreach($data as $tagdata) {
$row = $r = array();
$tmp = explode("\t", $tagdata['data']);
$type = $tmp[0];
array_shift($tmp);
foreach($tmp as $tmp1) {
$tmp1 != '' && $r[] = $_ENV['misc']->string2array($tmp1);
}
if(in_array($tagdata['appid'], $apparray)) {
if($tagdata['expiration'] > 0 && $this->time - $tagdata['expiration'] > 3600) {
$appadd[] = $tagdata['appid'];
$_ENV['tag']->formatcache($tagdata['appid'], $tagname);
} else {
$apparraynew[] = $tagdata['appid'];
}
$datakey = array();
$count = 0;
foreach($r as $data) {
$return[$tagdata['appid']]['data'][] = $data;
$return[$tagdata['appid']]['type'] = $type;
$count++;
if($count >= $nums[$tagdata['appid']]) {
break;
}
}
}
}
$apparray = array_diff($apparray, $apparraynew);
} else {
foreach($apparray as $appid) {
$_ENV['tag']->formatcache($appid, $tagname);
}
}
if($apparray) {
$this->load('note');
$_ENV['note']->add('gettag', "id=$tagname", '', $appadd, -1);
}
return $return;
}
}
?>
|
108wo
|
phpsso_server/api/uc_client/control/tag.php
|
PHP
|
asf20
| 2,012
|
<?php
/*
[UCenter] (C)2001-2009 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$Id: cache.php 753 2008-11-14 06:48:25Z cnteacher $
*/
!defined('IN_UC') && exit('Access Denied');
class cachecontrol extends base {
function __construct() {
$this->cachecontrol();
}
function cachecontrol() {
parent::__construct();
}
function onupdate($arr) {
$this->load("cache");
$_ENV['cache']->updatedata();
}
}
?>
|
108wo
|
phpsso_server/api/uc_client/control/cache.php
|
PHP
|
asf20
| 473
|
<?php
/*
[UCenter] (C)2001-2009 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$Id: client.php 963 2009-09-21 02:40:04Z zhaoxiongfei $
*/
if(!defined('UC_API')) {
exit('Access denied');
}
error_reporting(0);
define('IN_UC', TRUE);
define('UC_CLIENT_VERSION', '1.5.1');
define('UC_CLIENT_RELEASE', '20100501');
define('UC_ROOT', substr(__FILE__, 0, -10));
define('UC_DATADIR', UC_ROOT.'./data/');
define('UC_DATAURL', UC_API.'/data');
define('UC_API_FUNC', UC_CONNECT == 'mysql' ? 'uc_api_mysql' : 'uc_api_post');
$GLOBALS['uc_controls'] = array();
function uc_addslashes($string, $force = 0, $strip = FALSE) {
!defined('MAGIC_QUOTES_GPC') && define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc());
if(!MAGIC_QUOTES_GPC || $force) {
if(is_array($string)) {
foreach($string as $key => $val) {
$string[$key] = uc_addslashes($val, $force, $strip);
}
} else {
$string = addslashes($strip ? stripslashes($string) : $string);
}
}
return $string;
}
if(!function_exists('daddslashes')) {
function daddslashes($string, $force = 0) {
return uc_addslashes($string, $force);
}
}
function uc_stripslashes($string) {
!defined('MAGIC_QUOTES_GPC') && define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc());
if(MAGIC_QUOTES_GPC) {
return stripslashes($string);
} else {
return $string;
}
}
function uc_api_post($module, $action, $arg = array()) {
$s = $sep = '';
foreach($arg as $k => $v) {
$k = urlencode($k);
if(is_array($v)) {
$s2 = $sep2 = '';
foreach($v as $k2 => $v2) {
$k2 = urlencode($k2);
$s2 .= "$sep2{$k}[$k2]=".urlencode(uc_stripslashes($v2));
$sep2 = '&';
}
$s .= $sep.$s2;
} else {
$s .= "$sep$k=".urlencode(uc_stripslashes($v));
}
$sep = '&';
}
$postdata = uc_api_requestdata($module, $action, $s);
return uc_fopen2(UC_API.'/index.php', 500000, $postdata, '', TRUE, UC_IP, 20);
}
function uc_api_requestdata($module, $action, $arg='', $extra='') {
$input = uc_api_input($arg);
$post = "m=$module&a=$action&inajax=2&release=".UC_CLIENT_RELEASE."&input=$input&appid=".UC_APPID.$extra;
return $post;
}
function uc_api_url($module, $action, $arg='', $extra='') {
$url = UC_API.'/index.php?'.uc_api_requestdata($module, $action, $arg, $extra);
return $url;
}
function uc_api_input($data) {
$s = urlencode(uc_authcode($data.'&agent='.md5($_SERVER['HTTP_USER_AGENT'])."&time=".time(), 'ENCODE', UC_KEY));
return $s;
}
function uc_api_mysql($model, $action, $args=array()) {
global $uc_controls;
if(empty($uc_controls[$model])) {
include_once UC_ROOT.'./lib/db.class.php';
include_once UC_ROOT.'./model/base.php';
include_once UC_ROOT."./control/$model.php";
eval("\$uc_controls['$model'] = new {$model}control();");
}
if($action{0} != '_') {
$args = uc_addslashes($args, 1, TRUE);
$action = 'on'.$action;
$uc_controls[$model]->input = $args;
return $uc_controls[$model]->$action($args);
} else {
return '';
}
}
function uc_serialize($arr, $htmlon = 0) {
include_once UC_ROOT.'./lib/xml.class.php';
return xml_serialize($arr, $htmlon);
}
function uc_unserialize($s) {
include_once UC_ROOT.'./lib/xml.class.php';
return xml_unserialize($s);
}
function uc_authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) {
$ckey_length = 4;
$key = md5($key ? $key : UC_KEY);
$keya = md5(substr($key, 0, 16));
$keyb = md5(substr($key, 16, 16));
$keyc = $ckey_length ? ($operation == 'DECODE' ? substr($string, 0, $ckey_length): substr(md5(microtime()), -$ckey_length)) : '';
$cryptkey = $keya.md5($keya.$keyc);
$key_length = strlen($cryptkey);
$string = $operation == 'DECODE' ? base64_decode(substr($string, $ckey_length)) : sprintf('%010d', $expiry ? $expiry + time() : 0).substr(md5($string.$keyb), 0, 16).$string;
$string_length = strlen($string);
$result = '';
$box = range(0, 255);
$rndkey = array();
for($i = 0; $i <= 255; $i++) {
$rndkey[$i] = ord($cryptkey[$i % $key_length]);
}
for($j = $i = 0; $i < 256; $i++) {
$j = ($j + $box[$i] + $rndkey[$i]) % 256;
$tmp = $box[$i];
$box[$i] = $box[$j];
$box[$j] = $tmp;
}
for($a = $j = $i = 0; $i < $string_length; $i++) {
$a = ($a + 1) % 256;
$j = ($j + $box[$a]) % 256;
$tmp = $box[$a];
$box[$a] = $box[$j];
$box[$j] = $tmp;
$result .= chr(ord($string[$i]) ^ ($box[($box[$a] + $box[$j]) % 256]));
}
if($operation == 'DECODE') {
if((substr($result, 0, 10) == 0 || substr($result, 0, 10) - time() > 0) && substr($result, 10, 16) == substr(md5(substr($result, 26).$keyb), 0, 16)) {
return substr($result, 26);
} else {
return '';
}
} else {
return $keyc.str_replace('=', '', base64_encode($result));
}
}
function uc_fopen2($url, $limit = 0, $post = '', $cookie = '', $bysocket = FALSE, $ip = '', $timeout = 15, $block = TRUE) {
$__times__ = isset($_GET['__times__']) ? intval($_GET['__times__']) + 1 : 1;
if($__times__ > 2) {
return '';
}
$url .= (strpos($url, '?') === FALSE ? '?' : '&')."__times__=$__times__";
return uc_fopen($url, $limit, $post, $cookie, $bysocket, $ip, $timeout, $block);
}
function uc_fopen($url, $limit = 0, $post = '', $cookie = '', $bysocket = FALSE, $ip = '', $timeout = 15, $block = TRUE) {
$return = '';
$matches = parse_url($url);
!isset($matches['host']) && $matches['host'] = '';
!isset($matches['path']) && $matches['path'] = '';
!isset($matches['query']) && $matches['query'] = '';
!isset($matches['port']) && $matches['port'] = '';
$host = $matches['host'];
$path = $matches['path'] ? $matches['path'].($matches['query'] ? '?'.$matches['query'] : '') : '/';
$port = !empty($matches['port']) ? $matches['port'] : 80;
if($post) {
$out = "POST $path HTTP/1.0\r\n";
$out .= "Accept: */*\r\n";
//$out .= "Referer: $boardurl\r\n";
$out .= "Accept-Language: zh-cn\r\n";
$out .= "Content-Type: application/x-www-form-urlencoded\r\n";
$out .= "User-Agent: $_SERVER[HTTP_USER_AGENT]\r\n";
$out .= "Host: $host\r\n";
$out .= 'Content-Length: '.strlen($post)."\r\n";
$out .= "Connection: Close\r\n";
$out .= "Cache-Control: no-cache\r\n";
$out .= "Cookie: $cookie\r\n\r\n";
$out .= $post;
} else {
$out = "GET $path HTTP/1.0\r\n";
$out .= "Accept: */*\r\n";
//$out .= "Referer: $boardurl\r\n";
$out .= "Accept-Language: zh-cn\r\n";
$out .= "User-Agent: $_SERVER[HTTP_USER_AGENT]\r\n";
$out .= "Host: $host\r\n";
$out .= "Connection: Close\r\n";
$out .= "Cookie: $cookie\r\n\r\n";
}
$fp = @fsockopen(($ip ? $ip : $host), $port, $errno, $errstr, $timeout);
if(!$fp) {
return '';
} else {
stream_set_blocking($fp, $block);
stream_set_timeout($fp, $timeout);
@fwrite($fp, $out);
$status = stream_get_meta_data($fp);
if(!$status['timed_out']) {
while (!feof($fp)) {
if(($header = @fgets($fp)) && ($header == "\r\n" || $header == "\n")) {
break;
}
}
$stop = false;
while(!feof($fp) && !$stop) {
$data = fread($fp, ($limit == 0 || $limit > 8192 ? 8192 : $limit));
$return .= $data;
if($limit) {
$limit -= strlen($data);
$stop = $limit <= 0;
}
}
}
@fclose($fp);
return $return;
}
}
function uc_app_ls() {
$return = call_user_func(UC_API_FUNC, 'app', 'ls', array());
return UC_CONNECT == 'mysql' ? $return : uc_unserialize($return);
}
function uc_feed_add($icon, $uid, $username, $title_template='', $title_data='', $body_template='', $body_data='', $body_general='', $target_ids='', $images = array()) {
return call_user_func(UC_API_FUNC, 'feed', 'add',
array( 'icon'=>$icon,
'appid'=>UC_APPID,
'uid'=>$uid,
'username'=>$username,
'title_template'=>$title_template,
'title_data'=>$title_data,
'body_template'=>$body_template,
'body_data'=>$body_data,
'body_general'=>$body_general,
'target_ids'=>$target_ids,
'image_1'=>$images[0]['url'],
'image_1_link'=>$images[0]['link'],
'image_2'=>$images[1]['url'],
'image_2_link'=>$images[1]['link'],
'image_3'=>$images[2]['url'],
'image_3_link'=>$images[2]['link'],
'image_4'=>$images[3]['url'],
'image_4_link'=>$images[3]['link']
)
);
}
function uc_feed_get($limit = 100, $delete = TRUE) {
$return = call_user_func(UC_API_FUNC, 'feed', 'get', array('limit'=>$limit, 'delete'=>$delete));
return UC_CONNECT == 'mysql' ? $return : uc_unserialize($return);
}
function uc_friend_add($uid, $friendid, $comment='') {
return call_user_func(UC_API_FUNC, 'friend', 'add', array('uid'=>$uid, 'friendid'=>$friendid, 'comment'=>$comment));
}
function uc_friend_delete($uid, $friendids) {
return call_user_func(UC_API_FUNC, 'friend', 'delete', array('uid'=>$uid, 'friendids'=>$friendids));
}
function uc_friend_totalnum($uid, $direction = 0) {
return call_user_func(UC_API_FUNC, 'friend', 'totalnum', array('uid'=>$uid, 'direction'=>$direction));
}
function uc_friend_ls($uid, $page = 1, $pagesize = 10, $totalnum = 10, $direction = 0) {
$return = call_user_func(UC_API_FUNC, 'friend', 'ls', array('uid'=>$uid, 'page'=>$page, 'pagesize'=>$pagesize, 'totalnum'=>$totalnum, 'direction'=>$direction));
return UC_CONNECT == 'mysql' ? $return : uc_unserialize($return);
}
function uc_user_register($username, $password, $email, $random, $questionid = '', $answer = '', $regip = '') {
return call_user_func(UC_API_FUNC, 'user', 'register', array('username'=>$username, 'password'=>$password, 'random'=>$random, 'email'=>$email, 'questionid'=>$questionid, 'answer'=>$answer, 'regip' => $regip));
}
function uc_user_login($username, $password, $isuid = 0, $checkques = 0, $questionid = '', $answer = '') {
$isuid = intval($isuid);
$return = call_user_func(UC_API_FUNC, 'user', 'login', array('username'=>$username, 'password'=>$password, 'isuid'=>$isuid, 'checkques'=>$checkques, 'questionid'=>$questionid, 'answer'=>$answer));
return UC_CONNECT == 'mysql' ? $return : uc_unserialize($return);
}
function uc_user_synlogin($uid) {
$uid = intval($uid);
$return = uc_api_post('user', 'synlogin', array('uid'=>$uid));
return $return;
}
function uc_user_synlogout() {
return uc_api_post('user', 'synlogout', array());
}
function uc_user_edit($username, $oldpw, $newpw, $email, $salt = '', $ignoreoldpw = 0, $questionid = '', $answer = '') {
return call_user_func(UC_API_FUNC, 'user', 'edit', array('username'=>$username, 'oldpw'=>$oldpw, 'newpw'=>$newpw, 'salt'=>$salt, 'email'=>$email, 'ignoreoldpw'=>$ignoreoldpw, 'questionid'=>$questionid, 'answer'=>$answer));
}
function uc_user_delete($uid) {
return call_user_func(UC_API_FUNC, 'user', 'delete', array('uid'=>$uid));
}
function uc_user_deleteavatar($uid) {
uc_api_post('user', 'deleteavatar', array('uid'=>$uid));
}
function uc_user_checkname($username) {
return call_user_func(UC_API_FUNC, 'user', 'check_username', array('username'=>$username));
}
function uc_user_checkemail($email) {
return call_user_func(UC_API_FUNC, 'user', 'check_email', array('email'=>$email));
}
function uc_user_addprotected($username, $admin='') {
return call_user_func(UC_API_FUNC, 'user', 'addprotected', array('username'=>$username, 'admin'=>$admin));
}
function uc_user_deleteprotected($username) {
return call_user_func(UC_API_FUNC, 'user', 'deleteprotected', array('username'=>$username));
}
function uc_user_getprotected() {
$return = call_user_func(UC_API_FUNC, 'user', 'getprotected', array('1'=>1));
return UC_CONNECT == 'mysql' ? $return : uc_unserialize($return);
}
function uc_get_user($username, $isuid=0) {
$return = call_user_func(UC_API_FUNC, 'user', 'get_user', array('username'=>$username, 'isuid'=>$isuid));
return UC_CONNECT == 'mysql' ? $return : uc_unserialize($return);
}
function uc_user_merge($oldusername, $newusername, $uid, $password, $email) {
return call_user_func(UC_API_FUNC, 'user', 'merge', array('oldusername'=>$oldusername, 'newusername'=>$newusername, 'uid'=>$uid, 'password'=>$password, 'email'=>$email));
}
function uc_user_merge_remove($username) {
return call_user_func(UC_API_FUNC, 'user', 'merge_remove', array('username'=>$username));
}
function uc_user_getcredit($appid, $uid, $credit) {
return uc_api_post('user', 'getcredit', array('appid'=>$appid, 'uid'=>$uid, 'credit'=>$credit));
}
function uc_pm_location($uid, $newpm = 0) {
$apiurl = uc_api_url('pm_client', 'ls', "uid=$uid", ($newpm ? '&folder=newbox' : ''));
@header("Expires: 0");
@header("Cache-Control: private, post-check=0, pre-check=0, max-age=0", FALSE);
@header("Pragma: no-cache");
@header("location: $apiurl");
}
function uc_pm_checknew($uid, $more = 0) {
$return = call_user_func(UC_API_FUNC, 'pm', 'check_newpm', array('uid'=>$uid, 'more'=>$more));
return (!$more || UC_CONNECT == 'mysql') ? $return : uc_unserialize($return);
}
function uc_pm_send($fromuid, $msgto, $subject, $message, $instantly = 1, $replypmid = 0, $isusername = 0) {
if($instantly) {
$replypmid = @is_numeric($replypmid) ? $replypmid : 0;
return call_user_func(UC_API_FUNC, 'pm', 'sendpm', array('fromuid'=>$fromuid, 'msgto'=>$msgto, 'subject'=>$subject, 'message'=>$message, 'replypmid'=>$replypmid, 'isusername'=>$isusername));
} else {
$fromuid = intval($fromuid);
$subject = rawurlencode($subject);
$msgto = rawurlencode($msgto);
$message = rawurlencode($message);
$replypmid = @is_numeric($replypmid) ? $replypmid : 0;
$replyadd = $replypmid ? "&pmid=$replypmid&do=reply" : '';
$apiurl = uc_api_url('pm_client', 'send', "uid=$fromuid", "&msgto=$msgto&subject=$subject&message=$message$replyadd");
@header("Expires: 0");
@header("Cache-Control: private, post-check=0, pre-check=0, max-age=0", FALSE);
@header("Pragma: no-cache");
@header("location: ".$apiurl);
}
}
function uc_pm_delete($uid, $folder, $pmids) {
return call_user_func(UC_API_FUNC, 'pm', 'delete', array('uid'=>$uid, 'folder'=>$folder, 'pmids'=>$pmids));
}
function uc_pm_deleteuser($uid, $touids) {
return call_user_func(UC_API_FUNC, 'pm', 'deleteuser', array('uid'=>$uid, 'touids'=>$touids));
}
function uc_pm_readstatus($uid, $uids, $pmids = array(), $status = 0) {
return call_user_func(UC_API_FUNC, 'pm', 'readstatus', array('uid'=>$uid, 'uids'=>$uids, 'pmids'=>$pmids, 'status'=>$status));
}
function uc_pm_list($uid, $page = 1, $pagesize = 10, $folder = 'inbox', $filter = 'newpm', $msglen = 0) {
$uid = intval($uid);
$page = intval($page);
$pagesize = intval($pagesize);
$return = call_user_func(UC_API_FUNC, 'pm', 'ls', array('uid'=>$uid, 'page'=>$page, 'pagesize'=>$pagesize, 'folder'=>$folder, 'filter'=>$filter, 'msglen'=>$msglen));
return UC_CONNECT == 'mysql' ? $return : uc_unserialize($return);
}
function uc_pm_ignore($uid) {
$uid = intval($uid);
return call_user_func(UC_API_FUNC, 'pm', 'ignore', array('uid'=>$uid));
}
function uc_pm_view($uid, $pmid, $touid = 0, $daterange = 1) {
$uid = intval($uid);
$touid = intval($touid);
$pmid = @is_numeric($pmid) ? $pmid : 0;
$return = call_user_func(UC_API_FUNC, 'pm', 'view', array('uid'=>$uid, 'pmid'=>$pmid, 'touid'=>$touid, 'daterange'=>$daterange));
return UC_CONNECT == 'mysql' ? $return : uc_unserialize($return);
}
function uc_pm_viewnode($uid, $type = 0, $pmid = 0) {
$uid = intval($uid);
$pmid = @is_numeric($pmid) ? $pmid : 0;
$return = call_user_func(UC_API_FUNC, 'pm', 'viewnode', array('uid'=>$uid, 'pmid'=>$pmid, 'type'=>$type));
return UC_CONNECT == 'mysql' ? $return : uc_unserialize($return);
}
function uc_pm_blackls_get($uid) {
$uid = intval($uid);
return call_user_func(UC_API_FUNC, 'pm', 'blackls_get', array('uid'=>$uid));
}
function uc_pm_blackls_set($uid, $blackls) {
$uid = intval($uid);
return call_user_func(UC_API_FUNC, 'pm', 'blackls_set', array('uid'=>$uid, 'blackls'=>$blackls));
}
function uc_pm_blackls_add($uid, $username) {
$uid = intval($uid);
return call_user_func(UC_API_FUNC, 'pm', 'blackls_add', array('uid'=>$uid, 'username'=>$username));
}
function uc_pm_blackls_delete($uid, $username) {
$uid = intval($uid);
return call_user_func(UC_API_FUNC, 'pm', 'blackls_delete', array('uid'=>$uid, 'username'=>$username));
}
function uc_domain_ls() {
$return = call_user_func(UC_API_FUNC, 'domain', 'ls', array('1'=>1));
return UC_CONNECT == 'mysql' ? $return : uc_unserialize($return);
}
function uc_credit_exchange_request($uid, $from, $to, $toappid, $amount) {
$uid = intval($uid);
$from = intval($from);
$toappid = intval($toappid);
$to = intval($to);
$amount = intval($amount);
return uc_api_post('credit', 'request', array('uid'=>$uid, 'from'=>$from, 'to'=>$to, 'toappid'=>$toappid, 'amount'=>$amount));
}
function uc_tag_get($tagname, $nums = 0) {
$return = call_user_func(UC_API_FUNC, 'tag', 'gettag', array('tagname'=>$tagname, 'nums'=>$nums));
return UC_CONNECT == 'mysql' ? $return : uc_unserialize($return);
}
function uc_avatar($uid, $type = 'virtual', $returnhtml = 1) {
$uid = intval($uid);
$uc_input = uc_api_input("uid=$uid");
$uc_avatarflash = UC_API.'/images/camera.swf?inajax=1&appid='.UC_APPID.'&input='.$uc_input.'&agent='.md5($_SERVER['HTTP_USER_AGENT']).'&ucapi='.urlencode(str_replace('http://', '', UC_API)).'&avatartype='.$type.'&uploadSize=2048';
if($returnhtml) {
return '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="450" height="253" id="mycamera" align="middle">
<param name="allowScriptAccess" value="always" />
<param name="scale" value="exactfit" />
<param name="wmode" value="transparent" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="movie" value="'.$uc_avatarflash.'" />
<param name="menu" value="false" />
<embed src="'.$uc_avatarflash.'" quality="high" bgcolor="#ffffff" width="450" height="253" name="mycamera" align="middle" allowScriptAccess="always" allowFullScreen="false" scale="exactfit" wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>';
} else {
return array(
'width', '450',
'height', '253',
'scale', 'exactfit',
'src', $uc_avatarflash,
'id', 'mycamera',
'name', 'mycamera',
'quality','high',
'bgcolor','#ffffff',
'wmode','transparent',
'menu', 'false',
'swLiveConnect', 'true',
'allowScriptAccess', 'always'
);
}
}
function uc_mail_queue($uids, $emails, $subject, $message, $frommail = '', $charset = 'gbk', $htmlon = FALSE, $level = 1) {
return call_user_func(UC_API_FUNC, 'mail', 'add', array('uids' => $uids, 'emails' => $emails, 'subject' => $subject, 'message' => $message, 'frommail' => $frommail, 'charset' => $charset, 'htmlon' => $htmlon, 'level' => $level));
}
function uc_check_avatar($uid, $size = 'middle', $type = 'virtual') {
$url = UC_API."/avatar.php?uid=$uid&size=$size&type=$type&check_file_exists=1";
$res = uc_fopen2($url, 500000, '', '', TRUE, UC_IP, 20);
if($res == 1) {
return 1;
} else {
return 0;
}
}
function uc_check_version() {
$return = uc_api_post('version', 'check', array());
$data = uc_unserialize($return);
return is_array($data) ? $data : $return;
}
?>
|
108wo
|
phpsso_server/api/uc_client/client.php
|
PHP
|
asf20
| 19,506
|
<?php
/*
[UCenter] (C)2001-2009 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$Id: uccode.class.php 753 2008-11-14 06:48:25Z cnteacher $
*/
class uccode {
var $uccodes;
function uccode() {
$this->uccode = array(
'pcodecount' => -1,
'codecount' => 0,
'codehtml' => ''
);
}
function codedisp($code) {
$this->uccode['pcodecount']++;
$code = str_replace('\\"', '"', preg_replace("/^[\n\r]*(.+?)[\n\r]*$/is", "\\1", $code));
$this->uccode['codehtml'][$this->uccode['pcodecount']] = $this->tpl_codedisp($code);
$this->uccode['codecount']++;
return "[\tUCENTER_CODE_".$this->uccode[pcodecount]."\t]";
}
function complie($message) {
$message = htmlspecialchars($message);
if(strpos($message, '[/code]') !== FALSE) {
$message = preg_replace("/\s*\[code\](.+?)\[\/code\]\s*/ies", "\$this->codedisp('\\1')", $message);
}
if(strpos($message, '[/url]') !== FALSE) {
$message = preg_replace("/\[url(=((https?|ftp|gopher|news|telnet|rtsp|mms|callto|bctp|ed2k|thunder|synacast){1}:\/\/|www\.)([^\[\"']+?))?\](.+?)\[\/url\]/ies", "\$this->parseurl('\\1', '\\5')", $message);
}
if(strpos($message, '[/email]') !== FALSE) {
$message = preg_replace("/\[email(=([a-z0-9\-_.+]+)@([a-z0-9\-_]+[.][a-z0-9\-_.]+))?\](.+?)\[\/email\]/ies", "\$this->parseemail('\\1', '\\4')", $message);
}
$message = str_replace(array(
'[/color]', '[/size]', '[/font]', '[/align]', '[b]', '[/b]',
'[i]', '[/i]', '[u]', '[/u]', '[list]', '[list=1]', '[list=a]',
'[list=A]', '[*]', '[/list]', '[indent]', '[/indent]', '[/float]'
), array(
'</font>', '</font>', '</font>', '</p>', '<strong>', '</strong>', '<i>',
'</i>', '<u>', '</u>', '<ul>', '<ul type="1">', '<ul type="a">',
'<ul type="A">', '<li>', '</ul>', '<blockquote>', '</blockquote>', '</span>'
), preg_replace(array(
"/\[color=([#\w]+?)\]/i",
"/\[size=(\d+?)\]/i",
"/\[size=(\d+(\.\d+)?(px|pt|in|cm|mm|pc|em|ex|%)+?)\]/i",
"/\[font=([^\[\<]+?)\]/i",
"/\[align=(left|center|right)\]/i",
"/\[float=(left|right)\]/i"
), array(
"<font color=\"\\1\">",
"<font size=\"\\1\">",
"<font style=\"font-size: \\1\">",
"<font face=\"\\1 \">",
"<p align=\"\\1\">",
"<span style=\"float: \\1;\">"
), $message));
if(strpos($message, '[/quote]') !== FALSE) {
$message = preg_replace("/\s*\[quote\][\n\r]*(.+?)[\n\r]*\[\/quote\]\s*/is", $this->tpl_quote(), $message);
}
if(strpos($message, '[/img]') !== FALSE) {
$message = preg_replace(array(
"/\[img\]\s*([^\[\<\r\n]+?)\s*\[\/img\]/ies",
"/\[img=(\d{1,4})[x|\,](\d{1,4})\]\s*([^\[\<\r\n]+?)\s*\[\/img\]/ies"
), array(
"\$this->bbcodeurl('\\1', '<img src=\"%s\" border=\"0\" alt=\"\" />')",
"\$this->bbcodeurl('\\3', '<img width=\"\\1\" height=\"\\2\" src=\"%s\" border=\"0\" alt=\"\" />')"
), $message);
}
for($i = 0; $i <= $this->uccode['pcodecount']; $i++) {
$message = str_replace("[\tUCENTER_CODE_$i\t]", $this->uccode['codehtml'][$i], $message);
}
return nl2br(str_replace(array("\t", ' ', ' '), array(' ', ' ', ' '), $message));
}
function parseurl($url, $text) {
if(!$url && preg_match("/((https?|ftp|gopher|news|telnet|rtsp|mms|callto|bctp|ed2k|thunder|synacast){1}:\/\/|www\.)[^\[\"']+/i", trim($text), $matches)) {
$url = $matches[0];
$length = 65;
if(strlen($url) > $length) {
$text = substr($url, 0, intval($length * 0.5)).' ... '.substr($url, - intval($length * 0.3));
}
return '<a href="'.(substr(strtolower($url), 0, 4) == 'www.' ? 'http://'.$url : $url).'" target="_blank">'.$text.'</a>';
} else {
$url = substr($url, 1);
if(substr(strtolower($url), 0, 4) == 'www.') {
$url = 'http://'.$url;
}
return '<a href="'.$url.'" target="_blank">'.$text.'</a>';
}
}
function parseemail($email, $text) {
if(!$email && preg_match("/\s*([a-z0-9\-_.+]+)@([a-z0-9\-_]+[.][a-z0-9\-_.]+)\s*/i", $text, $matches)) {
$email = trim($matches[0]);
return '<a href="mailto:'.$email.'">'.$email.'</a>';
} else {
return '<a href="mailto:'.substr($email, 1).'">'.$text.'</a>';
}
}
function bbcodeurl($url, $tags) {
if(!preg_match("/<.+?>/s", $url)) {
if(!in_array(strtolower(substr($url, 0, 6)), array('http:/', 'https:', 'ftp://', 'rtsp:/', 'mms://'))) {
$url = 'http://'.$url;
}
return str_replace(array('submit', 'logging.php'), array('', ''), sprintf($tags, $url, addslashes($url)));
} else {
return ' '.$url;
}
}
function tpl_codedisp($code) {
return '<div class="blockcode"><code id="code'.$this->uccodes['codecount'].'">'.$code.'</code></div>';
}
function tpl_quote() {
return '<div class="quote"><blockquote>\\1</blockquote></div>';
}
}
/*
Usage:
$str = <<<EOF
1
2
3
EOF;
require_once 'lib/uccode.class.php';
$this->uccode = new uccode();
echo $this->uccode->complie($str);
*/
?>
|
108wo
|
phpsso_server/api/uc_client/lib/uccode.class.php
|
PHP
|
asf20
| 5,020
|
<?php
/*
[UCenter] (C)2001-2009 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$Id: db.class.php 922 2009-02-19 01:30:22Z zhaoxiongfei $
*/
class ucclient_db {
var $querynum = 0;
var $link;
var $histories;
var $dbhost;
var $dbuser;
var $dbpw;
var $dbcharset;
var $pconnect;
var $tablepre;
var $time;
var $goneaway = 5;
function connect($dbhost, $dbuser, $dbpw, $dbname = '', $dbcharset = '', $pconnect = 0, $tablepre='', $time = 0) {
$this->dbhost = $dbhost;
$this->dbuser = $dbuser;
$this->dbpw = $dbpw;
$this->dbname = $dbname;
$this->dbcharset = $dbcharset;
$this->pconnect = $pconnect;
$this->tablepre = $tablepre;
$this->time = $time;
if($pconnect) {
if(!$this->link = mysql_pconnect($dbhost, $dbuser, $dbpw)) {
$this->halt('Can not connect to MySQL server');
}
} else {
if(!$this->link = mysql_connect($dbhost, $dbuser, $dbpw)) {
$this->halt('Can not connect to MySQL server');
}
}
if($this->version() > '4.1') {
if($dbcharset) {
mysql_query("SET character_set_connection=".$dbcharset.", character_set_results=".$dbcharset.", character_set_client=binary", $this->link);
}
if($this->version() > '5.0.1') {
mysql_query("SET sql_mode=''", $this->link);
}
}
if($dbname) {
mysql_select_db($dbname, $this->link);
}
}
function fetch_array($query, $result_type = MYSQL_ASSOC) {
return mysql_fetch_array($query, $result_type);
}
function result_first($sql) {
$query = $this->query($sql);
return $this->result($query, 0);
}
function fetch_first($sql) {
$query = $this->query($sql);
return $this->fetch_array($query);
}
function fetch_all($sql, $id = '') {
$arr = array();
$query = $this->query($sql);
while($data = $this->fetch_array($query)) {
$id ? $arr[$data[$id]] = $data : $arr[] = $data;
}
return $arr;
}
function cache_gc() {
$this->query("DELETE FROM {$this->tablepre}sqlcaches WHERE expiry<$this->time");
}
function query($sql, $type = '', $cachetime = FALSE) {
$func = $type == 'UNBUFFERED' && @function_exists('mysql_unbuffered_query') ? 'mysql_unbuffered_query' : 'mysql_query';
if(!($query = $func($sql, $this->link)) && $type != 'SILENT') {
$this->halt('MySQL Query Error', $sql);
}
$this->querynum++;
$this->histories[] = $sql;
return $query;
}
function affected_rows() {
return mysql_affected_rows($this->link);
}
function error() {
return (($this->link) ? mysql_error($this->link) : mysql_error());
}
function errno() {
return intval(($this->link) ? mysql_errno($this->link) : mysql_errno());
}
function result($query, $row) {
$query = @mysql_result($query, $row);
return $query;
}
function num_rows($query) {
$query = mysql_num_rows($query);
return $query;
}
function num_fields($query) {
return mysql_num_fields($query);
}
function free_result($query) {
return mysql_free_result($query);
}
function insert_id() {
return ($id = mysql_insert_id($this->link)) >= 0 ? $id : $this->result($this->query("SELECT last_insert_id()"), 0);
}
function fetch_row($query) {
$query = mysql_fetch_row($query);
return $query;
}
function fetch_fields($query) {
return mysql_fetch_field($query);
}
function version() {
return mysql_get_server_info($this->link);
}
function close() {
return mysql_close($this->link);
}
function halt($message = '', $sql = '') {
$error = mysql_error();
$errorno = mysql_errno();
if($errorno == 2006 && $this->goneaway-- > 0) {
$this->connect($this->dbhost, $this->dbuser, $this->dbpw, $this->dbname, $this->dbcharset, $this->pconnect, $this->tablepre, $this->time);
$this->query($sql);
} else {
$s = '';
if($message) {
$s = "<b>UCenter info:</b> $message<br />";
}
if($sql) {
$s .= '<b>SQL:</b>'.htmlspecialchars($sql).'<br />';
}
$s .= '<b>Error:</b>'.$error.'<br />';
$s .= '<b>Errno:</b>'.$errorno.'<br />';
$s = str_replace(UC_DBTABLEPRE, '[Table]', $s);
exit($s);
}
}
}
?>
|
108wo
|
phpsso_server/api/uc_client/lib/db.class.php
|
PHP
|
asf20
| 4,177
|
<?php
/*
[UCenter] (C)2001-2009 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$Id: sendmail.inc.php 753 2008-11-14 06:48:25Z cnteacher $
*/
!defined('IN_UC') && exit('Access Denied');
if($mail_setting['mailsilent']) {
error_reporting(0);
}
$maildelimiter = $mail_setting['maildelimiter'] == 1 ? "\r\n" : ($mail_setting['maildelimiter'] == 2 ? "\r" : "\n");
$mailusername = isset($mail_setting['mailusername']) ? $mail_setting['mailusername'] : 1;
$appname = $this->base->cache['apps'][$mail['appid']]['name'];
$mail['subject'] = '=?'.$mail['charset'].'?B?'.base64_encode(str_replace("\r", '', str_replace("\n", '', '['.$appname.'] '.$mail['subject']))).'?=';
$mail['message'] = chunk_split(base64_encode(str_replace("\r\n.", " \r\n..", str_replace("\n", "\r\n", str_replace("\r", "\n", str_replace("\r\n", "\n", str_replace("\n\r", "\r", $mail['message'])))))));
$email_from = $mail['frommail'] == '' ? '=?'.$mail['charset'].'?B?'.base64_encode($appname)."?= <$mail_setting[maildefault]>" : (preg_match('/^(.+?) \<(.+?)\>$/',$email_from, $from) ? '=?'.$mail['charset'].'?B?'.base64_encode($from[1])."?= <$from[2]>" : $mail['frommail']);
foreach(explode(',', $mail['email_to']) as $touser) {
$tousers[] = preg_match('/^(.+?) \<(.+?)\>$/',$touser, $to) ? ($mailusername ? '=?'.$mail['charset'].'?B?'.base64_encode($to[1])."?= <$to[2]>" : $to[2]) : $touser;
}
$mail['email_to'] = implode(',', $tousers);
$headers = "From: $email_from{$maildelimiter}X-Priority: 3{$maildelimiter}X-Mailer: Discuz! $version{$maildelimiter}MIME-Version: 1.0{$maildelimiter}Content-type: text/".($mail['htmlon'] ? 'html' : 'plain')."; charset=$mail[charset]{$maildelimiter}Content-Transfer-Encoding: base64{$maildelimiter}";
$mail_setting['mailport'] = $mail_setting['mailport'] ? $mail_setting['mailport'] : 25;
if($mail_setting['mailsend'] == 1 && function_exists('mail')) {
return @mail($mail['email_to'], $mail['subject'], $mail['message'], $headers);
} elseif($mail_setting['mailsend'] == 2) {
if(!$fp = fsockopen($mail_setting['mailserver'], $mail_setting['mailport'], $errno, $errstr, 30)) {
return false;
}
stream_set_blocking($fp, true);
$lastmessage = fgets($fp, 512);
if(substr($lastmessage, 0, 3) != '220') {
return false;
}
fputs($fp, ($mail_setting['mailauth'] ? 'EHLO' : 'HELO')." discuz\r\n");
$lastmessage = fgets($fp, 512);
if(substr($lastmessage, 0, 3) != 220 && substr($lastmessage, 0, 3) != 250) {
return false;
}
while(1) {
if(substr($lastmessage, 3, 1) != '-' || empty($lastmessage)) {
break;
}
$lastmessage = fgets($fp, 512);
}
if($mail_setting['mailauth']) {
fputs($fp, "AUTH LOGIN\r\n");
$lastmessage = fgets($fp, 512);
if(substr($lastmessage, 0, 3) != 334) {
return false;
}
fputs($fp, base64_encode($mail_setting['mailauth_username'])."\r\n");
$lastmessage = fgets($fp, 512);
if(substr($lastmessage, 0, 3) != 334) {
return false;
}
fputs($fp, base64_encode($mail_setting['mailauth_password'])."\r\n");
$lastmessage = fgets($fp, 512);
if(substr($lastmessage, 0, 3) != 235) {
return false;
}
$email_from = $mail_setting['mailfrom'];
}
fputs($fp, "MAIL FROM: <".preg_replace("/.*\<(.+?)\>.*/", "\\1", $email_from).">\r\n");
$lastmessage = fgets($fp, 512);
if(substr($lastmessage, 0, 3) != 250) {
fputs($fp, "MAIL FROM: <".preg_replace("/.*\<(.+?)\>.*/", "\\1", $email_from).">\r\n");
$lastmessage = fgets($fp, 512);
if(substr($lastmessage, 0, 3) != 250) {
return false;
}
}
$email_tos = array();
foreach(explode(',', $mail['email_to']) as $touser) {
$touser = trim($touser);
if($touser) {
fputs($fp, "RCPT TO: <".preg_replace("/.*\<(.+?)\>.*/", "\\1", $touser).">\r\n");
$lastmessage = fgets($fp, 512);
if(substr($lastmessage, 0, 3) != 250) {
fputs($fp, "RCPT TO: <".preg_replace("/.*\<(.+?)\>.*/", "\\1", $touser).">\r\n");
$lastmessage = fgets($fp, 512);
return false;
}
}
}
fputs($fp, "DATA\r\n");
$lastmessage = fgets($fp, 512);
if(substr($lastmessage, 0, 3) != 354) {
return false;
}
$headers .= 'Message-ID: <'.gmdate('YmdHs').'.'.substr(md5($mail['message'].microtime()), 0, 6).rand(100000, 999999).'@'.$_SERVER['HTTP_HOST'].">{$maildelimiter}";
fputs($fp, "Date: ".gmdate('r')."\r\n");
fputs($fp, "To: ".$mail['email_to']."\r\n");
fputs($fp, "Subject: ".$mail['subject']."\r\n");
fputs($fp, $headers."\r\n");
fputs($fp, "\r\n\r\n");
fputs($fp, "$mail[message]\r\n.\r\n");
$lastmessage = fgets($fp, 512);
if(substr($lastmessage, 0, 3) != 250) {
return false;
}
fputs($fp, "QUIT\r\n");
return true;
} elseif($mail_setting['mailsend'] == 3) {
ini_set('SMTP', $mail_setting['mailserver']);
ini_set('smtp_port', $mail_setting['mailport']);
ini_set('sendmail_from', $email_from);
return @mail($mail['email_to'], $mail['subject'], $mail['message'], $headers);
}
?>
|
108wo
|
phpsso_server/api/uc_client/lib/sendmail.inc.php
|
PHP
|
asf20
| 5,010
|
<?php
/*
[UCenter] (C)2001-2009 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$Id: xml.class.php 972 2009-11-16 02:20:39Z zhaoxiongfei $
*/
function xml_unserialize(&$xml, $isnormal = FALSE) {
$xml_parser = new XML($isnormal);
$data = $xml_parser->parse($xml);
$xml_parser->destruct();
return $data;
}
function xml_serialize($arr, $htmlon = FALSE, $isnormal = FALSE, $level = 1) {
$s = $level == 1 ? "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\r\n<root>\r\n" : '';
$space = str_repeat("\t", $level);
foreach($arr as $k => $v) {
if(!is_array($v)) {
$s .= $space."<item id=\"$k\">".($htmlon ? '<![CDATA[' : '').$v.($htmlon ? ']]>' : '')."</item>\r\n";
} else {
$s .= $space."<item id=\"$k\">\r\n".xml_serialize($v, $htmlon, $isnormal, $level + 1).$space."</item>\r\n";
}
}
$s = preg_replace("/([\x01-\x08\x0b-\x0c\x0e-\x1f])+/", ' ', $s);
return $level == 1 ? $s."</root>" : $s;
}
class XML {
var $parser;
var $document;
var $stack;
var $data;
var $last_opened_tag;
var $isnormal;
var $attrs = array();
var $failed = FALSE;
function __construct($isnormal) {
$this->XML($isnormal);
}
function XML($isnormal) {
$this->isnormal = $isnormal;
$this->parser = xml_parser_create('ISO-8859-1');
xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, false);
xml_set_object($this->parser, $this);
xml_set_element_handler($this->parser, 'open','close');
xml_set_character_data_handler($this->parser, 'data');
}
function destruct() {
xml_parser_free($this->parser);
}
function parse(&$data) {
$this->document = array();
$this->stack = array();
return xml_parse($this->parser, $data, true) && !$this->failed ? $this->document : '';
}
function open(&$parser, $tag, $attributes) {
$this->data = '';
$this->failed = FALSE;
if(!$this->isnormal) {
if(isset($attributes['id']) && !is_string($this->document[$attributes['id']])) {
$this->document = &$this->document[$attributes['id']];
} else {
$this->failed = TRUE;
}
} else {
if(!isset($this->document[$tag]) || !is_string($this->document[$tag])) {
$this->document = &$this->document[$tag];
} else {
$this->failed = TRUE;
}
}
$this->stack[] = &$this->document;
$this->last_opened_tag = $tag;
$this->attrs = $attributes;
}
function data(&$parser, $data) {
if($this->last_opened_tag != NULL) {
$this->data .= $data;
}
}
function close(&$parser, $tag) {
if($this->last_opened_tag == $tag) {
$this->document = $this->data;
$this->last_opened_tag = NULL;
}
array_pop($this->stack);
if($this->stack) {
$this->document = &$this->stack[count($this->stack)-1];
}
}
}
?>
|
108wo
|
phpsso_server/api/uc_client/lib/xml.class.php
|
PHP
|
asf20
| 2,792
|
<?php
/*
[UCenter] (C)2001-2009 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$Id: mail.php 848 2008-12-08 05:43:39Z zhaoxiongfei $
*/
!defined('IN_UC') && exit('Access Denied');
define('UC_MAIL_REPEAT', 5);
class mailmodel {
var $db;
var $base;
var $apps;
function __construct(&$base) {
$this->mailmodel($base);
}
function mailmodel(&$base) {
$this->base = $base;
$this->db = $base->db;
$this->apps = &$this->base->cache['apps'];
}
function get_total_num() {
$data = $this->db->result_first("SELECT COUNT(*) FROM ".UC_DBTABLEPRE."mailqueue");
return $data;
}
function get_list($page, $ppp, $totalnum) {
$start = $this->base->page_get_start($page, $ppp, $totalnum);
$data = $this->db->fetch_all("SELECT m.*, u.username, u.email FROM ".UC_DBTABLEPRE."mailqueue m LEFT JOIN ".UC_DBTABLEPRE."members u ON m.touid=u.uid ORDER BY dateline DESC LIMIT $start, $ppp");
foreach((array)$data as $k => $v) {
$data[$k]['subject'] = htmlspecialchars($v['subject']);
$data[$k]['tomail'] = empty($v['tomail']) ? $v['email'] : $v['tomail'];
$data[$k]['dateline'] = $v['dateline'] ? $this->base->date($data[$k]['dateline']) : '';
$data[$k]['appname'] = $this->base->cache['apps'][$v['appid']]['name'];
}
return $data;
}
function delete_mail($ids) {
$ids = $this->base->implode($ids);
$this->db->query("DELETE FROM ".UC_DBTABLEPRE."mailqueue WHERE mailid IN ($ids)");
return $this->db->affected_rows();
}
function add($mail) {
if($mail['level']) {
$sql = "INSERT INTO ".UC_DBTABLEPRE."mailqueue (touid, tomail, subject, message, frommail, charset, htmlon, level, dateline, failures, appid) VALUES ";
$values_arr = array();
foreach($mail['uids'] as $uid) {
if(empty($uid)) continue;
$values_arr[] = "('$uid', '', '$mail[subject]', '$mail[message]', '$mail[frommail]', '$mail[charset]', '$mail[htmlon]', '$mail[level]', '$mail[dateline]', '0', '$mail[appid]')";
}
foreach($mail['emails'] as $email) {
if(empty($email)) continue;
$values_arr[] = "('', '$email', '$mail[subject]', '$mail[message]', '$mail[frommail]', '$mail[charset]', '$mail[htmlon]', '$mail[level]', '$mail[dateline]', '0', '$mail[appid]')";
}
$sql .= implode(',', $values_arr);
$this->db->query($sql);
$insert_id = $this->db->insert_id();
$insert_id && $this->db->query("REPLACE INTO ".UC_DBTABLEPRE."vars SET name='mailexists', value='1'");
return $insert_id;
} else {
$mail['email_to'] = array();
$uids = 0;
foreach($mail['uids'] as $uid) {
if(empty($uid)) continue;
$uids .= ','.$uid;
}
$users = $this->db->fetch_all("SELECT uid, username, email FROM ".UC_DBTABLEPRE."members WHERE uid IN ($uids)");
foreach($users as $v) {
$mail['email_to'][] = $v['username'].'<'.$v['email'].'>';
}
foreach($mail['emails'] as $email) {
if(empty($email)) continue;
$mail['email_to'][] = $email;
}
$mail['message'] = str_replace('\"', '"', $mail['message']);
$mail['email_to'] = implode(',', $mail['email_to']);
return $this->send_one_mail($mail);
}
}
function send() {
register_shutdown_function(array($this, '_send'));
}
function _send() {
$mail = $this->_get_mail();
if(empty($mail)) {
$this->db->query("REPLACE INTO ".UC_DBTABLEPRE."vars SET name='mailexists', value='0'");
return NULL;
} else {
$mail['email_to'] = $mail['tomail'] ? $mail['tomail'] : $mail['username'].'<'.$mail['email'].'>';
if($this->send_one_mail($mail)) {
$this->_delete_one_mail($mail['mailid']);
return true;
} else {
$this->_update_failures($mail['mailid']);
return false;
}
}
}
function send_by_id($mailid) {
if ($this->send_one_mail($this->_get_mail_by_id($mailid))) {
$this->_delete_one_mail($mailid);
return true;
}
}
function send_one_mail($mail) {
if(empty($mail)) return;
$mail['email_to'] = $mail['email_to'] ? $mail['email_to'] : $mail['username'].'<'.$mail['email'].'>';
$mail_setting = $this->base->settings;
return include UC_ROOT.'lib/sendmail.inc.php';
}
function _get_mail() {
$data = $this->db->fetch_first("SELECT m.*, u.username, u.email FROM ".UC_DBTABLEPRE."mailqueue m LEFT JOIN ".UC_DBTABLEPRE."members u ON m.touid=u.uid WHERE failures<'".UC_MAIL_REPEAT."' ORDER BY level DESC, mailid ASC LIMIT 1");
return $data;
}
function _get_mail_by_id($mailid) {
$data = $this->db->fetch_first("SELECT m.*, u.username, u.email FROM ".UC_DBTABLEPRE."mailqueue m LEFT JOIN ".UC_DBTABLEPRE."members u ON m.touid=u.uid WHERE mailid='$mailid'");
return $data;
}
function _delete_one_mail($mailid) {
$mailid = intval($mailid);
return $this->db->query("DELETE FROM ".UC_DBTABLEPRE."mailqueue WHERE mailid='$mailid'");
}
function _update_failures($mailid) {
$mailid = intval($mailid);
return $this->db->query("UPDATE ".UC_DBTABLEPRE."mailqueue SET failures=failures+1 WHERE mailid='$mailid'");
}
}
?>
|
108wo
|
phpsso_server/api/uc_client/model/mail.php
|
PHP
|
asf20
| 5,074
|
<?php
/*
[UCenter] (C)2001-2009 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$Id: base.php 837 2008-12-05 03:14:47Z zhaoxiongfei $
*/
!defined('IN_UC') && exit('Access Denied');
if(!function_exists('getgpc')) {
function getgpc($k, $var='G') {
switch($var) {
case 'G': $var = &$_GET; break;
case 'P': $var = &$_POST; break;
case 'C': $var = &$_COOKIE; break;
case 'R': $var = &$_REQUEST; break;
}
return isset($var[$k]) ? $var[$k] : NULL;
}
}
class base {
var $time;
var $onlineip;
var $db;
var $key;
var $settings = array();
var $cache = array();
var $app = array();
var $user = array();
var $input = array();
function __construct() {
$this->base();
}
function base() {
$this->init_var();
$this->init_db();
$this->init_cache();
$this->init_note();
$this->init_mail();
}
function init_var() {
$this->time = time();
$cip = getenv('HTTP_CLIENT_IP');
$xip = getenv('HTTP_X_FORWARDED_FOR');
$rip = getenv('REMOTE_ADDR');
$srip = $_SERVER['REMOTE_ADDR'];
if($cip && strcasecmp($cip, 'unknown')) {
$this->onlineip = $cip;
} elseif($xip && strcasecmp($xip, 'unknown')) {
$this->onlineip = $xip;
} elseif($rip && strcasecmp($rip, 'unknown')) {
$this->onlineip = $rip;
} elseif($srip && strcasecmp($srip, 'unknown')) {
$this->onlineip = $srip;
}
preg_match("/[\d\.]{7,15}/", $this->onlineip, $match);
$this->onlineip = $match[0] ? $match[0] : 'unknown';
$this->app['appid'] = UC_APPID;
}
function init_input() {
}
function init_db() {
require_once UC_ROOT.'lib/db.class.php';
$this->db = new ucclient_db();
$this->db->connect(UC_DBHOST, UC_DBUSER, UC_DBPW, UC_DBNAME, UC_DBCHARSET, UC_DBCONNECT, UC_DBTABLEPRE);
}
function load($model, $base = NULL) {
$base = $base ? $base : $this;
if(empty($_ENV[$model])) {
require_once UC_ROOT."./model/$model.php";
eval('$_ENV[$model] = new '.$model.'model($base);');
}
return $_ENV[$model];
}
function date($time, $type = 3) {
if(!$this->settings) {
$this->settings = $this->cache('settings');
}
$format[] = $type & 2 ? (!empty($this->settings['dateformat']) ? $this->settings['dateformat'] : 'Y-n-j') : '';
$format[] = $type & 1 ? (!empty($this->settings['timeformat']) ? $this->settings['timeformat'] : 'H:i') : '';
return gmdate(implode(' ', $format), $time + $this->settings['timeoffset']);
}
function page_get_start($page, $ppp, $totalnum) {
$totalpage = ceil($totalnum / $ppp);
$page = max(1, min($totalpage,intval($page)));
return ($page - 1) * $ppp;
}
function implode($arr) {
return "'".implode("','", (array)$arr)."'";
}
function &cache($cachefile) {
static $_CACHE = array();
if(!isset($_CACHE[$cachefile])) {
$cachepath = UC_DATADIR.'./cache/'.$cachefile.'.php';
if(!file_exists($cachepath)) {
$this->load('cache');
$_ENV['cache']->updatedata($cachefile);
} else {
include_once $cachepath;
}
}
return $_CACHE[$cachefile];
}
function get_setting($k = array(), $decode = FALSE) {
$return = array();
$sqladd = $k ? "WHERE k IN (".$this->implode($k).")" : '';
$settings = $this->db->fetch_all("SELECT * FROM ".UC_DBTABLEPRE."settings $sqladd");
if(is_array($settings)) {
foreach($settings as $arr) {
$return[$arr['k']] = $decode ? unserialize($arr['v']) : $arr['v'];
}
}
return $return;
}
function init_cache() {
$this->settings = $this->cache('settings');
$this->cache['apps'] = $this->cache('apps');
if(PHP_VERSION > '5.1') {
$timeoffset = intval($this->settings['timeoffset'] / 3600);
@date_default_timezone_set('Etc/GMT'.($timeoffset > 0 ? '-' : '+').(abs($timeoffset)));
}
}
function cutstr($string, $length, $dot = ' ...') {
if(strlen($string) <= $length) {
return $string;
}
$string = str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $string);
$strcut = '';
if(strtolower(UC_CHARSET) == 'utf-8') {
$n = $tn = $noc = 0;
while($n < strlen($string)) {
$t = ord($string[$n]);
if($t == 9 || $t == 10 || (32 <= $t && $t <= 126)) {
$tn = 1; $n++; $noc++;
} elseif(194 <= $t && $t <= 223) {
$tn = 2; $n += 2; $noc += 2;
} elseif(224 <= $t && $t < 239) {
$tn = 3; $n += 3; $noc += 2;
} elseif(240 <= $t && $t <= 247) {
$tn = 4; $n += 4; $noc += 2;
} elseif(248 <= $t && $t <= 251) {
$tn = 5; $n += 5; $noc += 2;
} elseif($t == 252 || $t == 253) {
$tn = 6; $n += 6; $noc += 2;
} else {
$n++;
}
if($noc >= $length) {
break;
}
}
if($noc > $length) {
$n -= $tn;
}
$strcut = substr($string, 0, $n);
} else {
for($i = 0; $i < $length; $i++) {
$strcut .= ord($string[$i]) > 127 ? $string[$i].$string[++$i] : $string[$i];
}
}
$strcut = str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $strcut);
return $strcut.$dot;
}
function init_note() {
if($this->note_exists()) {
$this->load('note');
$_ENV['note']->send();
}
}
function note_exists() {
$noteexists = $this->db->fetch_first("SELECT value FROM ".UC_DBTABLEPRE."vars WHERE name='noteexists".UC_APPID."'");
if(empty($noteexists)) {
return FALSE;
} else {
return TRUE;
}
}
function init_mail() {
if($this->mail_exists() && !getgpc('inajax')) {
$this->load('mail');
$_ENV['mail']->send();
}
}
function authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) {
return uc_authcode($string, $operation, $key, $expiry);
}
/*
function serialize() {
}
*/
function unserialize($s) {
return uc_unserialize($s);
}
function input($k) {
return isset($this->input[$k]) ? (is_array($this->input[$k]) ? $this->input[$k] : trim($this->input[$k])) : NULL;
}
function mail_exists() {
$mailexists = $this->db->fetch_first("SELECT value FROM ".UC_DBTABLEPRE."vars WHERE name='mailexists'");
if(empty($mailexists)) {
return FALSE;
} else {
return TRUE;
}
}
function dstripslashes($string) {
if(is_array($string)) {
foreach($string as $key => $val) {
$string[$key] = $this->dstripslashes($val);
}
} else {
$string = stripslashes($string);
}
return $string;
}
}
?>
|
108wo
|
phpsso_server/api/uc_client/model/base.php
|
PHP
|
asf20
| 6,456
|
<?php
/*
[UCenter] (C)2001-2009 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$Id: pm.php 908 2008-12-26 07:27:51Z monkey $
*/
!defined('IN_UC') && exit('Access Denied');
class pmmodel {
var $db;
var $base;
function __construct(&$base) {
$this->pmmodel($base);
}
function pmmodel(&$base) {
$this->base = $base;
$this->db = $base->db;
}
function pmintval($pmid) {
return @is_numeric($pmid) ? $pmid : 0;
}
function get_pm_by_pmid($uid, $pmid) {
$arr = $this->db->fetch_all("SELECT * FROM ".UC_DBTABLEPRE."pms WHERE pmid='$pmid' AND (msgtoid IN ('$uid','0') OR msgfromid='$uid')");
return $arr;
}
function get_pm_by_touid($uid, $touid, $starttime, $endtime) {
$arr1 = $this->db->fetch_all("SELECT * FROM ".UC_DBTABLEPRE."pms WHERE msgfromid='$uid' AND msgtoid='$touid' AND dateline>='$starttime' AND dateline<'$endtime' AND related>'0' AND delstatus IN (0,2) ORDER BY dateline");
$arr2 = $this->db->fetch_all("SELECT * FROM ".UC_DBTABLEPRE."pms WHERE msgfromid='$touid' AND msgtoid='$uid' AND dateline>='$starttime' AND dateline<'$endtime' AND related>'0' AND delstatus IN (0,1) ORDER BY dateline");
$arr = array_merge($arr1, $arr2);
uasort($arr, 'pm_datelinesort');
return $arr;
}
function get_pmnode_by_pmid($uid, $pmid, $type = 0) {
$arr = array();
if($type == 1) {
$arr = $this->db->fetch_first("SELECT * FROM ".UC_DBTABLEPRE."pms WHERE msgfromid='$uid' and folder='inbox' ORDER BY dateline DESC LIMIT 1");
} elseif($type == 2) {
$arr = $this->db->fetch_first("SELECT * FROM ".UC_DBTABLEPRE."pms WHERE msgtoid='$uid' and folder='inbox' ORDER BY dateline DESC LIMIT 1");
} else {
$arr = $this->db->fetch_first("SELECT * FROM ".UC_DBTABLEPRE."pms WHERE pmid='$pmid'");
}
return $arr;
}
function set_pm_status($uid, $touid, $pmid = 0, $status = 0) {
if(!$status) {
$oldstatus = 1;
$newstatus = 0;
} else {
$oldstatus = 0;
$newstatus = 1;
}
if($touid) {
$ids = is_array($touid) ? $this->base->implode($touid) : $touid;
$this->db->query("UPDATE ".UC_DBTABLEPRE."pms SET new='$newstatus' WHERE msgfromid IN ($ids) AND msgtoid='$uid' AND new='$oldstatus'", 'UNBUFFERED');
}
if($pmid) {
$ids = is_array($pmid) ? $this->base->implode($pmid) : $pmid;
$this->db->query("UPDATE ".UC_DBTABLEPRE."pms SET new='$newstatus' WHERE pmid IN ($ids) AND msgtoid='$uid' AND new='$oldstatus'", 'UNBUFFERED');
}
}
function get_pm_num() {
}
function get_num($uid, $folder, $filter = '') {
switch($folder) {
case 'newbox':
$sql = "SELECT count(*) FROM ".UC_DBTABLEPRE."pms WHERE msgtoid='$uid' AND (related='0' AND msgfromid>'0' OR msgfromid='0') AND folder='inbox' AND new='1'";
$num = $this->db->result_first($sql);
return $num;
case 'outbox':
case 'inbox':
if($filter == 'newpm') {
$filteradd = "msgtoid='$uid' AND (related='0' AND msgfromid>'0' OR msgfromid='0') AND folder='inbox' AND new='1'";
} elseif($filter == 'systempm') {
$filteradd = "msgtoid='$uid' AND msgfromid='0' AND folder='inbox'";
} elseif($filter == 'privatepm') {
$filteradd = "msgtoid='$uid' AND related='0' AND msgfromid>'0' AND folder='inbox'";
} elseif($filter == 'announcepm') {
$filteradd = "msgtoid='0' AND folder='inbox'";
} else {
$filteradd = "msgtoid='$uid' AND related='0' AND folder='inbox'";
}
$sql = "SELECT count(*) FROM ".UC_DBTABLEPRE."pms WHERE $filteradd";
break;
case 'savebox':
break;
}
$num = $this->db->result_first($sql);
return $num;
}
function get_pm_list($uid, $pmnum, $folder, $filter, $start, $ppp = 10) {
$ppp = $ppp ? $ppp : 10;
switch($folder) {
case 'newbox':
$folder = 'inbox';
$filter = 'newpm';
case 'outbox':
case 'inbox':
if($filter == 'newpm') {
$filteradd = "pm.msgtoid='$uid' AND (pm.related='0' AND pm.msgfromid>'0' OR pm.msgfromid='0') AND pm.folder='inbox' AND pm.new='1'";
} elseif($filter == 'systempm') {
$filteradd = "pm.msgtoid='$uid' AND pm.msgfromid='0' AND pm.folder='inbox'";
} elseif($filter == 'privatepm') {
$filteradd = "pm.msgtoid='$uid' AND pm.related='0' AND pm.msgfromid>'0' AND pm.folder='inbox'";
} elseif($filter == 'announcepm') {
$filteradd = "pm.msgtoid='0' AND pm.folder='inbox'";
} else {
$filteradd = "pm.msgtoid='$uid' AND pm.related='0' AND pm.folder='inbox'";
}
$sql = "SELECT pm.*,m.username as msgfrom FROM ".UC_DBTABLEPRE."pms pm
LEFT JOIN ".UC_DBTABLEPRE."members m ON pm.msgfromid = m.uid
WHERE $filteradd ORDER BY pm.dateline DESC LIMIT $start, $ppp";
break;
case 'searchbox':
$filteradd = "msgtoid='$uid' AND folder='inbox' AND message LIKE '%".(str_replace('_', '\_', addcslashes($filter, '%_')))."%'";
$sql = "SELECT * FROM ".UC_DBTABLEPRE."pms
WHERE $filteradd ORDER BY dateline DESC LIMIT $start, $ppp";
break;
case 'savebox':
break;
}
$query = $this->db->query($sql);
$array = array();
$today = $this->base->time - $this->base->time % 86400;
while($data = $this->db->fetch_array($query)) {
$daterange = 5;
if($data['dateline'] >= $today) {
$daterange = 1;
} elseif($data['dateline'] >= $today - 86400) {
$daterange = 2;
} elseif($data['dateline'] >= $today - 172800) {
$daterange = 3;
} elseif($data['dateline'] >= $today - 604800) {
$daterange = 4;
}
$data['daterange'] = $daterange;
$data['subject'] = htmlspecialchars($data['subject']);
if($filter == 'announcepm') {
unset($data['msgfromid'], $data['msgfrom']);
}
$data['touid'] = $uid == $data['msgfromid'] ? $data['msgtoid'] : $data['msgfromid'];
$array[] = $data;
}
if($folder == 'inbox') {
$this->db->query("DELETE FROM ".UC_DBTABLEPRE."newpm WHERE uid='$uid'", 'UNBUFFERED');
}
return $array;
}
function sendpm($subject, $message, $msgfrom, $msgto, $related = 0) {
if($msgfrom['uid'] && $msgfrom['uid'] == $msgto) {
return 0;
}
$_CACHE['badwords'] = $this->base->cache('badwords');
if($_CACHE['badwords']['findpattern']) {
$subject = @preg_replace($_CACHE['badwords']['findpattern'], $_CACHE['badwords']['replace'], $subject);
$message = @preg_replace($_CACHE['badwords']['findpattern'], $_CACHE['badwords']['replace'], $message);
}
$box = 'inbox';
$subject = trim($subject);
if($subject == '' && !$related) {
$subject = $this->removecode(trim($message), 75);
} else {
$subject = $this->base->cutstr(trim($subject), 75, ' ');
}
if($msgfrom['uid']) {
$sessionexist = $this->db->result_first("SELECT count(*) FROM ".UC_DBTABLEPRE."pms WHERE msgfromid='$msgfrom[uid]' AND msgtoid='$msgto' AND folder='inbox' AND related='0'");
if(!$sessionexist || $sessionexist > 1) {
if($sessionexist > 1) {
$this->db->query("DELETE FROM ".UC_DBTABLEPRE."pms WHERE msgfromid='$msgfrom[uid]' AND msgtoid='$msgto' AND folder='inbox' AND related='0'");
}
$this->db->query("INSERT INTO ".UC_DBTABLEPRE."pms (msgfrom,msgfromid,msgtoid,folder,new,subject,dateline,related,message,fromappid) VALUES
('".$msgfrom['username']."','".$msgfrom['uid']."','$msgto','$box','1','$subject','".$this->base->time."','0','$message','".$this->base->app['appid']."')");
$lastpmid = $this->db->insert_id();
} else {
$this->db->query("UPDATE ".UC_DBTABLEPRE."pms SET subject='$subject', message='$message', dateline='".$this->base->time."', new='1', fromappid='".$this->base->app['appid']."'
WHERE msgfromid='$msgfrom[uid]' AND msgtoid='$msgto' AND folder='inbox' AND related='0'");
}
if(!$savebox) {
$sessionexist = $this->db->result_first("SELECT count(*) FROM ".UC_DBTABLEPRE."pms WHERE msgfromid='$msgto' AND msgtoid='$msgfrom[uid]' AND folder='inbox' AND related='0'");
if($msgfrom['uid'] && !$sessionexist) {
$this->db->query("INSERT INTO ".UC_DBTABLEPRE."pms (msgfrom,msgfromid,msgtoid,folder,new,subject,dateline,related,message,fromappid) VALUES
('".$msgfrom['username']."','$msgto','".$msgfrom['uid']."','$box','0','$subject','".$this->base->time."','0','$message','0')");
}
$this->db->query("INSERT INTO ".UC_DBTABLEPRE."pms (msgfrom,msgfromid,msgtoid,folder,new,subject,dateline,related,message,fromappid) VALUES
('".$msgfrom['username']."','".$msgfrom['uid']."','$msgto','$box','1','$subject','".$this->base->time."','1','$message','".$this->base->app['appid']."')");
$lastpmid = $this->db->insert_id();
}
} else {
$this->db->query("INSERT INTO ".UC_DBTABLEPRE."pms (msgfrom,msgfromid,msgtoid,folder,new,subject,dateline,related,message,fromappid) VALUES
('".$msgfrom['username']."','".$msgfrom['uid']."','$msgto','$box','1','$subject','".$this->base->time."','0','$message','".$this->base->app['appid']."')");
$lastpmid = $this->db->insert_id();
}
$this->db->query("REPLACE INTO ".UC_DBTABLEPRE."newpm (uid) VALUES ('$msgto')");
return $lastpmid;
}
function set_ignore($uid) {
$this->db->query("DELETE FROM ".UC_DBTABLEPRE."newpm WHERE uid='$uid'");
}
function check_newpm($uid, $more) {
if($more < 2) {
$newpm = $this->db->result_first("SELECT count(*) FROM ".UC_DBTABLEPRE."newpm WHERE uid='$uid'");
if($newpm) {
$newpm = $this->db->result_first("SELECT count(*) FROM ".UC_DBTABLEPRE."pms WHERE (related='0' AND msgfromid>'0' OR msgfromid='0') AND msgtoid='$uid' AND folder='inbox' AND new='1'");
if($more) {
$newprvpm = $this->db->result_first("SELECT count(*) FROM ".UC_DBTABLEPRE."pms WHERE related='0' AND msgfromid>'0' AND msgtoid='$uid' AND folder='inbox' AND new='1'");
return array('newpm' => $newpm, 'newprivatepm' => $newprvpm);
} else {
return $newpm;
}
}
} else {
$newpm = $this->db->result_first("SELECT count(*) FROM ".UC_DBTABLEPRE."pms WHERE (related='0' AND msgfromid>'0' OR msgfromid='0') AND msgtoid='$uid' AND folder='inbox' AND new='1'");
$newprvpm = $this->db->result_first("SELECT count(*) FROM ".UC_DBTABLEPRE."pms WHERE related='0' AND msgfromid>'0' AND msgtoid='$uid' AND folder='inbox' AND new='1'");
if($more == 2 || $more == 3) {
$annpm = $this->db->result_first("SELECT count(*) FROM ".UC_DBTABLEPRE."pms WHERE related='0' AND msgtoid='0' AND folder='inbox'");
$syspm = $this->db->result_first("SELECT count(*) FROM ".UC_DBTABLEPRE."pms WHERE related='0' AND msgtoid='$uid' AND folder='inbox' AND msgfromid='0'");
}
if($more == 2) {
return array('newpm' => $newpm, 'newprivatepm' => $newprvpm, 'announcepm' => $annpm, 'systempm' => $syspm);
} if($more == 4) {
return array('newpm' => $newpm, 'newprivatepm' => $newprvpm);
} else {
$pm = $this->db->fetch_first("SELECT pm.dateline,pm.msgfromid,m.username as msgfrom,pm.message FROM ".UC_DBTABLEPRE."pms pm LEFT JOIN ".UC_DBTABLEPRE."members m ON pm.msgfromid = m.uid WHERE (pm.related='0' OR pm.msgfromid='0') AND pm.msgtoid='$uid' AND pm.folder='inbox' ORDER BY pm.dateline DESC LIMIT 1");
return array('newpm' => $newpm, 'newprivatepm' => $newprvpm, 'announcepm' => $annpm, 'systempm' => $syspm, 'lastdate' => $pm['dateline'], 'lastmsgfromid' => $pm['msgfromid'], 'lastmsgfrom' => $pm['msgfrom'], 'lastmsg' => $pm['message']);
}
}
}
function deletepm($uid, $pmids) {
$this->db->query("DELETE FROM ".UC_DBTABLEPRE."pms WHERE msgtoid='$uid' AND pmid IN (".$this->base->implode($pmids).")");
$delnum = $this->db->affected_rows();
return $delnum;
}
function deleteuidpm($uid, $ids) {
$delnum = 0;
if($ids) {
$delnum = 1;
$deluids = $this->base->implode($ids);
$this->db->query("DELETE FROM ".UC_DBTABLEPRE."pms
WHERE msgfromid IN ($deluids) AND msgtoid='$uid' AND folder='inbox' AND related='0'", 'UNBUFFERED');
$this->db->query("UPDATE ".UC_DBTABLEPRE."pms SET delstatus=2
WHERE msgfromid IN ($deluids) AND msgtoid='$uid' AND folder='inbox' AND delstatus=0", 'UNBUFFERED');
$this->db->query("UPDATE ".UC_DBTABLEPRE."pms SET delstatus=1
WHERE msgtoid IN ($deluids) AND msgfromid='$uid' AND folder='inbox' AND delstatus=0", 'UNBUFFERED');
$this->db->query("DELETE FROM ".UC_DBTABLEPRE."pms
WHERE msgfromid IN ($deluids) AND msgtoid='$uid' AND delstatus=1 AND folder='inbox'", 'UNBUFFERED');
$this->db->query("DELETE FROM ".UC_DBTABLEPRE."pms
WHERE msgtoid IN ($deluids) AND msgfromid='$uid' AND delstatus=2 AND folder='inbox'", 'UNBUFFERED');
}
return $delnum;
}
function get_blackls($uid, $uids = array()) {
if(!$uids) {
$blackls = $this->db->result_first("SELECT blacklist FROM ".UC_DBTABLEPRE."memberfields WHERE uid='$uid'");
} else {
$uids = $this->base->implode($uids);
$blackls = array();
$query = $this->db->query("SELECT uid, blacklist FROM ".UC_DBTABLEPRE."memberfields WHERE uid IN ($uids)");
while($data = $this->db->fetch_array($query)) {
$blackls[$data['uid']] = explode(',', $data['blacklist']);
}
}
return $blackls;
}
function set_blackls($uid, $blackls) {
$this->db->query("UPDATE ".UC_DBTABLEPRE."memberfields SET blacklist='$blackls' WHERE uid='$uid'");
return $this->db->affected_rows();
}
function update_blackls($uid, $username, $action = 1) {
$username = !is_array($username) ? array($username) : $username;
if($action == 1) {
if(!in_array('{ALL}', $username)) {
$usernames = $this->base->implode($username);
$query = $this->db->query("SELECT username FROM ".UC_DBTABLEPRE."members WHERE username IN ($usernames)");
$usernames = array();
while($data = $this->db->fetch_array($query)) {
$usernames[addslashes($data['username'])] = addslashes($data['username']);
}
if(!$usernames) {
return 0;
}
$blackls = addslashes($this->db->result_first("SELECT blacklist FROM ".UC_DBTABLEPRE."memberfields WHERE uid='$uid'"));
if($blackls) {
$list = explode(',', $blackls);
foreach($list as $k => $v) {
if(in_array($v, $usernames)) {
unset($usernames[$v]);
}
}
}
if(!$usernames) {
return 1;
}
$listnew = implode(',', $usernames);
$blackls .= $blackls !== '' ? ','.$listnew : $listnew;
} else {
$blackls = addslashes($this->db->result_first("SELECT blacklist FROM ".UC_DBTABLEPRE."memberfields WHERE uid='$uid'"));
$blackls .= ',{ALL}';
}
} else {
$blackls = addslashes($this->db->result_first("SELECT blacklist FROM ".UC_DBTABLEPRE."memberfields WHERE uid='$uid'"));
$list = $blackls = explode(',', $blackls);
foreach($list as $k => $v) {
if(in_array($v, $username)) {
unset($blackls[$k]);
}
}
$blackls = implode(',', $blackls);
}
$this->db->query("UPDATE ".UC_DBTABLEPRE."memberfields SET blacklist='$blackls' WHERE uid='$uid'");
return 1;
}
function removecode($str, $length) {
return trim($this->base->cutstr(preg_replace(array(
"/\[(email|code|quote|img)=?.*\].*?\[\/(email|code|quote|img)\]/siU",
"/\[\/?(b|i|url|u|color|size|font|align|list|indent|float)=?.*\]/siU",
"/\r\n/",
), '', $str), $length));
}
function count_pm_by_fromuid($uid, $timeoffset = 86400) {
$dateline = $this->base->time - intval($timeoffset);
return $this->db->result_first("SELECT COUNT(*) FROM ".UC_DBTABLEPRE."pms WHERE msgfromid='$uid' AND dateline>'$dateline'");
}
function is_reply_pm($uid, $touids) {
$touid_str = implode("', '", $touids);
$pm_reply = $this->db->fetch_all("SELECT msgfromid, msgtoid FROM ".UC_DBTABLEPRE."pms WHERE msgfromid IN ('$touid_str') AND msgtoid='$uid' AND related=1", 'msgfromid');
foreach($touids as $val) {
if(!isset($pm_reply[$val])) {
return false;
}
}
return true;
}
}
function pm_datelinesort($a, $b) {
if ($a['dateline'] == $b['dateline']) {
return 0;
}
return ($a['dateline'] < $b['dateline']) ? -1 : 1;
}
?>
|
108wo
|
phpsso_server/api/uc_client/model/pm.php
|
PHP
|
asf20
| 16,049
|
<?php
/*
[UCenter] (C)2001-2009 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$Id: domain.php 848 2008-12-08 05:43:39Z zhaoxiongfei $
*/
!defined('IN_UC') && exit('Access Denied');
class domainmodel {
var $db;
var $base;
function __construct(&$base) {
$this->domainmodel($base);
}
function domainmodel(&$base) {
$this->base = $base;
$this->db = $base->db;
}
function add_domain($domain, $ip) {
if($domain) {
$this->db->query("INSERT INTO ".UC_DBTABLEPRE."domains SET domain='$domain', ip='$ip'");
}
return $this->db->insert_id();
}
function get_total_num() {
$data = $this->db->result_first("SELECT COUNT(*) FROM ".UC_DBTABLEPRE."domains");
return $data;
}
function get_list($page, $ppp, $totalnum) {
$start = $this->base->page_get_start($page, $ppp, $totalnum);
$data = $this->db->fetch_all("SELECT * FROM ".UC_DBTABLEPRE."domains LIMIT $start, $ppp");
return $data;
}
function delete_domain($arr) {
$domainids = $this->base->implode($arr);
$this->db->query("DELETE FROM ".UC_DBTABLEPRE."domains WHERE id IN ($domainids)");
return $this->db->affected_rows();
}
function update_domain($domain, $ip, $id) {
$this->db->query("UPDATE ".UC_DBTABLEPRE."domains SET domain='$domain', ip='$ip' WHERE id='$id'");
return $this->db->affected_rows();
}
}
?>
|
108wo
|
phpsso_server/api/uc_client/model/domain.php
|
PHP
|
asf20
| 1,391
|
<?php
/*
[UCenter] (C)2001-2009 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$Id: note.php 916 2009-01-19 05:56:07Z monkey $
*/
!defined('IN_UC') && exit('Access Denied');
define('UC_NOTE_REPEAT', 5);
define('UC_NOTE_TIMEOUT', 15);
define('UC_NOTE_GC', 10000);
define('API_RETURN_FAILED', '-1');
class notemodel {
var $db;
var $base;
var $apps;
var $operations = array();
var $notetype = 'HTTP';
function __construct(&$base) {
$this->notemodel($base);
}
function notemodel(&$base) {
$this->base = $base;
$this->db = $base->db;
$this->apps = $this->base->cache('apps');
$this->operations = array(
'test'=>array('', 'action=test'),
'deleteuser'=>array('', 'action=deleteuser'),
'renameuser'=>array('', 'action=renameuser'),
'deletefriend'=>array('', 'action=deletefriend'),
'gettag'=>array('', 'action=gettag', 'tag', 'updatedata'),
'getcreditsettings'=>array('', 'action=getcreditsettings'),
'getcredit'=>array('', 'action=getcredit'),
'updatecreditsettings'=>array('', 'action=updatecreditsettings'),
'updateclient'=>array('', 'action=updateclient'),
'updatepw'=>array('', 'action=updatepw'),
'updatebadwords'=>array('', 'action=updatebadwords'),
'updatehosts'=>array('', 'action=updatehosts'),
'updateapps'=>array('', 'action=updateapps'),
'updatecredit'=>array('', 'action=updatecredit'),
);
}
function get_total_num($all = TRUE) {
}
function get_list($page, $ppp, $totalnum, $all = TRUE) {
}
function delete_note($ids) {
}
function add($operation, $getdata='', $postdata='', $appids=array(), $pri = 0) {
$extra = $varextra = '';
$appadd = $varadd = array();
foreach((array)$this->apps as $appid => $app) {
$appid = $app['appid'];
if($appid == intval($appid)) {
if($appids && !in_array($appid, $appids)) {
$appadd[] = 'app'.$appid."='1'";
} else {
$varadd[] = "('noteexists{$appid}', '1')";
}
}
}
if($appadd) {
$extra = implode(',', $appadd);
$extra = $extra ? ', '.$extra : '';
}
if($varadd) {
$varextra = implode(', ', $varadd);
$varextra = $varextra ? ', '.$varextra : '';
}
$getdata = addslashes($getdata);
$postdata = addslashes($postdata);
$this->db->query("INSERT INTO ".UC_DBTABLEPRE."notelist SET getdata='$getdata', operation='$operation', pri='$pri', postdata='$postdata'$extra");
$insert_id = $this->db->insert_id();
$insert_id && $this->db->query("REPLACE INTO ".UC_DBTABLEPRE."vars (name, value) VALUES ('noteexists', '1')$varextra");
return $insert_id;
}
function send() {
register_shutdown_function(array($this, '_send'));
}
function _send() {
$note = $this->_get_note();
if(empty($note)) {
$this->db->query("REPLACE INTO ".UC_DBTABLEPRE."vars SET name='noteexists".UC_APPID."', value='0'");
return NULL;
}
$this->sendone(UC_APPID, 0, $note);
$this->_gc();
}
function sendone($appid, $noteid = 0, $note = '') {
require_once UC_ROOT.'./lib/xml.class.php';
$return = FALSE;
$app = $this->apps[$appid];
if($noteid) {
$note = $this->_get_note_by_id($noteid);
}
$this->base->load('misc');
$apifilename = isset($app['apifilename']) && $app['apifilename'] ? $app['apifilename'] : 'uc.php';
if($app['extra']['apppath'] && @include $app['extra']['apppath'].'./api/'.$apifilename) {
$uc_note = new uc_note();
$method = $note['operation'];
if(is_string($method) && !empty($method)) {
parse_str($note['getdata'], $note['getdata']);
if(get_magic_quotes_gpc()) {
$note['getdata'] = $this->base->dstripslashes($note['getdata']);
}
$note['postdata'] = xml_unserialize($note['postdata']);
$response = $uc_note->$method($note['getdata'], $note['postdata']);
}
unset($uc_note);
} else {
$url = $this->get_url_code($note['operation'], $note['getdata'], $appid);
$note['postdata'] = str_replace(array("\n", "\r"), '', $note['postdata']);
$response = trim($_ENV['misc']->dfopen2($url, 0, $note['postdata'], '', 1, $app['ip'], UC_NOTE_TIMEOUT, TRUE));
}
$returnsucceed = $response != '' && ($response == 1 || is_array(xml_unserialize($response)));
$closedsqladd = $this->_close_note($note, $this->apps, $returnsucceed, $appid) ? ",closed='1'" : '';//
if($returnsucceed) {
if($this->operations[$note['operation']][2]) {
$this->base->load($this->operations[$note['operation']][2]);
$func = $this->operations[$note['operation']][3];
$_ENV[$this->operations[$note['operation']][2]]->$func($appid, $response);
}
$this->db->query("UPDATE ".UC_DBTABLEPRE."notelist SET app$appid='1', totalnum=totalnum+1, succeednum=succeednum+1, dateline='{$this->base->time}' $closedsqladd WHERE noteid='$note[noteid]'", 'SILENT');
$return = TRUE;
} else {
$this->db->query("UPDATE ".UC_DBTABLEPRE."notelist SET app$appid = app$appid-'1', totalnum=totalnum+1, dateline='{$this->base->time}' $closedsqladd WHERE noteid='$note[noteid]'", 'SILENT');
$return = FALSE;
}
return $return;
}
function _get_note() {
$app_field = 'app'.UC_APPID;
$data = $this->db->fetch_first("SELECT * FROM ".UC_DBTABLEPRE."notelist WHERE closed='0' AND $app_field<'1' AND $app_field>'-".UC_NOTE_REPEAT."' LIMIT 1");
return $data;
}
function _gc() {
rand(0, UC_NOTE_GC) == 0 && $this->db->query("DELETE FROM ".UC_DBTABLEPRE."notelist WHERE closed='1'");
}
function _close_note($note, $apps, $returnsucceed, $appid) {
$note['app'.$appid] = $returnsucceed ? 1 : $note['app'.$appid] - 1;
$appcount = count($apps);
foreach($apps as $key => $app) {
$appstatus = $note['app'.$app['appid']];
if(!$app['recvnote'] || $appstatus == 1 || $appstatus <= -UC_NOTE_REPEAT) {
$appcount--;
}
}
if($appcount < 1) {
return TRUE;
//$closedsqladd = ",closed='1'";
}
}
function _get_note_by_id($noteid) {
$data = $this->db->fetch_first("SELECT * FROM ".UC_DBTABLEPRE."notelist WHERE noteid='$noteid'");
return $data;
}
function get_url_code($operation, $getdata, $appid) {
$app = $this->apps[$appid];
$authkey = UC_KEY;
$url = $app['url'];
$apifilename = isset($app['apifilename']) && $app['apifilename'] ? $app['apifilename'] : 'uc.php';
$action = $this->operations[$operation][1];
$code = urlencode($this->base->authcode("$action&".($getdata ? "$getdata&" : '')."time=".$this->base->time, 'ENCODE', $authkey));
return $url."/api/$apifilename?code=$code";
}
}
?>
|
108wo
|
phpsso_server/api/uc_client/model/note.php
|
PHP
|
asf20
| 6,591
|
<?php
/*
[UCenter] (C)2001-2009 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$Id: user.php 968 2009-10-29 02:06:45Z zhaoxiongfei $
*/
!defined('IN_UC') && exit('Access Denied');
class usermodel {
var $db;
var $base;
function __construct(&$base) {
$this->usermodel($base);
}
function usermodel(&$base) {
$this->base = $base;
$this->db = $base->db;
}
function get_user_by_uid($uid) {
$arr = $this->db->fetch_first("SELECT * FROM ".UC_DBTABLEPRE."members WHERE uid='$uid'");
return $arr;
}
function get_user_by_username($username) {
$arr = $this->db->fetch_first("SELECT * FROM ".UC_DBTABLEPRE."members WHERE username='$username'");
return $arr;
}
function get_user_by_email($email) {
$arr = $this->db->fetch_first("SELECT * FROM ".UC_DBTABLEPRE."members WHERE email='$email'");
return $arr;
}
function check_username($username) {
$guestexp = '\xA1\xA1|\xAC\xA3|^Guest|^\xD3\xCE\xBF\xCD|\xB9\x43\xAB\xC8';
$len = strlen($username);
if($len > 15 || $len < 3 || preg_match("/\s+|^c:\\con\\con|[%,\*\"\s\<\>\&]|$guestexp/is", $username)) {
return FALSE;
} else {
return TRUE;
}
}
function check_mergeuser($username) {
$data = $this->db->result_first("SELECT count(*) FROM ".UC_DBTABLEPRE."mergemembers WHERE appid='".$this->base->app['appid']."' AND username='$username'");
return $data;
}
function check_usernamecensor($username) {
$_CACHE['badwords'] = $this->base->cache('badwords');
$censorusername = $this->base->get_setting('censorusername');
$censorusername = $censorusername['censorusername'];
$censorexp = '/^('.str_replace(array('\\*', "\r\n", ' '), array('.*', '|', ''), preg_quote(($censorusername = trim($censorusername)), '/')).')$/i';
$usernamereplaced = isset($_CACHE['badwords']['findpattern']) && !empty($_CACHE['badwords']['findpattern']) ? @preg_replace($_CACHE['badwords']['findpattern'], $_CACHE['badwords']['replace'], $username) : $username;
if(($usernamereplaced != $username) || ($censorusername && preg_match($censorexp, $username))) {
return FALSE;
} else {
return TRUE;
}
}
function check_usernameexists($username) {
$data = $this->db->result_first("SELECT username FROM ".UC_DBTABLEPRE."members WHERE username='$username'");
return $data;
}
function check_emailformat($email) {
return strlen($email) > 6 && preg_match("/^[\w\-\.]+@[\w\-\.]+(\.\w+)+$/", $email);
}
function check_emailaccess($email) {
$setting = $this->base->get_setting(array('accessemail', 'censoremail'));
$accessemail = $setting['accessemail'];
$censoremail = $setting['censoremail'];
$accessexp = '/('.str_replace("\r\n", '|', preg_quote(trim($accessemail), '/')).')$/i';
$censorexp = '/('.str_replace("\r\n", '|', preg_quote(trim($censoremail), '/')).')$/i';
if($accessemail || $censoremail) {
if(($accessemail && !preg_match($accessexp, $email)) || ($censoremail && preg_match($censorexp, $email))) {
return FALSE;
} else {
return TRUE;
}
} else {
return TRUE;
}
}
function check_emailexists($email, $username = '') {
$sqladd = $username !== '' ? "AND username<>'$username'" : '';
$email = $this->db->result_first("SELECT email FROM ".UC_DBTABLEPRE."members WHERE email='$email' $sqladd");
return $email;
}
function check_login($username, $password, &$user) {
$user = $this->get_user_by_username($username);
if(empty($user['username'])) {
return -1;
} elseif($user['password'] != md5(md5($password).$user['salt'])) {
return -2;
}
return $user['uid'];
}
function add_user($username, $password, $email, $salt, $uid = 0, $questionid = '', $answer = '', $regip = '') {
$regip = empty($regip) ? $this->base->onlineip : $regip;
$password = md5(md5($password).$salt);
$sqladd = $uid ? "uid='".intval($uid)."'," : '';
$sqladd .= $questionid > 0 ? " secques='".$this->quescrypt($questionid, $answer)."'," : " secques='',";
$this->db->query("INSERT INTO ".UC_DBTABLEPRE."members SET $sqladd username='$username', password='$password', email='$email', regip='$regip', regdate='".$this->base->time."', salt='$salt'");
$uid = $this->db->insert_id();
$this->db->query("INSERT INTO ".UC_DBTABLEPRE."memberfields SET uid='$uid'");
return $uid;
}
function edit_user($username, $oldpw, $newpw, $email, $salt = '', $ignoreoldpw = 0, $questionid = '', $answer = '') {
$data = $this->db->fetch_first("SELECT username, uid, password FROM ".UC_DBTABLEPRE."members WHERE username='$username'");
if($ignoreoldpw) {
$isprotected = $this->db->result_first("SELECT COUNT(*) FROM ".UC_DBTABLEPRE."protectedmembers WHERE uid = '$data[uid]'");
if($isprotected) {
return -8;
}
}
if(!$ignoreoldpw && $data['password'] != md5(md5($oldpw).$salt)) {
return -1;
}
$sqladd = $newpw ? "password='".md5(md5($newpw).$salt)."', `salt`='$salt'" : '';
$sqladd .= $email ? ($sqladd ? ',' : '')." email='$email'" : '';
if($questionid !== '') {
if($questionid > 0) {
$sqladd .= ($sqladd ? ',' : '')." secques='".$this->quescrypt($questionid, $answer)."'";
} else {
$sqladd .= ($sqladd ? ',' : '')." secques=''";
}
}
if($sqladd || $emailadd) {
$this->db->query("UPDATE ".UC_DBTABLEPRE."members SET $sqladd WHERE username='$username'");
return $this->db->affected_rows();
} else {
return -7;
}
}
function delete_user($uidsarr) {
$uidsarr = (array)$uidsarr;
if(!$uidsarr) {
return 0;
}
$uids = $this->base->implode($uidsarr);
$arr = $this->db->fetch_all("SELECT uid FROM ".UC_DBTABLEPRE."protectedmembers WHERE uid IN ($uids)");
$puids = array();
foreach((array)$arr as $member) {
$puids[] = $member['uid'];
}
$uids = $this->base->implode(array_diff($uidsarr, $puids));
if($uids) {
$this->db->query("DELETE FROM ".UC_DBTABLEPRE."members WHERE uid IN($uids)");
$this->db->query("DELETE FROM ".UC_DBTABLEPRE."memberfields WHERE uid IN($uids)");
uc_user_deleteavatar($uidsarr);
$this->base->load('note');
$_ENV['note']->add('deleteuser', "ids=$uids");
return $this->db->affected_rows();
} else {
return 0;
}
}
function get_total_num($sqladd = '') {
$data = $this->db->result_first("SELECT COUNT(*) FROM ".UC_DBTABLEPRE."members $sqladd");
return $data;
}
function get_list($page, $ppp, $totalnum, $sqladd) {
$start = $this->base->page_get_start($page, $ppp, $totalnum);
$data = $this->db->fetch_all("SELECT * FROM ".UC_DBTABLEPRE."members $sqladd LIMIT $start, $ppp");
return $data;
}
function name2id($usernamesarr) {
$usernamesarr = uc_addslashes($usernamesarr, 1, TRUE);
$usernames = $this->base->implode($usernamesarr);
$query = $this->db->query("SELECT uid FROM ".UC_DBTABLEPRE."members WHERE username IN($usernames)");
$arr = array();
while($user = $this->db->fetch_array($query)) {
$arr[] = $user['uid'];
}
return $arr;
}
function quescrypt($questionid, $answer) {
return $questionid > 0 && $answer != '' ? substr(md5($answer.md5($questionid)), 16, 8) : '';
}
}
?>
|
108wo
|
phpsso_server/api/uc_client/model/user.php
|
PHP
|
asf20
| 7,206
|
<?php
/*
[UCenter] (C)2001-2009 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$Id: friend.php 773 2008-11-26 08:45:08Z zhaoxiongfei $
*/
!defined('IN_UC') && exit('Access Denied');
class friendmodel {
var $db;
var $base;
function __construct(&$base) {
$this->friendmodel($base);
}
function friendmodel(&$base) {
$this->base = $base;
$this->db = $base->db;
}
function add($uid, $friendid, $comment='') {
$direction = $this->db->result_first("SELECT direction FROM ".UC_DBTABLEPRE."friends WHERE uid='$friendid' AND friendid='$uid' LIMIT 1");
if($direction == 1) {
$this->db->query("INSERT INTO ".UC_DBTABLEPRE."friends SET uid='$uid', friendid='$friendid', comment='$comment', direction='3'", 'SILENT');
$this->db->query("UPDATE ".UC_DBTABLEPRE."friends SET direction='3' WHERE uid='$friendid' AND friendid='$uid'");
return 1;
} elseif($direction == 2) {
return 1;
} elseif($direction == 3) {
return -1;
} else {
$this->db->query("INSERT INTO ".UC_DBTABLEPRE."friends SET uid='$uid', friendid='$friendid', comment='$comment', direction='1'", 'SILENT');
return $this->db->insert_id();
}
}
function delete($uid, $friendids) {
$friendids = $this->base->implode($friendids);
$this->db->query("DELETE FROM ".UC_DBTABLEPRE."friends WHERE uid='$uid' AND friendid IN ($friendids)");
$affectedrows = $this->db->affected_rows();
if($affectedrows > 0) {
$this->db->query("UPDATE ".UC_DBTABLEPRE."friends SET direction=1 WHERE uid IN ($friendids) AND friendid='$uid' AND direction='3'");
}
return $affectedrows;
}
function get_totalnum_by_uid($uid, $direction = 0) {
$sqladd = '';
if($direction == 0) {
$sqladd = "uid='$uid'";
} elseif($direction == 1) {
$sqladd = "uid='$uid' AND direction='1'";
} elseif($direction == 2) {
$sqladd = "friendid='$uid' AND direction='1'";
} elseif($direction == 3) {
$sqladd = "uid='$uid' AND direction='3'";
}
$totalnum = $this->db->result_first("SELECT COUNT(*) FROM ".UC_DBTABLEPRE."friends WHERE $sqladd");
return $totalnum;
}
function get_list($uid, $page, $pagesize, $totalnum, $direction = 0) {
$start = $this->base->page_get_start($page, $pagesize, $totalnum);
$sqladd = '';
if($direction == 0) {
$sqladd = "f.uid='$uid'";
} elseif($direction == 1) {
$sqladd = "f.uid='$uid' AND f.direction='1'";
} elseif($direction == 2) {
$sqladd = "f.friendid='$uid' AND f.direction='1'";
} elseif($direction == 3) {
$sqladd = "f.uid='$uid' AND f.direction='3'";
}
if($sqladd) {
$data = $this->db->fetch_all("SELECT f.*, m.username FROM ".UC_DBTABLEPRE."friends f LEFT JOIN ".UC_DBTABLEPRE."members m ON f.friendid=m.uid WHERE $sqladd LIMIT $start, $pagesize");
return $data;
} else {
return array();
}
}
function is_friend($uid, $friendids, $direction = 0) {
$friendid_str = implode("', '", $friendids);
$sqladd = '';
if($direction == 0) {
$sqladd = "uid='$uid'";
} elseif($direction == 1) {
$sqladd = "uid='$uid' AND friendid IN ('$friendid_str') AND direction='1'";
} elseif($direction == 2) {
$sqladd = "friendid='$uid' AND uid IN ('$friendid_str') AND direction='1'";
} elseif($direction == 3) {
$sqladd = "uid='$uid' AND friendid IN ('$friendid_str') AND direction='3'";
}
if($this->db->result_first("SELECT COUNT(*) FROM ".UC_DBTABLEPRE."friends WHERE $sqladd") == count($friendids)) {
return true;
} else {
return false;
}
}
}
?>
|
108wo
|
phpsso_server/api/uc_client/model/friend.php
|
PHP
|
asf20
| 3,574
|
<?php
/*
[UCenter] (C)2001-2009 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$Id: app.php 846 2008-12-08 05:37:05Z zhaoxiongfei $
*/
!defined('IN_UC') && exit('Access Denied');
class appmodel {
var $db;
var $base;
function __construct(&$base) {
$this->appmodel($base);
}
function appmodel(&$base) {
$this->base = $base;
$this->db = $base->db;
}
function get_apps($col = '*', $where = '') {
$arr = $this->db->fetch_all("SELECT $col FROM ".UC_DBTABLEPRE."applications".($where ? ' WHERE '.$where : ''), 'appid');
foreach($arr as $k => $v) {
isset($v['extra']) && !empty($v['extra']) && $v['extra'] = unserialize($v['extra']);
unset($v['authkey']);
$arr[$k] = $v;
}
return $arr;
}
}
?>
|
108wo
|
phpsso_server/api/uc_client/model/app.php
|
PHP
|
asf20
| 783
|
<?php
/*
[UCenter] (C)2001-2009 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$Id: misc.php 846 2008-12-08 05:37:05Z zhaoxiongfei $
*/
!defined('IN_UC') && exit('Access Denied');
define('UC_ARRAY_SEP_1', 'UC_ARRAY_SEP_1');
define('UC_ARRAY_SEP_2', 'UC_ARRAY_SEP_2');
class miscmodel {
var $db;
var $base;
function __construct(&$base) {
$this->miscmodel($base);
}
function miscmodel(&$base) {
$this->base = $base;
$this->db = $base->db;
}
function get_apps($col = '*', $where = '') {
$arr = $this->db->fetch_all("SELECT $col FROM ".UC_DBTABLEPRE."applications".($where ? ' WHERE '.$where : ''));
return $arr;
}
function delete_apps($appids) {
}
function update_app($appid, $name, $url, $authkey, $charset, $dbcharset) {
}
//private
function alter_app_table($appid, $operation = 'ADD') {
}
function get_host_by_url($url) {
}
function check_url($url) {
}
function check_ip($url) {
}
function test_api($url, $ip = '') {
}
function dfopen2($url, $limit = 0, $post = '', $cookie = '', $bysocket = FALSE, $ip = '', $timeout = 15, $block = TRUE, $encodetype = 'URLENCODE') {
$__times__ = isset($_GET['__times__']) ? intval($_GET['__times__']) + 1 : 1;
if($__times__ > 2) {
return '';
}
$url .= (strpos($url, '?') === FALSE ? '?' : '&')."__times__=$__times__";
return $this->dfopen($url, $limit, $post, $cookie, $bysocket, $ip, $timeout, $block, $encodetype);
}
function dfopen($url, $limit = 0, $post = '', $cookie = '', $bysocket = FALSE , $ip = '', $timeout = 15, $block = TRUE, $encodetype = 'URLENCODE') {
//error_log("[uc_client]\r\nurl: $url\r\npost: $post\r\n\r\n", 3, 'c:/log/php_fopen.txt');
$return = '';
$matches = parse_url($url);
$host = $matches['host'];
$path = $matches['path'] ? $matches['path'].($matches['query'] ? '?'.$matches['query'] : '') : '/';
$port = !empty($matches['port']) ? $matches['port'] : 80;
if($post) {
$out = "POST $path HTTP/1.0\r\n";
$out .= "Accept: */*\r\n";
//$out .= "Referer: $boardurl\r\n";
$out .= "Accept-Language: zh-cn\r\n";
$boundary = $encodetype == 'URLENCODE' ? '' : ';'.substr($post, 0, trim(strpos($post, "\n")));
$out .= $encodetype == 'URLENCODE' ? "Content-Type: application/x-www-form-urlencoded\r\n" : "Content-Type: multipart/form-data$boundary\r\n";
$out .= "User-Agent: $_SERVER[HTTP_USER_AGENT]\r\n";
$out .= "Host: $host\r\n";
$out .= 'Content-Length: '.strlen($post)."\r\n";
$out .= "Connection: Close\r\n";
$out .= "Cache-Control: no-cache\r\n";
$out .= "Cookie: $cookie\r\n\r\n";
$out .= $post;
} else {
$out = "GET $path HTTP/1.0\r\n";
$out .= "Accept: */*\r\n";
//$out .= "Referer: $boardurl\r\n";
$out .= "Accept-Language: zh-cn\r\n";
$out .= "User-Agent: $_SERVER[HTTP_USER_AGENT]\r\n";
$out .= "Host: $host\r\n";
$out .= "Connection: Close\r\n";
$out .= "Cookie: $cookie\r\n\r\n";
}
$fp = @fsockopen(($ip ? $ip : $host), $port, $errno, $errstr, $timeout);
if(!$fp) {
return '';
} else {
stream_set_blocking($fp, $block);
stream_set_timeout($fp, $timeout);
@fwrite($fp, $out);
$status = stream_get_meta_data($fp);
if(!$status['timed_out']) {
while (!feof($fp)) {
if(($header = @fgets($fp)) && ($header == "\r\n" || $header == "\n")) {
break;
}
}
$stop = false;
while(!feof($fp) && !$stop) {
$data = fread($fp, ($limit == 0 || $limit > 8192 ? 8192 : $limit));
$return .= $data;
if($limit) {
$limit -= strlen($data);
$stop = $limit <= 0;
}
}
}
@fclose($fp);
return $return;
}
}
function array2string($arr) {
$s = $sep = '';
if($arr && is_array($arr)) {
foreach($arr as $k => $v) {
$s .= $sep.$k.UC_ARRAY_SEP_1.$v;
$sep = UC_ARRAY_SEP_2;
}
}
return $s;
}
function string2array($s) {
$arr = explode(UC_ARRAY_SEP_2, $s);
$arr2 = array();
foreach($arr as $k => $v) {
list($key, $val) = explode(UC_ARRAY_SEP_1, $v);
$arr2[$key] = $val;
}
return $arr2;
}
}
?>
|
108wo
|
phpsso_server/api/uc_client/model/misc.php
|
PHP
|
asf20
| 4,191
|
<?php
/*
[UCenter] (C)2001-2009 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$Id: tag.php 753 2008-11-14 06:48:25Z cnteacher $
*/
!defined('IN_UC') && exit('Access Denied');
class tagmodel {
var $db;
var $base;
function __construct(&$base) {
$this->tagmodel($base);
}
function tagmodel(&$base) {
$this->base = $base;
$this->db = $base->db;
}
function get_tag_by_name($tagname) {
$arr = $this->db->fetch_all("SELECT * FROM ".UC_DBTABLEPRE."tags WHERE tagname='$tagname'");
return $arr;
}
function get_template($appid) {
$result = $this->db->result_first("SELECT tagtemplates FROM ".UC_DBTABLEPRE."applications WHERE appid='$appid'");
return $result;
}
function updatedata($appid, $data) {
$appid = intval($appid);
include_once UC_ROOT.'lib/xml.class.php';
$data = xml_unserialize($data);
$this->base->load('app');
$data[0] = addslashes($data[0]);
$datanew = array();
if(is_array($data[1])) {
foreach($data[1] as $r) {
$datanew[] = $_ENV['misc']->array2string($r);
}
}
$tmp = $_ENV['app']->get_apps('type', "appid='$appid'");
$datanew = addslashes($tmp[0]['type']."\t".implode("\t", $datanew));
if(!empty($data[0])) {
$return = $this->db->result_first("SELECT count(*) FROM ".UC_DBTABLEPRE."tags WHERE tagname='$data[0]' AND appid='$appid'");
if($return) {
$this->db->query("UPDATE ".UC_DBTABLEPRE."tags SET data='$datanew', expiration='".$this->base->time."' WHERE tagname='$data[0]' AND appid='$appid'");
} else {
$this->db->query("INSERT INTO ".UC_DBTABLEPRE."tags (tagname, appid, data, expiration) VALUES ('$data[0]', '$appid', '$datanew', '".$this->base->time."')");
}
}
}
function formatcache($appid, $tagname) {
$return = $this->db->result_first("SELECT count(*) FROM ".UC_DBTABLEPRE."tags WHERE tagname='$tagname' AND appid='$appid'");
if($return) {
$this->db->query("UPDATE ".UC_DBTABLEPRE."tags SET expiration='0' WHERE tagname='$tagname' AND appid='$appid'");
} else {
$this->db->query("INSERT INTO ".UC_DBTABLEPRE."tags (tagname, appid, expiration) VALUES ('$tagname', '$appid', '0')");
}
}
}
?>
|
108wo
|
phpsso_server/api/uc_client/model/tag.php
|
PHP
|
asf20
| 2,212
|
<?php
/*
[UCenter] (C)2001-2009 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$Id: cache.php 846 2008-12-08 05:37:05Z zhaoxiongfei $
*/
!defined('IN_UC') && exit('Access Denied');
if(!function_exists('file_put_contents')) {
function file_put_contents($filename, $s) {
$fp = @fopen($filename, 'w');
@fwrite($fp, $s);
@fclose($fp);
}
}
class cachemodel {
var $db;
var $base;
var $map;
function __construct(&$base) {
$this->cachemodel($base);
}
function cachemodel(&$base) {
$this->base = $base;
$this->db = $base->db;
$this->map = array(
'settings' => array('settings'),
'badwords' => array('badwords'),
'apps' => array('apps')
);
}
//public
function updatedata($cachefile = '') {
if($cachefile) {
foreach((array)$this->map[$cachefile] as $modules) {
$s = "<?php\r\n";
foreach((array)$modules as $m) {
$method = "_get_$m";
$s .= '$_CACHE[\''.$m.'\'] = '.var_export($this->$method(), TRUE).";\r\n";
}
$s .= "\r\n?>";
@file_put_contents(UC_DATADIR."./cache/$cachefile.php", $s);
}
} else {
foreach((array)$this->map as $file => $modules) {
$s = "<?php\r\n";
foreach($modules as $m) {
$method = "_get_$m";
$s .= '$_CACHE[\''.$m.'\'] = '.var_export($this->$method(), TRUE).";\r\n";
}
$s .= "\r\n?>";
@file_put_contents(UC_DATADIR."./cache/$file.php", $s);
}
}
}
function updatetpl() {
}
//private
function _get_badwords() {
$data = $this->db->fetch_all("SELECT * FROM ".UC_DBTABLEPRE."badwords");
$return = array();
if(is_array($data)) {
foreach($data as $k => $v) {
$return['findpattern'][$k] = $v['findpattern'];
$return['replace'][$k] = $v['replacement'];
}
}
return $return;
}
//private
function _get_apps() {
$this->base->load('app');
$apps = $_ENV['app']->get_apps();
$apps2 = array();
if(is_array($apps)) {
foreach($apps as $v) {
$v['extra'] = unserialize($v['extra']);
$apps2[$v['appid']] = $v;
}
}
return $apps2;
}
function _get_settings() {
return $this->base->get_setting();
}
}
?>
|
108wo
|
phpsso_server/api/uc_client/model/cache.php
|
PHP
|
asf20
| 2,206
|
<?php
return array (
'default' => array (
'hostname' => 'localhost',
'database' => '108wo_new',
'username' => 'root',
'password' => '123',
'tablepre' => '108wo_sso_',
'charset' => 'utf8',
'type' => 'mysql',
'debug' => true,
'pconnect' => 0,
'autoconnect' => 0
)
);
?>
|
108wo
|
phpsso_server/caches/configs/database.php
|
PHP
|
asf20
| 309
|
<?php
/**
* 路由配置文件
* 默认配置为default如下:
* 'default'=>array(
* 'm'=>'phpcms',
* 'c'=>'index',
* 'a'=>'init',
* 'data'=>array(
* 'POST'=>array(
* 'catid'=>1
* ),
* 'GET'=>array(
* 'contentid'=>1
* )
* )
* )
* 基中“m”为模型,“c”为控制器,“a”为事件,“data”为其他附加参数。
* data为一个二维数组,可设置POST和GET的默认参数。POST和GET分别对应PHP中的$_POST和$_GET两个超全局变量。在程序中您可以使用$_POST['catid']来得到data下面POST中的数组的值。
* data中的所设置的参数等级比较低。如果外部程序有提交相同的名字的变量,将会覆盖配置文件中所设置的值。如:
* 外部程序POST了一个变量catid=2那么你在程序中使用$_POST取到的值是2,而不是配置文件中所设置的1。
*/
return array(
'default'=>array('m'=>'admin', 'c'=>'index', 'a'=>'init'),
);
|
108wo
|
phpsso_server/caches/configs/route.php
|
PHP
|
asf20
| 986
|
<?php
define('UC_CONNECT', 'mysql');
define('UC_API', 'http://localhost/comsenz/uc');
define('UC_IP', '');
define('UC_DBHOST', 'localhost');
define('UC_DBUSER', 'root');
define('UC_DBPW', 'root');
define('UC_DBNAME', 'ucenter');
define('UC_DBTABLEPRE', 'uc_');
define('UC_DBCHARSET', 'gbk');
define('UC_APPID', '8');
define('UC_KEY', 'arqFDAQRFWQE2346fweqre');
define('UCUSE', '0');
|
108wo
|
phpsso_server/caches/configs/uc_config.php
|
PHP
|
asf20
| 384
|
<?php
return array(
//网站路径
'web_path' => '/108wo/phpsso_server/',
//Session配置
'session_storage' => 'mysql',
'session_ttl' => 1800,
'session_savepath' => CACHE_PATH.'sessions/',
'session_n' => 0,
//Cookie配置
'cookie_domain' => '', //Cookie 作用域
'cookie_path' => '/', //Cookie 作用路径
'cookie_pre' => 'vAyKg_', //Cookie 前缀,同一域名下安装多套系统时,请修改Cookie前缀
'cookie_ttl' => 0, //Cookie 生命周期,0 表示随浏览器进程
'js_path' => 'http://localhost/108wo/phpsso_server/statics/js/', //CDN JS
'css_path' => 'http://localhost/108wo/phpsso_server/statics/css/', //CDN CSS
'img_path' => 'http://localhost/108wo/phpsso_server/statics/images/', //CDN img
'upload_path' => PHPCMS_PATH.'uploadfile/', //上传文件路径
'app_path' => 'http://localhost/108wo/phpsso_server/',//动态域名配置地址
'charset' => 'utf-8', //网站字符集
'timezone' => 'Etc/GMT-8', //网站时区(只对php 5.1以上版本有效),Etc/GMT-8 实际表示的是 GMT+8
'debug' => 1, //是否显示调试信息
'admin_log' => 0, //是否记录后台操作日志
'errorlog' => 0, //是否保存错误日志
'gzip' => 1, //是否Gzip压缩后输出
'auth_key' => '6OeEUIM0ZYRwkZ7ScM4d', // //Cookie密钥
'lang' => 'zh-cn', //网站语言包
'admin_founders' => '1', //网站创始人ID,多个ID逗号分隔
'execution_sql' => 0, //EXECUTION_SQL
//UCenter配置开始
'ucuse'=>'0',//是否开启UC
'uc_api'=>'http://localhost/comsenz/uc',//Ucenter api 地址
'uc_ip'=>'',//Ucenter api IP
'uc_dbhost'=>'localhost',//Ucenter 数据库主机名
'uc_dbuser'=>'root',//Ucenter 数据库用户名
'uc_dbpw'=>'root',//Ucenter 数据库密码
'uc_dbname'=>'ucenter',//Ucenter 数据库名
'uc_dbtablepre'=>'uc_',//Ucenter 数据库表前缀
'uc_dbcharset'=>'gbk',//Ucenter 数据库字符集
'uc_appid'=>'',//应用id(APP ID)
'uc_key'=>'',//Ucenter 通信密钥
);
?>
|
108wo
|
phpsso_server/caches/configs/system.php
|
PHP
|
asf20
| 1,954
|
<?php
return array (
'file1' => array (
'type' => 'file',
'debug' => true,
'pconnect' => 0,
'autoconnect' => 0
),
'template' => array (
'hostname' => '210.78.140.2',
'port' => 11211,
'timeout' => 0,
'type' => 'memcache',
'debug' => true,
'pconnect' => 0,
'autoconnect' => 0
)
);
?>
|
108wo
|
phpsso_server/caches/configs/cache.php
|
PHP
|
asf20
| 330
|
<?php
return array (
1 =>
array (
'appid' => '1',
'type' => 'phpcms_v9',
'name' => 'phpcms v9',
'url' => 'http://localhost/108wo_new/',
'authkey' => 'qZdQRVXybU0wdhOnvbUq90PXZt0eF1gg',
'ip' => '',
'apifilename' => 'api.php?op=phpsso',
'charset' => 'utf-8',
'synlogin' => '1',
),
);
?>
|
108wo
|
phpsso_server/caches/caches_admin/caches_data/applist.cache.php
|
PHP
|
asf20
| 327
|
<?php
/**
* index.php API 入口
*
* @copyright (C) 2005-2010 PHPCMS
* @license http://www.phpcms.cn/license/
* @lastmodify 2010-7-26
*/
define('PHPCMS_PATH', dirname(__FILE__).DIRECTORY_SEPARATOR);
include './phpcms/base.php';
$param = pc_base::load_sys_class('param');
$op = isset($_GET['op']) && trim($_GET['op']) ? trim($_GET['op']) : exit('Operation can not be empty');
if (!preg_match('/([^a-z_]+)/i',$op) && file_exists('api'.DIRECTORY_SEPARATOR.$op.'.php')) {
include 'api'.DIRECTORY_SEPARATOR.$op.'.php';
} else {
exit('API handler does not exist');
}
?>
|
108wo
|
phpsso_server/api.php
|
PHP
|
asf20
| 599
|
<?php
/**
* index.php PHPCMS 入口
*
* @copyright (C) 2005-2010 PHPCMS
* @license http://www.phpcms.cn/license/
* @lastmodify 2010-6-1
*/
//PHPCMS根目录
define('PHPCMS_PATH', dirname(__FILE__).DIRECTORY_SEPARATOR);
include PHPCMS_PATH.'/phpcms/base.php';
pc_base::creat_app();
?>
|
108wo
|
index.php
|
PHP
|
asf20
| 318
|
<?php
header('location:index.php?m=admin');
?>
|
108wo
|
admin.php
|
PHP
|
asf20
| 48
|
/*
* 在jquery.suggest 1.1基础上针对中文输入的特点做了部分修改,下载原版请到jquery插件库
* 修改者:wangshuai
*
* 修改部分已在文中标注
*
*
* jquery.suggest 1.1 - 2007-08-06
*
* Uses code and techniques from following libraries:
* 1. http://www.dyve.net/jquery/?autocomplete
* 2. http://dev.jquery.com/browser/trunk/plugins/interface/iautocompleter.js
*
* All the new stuff written by Peter Vulgaris (www.vulgarisoip.com)
* Feel free to do whatever you want with this file
*
*/
(function($) {
$.suggest = function(input, options) {
var $input = $(input).attr("autocomplete", "off");
var $results = $("#sr_infos");
var timeout = false; // hold timeout ID for suggestion results to appear
var prevLength = 0; // last recorded length of $input.val()
$input.blur(function() {
setTimeout(function() { $results.hide() }, 200);
});
$results.mouseover(function() {
$("#sr_infos ul li").removeClass(options.selectClass);
})
// help IE users if possible
try {
$results.bgiframe();
} catch(e) { }
// I really hate browser detection, but I don't see any other way
//修改开始
//下面部分在作者原来代码的基本上针对中文输入的特点做了些修改
if ($.browser.mozilla)
$input.keypress(processKey2); // onkeypress repeats arrow keys in Mozilla/Opera
else
$input.keydown(processKey2); // onkeydown repeats arrow keys in IE/Safari*/
//这里是自己改为keyup事件
$input.keyup(processKey);
//修改结束
function processKey(e) {
// handling up/down/escape requires results to be visible
// handling enter/tab requires that AND a result to be selected
if (/^32$|^9$/.test(e.keyCode) && getCurrentResult()) {
if (e.preventDefault)
e.preventDefault();
if (e.stopPropagation)
e.stopPropagation();
e.cancelBubble = true;
e.returnValue = false;
selectCurrentResult();
} else if ($input.val().length != prevLength) {
if (timeout)
clearTimeout(timeout);
timeout = setTimeout(suggest, options.delay);
prevLength = $input.val().length;
}
}
//此处针对上面介绍的修改增加的函数
function processKey2(e) {
// handling up/down/escape requires results to be visible
// handling enter/tab requires that AND a result to be selected
if (/27$|38$|40$|13$/.test(e.keyCode) && $results.is(':visible')) {
if (e.preventDefault)
e.preventDefault();
if (e.stopPropagation)
e.stopPropagation();
e.cancelBubble = true;
e.returnValue = false;
switch(e.keyCode) {
case 38: // up
prevResult();
break;
case 40: // down
nextResult();
break;
case 27: // escape
$results.hide();
break;
case 13: // enter
$currentResult = getCurrentResult();
if ($currentResult) {
$input.val($currentResult.text());
window.location.href='?m=search&c=index&a=init&q='+$currentResult.text();
}
break;
}
} else if ($input.val().length != prevLength) {
if (timeout)
clearTimeout(timeout);
timeout = setTimeout(suggest, options.delay);
prevLength = $input.val().length;
}
}
function suggest() {
var q = $input.val().replace(/ /g, '');
if (q.length >= options.minchars) {
$.getScript(options.source+'&q='+q, function(){
});
$results.hide();
//var items = parseTxt(txt, q);
//displayItems(items);
$results.show();
} else {
$results.hide();
}
}
function displayItems(items) {
if (!items)
return;
if (!items.length) {
$results.hide();
return;
}
var html = '';
for (var i = 0; i < items.length; i++)
html += '<li>' + items[i] + '</li>';
$results.html(html).show();
$results
.children('li')
.mouseover(function() {
$results.children('li').removeClass(options.selectClass);
$(this).addClass(options.selectClass);
})
.click(function(e) {
e.preventDefault();
e.stopPropagation();
selectCurrentResult();
});
}
function getCurrentResult() {
if (!$results.is(':visible'))
return false;
//var $currentResult = $results.children('li.' + options.selectClass);
var $currentResult = $("#sr_infos ul li."+ options.selectClass);
if (!$currentResult.length)
$currentResult = false;
return $currentResult;
}
function selectCurrentResult() {
$currentResult = getCurrentResult();
if ($currentResult) {
$input.val($currentResult.text());
$results.hide();
if (options.onSelect)
options.onSelect.apply($input[0]);
}
}
function nextResult() {
$currentResult = getCurrentResult();
if ($currentResult) {
$currentResult.removeClass(options.selectClass).next().addClass(options.selectClass);
} else {
$("#sr_infos ul li:first-child'").addClass(options.selectClass);
//$results.children('li:first-child').addClass(options.selectClass);
}
}
function prevResult() {
$currentResult = getCurrentResult();
if ($currentResult)
$currentResult.removeClass(options.selectClass).prev().addClass(options.selectClass);
else
//$results.children('li:last-child').addClass(options.selectClass);
$("#sr_infos ul li:last-child'").addClass(options.selectClass);
}
}
$.fn.suggest = function(source, options) {
if (!source)
return;
options = options || {};
options.source = source;
options.delay = options.delay || 100;
options.resultsClass = options.resultsClass || 'ac_results';
options.selectClass = options.selectClass || 'ac_over';
options.matchClass = options.matchClass || 'ac_match';
options.minchars = options.minchars || 1;
options.delimiter = options.delimiter || '\n';
options.onSelect = options.onSelect || false;
this.each(function() {
new $.suggest(this, options);
});
return this;
};
})(jQuery);
|
108wo
|
statics/js/jquery.suggest.js
|
JavaScript
|
asf20
| 6,417
|
function setmodel(value, id, siteid, q) {
$("#typeid").val(value);
$("#search a").removeClass();
id.addClass('on');
if(q!=null && q!='') {
window.location='?m=search&c=index&a=init&siteid='+siteid+'&typeid='+value+'&q='+q;
}
}
|
108wo
|
statics/js/search_common.js
|
JavaScript
|
asf20
| 248
|
/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
var swfobject = function() {
var UNDEF = "undefined",
OBJECT = "object",
SHOCKWAVE_FLASH = "Shockwave Flash",
SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
FLASH_MIME_TYPE = "application/x-shockwave-flash",
EXPRESS_INSTALL_ID = "SWFObjectExprInst",
ON_READY_STATE_CHANGE = "onreadystatechange",
win = window,
doc = document,
nav = navigator,
plugin = false,
domLoadFnArr = [main],
regObjArr = [],
objIdArr = [],
listenersArr = [],
storedAltContent,
storedAltContentId,
storedCallbackFn,
storedCallbackObj,
isDomLoaded = false,
isExpressInstallActive = false,
dynamicStylesheet,
dynamicStylesheetMedia,
autoHideShow = true,
/* Centralized function for browser feature detection
- User agent string detection is only used when no good alternative is possible
- Is executed directly for optimal performance
*/
ua = function() {
var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
u = nav.userAgent.toLowerCase(),
p = nav.platform.toLowerCase(),
windows = p ? /win/.test(p) : /win/.test(u),
mac = p ? /mac/.test(p) : /mac/.test(u),
webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
playerVersion = [0,0,0],
d = null;
if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
d = nav.plugins[SHOCKWAVE_FLASH].description;
if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
plugin = true;
ie = false; // cascaded feature detection for Internet Explorer
d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
}
}
else if (typeof win.ActiveXObject != UNDEF) {
try {
var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
if (a) { // a will return null when ActiveX is disabled
d = a.GetVariable("$version");
if (d) {
ie = true; // cascaded feature detection for Internet Explorer
d = d.split(" ")[1].split(",");
playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
}
}
}
catch(e) {}
}
return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
}(),
/* Cross-browser onDomLoad
- Will fire an event as soon as the DOM of a web page is loaded
- Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
- Regular onload serves as fallback
*/
onDomLoad = function() {
if (!ua.w3) { return; }
if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
callDomLoadFunctions();
}
if (!isDomLoaded) {
if (typeof doc.addEventListener != UNDEF) {
doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
}
if (ua.ie && ua.win) {
doc.attachEvent(ON_READY_STATE_CHANGE, function() {
if (doc.readyState == "complete") {
doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
callDomLoadFunctions();
}
});
if (win == top) { // if not inside an iframe
(function(){
if (isDomLoaded) { return; }
try {
doc.documentElement.doScroll("left");
}
catch(e) {
setTimeout(arguments.callee, 0);
return;
}
callDomLoadFunctions();
})();
}
}
if (ua.wk) {
(function(){
if (isDomLoaded) { return; }
if (!/loaded|complete/.test(doc.readyState)) {
setTimeout(arguments.callee, 0);
return;
}
callDomLoadFunctions();
})();
}
addLoadEvent(callDomLoadFunctions);
}
}();
function callDomLoadFunctions() {
if (isDomLoaded) { return; }
try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
t.parentNode.removeChild(t);
}
catch (e) { return; }
isDomLoaded = true;
var dl = domLoadFnArr.length;
for (var i = 0; i < dl; i++) {
domLoadFnArr[i]();
}
}
function addDomLoadEvent(fn) {
if (isDomLoaded) {
fn();
}
else {
domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
}
}
/* Cross-browser onload
- Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
- Will fire an event as soon as a web page including all of its assets are loaded
*/
function addLoadEvent(fn) {
if (typeof win.addEventListener != UNDEF) {
win.addEventListener("load", fn, false);
}
else if (typeof doc.addEventListener != UNDEF) {
doc.addEventListener("load", fn, false);
}
else if (typeof win.attachEvent != UNDEF) {
addListener(win, "onload", fn);
}
else if (typeof win.onload == "function") {
var fnOld = win.onload;
win.onload = function() {
fnOld();
fn();
};
}
else {
win.onload = fn;
}
}
/* Main function
- Will preferably execute onDomLoad, otherwise onload (as a fallback)
*/
function main() {
if (plugin) {
testPlayerVersion();
}
else {
matchVersions();
}
}
/* Detect the Flash Player version for non-Internet Explorer browsers
- Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
a. Both release and build numbers can be detected
b. Avoid wrong descriptions by corrupt installers provided by Adobe
c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
- Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
*/
function testPlayerVersion() {
var b = doc.getElementsByTagName("body")[0];
var o = createElement(OBJECT);
o.setAttribute("type", FLASH_MIME_TYPE);
var t = b.appendChild(o);
if (t) {
var counter = 0;
(function(){
if (typeof t.GetVariable != UNDEF) {
var d = t.GetVariable("$version");
if (d) {
d = d.split(" ")[1].split(",");
ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
}
}
else if (counter < 10) {
counter++;
setTimeout(arguments.callee, 10);
return;
}
b.removeChild(o);
t = null;
matchVersions();
})();
}
else {
matchVersions();
}
}
/* Perform Flash Player and SWF version matching; static publishing only
*/
function matchVersions() {
var rl = regObjArr.length;
if (rl > 0) {
for (var i = 0; i < rl; i++) { // for each registered object element
var id = regObjArr[i].id;
var cb = regObjArr[i].callbackFn;
var cbObj = {success:false, id:id};
if (ua.pv[0] > 0) {
var obj = getElementById(id);
if (obj) {
if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
setVisibility(id, true);
if (cb) {
cbObj.success = true;
cbObj.ref = getObjectById(id);
cb(cbObj);
}
}
else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
var att = {};
att.data = regObjArr[i].expressInstall;
att.width = obj.getAttribute("width") || "0";
att.height = obj.getAttribute("height") || "0";
if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
// parse HTML object param element's name-value pairs
var par = {};
var p = obj.getElementsByTagName("param");
var pl = p.length;
for (var j = 0; j < pl; j++) {
if (p[j].getAttribute("name").toLowerCase() != "movie") {
par[p[j].getAttribute("name")] = p[j].getAttribute("value");
}
}
showExpressInstall(att, par, id, cb);
}
else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
displayAltContent(obj);
if (cb) { cb(cbObj); }
}
}
}
else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
setVisibility(id, true);
if (cb) {
var o = getObjectById(id); // test whether there is an HTML object element or not
if (o && typeof o.SetVariable != UNDEF) {
cbObj.success = true;
cbObj.ref = o;
}
cb(cbObj);
}
}
}
}
}
function getObjectById(objectIdStr) {
var r = null;
var o = getElementById(objectIdStr);
if (o && o.nodeName == "OBJECT") {
if (typeof o.SetVariable != UNDEF) {
r = o;
}
else {
var n = o.getElementsByTagName(OBJECT)[0];
if (n) {
r = n;
}
}
}
return r;
}
/* Requirements for Adobe Express Install
- only one instance can be active at a time
- fp 6.0.65 or higher
- Win/Mac OS only
- no Webkit engines older than version 312
*/
function canExpressInstall() {
return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
}
/* Show the Adobe Express Install dialog
- Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
*/
function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
isExpressInstallActive = true;
storedCallbackFn = callbackFn || null;
storedCallbackObj = {success:false, id:replaceElemIdStr};
var obj = getElementById(replaceElemIdStr);
if (obj) {
if (obj.nodeName == "OBJECT") { // static publishing
storedAltContent = abstractAltContent(obj);
storedAltContentId = null;
}
else { // dynamic publishing
storedAltContent = obj;
storedAltContentId = replaceElemIdStr;
}
att.id = EXPRESS_INSTALL_ID;
if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
if (typeof par.flashvars != UNDEF) {
par.flashvars += "&" + fv;
}
else {
par.flashvars = fv;
}
// IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
// because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
if (ua.ie && ua.win && obj.readyState != 4) {
var newObj = createElement("div");
replaceElemIdStr += "SWFObjectNew";
newObj.setAttribute("id", replaceElemIdStr);
obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
obj.style.display = "none";
(function(){
if (obj.readyState == 4) {
obj.parentNode.removeChild(obj);
}
else {
setTimeout(arguments.callee, 10);
}
})();
}
createSWF(att, par, replaceElemIdStr);
}
}
/* Functions to abstract and display alternative content
*/
function displayAltContent(obj) {
if (ua.ie && ua.win && obj.readyState != 4) {
// IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
// because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
var el = createElement("div");
obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
el.parentNode.replaceChild(abstractAltContent(obj), el);
obj.style.display = "none";
(function(){
if (obj.readyState == 4) {
obj.parentNode.removeChild(obj);
}
else {
setTimeout(arguments.callee, 10);
}
})();
}
else {
obj.parentNode.replaceChild(abstractAltContent(obj), obj);
}
}
function abstractAltContent(obj) {
var ac = createElement("div");
if (ua.win && ua.ie) {
ac.innerHTML = obj.innerHTML;
}
else {
var nestedObj = obj.getElementsByTagName(OBJECT)[0];
if (nestedObj) {
var c = nestedObj.childNodes;
if (c) {
var cl = c.length;
for (var i = 0; i < cl; i++) {
if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
ac.appendChild(c[i].cloneNode(true));
}
}
}
}
}
return ac;
}
/* Cross-browser dynamic SWF creation
*/
function createSWF(attObj, parObj, id) {
var r, el = getElementById(id);
if (ua.wk && ua.wk < 312) { return r; }
if (el) {
if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
attObj.id = id;
}
if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
var att = "";
for (var i in attObj) {
if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
if (i.toLowerCase() == "data") {
parObj.movie = attObj[i];
}
else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
att += ' class="' + attObj[i] + '"';
}
else if (i.toLowerCase() != "classid") {
att += ' ' + i + '="' + attObj[i] + '"';
}
}
}
var par = "";
for (var j in parObj) {
if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
par += '<param name="' + j + '" value="' + parObj[j] + '" />';
}
}
el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
r = getElementById(attObj.id);
}
else { // well-behaving browsers
var o = createElement(OBJECT);
o.setAttribute("type", FLASH_MIME_TYPE);
for (var m in attObj) {
if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
o.setAttribute("class", attObj[m]);
}
else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
o.setAttribute(m, attObj[m]);
}
}
}
for (var n in parObj) {
if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
createObjParam(o, n, parObj[n]);
}
}
el.parentNode.replaceChild(o, el);
r = o;
}
}
return r;
}
function createObjParam(el, pName, pValue) {
var p = createElement("param");
p.setAttribute("name", pName);
p.setAttribute("value", pValue);
el.appendChild(p);
}
/* Cross-browser SWF removal
- Especially needed to safely and completely remove a SWF in Internet Explorer
*/
function removeSWF(id) {
var obj = getElementById(id);
if (obj && obj.nodeName == "OBJECT") {
if (ua.ie && ua.win) {
obj.style.display = "none";
(function(){
if (obj.readyState == 4) {
removeObjectInIE(id);
}
else {
setTimeout(arguments.callee, 10);
}
})();
}
else {
obj.parentNode.removeChild(obj);
}
}
}
function removeObjectInIE(id) {
var obj = getElementById(id);
if (obj) {
for (var i in obj) {
if (typeof obj[i] == "function") {
obj[i] = null;
}
}
obj.parentNode.removeChild(obj);
}
}
/* Functions to optimize JavaScript compression
*/
function getElementById(id) {
var el = null;
try {
el = doc.getElementById(id);
}
catch (e) {}
return el;
}
function createElement(el) {
return doc.createElement(el);
}
/* Updated attachEvent function for Internet Explorer
- Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
*/
function addListener(target, eventType, fn) {
target.attachEvent(eventType, fn);
listenersArr[listenersArr.length] = [target, eventType, fn];
}
/* Flash Player and SWF content version matching
*/
function hasPlayerVersion(rv) {
var pv = ua.pv, v = rv.split(".");
v[0] = parseInt(v[0], 10);
v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
v[2] = parseInt(v[2], 10) || 0;
return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
}
/* Cross-browser dynamic CSS creation
- Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
*/
function createCSS(sel, decl, media, newStyle) {
if (ua.ie && ua.mac) { return; }
var h = doc.getElementsByTagName("head")[0];
if (!h) { return; } // to also support badly authored HTML pages that lack a head element
var m = (media && typeof media == "string") ? media : "screen";
if (newStyle) {
dynamicStylesheet = null;
dynamicStylesheetMedia = null;
}
if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
// create dynamic stylesheet + get a global reference to it
var s = createElement("style");
s.setAttribute("type", "text/css");
s.setAttribute("media", m);
dynamicStylesheet = h.appendChild(s);
if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
}
dynamicStylesheetMedia = m;
}
// add style rule
if (ua.ie && ua.win) {
if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
dynamicStylesheet.addRule(sel, decl);
}
}
else {
if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
}
}
}
function setVisibility(id, isVisible) {
if (!autoHideShow) { return; }
var v = isVisible ? "visible" : "hidden";
if (isDomLoaded && getElementById(id)) {
getElementById(id).style.visibility = v;
}
else {
createCSS("#" + id, "visibility:" + v);
}
}
/* Filter to avoid XSS attacks
*/
function urlEncodeIfNecessary(s) {
var regex = /[\\\"<>\.;]/;
var hasBadChars = regex.exec(s) != null;
return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
}
/* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
*/
var cleanup = function() {
if (ua.ie && ua.win) {
window.attachEvent("onunload", function() {
// remove listeners to avoid memory leaks
var ll = listenersArr.length;
for (var i = 0; i < ll; i++) {
listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
}
// cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
var il = objIdArr.length;
for (var j = 0; j < il; j++) {
removeSWF(objIdArr[j]);
}
// cleanup library's main closures to avoid memory leaks
for (var k in ua) {
ua[k] = null;
}
ua = null;
for (var l in swfobject) {
swfobject[l] = null;
}
swfobject = null;
});
}
}();
return {
/* Public API
- Reference: http://code.google.com/p/swfobject/wiki/documentation
*/
registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
if (ua.w3 && objectIdStr && swfVersionStr) {
var regObj = {};
regObj.id = objectIdStr;
regObj.swfVersion = swfVersionStr;
regObj.expressInstall = xiSwfUrlStr;
regObj.callbackFn = callbackFn;
regObjArr[regObjArr.length] = regObj;
setVisibility(objectIdStr, false);
}
else if (callbackFn) {
callbackFn({success:false, id:objectIdStr});
}
},
getObjectById: function(objectIdStr) {
if (ua.w3) {
return getObjectById(objectIdStr);
}
},
embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
var callbackObj = {success:false, id:replaceElemIdStr};
if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
setVisibility(replaceElemIdStr, false);
addDomLoadEvent(function() {
widthStr += ""; // auto-convert to string
heightStr += "";
var att = {};
if (attObj && typeof attObj === OBJECT) {
for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
att[i] = attObj[i];
}
}
att.data = swfUrlStr;
att.width = widthStr;
att.height = heightStr;
var par = {};
if (parObj && typeof parObj === OBJECT) {
for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
par[j] = parObj[j];
}
}
if (flashvarsObj && typeof flashvarsObj === OBJECT) {
for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
if (typeof par.flashvars != UNDEF) {
par.flashvars += "&" + k + "=" + flashvarsObj[k];
}
else {
par.flashvars = k + "=" + flashvarsObj[k];
}
}
}
if (hasPlayerVersion(swfVersionStr)) { // create SWF
var obj = createSWF(att, par, replaceElemIdStr);
if (att.id == replaceElemIdStr) {
setVisibility(replaceElemIdStr, true);
}
callbackObj.success = true;
callbackObj.ref = obj;
}
else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
att.data = xiSwfUrlStr;
showExpressInstall(att, par, replaceElemIdStr, callbackFn);
return;
}
else { // show alternative content
setVisibility(replaceElemIdStr, true);
}
if (callbackFn) { callbackFn(callbackObj); }
});
}
else if (callbackFn) { callbackFn(callbackObj); }
},
switchOffAutoHideShow: function() {
autoHideShow = false;
},
ua: ua,
getFlashPlayerVersion: function() {
return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
},
hasFlashPlayerVersion: hasPlayerVersion,
createSWF: function(attObj, parObj, replaceElemIdStr) {
if (ua.w3) {
return createSWF(attObj, parObj, replaceElemIdStr);
}
else {
return undefined;
}
},
showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
if (ua.w3 && canExpressInstall()) {
showExpressInstall(att, par, replaceElemIdStr, callbackFn);
}
},
removeSWF: function(objElemIdStr) {
if (ua.w3) {
removeSWF(objElemIdStr);
}
},
createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
if (ua.w3) {
createCSS(selStr, declStr, mediaStr, newStyleBoolean);
}
},
addDomLoadEvent: addDomLoadEvent,
addLoadEvent: addLoadEvent,
getQueryParamValue: function(param) {
var q = doc.location.search || doc.location.hash;
if (q) {
if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
if (param == null) {
return urlEncodeIfNecessary(q);
}
var pairs = q.split("&");
for (var i = 0; i < pairs.length; i++) {
if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
}
}
}
return "";
},
// For internal usage only
expressInstallCallback: function() {
if (isExpressInstallActive) {
var obj = getElementById(EXPRESS_INSTALL_ID);
if (obj && storedAltContent) {
obj.parentNode.replaceChild(storedAltContent, obj);
if (storedAltContentId) {
setVisibility(storedAltContentId, true);
if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
}
if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
}
isExpressInstallActive = false;
}
}
};
}();
|
108wo
|
statics/js/crop/swfobject.js
|
JavaScript
|
asf20
| 25,574
|
var userAgent = navigator.userAgent.toLowerCase();
jQuery.browser = {
version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1],
safari: /webkit/.test( userAgent ),
opera: /opera/.test( userAgent ),
msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
};
function thumb_images(uploadid,returnid) {
var d = window.top.art.dialog({id:uploadid}).data.iframe;
var in_content = d.$("#att-status").html().substring(1);
if(in_content=='') return false;
if(!IsImg(in_content)) {
alert('选择的类型必须为图片类型');
return false;
}
if($('#'+returnid+'_preview').attr('src')) {
$('#'+returnid+'_preview').attr('src',in_content);
}
$('#'+returnid).val(in_content);
}
function change_images(uploadid,returnid){
var d = window.top.art.dialog({id:uploadid}).data.iframe;
var in_content = d.$("#att-status").html().substring(1);
var in_filename = d.$("#att-name").html().substring(1);
var str = $('#'+returnid).html();
var contents = in_content.split('|');
var filenames = in_filename.split('|');
$('#'+returnid+'_tips').css('display','none');
if(contents=='') return true;
$.each( contents, function(i, n) {
var ids = parseInt(Math.random() * 10000 + 10*i);
var filename = filenames[i].substr(0,filenames[i].indexOf('.'));
str += "<li id='image"+ids+"'><input type='text' name='"+returnid+"_url[]' value='"+n+"' style='width:310px;' ondblclick='image_priview(this.value);' class='input-text'> <input type='text' name='"+returnid+"_alt[]' value='"+filename+"' style='width:160px;' class='input-text' onfocus=\"if(this.value == this.defaultValue) this.value = ''\" onblur=\"if(this.value.replace(' ','') == '') this.value = this.defaultValue;\"> <a href=\"javascript:remove_div('image"+ids+"')\">移除</a> </li>";
});
$('#'+returnid).html(str);
}
function change_multifile(uploadid,returnid){
var d = window.top.art.dialog({id:uploadid}).data.iframe;
var in_content = d.$("#att-status").html().substring(1);
var in_filename = d.$("#att-name").html().substring(1);
var str = '';
var contents = in_content.split('|');
var filenames = in_filename.split('|');
$('#'+returnid+'_tips').css('display','none');
if(contents=='') return true;
$.each( contents, function(i, n) {
var ids = parseInt(Math.random() * 10000 + 10*i);
var filename = filenames[i].substr(0,filenames[i].indexOf('.'));
str += "<li id='multifile"+ids+"'><input type='text' name='"+returnid+"_fileurl[]' value='"+n+"' style='width:310px;' class='input-text'> <input type='text' name='"+returnid+"_filename[]' value='"+filename+"' style='width:160px;' class='input-text' onfocus=\"if(this.value == this.defaultValue) this.value = ''\" onblur=\"if(this.value.replace(' ','') == '') this.value = this.defaultValue;\"> <a href=\"javascript:remove_div('multifile"+ids+"')\">移除</a> </li>";
});
$('#'+returnid).append(str);
}
function add_multifile(returnid) {
var ids = parseInt(Math.random() * 10000);
var str = "<li id='multifile"+ids+"'><input type='text' name='"+returnid+"_fileurl[]' value='' style='width:310px;' class='input-text'> <input type='text' name='"+returnid+"_filename[]' value='附件说明' style='width:160px;' class='input-text'> <a href=\"javascript:remove_div('multifile"+ids+"')\">移除</a> </li>";
$('#'+returnid).append(str);
}
function set_title_color(color) {
$('#title').css('color',color);
$('#style_color').val(color);
}
//-----------------------
function check_content(obj) {
if($.browser.msie) {
CKEDITOR.instances[obj].insertHtml('');
CKEDITOR.instances[obj].focusManager.hasFocus;
}
top.art.dialog({id:'check_content_id'}).close();
return true;
}
function image_priview(img) {
window.top.art.dialog({title:'图片查看',fixed:true, content:'<img src="'+img+'" />',id:'image_priview',time:5});
}
function remove_div(id) {
$('#'+id).remove();
}
function input_font_bold() {
if($('#title').css('font-weight') == '700' || $('#title').css('font-weight')=='bold') {
$('#title').css('font-weight','normal');
$('#style_font_weight').val('');
} else {
$('#title').css('font-weight','bold');
$('#style_font_weight').val('bold');
}
}
function ruselinkurl() {
if($('#islink').attr('checked')==true) {
$('#linkurl').attr('disabled','');
var oEditor = CKEDITOR.instances.content;
oEditor.insertHtml(' ');
return false;
} else {
$('#linkurl').attr('disabled','true');
}
}
function close_window() {
if($('#title').val() !='') {
art.dialog({content:'内容已经录入,确定离开将不保存数据!', fixed:true,yesText:'我要关闭',noText:'返回保存数据',style:'confirm', id:'bnt4_test'}, function(){
window.close();
}, function(){
});
} else {
window.close();
}
return false;
}
function ChangeInput (objSelect,objInput) {
if (!objInput) return;
var str = objInput.value;
var arr = str.split(",");
for (var i=0; i<arr.length; i++){
if(objSelect.value==arr[i])return;
}
if(objInput.value=='' || objInput.value==0 || objSelect.value==0){
objInput.value=objSelect.value
}else{
objInput.value+=','+objSelect.value
}
}
//移除相关文章
function remove_relation(sid,id) {
var relation_ids = $('#relation').val();
if(relation_ids !='' ) {
$('#'+sid).remove();
var r_arr = relation_ids.split('|');
var newrelation_ids = '';
$.each(r_arr, function(i, n){
if(n!=id) {
if(i==0) {
newrelation_ids = n;
} else {
newrelation_ids = newrelation_ids+'|'+n;
}
}
});
$('#relation').val(newrelation_ids);
}
}
//显示相关文章
function show_relation(modelid,id) {
$.getJSON("?m=content&c=content&a=public_getjson_ids&modelid="+modelid+"&id="+id, function(json){
var newrelation_ids = '';
if(json==null) {
alert('没有添加相关文章');
return false;
}
$.each(json, function(i, n){
newrelation_ids += "<li id='"+n.sid+"'>·<span>"+n.title+"</span><a href='javascript:;' class='close' onclick=\"remove_relation('"+n.sid+"',"+n.id+")\"></a></li>";
});
$('#relation_text').html(newrelation_ids);
});
}
//移除ID
function remove_id(id) {
$('#'+id).remove();
}
function strlen_verify(obj, checklen, maxlen) {
var v = obj.value, charlen = 0, maxlen = !maxlen ? 200 : maxlen, curlen = maxlen, len = strlen(v);
for(var i = 0; i < v.length; i++) {
if(v.charCodeAt(i) < 0 || v.charCodeAt(i) > 255) {
curlen -= charset == 'utf-8' ? 2 : 1;
}
}
if(curlen >= len) {
$('#'+checklen).html(curlen - len);
} else {
obj.value = mb_cutstr(v, maxlen, true);
}
}
function mb_cutstr(str, maxlen, dot) {
var len = 0;
var ret = '';
var dot = !dot ? '...' : '';
maxlen = maxlen - dot.length;
for(var i = 0; i < str.length; i++) {
len += str.charCodeAt(i) < 0 || str.charCodeAt(i) > 255 ? (charset == 'utf-8' ? 3 : 2) : 1;
if(len > maxlen) {
ret += dot;
break;
}
ret += str.substr(i, 1);
}
return ret;
}
function strlen(str) {
return ($.browser.msie && str.indexOf('\n') != -1) ? str.replace(/\r?\n/g, '_').length : str.length;
}
|
108wo
|
statics/js/content_addtop.js
|
JavaScript
|
asf20
| 7,246
|
$(document).ready(function() {
var q = $("#q").val();
var typeid = $("#typeid").val();
search_history = getcookie('search_history');
if(search_history!=null && search_history!='') {
search_s = search_history.split(",");
var exists = in_array(q+'|'+typeid, search_s);
//不存在
if(exists==-1) {
if(search_s.length > 5) {
search_history = search_history.replace(search_s[0]+',', "");
}
search_history += ','+q+'|'+typeid;
}
//搜索历史
var history_html = '';
for(i=0;i<search_s.length;i++) {
var j = search_s.length - i - 1;
search_s_arr = search_s[j].split("|");
var keyword = search_s_arr[0];
var keywordtypeid = search_s_arr[1];
history_html += '<li><a href="?m=search&c=index&a=init&typeid='+keywordtypeid+'&q='+keyword+'">'+keyword+'</a></li>';
}
$('#history_ul').html(history_html);
} else {
search_history = q+'|'+typeid;
}
setcookie('search_history', search_history, '1000');
function in_array(v, a) {
var i;
for(i = 0; i < a.length; i++) {
if(v === a[i]) {
return i;
}
}
return -1;
}
});
|
108wo
|
statics/js/search_history.js
|
JavaScript
|
asf20
| 1,124
|
/*
* Async Treeview 0.1 - Lazy-loading extension for Treeview
*
* http://bassistance.de/jquery-plugins/jquery-plugin-treeview/
*
* Copyright (c) 2007 Jörn Zaefferer
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* Revision: $Id$
*
*/
;(function($) {
function load(settings, root, child, container) {
function createNode(parent) {
var current = $("<li/>").attr("id", this.id || "").attr("class", this.liclass || "").html("<span>" + this.text + "</span>").appendTo(parent);
if (this.classes) {
current.children("span").addClass(this.classes);
}
if (this.expanded) {
current.addClass("open");
}
if (this.hasChildren || this.children && this.children.length) {
var branch = $("<ul/>").appendTo(current);
if (this.hasChildren) {
current.addClass("hasChildren");
createNode.call({
classes: "placeholder",
text: " ",
children:[]
}, branch);
}
if (this.children && this.children.length) {
$.each(this.children, createNode, [branch])
}
}
}
$.ajax($.extend(true, {
url: settings.url,
dataType: "json",
data: {
root: root
},
success: function(response) {
child.empty();
$.each(response, createNode, [child]);
$(container).treeview({add: child});
}
}, settings.ajax));
/*
$.getJSON(settings.url, {root: root}, function(response) {
function createNode(parent) {
var current = $("<li/>").attr("id", this.id || "").html("<span>" + this.text + "</span>").appendTo(parent);
if (this.classes) {
current.children("span").addClass(this.classes);
}
if (this.expanded) {
current.addClass("open");
}
if (this.hasChildren || this.children && this.children.length) {
var branch = $("<ul/>").appendTo(current);
if (this.hasChildren) {
current.addClass("hasChildren");
createNode.call({
classes: "placeholder",
text: " ",
children:[]
}, branch);
}
if (this.children && this.children.length) {
$.each(this.children, createNode, [branch])
}
}
}
child.empty();
$.each(response, createNode, [child]);
$(container).treeview({add: child});
});
*/
}
var proxied = $.fn.treeview;
$.fn.treeview = function(settings) {
if (!settings.url) {
return proxied.apply(this, arguments);
}
var container = this;
if (!container.children().size())
load(settings, "source", this, container);
var userToggle = settings.toggle;
return proxied.call(this, $.extend({}, settings, {
collapsed: true,
toggle: function() {
var $this = $(this);
if ($this.hasClass("hasChildren")) {
var childList = $this.removeClass("hasChildren").find("ul");
load(settings, this.id, childList, container);
}
if (userToggle) {
userToggle.apply(this, arguments);
}
}
}));
};
})(jQuery);
|
108wo
|
statics/js/jquery.treeview.async.js
|
JavaScript
|
asf20
| 3,004
|
function confirmurl(url,message) {
url = url+'&pc_hash='+pc_hash;
if(confirm(message)) redirect(url);
}
function redirect(url) {
location.href = url;
}
//滚动条
$(function(){
$(":text").addClass('input-text');
})
/**
* 全选checkbox,注意:标识checkbox id固定为为check_box
* @param string name 列表check名称,如 uid[]
*/
function selectall(name) {
if ($("#check_box").attr("checked")==false) {
$("input[name='"+name+"']").each(function() {
this.checked=false;
});
} else {
$("input[name='"+name+"']").each(function() {
this.checked=true;
});
}
}
function openwinx(url,name,w,h) {
if(!w) w=screen.width-4;
if(!h) h=screen.height-95;
url = url+'&pc_hash='+pc_hash;
window.open(url,name,"top=100,left=400,width=" + w + ",height=" + h + ",toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,status=no");
}
//弹出对话框
function omnipotent(id,linkurl,title,close_type,w,h) {
if(!w) w=700;
if(!h) h=500;
art.dialog({id:id,iframe:linkurl, title:title, width:w, height:h, lock:true},
function(){
if(close_type==1) {
art.dialog({id:id}).close()
} else {
var d = art.dialog({id:id}).data.iframe;
var form = d.document.getElementById('dosubmit');form.click();
}
return false;
},
function(){
art.dialog({id:id}).close()
});void(0);
}
|
108wo
|
statics/js/admin_common.js
|
JavaScript
|
asf20
| 1,362
|
function open_menu(id,name,container,file,path,title,key, func) {
returnid= id;
returnfile = file;
returnname = name;
returnfunc = func;
var content = '<div class="linkage-menu"><h6><a href="javascript:;" onclick="get_menu_parent(this,0,\''+path+'\', \''+title+'\', \''+key+'\')" class="rt"><<返回主菜单</a><span>'+name+'</span> <a href="javascript:;" onclick="get_menu_parent(this,\'\',\''+path+'\', \''+title+'\', \''+key+'\')" id="parent_'+id+'" parentid="0"><img src="statics/images/icon/old-edit-redo.png" width="16" height="16" alt="返回上一级" /></a></h6><div class="ib-a menu" id="ul_'+id+'">';
for (i=0; i < container.length; i++)
{
content += '<a href="javascript:;" onclick="get_menu_child(\''+container[i][0]+'\',\''+container[i][1]+'\',\''+container[i][2]+'\',\''+path+'\',\''+title+'\',\''+key+'\')">'+container[i][1]+'</a>';
}
content += '</div></div>';
art.dialog({title:name,id:'edit_'+id,content:content,width:'422',height:'200',style:'none_icon ui_content_m'});
}
var level = 0;
function get_menu_child(nodeid,nodename,parentid,path,title,key) {
var content = container = '';
var url = "api.php?op=get_menu&act=ajax_getlist&parentid="+nodeid+"&cachefile="+returnfile+"&path="+path+'&title='+title+'&key='+key;
$.getJSON(url+'&callback=?',function(data){
if(data) {
level = 1;
$.each(data, function(i,data){
container = data.split(',');
content += '<a href="javascript:;" onclick="get_menu_child(\''+container[0]+'\',\''+container[1]+'\',\''+container[2]+'\',\''+path+'\',\''+title+'\',\''+key+'\')">'+container[1]+'</a>';
})
$("#ul_"+returnid).html(content);
get_menu_path(container[2],returnid,path);
$("#parent_"+returnid).attr('parentid',parentid);
} else {
get_menu_val(nodename,nodeid,path);
$("input[name='info["+returnid+"]']").val(nodeid);
//$("#"+returnid).after('<input type="hidden" name="info['+returnid+']" value="'+nodeid+'">');
art.dialog({id:'edit_'+returnid}).close();
}
})
}
function get_menu_parent(obj,parentid,path,title,key) {
var linkageid = parentid ? parentid : $(obj).attr('parentid');
var content = container = '';
var url = "api.php?op=get_menu&act=ajax_getlist&parentid="+linkageid+"&cachefile="+returnfile+"&path="+path+'&title='+title+'&key='+key;
$.getJSON(url+'&callback=?',function(data){
if(data) {
$.each(data, function(i,data){
container = data.split(',');
content += '<a href="javascript:;" onclick="get_menu_child(\''+container[0]+'\',\''+container[1]+'\',\''+container[2]+'\',\''+path+'\',\''+title+'\',\''+key+'\')">'+container[1]+'</a>';
})
get_menu_path(container[2],returnid,path);
$("#parent_"+returnid).attr('parentid',container[4]);
$("#ul_"+returnid).html(content);
} else {
$("#"+returnid).val(nodename);
art.dialog({id:'edit_'+returnid}).close();
}
})
}
function get_menu_path(nodeid,returnid,path) {
var show_path = '';
var url = "api.php?op=get_menu&act=ajax_getpath&parentid="+nodeid+"&keyid="+returnfile+'&path='+path;
$.getJSON(url+'&callback=?',function(data){
if(data) {
$.each(data, function(i,data){
if (data) {
show_path += data+" > ";
} else {
show_path += returnname;
}
})
$("#parent_"+returnid).siblings('span').html(show_path);
}
})
}
function get_menu_val(nodename,nodeid,cachepath) {
var path = $("#parent_"+returnid).siblings('span').html();
if(level==0) $("#"+returnid).html(nodename);
else $("#"+returnid).html(path+nodename);
var url = "api.php?op=get_menu&act=ajax_gettopparent&id="+nodeid+"&keyid="+returnfile+'&path='+cachepath;
$.getJSON(url+'&callback=?',function(data){
if(data) {
}
if (returnfunc) {
obj=new Object();
obj.value = data;
get_additional(obj);
}
})
level = 0;
}
|
108wo
|
statics/js/linkage/js/menu.js
|
JavaScript
|
asf20
| 3,843
|
(function($){
$.fn.mlnColsel=function(data,setting){
var dataObj={"Items":[
{"name":"mlnColsel","topid":"-1","colid":"-1","value":"-1","fun":function(){alert("undefined!");}}
]};
var settingObj={
title:"请选择",
value:"-1",
width:100
};
settingObj=$.extend(settingObj,setting);
dataObj=$.extend(dataObj,data);
var $this=$(this);
var $colselbox=$(document.createElement("a")).addClass("colselect").attr({"href":"javascript:;"});
var $colseltext=$(document.createElement("span")).text(settingObj.title);
var $coldrop=$(document.createElement("ul")).addClass("dropmenu");
var selectInput = $.browser.msie?document.createElement("<input name="+$this.attr("id")+" />"):document.createElement("input");
selectInput.type="hidden";
selectInput.value=settingObj.value;
selectInput.setAttribute("name",'info['+$this.attr("id")+']');
var ids=$this.attr("id");
$this.onselectstart=function(){return false;};
$this.onselect=function(){document.selection.empty()};
$colselbox.append($colseltext);
$this.addClass("colsel").append($colselbox).append($coldrop).append(selectInput);
$(dataObj.Items).each(function(i,n){
var $item=$(document.createElement("li"));
if(n.topid==0){
$coldrop.append($item);
$item.html("<span>"+n.name+"</span>").attr({"values":n.value,"id":"col_"+ids+"_"+n.colid});
}else{
if($("#col_"+ids+"_"+n.topid).find("ul").length<=0){
$("#col_"+ids+"_"+n.topid).append("<ul class=\"dropmenu rootmenu\"></ul>");
$("#col_"+ids+"_"+n.topid).find("ul:first").append($item);
$item.html("<span>"+n.name+"</span>").attr({"values":n.value,"id":"col_"+ids+"_"+n.colid});
}else{
$("#col_"+ids+"_"+n.topid).find("ul:first").append($item);
$item.html("<span>"+n.name+"</span>").attr({"values":n.value,"id":"col_"+ids+"_"+n.colid});
}
}
});
$this.find("li").each(function(){
$(this).click(function(event){
$colselbox.children("span").text($(this).find("span:first").text());
$(selectInput).val($(this).attr("values"));
hideMenu();
event.stopPropagation();
});
if($(this).find("ul").length>0){
$(this).addClass("menuout");
$(this).hover(function(){
$(this).removeClass("menuout");
$(this).addClass("menuhover");
$(this).find("ul:first").fadeIn("fast")
},function(){
$(this).removeClass("menuhover");
$(this).addClass("menuout");
$(this).find("ul").each(function(){
$(this).fadeOut("fast");
});
});
}else{
$(this).addClass("norout");
$(this).hover(function(){
$(this).removeClass("norout");
$(this).addClass("norhover");
},function(){
$(this).removeClass("norhover");
$(this).addClass("norout");
});
}
});
function hideMenu(){
$this.bOpen=0;
$(".rootmenu").hide();
$coldrop.slideUp("fast");
$(document).unbind("click",hideMenu);
}
function openMenu(){
$coldrop.slideDown("fast");
$this.bOpen=1;
}
$colselbox.click(function(event){
$(this).blur();
if($this.bOpen){
hideMenu();
}else{
openMenu();
$(document).bind("click",hideMenu);
}
event.stopPropagation();
});
$(".rootmenu").each(function(){
$(this).css({"left":135+"px"});
});
}
})(jQuery);
|
108wo
|
statics/js/linkage/js/mln.colselect.js
|
JavaScript
|
asf20
| 3,383
|
function open_linkage(id,name,container,linkageid) {
returnid= id;
returnkeyid = linkageid;
var content = '<div class="linkage-menu"><h6><a href="javascript:;" onclick="get_parent(this,0)" class="rt"><<返回主菜单</a><span>'+name+'</span> <a href="javascript:;" onclick="get_parent(this)" id="parent_'+id+'" parentid="0"><img src="statics/images/icon/old-edit-redo.png" width="16" height="16" alt="返回上一级" /></a></h6><div class="ib-a menu" id="ul_'+id+'">';
for (i=0; i < container.length; i++)
{
content += '<a href="javascript:;" onclick="get_child(\''+container[i][0]+'\',\''+container[i][1]+'\',\''+container[i][2]+'\')">'+container[i][1]+'</a>';
}
content += '</div></div>';
art.dialog({title:name,id:'edit_'+id,content:content,width:'422',height:'200',style:'none_icon ui_content_m'});
}
var level = 0;
function get_child(nodeid,nodename,parentid) {
var content = container = '';
var url = "api.php?op=get_linkage&act=ajax_getlist&parentid="+nodeid+"&keyid="+returnkeyid;
$.getJSON(url+'&callback=?',function(data){
if(data) {
level = 1;
$.each(data, function(i,data){
container = data.split(',');
content += '<a href="javascript:;" onclick="get_child(\''+container[0]+'\',\''+container[1]+'\',\''+container[2]+'\')">'+container[1]+'</a>';
})
$("#ul_"+returnid).html(content);
get_path(container[2],returnid);
$("#parent_"+returnid).attr('parentid',container[2]);
} else {
set_val(nodename,nodeid);
$("input[name='info["+returnid+"]']").val(nodeid);
//$("#"+returnid).after('<input type="hidden" name="info['+returnid+']" value="'+nodeid+'">');
art.dialog({id:'edit_'+returnid}).close();
}
})
}
function get_parent(obj,parentid) {
var linkageid = parentid ? parentid : $(obj).attr('parentid');
var content = container = '';
var url = "api.php?op=get_linkage&act=ajax_getlist&linkageid="+linkageid+"&keyid="+returnkeyid;
$.getJSON(url+'&callback=?',function(data){
if(data) {
$.each(data, function(i,data){
container = data.split(',');
content += '<a href="javascript:;" onclick="get_child(\''+container[0]+'\',\''+container[1]+'\',\''+container[2]+'\')">'+container[1]+'</a>';
})
get_path(container[2],returnid);
$("#parent_"+returnid).attr('parentid',container[2]);
$("#ul_"+returnid).html(content);
} else {
$("#"+returnid).val(nodename);
art.dialog({id:'edit_'+returnid}).close();
}
})
}
function get_path(nodeid,returnid) {
var show_path = '';
var url = "api.php?op=get_linkage&act=ajax_getpath&parentid="+nodeid+"&keyid="+returnkeyid;
$.getJSON(url+'&callback=?',function(data){
if(data) {
$.each(data, function(i,data){
show_path += data+" > ";
})
$("#parent_"+returnid).siblings('span').html(show_path);
}
})
}
function set_val(nodename,nodeid) {
var path = $("#parent_"+returnid).siblings('span').html();
if(level==0) $("#"+returnid).html(nodename);
else $("#"+returnid).html(path+nodename);
var url = "api.php?op=get_linkage&act=ajax_gettopparent&linkageid="+nodeid+"&keyid="+returnkeyid;
$.getJSON(url+'&callback=?',function(data){
if(data) {
$("#city").val(data);
}
})
level = 0;
}
|
108wo
|
statics/js/linkage/js/pop.js
|
JavaScript
|
asf20
| 3,235
|
.colselect,.colselect:link,.colselect:visited{
display:block;
border:1px solid #BCBCBC;
width:145px;
height:20px;
overflow:hidden;
line-height:20px;
background:url(../images/up1.png) right no-repeat;
text-align:left;
}
.colselect:active{
border:1px solid #BCBCBC;
width:144px;
height:19px;
padding:1px 0 0 1px;
overflow:hidden;
}
.colselect span{
width:115px;
padding-left:3px;
overflow:hidden;
height:20px;
line-height:20px;
font-size:12px;
color:#333;
}
.dropmenu{
display:none;
margin-top:-1px;
background-color:#FFF;
position:absolute;
width:141px;
height:auto;
border:1px solid #BCBCBC;
z-index:99;
padding:2px 2px
}
.dropmenu li{
font-size:12px;
line-height:25px;
height:25px;
padding-left:5px;
display:block;
width:136px;
cursor:default;
-moz-user-select:none;
text-align:left;
}
.rootmenu{
position:absolute;
display:none;
margin-top:-25px;
* margin-top:-8px;
}
.menuhover{
background:url(../images/root2.png) right no-repeat;
color:#FFF;
}
.menuout{
background:url(../images/root1.png) right no-repeat;
color:#333;
}
.norout{
color:#333;
}
.norhover{
background:url(../images/root.png) right no-repeat;
color:#FFF;
}
|
108wo
|
statics/js/linkage/style/admin.css
|
CSS
|
asf20
| 1,250
|
.colselect,.colselect:link,.colselect:visited{
display:block;
border:1px solid #BCBCBC;
width:145px;
height:20px;
overflow:hidden;
line-height:20px;
background:url(../images/up1.png) right no-repeat;
text-align:left;
}
.colselect:active{
border:1px solid #BCBCBC;
width:144px;
height:19px;
padding:1px 0 0 1px;
overflow:hidden;
}
.colselect span{
width:115px;
padding-left:3px;
overflow:hidden;
height:20px;
line-height:20px;
font-size:12px;
color:#333;
}
.dropmenu{
display:none;
margin-top:-1px;
background-color:#FFF;
position:absolute;
width:141px;
height:auto;
border:1px solid #BCBCBC;
z-index:99;
padding:2px 2px
}
.dropmenu li{
font-size:12px;
line-height:25px;
height:25px;
padding-left:5px;
display:block;
width:136px;
cursor:default;
-moz-user-select:none;
text-align:left;
}
.rootmenu{
position:absolute;
display:none;
margin-top:-25px;
* margin-top:-8px;
}
.menuhover{
background:url(../images/root2.png) right no-repeat;
color:#FFF;
}
.menuout{
background:url(../images/root1.png) right no-repeat;
color:#333;
}
.norout{
color:#333;
}
.norhover{
background:url(../images/root.png) right no-repeat;
color:#FFF;
}
|
108wo
|
statics/js/linkage/style/css.css
|
CSS
|
asf20
| 1,248
|
/* The main calendar widget. DIV containing a table. */
div.calendar { position: relative; }
.calendar, .calendar table {
border: 1px solid #b3cbe4;
font-size: 11px;
color: #000;
cursor: default;
background: #F1F8FC;
font-family: tahoma,verdana,sans-serif;
}
.calendar table{border: 1px solid #fff;}
/* Header part -- contains navigation buttons and day names. */
.calendar table thead td{background:#d5e5f6; color:#6993c0; border-bottom:1px solid #fff; border-right:none; height:16px; width:18px}
.calendar table thead tr.headrow td{ background:#e0ecf9}
.headrow{border-top:1px solid #b3cbe4}
.calendar table thead td.button div div{
background-image: url(../../images/admin_img/question-balloon.png);
background-repeat: no-repeat; text-indent:-100px; overflow:hidden
}
.headrow .button { /* "<<", "<", ">", ">>" buttons have this class */
text-align: center; /* They are the navigation buttons */
border-right:1px solid #FFF; padding:0
}
.headrow .button div,.calendar table .wn div{border-right:1px solid #b3cbe4; height:23px; line-height:23px}
.calendar .nav {
}
.calendar thead .title { /* This holds the current "month, year" */
font-weight: bold; /* Pressing it will take you to the current date */
text-align: center;
padding: 2px;
color:#366699; width:auto
}
.calendar thead tr { /* Row <TR> containing navigation buttons */
background: #007ED1;
color: #fff;
}
.calendar thead .daynames { /* Row <TR> containing the day names */
background: #e0ecf9;
}
.calendar thead .name { /* Cells <TD> containing the day names */
border-bottom: 1px solid #b3cbe4;
padding: 2px;
text-align: center;
color: #000;
}
.calendar thead .weekend { /* How a weekend day name shows in header */
color: #a66;
}
.calendar thead .hilite { /* How do the buttons in header appear when hover */
background-color: #d5e5f6;
color: #366699;
}
/* The body part -- contains all the days in month. */
.calendar tbody .day { /* Cells <TD> containing month days dates */
width: 2em;
color: #456;
text-align: right;
padding: 2px 4px 2px 2px;
}
.calendar tbody .day div{ padding-right:5px}
.calendar tbody .day.othermonth {
font-size: 80%;
color: #bbb;
}
.calendar tbody .day.othermonth.oweekend {
color: #fbb;
}
.calendar table .wn {
border-right: 1px solid #fff;
background: #e0ecf9; padding:0
}
.calendar tbody .rowhilite td {
background: #def;
}
.calendar tbody .rowhilite td.wn {
background: #F1F8FC;
}
.calendar tbody td.hilite { /* Hovered cells <TD> */
background: #93b9e2;
padding: 1px 3px 1px 1px;
color:#fff
}
.calendar tbody td.active { /* Active (pressed) cells <TD> */
background: #cde;
padding: 2px 2px 0px 2px;
}
.calendar tbody td.selected { /* Cell showing today date */
font-weight: bold;
padding: 1px 3px 1px 1px;
background: #ff7200;
color: #fff;
}
.calendar tbody td.weekend { /* Cells showing weekend days */
color: #a66;
}
.calendar tbody td.today { /* Cell showing selected date */
font-weight: bold;
color: #D50000;
}
.calendar tbody .disabled { color: #999; }
.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */
visibility: hidden;
}
.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */
display: none;
}
/* The footer part -- status bar and "Close" button */
.calendar tfoot .footrow { /* The <TR> in footer (only one right now) */
text-align: center;
background: #206A9B;
color: #fff;
}
.calendar tfoot .ttip { /* Tooltip (status bar) cell <TD> */
background: #e0ecf9;
color: #366699;
border-top: 1px solid #b3cbe4;
padding: 1px; height:24px
}
.calendar tfoot .hilite { /* Hover style for buttons in footer */
background: #B8DAF0;
border: 1px solid #178AEB;
color: #000;
padding: 1px;
}
.calendar tfoot .active { /* Active (pressed) style for buttons in footer */
background: #006AA9;
padding: 2px 0px 0px 2px;
}
/* Combo boxes (menus that display months/years for direct selection) */
.calendar .combo {
position: absolute;
display: none;
top: 0px;
left: 0px;
width: 4em;
cursor: default;
border: 1px solid #655;
background: #def;
color: #000;
font-size: 90%;
z-index: 9999999999999999999999999999;
}
.calendar .combo .label,
.calendar .combo .label-IEfix {
text-align: center;
padding: 1px;
}
.calendar .combo .label-IEfix {
width: 4em;
}
.calendar .combo .hilite {
background: #34ABFA;
border-top: 1px solid #46a;
border-bottom: 1px solid #46a;
font-weight: bold;
}
.calendar .combo .active {
border-top: 1px solid #46a;
border-bottom: 1px solid #46a;
background: #F1F8FC;
font-weight: bold;
}
.calendar td.time {
border-top: 1px solid #b3cbe4;
padding: 1px 0px;
text-align: center;
background-color: #E3F0F9;
height:24px
}
.calendar td.time .hour,
.calendar td.time .minute,
.calendar td.time .ampm {
padding: 0px 3px 0px 4px;
border: 1px solid #889;
font-weight: bold;
background-color: #F1F8FC;
}
.calendar td.time .ampm {
text-align: center;
}
.calendar td.time .colon {
padding: 0px 2px 0px 3px;
font-weight: bold;
}
.calendar td.time span.hilite {
border-color: #000;
background-color: #267DB7;
color: #fff;
}
.calendar td.time span.active {
border-color: red;
background-color: #000;
color: #A5FF00;
}
.calendar thead .active div{ /* Active (pressed) buttons in header */
background: #bdd2e8;
}
|
108wo
|
statics/js/calendar/calendar-blue.css
|
CSS
|
asf20
| 5,645
|
/* CSS */
.DynarchCalendar {
border: 1px solid #aaa;
-moz-user-select: none;
-webkit-user-select: none;
user-select: none;
background: #e8e8e8;
font: 11px "lucida grande",tahoma,verdana,sans-serif;
line-height: 14px;
position: relative;
cursor: default;
}
.DynarchCalendar table {
border-collapse: collapse;
font: 11px "lucida grande",tahoma,verdana,sans-serif;
line-height: 14px;
}
.DynarchCalendar-topBar {
border-bottom: 1px solid #aaa;
background: #ddd;
padding: 5px 0 0 0;
}
table.DynarchCalendar-titleCont {
font-size: 130%; font-weight: bold;
color: #444;
text-align: center;
z-index: 9;
position: relative;
margin-top: -6px;
}
.DynarchCalendar-title div {
padding: 5px 17px;
}
.DynarchCalendar-hover-title div {
background-color: #fff;
border: 1px solid #000;
padding: 4px 16px;
background-image: url("img/drop-down.gif");
background-repeat: no-repeat;
background-position: 100% 50%;
}
.DynarchCalendar-pressed-title div {
border: 1px solid #000;
padding: 4px 16px;
background-color: #777;
color: #fff;
background-image: url("img/drop-up.gif");
background-repeat: no-repeat;
background-position: 100% 50%;
}
.DynarchCalendar-bottomBar {
border-top: 1px solid #aaa;
background: #ddd;
padding: 2px;
position: relative;
text-align: center;
}
.DynarchCalendar-bottomBar-today {
padding: 2px 15px;
}
.DynarchCalendar-hover-bottomBar-today {
border: 1px solid #000;
background-color: #fff;
padding: 1px 14px;
}
.DynarchCalendar-pressed-bottomBar-today {
border: 1px solid #000;
background-color: #777;
color: #fff;
padding: 1px 14px;
}
.DynarchCalendar-body {
position: relative;
overflow: hidden;
padding-top: 5px;
padding-bottom: 5px;
}
.DynarchCalendar-first-col { padding-left: 5px; }
.DynarchCalendar-last-col { padding-right: 5px; }
.DynarchCalendar-animBody-backYear {
position: absolute;
top: -100%;
left: 0;
}
.DynarchCalendar-animBody-back {
position: absolute;
top: 5px;
left: -100%;
}
.DynarchCalendar-animBody-fwd {
position: absolute;
top: 5px;
left: 100%;
}
.DynarchCalendar-animBody-now {
position: absolute;
top: 5px;
left: 0;
}
.DynarchCalendar-animBody-fwdYear {
position: absolute;
top: 100%;
left: 0;
}
.DynarchCalendar-dayNames {
padding-left: 5px;
padding-right: 5px;
}
.DynarchCalendar-dayNames div { font-weight: bold; color: #444; text-shadow: 1px 1px 1px #777; }
.DynarchCalendar-navBtn {
position: absolute;
top: 5px;
z-index: 10;
}
.DynarchCalendar-navBtn div {
background-repeat: no-repeat;
background-position: 50% 50%;
height: 15px;
width: 16px;
padding: 1px;
}
.DynarchCalendar-hover-navBtn div {
border: 1px solid #000;
padding: 0;
background-color: #fff;
}
.DynarchCalendar-navDisabled {
opacity: 0.3;
filter: alpha(opacity=30);
}
.DynarchCalendar-pressed-navBtn div {
border: 1px solid #000;
padding: 0;
background-color: #777;
color: #fff;
}
.DynarchCalendar-prevMonth {
left: 25px;
}
.DynarchCalendar-nextMonth {
left: 100%;
margin-left: -43px;
}
.DynarchCalendar-prevYear {
left: 5px;
}
.DynarchCalendar-nextYear {
left: 100%;
margin-left: -23px;
}
.DynarchCalendar-prevMonth div {
background-image: url("img/nav-left.gif");
}
.DynarchCalendar-nextMonth div {
background-image: url("img/nav-right.gif");
}
.DynarchCalendar-prevYear div {
background-image: url("img/nav-left-x2.gif");
}
.DynarchCalendar-nextYear div {
background-image: url("img/nav-right-x2.gif");
}
.DynarchCalendar-menu {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: #ddd;
overflow: hidden;
opacity: 0.85;
filter: alpha(opacity=85);
}
.DynarchCalendar-menu table td div {
text-align: center;
font-weight: bold;
padding: 3px 5px;
}
.DynarchCalendar-menu table td div.DynarchCalendar-menu-month {
width: 4em;
text-align: center;
}
.DynarchCalendar-menu table td div.DynarchCalendar-hover-navBtn {
border: 1px solid #000;
padding: 2px 4px;
background-color: #fff;
color: #000;
}
.DynarchCalendar-menu table td div.DynarchCalendar-pressed-navBtn {
border: 1px solid #000;
padding: 2px 4px;
background-color: #777;
color: #fff !important;
}
.DynarchCalendar-menu-year {
text-align: center;
font: 16px "lucida grande",tahoma,verdana,sans-serif;
font-weight: bold;
}
.DynarchCalendar-menu-sep {
height: 1px; font-size: 1px; line-height: 1px;
overflow: hidden;
border-top: 1px solid #888;
background: #fff;
margin-top: 4px; margin-bottom: 3px;
}
.DynarchCalendar-time td { font-weight: bold; font-size: 120%; }
.DynarchCalendar-time-hour, .DynarchCalendar-time-minute { padding: 1px 3px; }
.DynarchCalendar-time-down { background: url("img/time-down.png") no-repeat 50% 50%; width: 11px; height: 8px; opacity: 0.5; }
.DynarchCalendar-time-up { background: url("img/time-up.png") no-repeat 50% 50%; width: 11px; height: 8px; opacity: 0.5; }
.DynarchCalendar-time-sep { padding: 0 2px; }
.DynarchCalendar-hover-time { background-color: #93b9e2; color: #fff; opacity: 1; }
.DynarchCalendar-pressed-time { background-color: #7da7d5; color: #fff; opacity: 1; }
.DynarchCalendar-time-am { padding: 1px; width: 2.5em; text-align: center; }
/* body */
.DynarchCalendar-hover-week { background-color: #ddd; }
.DynarchCalendar-dayNames div, .DynarchCalendar-day, .DynarchCalendar-weekNumber {
width: 1.7em;
padding: 3px 4px;
text-align: center;
}
.DynarchCalendar-weekNumber {
border-right: 1px solid #aaa;
margin-right: 4px;
width: 2em !important;
padding-right: 8px !important;
}
.DynarchCalendar-day {
text-align: right; color: #222;
}
.DynarchCalendar-day-othermonth { color: #888; }
.DynarchCalendar-weekend { color: #c22; }
.DynarchCalendar-day-today { color: #00f; font-weight: bold; }
.DynarchCalendar-day-disabled {
opacity: 0.5;
text-shadow: 2px 1px 1px #fff;
}
.DynarchCalendar-hover-date {
padding: 2px 3px;
background-color: #eef;
border: 1px solid #88c;
margin: 0 !important;
color: #000;
}
.DynarchCalendar-day-othermonth.DynarchCalendar-hover-date { border-color: #aaa; color: #888; }
.DynarchCalendar-dayNames .DynarchCalendar-weekend { color: #c22; }
.DynarchCalendar-day-othermonth.DynarchCalendar-weekend { color: #d88; }
.DynarchCalendar-day-selected {
padding: 2px 3px;
margin: 1px;
background-color: #aaa;
color: #000 !important;
}
.DynarchCalendar-day-today.DynarchCalendar-day-selected { background-color: #999; }
/* focus */
.DynarchCalendar-focusLink {
position: absolute;
opacity: 0;
filter: alpha(opacity=0);
}
.DynarchCalendar-focused {
border-color: #000;
}
.DynarchCalendar-focused .DynarchCalendar-topBar, .DynarchCalendar-focused .DynarchCalendar-bottomBar {
background-color: #ccc;
border-color: #336;
}
.DynarchCalendar-focused .DynarchCalendar-hover-week {
background-color: #ccc;
}
.DynarchCalendar-tooltip {
position: absolute;
top: 100%;
width: 100%;
}
.DynarchCalendar-tooltipCont {
margin: 0 5px 0 5px;
border: 1px solid #aaa;
border-top: 0;
padding: 3px 6px;
background: #ddd;
}
.DynarchCalendar-focused .DynarchCalendar-tooltipCont {
background: #ccc;
border-color: #000;
}
@media print {
.DynarchCalendar-day-selected {
padding: 2px 3px;
border: 1px solid #000;
margin: 0 !important;
}
}
|
108wo
|
statics/js/calendar/jscal2.css
|
CSS
|
asf20
| 7,707
|
Calendar.LANG("cn", "中文", {
fdow: 1, // first day of week for this locale; 0 = Sunday, 1 = Monday, etc.
goToday: "今天",
today: "今天", // appears in bottom bar
wk: "周",
weekend: "0,6", // 0 = Sunday, 1 = Monday, etc.
AM: "AM",
PM: "PM",
mn : [ "一月",
"二月",
"三月",
"四月",
"五月",
"六月",
"七月",
"八月",
"九月",
"十月",
"十一月",
"十二月"],
smn : [ "一月",
"二月",
"三月",
"四月",
"五月",
"六月",
"七月",
"八月",
"九月",
"十月",
"十一月",
"十二月"],
dn : [ "日",
"一",
"二",
"三",
"四",
"五",
"六",
"日" ],
sdn : [ "日",
"一",
"二",
"三",
"四",
"五",
"六",
"日" ]
});
|
108wo
|
statics/js/calendar/lang/en.js
|
JavaScript
|
asf20
| 1,316
|
.DynarchCalendar-topCont{background: none repeat scroll 0 0 #F1F8FC;
border: 1px solid #B3CBE4;}
.DynarchCalendar-topCont .DynarchCalendar{ border: 1px solid #FFFFFF;}
.DynarchCalendar, .DynarchCalendar-focused {
background-color: #F1F8FC;
}
.DynarchCalendar-topBar,
.DynarchCalendar-bottomBar,
.DynarchCalendar-focused .DynarchCalendar-topBar,
.DynarchCalendar-focused .DynarchCalendar-bottomBar {
background-color: #D5E5F6;
color: #369;
}
.DynarchCalendar-title div { color: #369;}
.DynarchCalendar-dayNames { border-bottom: 1px solid #B3CBE4;background-color: #D5E5F6; }
.DynarchCalendar-hover-navBtn div,
.DynarchCalendar-hover-title div,
.DynarchCalendar-hover-bottomBar-today {
border-color: #ddeeff #84acd7 #84acd7 #ddeeff;
background-color: #93b9e2;
color: #000;
}
.DynarchCalendar-menu table td div.DynarchCalendar-hover-navBtn {
border-color: #93b9e2;
background-color: #93b9e2;
color: #366699;
}
.DynarchCalendar-pressed-navBtn div,
.DynarchCalendar-pressed-title div,
.DynarchCalendar-pressed-bottomBar-today,
.DynarchCalendar-menu table td div.DynarchCalendar-pressed-navBtn {
border-color: #bfd7f2 #7faad7 #7faad7 #bfd7f2;
background-color: #93b9e2;
color: #369;
}
.DynarchCalendar-hover-date {
background-color: #93b9e2; border-color:#93b9e2
}
.DynarchCalendar-day {
-moz-border-radius: 0;
-webkit-border-radius: 0;
border-radius: 0;
}
.DynarchCalendar-day-disabled {
background: #c4c0b8;
}
.DynarchCalendar-hover-week { background-color: #ddeeff !important; }
.DynarchCalendar-day-selected {
background-color: #ff7200;
border: 1px solid;
border-color: #ff7200;
margin: 0; color:#fff; font-weight:700
}
.DynarchCalendar-day-today.DynarchCalendar-day-selected { background-color: #ff7200; }
.DynarchCalendar-menu {
background-color: #ddeeff;
}
.DynarchCalendar-dayNames div{text-shadow:none; font-size:12px}
.DynarchCalendar table{ font-size:12px; color:#366699}
|
108wo
|
statics/js/calendar/win2k.css
|
CSS
|
asf20
| 2,006
|
.DynarchCalendar, .DynarchCalendar table {
font-size: 10px;
}
.DynarchCalendar-dayNames { padding: 0; }
.DynarchCalendar-body { padding: 0; }
.DynarchCalendar-animBody-back { top: 0; }
.DynarchCalendar-animBody-fwd { top: 0; }
.DynarchCalendar-animBody-now { top: 0; }
.DynarchCalendar-first-col { padding-left: 0; }
.DynarchCalendar-last-col { padding-right: 0; }
.DynarchCalendar-weekNumber {
margin-right: 0;
padding-right: 4px !important;
}
.DynarchCalendar-dayNames div, .DynarchCalendar-day, .DynarchCalendar-weekNumber {
padding: 1px 2px;
}
.DynarchCalendar-menu-year { font-size: 12px; }
.DynarchCalendar-hover-date {
padding: 0px 1px;
}
.DynarchCalendar-day-selected {
padding: 0px 1px;
}
.DynarchCalendar-menu table td div {
padding: 2px 4px;
}
.DynarchCalendar-menu table td div.DynarchCalendar-hover-navBtn {
padding: 1px 3px;
}
|
108wo
|
statics/js/calendar/reduce-spacing.css
|
CSS
|
asf20
| 858
|
/* This is for Gecko-based browsers */
/*
.DynarchCalendar {
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
}
.DynarchCalendar-title, .DynarchCalendar-title div {
-moz-border-radius: 0 0 4px 4px;
-webkit-border-radius: 0 0 4px 4px;
border-radius: 0 0 4px 4px;
}
.DynarchCalendar-topBar {
-moz-border-radius: 4px 4px 0 0;
-webkit-border-radius: 4px;
border-radius: 4px 4px 0 0;
}
.DynarchCalendar-bottomBar {
-moz-border-radius: 0 0 4px 4px;
-webkit-border-radius: 0 0 4px 4px;
border-radius: 0 0 4px 4px;
}
.DynarchCalendar-bottomBar-today {
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
}
.DynarchCalendar-navBtn, .DynarchCalendar-navBtn div {
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
}
.DynarchCalendar-menu {
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
}
.DynarchCalendar-menu table td div {
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
}
.DynarchCalendar-weekNumber {
-moz-border-radius: 4px 0 0 4px;
-webkit-border-radius: 4px 0 0 4px;
border-radius: 4px 0 0 4px;
}
.DynarchCalendar-day {
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
}
.DynarchCalendar-day-disabled {
-moz-border-radius: 0;
-webkit-border-radius: 0;
border-radius: 0;
}
.DynarchCalendar-tooltipCont {
-moz-border-radius: 0 0 5px 5px;
-webkit-border-radius: 5px;
}
.DynarchCalendar-time-hour, .DynarchCalendar-time-minute {
-moz-border-radius: 3px 0 0 3px;
-webkit-border-radius: 3px;
}
.DynarchCalendar-time-am {
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
}
*/
|
108wo
|
statics/js/calendar/border-radius.css
|
CSS
|
asf20
| 1,785
|
/**
* Copyright (c) 2010 Anders Ekdahl (http://coffeescripter.com/)
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
*
* Version: 1.2.4
*
* Demo and documentation: http://coffeescripter.com/code/ad-gallery/
*/
(function($) {
$.fn.adGallery = function(options) {
var defaults = { loader_image: 'statics/images/yp/loader.gif',
start_at_index: 0,
description_wrapper: false,
thumb_opacity: 0.7,
animate_first_image: false,
animation_speed: 400,
width: false,
height: false,
display_next_and_prev: true,
display_back_and_forward: true,
scroll_jump: 0, // If 0, it jumps the width of the container
slideshow: {
enable: false,
autostart: false,
speed: 5000,
start_label: 'Start',
stop_label: 'Stop',
stop_on_scroll: true,
countdown_prefix: '(',
countdown_sufix: ')',
onStart: false,
onStop: false
},
effect: 'slide-hori', // or 'slide-vert', 'fade', or 'resize', 'none'
enable_keyboard_move: true,
cycle: true,
callbacks: {
init: false,
afterImageVisible: false,
beforeImageVisible: false
}
};
var settings = $.extend(false, defaults, options);
if(options && options.slideshow) {
settings.slideshow = $.extend(false, defaults.slideshow, options.slideshow);
};
if(!settings.slideshow.enable) {
settings.slideshow.autostart = false;
};
var galleries = [];
$(this).each(function() {
var gallery = new AdGallery(this, settings);
galleries[galleries.length] = gallery;
});
// Sorry, breaking the jQuery chain because the gallery instances
// are returned so you can fiddle with them
return galleries;
};
function VerticalSlideAnimation(img_container, direction, desc) {
var current_top = parseInt(img_container.css('top'), 10);
if(direction == 'left') {
var old_image_top = '-'+ this.image_wrapper_height +'px';
img_container.css('top', this.image_wrapper_height +'px');
} else {
var old_image_top = this.image_wrapper_height +'px';
img_container.css('top', '-'+ this.image_wrapper_height +'px');
};
if(desc) {
desc.css('bottom', '-'+ desc[0].offsetHeight +'px');
desc.animate({bottom: 0}, this.settings.animation_speed * 2);
};
if(this.current_description) {
this.current_description.animate({bottom: '-'+ this.current_description[0].offsetHeight +'px'}, this.settings.animation_speed * 2);
};
return {old_image: {top: old_image_top},
new_image: {top: current_top}};
};
function HorizontalSlideAnimation(img_container, direction, desc) {
var current_left = parseInt(img_container.css('left'), 10);
if(direction == 'left') {
var old_image_left = '-'+ this.image_wrapper_width +'px';
img_container.css('left',this.image_wrapper_width +'px');
} else {
var old_image_left = this.image_wrapper_width +'px';
img_container.css('left','-'+ this.image_wrapper_width +'px');
};
if(desc) {
desc.css('bottom', '-'+ desc[0].offsetHeight +'px');
desc.animate({bottom: 0}, this.settings.animation_speed * 2);
};
if(this.current_description) {
this.current_description.animate({bottom: '-'+ this.current_description[0].offsetHeight +'px'}, this.settings.animation_speed * 2);
};
return {old_image: {left: old_image_left},
new_image: {left: current_left}};
};
function ResizeAnimation(img_container, direction, desc) {
var image_width = img_container.width();
var image_height = img_container.height();
var current_left = parseInt(img_container.css('left'), 10);
var current_top = parseInt(img_container.css('top'), 10);
img_container.css({width: 0, height: 0, top: this.image_wrapper_height / 2, left: this.image_wrapper_width / 2});
return {old_image: {width: 0,
height: 0,
top: this.image_wrapper_height / 2,
left: this.image_wrapper_width / 2},
new_image: {width: image_width,
height: image_height,
top: current_top,
left: current_left}};
};
function FadeAnimation(img_container, direction, desc) {
img_container.css('opacity', 0);
return {old_image: {opacity: 0},
new_image: {opacity: 1}};
};
// Sort of a hack, will clean this up... eventually
function NoneAnimation(img_container, direction, desc) {
img_container.css('opacity', 0);
return {old_image: {opacity: 0},
new_image: {opacity: 1},
speed: 0};
};
function AdGallery(wrapper, settings) {
this.init(wrapper, settings);
};
AdGallery.prototype = {
// Elements
wrapper: false,
image_wrapper: false,
gallery_info: false,
nav: false,
loader: false,
preloads: false,
thumbs_wrapper: false,
scroll_back: false,
scroll_forward: false,
next_link: false,
prev_link: false,
slideshow: false,
image_wrapper_width: 0,
image_wrapper_height: 0,
current_index: 0,
current_image: false,
current_description: false,
nav_display_width: 0,
settings: false,
images: false,
in_transition: false,
animations: false,
init: function(wrapper, settings) {
var context = this;
this.wrapper = $(wrapper);
this.settings = settings;
this.setupElements();
this.setupAnimations();
if(this.settings.width) {
this.image_wrapper_width = this.settings.width;
this.image_wrapper.width(this.settings.width);
this.wrapper.width(this.settings.width);
} else {
this.image_wrapper_width = this.image_wrapper.width();
};
if(this.settings.height) {
this.image_wrapper_height = this.settings.height;
this.image_wrapper.height(this.settings.height);
} else {
this.image_wrapper_height = this.image_wrapper.height();
};
this.nav_display_width = this.nav.width();
this.current_index = 0;
this.current_image = false;
this.current_description = false;
this.in_transition = false;
this.findImages();
if(this.settings.display_next_and_prev) {
this.initNextAndPrev();
};
// The slideshow needs a callback to trigger the next image to be shown
// but we don't want to give it access to the whole gallery instance
var nextimage_callback = function(callback) {
return context.nextImage(callback);
};
this.slideshow = new AdGallerySlideshow(nextimage_callback, this.settings.slideshow);
this.controls.append(this.slideshow.create());
if(this.settings.slideshow.enable) {
this.slideshow.enable();
} else {
this.slideshow.disable();
};
if(this.settings.display_back_and_forward) {
this.initBackAndForward();
};
if(this.settings.enable_keyboard_move) {
this.initKeyEvents();
};
var start_at = parseInt(this.settings.start_at_index, 10);
if(window.location.hash && window.location.hash.indexOf('#ad-image') === 0) {
start_at = window.location.hash.replace(/[^0-9]+/g, '');
// Check if it's a number
if((start_at * 1) != start_at) {
start_at = this.settings.start_at_index;
};
};
this.loading(true);
this.showImage(start_at,
function() {
// We don't want to start the slideshow before the image has been
// displayed
if(context.settings.slideshow.autostart) {
context.preloadImage(start_at + 1);
context.slideshow.start();
};
}
);
this.fireCallback(this.settings.callbacks.init);
},
setupAnimations: function() {
this.animations = {
'slide-vert': VerticalSlideAnimation,
'slide-hori': HorizontalSlideAnimation,
'resize': ResizeAnimation,
'fade': FadeAnimation,
'none': NoneAnimation
};
},
setupElements: function() {
this.controls = this.wrapper.find('.ad-controls');
this.gallery_info = $('<p class="ad-info"></p>');
this.controls.append(this.gallery_info);
this.image_wrapper = this.wrapper.find('.ad-image-wrapper');
this.image_wrapper.empty();
this.nav = this.wrapper.find('.ad-nav');
this.thumbs_wrapper = this.nav.find('.ad-thumbs');
this.preloads = $('<div class="ad-preloads"></div>');
this.loader = $('<img class="ad-loader" src="'+ this.settings.loader_image +'">');
this.image_wrapper.append(this.loader);
this.loader.hide();
$(document.body).append(this.preloads);
},
loading: function(bool) {
if(bool) {
this.loader.show();
} else {
this.loader.hide();
};
},
addAnimation: function(name, fn) {
if($.isFunction(fn)) {
this.animations[name] = fn;
};
},
findImages: function() {
var context = this;
this.images = [];
var thumb_wrapper_width = 0;
var thumbs_loaded = 0;
var thumbs = this.thumbs_wrapper.find('a');
var thumb_count = thumbs.length;
if(this.settings.thumb_opacity < 1) {
thumbs.find('img').css('opacity', this.settings.thumb_opacity);
};
thumbs.each(
function(i) {
var link = $(this);
var image_src = link.attr('href');
var thumb = link.find('img');
// Check if the thumb has already loaded
if(!context.isImageLoaded(thumb[0])) {
thumb.load(
function() {
thumb_wrapper_width += this.parentNode.parentNode.offsetWidth;
thumbs_loaded++;
}
);
} else{
thumb_wrapper_width += thumb[0].parentNode.parentNode.offsetWidth;
thumbs_loaded++;
};
link.addClass('ad-thumb'+ i);
link.click(
function() {
context.showImage(i);
context.slideshow.stop();
return false;
}
).hover(
function() {
if(!$(this).is('.ad-active') && context.settings.thumb_opacity < 1) {
$(this).find('img').fadeTo(300, 1);
};
context.preloadImage(i);
},
function() {
if(!$(this).is('.ad-active') && context.settings.thumb_opacity < 1) {
$(this).find('img').fadeTo(300, context.settings.thumb_opacity);
};
}
);
var link = false;
if(thumb.data('ad-link')) {
link = thumb.data('ad-link');
} else if(thumb.attr('longdesc') && thumb.attr('longdesc').length) {
link = thumb.attr('longdesc');
};
var desc = false;
if(thumb.data('ad-desc')) {
desc = thumb.data('ad-desc');
} else if(thumb.attr('alt') && thumb.attr('alt').length) {
desc = thumb.attr('alt');
};
var title = false;
if(thumb.data('ad-title')) {
title = thumb.data('ad-title');
} else if(thumb.attr('title') && thumb.attr('title').length) {
title = thumb.attr('title');
};
context.images[i] = { thumb: thumb.attr('src'), image: image_src, error: false,
preloaded: false, desc: desc, title: title, size: false,
link: link };
}
);
// Wait until all thumbs are loaded, and then set the width of the ul
var inter = setInterval(
function() {
if(thumb_count == thumbs_loaded) {
thumb_wrapper_width -= 100;
var list = context.nav.find('.ad-thumb-list'),
list_num = list.children().length,
list_width = list.children().eq(0).width();
list.css('width', (list_width+5)*list_num +'px');
clearInterval(inter);
};
},
100
);
},
initKeyEvents: function() {
var context = this;
$(document).keydown(
function(e) {
if(e.keyCode == 39) {
// right arrow
context.nextImage();
context.slideshow.stop();
} else if(e.keyCode == 37) {
// left arrow
context.prevImage();
context.slideshow.stop();
};
}
);
},
initNextAndPrev: function() {
this.next_link = $('<div class="ad-next"><div class="ad-next-image"></div></div>');
this.prev_link = $('<div class="ad-prev"><div class="ad-prev-image"></div></div>');
this.image_wrapper.append(this.next_link);
this.image_wrapper.append(this.prev_link);
var context = this;
this.prev_link.add(this.next_link).mouseover(
function(e) {
// IE 6 hides the wrapper div, so we have to set it's width
$(this).css('height', context.image_wrapper_height);
$(this).find('div').show();
}
).mouseout(
function(e) {
$(this).find('div').hide();
}
).click(
function() {
if($(this).is('.ad-next')) {
context.nextImage();
context.slideshow.stop();
} else {
context.prevImage();
context.slideshow.stop();
};
}
).find('div').css('opacity', 0.7);
},
initBackAndForward: function() {
var context = this;
this.scroll_forward = $('<div class="ad-forward"></div>');
this.scroll_back = $('<div class="ad-back"></div>');
this.nav.append(this.scroll_forward);
this.nav.prepend(this.scroll_back);
var has_scrolled = 0;
var thumbs_scroll_interval = false;
$(this.scroll_back).add(this.scroll_forward).click(
function() {
// We don't want to jump the whole width, since an image
// might be cut at the edge
var width = context.nav_display_width - 50;
if(context.settings.scroll_jump > 0) {
var width = context.settings.scroll_jump;
};
if($(this).is('.ad-forward')) {
var left = context.thumbs_wrapper.scrollLeft() + width;
} else {
var left = context.thumbs_wrapper.scrollLeft() - width;
};
if(context.settings.slideshow.stop_on_scroll) {
context.slideshow.stop();
};
context.thumbs_wrapper.animate({scrollLeft: left +'px'});
return false;
}
).css('opacity', 0.6).hover(
function() {
var direction = 'left';
if($(this).is('.ad-forward')) {
direction = 'right';
};
thumbs_scroll_interval = setInterval(
function() {
has_scrolled++;
// Don't want to stop the slideshow just because we scrolled a pixel or two
if(has_scrolled > 30 && context.settings.slideshow.stop_on_scroll) {
context.slideshow.stop();
};
var left = context.thumbs_wrapper.scrollLeft() + 1;
if(direction == 'left') {
left = context.thumbs_wrapper.scrollLeft() - 1;
};
context.thumbs_wrapper.scrollLeft(left);
},
10
);
$(this).css('opacity', 1);
},
function() {
has_scrolled = 0;
clearInterval(thumbs_scroll_interval);
$(this).css('opacity', 0.6);
}
);
},
_afterShow: function() {
this.gallery_info.html((this.current_index + 1) +' / '+ this.images.length);
if(!this.settings.cycle) {
// Needed for IE
this.prev_link.show().css('height', this.image_wrapper_height);
this.next_link.show().css('height', this.image_wrapper_height);
if(this.current_index == (this.images.length - 1)) {
this.next_link.hide();
};
if(this.current_index == 0) {
this.prev_link.hide();
};
};
this.fireCallback(this.settings.callbacks.afterImageVisible);
},
/**
* Checks if the image is small enough to fit inside the container
* If it's not, shrink it proportionally
*/
_getContainedImageSize: function(image_width, image_height) {
if(image_height > this.image_wrapper_height) {
var ratio = image_width / image_height;
image_height = this.image_wrapper_height;
image_width = this.image_wrapper_height * ratio;
};
if(image_width > this.image_wrapper_width) {
var ratio = image_height / image_width;
image_width = this.image_wrapper_width;
image_height = this.image_wrapper_width * ratio;
};
return {width: image_width, height: image_height};
},
/**
* If the image dimensions are smaller than the wrapper, we position
* it in the middle anyway
*/
_centerImage: function(img_container, image_width, image_height) {
img_container.css('top', '0px');
if(image_height < this.image_wrapper_height) {
var dif = this.image_wrapper_height - image_height;
img_container.css('top', (dif / 2) +'px');
};
img_container.css('left', '0px');
if(image_width < this.image_wrapper_width) {
var dif = this.image_wrapper_width - image_width;
img_container.css('left', (dif / 2) +'px');
};
},
_getDescription: function(image) {
var desc = false;
if(image.desc.length || image.title.length) {
var title = '';
if(image.title.length) {
title = '<strong class="ad-description-title">'+ image.title +'</strong>';
};
var desc = '';
if(image.desc.length) {
desc = '<span>'+ image.desc +'</span>';
};
desc = $('<p class="ad-image-description">'+ title + desc +'</p>');
};
return desc;
},
/**
* @param function callback Gets fired when the image has loaded, is displaying
* and it's animation has finished
*/
showImage: function(index, callback) {
if(this.images[index] && !this.in_transition) {
var context = this;
var image = this.images[index];
this.in_transition = true;
if(!image.preloaded) {
this.loading(true);
this.preloadImage(index, function() {
context.loading(false);
context._showWhenLoaded(index, callback);
});
} else {
this._showWhenLoaded(index, callback);
};
};
},
/**
* @param function callback Gets fired when the image has loaded, is displaying
* and it's animation has finished
*/
_showWhenLoaded: function(index, callback) {
if(this.images[index]) {
var context = this;
var image = this.images[index];
var img_container = $(document.createElement('div')).addClass('ad-image');
var img = $(new Image()).attr('src', image.image);
if(image.link) {
var link = $('<a href="'+ image.link +'" target="_blank"></a>');
link.append(img);
img_container.append(link);
} else {
img_container.append(img);
}
this.image_wrapper.prepend(img_container);
var size = this._getContainedImageSize(image.size.width, image.size.height);
img.attr('width', size.width);
img.attr('height', size.height);
img_container.css({width: size.width +'px', height: size.height +'px'});
this._centerImage(img_container, size.width, size.height);
var desc = this._getDescription(image, img_container);
if(desc) {
if(!this.settings.description_wrapper) {
img_container.append(desc);
var width = size.width - parseInt(desc.css('padding-left'), 10) - parseInt(desc.css('padding-right'), 10);
desc.css('width', width +'px');
} else {
this.settings.description_wrapper.append(desc);
}
};
this.highLightThumb(this.nav.find('.ad-thumb'+ index));
var direction = 'right';
if(this.current_index < index) {
direction = 'left';
};
this.fireCallback(this.settings.callbacks.beforeImageVisible);
if(this.current_image || this.settings.animate_first_image) {
var animation_speed = this.settings.animation_speed;
var easing = 'swing';
var animation = this.animations[this.settings.effect].call(this, img_container, direction, desc);
if(typeof animation.speed != 'undefined') {
animation_speed = animation.speed;
};
if(typeof animation.easing != 'undefined') {
easing = animation.easing;
};
if(this.current_image) {
var old_image = this.current_image;
var old_description = this.current_description;
old_image.animate(animation.old_image, animation_speed, easing,
function() {
old_image.remove();
if(old_description) old_description.remove();
}
);
};
img_container.animate(animation.new_image, animation_speed, easing,
function() {
context.current_index = index;
context.current_image = img_container;
context.current_description = desc;
context.in_transition = false;
context._afterShow();
context.fireCallback(callback);
}
);
} else {
this.current_index = index;
this.current_image = img_container;
context.current_description = desc;
this.in_transition = false;
context._afterShow();
this.fireCallback(callback);
};
};
},
nextIndex: function() {
if(this.current_index == (this.images.length - 1)) {
if(!this.settings.cycle) {
return false;
};
var next = 0;
} else {
var next = this.current_index + 1;
};
return next;
},
nextImage: function(callback) {
var next = this.nextIndex();
if(next === false) return false;
this.preloadImage(next + 1);
this.showImage(next, callback);
return true;
},
prevIndex: function() {
if(this.current_index == 0) {
if(!this.settings.cycle) {
return false;
};
var prev = this.images.length - 1;
} else {
var prev = this.current_index - 1;
};
return prev;
},
prevImage: function(callback) {
var prev = this.prevIndex();
if(prev === false) return false;
this.preloadImage(prev - 1);
this.showImage(prev, callback);
return true;
},
preloadAll: function() {
var context = this;
var i = 0;
function preloadNext() {
if(i < context.images.length) {
i++;
context.preloadImage(i, preloadNext);
};
};
context.preloadImage(i, preloadNext);
},
preloadImage: function(index, callback) {
if(this.images[index]) {
var image = this.images[index];
if(!this.images[index].preloaded) {
var img = $(new Image());
img.attr('src', image.image);
if(!this.isImageLoaded(img[0])) {
this.preloads.append(img);
var context = this;
img.load(
function() {
image.preloaded = true;
image.size = { width: this.width, height: this.height };
context.fireCallback(callback);
}
).error(
function() {
image.error = true;
image.preloaded = false;
image.size = false;
}
);
} else {
image.preloaded = true;
image.size = { width: img[0].width, height: img[0].height };
this.fireCallback(callback);
};
} else {
this.fireCallback(callback);
};
};
},
isImageLoaded: function(img) {
if(typeof img.complete != 'undefined' && !img.complete) {
return false;
};
if(typeof img.naturalWidth != 'undefined' && img.naturalWidth == 0) {
return false;
};
return true;
},
highLightThumb: function(thumb) {
this.thumbs_wrapper.find('.ad-active').removeClass('ad-active');
thumb.addClass('ad-active');
if(this.settings.thumb_opacity < 1) {
this.thumbs_wrapper.find('a:not(.ad-active) img').fadeTo(300, this.settings.thumb_opacity);
thumb.find('img').fadeTo(300, 1);
};
var left = thumb[0].parentNode.offsetLeft;
left -= (this.nav_display_width / 2) - (thumb[0].offsetWidth / 2);
this.thumbs_wrapper.animate({scrollLeft: left +'px'});
},
fireCallback: function(fn) {
if($.isFunction(fn)) {
fn.call(this);
};
}
};
function AdGallerySlideshow(nextimage_callback, settings) {
this.init(nextimage_callback, settings);
};
AdGallerySlideshow.prototype = {
start_link: false,
stop_link: false,
countdown: false,
controls: false,
settings: false,
nextimage_callback: false,
enabled: false,
running: false,
countdown_interval: false,
init: function(nextimage_callback, settings) {
var context = this;
this.nextimage_callback = nextimage_callback;
this.settings = settings;
},
create: function() {
this.start_link = $('<span class="ad-slideshow-start">'+ this.settings.start_label +'</span>');
this.stop_link = $('<span class="ad-slideshow-stop">'+ this.settings.stop_label +'</span>');
this.countdown = $('<span class="ad-slideshow-countdown"></span>');
this.controls = $('<div class="ad-slideshow-controls"></div>');
this.controls.append(this.start_link).append(this.stop_link).append(this.countdown);
this.countdown.hide();
var context = this;
this.start_link.click(
function() {
context.start();
}
);
this.stop_link.click(
function() {
context.stop();
}
);
$(document).keydown(
function(e) {
if(e.keyCode == 83) {
// 's'
if(context.running) {
context.stop();
} else {
context.start();
};
};
}
);
return this.controls;
},
disable: function() {
this.enabled = false;
this.stop();
this.controls.hide();
},
enable: function() {
this.enabled = true;
this.controls.show();
},
toggle: function() {
if(this.enabled) {
this.disable();
} else {
this.enable();
};
},
start: function() {
if(this.running || !this.enabled) return false;
var context = this;
this.running = true;
this.controls.addClass('ad-slideshow-running');
this._next();
this.fireCallback(this.settings.onStart);
return true;
},
stop: function() {
if(!this.running) return false;
this.running = false;
this.countdown.hide();
this.controls.removeClass('ad-slideshow-running');
clearInterval(this.countdown_interval);
this.fireCallback(this.settings.onStop);
return true;
},
_next: function() {
var context = this;
var pre = this.settings.countdown_prefix;
var su = this.settings.countdown_sufix;
clearInterval(context.countdown_interval);
this.countdown.show().html(pre + (this.settings.speed / 1000) + su);
var slide_timer = 0;
this.countdown_interval = setInterval(
function() {
slide_timer += 1000;
if(slide_timer >= context.settings.speed) {
var whenNextIsShown = function() {
// A check so the user hasn't stoped the slideshow during the
// animation
if(context.running) {
context._next();
};
slide_timer = 0;
};
if(!context.nextimage_callback(whenNextIsShown)) {
context.stop();
};
slide_timer = 0;
};
var sec = parseInt(context.countdown.text().replace(/[^0-9]/g, ''), 10);
sec--;
if(sec > 0) {
context.countdown.html(pre + sec + su);
};
},
1000
);
},
fireCallback: function(fn) {
if($.isFunction(fn)) {
fn.call(this);
};
}
};
})(jQuery);
|
108wo
|
statics/js/jquery.ad-gallery.js
|
JavaScript
|
asf20
| 30,259
|
/**
* Styleswitch stylesheet switcher built on jQuery
* Under an Attribution, Share Alike License
* Download by http://www.codefans.net
* By Kelvin Luck ( http://www.kelvinluck.com/ )
**/
(function($)
{
$(document).ready(function() {
$('.styleswitch').click(function()
{
switchStylestyle(this.getAttribute("rel"));
return false;
});
var c = readCookie('style');
if (c) switchStylestyle(c);
});
function switchStylestyle(styleName)
{
var ifrm = $("#rightMain").contents();
$('link[@rel*=style][title]').each(function(i)
{
this.disabled = true;
if (this.getAttribute('title') == styleName) this.disabled = false;
});
ifrm.find('link[@rel*=style][title]').each(function(i)
{
this.disabled = true;
if (this.getAttribute('title') == styleName) this.disabled = false;
});
createCookie('style', styleName, 365);
}
})(jQuery);
// cookie functions http://www.quirksmode.org/js/cookies.html
function createCookie(name,value,days)
{
if (days)
{
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name)
{
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++)
{
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
function eraseCookie(name)
{
createCookie(name,"",-1);
}
// /cookie functions
|
108wo
|
statics/js/styleswitch.js
|
JavaScript
|
asf20
| 1,636
|
Array.prototype.in_array = function(e){
for(i=0;i<this.length && this[i]!=e;i++);
return !(i==this.length);
}
function remove_all(){
$("#checkbox :checkbox").attr("checked",false);
$("#relation_text").html("");
$.get(ajax_url, {m:'yp', c:'index', a:'pk', action:'remove', catid:catid, random:Math.random()});
$("#relation").val("");
c_sum();
};
$("#checkbox :checkbox").click(function (){
var q = $(this),
num = 4,
id = q.val(),
title = q.attr('title'),
img = q.attr('img'),
sid = 'v1'+id,
relation_ids = $('#relation').val(),
relation_ids = relation_ids.replace(/(^_*)|(_*$)/g, ""),
r_arr = relation_ids.split('-');
if($("#comparison").css("display")=="none"){
$("#comparison").fadeIn("slow");
}
if(q.attr("checked")==false){
$('#'+sid).remove();
$.get(ajax_url, {m:'yp', c:'index', a:'pk', action:'reduce', id:id, catid:catid, random:Math.random()});
if(relation_ids !='' ) {
var newrelation_ids = '';
$.each(r_arr, function(i, n){
if(n!=id) {
if(i==0) {
newrelation_ids = n;
} else {
newrelation_ids = newrelation_ids+'-'+n;
}
}
});
$('#relation').val(newrelation_ids);
}
c_sum();
}else{
if(r_arr.in_array(id)){
q.checked=false;
alert("抱歉,已经选择了该信息");
return false;
}
if(r_arr.length>=num){
q.checked=false;
alert("抱歉,您只能选择"+r_arr.length+"款商品对比");
return false;
}else{
$.get(ajax_url, {m:'yp', c:'index', a:'pk', action:'add', id:id, title:title, thumb:img, catid:catid, random:Math.random()});
var str = "<li style='display:none' id='"+sid+"'><img src="+img+" height='45'/><p>"+title+"</p><a href='javascript:;' class='close' onclick=\"remove_relation('"+sid+"',"+id+")\">X</a></li>";
$('#relation_text').append(str);
$("#"+sid).fadeIn("slow");
if(relation_ids =='' ){
$('#relation').val(id);
}else{
relation_ids = relation_ids+'-'+id;
$('#relation').val(relation_ids);
}
c_sum();
$('#'+sid+' img').LoadImage(true, 120, 60,'statics/images/s_nopic.gif');
}
}
});
function remove_relation(sid,id){
$('#'+sid).remove();
$.get(ajax_url, {m:'yp', c:'index', a:'pk', action:'reduce', id:id, catid:catid, random:Math.random()});
$("#c_"+id).attr("checked",false);
$("#c_h_"+id).attr("checked",false);
var relation_ids = $('#relation').val(),
r_arr = relation_ids.split('-'),
newrelation_ids = '';
if(relation_ids!=''){
$.each(r_arr, function(i, n){
if(n!=id) {
if(i==0) {
newrelation_ids = n;
} else {
newrelation_ids = newrelation_ids+'-'+n;
}
}
});
$('#relation').val(newrelation_ids);
}
c_sum();
return false;
}
function comp_btn() {
var relation_ids = $('#relation').val(),
_rel = relation_ids.replace(/(^_*)|(_*$)/g, "");
if($("#comp_num").text()>1){
//alert(_rel);
window.open(ajax_url+"?m=yp&c=index&a=pk&catid="+catid+"&modelid="+modelid+"&pk="+_rel);
}else{
alert("请选择2~4个需要对比的商品!");
}
};
function c_sum(){
var relation_ids = $('#relation').val(),
relation_ids = relation_ids.replace(/(^_*)|(_*$)/g, ""),
r_arr = relation_ids.split('-');
if(relation_ids){
$("#comp_num").text(r_arr.length);
}else{
$("#comp_num").text('0');
}
}
//浮动
(function($) {
$.fn.extend({
"followDiv": function(str) {
var _self = this,
_h = _self.height() ;
var pos;
switch (str) {
case "right":
pos = { "right": "0px", "top": "27px" };
break;
}
topIE6 = parseInt(pos.top) + $(window).scrollTop();
_self.animate({'top':topIE6},500);
/*FF和IE7可以通过position:fixed来定位,*/
//_self.css({ "position": "fixed", "z-index": "9999" }).css(pos);
/*ie6需要动态设置距顶端高度top.*/
// if ($.browser.msie && $.browser.version == 6) {
//_self.css('position', 'absolute');
$(window).scroll(function() {
topIE6 = parseInt(pos.top) + $(window).scrollTop();
//_self.css('top', topIE6);
$(_self).stop().animate({top:topIE6},300)
});
// }
return _self; //返回this,使方法可链。
}
});
})(jQuery);
$("body").append('<div id="comparison"><div class="title"><span id="comp_num">1</span>/4对比栏<a href="javascript:;" onclick="$(this).parent().parent().hide()" class="colse">X</a></div><input type="hidden" id="relation" value="" /><ul id="relation_text"></ul><center><a href="javascript:void(0);" onclick="comp_btn()" id="comp_btn">开始对比</a><br><a href="javascript:;" class="remove_all" onclick="remove_all();">清空对比栏</a></center></div>');
$("#comparison").followDiv("right");
|
108wo
|
statics/js/comparison.js
|
JavaScript
|
asf20
| 4,696
|
//Chrome Drop Down Menu- Author: Dynamic Drive (http://www.dynamicdrive.com)
//Last updated: June 14th, 06'
var cssdropdown={
disappeardelay: 250, //set delay in miliseconds before menu disappears onmouseout
disablemenuclick: false, //when user clicks on a menu item with a drop down menu, disable menu item's link?
enableswipe: 1, //enable swipe effect? 1 for yes, 0 for no
//No need to edit beyond here////////////////////////
dropmenuobj: null, ie: document.all, firefox: document.getElementById&&!document.all, swipetimer: undefined, bottomclip:0,
getposOffset:function(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
},
swipeeffect:function(){
if (this.bottomclip<parseInt(this.dropmenuobj.offsetHeight)){
this.bottomclip+=10+(this.bottomclip/10) //unclip drop down menu visibility gradually
this.dropmenuobj.style.clip="rect(0 auto "+this.bottomclip+"px 0)"
}
else
return
this.swipetimer=setTimeout("cssdropdown.swipeeffect()", 10)
},
showhide:function(obj, e){
if (this.ie || this.firefox)
this.dropmenuobj.style.left=this.dropmenuobj.style.top="-500px"
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover"){
if (this.enableswipe==1){
if (typeof this.swipetimer!="undefined")
clearTimeout(this.swipetimer)
obj.clip="rect(0 auto 0 0)" //hide menu via clipping
this.bottomclip=0
this.swipeeffect()
}
obj.visibility="visible"
}
else if (e.type=="click")
obj.visibility="hidden"
},
iecompattest:function(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
},
clearbrowseredge:function(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=this.ie && !window.opera? this.iecompattest().scrollLeft+this.iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetWidth
if (windowedge-this.dropmenuobj.x < this.dropmenuobj.contentmeasure) //move menu to the left?
edgeoffset=this.dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=this.ie && !window.opera? this.iecompattest().scrollTop : window.pageYOffset
var windowedge=this.ie && !window.opera? this.iecompattest().scrollTop+this.iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetHeight
if (windowedge-this.dropmenuobj.y < this.dropmenuobj.contentmeasure){ //move up?
edgeoffset=this.dropmenuobj.contentmeasure+obj.offsetHeight
if ((this.dropmenuobj.y-topedge)<this.dropmenuobj.contentmeasure) //up no good either?
edgeoffset=this.dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
},
dropit:function(obj, e, dropmenuID){
if (this.dropmenuobj!=null) //hide previous menu
this.dropmenuobj.style.visibility="hidden" //hide menu
this.clearhidemenu()
if (this.ie||this.firefox){
obj.onmouseout=function(){cssdropdown.delayhidemenu()}
obj.onclick=function(){return !cssdropdown.disablemenuclick} //disable main menu item link onclick?
this.dropmenuobj=document.getElementById(dropmenuID)
this.dropmenuobj.onmouseover=function(){cssdropdown.clearhidemenu()}
this.dropmenuobj.onmouseout=function(){cssdropdown.dynamichide(e)}
this.dropmenuobj.onclick=function(){cssdropdown.delayhidemenu()}
this.showhide(this.dropmenuobj.style, e)
this.dropmenuobj.x=this.getposOffset(obj, "left")
this.dropmenuobj.y=this.getposOffset(obj, "top")
this.dropmenuobj.style.left=this.dropmenuobj.x-this.clearbrowseredge(obj, "rightedge")+obj.offsetWidth+0+"px"
this.dropmenuobj.style.top=this.dropmenuobj.y-this.clearbrowseredge(obj, "bottomedge")+obj.offsetHeight-42+"px"
}
},
contains_firefox:function(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
},
dynamichide:function(e){
var evtobj=window.event? window.event : e
if (this.ie&&!this.dropmenuobj.contains(evtobj.toElement))
this.delayhidemenu()
else if (this.firefox&&e.currentTarget!= evtobj.relatedTarget&& !this.contains_firefox(evtobj.currentTarget, evtobj.relatedTarget))
this.delayhidemenu()
},
delayhidemenu:function(){
this.delayhide=setTimeout("cssdropdown.dropmenuobj.style.visibility='hidden'",this.disappeardelay) //hide menu
},
clearhidemenu:function(){
if (this.delayhide!="undefined")
clearTimeout(this.delayhide)
},
startchrome:function(){
for (var ids=0; ids<arguments.length; ids++){
var menuitems=document.getElementById(arguments[ids]).getElementsByTagName("a")
for (var i=0; i<menuitems.length; i++){
if (menuitems[i].getAttribute("rel") && $(menuitems[i]).attr('rel') == 'dropmenu1'){
var relvalue=menuitems[i].getAttribute("rel")
menuitems[i].onmouseover=function(e){
var event=typeof e!="undefined"? e : window.event
cssdropdown.dropit(this,event,this.getAttribute("rel"))
}
}
}
}
}
}
|
108wo
|
statics/js/108wo/dropmenu.js
|
JavaScript
|
asf20
| 5,095
|
$(function() {
//IE6 PNG透明
$(document).pngFix();
if($('.listView').length > 0 || $('.price').length > 0 ){
cssdropdown.startchrome("main");
};
//Footer
$('#footer').height($('body').height()-$('#wrapper').height()-31);
//返回页面顶部按纽跟随
$('#goTop').click(function(){
$('html,body').animate({scrollTop: '0px'}, 600);
return false;
});
//picList
$('.picList .listCo ul li a.image').each(function(){
$(this).css('background','url('+$(this).attr('rev')+') no-repeat');
})
$('a.single_image').fancybox({'titleShow':true});
if($('.picList').length > 0){
$("a[rel=photoGroup]").fancybox({
'transitionIn' : 'none',
'transitionOut' : 'none',
'titlePosition' : 'inside',
'titleFormat' : function(title, currentArray, currentIndex, currentOpts) {
return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' ' + title : '') + '</span>';
}
});
$("a[rel=photoGroup]").hover(function(){
$(this).parent().find("a.btn").fadeIn("fast");
});
$("a[rel=photoGroup]").parent().hover(function(){
},function(){
$(this).find("a.btn").fadeOut("fast");
})
};
if($('.listView').length > 0){
$(".subMenu .btn").fancybox({
'width' : 430,
'height' : 260,
'autoScale' : false,
'transitionIn' : 'none',
'transitionOut' : 'none',
'type' : 'iframe'
});
$("a[rel=photoGroup]").fancybox({
'transitionIn' : 'none',
'transitionOut' : 'none',
'titlePosition' : 'inside',
'titleFormat' : function(title, currentArray, currentIndex, currentOpts) {
return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' ' + title : '') + '</span>';
}
});
};
if($('.product').length > 0){
$("a[rel=photoGroup]").fancybox({
'transitionIn' : 'none',
'transitionOut' : 'none',
'titlePosition' : 'inside',
'titleFormat' : function(title, currentArray, currentIndex, currentOpts) {
return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' ' + title : '') + '</span>';
}
});
};
if($('.price').length > 0){
$("a[rel=photoGroup]").fancybox({
'transitionIn' : 'none',
'transitionOut' : 'none',
'titlePosition' : 'inside',
'titleFormat' : function(title, currentArray, currentIndex, currentOpts) {
return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' ' + title : '') + '</span>';
}
});
};
if($('.createBtn').length > 0){
$(".createBtn").fancybox({
'width' : 430,
'height' : 260,
'autoScale' : false,
'transitionIn' : 'none',
'transitionOut' : 'none',
'type' : 'iframe'
});
}
if($('.batchupload').length > 0){
$(".batchupload").fancybox({
'width' : 500,
'height' : 450,
'autoScale' : false,
'transitionIn' : 'none',
'transitionOut' : 'none',
'type' : 'iframe'
});
}
//tab选项卡
$("a.tabs").click(function () {
$(this).parent().find("a.current").removeClass("current");
$(this).addClass("current");
$("#"+$(this).siblings().attr("rel")).hide();
//$(this).parent().parent().find(".tabsCo").hide();
var content_show = $(this).attr("rel");
$("#"+content_show).show();
return false;
});
$(".cate div h3").click(function(){
if($(this).next("ul").css("display")=="none"){
$(this).next("ul").css("display","inline");
$(this).next("br").css("display","block");
}else{
$(this).next("ul").css("display","none");
$(this).next("br").css("display","none");
}
})
//更改首选清单
$('#orderList input:checkbox').live('click', function() {
$('#orderList input:checkbox').attr("checked", false);
$.getJSON('index.php?m=order&c=index&a=setSelected', {id:$(this).val()});
$(this).attr("checked", true);
});
})
//点评
function dianping(elem, a, id, modelid) {
var _font = $(elem).next("."+a);
$.getJSON('index.php?m=content&c=index&a=ajax_update', {t:a, modelid:modelid, id:id});
_font.html(parseInt(_font.html())+1);
}
//添加到清单
function addOrder(id) {
$.getJSON('index.php?m=order&c=order_detail&a=add', {productid:id, ajax:1}, function(data){
if(data.code == true) {
$('#msgBox').html("<div class='suc'>"+data.msg+"</div>");
$('#msgBox').fadeIn("fast");
setTimeout(function(){$("#msgBox").fadeOut("fast");},800);
} else {
$('#msgBox').html("<div class='err'>"+data.msg+"</div>");
$('#msgBox').fadeIn("fast");
setTimeout(function(){$("#msgBox").fadeOut("fast");},3000);
}
//alert(data.msg);
});
}
|
108wo
|
statics/js/108wo/int.js
|
JavaScript
|
asf20
| 4,903
|
/*
* Easy Slider 1.5 - jQuery plugin
* written by Alen Grakalic
* http://cssglobe.com/post/4004/easy-slider-15-the-easiest-jquery-plugin-for-sliding
*
* Copyright (c) 2009 Alen Grakalic (http://cssglobe.com)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* Built for jQuery library
* http://jquery.com
*
*/
/*
* markup example for $("#slider").easySlider();
*
* <div id="slider">
* <ul>
* <li><img src="images/01.jpg" alt="" /></li>
* <li><img src="images/02.jpg" alt="" /></li>
* <li><img src="images/03.jpg" alt="" /></li>
* <li><img src="images/04.jpg" alt="" /></li>
* <li><img src="images/05.jpg" alt="" /></li>
* </ul>
* </div>
*
*/
(function($) {
$.fn.easySlider = function(options){
// default configuration properties
var defaults = {
prevId: 'prevBtn',
num: 'num',
prevText: 'Previous',
nextId: 'nextBtn',
nextText: 'Next',
controlsShow: true,
controlsBefore: '',
controlsAfter: '',
controlsFade: true,
firstId: 'firstBtn',
firstText: 'First',
firstShow: false,
lastId: 'lastBtn',
lastText: 'Last',
lastShow: false,
vertical: false,
speed: 800,
auto: false,
pause: 2000,
continuous: false
};
var options = $.extend(defaults, options);
this.each(function() {
var obj = $(this);
var s = $("li", obj).length;
var w = $("li", obj).width();
var h = $("li", obj).height();
obj.width(w);
obj.height(h);
obj.css("overflow","hidden");
var ts = s-1;
var t = 0;
$("ul", obj).css('width',s*w);
if(!options.vertical) $("li", obj).css('float','left');
if(options.controlsShow){
var html = options.controlsBefore;
if(options.firstShow) html += '<span id="'+ options.firstId +'"><a href=\"javascript:void(0);\">'+ options.firstText +'</a></span>';
html += ' <span id="'+ options.prevId +'"><a href=\"javascript:void(0);\">'+ options.prevText +'</a></span>';
html += ' <span id="'+ options.num +'">'+(t+1)+' / '+(ts+1)+'</span>';
html += ' <span id="'+ options.nextId +'"><a href=\"javascript:void(0);\">'+ options.nextText +'</a></span>';
if(options.lastShow) html += ' <span id="'+ options.lastId +'"><a href=\"javascript:void(0);\">'+ options.lastText +'</a></span>';
html += options.controlsAfter;
$(obj).after(html);
};
$("a","#"+options.nextId).click(function(){
animate("next",true);
});
$("a","#"+options.prevId).click(function(){
animate("prev",true);
});
$("a","#"+options.firstId).click(function(){
animate("first",true);
});
$("a","#"+options.lastId).click(function(){
animate("last",true);
});
function animate(dir,clicked){
var ot = t;
switch(dir){
case "next":
t = (ot>=ts) ? (options.continuous ? 0 : ts) : t+1;
break;
case "prev":
t = (t<=0) ? (options.continuous ? ts : 0) : t-1;
break;
case "first":
t = 0;
break;
case "last":
t = ts;
break;
default:
break;
};
$("#num").html(""+(t+1)+" / "+(ts+1));
var diff = Math.abs(ot-t);
var speed = diff*options.speed;
if(!options.vertical) {
p = (t*w*-1);
$("ul",obj).animate(
{ marginLeft: p },
speed
);
} else {
p = (t*h*-1);
$("ul",obj).animate(
{ marginTop: p },
speed
);
};
if(!options.continuous && options.controlsFade){
if(t==ts){
$("a","#"+options.nextId).hide();
$("a","#"+options.lastId).hide();
} else {
$("a","#"+options.nextId).show();
$("a","#"+options.lastId).show();
};
if(t==0){
$("a","#"+options.prevId).hide();
$("a","#"+options.firstId).hide();
} else {
$("a","#"+options.prevId).show();
$("a","#"+options.firstId).show();
};
};
if(clicked) clearTimeout(timeout);
if(options.auto && dir=="next" && !clicked){;
timeout = setTimeout(function(){
animate("next",false);
},diff*options.speed+options.pause);
};
};
// init
var timeout;
if(options.auto){;
timeout = setTimeout(function(){
animate("next",false);
},options.pause);
};
if(!options.continuous && options.controlsFade){
$("a","#"+options.prevId).hide();
$("a","#"+options.firstId).hide();
};
});
};
})(jQuery);
|
108wo
|
statics/js/108wo/easySlider.js
|
JavaScript
|
asf20
| 4,738
|
/**
* --------------------------------------------------------------------
* jQuery-Plugin "pngFix"
* Version: 1.2, 09.03.2009
* by Andreas Eberhard, andreas.eberhard@gmail.com
* http://jquery.andreaseberhard.de/
*
* Copyright (c) 2007 Andreas Eberhard
* Licensed under GPL (http://www.opensource.org/licenses/gpl-license.php)
*
* Changelog:
* 09.03.2009 Version 1.2
* - Update for jQuery 1.3.x, removed @ from selectors
* 11.09.2007 Version 1.1
* - removed noConflict
* - added png-support for input type=image
* - 01.08.2007 CSS background-image support extension added by Scott Jehl, scott@filamentgroup.com, http://www.filamentgroup.com
* 31.05.2007 initial Version 1.0
* --------------------------------------------------------------------
* @example $(function(){$(document).pngFix();});
* @desc Fixes all PNG's in the document on document.ready
*
* jQuery(function(){jQuery(document).pngFix();});
* @desc Fixes all PNG's in the document on document.ready when using noConflict
*
* @example $(function(){$('div.examples').pngFix();});
* @desc Fixes all PNG's within div with class examples
*
* @example $(function(){$('div.examples').pngFix( { blankgif:'ext.gif' } );});
* @desc Fixes all PNG's within div with class examples, provides blank gif for input with png
* --------------------------------------------------------------------
*/
(function($) {
jQuery.fn.pngFix = function(settings) {
// Settings
settings = jQuery.extend({
blankgif: 'blank.gif'
}, settings);
var ie55 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 5.5") != -1);
var ie6 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 6.0") != -1);
if (jQuery.browser.msie && (ie55 || ie6)) {
//fix images with png-source
jQuery(this).find("img[src$=.png]").each(function() {
jQuery(this).attr('width',jQuery(this).width());
jQuery(this).attr('height',jQuery(this).height());
var prevStyle = '';
var strNewHTML = '';
var imgId = (jQuery(this).attr('id')) ? 'id="' + jQuery(this).attr('id') + '" ' : '';
var imgClass = (jQuery(this).attr('class')) ? 'class="' + jQuery(this).attr('class') + '" ' : '';
var imgTitle = (jQuery(this).attr('title')) ? 'title="' + jQuery(this).attr('title') + '" ' : '';
var imgAlt = (jQuery(this).attr('alt')) ? 'alt="' + jQuery(this).attr('alt') + '" ' : '';
var imgAlign = (jQuery(this).attr('align')) ? 'float:' + jQuery(this).attr('align') + ';' : '';
var imgHand = (jQuery(this).parent().attr('href')) ? 'cursor:hand;' : '';
if (this.style.border) {
prevStyle += 'border:'+this.style.border+';';
this.style.border = '';
}
if (this.style.padding) {
prevStyle += 'padding:'+this.style.padding+';';
this.style.padding = '';
}
if (this.style.margin) {
prevStyle += 'margin:'+this.style.margin+';';
this.style.margin = '';
}
var imgStyle = (this.style.cssText);
strNewHTML += '<span '+imgId+imgClass+imgTitle+imgAlt;
strNewHTML += 'style="position:relative;white-space:pre-line;display:inline-block;background:transparent;'+imgAlign+imgHand;
strNewHTML += 'width:' + jQuery(this).width() + 'px;' + 'height:' + jQuery(this).height() + 'px;';
strNewHTML += 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader' + '(src=\'' + jQuery(this).attr('src') + '\', sizingMethod=\'scale\');';
strNewHTML += imgStyle+'"></span>';
if (prevStyle != ''){
strNewHTML = '<span style="position:relative;display:inline-block;'+prevStyle+imgHand+'width:' + jQuery(this).width() + 'px;' + 'height:' + jQuery(this).height() + 'px;'+'">' + strNewHTML + '</span>';
}
jQuery(this).hide();
jQuery(this).after(strNewHTML);
});
// fix css background pngs
jQuery(this).find("*").each(function(){
var bgIMG = jQuery(this).css('background-image');
if(bgIMG.indexOf(".png")!=-1){
var iebg = bgIMG.split('url("')[1].split('")')[0];
jQuery(this).css('background-image', 'none');
jQuery(this).get(0).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + iebg + "',sizingMethod='scale')";
}
});
//fix input with png-source
jQuery(this).find("input[src$=.png]").each(function() {
var bgIMG = jQuery(this).attr('src');
jQuery(this).get(0).runtimeStyle.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader' + '(src=\'' + bgIMG + '\', sizingMethod=\'scale\');';
jQuery(this).attr('src', settings.blankgif)
});
}
return jQuery;
};
})(jQuery);
|
108wo
|
statics/js/108wo/jquery.pngFix.js
|
JavaScript
|
asf20
| 4,780
|
// Simple Set Clipboard System
// Author: Joseph Huckaby
var ZeroClipboard = {
version: "1.0.7",
clients: {}, // registered upload clients on page, indexed by id
moviePath: 'ZeroClipboard.swf', // URL to movie
nextId: 1, // ID of next movie
$: function(thingy) {
// simple DOM lookup utility function
if (typeof(thingy) == 'string') thingy = document.getElementById(thingy);
if (!thingy.addClass) {
// extend element with a few useful methods
thingy.hide = function() { this.style.display = 'none'; };
thingy.show = function() { this.style.display = ''; };
thingy.addClass = function(name) { this.removeClass(name); this.className += ' ' + name; };
thingy.removeClass = function(name) {
var classes = this.className.split(/\s+/);
var idx = -1;
for (var k = 0; k < classes.length; k++) {
if (classes[k] == name) { idx = k; k = classes.length; }
}
if (idx > -1) {
classes.splice( idx, 1 );
this.className = classes.join(' ');
}
return this;
};
thingy.hasClass = function(name) {
return !!this.className.match( new RegExp("\\s*" + name + "\\s*") );
};
}
return thingy;
},
setMoviePath: function(path) {
// set path to ZeroClipboard.swf
this.moviePath = path;
},
dispatch: function(id, eventName, args) {
// receive event from flash movie, send to client
var client = this.clients[id];
if (client) {
client.receiveEvent(eventName, args);
}
},
register: function(id, client) {
// register new client to receive events
this.clients[id] = client;
},
getDOMObjectPosition: function(obj, stopObj) {
// get absolute coordinates for dom element
var info = {
left: 0,
top: 0,
width: obj.width ? obj.width : obj.offsetWidth,
height: obj.height ? obj.height : obj.offsetHeight
};
while (obj && (obj != stopObj)) {
info.left += obj.offsetLeft;
info.top += obj.offsetTop;
obj = obj.offsetParent;
}
return info;
},
Client: function(elem) {
// constructor for new simple upload client
this.handlers = {};
// unique ID
this.id = ZeroClipboard.nextId++;
this.movieId = 'ZeroClipboardMovie_' + this.id;
// register client with singleton to receive flash events
ZeroClipboard.register(this.id, this);
// create movie
if (elem) this.glue(elem);
}
};
ZeroClipboard.Client.prototype = {
id: 0, // unique ID for us
ready: false, // whether movie is ready to receive events or not
movie: null, // reference to movie object
clipText: '', // text to copy to clipboard
handCursorEnabled: true, // whether to show hand cursor, or default pointer cursor
cssEffects: true, // enable CSS mouse effects on dom container
handlers: null, // user event handlers
glue: function(elem, appendElem, stylesToAdd) {
// glue to DOM element
// elem can be ID or actual DOM element object
this.domElement = ZeroClipboard.$(elem);
// float just above object, or zIndex 99 if dom element isn't set
var zIndex = 99;
if (this.domElement.style.zIndex) {
zIndex = parseInt(this.domElement.style.zIndex, 10) + 1;
}
if (typeof(appendElem) == 'string') {
appendElem = ZeroClipboard.$(appendElem);
}
else if (typeof(appendElem) == 'undefined') {
appendElem = document.getElementsByTagName('body')[0];
}
// find X/Y position of domElement
var box = ZeroClipboard.getDOMObjectPosition(this.domElement, appendElem);
// create floating DIV above element
this.div = document.createElement('div');
var style = this.div.style;
style.position = 'absolute';
style.left = '' + box.left + 'px';
style.top = '' + box.top + 'px';
style.width = '' + box.width + 'px';
style.height = '' + box.height + 'px';
style.zIndex = zIndex;
if (typeof(stylesToAdd) == 'object') {
for (addedStyle in stylesToAdd) {
style[addedStyle] = stylesToAdd[addedStyle];
}
}
// style.backgroundColor = '#f00'; // debug
appendElem.appendChild(this.div);
this.div.innerHTML = this.getHTML( box.width, box.height );
},
getHTML: function(width, height) {
// return HTML for movie
var html = '';
var flashvars = 'id=' + this.id +
'&width=' + width +
'&height=' + height;
if (navigator.userAgent.match(/MSIE/)) {
// IE gets an OBJECT tag
var protocol = location.href.match(/^https/i) ? 'https://' : 'http://';
html += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="'+protocol+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+width+'" height="'+height+'" id="'+this.movieId+'" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="'+ZeroClipboard.moviePath+'" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><param name="flashvars" value="'+flashvars+'"/><param name="wmode" value="transparent"/></object>';
}
else {
// all other browsers get an EMBED tag
html += '<embed id="'+this.movieId+'" src="'+ZeroClipboard.moviePath+'" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="'+width+'" height="'+height+'" name="'+this.movieId+'" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="'+flashvars+'" wmode="transparent" />';
}
return html;
},
hide: function() {
// temporarily hide floater offscreen
if (this.div) {
this.div.style.left = '-2000px';
}
},
show: function() {
// show ourselves after a call to hide()
this.reposition();
},
destroy: function() {
// destroy control and floater
if (this.domElement && this.div) {
this.hide();
this.div.innerHTML = '';
var body = document.getElementsByTagName('body')[0];
try { body.removeChild( this.div ); } catch(e) {;}
this.domElement = null;
this.div = null;
}
},
reposition: function(elem) {
// reposition our floating div, optionally to new container
// warning: container CANNOT change size, only position
if (elem) {
this.domElement = ZeroClipboard.$(elem);
if (!this.domElement) this.hide();
}
if (this.domElement && this.div) {
var box = ZeroClipboard.getDOMObjectPosition(this.domElement);
var style = this.div.style;
style.left = '' + box.left + 'px';
style.top = '' + box.top + 'px';
}
},
setText: function(newText) {
// set text to be copied to clipboard
this.clipText = newText;
if (this.ready) this.movie.setText(newText);
},
addEventListener: function(eventName, func) {
// add user event listener for event
// event types: load, queueStart, fileStart, fileComplete, queueComplete, progress, error, cancel
eventName = eventName.toString().toLowerCase().replace(/^on/, '');
if (!this.handlers[eventName]) this.handlers[eventName] = [];
this.handlers[eventName].push(func);
},
setHandCursor: function(enabled) {
// enable hand cursor (true), or default arrow cursor (false)
this.handCursorEnabled = enabled;
if (this.ready) this.movie.setHandCursor(enabled);
},
setCSSEffects: function(enabled) {
// enable or disable CSS effects on DOM container
this.cssEffects = !!enabled;
},
receiveEvent: function(eventName, args) {
// receive event from flash
eventName = eventName.toString().toLowerCase().replace(/^on/, '');
// special behavior for certain events
switch (eventName) {
case 'load':
// movie claims it is ready, but in IE this isn't always the case...
// bug fix: Cannot extend EMBED DOM elements in Firefox, must use traditional function
this.movie = document.getElementById(this.movieId);
if (!this.movie) {
var self = this;
setTimeout( function() { self.receiveEvent('load', null); }, 1 );
return;
}
// firefox on pc needs a "kick" in order to set these in certain cases
if (!this.ready && navigator.userAgent.match(/Firefox/) && navigator.userAgent.match(/Windows/)) {
var self = this;
setTimeout( function() { self.receiveEvent('load', null); }, 100 );
this.ready = true;
return;
}
this.ready = true;
this.movie.setText( this.clipText );
this.movie.setHandCursor( this.handCursorEnabled );
break;
case 'mouseover':
if (this.domElement && this.cssEffects) {
this.domElement.addClass('hover');
if (this.recoverActive) this.domElement.addClass('active');
}
break;
case 'mouseout':
if (this.domElement && this.cssEffects) {
this.recoverActive = false;
if (this.domElement.hasClass('active')) {
this.domElement.removeClass('active');
this.recoverActive = true;
}
this.domElement.removeClass('hover');
}
break;
case 'mousedown':
if (this.domElement && this.cssEffects) {
this.domElement.addClass('active');
}
break;
case 'mouseup':
if (this.domElement && this.cssEffects) {
this.domElement.removeClass('active');
this.recoverActive = false;
}
break;
} // switch eventName
if (this.handlers[eventName]) {
for (var idx = 0, len = this.handlers[eventName].length; idx < len; idx++) {
var func = this.handlers[eventName][idx];
if (typeof(func) == 'function') {
// actual function reference
func(this, args);
}
else if ((typeof(func) == 'object') && (func.length == 2)) {
// PHP style object + method, i.e. [myObject, 'myMethod']
func[0][ func[1] ](this, args);
}
else if (typeof(func) == 'string') {
// name of function
window[func](this, args);
}
} // foreach event handler defined
} // user defined handler for event
}
};
|
108wo
|
statics/js/108wo/zeroclipboard/ZeroClipboard.js
|
JavaScript
|
asf20
| 9,784
|
package {
// Simple Set Clipboard System
// Author: Joseph Huckaby
import flash.display.Stage;
import flash.display.Sprite;
import flash.display.LoaderInfo;
import flash.display.StageScaleMode;
import flash.events.*;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.external.ExternalInterface;
import flash.system.Security;
import flash.utils.*;
import flash.system.System;
public class ZeroClipboard extends Sprite {
private var id:String = '';
private var button:Sprite;
private var clipText:String = '';
public function ZeroClipboard() {
// constructor, setup event listeners and external interfaces
stage.scaleMode = StageScaleMode.EXACT_FIT;
flash.system.Security.allowDomain("*");
// import flashvars
var flashvars:Object = LoaderInfo( this.root.loaderInfo ).parameters;
id = flashvars.id;
// invisible button covers entire stage
button = new Sprite();
button.buttonMode = true;
button.useHandCursor = true;
button.graphics.beginFill(0xCCFF00);
button.graphics.drawRect(0, 0, Math.floor(flashvars.width), Math.floor(flashvars.height));
button.alpha = 0.0;
addChild(button);
button.addEventListener(MouseEvent.CLICK, clickHandler);
button.addEventListener(MouseEvent.MOUSE_OVER, function(event:Event) {
ExternalInterface.call( 'ZeroClipboard.dispatch', id, 'mouseOver', null );
} );
button.addEventListener(MouseEvent.MOUSE_OUT, function(event:Event) {
ExternalInterface.call( 'ZeroClipboard.dispatch', id, 'mouseOut', null );
} );
button.addEventListener(MouseEvent.MOUSE_DOWN, function(event:Event) {
ExternalInterface.call( 'ZeroClipboard.dispatch', id, 'mouseDown', null );
} );
button.addEventListener(MouseEvent.MOUSE_UP, function(event:Event) {
ExternalInterface.call( 'ZeroClipboard.dispatch', id, 'mouseUp', null );
} );
// external functions
ExternalInterface.addCallback("setHandCursor", setHandCursor);
ExternalInterface.addCallback("setText", setText);
// signal to the browser that we are ready
ExternalInterface.call( 'ZeroClipboard.dispatch', id, 'load', null );
}
public function setText(newText) {
// set the maximum number of files allowed
clipText = newText;
}
public function setHandCursor(enabled:Boolean) {
// control whether the hand cursor is shown on rollover (true)
// or the default arrow cursor (false)
button.useHandCursor = enabled;
}
private function clickHandler(event:Event):void {
// user click copies text to clipboard
// as of flash player 10, this MUST happen from an in-movie flash click event
System.setClipboard( clipText );
ExternalInterface.call( 'ZeroClipboard.dispatch', id, 'complete', clipText );
}
}
}
|
108wo
|
statics/js/108wo/zeroclipboard/ZeroClipboard.as
|
ActionScript
|
asf20
| 2,795
|
<html>
<head>
<title>Zero Clipboard Test</title>
<style type="text/css">
body { font-family:arial,sans-serif; font-size:9pt; }
.my_clip_button { width:150px; text-align:center; border:1px solid black; background-color:#ccc; margin:10px; padding:10px; cursor:default; font-size:9pt; }
.my_clip_button.hover { background-color:#eee; }
.my_clip_button.active { background-color:#aaa; }
</style>
<script type="text/javascript" src="ZeroClipboard.js"></script>
<script language="JavaScript">
var clip = null;
function $(id) { return document.getElementById(id); }
function init() {
clip = new ZeroClipboard.Client();
clip.setHandCursor( true );
clip.addEventListener('load', function (client) {
debugstr("Flash movie loaded and ready.");
});
clip.addEventListener('mouseOver', function (client) {
// update the text on mouse over
clip.setText( $('fe_text').value );
});
clip.addEventListener('complete', function (client, text) {
debugstr("Copied text to clipboard: " + text );
});
clip.glue( 'd_clip_button', 'd_clip_container' );
}
function debugstr(msg) {
var p = document.createElement('p');
p.innerHTML = msg;
$('d_debug').appendChild(p);
}
</script>
</head>
<body onLoad="init()">
<h1>Zero Clipboard Test</h1>
<p><script>document.write("Your browser: " + navigator.userAgent);</script></p>
<table width="100%">
<tr>
<td width="50%" valign="top">
<!-- Upload Form -->
<table>
<tr>
<td align="right"><b>Text:</b></td>
<td align="left"><textarea id="fe_text" cols=50 rows=5 onChange="clip.setText(this.value)">Copy me!</textarea></td>
</tr>
</table>
<br/>
<div id="d_clip_container" style="position:relative">
<div id="d_clip_button" class="my_clip_button"><b>Copy To Clipboard...</b></div>
</div>
</td>
<td width="50%" valign="top">
<!-- Debug Console -->
<div id="d_debug" style="border:1px solid #aaa; padding: 10px; font-size:9pt;">
<h3>Debug Console:</h3>
</div>
</td>
</tr>
</table>
<br/><br/>
You can paste text here if you want, to make sure it worked:<br/>
<textarea id="testarea" cols=50 rows=10></textarea><br/>
<input type=button value="Clear Test Area" onClick="$('testarea').value = '';"/>
</body>
</html>
|
108wo
|
statics/js/108wo/zeroclipboard/test.html
|
HTML
|
asf20
| 2,318
|
/*
* jQuery Color Animations
* Copyright 2007 John Resig
* Released under the MIT and GPL licenses.
*/
(function(jQuery){
// We override the animation for all of these color styles
jQuery.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){
jQuery.fx.step[attr] = function(fx){
if ( fx.colorFunction == undefined || fx.state == 0 ) {
fx.start = getColor( fx.elem, attr );
fx.end = getRGB( fx.end );
if ( fx.start == undefined ) {
fx.start = [ 255,255,255,0 ];
} else {
if ( fx.start[3] == undefined ) // if alpha channel is not spotted
fx.start[3] = 1; // assume it is fully opaque
if ( fx.start[3] == 0 ) // if alpha is present and fully transparent
fx.start[0] = fx.start[1] = fx.start[2] = 255; // assume starting with white
}
if ( fx.end[3] == undefined ) // if alpha channel is not spotted
fx.end[3] = 1; // assume it is fully opaque
fx.colorFunction = ( fx.start[3] == 1 && fx.end[3] == 1 ? calcRGB : calcRGBa );
}
fx.elem.style[attr] = fx.colorFunction();
}
});
var calcRGB = function() {
return 'rgb(' +
Math.max(Math.min( parseInt((this.pos * (this.end[0] - this.start[0])) + this.start[0]), 255), 0) + ',' +
Math.max(Math.min( parseInt((this.pos * (this.end[1] - this.start[1])) + this.start[1]), 255), 0) + ',' +
Math.max(Math.min( parseInt((this.pos * (this.end[2] - this.start[2])) + this.start[2]), 255), 0) + ')';
};
var calcRGBa = function() {
return 'rgba(' +
Math.max(Math.min( parseInt((this.pos * (this.end[0] - this.start[0])) + this.start[0]), 255), 0) + ',' +
Math.max(Math.min( parseInt((this.pos * (this.end[1] - this.start[1])) + this.start[1]), 255), 0) + ',' +
Math.max(Math.min( parseInt((this.pos * (this.end[2] - this.start[2])) + this.start[2]), 255), 0) + ',' +
Math.max(Math.min( parseFloat((this.pos * (this.end[3] - this.start[3])) + this.start[3]), 1), 0) + ')';
};
// Color Conversion functions from highlightFade
// By Blair Mitchelmore
// http://jquery.offput.ca/highlightFade/
// Parse strings looking for color tuples [255,255,255]
function getRGB(color) {
var result;
// Check if we're already dealing with an array of colors
if ( color && color.constructor == Array && color.length >= 3 )
return color;
// Look for rgb(num,num,num)
if (result = /rgba?\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,?\s*((?:[0-9](?:\.[0-9]+)?)?)\s*\)/.exec(color))
return [ parseInt(result[1]), parseInt(result[2]), parseInt(result[3]), parseFloat(result[4]||1) ];
// Look for rgb(num%,num%,num%)
if (result = /rgba?\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,?\s*((?:[0-9](?:\.[0-9]+)?)?)\s*\)/.exec(color))
return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55, parseFloat(result[4]||1)];
// Look for #a0b1c2
if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
// Look for #fff
if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
// Otherwise, we're most likely dealing with a named color
var colorName = jQuery.trim(color).toLowerCase();
if ( colors[colorName] != undefined )
return colors[colorName];
return [ 255, 255, 255, 0 ];
}
function getColor(elem, attr) {
var color;
do {
color = jQuery.curCSS(elem, attr);
// Keep going until we find an element that has color, or we hit the body
if ( color != '' && color != 'transparent' || jQuery.nodeName(elem, "body") )
break;
attr = "backgroundColor";
} while ( elem = elem.parentNode );
return getRGB(color);
};
// Some named colors to work with
// From Interface by Stefan Petre
// http://interface.eyecon.ro/
var colors = {
aqua:[0,255,255],
azure:[240,255,255],
beige:[245,245,220],
black:[0,0,0],
blue:[0,0,255],
brown:[165,42,42],
cyan:[0,255,255],
darkblue:[0,0,139],
darkcyan:[0,139,139],
darkgrey:[169,169,169],
darkgreen:[0,100,0],
darkkhaki:[189,183,107],
darkmagenta:[139,0,139],
darkolivegreen:[85,107,47],
darkorange:[255,140,0],
darkorchid:[153,50,204],
darkred:[139,0,0],
darksalmon:[233,150,122],
darkviolet:[148,0,211],
fuchsia:[255,0,255],
gold:[255,215,0],
green:[0,128,0],
indigo:[75,0,130],
khaki:[240,230,140],
lightblue:[173,216,230],
lightcyan:[224,255,255],
lightgreen:[144,238,144],
lightgrey:[211,211,211],
lightpink:[255,182,193],
lightyellow:[255,255,224],
lime:[0,255,0],
magenta:[255,0,255],
maroon:[128,0,0],
navy:[0,0,128],
olive:[128,128,0],
orange:[255,165,0],
pink:[255,192,203],
purple:[128,0,128],
violet:[128,0,128],
red:[255,0,0],
silver:[192,192,192],
white:[255,255,255],
yellow:[255,255,0]
};
})(jQuery);
|
108wo
|
statics/js/108wo/jquery.color.js
|
JavaScript
|
asf20
| 5,091
|
function flash(url,w,h,bg,win,vars){
var s=
"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://www.yongtu.net/swflash.cab#version=8,0,0,0' width='"+w+"' height='"+h+"' align='middle'>"+
"<param name='movie' value='"+url+"' />"+
"<param name='wmode' value='"+win+"' />"+
"<param name='quality' value='high' />"+
"<param name='FlashVars' value='"+vars+"' />"+
"<param name='bgcolor' value='"+bg+"' />"+
"<embed src='"+url+"' wmode='"+win+"' menu='false' quality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' align='middle' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
"</object>";
document.write(s);
}
|
108wo
|
statics/js/108wo/flash.js
|
JavaScript
|
asf20
| 713
|
/**
* jquery.scrollFollow.js
* Copyright (c) 2008 Net Perspective (http://kitchen.net-perspective.com/)
* Licensed under the MIT License (http://www.opensource.org/licenses/mit-license.php)
*
* @author R.A. Ray
*
* @projectDescription jQuery plugin for allowing an element to animate down as the user scrolls the page.
*
* @version 0.4.0
*
* @requires jquery.js (tested with 1.2.6)
* @requires ui.core.js (tested with 1.5.2)
*
* @optional jquery.cookie.js (http://www.stilbuero.de/2006/09/17/cookie-plugin-for-jquery/)
* @optional jquery.easing.js (http://gsgd.co.uk/sandbox/jquery/easing/ - tested with 1.3)
*
* @param speed int - Duration of animation (in milliseconds)
* default: 500
* @param offset int - Number of pixels box should remain from top of viewport
* default: 0
* @param easing string - Any one of the easing options from the easing plugin - Requires jQuery Easing Plugin < http://gsgd.co.uk/sandbox/jquery/easing/ >
* default: 'linear'
* @param container string - ID of the containing div
* default: box's immediate parent
* @param killSwitch string - ID of the On/Off toggle element
* default: 'killSwitch'
* @param onText string - killSwitch text to be displayed if sliding is enabled
* default: 'Turn Slide Off'
* @param offText string - killSwitch text to be displayed if sliding is disabled
* default: 'Turn Slide On'
* @param relativeTo string - Scroll animation can be relative to either the 'top' or 'bottom' of the viewport
* default: 'top'
* @param delay int - Time between the end of the scroll and the beginning of the animation in milliseconds
* default: 0
*/
( function( $ ) {
$.scrollFollow = function ( box, options )
{
// Convert box into a jQuery object
box = $( box );
// 'box' is the object to be animated
var position = box.css( 'position' );
function ani()
{
// The script runs on every scroll which really means many times during a scroll.
// We don't want multiple slides to queue up.
box.queue( [ ] );
// A bunch of values we need to determine where to animate to
var viewportHeight = parseInt( $( window ).height() );
var pageScroll = parseInt( $( document ).scrollTop() );
var parentTop = parseInt( box.cont.offset().top);
var parentHeight = parseInt( box.cont.attr( 'offsetHeight' ) );
var boxHeight = parseInt( box.attr( 'offsetHeight' ) + ( parseInt( box.css( 'marginTop' ) ) || 0 ) + ( parseInt( box.css( 'marginBottom' ) ) || 0 ) );
var aniTop;
// Make sure the user wants the animation to happen
if ( isActive )
{
// If the box should animate relative to the top of the window
if ( options.relativeTo == 'top' )
{
// Don't animate until the top of the window is close enough to the top of the box
if ( box.initialOffsetTop >= ( pageScroll + options.offset ) )
{
aniTop = box.initialTop;
}
else
{
aniTop = Math.min( ( Math.max( ( -parentTop ), ( pageScroll - box.initialOffsetTop + box.initialTop ) ) + options.offset ), ( parentHeight - boxHeight - box.paddingAdjustment ) );
}
}
// If the box should animate relative to the bottom of the window
else if ( options.relativeTo == 'bottom' )
{
// Don't animate until the bottom of the window is close enough to the bottom of the box
if ( ( box.initialOffsetTop + boxHeight ) >= ( pageScroll + options.offset + viewportHeight ) )
{
aniTop = box.initialTop;
}
else
{
aniTop = Math.min( ( pageScroll + viewportHeight - boxHeight - options.offset ), ( parentHeight - boxHeight ) );
}
}
// Checks to see if the relevant scroll was the last one
// "-20" is to account for inaccuracy in the timeout
if ( ( new Date().getTime() - box.lastScroll ) >= ( options.delay - 20 ) )
{
box.animate(
{
top: aniTop
}, options.speed, options.easing
);
}
}
};
// For user-initiated stopping of the slide
var isActive = true;
if ( $.cookie != undefined )
{
if( $.cookie( 'scrollFollowSetting' + box.attr( 'id' ) ) == 'false' )
{
var isActive = false;
$( '#' + options.killSwitch ).text( options.offText )
.toggle(
function ()
{
isActive = true;
$( this ).text( options.onText );
$.cookie( 'scrollFollowSetting' + box.attr( 'id' ), true, { expires: 365, path: '/'} );
ani();
},
function ()
{
isActive = false;
$( this ).text( options.offText );
box.animate(
{
top: box.initialTop
}, options.speed, options.easing
);
$.cookie( 'scrollFollowSetting' + box.attr( 'id' ), false, { expires: 365, path: '/'} );
}
);
}
else
{
$( '#' + options.killSwitch ).text( options.onText )
.toggle(
function ()
{
isActive = false;
$( this ).text( options.offText );
box.animate(
{
top: box.initialTop
}, 0
);
$.cookie( 'scrollFollowSetting' + box.attr( 'id' ), false, { expires: 365, path: '/'} );
},
function ()
{
isActive = true;
$( this ).text( options.onText );
$.cookie( 'scrollFollowSetting' + box.attr( 'id' ), true, { expires: 365, path: '/'} );
ani();
}
);
}
}
// If no parent ID was specified, and the immediate parent does not have an ID
// options.container will be undefined. So we need to figure out the parent element.
if ( options.container == '')
{
box.cont = box.parent();
}
else
{
box.cont = $( '#' + options.container );
}
// Finds the default positioning of the box.
box.initialOffsetTop = parseInt( box.offset().top );
box.initialTop = parseInt( box.css( 'top' ) ) || 0;
// Hack to fix different treatment of boxes positioned 'absolute' and 'relative'
if ( box.css( 'position' ) == 'relative' )
{
box.paddingAdjustment = parseInt( box.cont.css( 'paddingTop' ) ) + parseInt( box.cont.css( 'paddingBottom' ) );
}
else
{
box.paddingAdjustment = 0;
}
// Animate the box when the page is scrolled
$( window ).scroll( function ()
{
// Sets up the delay of the animation
$.fn.scrollFollow.interval = setTimeout( function(){ ani();} , options.delay );
// To check against right before setting the animation
box.lastScroll = new Date().getTime();
}
);
// Animate the box when the page is resized
$( window ).resize( function ()
{
// Sets up the delay of the animation
$.fn.scrollFollow.interval = setTimeout( function(){ ani();} , options.delay );
// To check against right before setting the animation
box.lastScroll = new Date().getTime();
}
);
// Run an initial animation on page load
box.lastScroll = 0;
ani();
};
$.fn.scrollFollow = function ( options )
{
options = options || {};
options.relativeTo = options.relativeTo || 'top';
options.speed = options.speed || 500;
options.offset = options.offset || 0;
options.easing = options.easing || 'swing';
options.container = options.container || this.parent().attr( 'id' );
options.killSwitch = options.killSwitch || 'killSwitch';
options.onText = options.onText || 'Turn Slide Off';
options.offText = options.offText || 'Turn Slide On';
options.delay = options.delay || 0;
this.each( function()
{
new $.scrollFollow( this, options );
}
);
return this;
};
})( jQuery );
|
108wo
|
statics/js/108wo/jquery.scrollfollow.js
|
JavaScript
|
asf20
| 7,932
|
var phpcms_path = '/';
var cookie_pre = 'sYQDUGqqzH';
var cookie_domain = '';
var cookie_path = '/';
function getcookie(name) {
name = cookie_pre+name;
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while(i < clen) {
var j = i + alen;
if(document.cookie.substring(i, j) == arg) return getcookieval(j);
i = document.cookie.indexOf(" ", i) + 1;
if(i == 0) break;
}
return null;
}
function setcookie(name, value, days) {
name = cookie_pre+name;
var argc = setcookie.arguments.length;
var argv = setcookie.arguments;
var secure = (argc > 5) ? argv[5] : false;
var expire = new Date();
if(days==null || days==0) days=1;
expire.setTime(expire.getTime() + 3600000*24*days);
document.cookie = name + "=" + escape(value) + ("; path=" + cookie_path) + ((cookie_domain == '') ? "" : ("; domain=" + cookie_domain)) + ((secure == true) ? "; secure" : "") + ";expires="+expire.toGMTString();
}
function delcookie(name) {
var exp = new Date();
exp.setTime (exp.getTime() - 1);
var cval = getcookie(name);
name = cookie_pre+name;
document.cookie = name+"="+cval+";expires="+exp.toGMTString();
}
function getcookieval(offset) {
var endstr = document.cookie.indexOf (";", offset);
if(endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
|
108wo
|
statics/js/108wo/cookie.js
|
JavaScript
|
asf20
| 1,409
|
/* Copyright (c) 2009 Kelvin Luck (kelvin AT kelvinluck DOT com || http://www.kelvinluck.com)
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
*
* See http://kelvinluck.com/assets/jquery/jScrollPane/
* $Id: jScrollPane.js 93 2010-06-01 08:17:28Z kelvin.luck $
*/
/**
* Replace the vertical scroll bars on any matched elements with a fancy
* styleable (via CSS) version. With JS disabled the elements will
* gracefully degrade to the browsers own implementation of overflow:auto.
* If the mousewheel plugin has been included on the page then the scrollable areas will also
* respond to the mouse wheel.
*
* @example jQuery(".scroll-pane").jScrollPane();
*
* @name jScrollPane
* @type jQuery
* @param Object settings hash with options, described below.
* scrollbarWidth - The width of the generated scrollbar in pixels
* scrollbarMargin - The amount of space to leave on the side of the scrollbar in pixels
* wheelSpeed - The speed the pane will scroll in response to the mouse wheel in pixels
* showArrows - Whether to display arrows for the user to scroll with
* arrowSize - The height of the arrow buttons if showArrows=true
* animateTo - Whether to animate when calling scrollTo and scrollBy
* dragMinHeight - The minimum height to allow the drag bar to be
* dragMaxHeight - The maximum height to allow the drag bar to be
* animateInterval - The interval in milliseconds to update an animating scrollPane (default 100)
* animateStep - The amount to divide the remaining scroll distance by when animating (default 3)
* maintainPosition- Whether you want the contents of the scroll pane to maintain it's position when you re-initialise it - so it doesn't scroll as you add more content (default true)
* tabIndex - The tabindex for this jScrollPane to control when it is tabbed to when navigating via keyboard (default 0)
* enableKeyboardNavigation - Whether to allow keyboard scrolling of this jScrollPane when it is focused (default true)
* animateToInternalLinks - Whether the move to an internal link (e.g. when it's focused by tabbing or by a hash change in the URL) should be animated or instant (default false)
* scrollbarOnLeft - Display the scrollbar on the left side? (needs stylesheet changes, see examples.html)
* reinitialiseOnImageLoad - Whether the jScrollPane should automatically re-initialise itself when any contained images are loaded (default false)
* topCapHeight - The height of the "cap" area between the top of the jScrollPane and the top of the track/ buttons
* bottomCapHeight - The height of the "cap" area between the bottom of the jScrollPane and the bottom of the track/ buttons
* observeHash - Whether jScrollPane should attempt to automagically scroll to the correct place when an anchor inside the scrollpane is linked to (default true)
* @return jQuery
* @cat Plugins/jScrollPane
* @author Kelvin Luck (kelvin AT kelvinluck DOT com || http://www.kelvinluck.com)
*/
(function($) {
$.jScrollPane = {
active : []
};
$.fn.jScrollPane = function(settings)
{
settings = $.extend({}, $.fn.jScrollPane.defaults, settings);
var rf = function() { return false; };
return this.each(
function()
{
var $this = $(this);
var paneEle = this;
var currentScrollPosition = 0;
var paneWidth;
var paneHeight;
var trackHeight;
var trackOffset = settings.topCapHeight;
var $container;
if ($(this).parent().is('.jScrollPaneContainer')) {
$container = $(this).parent();
currentScrollPosition = settings.maintainPosition ? $this.position().top : 0;
var $c = $(this).parent();
paneWidth = $c.innerWidth();
paneHeight = $c.outerHeight();
$('>.jScrollPaneTrack, >.jScrollArrowUp, >.jScrollArrowDown, >.jScrollCap', $c).remove();
$this.css({'top':0});
} else {
$this.data('originalStyleTag', $this.attr('style'));
// Switch the element's overflow to hidden to ensure we get the size of the element without the scrollbars [http://plugins.jquery.com/node/1208]
$this.css('overflow', 'hidden');
this.originalPadding = $this.css('paddingTop') + ' ' + $this.css('paddingRight') + ' ' + $this.css('paddingBottom') + ' ' + $this.css('paddingLeft');
this.originalSidePaddingTotal = (parseInt($this.css('paddingLeft')) || 0) + (parseInt($this.css('paddingRight')) || 0);
paneWidth = $this.innerWidth();
paneHeight = $this.innerHeight();
$container = $('<div></div>')
.attr({'className':'jScrollPaneContainer'})
.css(
{
'height':paneHeight+'px',
'width':paneWidth+'px'
}
);
if (settings.enableKeyboardNavigation) {
$container.attr(
'tabindex',
settings.tabIndex
);
}
$this.wrap($container);
$container = $this.parent();
// deal with text size changes (if the jquery.em plugin is included)
// and re-initialise the scrollPane so the track maintains the
// correct size
$(document).bind(
'emchange',
function(e, cur, prev)
{
$this.jScrollPane(settings);
}
);
}
trackHeight = paneHeight;
if (settings.reinitialiseOnImageLoad) {
// code inspired by jquery.onImagesLoad: http://plugins.jquery.com/project/onImagesLoad
// except we re-initialise the scroll pane when each image loads so that the scroll pane is always up to size...
// TODO: Do I even need to store it in $.data? Is a local variable here the same since I don't pass the reinitialiseOnImageLoad when I re-initialise?
var $imagesToLoad = $.data(paneEle, 'jScrollPaneImagesToLoad') || $('img', $this);
var loadedImages = [];
if ($imagesToLoad.length) {
$imagesToLoad.each(function(i, val) {
$(this).bind('load readystatechange', function() {
if($.inArray(i, loadedImages) == -1){ //don't double count images
loadedImages.push(val); //keep a record of images we've seen
$imagesToLoad = $.grep($imagesToLoad, function(n, i) {
return n != val;
});
$.data(paneEle, 'jScrollPaneImagesToLoad', $imagesToLoad);
var s2 = $.extend(settings, {reinitialiseOnImageLoad:false});
$this.jScrollPane(s2); // re-initialise
}
}).each(function(i, val) {
if(this.complete || this.complete===undefined) {
//needed for potential cached images
this.src = this.src;
}
});
});
};
}
var p = this.originalSidePaddingTotal;
var realPaneWidth = paneWidth - settings.scrollbarWidth - settings.scrollbarMargin - p;
var cssToApply = {
'height':'auto',
'width': realPaneWidth + 'px'
}
if(settings.scrollbarOnLeft) {
cssToApply.paddingLeft = settings.scrollbarMargin + settings.scrollbarWidth + 'px';
} else {
cssToApply.paddingRight = settings.scrollbarMargin + 'px';
}
$this.css(cssToApply);
var contentHeight = $this.outerHeight();
var percentInView = paneHeight / contentHeight;
var isScrollable = percentInView < .99;
$container[isScrollable ? 'addClass' : 'removeClass']('jScrollPaneScrollable');
if (isScrollable) {
$container.append(
$('<div></div>').addClass('jScrollCap jScrollCapTop').css({height:settings.topCapHeight}),
$('<div></div>').attr({'className':'jScrollPaneTrack'}).css({'width':settings.scrollbarWidth+'px'}).append(
$('<div></div>').attr({'className':'jScrollPaneDrag'}).css({'width':settings.scrollbarWidth+'px'}).append(
$('<div></div>').attr({'className':'jScrollPaneDragTop'}).css({'width':settings.scrollbarWidth+'px'}),
$('<div></div>').attr({'className':'jScrollPaneDragBottom'}).css({'width':settings.scrollbarWidth+'px'})
)
),
$('<div></div>').addClass('jScrollCap jScrollCapBottom').css({height:settings.bottomCapHeight})
);
var $track = $('>.jScrollPaneTrack', $container);
var $drag = $('>.jScrollPaneTrack .jScrollPaneDrag', $container);
var currentArrowDirection;
var currentArrowTimerArr = [];// Array is used to store timers since they can stack up when dealing with keyboard events. This ensures all timers are cleaned up in the end, preventing an acceleration bug.
var currentArrowInc;
var whileArrowButtonDown = function()
{
if (currentArrowInc > 4 || currentArrowInc % 4 == 0) {
positionDrag(dragPosition + currentArrowDirection * mouseWheelMultiplier);
}
currentArrowInc++;
};
if (settings.enableKeyboardNavigation) {
$container.bind(
'keydown.jscrollpane',
function(e)
{
switch (e.keyCode) {
case 38: //up
currentArrowDirection = -1;
currentArrowInc = 0;
whileArrowButtonDown();
currentArrowTimerArr[currentArrowTimerArr.length] = setInterval(whileArrowButtonDown, 100);
return false;
case 40: //down
currentArrowDirection = 1;
currentArrowInc = 0;
whileArrowButtonDown();
currentArrowTimerArr[currentArrowTimerArr.length] = setInterval(whileArrowButtonDown, 100);
return false;
case 33: // page up
case 34: // page down
// TODO
return false;
default:
}
}
).bind(
'keyup.jscrollpane',
function(e)
{
if (e.keyCode == 38 || e.keyCode == 40) {
for (var i = 0; i < currentArrowTimerArr.length; i++) {
clearInterval(currentArrowTimerArr[i]);
}
return false;
}
}
);
}
if (settings.showArrows) {
var currentArrowButton;
var currentArrowInterval;
var onArrowMouseUp = function(event)
{
$('html').unbind('mouseup', onArrowMouseUp);
currentArrowButton.removeClass('jScrollActiveArrowButton');
clearInterval(currentArrowInterval);
};
var onArrowMouseDown = function() {
$('html').bind('mouseup', onArrowMouseUp);
currentArrowButton.addClass('jScrollActiveArrowButton');
currentArrowInc = 0;
whileArrowButtonDown();
currentArrowInterval = setInterval(whileArrowButtonDown, 100);
};
$container
.append(
$('<a></a>')
.attr(
{
'href':'javascript:;',
'className':'jScrollArrowUp',
'tabindex':-1
}
)
.css(
{
'width':settings.scrollbarWidth+'px',
'top':settings.topCapHeight + 'px'
}
)
.html('Scroll up')
.bind('mousedown', function()
{
currentArrowButton = $(this);
currentArrowDirection = -1;
onArrowMouseDown();
this.blur();
return false;
})
.bind('click', rf),
$('<a></a>')
.attr(
{
'href':'javascript:;',
'className':'jScrollArrowDown',
'tabindex':-1
}
)
.css(
{
'width':settings.scrollbarWidth+'px',
'bottom':settings.bottomCapHeight + 'px'
}
)
.html('Scroll down')
.bind('mousedown', function()
{
currentArrowButton = $(this);
currentArrowDirection = 1;
onArrowMouseDown();
this.blur();
return false;
})
.bind('click', rf)
);
var $upArrow = $('>.jScrollArrowUp', $container);
var $downArrow = $('>.jScrollArrowDown', $container);
}
if (settings.arrowSize) {
trackHeight = paneHeight - settings.arrowSize - settings.arrowSize;
trackOffset += settings.arrowSize;
} else if ($upArrow) {
var topArrowHeight = $upArrow.height();
settings.arrowSize = topArrowHeight;
trackHeight = paneHeight - topArrowHeight - $downArrow.height();
trackOffset += topArrowHeight;
}
trackHeight -= settings.topCapHeight + settings.bottomCapHeight;
$track.css({'height': trackHeight+'px', top:trackOffset+'px'})
var $pane = $(this).css({'position':'absolute', 'overflow':'visible'});
var currentOffset;
var maxY;
var mouseWheelMultiplier;
// store this in a seperate variable so we can keep track more accurately than just updating the css property..
var dragPosition = 0;
var dragMiddle = percentInView*paneHeight/2;
// pos function borrowed from tooltip plugin and adapted...
var getPos = function (event, c) {
var p = c == 'X' ? 'Left' : 'Top';
return event['page' + c] || (event['client' + c] + (document.documentElement['scroll' + p] || document.body['scroll' + p])) || 0;
};
var ignoreNativeDrag = function() { return false; };
var initDrag = function()
{
ceaseAnimation();
currentOffset = $drag.offset(false);
currentOffset.top -= dragPosition;
maxY = trackHeight - $drag[0].offsetHeight;
mouseWheelMultiplier = 2 * settings.wheelSpeed * maxY / contentHeight;
};
var onStartDrag = function(event)
{
initDrag();
dragMiddle = getPos(event, 'Y') - dragPosition - currentOffset.top;
$('html').bind('mouseup', onStopDrag).bind('mousemove', updateScroll).bind('mouseleave', onStopDrag)
if ($.browser.msie) {
$('html').bind('dragstart', ignoreNativeDrag).bind('selectstart', ignoreNativeDrag);
}
return false;
};
var onStopDrag = function()
{
$('html').unbind('mouseup', onStopDrag).unbind('mousemove', updateScroll);
dragMiddle = percentInView*paneHeight/2;
if ($.browser.msie) {
$('html').unbind('dragstart', ignoreNativeDrag).unbind('selectstart', ignoreNativeDrag);
}
};
var positionDrag = function(destY)
{
$container.scrollTop(0);
destY = destY < 0 ? 0 : (destY > maxY ? maxY : destY);
dragPosition = destY;
$drag.css({'top':destY+'px'});
var p = destY / maxY;
$this.data('jScrollPanePosition', (paneHeight-contentHeight)*-p);
$pane.css({'top':((paneHeight-contentHeight)*p) + 'px'});
$this.trigger('scroll');
if (settings.showArrows) {
$upArrow[destY == 0 ? 'addClass' : 'removeClass']('disabled');
$downArrow[destY == maxY ? 'addClass' : 'removeClass']('disabled');
}
};
var updateScroll = function(e)
{
positionDrag(getPos(e, 'Y') - currentOffset.top - dragMiddle);
};
var dragH = Math.max(Math.min(percentInView*(paneHeight-settings.arrowSize*2), settings.dragMaxHeight), settings.dragMinHeight);
$drag.css(
{'height':dragH+'px'}
).bind('mousedown', onStartDrag);
var trackScrollInterval;
var trackScrollInc;
var trackScrollMousePos;
var doTrackScroll = function()
{
if (trackScrollInc > 8 || trackScrollInc%4==0) {
positionDrag((dragPosition - ((dragPosition - trackScrollMousePos) / 2)));
}
trackScrollInc ++;
};
var onStopTrackClick = function()
{
clearInterval(trackScrollInterval);
$('html').unbind('mouseup', onStopTrackClick).unbind('mousemove', onTrackMouseMove);
};
var onTrackMouseMove = function(event)
{
trackScrollMousePos = getPos(event, 'Y') - currentOffset.top - dragMiddle;
};
var onTrackClick = function(event)
{
initDrag();
onTrackMouseMove(event);
trackScrollInc = 0;
$('html').bind('mouseup', onStopTrackClick).bind('mousemove', onTrackMouseMove);
trackScrollInterval = setInterval(doTrackScroll, 100);
doTrackScroll();
return false;
};
$track.bind('mousedown', onTrackClick);
$container.bind(
'mousewheel',
function (event, delta) {
delta = delta || (event.wheelDelta ? event.wheelDelta / 120 : (event.detail) ?
-event.detail/3 : 0);
initDrag();
ceaseAnimation();
var d = dragPosition;
positionDrag(dragPosition - delta * mouseWheelMultiplier);
var dragOccured = d != dragPosition;
return !dragOccured;
}
);
var _animateToPosition;
var _animateToInterval;
function animateToPosition()
{
var diff = (_animateToPosition - dragPosition) / settings.animateStep;
if (diff > 1 || diff < -1) {
positionDrag(dragPosition + diff);
} else {
positionDrag(_animateToPosition);
ceaseAnimation();
}
}
var ceaseAnimation = function()
{
if (_animateToInterval) {
clearInterval(_animateToInterval);
delete _animateToPosition;
}
};
var scrollTo = function(pos, preventAni)
{
if (typeof pos == "string") {
// Legal hash values aren't necessarily legal jQuery selectors so we need to catch any
// errors from the lookup...
try {
$e = $(pos, $this);
} catch (err) {
return;
}
if (!$e.length) return;
pos = $e.offset().top - $this.offset().top;
}
ceaseAnimation();
var maxScroll = contentHeight - paneHeight;
pos = pos > maxScroll ? maxScroll : pos;
$this.data('jScrollPaneMaxScroll', maxScroll);
var destDragPosition = pos/maxScroll * maxY;
if (preventAni || !settings.animateTo) {
positionDrag(destDragPosition);
} else {
$container.scrollTop(0);
_animateToPosition = destDragPosition;
_animateToInterval = setInterval(animateToPosition, settings.animateInterval);
}
};
$this[0].scrollTo = scrollTo;
$this[0].scrollBy = function(delta)
{
var currentPos = -parseInt($pane.css('top')) || 0;
scrollTo(currentPos + delta);
};
initDrag();
scrollTo(-currentScrollPosition, true);
// Deal with it when the user tabs to a link or form element within this scrollpane
$('*', this).bind(
'focus',
function(event)
{
var $e = $(this);
// loop through parents adding the offset top of any elements that are relatively positioned between
// the focused element and the jScrollPaneContainer so we can get the true distance from the top
// of the focused element to the top of the scrollpane...
var eleTop = 0;
var preventInfiniteLoop = 100;
while ($e[0] != $this[0]) {
eleTop += $e.position().top;
$e = $e.offsetParent();
if (!preventInfiniteLoop--) {
return;
}
}
var viewportTop = -parseInt($pane.css('top')) || 0;
var maxVisibleEleTop = viewportTop + paneHeight;
var eleInView = eleTop > viewportTop && eleTop < maxVisibleEleTop;
if (!eleInView) {
var destPos = eleTop - settings.scrollbarMargin;
if (eleTop > viewportTop) { // element is below viewport - scroll so it is at bottom.
destPos += $(this).height() + 15 + settings.scrollbarMargin - paneHeight;
}
scrollTo(destPos);
}
}
)
if (settings.observeHash) {
if (location.hash && location.hash.length > 1) {
setTimeout(function(){
scrollTo(location.hash);
}, $.browser.safari ? 100 : 0);
}
// use event delegation to listen for all clicks on links and hijack them if they are links to
// anchors within our content...
$(document).bind('click', function(e){
$target = $(e.target);
if ($target.is('a')) {
var h = $target.attr('href');
if (h && h.substr(0, 1) == '#' && h.length > 1) {
setTimeout(function(){
scrollTo(h, !settings.animateToInternalLinks);
}, $.browser.safari ? 100 : 0);
}
}
});
}
// Deal with dragging and selecting text to make the scrollpane scroll...
function onSelectScrollMouseDown(e)
{
$(document).bind('mousemove.jScrollPaneDragging', onTextSelectionScrollMouseMove);
$(document).bind('mouseup.jScrollPaneDragging', onSelectScrollMouseUp);
}
var textDragDistanceAway;
var textSelectionInterval;
function onTextSelectionInterval()
{
direction = textDragDistanceAway < 0 ? -1 : 1;
$this[0].scrollBy(textDragDistanceAway / 2);
}
function clearTextSelectionInterval()
{
if (textSelectionInterval) {
clearInterval(textSelectionInterval);
textSelectionInterval = undefined;
}
}
function onTextSelectionScrollMouseMove(e)
{
var offset = $this.parent().offset().top;
var maxOffset = offset + paneHeight;
var mouseOffset = getPos(e, 'Y');
textDragDistanceAway = mouseOffset < offset ? mouseOffset - offset : (mouseOffset > maxOffset ? mouseOffset - maxOffset : 0);
if (textDragDistanceAway == 0) {
clearTextSelectionInterval();
} else {
if (!textSelectionInterval) {
textSelectionInterval = setInterval(onTextSelectionInterval, 100);
}
}
}
function onSelectScrollMouseUp(e)
{
$(document)
.unbind('mousemove.jScrollPaneDragging')
.unbind('mouseup.jScrollPaneDragging');
clearTextSelectionInterval();
}
$container.bind('mousedown.jScrollPane', onSelectScrollMouseDown);
$.jScrollPane.active.push($this[0]);
} else {
$this.css(
{
'height':paneHeight+'px',
'width':paneWidth-this.originalSidePaddingTotal+'px',
'padding':this.originalPadding
}
);
$this[0].scrollTo = $this[0].scrollBy = function() {};
// clean up listeners
$this.parent().unbind('mousewheel').unbind('mousedown.jScrollPane').unbind('keydown.jscrollpane').unbind('keyup.jscrollpane');
}
}
)
};
$.fn.jScrollPaneRemove = function()
{
$(this).each(function()
{
$this = $(this);
var $c = $this.parent();
if ($c.is('.jScrollPaneContainer')) {
$this.css(
{
'top':'',
'height':'',
'width':'',
'padding':'',
'overflow':'',
'position':''
}
);
$this.attr('style', $this.data('originalStyleTag'));
$c.after($this).remove();
}
});
}
$.fn.jScrollPane.defaults = {
scrollbarWidth : 10,
scrollbarMargin : 5,
wheelSpeed : 18,
showArrows : false,
arrowSize : 0,
animateTo : false,
dragMinHeight : 1,
dragMaxHeight : 99999,
animateInterval : 100,
animateStep: 3,
maintainPosition: true,
scrollbarOnLeft: false,
reinitialiseOnImageLoad: false,
tabIndex : 0,
enableKeyboardNavigation: true,
animateToInternalLinks: false,
topCapHeight: 0,
bottomCapHeight: 0,
observeHash: true
};
// clean up the scrollTo expandos
$(window)
.bind('unload', function() {
var els = $.jScrollPane.active;
for (var i=0; i<els.length; i++) {
els[i].scrollTo = els[i].scrollBy = null;
}
}
);
})(jQuery);
|
108wo
|
statics/js/108wo/jScrollPane.js
|
JavaScript
|
asf20
| 23,352
|
/**
* 会员中心公用js
*
*/
/**
* 隐藏html element
*/
function hide_element(name) {
$('#'+name+'').fadeOut("slow");
}
/**
* 显示html element
*/
function show_element(name) {
$('#'+name+'').fadeIn("slow");
}
$(document).ready(function(){
$("input.input-text").blur(function () { this.className='input-text'; } );
$("input.input-text',input[type='password'],textarea").focus(function () { this.className='input-focus'; } );
});
/**
* url跳转
*/
function redirect(url) {
if(url.indexOf('://') == -1 && url.substr(0, 1) != '/' && url.substr(0, 1) != '?') url = $('base').attr('href')+url;
location.href = url;
}
function thumb_images(uploadid,returnid) {
var d = window.top.art.dialog({id:uploadid}).data.iframe;
var in_content = d.$("#att-status").html().substring(1);
if(in_content=='') return false;
if($('#'+returnid+'_preview').attr('src')) {
$('#'+returnid+'_preview').attr('src',in_content);
}
$('#'+returnid).val(in_content);
}
function change_images(uploadid,returnid){
var d = window.top.art.dialog({id:uploadid}).data.iframe;
var in_content = d.$("#att-status").html().substring(1);
var str = $('#'+returnid).html();
var contents = in_content.split('|');
$('#'+returnid+'_tips').css('display','none');
$.each( contents, function(i, n) {
var ids = parseInt(Math.random() * 10000 + 10*i);
str += "<div id='image"+ids+"'><input type='text' name='"+returnid+"_url[]' value='"+n+"' style='width:360px;' ondblclick='image_priview(this.value);' class='input-text'> <input type='text' name='"+returnid+"_alt[]' value='图片说明"+(i+1)+"' style='width:100px;' class='input-text' onfocus=\"if(this.value == this.defaultValue) this.value = ''\" onblur=\"if(this.value.replace(' ','') == '') this.value = this.defaultValue;\"> <a href=\"javascript:remove_div('image"+ids+"')\">移除</a> </div><div class='bk10'></div>";
});
$('#'+returnid).html(str);
}
function image_priview(img) {
window.top.art.dialog({title:'图片查看',fixed:true, content:'<img src="'+img+'" />',id:'image_priview',time:5});
}
function remove_div(id) {
$('#'+id).html(' ');
}
function select_catids() {
$('#addbutton').attr('disabled','');
}
//商业用户会添加 num,普通用户默认为5
function transact(update,fromfiled,tofiled, num) {
if(update=='delete') {
var fieldvalue = $('#'+tofiled).val();
$("#"+tofiled+" option").each(function() {
if($(this).val() == fieldvalue){
$(this).remove();
}
});
} else {
var fieldvalue = $('#'+fromfiled).val();
var have_exists = 0;
var len = $("#"+tofiled+" option").size();
if(len>=num) {
alert('最多添加 '+num+' 项');
return false;
}
$("#"+tofiled+" option").each(function() {
if($(this).val() == fieldvalue){
have_exists = 1;
alert('已经添加到列表中');
return false;
}
});
if(have_exists==0) {
obj = $('#'+fromfiled+' option:selected');
text = obj.text();
text = text.replace('│', '');
text = text.replace('├ ', '');
text = text.replace('└ ', '');
text = text.trim();
fieldvalue = "<option value='"+fieldvalue+"'>"+text+"</option>"
$('#'+tofiled).append(fieldvalue);
$('#deletebutton').attr('disabled','');
}
}
}
function omnipotent(id,linkurl,title,close_type,w,h) {
if(!w) w=700;
if(!h) h=500;
art.dialog({id:id,iframe:linkurl, title:title, width:w, height:h, lock:true},
function(){
if(close_type==1) {
art.dialog({id:id}).close()
} else {
var d = art.dialog({id:id}).data.iframe;
var form = d.document.getElementById('dosubmit');form.click();
}
return false;
},
function(){
art.dialog({id:id}).close()
});void(0);
}
String.prototype.trim = function() {
var str = this,
whitespace = ' \n\r\t\f\x0b\xa0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000';
for (var i = 0,len = str.length; i < len; i++) {
if (whitespace.indexOf(str.charAt(i)) === -1) {
str = str.substring(i);
break;
}
}
for (i = str.length - 1; i >= 0; i--) {
if (whitespace.indexOf(str.charAt(i)) === -1) {
str = str.substring(0, i + 1);
break;
}
}
return whitespace.indexOf(str.charAt(0)) === -1 ? str : '';
}
|
108wo
|
statics/js/member_common.js
|
JavaScript
|
asf20
| 4,322
|
function FileProgress(file, targetID) {
this.fileProgressID = file.id;
this.opacity = 100;
this.height = 0;
this.fileProgressWrapper = document.getElementById(this.fileProgressID);
if (!this.fileProgressWrapper) {
this.fileProgressWrapper = document.createElement("div");
this.fileProgressWrapper.className = "progressWrapper";
this.fileProgressWrapper.id = this.fileProgressID;
this.fileProgressElement = document.createElement("div");
this.fileProgressElement.className = "progressContainer";
var progressCancel = document.createElement("a");
progressCancel.className = "progressCancel";
progressCancel.href = "#";
progressCancel.style.visibility = "hidden";
progressCancel.appendChild(document.createTextNode(" "));
var progressText = document.createElement("div");
progressText.className = "progressName";
progressText.appendChild(document.createTextNode(file.name));
var progressBar = document.createElement("div");
progressBar.className = "progressBarInProgress";
var progressStatus = document.createElement("div");
progressStatus.className = "progressBarStatus";
progressStatus.innerHTML = " ";
this.fileProgressElement.appendChild(progressCancel);
this.fileProgressElement.appendChild(progressText);
this.fileProgressElement.appendChild(progressStatus);
this.fileProgressElement.appendChild(progressBar);
this.fileProgressWrapper.appendChild(this.fileProgressElement);
document.getElementById(targetID).appendChild(this.fileProgressWrapper);
} else {
this.fileProgressElement = this.fileProgressWrapper.firstChild;
this.reset();
}
this.height = this.fileProgressWrapper.offsetHeight;
this.setTimer(null);
}
FileProgress.prototype.setTimer = function (timer) {
this.fileProgressElement["FP_TIMER"] = timer;
};
FileProgress.prototype.getTimer = function (timer) {
return this.fileProgressElement["FP_TIMER"] || null;
};
FileProgress.prototype.reset = function () {
this.fileProgressElement.className = "progressContainer";
this.fileProgressElement.childNodes[2].innerHTML = " ";
this.fileProgressElement.childNodes[2].className = "progressBarStatus";
this.fileProgressElement.childNodes[3].className = "progressBarInProgress";
this.fileProgressElement.childNodes[3].style.width = "0%";
this.appear();
};
FileProgress.prototype.setProgress = function (percentage) {
this.fileProgressElement.className = "progressContainer green";
this.fileProgressElement.childNodes[3].className = "progressBarInProgress";
this.fileProgressElement.childNodes[3].style.width = percentage + "%";
this.appear();
};
FileProgress.prototype.setComplete = function () {
this.fileProgressElement.parentNode.className = "progresshidden";
var oSelf = this;
};
FileProgress.prototype.setError = function () {
this.fileProgressElement.className = "progressContainer red";
this.fileProgressElement.childNodes[3].className = "progressBarError";
this.fileProgressElement.childNodes[3].style.width = "";
var oSelf = this;
this.setTimer(setTimeout(function () {
oSelf.disappear();
}, 5000));
};
FileProgress.prototype.setCancelled = function () {
this.fileProgressElement.className = "progressContainer";
this.fileProgressElement.childNodes[3].className = "progressBarError";
this.fileProgressElement.childNodes[3].style.width = "";
var oSelf = this;
this.setTimer(setTimeout(function () {
oSelf.disappear();
}, 2000));
};
FileProgress.prototype.setStatus = function (status) {
this.fileProgressElement.childNodes[2].innerHTML = status;
};
// Show/Hide the cancel button
FileProgress.prototype.toggleCancel = function (show, swfUploadInstance) {
this.fileProgressElement.childNodes[0].style.visibility = show ? "visible" : "hidden";
if (swfUploadInstance) {
var fileID = this.fileProgressID;
this.fileProgressElement.childNodes[0].onclick = function () {
swfUploadInstance.cancelUpload(fileID);
return false;
};
}
};
FileProgress.prototype.appear = function () {
if (this.getTimer() !== null) {
clearTimeout(this.getTimer());
this.setTimer(null);
}
if (this.fileProgressWrapper.filters) {
try {
this.fileProgressWrapper.filters.item("DXImageTransform.Microsoft.Alpha").opacity = 100;
} catch (e) {
// If it is not set initially, the browser will throw an error. This will set it if it is not set yet.
this.fileProgressWrapper.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=100)";
}
} else {
this.fileProgressWrapper.style.opacity = 1;
}
this.fileProgressWrapper.style.height = "";
this.height = this.fileProgressWrapper.offsetHeight;
this.opacity = 100;
this.fileProgressWrapper.style.display = "";
};
// Fades out and clips away the FileProgress box.
FileProgress.prototype.disappear = function () {
var reduceOpacityBy = 15;
var reduceHeightBy = 4;
var rate = 30; // 15 fps
if (this.opacity > 0) {
this.opacity -= reduceOpacityBy;
if (this.opacity < 0) {
this.opacity = 0;
}
if (this.fileProgressWrapper.filters) {
try {
this.fileProgressWrapper.filters.item("DXImageTransform.Microsoft.Alpha").opacity = this.opacity;
} catch (e) {
// If it is not set initially, the browser will throw an error. This will set it if it is not set yet.
this.fileProgressWrapper.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=" + this.opacity + ")";
}
} else {
this.fileProgressWrapper.style.opacity = this.opacity / 100;
}
}
if (this.height > 0) {
this.height -= reduceHeightBy;
if (this.height < 0) {
this.height = 0;
}
this.fileProgressWrapper.style.height = this.height + "px";
}
if (this.height > 0 || this.opacity > 0) {
var oSelf = this;
this.setTimer(setTimeout(function () {
oSelf.disappear();
}, rate));
} else {
this.fileProgressWrapper.style.display = "none";
this.setTimer(null);
}
};
|
108wo
|
statics/js/swfupload/fileprogress.js
|
JavaScript
|
asf20
| 6,050
|
function att_show(serverData,file)
{
var serverData = serverData.replace(/<div.*?<\/div>/g,'');
var data = serverData.split(',');
var id = data[0];
var src = data[1];
var ext = data[2];
var filename = data[3];
if(id == 0) {
alert(src)
return false;
}
if(ext == 1) {
var img = '<a href="javascript:;" onclick="javascript:att_cancel(this,'+id+',\'upload\')" class="on"><div class="icon"></div><img src="'+src+'" width="80" imgid="'+id+'" path="'+src+'" title="'+filename+'"/></a>';
} else {
var img = '<a href="javascript:;" onclick="javascript:att_cancel(this,'+id+',\'upload\')" class="on"><div class="icon"></div><img src="statics/images/ext/'+ext+'.png" width="80" imgid="'+id+'" path="'+src+'" title="'+filename+'"/></a>';
}
$.get('index.php?m=attachment&c=attachments&a=swfupload_json&aid='+id+'&src='+src+'&filename='+filename);
$('#fsUploadProgress').append('<li><div id="attachment_'+id+'" class="img-wrap"></div></li>');
$('#attachment_'+id).html(img);
$('#att-status').append('|'+src);
$('#att-name').append('|'+filename);
}
function att_insert(obj,id)
{
var uploadfile = $("#attachment_"+id+"> img").attr('path');
$('#att-status').append('|'+uploadfile);
}
function att_cancel(obj,id,source){
var src = $(obj).children("img").attr("path");
var filename = $(obj).children("img").attr("title");
if($(obj).hasClass('on')){
$(obj).removeClass("on");
var imgstr = $("#att-status").html();
var length = $("a[class='on']").children("img").length;
var strs = filenames = '';
for(var i=0;i<length;i++){
strs += '|'+$("a[class='on']").children("img").eq(i).attr('path');
filenames += '|'+$("a[class='on']").children("img").eq(i).attr('title');
}
$('#att-status').html(strs);
$('#att-name').html(filenames);
if(source=='upload') $('#att-status-del').append('|'+id);
} else {
$(obj).addClass("on");
$('#att-status').append('|'+src);
$('#att-name').append('|'+filename);
var imgstr_del = $("#att-status-del").html();
var imgstr_del_obj = $("a[class!='on']").children("img")
var length_del = imgstr_del_obj.length;
var strs_del='';
for(var i=0;i<length_del;i++){strs_del += '|'+imgstr_del_obj.eq(i).attr('imgid');}
if(source=='upload') $('#att-status-del').html(strs_del);
}
}
//swfupload functions
function fileDialogStart() {
/* I don't need to do anything here */
}
function fileQueued(file) {
if(file!= null){
try {
var progress = new FileProgress(file, this.customSettings.progressTarget);
progress.toggleCancel(true, this);
} catch (ex) {
this.debug(ex);
}
}
}
function fileDialogComplete(numFilesSelected, numFilesQueued)
{
try {
if (this.getStats().files_queued > 0) {
document.getElementById(this.customSettings.cancelButtonId).disabled = false;
}
/* I want auto start and I can do that here */
//this.startUpload();
} catch (ex) {
this.debug(ex);
}
}
function uploadStart(file)
{
var progress = new FileProgress(file, this.customSettings.progressTarget);
progress.setStatus("正在上传请稍后...");
return true;
}
function uploadProgress(file, bytesLoaded, bytesTotal)
{
var percent = Math.ceil((bytesLoaded / bytesTotal) * 100);
var progress = new FileProgress(file, this.customSettings.progressTarget);
progress.setProgress(percent);
progress.setStatus("正在上传("+percent+" %)请稍后...");
}
function uploadSuccess(file, serverData)
{
att_show(serverData,file);
var progress = new FileProgress(file, this.customSettings.progressTarget);
progress.setComplete();
progress.setStatus("文件上传成功");
}
function uploadComplete(file)
{
if (this.getStats().files_queued > 0)
{
this.startUpload();
}
}
function uploadError(file, errorCode, message) {
var msg;
switch (errorCode)
{
case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:
msg = "上传错误: " + message;
break;
case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:
msg = "上传错误";
break;
case SWFUpload.UPLOAD_ERROR.IO_ERROR:
msg = "服务器 I/O 错误";
break;
case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:
msg = "服务器安全认证错误";
break;
case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:
msg = "附件安全检测失败,上传终止";
break;
case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:
msg = '上传取消';
break;
case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:
msg = '上传终止';
break;
case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:
msg = '单次上传文件数限制为 '+swfu.settings.file_upload_limit+' 个';
break;
default:
msg = message;
break;
}
var progress = new FileProgress(file,this.customSettings.progressTarget);
progress.setError();
progress.setStatus(msg);
}
function fileQueueError(file, errorCode, message)
{
var errormsg;
switch (errorCode) {
case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:
errormsg = "请不要上传空文件";
break;
case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED:
errormsg = "队列文件数量超过设定值";
break;
case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:
errormsg = "文件尺寸超过设定值";
break;
case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:
errormsg = "文件类型不合法";
default:
errormsg = '上传错误,请与管理员联系!';
break;
}
var progress = new FileProgress('file',this.customSettings.progressTarget);
progress.setError();
progress.setStatus(errormsg);
}
|
108wo
|
statics/js/swfupload/handlers.js
|
JavaScript
|
asf20
| 5,548
|
var SWFUpload;
if (SWFUpload == undefined) {
SWFUpload = function (settings) {
this.initSWFUpload(settings);
};
}
SWFUpload.prototype.initSWFUpload = function (settings) {
try {
this.customSettings = {}; // A container where developers can place their own settings associated with this instance.
this.settings = settings;
this.eventQueue = [];
this.movieName = "SWFUpload_" + SWFUpload.movieCount++;
this.movieElement = null;
// Setup global control tracking
SWFUpload.instances[this.movieName] = this;
// Load the settings. Load the Flash movie.
this.initSettings();
this.loadFlash();
this.displayDebugInfo();
} catch (ex) {
delete SWFUpload.instances[this.movieName];
throw ex;
}
};
/* *************** */
/* Static Members */
/* *************** */
SWFUpload.instances = {};
SWFUpload.movieCount = 0;
SWFUpload.version = "2.2.0 2009-03-25";
SWFUpload.QUEUE_ERROR = {
QUEUE_LIMIT_EXCEEDED : -100,
FILE_EXCEEDS_SIZE_LIMIT : -110,
ZERO_BYTE_FILE : -120,
INVALID_FILETYPE : -130
};
SWFUpload.UPLOAD_ERROR = {
HTTP_ERROR : -200,
MISSING_UPLOAD_URL : -210,
IO_ERROR : -220,
SECURITY_ERROR : -230,
UPLOAD_LIMIT_EXCEEDED : -240,
UPLOAD_FAILED : -250,
SPECIFIED_FILE_ID_NOT_FOUND : -260,
FILE_VALIDATION_FAILED : -270,
FILE_CANCELLED : -280,
UPLOAD_STOPPED : -290
};
SWFUpload.FILE_STATUS = {
QUEUED : -1,
IN_PROGRESS : -2,
ERROR : -3,
COMPLETE : -4,
CANCELLED : -5
};
SWFUpload.BUTTON_ACTION = {
SELECT_FILE : -100,
SELECT_FILES : -110,
START_UPLOAD : -120
};
SWFUpload.CURSOR = {
ARROW : -1,
HAND : -2
};
SWFUpload.WINDOW_MODE = {
WINDOW : "window",
TRANSPARENT : "transparent",
OPAQUE : "opaque"
};
// Private: takes a URL, determines if it is relative and converts to an absolute URL
// using the current site. Only processes the URL if it can, otherwise returns the URL untouched
SWFUpload.completeURL = function(url) {
if (typeof(url) !== "string" || url.match(/^https?:\/\//i) || url.match(/^\//)) {
return url;
}
var currentURL = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ":" + window.location.port : "");
var indexSlash = window.location.pathname.lastIndexOf("/");
if (indexSlash <= 0) {
path = "/";
} else {
path = window.location.pathname.substr(0, indexSlash) + "/";
}
return /*currentURL +*/ path + url;
};
/* ******************** */
/* Instance Members */
/* ******************** */
// Private: initSettings ensures that all the
// settings are set, getting a default value if one was not assigned.
SWFUpload.prototype.initSettings = function () {
this.ensureDefault = function (settingName, defaultValue) {
this.settings[settingName] = (this.settings[settingName] == undefined) ? defaultValue : this.settings[settingName];
};
// Upload backend settings
this.ensureDefault("upload_url", "");
this.ensureDefault("preserve_relative_urls", false);
this.ensureDefault("file_post_name", "Filedata");
this.ensureDefault("post_params", {});
this.ensureDefault("use_query_string", false);
this.ensureDefault("requeue_on_error", false);
this.ensureDefault("http_success", []);
this.ensureDefault("assume_success_timeout", 0);
// File Settings
this.ensureDefault("file_types", "*.*");
this.ensureDefault("file_types_description", "All Files");
this.ensureDefault("file_size_limit", 0); // Default zero means "unlimited"
this.ensureDefault("file_upload_limit", 0);
this.ensureDefault("file_queue_limit", 0);
// Flash Settings
this.ensureDefault("flash_url", "swfupload.swf");
this.ensureDefault("prevent_swf_caching", true);
// Button Settings
this.ensureDefault("button_image_url", "");
this.ensureDefault("button_width", 1);
this.ensureDefault("button_height", 1);
this.ensureDefault("button_text", "");
this.ensureDefault("button_text_style", "color: #000000; font-size: 16pt;");
this.ensureDefault("button_text_top_padding", 0);
this.ensureDefault("button_text_left_padding", 0);
this.ensureDefault("button_action", SWFUpload.BUTTON_ACTION.SELECT_FILES);
this.ensureDefault("button_disabled", false);
this.ensureDefault("button_placeholder_id", "");
this.ensureDefault("button_placeholder", null);
this.ensureDefault("button_cursor", SWFUpload.CURSOR.ARROW);
this.ensureDefault("button_window_mode", SWFUpload.WINDOW_MODE.WINDOW);
// Debug Settings
this.ensureDefault("debug", false);
this.settings.debug_enabled = this.settings.debug; // Here to maintain v2 API
// Event Handlers
this.settings.return_upload_start_handler = this.returnUploadStart;
this.ensureDefault("swfupload_loaded_handler", null);
this.ensureDefault("file_dialog_start_handler", null);
this.ensureDefault("file_queued_handler", null);
this.ensureDefault("file_queue_error_handler", null);
this.ensureDefault("file_dialog_complete_handler", null);
this.ensureDefault("upload_start_handler", null);
this.ensureDefault("upload_progress_handler", null);
this.ensureDefault("upload_error_handler", null);
this.ensureDefault("upload_success_handler", null);
this.ensureDefault("upload_complete_handler", null);
this.ensureDefault("debug_handler", this.debugMessage);
this.ensureDefault("custom_settings", {});
// Other settings
this.customSettings = this.settings.custom_settings;
// Update the flash url if needed
if (!!this.settings.prevent_swf_caching) {
this.settings.flash_url = this.settings.flash_url + (this.settings.flash_url.indexOf("?") < 0 ? "?" : "&") + "preventswfcaching=" + new Date().getTime();
}
if (!this.settings.preserve_relative_urls) {
//this.settings.flash_url = SWFUpload.completeURL(this.settings.flash_url); // Don't need to do this one since flash doesn't look at it
this.settings.upload_url = SWFUpload.completeURL(this.settings.upload_url);
this.settings.button_image_url = SWFUpload.completeURL(this.settings.button_image_url);
}
delete this.ensureDefault;
};
// Private: loadFlash replaces the button_placeholder element with the flash movie.
SWFUpload.prototype.loadFlash = function () {
var targetElement, tempParent;
// Make sure an element with the ID we are going to use doesn't already exist
if (document.getElementById(this.movieName) !== null) {
throw "ID " + this.movieName + " is already in use. The Flash Object could not be added";
}
// Get the element where we will be placing the flash movie
targetElement = document.getElementById(this.settings.button_placeholder_id) || this.settings.button_placeholder;
if (targetElement == undefined) {
throw "Could not find the placeholder element: " + this.settings.button_placeholder_id;
}
// Append the container and load the flash
tempParent = document.createElement("div");
tempParent.innerHTML = this.getFlashHTML(); // Using innerHTML is non-standard but the only sensible way to dynamically add Flash in IE (and maybe other browsers)
targetElement.parentNode.replaceChild(tempParent.firstChild, targetElement);
// Fix IE Flash/Form bug
if (window[this.movieName] == undefined) {
window[this.movieName] = this.getMovieElement();
}
};
// Private: getFlashHTML generates the object tag needed to embed the flash in to the document
SWFUpload.prototype.getFlashHTML = function () {
// Flash Satay object syntax: http://www.alistapart.com/articles/flashsatay
return ['<object id="', this.movieName, '" type="application/x-shockwave-flash" data="', this.settings.flash_url, '" width="', this.settings.button_width, '" height="', this.settings.button_height, '" class="swfupload">',
'<param name="wmode" value="', this.settings.button_window_mode, '" />',
'<param name="movie" value="', this.settings.flash_url, '" />',
'<param name="quality" value="high" />',
'<param name="menu" value="false" />',
'<param name="allowScriptAccess" value="always" />',
'<param name="flashvars" value="' + this.getFlashVars() + '" />',
'</object>'].join("");
};
// Private: getFlashVars builds the parameter string that will be passed
// to flash in the flashvars param.
SWFUpload.prototype.getFlashVars = function () {
// Build a string from the post param object
var paramString = this.buildParamString();
var httpSuccessString = this.settings.http_success.join(",");
// Build the parameter string
return ["movieName=", encodeURIComponent(this.movieName),
"&uploadURL=", encodeURIComponent(this.settings.upload_url),
"&useQueryString=", encodeURIComponent(this.settings.use_query_string),
"&requeueOnError=", encodeURIComponent(this.settings.requeue_on_error),
"&httpSuccess=", encodeURIComponent(httpSuccessString),
"&assumeSuccessTimeout=", encodeURIComponent(this.settings.assume_success_timeout),
"&params=", encodeURIComponent(paramString),
"&filePostName=", encodeURIComponent(this.settings.file_post_name),
"&fileTypes=", encodeURIComponent(this.settings.file_types),
"&fileTypesDescription=", encodeURIComponent(this.settings.file_types_description),
"&fileSizeLimit=", encodeURIComponent(this.settings.file_size_limit),
"&fileUploadLimit=", encodeURIComponent(this.settings.file_upload_limit),
"&fileQueueLimit=", encodeURIComponent(this.settings.file_queue_limit),
"&debugEnabled=", encodeURIComponent(this.settings.debug_enabled),
"&buttonImageURL=", encodeURIComponent(this.settings.button_image_url),
"&buttonWidth=", encodeURIComponent(this.settings.button_width),
"&buttonHeight=", encodeURIComponent(this.settings.button_height),
"&buttonText=", encodeURIComponent(this.settings.button_text),
"&buttonTextTopPadding=", encodeURIComponent(this.settings.button_text_top_padding),
"&buttonTextLeftPadding=", encodeURIComponent(this.settings.button_text_left_padding),
"&buttonTextStyle=", encodeURIComponent(this.settings.button_text_style),
"&buttonAction=", encodeURIComponent(this.settings.button_action),
"&buttonDisabled=", encodeURIComponent(this.settings.button_disabled),
"&buttonCursor=", encodeURIComponent(this.settings.button_cursor)
].join("");
};
// Public: getMovieElement retrieves the DOM reference to the Flash element added by SWFUpload
// The element is cached after the first lookup
SWFUpload.prototype.getMovieElement = function () {
if (this.movieElement == undefined) {
this.movieElement = document.getElementById(this.movieName);
}
if (this.movieElement === null) {
throw "Could not find Flash element";
}
return this.movieElement;
};
// Private: buildParamString takes the name/value pairs in the post_params setting object
// and joins them up in to a string formatted "name=value&name=value"
SWFUpload.prototype.buildParamString = function () {
var postParams = this.settings.post_params;
var paramStringPairs = [];
if (typeof(postParams) === "object") {
for (var name in postParams) {
if (postParams.hasOwnProperty(name)) {
paramStringPairs.push(encodeURIComponent(name.toString()) + "=" + encodeURIComponent(postParams[name].toString()));
}
}
}
return paramStringPairs.join("&");
};
// Public: Used to remove a SWFUpload instance from the page. This method strives to remove
// all references to the SWF, and other objects so memory is properly freed.
// Returns true if everything was destroyed. Returns a false if a failure occurs leaving SWFUpload in an inconsistant state.
// Credits: Major improvements provided by steffen
SWFUpload.prototype.destroy = function () {
try {
// Make sure Flash is done before we try to remove it
this.cancelUpload(null, false);
// Remove the SWFUpload DOM nodes
var movieElement = null;
movieElement = this.getMovieElement();
if (movieElement && typeof(movieElement.CallFunction) === "unknown") { // We only want to do this in IE
// Loop through all the movie's properties and remove all function references (DOM/JS IE 6/7 memory leak workaround)
for (var i in movieElement) {
try {
if (typeof(movieElement[i]) === "function") {
movieElement[i] = null;
}
} catch (ex1) {}
}
// Remove the Movie Element from the page
try {
movieElement.parentNode.removeChild(movieElement);
} catch (ex) {}
}
// Remove IE form fix reference
window[this.movieName] = null;
// Destroy other references
SWFUpload.instances[this.movieName] = null;
delete SWFUpload.instances[this.movieName];
this.movieElement = null;
this.settings = null;
this.customSettings = null;
this.eventQueue = null;
this.movieName = null;
return true;
} catch (ex2) {
return false;
}
};
// Public: displayDebugInfo prints out settings and configuration
// information about this SWFUpload instance.
// This function (and any references to it) can be deleted when placing
// SWFUpload in production.
SWFUpload.prototype.displayDebugInfo = function () {
this.debug(
[
"---SWFUpload Instance Info---\n",
"Version: ", SWFUpload.version, "\n",
"Movie Name: ", this.movieName, "\n",
"Settings:\n",
"\t", "upload_url: ", this.settings.upload_url, "\n",
"\t", "flash_url: ", this.settings.flash_url, "\n",
"\t", "use_query_string: ", this.settings.use_query_string.toString(), "\n",
"\t", "requeue_on_error: ", this.settings.requeue_on_error.toString(), "\n",
"\t", "http_success: ", this.settings.http_success.join(", "), "\n",
"\t", "assume_success_timeout: ", this.settings.assume_success_timeout, "\n",
"\t", "file_post_name: ", this.settings.file_post_name, "\n",
"\t", "post_params: ", this.settings.post_params.toString(), "\n",
"\t", "file_types: ", this.settings.file_types, "\n",
"\t", "file_types_description: ", this.settings.file_types_description, "\n",
"\t", "file_size_limit: ", this.settings.file_size_limit, "\n",
"\t", "file_upload_limit: ", this.settings.file_upload_limit, "\n",
"\t", "file_queue_limit: ", this.settings.file_queue_limit, "\n",
"\t", "debug: ", this.settings.debug.toString(), "\n",
"\t", "prevent_swf_caching: ", this.settings.prevent_swf_caching.toString(), "\n",
"\t", "button_placeholder_id: ", this.settings.button_placeholder_id.toString(), "\n",
"\t", "button_placeholder: ", (this.settings.button_placeholder ? "Set" : "Not Set"), "\n",
"\t", "button_image_url: ", this.settings.button_image_url.toString(), "\n",
"\t", "button_width: ", this.settings.button_width.toString(), "\n",
"\t", "button_height: ", this.settings.button_height.toString(), "\n",
"\t", "button_text: ", this.settings.button_text.toString(), "\n",
"\t", "button_text_style: ", this.settings.button_text_style.toString(), "\n",
"\t", "button_text_top_padding: ", this.settings.button_text_top_padding.toString(), "\n",
"\t", "button_text_left_padding: ", this.settings.button_text_left_padding.toString(), "\n",
"\t", "button_action: ", this.settings.button_action.toString(), "\n",
"\t", "button_disabled: ", this.settings.button_disabled.toString(), "\n",
"\t", "custom_settings: ", this.settings.custom_settings.toString(), "\n",
"Event Handlers:\n",
"\t", "swfupload_loaded_handler assigned: ", (typeof this.settings.swfupload_loaded_handler === "function").toString(), "\n",
"\t", "file_dialog_start_handler assigned: ", (typeof this.settings.file_dialog_start_handler === "function").toString(), "\n",
"\t", "file_queued_handler assigned: ", (typeof this.settings.file_queued_handler === "function").toString(), "\n",
"\t", "file_queue_error_handler assigned: ", (typeof this.settings.file_queue_error_handler === "function").toString(), "\n",
"\t", "upload_start_handler assigned: ", (typeof this.settings.upload_start_handler === "function").toString(), "\n",
"\t", "upload_progress_handler assigned: ", (typeof this.settings.upload_progress_handler === "function").toString(), "\n",
"\t", "upload_error_handler assigned: ", (typeof this.settings.upload_error_handler === "function").toString(), "\n",
"\t", "upload_success_handler assigned: ", (typeof this.settings.upload_success_handler === "function").toString(), "\n",
"\t", "upload_complete_handler assigned: ", (typeof this.settings.upload_complete_handler === "function").toString(), "\n",
"\t", "debug_handler assigned: ", (typeof this.settings.debug_handler === "function").toString(), "\n"
].join("")
);
};
/* Note: addSetting and getSetting are no longer used by SWFUpload but are included
the maintain v2 API compatibility
*/
// Public: (Deprecated) addSetting adds a setting value. If the value given is undefined or null then the default_value is used.
SWFUpload.prototype.addSetting = function (name, value, default_value) {
if (value == undefined) {
return (this.settings[name] = default_value);
} else {
return (this.settings[name] = value);
}
};
// Public: (Deprecated) getSetting gets a setting. Returns an empty string if the setting was not found.
SWFUpload.prototype.getSetting = function (name) {
if (this.settings[name] != undefined) {
return this.settings[name];
}
return "";
};
// Private: callFlash handles function calls made to the Flash element.
// Calls are made with a setTimeout for some functions to work around
// bugs in the ExternalInterface library.
SWFUpload.prototype.callFlash = function (functionName, argumentArray) {
argumentArray = argumentArray || [];
var movieElement = this.getMovieElement();
var returnValue, returnString;
// Flash's method if calling ExternalInterface methods (code adapted from MooTools).
try {
returnString = movieElement.CallFunction('<invoke name="' + functionName + '" returntype="javascript">' + __flash__argumentsToXML(argumentArray, 0) + '</invoke>');
returnValue = eval(returnString);
} catch (ex) {
throw "Call to " + functionName + " failed";
}
// Unescape file post param values
if (returnValue != undefined && typeof returnValue.post === "object") {
returnValue = this.unescapeFilePostParams(returnValue);
}
return returnValue;
};
/* *****************************
-- Flash control methods --
Your UI should use these
to operate SWFUpload
***************************** */
// WARNING: this function does not work in Flash Player 10
// Public: selectFile causes a File Selection Dialog window to appear. This
// dialog only allows 1 file to be selected.
SWFUpload.prototype.selectFile = function () {
this.callFlash("SelectFile");
};
// WARNING: this function does not work in Flash Player 10
// Public: selectFiles causes a File Selection Dialog window to appear/ This
// dialog allows the user to select any number of files
// Flash Bug Warning: Flash limits the number of selectable files based on the combined length of the file names.
// If the selection name length is too long the dialog will fail in an unpredictable manner. There is no work-around
// for this bug.
SWFUpload.prototype.selectFiles = function () {
this.callFlash("SelectFiles");
};
// Public: startUpload starts uploading the first file in the queue unless
// the optional parameter 'fileID' specifies the ID
SWFUpload.prototype.startUpload = function (fileID) {
this.callFlash("StartUpload", [fileID]);
};
// Public: cancelUpload cancels any queued file. The fileID parameter may be the file ID or index.
// If you do not specify a fileID the current uploading file or first file in the queue is cancelled.
// If you do not want the uploadError event to trigger you can specify false for the triggerErrorEvent parameter.
SWFUpload.prototype.cancelUpload = function (fileID, triggerErrorEvent) {
if (triggerErrorEvent !== false) {
triggerErrorEvent = true;
}
this.callFlash("CancelUpload", [fileID, triggerErrorEvent]);
};
// Public: stopUpload stops the current upload and requeues the file at the beginning of the queue.
// If nothing is currently uploading then nothing happens.
SWFUpload.prototype.stopUpload = function () {
this.callFlash("StopUpload");
};
/* ************************
* Settings methods
* These methods change the SWFUpload settings.
* SWFUpload settings should not be changed directly on the settings object
* since many of the settings need to be passed to Flash in order to take
* effect.
* *********************** */
// Public: getStats gets the file statistics object.
SWFUpload.prototype.getStats = function () {
return this.callFlash("GetStats");
};
// Public: setStats changes the SWFUpload statistics. You shouldn't need to
// change the statistics but you can. Changing the statistics does not
// affect SWFUpload accept for the successful_uploads count which is used
// by the upload_limit setting to determine how many files the user may upload.
SWFUpload.prototype.setStats = function (statsObject) {
this.callFlash("SetStats", [statsObject]);
};
// Public: getFile retrieves a File object by ID or Index. If the file is
// not found then 'null' is returned.
SWFUpload.prototype.getFile = function (fileID) {
if (typeof(fileID) === "number") {
return this.callFlash("GetFileByIndex", [fileID]);
} else {
return this.callFlash("GetFile", [fileID]);
}
};
// Public: addFileParam sets a name/value pair that will be posted with the
// file specified by the Files ID. If the name already exists then the
// exiting value will be overwritten.
SWFUpload.prototype.addFileParam = function (fileID, name, value) {
return this.callFlash("AddFileParam", [fileID, name, value]);
};
// Public: removeFileParam removes a previously set (by addFileParam) name/value
// pair from the specified file.
SWFUpload.prototype.removeFileParam = function (fileID, name) {
this.callFlash("RemoveFileParam", [fileID, name]);
};
// Public: setUploadUrl changes the upload_url setting.
SWFUpload.prototype.setUploadURL = function (url) {
this.settings.upload_url = url.toString();
this.callFlash("SetUploadURL", [url]);
};
// Public: setPostParams changes the post_params setting
SWFUpload.prototype.setPostParams = function (paramsObject) {
this.settings.post_params = paramsObject;
this.callFlash("SetPostParams", [paramsObject]);
};
// Public: addPostParam adds post name/value pair. Each name can have only one value.
SWFUpload.prototype.addPostParam = function (name, value) {
this.settings.post_params[name] = value;
this.callFlash("SetPostParams", [this.settings.post_params]);
};
// Public: removePostParam deletes post name/value pair.
SWFUpload.prototype.removePostParam = function (name) {
delete this.settings.post_params[name];
this.callFlash("SetPostParams", [this.settings.post_params]);
};
// Public: setFileTypes changes the file_types setting and the file_types_description setting
SWFUpload.prototype.setFileTypes = function (types, description) {
this.settings.file_types = types;
this.settings.file_types_description = description;
this.callFlash("SetFileTypes", [types, description]);
};
// Public: setFileSizeLimit changes the file_size_limit setting
SWFUpload.prototype.setFileSizeLimit = function (fileSizeLimit) {
this.settings.file_size_limit = fileSizeLimit;
this.callFlash("SetFileSizeLimit", [fileSizeLimit]);
};
// Public: setFileUploadLimit changes the file_upload_limit setting
SWFUpload.prototype.setFileUploadLimit = function (fileUploadLimit) {
this.settings.file_upload_limit = fileUploadLimit;
this.callFlash("SetFileUploadLimit", [fileUploadLimit]);
};
// Public: setFileQueueLimit changes the file_queue_limit setting
SWFUpload.prototype.setFileQueueLimit = function (fileQueueLimit) {
this.settings.file_queue_limit = fileQueueLimit;
this.callFlash("SetFileQueueLimit", [fileQueueLimit]);
};
// Public: setFilePostName changes the file_post_name setting
SWFUpload.prototype.setFilePostName = function (filePostName) {
this.settings.file_post_name = filePostName;
this.callFlash("SetFilePostName", [filePostName]);
};
// Public: setUseQueryString changes the use_query_string setting
SWFUpload.prototype.setUseQueryString = function (useQueryString) {
this.settings.use_query_string = useQueryString;
this.callFlash("SetUseQueryString", [useQueryString]);
};
// Public: setRequeueOnError changes the requeue_on_error setting
SWFUpload.prototype.setRequeueOnError = function (requeueOnError) {
this.settings.requeue_on_error = requeueOnError;
this.callFlash("SetRequeueOnError", [requeueOnError]);
};
// Public: setHTTPSuccess changes the http_success setting
SWFUpload.prototype.setHTTPSuccess = function (http_status_codes) {
if (typeof http_status_codes === "string") {
http_status_codes = http_status_codes.replace(" ", "").split(",");
}
this.settings.http_success = http_status_codes;
this.callFlash("SetHTTPSuccess", [http_status_codes]);
};
// Public: setHTTPSuccess changes the http_success setting
SWFUpload.prototype.setAssumeSuccessTimeout = function (timeout_seconds) {
this.settings.assume_success_timeout = timeout_seconds;
this.callFlash("SetAssumeSuccessTimeout", [timeout_seconds]);
};
// Public: setDebugEnabled changes the debug_enabled setting
SWFUpload.prototype.setDebugEnabled = function (debugEnabled) {
this.settings.debug_enabled = debugEnabled;
this.callFlash("SetDebugEnabled", [debugEnabled]);
};
// Public: setButtonImageURL loads a button image sprite
SWFUpload.prototype.setButtonImageURL = function (buttonImageURL) {
if (buttonImageURL == undefined) {
buttonImageURL = "";
}
this.settings.button_image_url = buttonImageURL;
this.callFlash("SetButtonImageURL", [buttonImageURL]);
};
// Public: setButtonDimensions resizes the Flash Movie and button
SWFUpload.prototype.setButtonDimensions = function (width, height) {
this.settings.button_width = width;
this.settings.button_height = height;
var movie = this.getMovieElement();
if (movie != undefined) {
movie.style.width = width + "px";
movie.style.height = height + "px";
}
this.callFlash("SetButtonDimensions", [width, height]);
};
// Public: setButtonText Changes the text overlaid on the button
SWFUpload.prototype.setButtonText = function (html) {
this.settings.button_text = html;
this.callFlash("SetButtonText", [html]);
};
// Public: setButtonTextPadding changes the top and left padding of the text overlay
SWFUpload.prototype.setButtonTextPadding = function (left, top) {
this.settings.button_text_top_padding = top;
this.settings.button_text_left_padding = left;
this.callFlash("SetButtonTextPadding", [left, top]);
};
// Public: setButtonTextStyle changes the CSS used to style the HTML/Text overlaid on the button
SWFUpload.prototype.setButtonTextStyle = function (css) {
this.settings.button_text_style = css;
this.callFlash("SetButtonTextStyle", [css]);
};
// Public: setButtonDisabled disables/enables the button
SWFUpload.prototype.setButtonDisabled = function (isDisabled) {
this.settings.button_disabled = isDisabled;
this.callFlash("SetButtonDisabled", [isDisabled]);
};
// Public: setButtonAction sets the action that occurs when the button is clicked
SWFUpload.prototype.setButtonAction = function (buttonAction) {
this.settings.button_action = buttonAction;
this.callFlash("SetButtonAction", [buttonAction]);
};
// Public: setButtonCursor changes the mouse cursor displayed when hovering over the button
SWFUpload.prototype.setButtonCursor = function (cursor) {
this.settings.button_cursor = cursor;
this.callFlash("SetButtonCursor", [cursor]);
};
/* *******************************
Flash Event Interfaces
These functions are used by Flash to trigger the various
events.
All these functions a Private.
Because the ExternalInterface library is buggy the event calls
are added to a queue and the queue then executed by a setTimeout.
This ensures that events are executed in a determinate order and that
the ExternalInterface bugs are avoided.
******************************* */
SWFUpload.prototype.queueEvent = function (handlerName, argumentArray) {
// Warning: Don't call this.debug inside here or you'll create an infinite loop
if (argumentArray == undefined) {
argumentArray = [];
} else if (!(argumentArray instanceof Array)) {
argumentArray = [argumentArray];
}
var self = this;
if (typeof this.settings[handlerName] === "function") {
// Queue the event
this.eventQueue.push(function () {
this.settings[handlerName].apply(this, argumentArray);
});
// Execute the next queued event
setTimeout(function () {
self.executeNextEvent();
}, 0);
} else if (this.settings[handlerName] !== null) {
throw "Event handler " + handlerName + " is unknown or is not a function";
}
};
// Private: Causes the next event in the queue to be executed. Since events are queued using a setTimeout
// we must queue them in order to garentee that they are executed in order.
SWFUpload.prototype.executeNextEvent = function () {
// Warning: Don't call this.debug inside here or you'll create an infinite loop
var f = this.eventQueue ? this.eventQueue.shift() : null;
if (typeof(f) === "function") {
f.apply(this);
}
};
// Private: unescapeFileParams is part of a workaround for a flash bug where objects passed through ExternalInterface cannot have
// properties that contain characters that are not valid for JavaScript identifiers. To work around this
// the Flash Component escapes the parameter names and we must unescape again before passing them along.
SWFUpload.prototype.unescapeFilePostParams = function (file) {
var reg = /[$]([0-9a-f]{4})/i;
var unescapedPost = {};
var uk;
if (file != undefined) {
for (var k in file.post) {
if (file.post.hasOwnProperty(k)) {
uk = k;
var match;
while ((match = reg.exec(uk)) !== null) {
uk = uk.replace(match[0], String.fromCharCode(parseInt("0x" + match[1], 16)));
}
unescapedPost[uk] = file.post[k];
}
}
file.post = unescapedPost;
}
return file;
};
// Private: Called by Flash to see if JS can call in to Flash (test if External Interface is working)
SWFUpload.prototype.testExternalInterface = function () {
try {
return this.callFlash("TestExternalInterface");
} catch (ex) {
return false;
}
};
// Private: This event is called by Flash when it has finished loading. Don't modify this.
// Use the swfupload_loaded_handler event setting to execute custom code when SWFUpload has loaded.
SWFUpload.prototype.flashReady = function () {
// Check that the movie element is loaded correctly with its ExternalInterface methods defined
var movieElement = this.getMovieElement();
if (!movieElement) {
this.debug("Flash called back ready but the flash movie can't be found.");
return;
}
this.cleanUp(movieElement);
this.queueEvent("swfupload_loaded_handler");
};
// Private: removes Flash added fuctions to the DOM node to prevent memory leaks in IE.
// This function is called by Flash each time the ExternalInterface functions are created.
SWFUpload.prototype.cleanUp = function (movieElement) {
// Pro-actively unhook all the Flash functions
try {
if (this.movieElement && typeof(movieElement.CallFunction) === "unknown") { // We only want to do this in IE
this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)");
for (var key in movieElement) {
try {
if (typeof(movieElement[key]) === "function") {
movieElement[key] = null;
}
} catch (ex) {
}
}
}
} catch (ex1) {
}
// Fix Flashes own cleanup code so if the SWFMovie was removed from the page
// it doesn't display errors.
window["__flash__removeCallback"] = function (instance, name) {
try {
if (instance) {
instance[name] = null;
}
} catch (flashEx) {
}
};
};
/* This is a chance to do something before the browse window opens */
SWFUpload.prototype.fileDialogStart = function () {
this.queueEvent("file_dialog_start_handler");
};
/* Called when a file is successfully added to the queue. */
SWFUpload.prototype.fileQueued = function (file) {
file = this.unescapeFilePostParams(file);
this.queueEvent("file_queued_handler", file);
};
/* Handle errors that occur when an attempt to queue a file fails. */
SWFUpload.prototype.fileQueueError = function (file, errorCode, message) {
file = this.unescapeFilePostParams(file);
this.queueEvent("file_queue_error_handler", [file, errorCode, message]);
};
/* Called after the file dialog has closed and the selected files have been queued.
You could call startUpload here if you want the queued files to begin uploading immediately. */
SWFUpload.prototype.fileDialogComplete = function (numFilesSelected, numFilesQueued, numFilesInQueue) {
this.queueEvent("file_dialog_complete_handler", [numFilesSelected, numFilesQueued, numFilesInQueue]);
};
SWFUpload.prototype.uploadStart = function (file) {
file = this.unescapeFilePostParams(file);
this.queueEvent("return_upload_start_handler", file);
};
SWFUpload.prototype.returnUploadStart = function (file) {
var returnValue;
if (typeof this.settings.upload_start_handler === "function") {
file = this.unescapeFilePostParams(file);
returnValue = this.settings.upload_start_handler.call(this, file);
} else if (this.settings.upload_start_handler != undefined) {
throw "upload_start_handler must be a function";
}
// Convert undefined to true so if nothing is returned from the upload_start_handler it is
// interpretted as 'true'.
if (returnValue === undefined) {
returnValue = true;
}
returnValue = !!returnValue;
this.callFlash("ReturnUploadStart", [returnValue]);
};
SWFUpload.prototype.uploadProgress = function (file, bytesComplete, bytesTotal) {
file = this.unescapeFilePostParams(file);
this.queueEvent("upload_progress_handler", [file, bytesComplete, bytesTotal]);
};
SWFUpload.prototype.uploadError = function (file, errorCode, message) {
file = this.unescapeFilePostParams(file);
this.queueEvent("upload_error_handler", [file, errorCode, message]);
};
SWFUpload.prototype.uploadSuccess = function (file, serverData, responseReceived) {
file = this.unescapeFilePostParams(file);
this.queueEvent("upload_success_handler", [file, serverData, responseReceived]);
};
SWFUpload.prototype.uploadComplete = function (file) {
file = this.unescapeFilePostParams(file);
this.queueEvent("upload_complete_handler", file);
};
/* Called by SWFUpload JavaScript and Flash functions when debug is enabled. By default it writes messages to the
internal debug console. You can override this event and have messages written where you want. */
SWFUpload.prototype.debug = function (message) {
this.queueEvent("debug_handler", message);
};
/* **********************************
Debug Console
The debug console is a self contained, in page location
for debug message to be sent. The Debug Console adds
itself to the body if necessary.
The console is automatically scrolled as messages appear.
If you are using your own debug handler or when you deploy to production and
have debug disabled you can remove these functions to reduce the file size
and complexity.
********************************** */
// Private: debugMessage is the default debug_handler. If you want to print debug messages
// call the debug() function. When overriding the function your own function should
// check to see if the debug setting is true before outputting debug information.
SWFUpload.prototype.debugMessage = function (message) {
if (this.settings.debug) {
var exceptionMessage, exceptionValues = [];
// Check for an exception object and print it nicely
if (typeof message === "object" && typeof message.name === "string" && typeof message.message === "string") {
for (var key in message) {
if (message.hasOwnProperty(key)) {
exceptionValues.push(key + ": " + message[key]);
}
}
exceptionMessage = exceptionValues.join("\n") || "";
exceptionValues = exceptionMessage.split("\n");
exceptionMessage = "EXCEPTION: " + exceptionValues.join("\nEXCEPTION: ");
SWFUpload.Console.writeLine(exceptionMessage);
} else {
SWFUpload.Console.writeLine(message);
}
}
};
SWFUpload.Console = {};
SWFUpload.Console.writeLine = function (message) {
var console, documentForm;
try {
console = document.getElementById("SWFUpload_Console");
if (!console) {
documentForm = document.createElement("form");
document.getElementsByTagName("body")[0].appendChild(documentForm);
console = document.createElement("textarea");
console.id = "SWFUpload_Console";
console.style.fontFamily = "monospace";
console.setAttribute("wrap", "off");
console.wrap = "off";
console.style.overflow = "auto";
console.style.width = "700px";
console.style.height = "350px";
console.style.margin = "5px";
documentForm.appendChild(console);
}
console.value += message + "\n";
console.scrollTop = console.scrollHeight - console.clientHeight;
} catch (ex) {
alert("Exception: " + ex.name + " Message: " + ex.message);
}
};
|
108wo
|
statics/js/swfupload/unpack_swfupload.js
|
JavaScript
|
asf20
| 38,075
|
.attachment_show {float:left;color:#000;text-align:center;width:99px;}
.attachment_show li {line-height:180%;word-wrap:break-word;word-break:break-all;}
.attachment_show img {padding:3px;margin-bottom:3px;width:60px;height:60px;background:#fff;border:1px solid #dfdfdf;}
.progressWrapper {
overflow: hidden;
}
.progressContainer {
margin: 5px;
padding: 4px;
border: solid 1px #E8E8E8;
background-color: #F7F7F7;
overflow: hidden;
}
/* Message */
.message {
margin: 1em 0;
padding: 10px 20px;
border: solid 1px #FFDD99;
background-color: #FFFFCC;
overflow: hidden;
}
/* Error */
.red {
border: solid 1px #B50000;
background-color: #FFEBEB;
}
/* Current */
.green {
border: solid 1px #DDF0DD;
background-color: #EBFFEB;
}
/* Complete */
.blue {
border: solid 1px #CEE2F2;
}
.progressName {
font-size: 8pt;
font-weight: 700;
color: #555;
width: 200px;
height: 14px;
text-align: left;
white-space: nowrap;
overflow: hidden;
height:26px; line-height:26px; float:left;
}
.progresshidden {
display:none;
}
.progressBarComplete,
.progressBarInProgress,
.progressBarComplete,
.progressBarError {
font-size: 0;
width: 0%;
height: 2px;
background-color: blue;
margin-top: 2px;
}
.progressBarComplete {
width: 100%;
background-color: green;
visibility: hidden;
}
.progressBarError {
width: 100%;
background-color: red;
visibility: hidden;
}
.progressBarStatus {
width: 200px;
font-size: 12px;;
font-family: Arial;
text-align: left;
white-space: nowrap; float:left; height:24px; line-height:24px
}
a.progressCancel {
font-size: 0;
display: block;
height: 16px;
width: 16px;
background-image: url(images/cross.png);
background-repeat: no-repeat;
background-position:0 4px ;
float: right;
}
a.progressCancel:hover {
background-position:0 bottom ;
}
/* -- SWFUpload Object Styles ------------------------------- */
.swfupload {
vertical-align: top;
}
#btupload,.addnew{background: url(images/swfBnt.png) no-repeat; float:left; margin-right:10px;width:75px; height:28px; line-height:28px;font-weight:700; color:#fff}
#btupload{ vertical-align:middle;border:none;cursor: hand;!important;cursor: pointer }
.addnew{background-position: left bottom;}
/*附件列表样式*/
.img-wrap{border:1px solid #eee;text-align:center;overflow:hidden;background:#fff}
.img-wrap a{display:table-cell;vertical-align:middle;text-align:center;*display:block;}
.attachment-list{overflow:hidden}
.attachment-list li{width:25%;*width:24.99%; overflow:hidden; padding:10px 0; float:left}
.attachment-list .img-wrap{width:104px;height:94px;overflow:hidden; margin:auto;}
.attachment-list .img-wrap {text-align:center;overflow:hidden; background:#fff; border:none; position:relative}
.attachment-list .img-wrap a{display:table-cell;vertical-align:middle;text-align:center;*display:block;border:1px solid #eee;width:101px; height:91px;*font-size:67px;}
.attachment-list .img-wrap a:hover,.attachment-list .img-wrap a.on{border-color:#d0def1; background:#f3f6fa}
.attachment-list .img-wrap a.off .icon{background: url(images/off.png) no-repeat; height:17px;bottom:5px;*bottom:3px; right:3px; z-index:100; position: absolute; overflow:hidden; width:98px;}
.attachment-list .img-wrap a.on .icon{background: url(../../images/msg_bg.png) no-repeat left -249px;width:16px; height:18px;bottom:4px;*bottom:2px; right:3px; z-index:100; position: absolute; overflow:hidden}
|
108wo
|
statics/js/swfupload/swfupload.css
|
CSS
|
asf20
| 3,506
|
function flashupload(uploadid, name, textareaid, funcName, args, module, catid, authkey) {
var args = args ? '&args='+args : '';
var setting = '&module='+module+'&catid='+catid+'&authkey='+authkey;
window.top.art.dialog({title:name,id:uploadid,iframe:'index.php?m=attachment&c=attachments&a=swfupload'+args+setting,width:'500',height:'420'}, function(){ if(funcName) {funcName.apply(this,[uploadid,textareaid]);}else {submit_ckeditor(uploadid,textareaid);}}, function(){window.top.art.dialog({id:uploadid}).close()});
}
function submit_ckeditor(uploadid,textareaid){
var d = window.top.art.dialog({id:uploadid}).data.iframe;
var in_content = d.$("#att-status").html();
var del_content = d.$("#att-status-del").html();
insert2editor(textareaid,in_content,del_content)
}
function submit_images(uploadid,returnid){
var d = window.top.art.dialog({id:uploadid}).data.iframe;
var in_content = d.$("#att-status").html().substring(1);
var in_content = in_content.split('|');
IsImg(in_content[0]) ? $('#'+returnid).attr("value",in_content[0]) : alert('选择的类型必须为图片类型');
}
function submit_attachment(uploadid,returnid){
var d = window.top.art.dialog({id:uploadid}).data.iframe;
var in_content = d.$("#att-status").html().substring(1);
var in_content = in_content.split('|');
$('#'+returnid).attr("value",in_content[0]);
}
function submit_files(uploadid,returnid){
var d = window.top.art.dialog({id:uploadid}).data.iframe;
var in_content = d.$("#att-status").html().substring(1);
var in_content = in_content.split('|');
var new_filepath = in_content[0].replace(uploadurl,'/');
$('#'+returnid).attr("value",new_filepath);
}
function insert2editor(id,in_content,del_content) {
if(in_content == '') {return false;}
var data = in_content.substring(1).split('|');
var img = '';
for (var n in data) {
img += IsImg(data[n]) ? '<img src="'+data[n]+'" /><br />' : (IsSwf(data[n]) ? '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="quality" value="high" /><param name="movie" value="'+data[n]+'" /><embed pluginspage="http://www.macromedia.com/go/getflashplayer" quality="high" src="'+data[n]+'" type="application/x-shockwave-flash" width="460"></embed></object>' :'<a href="'+data[n]+'" />'+data[n]+'</a><br />') ;
}
$.get("index.php?m=attachment&c=attachments&a=swfdelete",{data: del_content},function(data){});
CKEDITOR.instances[id].insertHtml(img);
}
function IsImg(url){
var sTemp;
var b=false;
var opt="jpg|gif|png|bmp|jpeg";
var s=opt.toUpperCase().split("|");
for (var i=0;i<s.length ;i++ ){
sTemp=url.substr(url.length-s[i].length-1);
sTemp=sTemp.toUpperCase();
s[i]="."+s[i];
if (s[i]==sTemp){
b=true;
break;
}
}
return b;
}
function IsSwf(url){
var sTemp;
var b=false;
var opt="swf";
var s=opt.toUpperCase().split("|");
for (var i=0;i<s.length ;i++ ){
sTemp=url.substr(url.length-s[i].length-1);
sTemp=sTemp.toUpperCase();
s[i]="."+s[i];
if (s[i]==sTemp){
b=true;
break;
}
}
return b;
}
|
108wo
|
statics/js/swfupload/swf2ckeditor.js
|
JavaScript
|
asf20
| 3,245
|
/*
* sGallery 1.0 - simple gallery with jQuery
* made by bujichong 2009-11-25
* 作者:不羁虫 2009-11-25
* http://hi.baidu.com/bujichong/
* 欢迎交流转载,但请尊重作者劳动成果,标明插件来源及作者
*/
(function ($) {
$.fn.sGallery = function (o) {
return new $sG(this, o);
//alert('do');
};
var settings = {
thumbObj:null,//预览对象
titleObj:null,//标题
botLast:null,//按钮上一个
botNext:null,//按钮下一个
thumbNowClass:'now',//预览对象当前的class,默认为now
slideTime:800,//平滑过渡时间
autoChange:true,//是否自动切换
changeTime:5000,//自动切换时间
delayTime:100//鼠标经过时反应的延迟时间
};
$.sGalleryLong = function(e, o) {
this.options = $.extend({}, settings, o || {});
var _self = $(e);
var set = this.options;
var thumb;
var size = _self.size();
var nowIndex = 0; //定义全局指针
var index;//定义全局指针
var startRun;//预定义自动运行参数
var delayRun;//预定义延迟运行参数
//初始化
_self.eq(0).show();
//主切换函数
function fadeAB () {
if (nowIndex != index) {
if (set.thumbObj!=null) {
$(set.thumbObj).removeClass().eq(index).addClass(set.thumbNowClass);}
_self.eq(nowIndex).stop(false,true).fadeOut(set.slideTime);
_self.eq(index).stop(true,true).fadeIn(set.slideTime);
$(set.titleObj).eq(nowIndex).hide();//新增加title
$(set.titleObj).eq(index).show();//新增加title
nowIndex = index;
if (set.autoChange==true) {
clearInterval(startRun);//重置自动切换函数
startRun = setInterval(runNext,set.changeTime);}
}
}
//切换到下一个
function runNext() {
index = (nowIndex+1)%size;
fadeAB();
}
//点击任一图片
if (set.thumbObj!=null) {
thumb = $(set.thumbObj);
//初始化
thumb.eq(0).addClass(set.thumbNowClass);
thumb.bind("mousemove",function(event){
index = thumb.index($(this));
fadeAB();
delayRun = setTimeout(fadeAB,set.delayTime);
clearTimeout(delayRun);
event.stopPropagation();
})
}
//点击上一个
if (set.botNext!=null) {
var botNext = $(set.botNext);
botNext.mousemove(function () {
runNext();
return false;
});
}
//点击下一个
if (set.botLast!=null) {
var botLast = $(set.botLast);
botLast.mousemove(function () {
index = (nowIndex+size-1)%size;
fadeAB();
return false;
});
}
//自动运行
if (set.autoChange==true) {
startRun = setInterval(runNext,set.changeTime);
}
}
var $sG = $.sGalleryLong;
})(jQuery);
function slide(Name,Class,Width,Height,fun){
$(Name).width(Width);
$(Name).height(Height);
if(fun == true){
$(Name).append('<div class="title-bg"></div><div class="title"></div><div class="change"></div>')
var atr = $(Name+' div.changeDiv a');
var sum = atr.length;
for(i=1;i<=sum;i++){
var title = atr.eq(i-1).attr("title");
var href = atr.eq(i-1).attr("href");
$(Name+' .change').append('<i>'+i+'</i>');
$(Name+' .title').append('<a href="'+href+'">'+title+'</a>');
}
$(Name+' .change i').eq(0).addClass('cur');
}
$(Name+' div.changeDiv a').sGallery({//对象指向层,层内包含图片及标题
titleObj:Name+' div.title a',
thumbObj:Name+' .change i',
thumbNowClass:Class
});
$(Name+" .title-bg").width(Width);
}
//缩略图
jQuery.fn.LoadImage=function(scaling,width,height,loadpic){
if(loadpic==null)loadpic="../images/msg_img/loading.gif";
return this.each(function(){
var t=$(this);
var src=$(this).attr("src")
var img=new Image();
img.src=src;
//自动缩放图片
var autoScaling=function(){
if(scaling){
if(img.width>0 && img.height>0){
if(img.width/img.height>=width/height){
if(img.width>width){
t.width(width);
t.height((img.height*width)/img.width);
}else{
t.width(img.width);
t.height(img.height);
}
}
else{
if(img.height>height){
t.height(height);
t.width((img.width*height)/img.height);
}else{
t.width(img.width);
t.height(img.height);
}
}
}
}
}
//处理ff下会自动读取缓存图片
if(img.complete){
autoScaling();
return;
}
$(this).attr("src","");
var loading=$("<img alt=\"加载中...\" title=\"图片加载中...\" src=\""+loadpic+"\" />");
t.hide();
t.after(loading);
$(img).load(function(){
autoScaling();
loading.remove();
t.attr("src",this.src);
t.show();
//$('.photo_prev a,.photo_next a').height($('#big-pic img').height());
});
});
}
//向上滚动代码
function startmarquee(elementID,h,n,speed,delay){
var t = null;
var box = '#' + elementID;
$(box).hover(function(){
clearInterval(t);
}, function(){
t = setInterval(start,delay);
}).trigger('mouseout');
function start(){
$(box).children('ul:first').animate({marginTop: '-='+h},speed,function(){
$(this).css({marginTop:'0'}).find('li').slice(0,n).appendTo(this);
})
}
}
//TAB切换
function SwapTab(name,title,content,Sub,cur){
$(name+' '+title).mouseover(function(){
$(this).addClass(cur).siblings().removeClass(cur);
$(content+" > "+Sub).eq($(name+' '+title).index(this)).show().siblings().hide();
});
}
|
108wo
|
statics/js/jquery.sGallery.js
|
JavaScript
|
asf20
| 5,606
|
.ContentPage{
background-color:#FDF8E3;
border-bottom:1px dashed #CCC;
padding:3px 10px
}
*{white-space: pre-wrap; /* css-3 */white-space: -moz-pre-wrap; /* Mozilla, since 1999 */white-space: -pre-wrap; /* Opera 4-6 */white-space: -o-pre-wrap; /* Opera 7 */ word-wrap: break-word; /* Internet Explorer 5.5+ */}
|
108wo
|
statics/js/ckeditor/contents.css
|
CSS
|
asf20
| 318
|
/*
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.editorConfig = function( config )
{
// Define changes to default configuration here. For example:
// config.language = 'fr';
config.uiColor = '#f7f5f4';
config.width = '';
config.removePlugins = 'elementspath,scayt';
config.disableNativeSpellChecker = false;
config.resize_dir = 'vertical';
config.keystrokes =[[ CKEDITOR.CTRL + 13 /*Enter*/, 'maximize' ]];
config.extraPlugins = 'capture';
};
//CKEDITOR.plugins.load('pgrfilemanager');
function insert_page(editorid)
{
var editor = CKEDITOR.instances[editorid];
editor.insertHtml('[page]');
if($('#paginationtype').val()) {
$('#paginationtype').val(2);
$('#paginationtype').css("color","red");
}
}
function insert_page_title(editorid,insertdata)
{
if(insertdata)
{
var editor = CKEDITOR.instances[editorid];
var data = editor.getData();
var page_title_value = $("#page_title_value").val();
if(page_title_value=='')
{
$("#msg_page_title_value").html("<font color='red'>请输入子标题</font>");
return false;
}
page_title_value = '[page]'+page_title_value+'[/page]';
editor.insertHtml(page_title_value);
$("#page_title_value").val('');
$("#msg_page_title_value").html('');
if($('#paginationtype').val()) {
$('#paginationtype').val(2);
$('#paginationtype').css("color","red");
}
}
else
{
$("#page_title_div").slideDown("fast");
}
}
var objid = MM_objid = key = 0;
function file_list(fn,url,obj) {
$('#MM_file_list_editor1').append('<div id="MM_file_list_'+fn+'">'+url+' <a href=\'#\' onMouseOver=\'javascript:FilePreview("'+url+'", 1);\' onMouseout=\'javascript:FilePreview("", 0);\'>查看</a> | <a href="javascript:insertHTMLToEditor(\'<img src='+url+'>\',\''+fn+'\')">插入</A> | <a href="javascript:del_file(\''+fn+'\',\''+url+'\','+fn+')">删除</a><br>');
}
|
108wo
|
statics/js/ckeditor/config.js
|
JavaScript
|
asf20
| 1,999
|
/*
Copyright (c) 2005-2011, PHPCMS V9- Rocing Chan. All rights reserved.
For licensing, see http://www.phpcms.cn.com/license
*/
(function()
{
var loadcapture =
{
exec : function( editor )
{
var pluginNameExt = 'capture';
ext_editor = editor.name;
if(CKEDITOR.env.ie) {
try{
//var t = new ActiveXObject("WEBCAPTURECTRL.WebCaptureCtrlCtrl.1");
return document.getElementById("PC_Capture").ShowCaptureWindow();
} catch(e){
CKEDITOR.dialog.add(pluginNameExt, function( api )
{
var dialogDefinition =
{
title : editor.lang.capture.notice,
minWidth : 350,
minHeight : 80,
contents : [
{
id : 'tab1',
label : 'Label',
title : 'Title',
padding : 0,
elements :
[
{
type : 'html',
html : editor.lang.capture.notice_tips
}
]
}
],
buttons : [ CKEDITOR.dialog.cancelButton ]
};
return dialogDefinition;
});
editor.addCommand(pluginNameExt, new CKEDITOR.dialogCommand(pluginNameExt));
editor.execCommand(pluginNameExt);
}
} else {
alert(editor.lang.capture.unsport_tips);
return false;
}
}
};
var pluginName = 'capture';
CKEDITOR.plugins.add('capture',
{
lang: ['zh-cn'],
init: function(editor)
{
if ( CKEDITOR.env.ie ) {
editor.addCommand(pluginName, loadcapture);
editor.ui.addButton('Capture',
{
label: editor.lang.capture.title,
command: pluginName,
icon: CKEDITOR.plugins.getPath('capture') + 'capture.png'
});
}
}
});
})();
function pc_screen(param){
var oEditor = CKEDITOR.instances[ext_editor];
var data = oEditor.getData();
var imgtag = "<img src="+param+"><BR>";
oEditor.insertHtml(imgtag);
}
|
108wo
|
statics/js/ckeditor/plugins/capture/plugin.js
|
JavaScript
|
asf20
| 1,949
|
/*
Copyright (c) 2003-2010, PHPCMS - PHPCMS TEAM. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('capture','zh-cn',
{
capture:
{
title:'PHPCMS在线截图',
notice:'PHPCMS在线截图控件安装',
notice_tips:'<p id="Capture">你还没有安装截图插件!<br />请使用 <a href="http://www.phpcms.cn/capture/" id="CaptureDownWeb" target="_blank">在线安装</a><font>(荐)</font> 或者 <a href="http://www.phpcms.cn/capture/capture.exe" id="CaptureDown" target="_blank">立即下载</a> 方式来安装插件。</p>',
unsport_tips:'对不起,本功能暂时只支持IE浏览器'
}
}
);
|
108wo
|
statics/js/ckeditor/plugins/capture/lang/zh-cn.js
|
JavaScript
|
asf20
| 692
|
/*
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.add('uicolor',{requires:['dialog'],lang:['en'],init:function(a){if(CKEDITOR.env.ie6Compat)return;a.addCommand('uicolor',new CKEDITOR.dialogCommand('uicolor'));a.ui.addButton('UIColor',{label:a.lang.uicolor.title,command:'uicolor',icon:this.path+'uicolor.gif'});CKEDITOR.dialog.add('uicolor',this.path+'dialogs/uicolor.js');CKEDITOR.scriptLoader.load(CKEDITOR.getUrl('plugins/uicolor/yui/yui.js'));a.element.getDocument().appendStyleSheet(CKEDITOR.getUrl('plugins/uicolor/yui/assets/yui.css'));}});
|
108wo
|
statics/js/ckeditor/plugins/uicolor/plugin.js
|
JavaScript
|
asf20
| 670
|
/*
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('uicolor','en',{uicolor:{title:'UI Color Picker',preview:'Live preview',config:'Paste this string into your config.js file',predefined:'Predefined color sets'}});
|
108wo
|
statics/js/ckeditor/plugins/uicolor/lang/en.js
|
JavaScript
|
asf20
| 343
|
/*
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
|
108wo
|
statics/js/ckeditor/plugins/dialog/dialogDefinition.js
|
JavaScript
|
asf20
| 152
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<!--
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript">
function doLoadScript( url )
{
if ( !url )
return false ;
var s = document.createElement( "script" ) ;
s.type = "text/javascript" ;
s.src = url ;
document.getElementsByTagName( "head" )[ 0 ].appendChild( s ) ;
return true ;
}
var opener;
function tryLoad()
{
opener = window.parent;
// get access to global parameters
var oParams = window.opener.oldFramesetPageParams;
// make frameset rows string prepare
var sFramesetRows = ( parseInt( oParams.firstframeh, 10 ) || '30') + ",*," + ( parseInt( oParams.thirdframeh, 10 ) || '150' ) + ',0' ;
document.getElementById( 'itFrameset' ).rows = sFramesetRows ;
// dynamic including init frames and crossdomain transport code
// from config sproxy_js_frameset url
var addScriptUrl = oParams.sproxy_js_frameset ;
doLoadScript( addScriptUrl ) ;
}
</script>
</head>
<frameset id="itFrameset" onload="tryLoad();" border="0" rows="30,*,*,0">
<frame scrolling="no" framespacing="0" frameborder="0" noresize="noresize" marginheight="0" marginwidth="2" src="" name="navbar"></frame>
<frame scrolling="auto" framespacing="0" frameborder="0" noresize="noresize" marginheight="0" marginwidth="0" src="" name="mid"></frame>
<frame scrolling="no" framespacing="0" frameborder="0" noresize="noresize" marginheight="1" marginwidth="1" src="" name="bot"></frame>
<frame scrolling="no" framespacing="0" frameborder="0" noresize="noresize" marginheight="1" marginwidth="1" src="" name="spellsuggestall"></frame>
</frameset>
</html>
|
108wo
|
statics/js/ckeditor/plugins/wsc/dialogs/tmpFrameset.html
|
HTML
|
asf20
| 1,935
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!--
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript">
function gup( name )
{
name = name.replace( /[\[]/, '\\\[' ).replace( /[\]]/, '\\\]' ) ;
var regexS = '[\\?&]' + name + '=([^&#]*)' ;
var regex = new RegExp( regexS ) ;
var results = regex.exec( window.location.href ) ;
if ( results )
return results[ 1 ] ;
else
return '' ;
}
var interval;
function sendData2Master()
{
var destination = window.parent.parent ;
try
{
if ( destination.XDTMaster )
{
var t = destination.XDTMaster.read( [ gup( 'cmd' ), gup( 'data' ) ] ) ;
window.clearInterval( interval ) ;
}
}
catch (e) {}
}
function onLoad()
{
interval = window.setInterval( sendData2Master, 100 );
}
</script>
</head>
<body onload="onLoad()"><p></p></body>
</html>
|
108wo
|
statics/js/ckeditor/plugins/wsc/dialogs/ciframe.html
|
HTML
|
asf20
| 1,120
|
$(document).ready(function() {
$("#q").suggest("?m=search&c=index&a=public_get_suggest_keyword&url="+encodeURIComponent('http://www.google.cn/complete/search?hl=zh-CN&q='+$("#q").val()), {
onSelect: function() {
alert(this.value);
}
});
});
var google={
ac:{
h:function(results){
if(results[1].length > 0) {
var data = '<ul>';
for (var i=0;i<results[1].length;i++) {
if(results[1][i]==null || typeof(results[1][i])=='undefined') {
} else {
data += '<li><a href="javascript:;" onmousedown="s(\''+results[1][i][0]+'\')">'+results[1][i][0]+'</a></li>';
}
}
data += '</ul>';
$("#sr_infos").html(data);
} else {
$("#sr_infos").hide();
}
}
}
};
function s(name) {
$("#q").val(name);
window.location.href='?m=search&c=index&a=init&q='+name;
}
|
108wo
|
statics/js/search_suggest.js
|
JavaScript
|
asf20
| 898
|
$(document).ready(function(){
//获取锚点即当前图片id
var picid = location.hash;
picid = picid.substring(1);
if(isNaN(picid) || picid=='' || picid==null) {
picid = 1;
}
picid = parseInt(picid);
//图集图片总数
var totalnum = $("#pictureurls li").length;
//如果当前图片id大于图片数,显示第一张图片
if(picid > totalnum || picid < 1) {
picid = 1;
next_picid = 1; //下一张图片id
} else {
next_picid = picid + 1;
}
url = $("#pictureurls li:nth-child("+picid+") img").attr("rel");
$("#big-pic").html("<img src='"+url+"' onload='loadpic("+next_picid+")'>");
$('#big-pic img').LoadImage(true, 890, 650,$("#load_pic").attr('rel'));
$("#picnum").html("("+picid+"/"+totalnum+")");
$("#picinfo").html($("#pictureurls li:nth-child("+picid+") img").attr("alt"));
$("#pictureurls li").click(function(){
i = $(this).index() + 1;
showpic(i);
});
//加载时图片滚动到中间
var _w = $('.cont li').width()*$('.cont li').length;
if(picid>2) {
movestep = picid - 3;
} else {
movestep = 0;
}
$(".cont ul").css({"left":-+$('.cont li').width()*movestep});
//点击图片滚动
$('.cont ul').width(_w);
$(".cont li").click( function () {
if($(this).index()>2){
movestep = $(this).index() - 2;
$(".cont ul").css({"left":-+$('.cont li').width()*movestep});
}
});
//当前缩略图添加样式
$("#pictureurls li:nth-child("+picid+")").addClass("on");
});
$(document).keyup(function(e) {
var currKey=0,e=e||event;
currKey=e.keyCode||e.which||e.charCode;
switch(currKey) {
case 37: // left
showpic('pre');
break;
case 39: // up
showpic('next');
break;
case 13: // enter
var nextpicurl = $('#nextPicsBut').attr('href');
if(nextpicurl !== '' || nextpicurl !== 'null') {
window.location=nextpicurl;
}
break;
}
});
function showpic(type, replay) {
//隐藏重复播放div
$("#endSelect").hide();
//图集图片总数
var totalnum = $("#pictureurls li").length;
if(type=='next' || type=='pre') {
//获取锚点即当前图片id
var picid = location.hash;
picid = picid.substring(1);
if(isNaN(picid) || picid=='' || picid==null) {
picid = 1;
}
picid = parseInt(picid);
if(type=='next') {
i = picid + 1;
//如果是最后一张图片,指针指向第一张
if(i > totalnum) {
$("#endSelect").show();
i=1;
next_picid=1;
//重新播放
if(replay!=1) {
return false;
} else {
$("#endSelect").hide();
}
} else {
next_picid = parseInt(i) + 1;
}
} else if (type=='pre') {
i = picid - 1;
//如果是第一张图片,指针指向最后一张
if(i < 1) {
i=totalnum;
next_picid = totalnum;
} else {
next_picid = parseInt(i) - 1;
}
}
url = $("#pictureurls li:nth-child("+i+") img").attr("rel");
$("#big-pic").html("<img src='"+url+"' onload='loadpic("+next_picid+")'>");
$('#big-pic img').LoadImage(true, 890, 650,$("#load_pic").attr('rel'));
$("#picnum").html("("+i+"/"+totalnum+")");
$("#picinfo").html($("#pictureurls li:nth-child("+i+") img").attr("alt"));
//更新锚点
location.hash = i;
type = i;
//点击图片滚动
var _w = $('.cont li').width()*$('.cont li').length;
if(i>2) {
movestep = i - 3;
} else {
movestep = 0;
}
$(".cont ul").css({"left":-+$('.cont li').width()*movestep});
} else if(type=='big') {
//获取锚点即当前图片id
var picid = location.hash;
picid = picid.substring(1);
if(isNaN(picid) || picid=='' || picid==null) {
picid = 1;
}
picid = parseInt(picid);
url = $("#pictureurls li:nth-child("+picid+") img").attr("rel");
window.open(url);
} else {
url = $("#pictureurls li:nth-child("+type+") img").attr("rel");
$("#big-pic").html("<img src='"+url+"'>");
$('#big-pic img').LoadImage(true, 890, 650,$("#load_pic").attr('rel'));
$("#picnum").html("("+type+"/"+totalnum+")");
$("#picinfo").html($("#pictureurls li:nth-child("+type+") img").attr("alt"));
location.hash = type;
}
$("#pictureurls li").each(function(i){
j = i+1;
if(j==type) {
$("#pictureurls li:nth-child("+j+")").addClass("on");
} else {
$("#pictureurls li:nth-child("+j+")").removeClass();
}
});
}
//预加载图片
function loadpic(id) {
url = $("#pictureurls li:nth-child("+id+") img").attr("rel");
$("#load_pic").html("<img src='"+url+"'>");
}
|
108wo
|
statics/js/show_picture.js
|
JavaScript
|
asf20
| 4,529
|
var regexEnum =
{
intege:"^-?[1-9]\\d*$", //整数
intege1:"^[1-9]\\d*$", //正整数
intege2:"^-[1-9]\\d*$", //负整数
num:"^([+-]?)\\d*\\.?\\d+$", //数字
num1:"^[1-9]\\d*|0$", //正数(正整数 + 0)
num2:"^-[1-9]\\d*|0$", //负数(负整数 + 0)
decmal:"^([+-]?)\\d*\\.\\d+$", //浮点数
decmal1:"^[1-9]\\d*.\\d*|0.\\d*[1-9]\\d*$", //正浮点数
decmal2:"^-([1-9]\\d*.\\d*|0.\\d*[1-9]\\d*)$", //负浮点数
decmal3:"^-?([1-9]\\d*.\\d*|0.\\d*[1-9]\\d*|0?.0+|0)$", //浮点数
decmal4:"^[1-9]\\d*.\\d*|0.\\d*[1-9]\\d*|0?.0+|0$", //非负浮点数(正浮点数 + 0)
decmal5:"^(-([1-9]\\d*.\\d*|0.\\d*[1-9]\\d*))|0?.0+|0$", //非正浮点数(负浮点数 + 0)
email:"^\\w+((-\\w+)|(\\.\\w+))*\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z0-9]+$", //邮件
color:"^[a-fA-F0-9]{6}$", //颜色
url:"^http[s]?:\\/\\/([\\w-]+\\.)+[\\w-]+([\\w-./?%&=]*)?$", //url
chinese:"^[\\u4E00-\\u9FA5\\uF900-\\uFA2D]+$", //仅中文
ascii:"^[\\x00-\\xFF]+$", //仅ACSII字符
zipcode:"^\\d{6}$", //邮编
mobile:"^(1)[0-9]{9}$", //手机
ip4:"^(25[0-5]|2[0-4]\\d|[0-1]\\d{2}|[1-9]?\\d)\\.(25[0-5]|2[0-4]\\d|[0-1]\\d{2}|[1-9]?\\d)\\.(25[0-5]|2[0-4]\\d|[0-1]\\d{2}|[1-9]?\\d)\\.(25[0-5]|2[0-4]\\d|[0-1]\\d{2}|[1-9]?\\d)$", //ip地址
notempty:"^\\S+$", //非空
picture:"(.*)\\.(jpg|bmp|gif|ico|pcx|jpeg|tif|png|raw|tga)$", //图片
rar:"(.*)\\.(rar|zip|7zip|tgz)$", //压缩文件
date:"^\\d{4}(\\-|\\/|\.)\\d{1,2}\\1\\d{1,2}$", //日期
qq:"^[1-9]*[1-9][0-9]*$", //QQ号码
tel:"^(([0\\+]\\d{2,3}-)?(0\\d{2,3})-)?(\\d{7,8})(-(\\d{3,}))?$", //电话号码的函数(包括验证国内区号,国际区号,分机号)
username:"^\\w+$", //用来用户注册。匹配由数字、26个英文字母或者下划线组成的字符串
letter:"^[A-Za-z]+$", //字母
letter_u:"^[A-Z]+$", //大写字母
letter_l:"^[a-z]+$", //小写字母
idcard:"^[1-9]([0-9]{14}|[0-9]{17})$", //身份证
ps_username:"^[\\u4E00-\\u9FA5\\uF900-\\uFA2D_\\w]+$" //中文、字母、数字 _
}
function isCardID(sId){
var iSum=0 ;
var info="" ;
if(!/^\d{17}(\d|x)$/i.test(sId)) return "你输入的身份证长度或格式错误";
sId=sId.replace(/x$/i,"a");
if(aCity[parseInt(sId.substr(0,2))]==null) return "你的身份证地区非法";
sBirthday=sId.substr(6,4)+"-"+Number(sId.substr(10,2))+"-"+Number(sId.substr(12,2));
var d=new Date(sBirthday.replace(/-/g,"/")) ;
if(sBirthday!=(d.getFullYear()+"-"+ (d.getMonth()+1) + "-" + d.getDate()))return "身份证上的出生日期非法";
for(var i = 17;i>=0;i --) iSum += (Math.pow(2,i) % 11) * parseInt(sId.charAt(17 - i),11) ;
if(iSum%11!=1) return "你输入的身份证号非法";
return true;//aCity[parseInt(sId.substr(0,2))]+","+sBirthday+","+(sId.substr(16,1)%2?"男":"女")
}
//短时间,形如 (13:04:06)
function isTime(str)
{
var a = str.match(/^(\d{1,2})(:)?(\d{1,2})\2(\d{1,2})$/);
if (a == null) {return false}
if (a[1]>24 || a[3]>60 || a[4]>60)
{
return false;
}
return true;
}
//短日期,形如 (2003-12-05)
function isDate(str)
{
var r = str.match(/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/);
if(r==null)return false;
var d= new Date(r[1], r[3]-1, r[4]);
return (d.getFullYear()==r[1]&&(d.getMonth()+1)==r[3]&&d.getDate()==r[4]);
}
//长时间,形如 (2003-12-05 13:04:06)
function isDateTime(str)
{
var reg = /^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})$/;
var r = str.match(reg);
if(r==null) return false;
var d= new Date(r[1], r[3]-1,r[4],r[5],r[6],r[7]);
return (d.getFullYear()==r[1]&&(d.getMonth()+1)==r[3]&&d.getDate()==r[4]&&d.getHours()==r[5]&&d.getMinutes()==r[6]&&d.getSeconds()==r[7]);
}
|
108wo
|
statics/js/formvalidatorregex.js
|
JavaScript
|
asf20
| 3,836
|
var phpcms_path = '/';
var cookie_pre = 'sYQDUGqqzH';
var cookie_domain = '';
var cookie_path = '/';
function getcookie(name) {
name = cookie_pre+name;
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while(i < clen) {
var j = i + alen;
if(document.cookie.substring(i, j) == arg) return getcookieval(j);
i = document.cookie.indexOf(" ", i) + 1;
if(i == 0) break;
}
return null;
}
function setcookie(name, value, days) {
name = cookie_pre+name;
var argc = setcookie.arguments.length;
var argv = setcookie.arguments;
var secure = (argc > 5) ? argv[5] : false;
var expire = new Date();
if(days==null || days==0) days=1;
expire.setTime(expire.getTime() + 3600000*24*days);
document.cookie = name + "=" + escape(value) + ("; path=" + cookie_path) + ((cookie_domain == '') ? "" : ("; domain=" + cookie_domain)) + ((secure == true) ? "; secure" : "") + ";expires="+expire.toGMTString();
}
function delcookie(name) {
var exp = new Date();
exp.setTime (exp.getTime() - 1);
var cval = getcookie(name);
name = cookie_pre+name;
document.cookie = name+"="+cval+";expires="+exp.toGMTString();
}
function getcookieval(offset) {
var endstr = document.cookie.indexOf (";", offset);
if(endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
|
108wo
|
statics/js/cookie.js
|
JavaScript
|
asf20
| 1,409
|
var ColorHex=new Array('00','33','66','99','CC','FF')
var SpColorHex=new Array('FF0000','00FF00','0000FF','FFFF00','00FFFF','FF00FF')
var current=null
var colorTable=''
function colorpicker(showid,fun) {
for (i=0;i<2;i++) {
for (j=0;j<6;j++) {
colorTable=colorTable+'<tr height=12>'
colorTable=colorTable+'<td width=11 onmouseover="onmouseover_color(\'000\')" onclick="select_color(\''+showid+'\',\'000\','+fun+')" style="background-color:#000">'
if (i==0){
colorTable=colorTable+'<td width=11 onmouseover="onmouseover_color(\''+ColorHex[j]+ColorHex[j]+ColorHex[j]+'\')" onclick="select_color(\''+showid+'\',\''+ColorHex[j]+ColorHex[j]+ColorHex[j]+'\','+fun+')" style="background-color:#'+ColorHex[j]+ColorHex[j]+ColorHex[j]+'">'
} else {
colorTable=colorTable+'<td width=11 onmouseover="onmouseover_color(\''+SpColorHex[j]+'\')" onclick="select_color(\''+showid+'\',\''+SpColorHex[j]+'\','+fun+')" style="background-color:#'+SpColorHex[j]+'">'}
colorTable=colorTable+'<td width=11 onmouseover="onmouseover_color(\'000\')" onclick="select_color(\''+showid+'\',\'000\','+fun+')" style="background-color:#000">'
for (k=0;k<3;k++) {
for (l=0;l<6;l++) {
colorTable=colorTable+'<td width=11 onmouseover="onmouseover_color(\''+ColorHex[k+i*3]+ColorHex[l]+ColorHex[j]+'\')" onclick="select_color(\''+showid+'\',\''+ColorHex[k+i*3]+ColorHex[l]+ColorHex[j]+'\','+fun+')" style="background-color:#'+ColorHex[k+i*3]+ColorHex[l]+ColorHex[j]+'">'
}
}
}
}
colorTable='<div style="position:relative;width:253px; height:176px"><a href="javascript:;" onclick="closeBox();" class="close-own">X</a><table width=253 border="0" cellspacing="0" cellpadding="0" style="border:1px #000 solid;border-bottom:none;border-collapse: collapse" bordercolor="000000">'
+'<tr height=30><td colspan=21 bgcolor=#eeeeee>'
+'<table cellpadding="0" cellspacing="1" border="0" style="border-collapse: collapse">'
+'<tr><td width="3"><td><input type="text" name="DisColor" size="6" id="background_colorId" disabled style="border:solid 1px #000000;background-color:#ffff00"></td>'
+'<td width="3"><td><input type="text" name="HexColor" size="7" id="input_colorId" style="border:inset 1px;font-family:Arial;" value="#000000"></td><td><a href="javascript:;" onclick="clear_title();"> clear</a></td></tr></table></td></table>'
+'<table border="1" cellspacing="0" cellpadding="0" style="border-collapse: collapse" bordercolor="000000" style="cursor:hand;">'
+colorTable+'</table></div>';
$('#'+showid).html(colorTable);
colorTable = '';
}
function onmouseover_color(color) {
var color = '#'+color;
$('#background_colorId').css('background-color',color);
$('#input_colorId').val(color);
}
function select_color(showid,color,fun) {
var color = '#'+color;
//$('#title').css('color',color);
if(fun) {
fun.apply(this,[color]);
}
$('#'+showid).html(' ');
}
function closeBox(){
$(".colorpanel").html(' ');
}
function clear_title() {
$('#title').css('color','');
$('#title_colorpanel').html(' ');
}
|
108wo
|
statics/js/colorpicker.js
|
JavaScript
|
asf20
| 3,100
|
/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
var swfobject = function() {
var UNDEF = "undefined",
OBJECT = "object",
SHOCKWAVE_FLASH = "Shockwave Flash",
SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
FLASH_MIME_TYPE = "application/x-shockwave-flash",
EXPRESS_INSTALL_ID = "SWFObjectExprInst",
ON_READY_STATE_CHANGE = "onreadystatechange",
win = window,
doc = document,
nav = navigator,
plugin = false,
domLoadFnArr = [main],
regObjArr = [],
objIdArr = [],
listenersArr = [],
storedAltContent,
storedAltContentId,
storedCallbackFn,
storedCallbackObj,
isDomLoaded = false,
isExpressInstallActive = false,
dynamicStylesheet,
dynamicStylesheetMedia,
autoHideShow = true,
/* Centralized function for browser feature detection
- User agent string detection is only used when no good alternative is possible
- Is executed directly for optimal performance
*/
ua = function() {
var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
u = nav.userAgent.toLowerCase(),
p = nav.platform.toLowerCase(),
windows = p ? /win/.test(p) : /win/.test(u),
mac = p ? /mac/.test(p) : /mac/.test(u),
webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
playerVersion = [0,0,0],
d = null;
if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
d = nav.plugins[SHOCKWAVE_FLASH].description;
if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
plugin = true;
ie = false; // cascaded feature detection for Internet Explorer
d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
}
}
else if (typeof win.ActiveXObject != UNDEF) {
try {
var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
if (a) { // a will return null when ActiveX is disabled
d = a.GetVariable("$version");
if (d) {
ie = true; // cascaded feature detection for Internet Explorer
d = d.split(" ")[1].split(",");
playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
}
}
}
catch(e) {}
}
return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
}(),
/* Cross-browser onDomLoad
- Will fire an event as soon as the DOM of a web page is loaded
- Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
- Regular onload serves as fallback
*/
onDomLoad = function() {
if (!ua.w3) { return; }
if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
callDomLoadFunctions();
}
if (!isDomLoaded) {
if (typeof doc.addEventListener != UNDEF) {
doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
}
if (ua.ie && ua.win) {
doc.attachEvent(ON_READY_STATE_CHANGE, function() {
if (doc.readyState == "complete") {
doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
callDomLoadFunctions();
}
});
if (win == top) { // if not inside an iframe
(function(){
if (isDomLoaded) { return; }
try {
doc.documentElement.doScroll("left");
}
catch(e) {
setTimeout(arguments.callee, 0);
return;
}
callDomLoadFunctions();
})();
}
}
if (ua.wk) {
(function(){
if (isDomLoaded) { return; }
if (!/loaded|complete/.test(doc.readyState)) {
setTimeout(arguments.callee, 0);
return;
}
callDomLoadFunctions();
})();
}
addLoadEvent(callDomLoadFunctions);
}
}();
function callDomLoadFunctions() {
if (isDomLoaded) { return; }
try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
t.parentNode.removeChild(t);
}
catch (e) { return; }
isDomLoaded = true;
var dl = domLoadFnArr.length;
for (var i = 0; i < dl; i++) {
domLoadFnArr[i]();
}
}
function addDomLoadEvent(fn) {
if (isDomLoaded) {
fn();
}
else {
domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
}
}
/* Cross-browser onload
- Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
- Will fire an event as soon as a web page including all of its assets are loaded
*/
function addLoadEvent(fn) {
if (typeof win.addEventListener != UNDEF) {
win.addEventListener("load", fn, false);
}
else if (typeof doc.addEventListener != UNDEF) {
doc.addEventListener("load", fn, false);
}
else if (typeof win.attachEvent != UNDEF) {
addListener(win, "onload", fn);
}
else if (typeof win.onload == "function") {
var fnOld = win.onload;
win.onload = function() {
fnOld();
fn();
};
}
else {
win.onload = fn;
}
}
/* Main function
- Will preferably execute onDomLoad, otherwise onload (as a fallback)
*/
function main() {
if (plugin) {
testPlayerVersion();
}
else {
matchVersions();
}
}
/* Detect the Flash Player version for non-Internet Explorer browsers
- Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
a. Both release and build numbers can be detected
b. Avoid wrong descriptions by corrupt installers provided by Adobe
c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
- Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
*/
function testPlayerVersion() {
var b = doc.getElementsByTagName("body")[0];
var o = createElement(OBJECT);
o.setAttribute("type", FLASH_MIME_TYPE);
var t = b.appendChild(o);
if (t) {
var counter = 0;
(function(){
if (typeof t.GetVariable != UNDEF) {
var d = t.GetVariable("$version");
if (d) {
d = d.split(" ")[1].split(",");
ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
}
}
else if (counter < 10) {
counter++;
setTimeout(arguments.callee, 10);
return;
}
b.removeChild(o);
t = null;
matchVersions();
})();
}
else {
matchVersions();
}
}
/* Perform Flash Player and SWF version matching; static publishing only
*/
function matchVersions() {
var rl = regObjArr.length;
if (rl > 0) {
for (var i = 0; i < rl; i++) { // for each registered object element
var id = regObjArr[i].id;
var cb = regObjArr[i].callbackFn;
var cbObj = {success:false, id:id};
if (ua.pv[0] > 0) {
var obj = getElementById(id);
if (obj) {
if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
setVisibility(id, true);
if (cb) {
cbObj.success = true;
cbObj.ref = getObjectById(id);
cb(cbObj);
}
}
else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
var att = {};
att.data = regObjArr[i].expressInstall;
att.width = obj.getAttribute("width") || "0";
att.height = obj.getAttribute("height") || "0";
if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
// parse HTML object param element's name-value pairs
var par = {};
var p = obj.getElementsByTagName("param");
var pl = p.length;
for (var j = 0; j < pl; j++) {
if (p[j].getAttribute("name").toLowerCase() != "movie") {
par[p[j].getAttribute("name")] = p[j].getAttribute("value");
}
}
showExpressInstall(att, par, id, cb);
}
else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
displayAltContent(obj);
if (cb) { cb(cbObj); }
}
}
}
else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
setVisibility(id, true);
if (cb) {
var o = getObjectById(id); // test whether there is an HTML object element or not
if (o && typeof o.SetVariable != UNDEF) {
cbObj.success = true;
cbObj.ref = o;
}
cb(cbObj);
}
}
}
}
}
function getObjectById(objectIdStr) {
var r = null;
var o = getElementById(objectIdStr);
if (o && o.nodeName == "OBJECT") {
if (typeof o.SetVariable != UNDEF) {
r = o;
}
else {
var n = o.getElementsByTagName(OBJECT)[0];
if (n) {
r = n;
}
}
}
return r;
}
/* Requirements for Adobe Express Install
- only one instance can be active at a time
- fp 6.0.65 or higher
- Win/Mac OS only
- no Webkit engines older than version 312
*/
function canExpressInstall() {
return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
}
/* Show the Adobe Express Install dialog
- Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
*/
function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
isExpressInstallActive = true;
storedCallbackFn = callbackFn || null;
storedCallbackObj = {success:false, id:replaceElemIdStr};
var obj = getElementById(replaceElemIdStr);
if (obj) {
if (obj.nodeName == "OBJECT") { // static publishing
storedAltContent = abstractAltContent(obj);
storedAltContentId = null;
}
else { // dynamic publishing
storedAltContent = obj;
storedAltContentId = replaceElemIdStr;
}
att.id = EXPRESS_INSTALL_ID;
if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
fv = "MMredirectURL=" + win.location.toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
if (typeof par.flashvars != UNDEF) {
par.flashvars += "&" + fv;
}
else {
par.flashvars = fv;
}
// IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
// because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
if (ua.ie && ua.win && obj.readyState != 4) {
var newObj = createElement("div");
replaceElemIdStr += "SWFObjectNew";
newObj.setAttribute("id", replaceElemIdStr);
obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
obj.style.display = "none";
(function(){
if (obj.readyState == 4) {
obj.parentNode.removeChild(obj);
}
else {
setTimeout(arguments.callee, 10);
}
})();
}
createSWF(att, par, replaceElemIdStr);
}
}
/* Functions to abstract and display alternative content
*/
function displayAltContent(obj) {
if (ua.ie && ua.win && obj.readyState != 4) {
// IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
// because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
var el = createElement("div");
obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
el.parentNode.replaceChild(abstractAltContent(obj), el);
obj.style.display = "none";
(function(){
if (obj.readyState == 4) {
obj.parentNode.removeChild(obj);
}
else {
setTimeout(arguments.callee, 10);
}
})();
}
else {
obj.parentNode.replaceChild(abstractAltContent(obj), obj);
}
}
function abstractAltContent(obj) {
var ac = createElement("div");
if (ua.win && ua.ie) {
ac.innerHTML = obj.innerHTML;
}
else {
var nestedObj = obj.getElementsByTagName(OBJECT)[0];
if (nestedObj) {
var c = nestedObj.childNodes;
if (c) {
var cl = c.length;
for (var i = 0; i < cl; i++) {
if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
ac.appendChild(c[i].cloneNode(true));
}
}
}
}
}
return ac;
}
/* Cross-browser dynamic SWF creation
*/
function createSWF(attObj, parObj, id) {
var r, el = getElementById(id);
if (ua.wk && ua.wk < 312) { return r; }
if (el) {
if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
attObj.id = id;
}
if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
var att = "";
for (var i in attObj) {
if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
if (i.toLowerCase() == "data") {
parObj.movie = attObj[i];
}
else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
att += ' class="' + attObj[i] + '"';
}
else if (i.toLowerCase() != "classid") {
att += ' ' + i + '="' + attObj[i] + '"';
}
}
}
var par = "";
for (var j in parObj) {
if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
par += '<param name="' + j + '" value="' + parObj[j] + '" />';
}
}
el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
r = getElementById(attObj.id);
}
else { // well-behaving browsers
var o = createElement(OBJECT);
o.setAttribute("type", FLASH_MIME_TYPE);
for (var m in attObj) {
if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
o.setAttribute("class", attObj[m]);
}
else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
o.setAttribute(m, attObj[m]);
}
}
}
for (var n in parObj) {
if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
createObjParam(o, n, parObj[n]);
}
}
el.parentNode.replaceChild(o, el);
r = o;
}
}
return r;
}
function createObjParam(el, pName, pValue) {
var p = createElement("param");
p.setAttribute("name", pName);
p.setAttribute("value", pValue);
el.appendChild(p);
}
/* Cross-browser SWF removal
- Especially needed to safely and completely remove a SWF in Internet Explorer
*/
function removeSWF(id) {
var obj = getElementById(id);
if (obj && obj.nodeName == "OBJECT") {
if (ua.ie && ua.win) {
obj.style.display = "none";
(function(){
if (obj.readyState == 4) {
removeObjectInIE(id);
}
else {
setTimeout(arguments.callee, 10);
}
})();
}
else {
obj.parentNode.removeChild(obj);
}
}
}
function removeObjectInIE(id) {
var obj = getElementById(id);
if (obj) {
for (var i in obj) {
if (typeof obj[i] == "function") {
obj[i] = null;
}
}
obj.parentNode.removeChild(obj);
}
}
/* Functions to optimize JavaScript compression
*/
function getElementById(id) {
var el = null;
try {
el = doc.getElementById(id);
}
catch (e) {}
return el;
}
function createElement(el) {
return doc.createElement(el);
}
/* Updated attachEvent function for Internet Explorer
- Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
*/
function addListener(target, eventType, fn) {
target.attachEvent(eventType, fn);
listenersArr[listenersArr.length] = [target, eventType, fn];
}
/* Flash Player and SWF content version matching
*/
function hasPlayerVersion(rv) {
var pv = ua.pv, v = rv.split(".");
v[0] = parseInt(v[0], 10);
v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
v[2] = parseInt(v[2], 10) || 0;
return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
}
/* Cross-browser dynamic CSS creation
- Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
*/
function createCSS(sel, decl, media, newStyle) {
if (ua.ie && ua.mac) { return; }
var h = doc.getElementsByTagName("head")[0];
if (!h) { return; } // to also support badly authored HTML pages that lack a head element
var m = (media && typeof media == "string") ? media : "screen";
if (newStyle) {
dynamicStylesheet = null;
dynamicStylesheetMedia = null;
}
if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
// create dynamic stylesheet + get a global reference to it
var s = createElement("style");
s.setAttribute("type", "text/css");
s.setAttribute("media", m);
dynamicStylesheet = h.appendChild(s);
if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
}
dynamicStylesheetMedia = m;
}
// add style rule
if (ua.ie && ua.win) {
if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
dynamicStylesheet.addRule(sel, decl);
}
}
else {
if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
}
}
}
function setVisibility(id, isVisible) {
if (!autoHideShow) { return; }
var v = isVisible ? "visible" : "hidden";
if (isDomLoaded && getElementById(id)) {
getElementById(id).style.visibility = v;
}
else {
createCSS("#" + id, "visibility:" + v);
}
}
/* Filter to avoid XSS attacks
*/
function urlEncodeIfNecessary(s) {
var regex = /[\\\"<>\.;]/;
var hasBadChars = regex.exec(s) != null;
return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
}
/* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
*/
var cleanup = function() {
if (ua.ie && ua.win) {
window.attachEvent("onunload", function() {
// remove listeners to avoid memory leaks
var ll = listenersArr.length;
for (var i = 0; i < ll; i++) {
listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
}
// cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
var il = objIdArr.length;
for (var j = 0; j < il; j++) {
removeSWF(objIdArr[j]);
}
// cleanup library's main closures to avoid memory leaks
for (var k in ua) {
ua[k] = null;
}
ua = null;
for (var l in swfobject) {
swfobject[l] = null;
}
swfobject = null;
});
}
}();
return {
/* Public API
- Reference: http://code.google.com/p/swfobject/wiki/documentation
*/
registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
if (ua.w3 && objectIdStr && swfVersionStr) {
var regObj = {};
regObj.id = objectIdStr;
regObj.swfVersion = swfVersionStr;
regObj.expressInstall = xiSwfUrlStr;
regObj.callbackFn = callbackFn;
regObjArr[regObjArr.length] = regObj;
setVisibility(objectIdStr, false);
}
else if (callbackFn) {
callbackFn({success:false, id:objectIdStr});
}
},
getObjectById: function(objectIdStr) {
if (ua.w3) {
return getObjectById(objectIdStr);
}
},
embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
var callbackObj = {success:false, id:replaceElemIdStr};
if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
setVisibility(replaceElemIdStr, false);
addDomLoadEvent(function() {
widthStr += ""; // auto-convert to string
heightStr += "";
var att = {};
if (attObj && typeof attObj === OBJECT) {
for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
att[i] = attObj[i];
}
}
att.data = swfUrlStr;
att.width = widthStr;
att.height = heightStr;
var par = {};
if (parObj && typeof parObj === OBJECT) {
for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
par[j] = parObj[j];
}
}
if (flashvarsObj && typeof flashvarsObj === OBJECT) {
for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
if (typeof par.flashvars != UNDEF) {
par.flashvars += "&" + k + "=" + flashvarsObj[k];
}
else {
par.flashvars = k + "=" + flashvarsObj[k];
}
}
}
if (hasPlayerVersion(swfVersionStr)) { // create SWF
var obj = createSWF(att, par, replaceElemIdStr);
if (att.id == replaceElemIdStr) {
setVisibility(replaceElemIdStr, true);
}
callbackObj.success = true;
callbackObj.ref = obj;
}
else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
att.data = xiSwfUrlStr;
showExpressInstall(att, par, replaceElemIdStr, callbackFn);
return;
}
else { // show alternative content
setVisibility(replaceElemIdStr, true);
}
if (callbackFn) { callbackFn(callbackObj); }
});
}
else if (callbackFn) { callbackFn(callbackObj); }
},
switchOffAutoHideShow: function() {
autoHideShow = false;
},
ua: ua,
getFlashPlayerVersion: function() {
return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
},
hasFlashPlayerVersion: hasPlayerVersion,
createSWF: function(attObj, parObj, replaceElemIdStr) {
if (ua.w3) {
return createSWF(attObj, parObj, replaceElemIdStr);
}
else {
return undefined;
}
},
showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
if (ua.w3 && canExpressInstall()) {
showExpressInstall(att, par, replaceElemIdStr, callbackFn);
}
},
removeSWF: function(objElemIdStr) {
if (ua.w3) {
removeSWF(objElemIdStr);
}
},
createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
if (ua.w3) {
createCSS(selStr, declStr, mediaStr, newStyleBoolean);
}
},
addDomLoadEvent: addDomLoadEvent,
addLoadEvent: addLoadEvent,
getQueryParamValue: function(param) {
var q = doc.location.search || doc.location.hash;
if (q) {
if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
if (param == null) {
return urlEncodeIfNecessary(q);
}
var pairs = q.split("&");
for (var i = 0; i < pairs.length; i++) {
if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
}
}
}
return "";
},
// For internal usage only
expressInstallCallback: function() {
if (isExpressInstallActive) {
var obj = getElementById(EXPRESS_INSTALL_ID);
if (obj && storedAltContent) {
obj.parentNode.replaceChild(storedAltContent, obj);
if (storedAltContentId) {
setVisibility(storedAltContentId, true);
if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
}
if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
}
isExpressInstallActive = false;
}
}
};
}();
|
108wo
|
statics/js/swfobject.js
|
JavaScript
|
asf20
| 25,560
|
function checkradio(radio)
{
var result = false;
for(var i=0; i<radio.length; i++)
{
if(radio[i].checked)
{
result = true;
break;
}
}
return result;
}
function checkselect(select)
{
var result = false;
for(var i=0;i<select.length;i++)
{
if(select[i].selected && select[i].value!='' && select[i].value!=0)
{
result = true;
break;
}
}
return result;
}
var set_show = false;
jQuery.fn.checkFormorder = function(m,func){
mode = (m==1) ? 1 : 0;
var form=jQuery(this);
var elements = form.find('input[require],select[require],textarea[require]');
elements.blur(function(index){
return validator.check(jQuery(this));
});
form.submit(function(){
var ok = true;
var errIndex= new Array();
var n=0;
elements.each(function(i){
if(validator.check(jQuery(this))==false){
ok = false;
errIndex[n++]=i;
};
});
if(ok==false){
elements.eq(errIndex[0]).focus().select();
return false;
}
if(document.getElementById('video_uploader') && !upLoading)
{
uploadFile();
return false;
}
if($('#f_filed_1') && set_show==false)
{
$("select[@id=catids] option").each(function()
{
$(this).attr('selected','selected');
});
}
if($('#hava_checked').val()==0)
{
YP_checkform();
return false;
}
func();
return false;
});
}
|
108wo
|
statics/js/form_ajax.js
|
JavaScript
|
asf20
| 1,402
|
jQuery.cookie = function(name, value, options) {
if (typeof value != 'undefined') { // name and value given, set cookie
options = options || {};
if (value === null) {
value = '';
options.expires = -1;
}
var expires = '';
if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
var date;
if (typeof options.expires == 'number') {
date = new Date();
date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
} else {
date = options.expires;
}
expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
}
var path = options.path ? '; path=' + options.path : '';
var domain = options.domain ? '; domain=' + options.domain : '';
var secure = options.secure ? '; secure' : '';
document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
} else { // only name given, get cookie
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
};
|
108wo
|
statics/js/jquery.cookie.js
|
JavaScript
|
asf20
| 1,717
|
<?php
$filetype['dir'] = "文件夹";
$filetype['gif'] = "GIF 图像";
$filetype['htm'] = "HTML Document";
$filetype['html'] = "HTML Document";
$filetype['shtml'] = "shtmlfile";
$filetype['php'] = "php 脚本";
$filetype['asp'] = "Active Server Page";
$filetype['do'] = "DO 文件";
$filetype['swf'] = "Shockwave Flash Object";
$filetype['xml'] = "XML 文档";
$filetype['jpg'] = "JPEG 图像";
$filetype['jpeg'] = "JPEG 图像";
$filetype['bmp'] = "BMP 图像";
$filetype['tif'] = "TIF 文件";
$filetype['js'] = "JavaScript 文件";
$filetype['doc'] = "Microsoft Word 文档";
$filetype['docx'] = "Microsoft Word 文档";
$filetype['mp3'] = "MP3 格式声音";
$filetype['rar'] = "WinRAR 压缩文件";
$filetype['psd'] = "Adobe Photoshop Image";
$filetype['png'] = "Macromedia Firewords Doc";
$filetype['pdf'] = "Adobe Acrobat 7.0 Document";
$filetype['zip'] = "WinRAR ZIP 压缩文件";
$filetype['rm'] = "RealMedia";
$filetype['rmvb'] = "RealVideo VBR";
$filetype['wav'] = "波形声音";
$filetype['mid'] = "MIDI 序列";
$filetype['midi'] = "MIDI 序列";
$filetype['mpg'] = "电影剪辑";
$filetype['mpeg'] = "电影剪辑";
$filetype['asf'] = "Windows Media 音频/视频文件";
$filetype['asx'] = "Windows Media 音频/视频播放列表";
$filetype['mov'] = "QuickTime 影片";
$filetype['xls'] = "Microsoft Excel 工作表";
$filetype['chm'] = "已编译的 HTML 帮助文件";
$filetype['hlp'] = "帮助文件";
$filetype['exe'] = "应用程序";
$filetype['txt'] = "文本文档";
$filetype['other'] = "未知";
?>
|
108wo
|
statics/images/ext/ext.php
|
PHP
|
asf20
| 1,571
|