public function step4() { $this->front_page = host_url(spUrl('welcome', 'index')); $this->admin_page = host_url(spUrl('admin', 'login')); fopen('data/install.lock', 'w'); $this->display("install/step4.php"); }
function deleteselect() { $i_order = spClass("i_pay"); $param = $this->spArgs(); if (sizeof($param['chk_list']) > 0) { foreach ($param['chk_list'] as $id) { $i_order->deleteByPk($id); } } $this->results = spUrl("i_pay_action", "index"); $this->display("ok.htm"); // 显示模板 }
public function buy() { $item_id = $this->spArgs("mid"); if ($item_id && is_numeric($item_id)) { $ptx_item = spClass('ptx_item'); $item = $ptx_item->get_item_by_id($item_id, ' ptx_item.promotion_url '); if ($item['promotion_url']) { $this->jump(str_ireplace('+', '%2B', $item['promotion_url'])); return; } } $this->jump(spUrl('welcome', 'index'), 2, T('page_404_redirecting')); }
public function __template_spUrl($params) { $geturl = basename(__FILE__); $controller = $GLOBALS['G_DY']["default_controller"]; $action = $GLOBALS['G_DY']["default_action"]; $args = array(); $anchor = null; foreach ($params as $key => $param) { if ($key == $GLOBALS['G_DY']["url_controller"]) { $controller = $param; } elseif ($key == $GLOBALS['G_DY']["url_action"]) { $action = $param; } elseif ($key == 'anchor') { $anchor = $param; } else { $args[$key] = $param; } } return spUrl($geturl, $controller, $action, $args, $anchor); }
/** * 生成单个静态页面 * * @param spurl spUrl的参数 * @param alias_url 生成HTML文件的名称,如果不设置alias_url,将使用年月日生成目录及随机数为文件名的形式生成HTML文件。 * @param update_mode 更新模式,默认2为同时更新列表及文件 * 0是仅更新列表 * 1是仅更新文件 */ public function make($spurl, $alias_url = null, $update_mode = 2) { if (1 == spAccess('r', 'sp_html_making')) { $this->spurls[] = array($spurl, $alias_url); return; } @(list($controller, $action, $args, $anchor) = $spurl); if ($url_item = spHtml::getUrl($controller, $action, $args, $anchor, TRUE)) { @(list($baseuri, $realfile) = $url_item); $update_mode = 1; } else { $file_root_name = '' == $GLOBALS['G_SP']['html']['file_root_name'] ? '' : $GLOBALS['G_SP']['html']['file_root_name'] . '/'; if (null == $alias_url) { $filedir = $file_root_name . date('Y/n/d') . '/'; $filename = substr(time(), 3, 10) . substr(mt_rand(100000, substr(time(), 3, 10)), 4) . ".html"; } else { $filedir = $file_root_name . dirname($alias_url) . '/'; $filename = basename($alias_url); } $baseuri = rtrim(dirname($GLOBALS['G_SP']['url']["url_path_base"]), '/\\') . "/" . $filedir . $filename; $realfile = APP_PATH . "/" . $filedir . $filename; } if (0 == $update_mode or 2 == $update_mode) { spHtml::setUrl($spurl, $baseuri, $realfile); } if (1 == $update_mode or 2 == $update_mode) { $remoteurl = 'http://' . $_SERVER["SERVER_NAME"] . ':' . $_SERVER['SERVER_PORT'] . '/' . ltrim(spUrl($controller, $action, $args, $anchor, TRUE), '/\\'); $cachedata = file_get_contents($remoteurl); if (FALSE === $cachedata) { $cachedata = $this->curl_get_file_contents($remoteurl); if (FALSE === $cachedata) { spError("无法从网络获取页面数据,请检查:<br />1. spUrl生成地址是否正确!<a href='{$remoteurl}' target='_blank'>点击这里测试</a>。<br />2. 设置php.ini的allow_url_fopen为On。<br />3. 检查是否防火墙阻止了APACHE/PHP访问网络。<br />4. 建议安装CURL函数库。"); } } __mkdirs(dirname($realfile)); file_put_contents($realfile, $cachedata); } }
function updatesave() { //更新o_order表 $o_order = spClass("o_order"); $row = $this->spArgs(); $order_id = $row['id']; $orderTime = $row['orderTime']; $row["username"] = $_SESSION["username"]; $conditions = array('id' => $row['id']); $o_order->update($conditions, $row); // echo $o_order->dumpSql(); //删除o_order_detail表中的有关$order_id记录 $o_order_detail = spClass("o_order_detail"); $o_order_detail->delete(array('orderId' => $order_id)); //插入o_order_detail表 $o_order_detail = spClass("o_order_detail"); if (strlen(trim($row['detail'])) > 0) { $records = explode("@@@", $row['detail']); for ($i = 0; $i < sizeOf($records); $i++) { $single = $records[$i]; $arr = explode("___", $single); $conditions = array("orderId" => $order_id, "productId" => $arr[0], "price" => $arr[1], "amount" => $arr[2]); $o_order_detail->create($conditions); } } $this->results = spUrl("o_order_action", "index"); $this->display("ok.htm"); // 显示模板 }
public function check_channel_item() { if ($this->check_admin()) { $act = $this->spArgs("act"); $channel_name = $this->spArgs("channel", 'taobao'); $channel = spClass("Channel"); $number = 50; $page = $this->spArgs("page", 1); $ptx_item = spClass('ptx_item'); $condition['reference_channel'] = 'taobao'; $items = $ptx_item->search(null, $page, $number, " ptx_item.reference_itemid,ptx_item.promotion_url,ptx_item.item_id ", NULL); $pid = $this->settings['api_setting']['Taobao']['PID']; foreach ($items as $item) { if (!strpos($item['promotion_url'], $pid) && $item['reference_itemid']) { $promotion = $channel->get_promotion_url($channel_name, $item['reference_itemid']); sleep(1); if ($promotion) { $scon['item_id'] = $item['item_id']; $ptx_item->updateField($scon, 'promotion_url', $promotion['promotion_url']); } } } if (array_length($items) > 0) { $start = ($page - 1) * $number; $end = $start + $number; $str = T('processing_data') . "{$start}----{$end}"; $url = spUrl('admin', 'check_channel_item', array('page' => $page + 1)); admin_show_message($str, $this, $url, 1500); return; } else { $str = T('processing_data_success'); $url = spUrl('admin', 'update_cache'); admin_show_message($str, $this, $url, 1500); } } }
/** * logout page */ public function logout() { unset($_SESSION['codeBuilder_admin']); $this->jump(spUrl('CodeBuilder', 'login')); }
<?php foreach ($comments as $comment) { ?> <div class="comment"> <div class="shareface"><a class="trans07" href="<?php echo spUrl('pub', 'index', array('uid' => $comment['user_id'])); ?> " data-user-id="<?php echo $comment['user_id']; ?> " data-user-profile="1"><img src="<?php echo useravatar($comment['user_id'], 'middle'); ?> " class="avatar" width="30" height="30"></a></div> <div class="shareinfo"><a href="<?php echo spUrl('pub', 'index', array('uid' => $comment['user_id'])); ?> " data-user-id="<?php echo $comment['user_id']; ?> " data-user-profile="1"><?php echo $comment['nickname']; ?> </a><p><?php echo parse_message(sysSubStr($comment['comment_txt'], 50, true)); ?> </p></div> </div> <?php } ?>
<script id="tags_pop_tpl" type="text/template"> <b class="arrow_t"><i class="arrow_inner_t"></i></b> {{#data}} <div class="tag_title"> <a href="<?php echo spUrl("pin", "tgroup", array('tg' => '{{tag_id}}')); ?> "><strong>{{tag_group_name_en}}</strong></a></div> <ul class="taglist"> {{#tags}} <li><a href="<?php echo spUrl("pin", "index", array("tag" => '{{.}}')); ?> ">{{.}}</a></li> {{/tags}} </ul> {{/data}} <b class="arrow_b"><i class="arrow_inner_b"></i></b> </script>
public function bind() { $ptx_connector = spClass("ptx_connector"); $ptx_user = spClass("ptx_user"); if ($this->social_info) { $social_user_info = $this->social_info; } else { $social_user_info = $this->session->get_data('social_info'); } $vendor = $social_user_info['vendor']; if (!$vendor) { $this->error(T('your_social_info_invalid'), spUrl('pin', 'index')); } if ($nickname = $this->spArgs("nickname")) { if ($this->check_nickname($nickname)) { $data['email'] = md5(random_string('alnum', 5)) . '@' . T('domain.com'); $data['nickname'] = $nickname; $data['avatar_remote'] = $social_user_info['avatar']; $data['gender'] = $social_user_info['gender']; $data['location'] = $social_user_info['location']; $data['bio'] = $social_user_info['description']; $data['passwd'] = md5(random_string('alnum', 8)); $data['create_time'] = time(); $data['is_active'] = 1; $data['is_social'] = 1; $uid = $ptx_user->add_one($data); $connector_data['user_id'] = $uid; $connector_data['social_userid'] = $social_user_info['uid']; $connector_data['vendor'] = $vendor; $connector_data['vendor_info'] = serialize($this->session->get_data('social_' . $vendor . '_info')); $connector_data['username'] = $social_user_info['screen_name']; $connector_data['name'] = $social_user_info['name']; $connector_data['description'] = $social_user_info['description']; $connector_data['homepage'] = $social_user_info['url']; $connector_data['avatar'] = $social_user_info['avatar']; $connector_data['email'] = $social_user_info['email']; $connector_data['gender'] = $social_user_info['gender']; $connector_data['location'] = $social_user_info['location']; $ptx_connector->create($connector_data); $this->save_remote_avatar($social_user_info['avatar'], $uid); $user = $ptx_user->getuser_byid($uid); $this->user_lib->set_session($user); $this->clear_socialinfo($vendor); $this->ajax_success_response(null, T('login_succeed')); return; } else { $this->ajax_failed_response(T('nick_already_existed')); } } else { $social_connector = $ptx_connector->get_bind_by_vendor_and_suid($vendor, $social_user_info['uid']); if ($social_connector) { if ($this->current_user['user_id'] && $social_connector['user_id'] != $this->current_user['user_id']) { $this->error(T('social_account_already_bind'), spUrl('pin', 'index')); } else { $update_connect_data['avatar'] = $social_user_info['avatar']; //$update_local_data['avatar_remote'] = $social_user_info['avatar']; //need update remote avatar $ptx_connector->update(array('connect_id' => $social_connector['connect_id']), $update_connect_data); //$this->user_model->edit_user($social_connector['user_id'],$update_local_data); $local_user = $ptx_user->getuser_byid($social_connector['user_id']); $this->user_lib->set_session($local_user); $this->clear_socialinfo($vendor); $this->jump(spUrl('pin', 'index')); } } else { if ($this->current_user['user_id']) { $connector_data['user_id'] = $this->current_user['user_id']; $connector_data['social_userid'] = $social_user_info['uid']; $connector_data['vendor'] = $vendor; $connector_data['vendor_info'] = serialize($this->session->get_data('social_' . $vendor . '_info')); $connector_data['username'] = $social_user_info['screen_name']; $connector_data['name'] = $social_user_info['name']; $connector_data['description'] = $social_user_info['description']; $connector_data['homepage'] = $social_user_info['url']; $connector_data['avatar'] = $social_user_info['avatar']; $connector_data['email'] = $social_user_info['email']; $connector_data['gender'] = $social_user_info['gender']; $connector_data['location'] = $social_user_info['location']; $ptx_connector->create($connector_data); $this->jump(spUrl('pin', 'index')); } else { $this->social_user_info = $social_user_info; $this->output("social/index"); } } } }
function updatesave() { $model = spClass("user"); $param = $this->spArgs(); $conditions = array('id' => $param['id']); $model->update($conditions, $param); // echo($model->dumpSql()); $this->results = spUrl("user_action", "index"); $this->display("ok.htm"); // 显示模板 }
/** * 默认的无权限提示跳转 */ public function def_prompt() { $url = spUrl(); // 跳转到首页,在强制权限的情况下,请将该页面设置成可以进入。 echo "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"><script>function sptips(){alert(\"Access Failed!\");location.href=\"{$url}\";}</script></head><body onload=\"sptips()\"></body></html>"; exit; }
if ($permission['other_permission']['allow_video']) { ?> <li><a href="#website_fetch" data-toggle="tab" class="video_share" data-action="switchPublish" data-params="video_share"><img alt="{lang video_share}" class="fig" src="<?php echo base_url("assets/img/publish-video.png"); ?> ">{lang video_share}</a></li> <?php } ?> <li><a href="#article_share" data-toggle="tab" class="article_share" data-action="switchPublish" data-params="article_share"><img alt="{lang article_share}" class="fig" src="<?php echo base_url("assets/img/publish-text.png"); ?> ">{lang article_share}</a></li> </ul> <form id="save_share_form" data-url="" next-url="<?php echo spUrl('pin', 'index'); ?> " method="post"> <input type="hidden" name="cover_filename" id="cover_filename"> <input type="hidden" name="item_id" id="item_id"> <input type="hidden" name="channel" id="channel"> <input type="hidden" name="share_type" id="share_type"> <input type="hidden" name="reference_url" id="reference_url"> <input type="hidden" name="all_files" id="all_files"> <input type="hidden" name="flv" id="flv"> <input type="hidden" name="groupid" id="groupid"> <input type="hidden" name="topicid" id="topicid"> <div class="tab-content" id="category_select_div"> <div class="well form-inline tab-pane" id="website_fetch"> <div class="input-prepend tab-pane"> <span class="add-on"><i class="icon-globe"></i></span><input type="text" name="remote_url" class="input-medium" id="remote_url" placeholder="{lang type_address_fetch}"/>
</div> </fieldset> </form> </div> <div class="span2 ml0"> <ul class="unstyled"> <li><strong>{lang already_register}?<a href="javascript:void(0);" data-action="openLoginDialog">{lang direct_login}</a></strong></li> <?php foreach ($vendors as $vendor) { $lowerkey = strtolower($vendor); ?> <?php if ($settings['api_setting'][$vendor]['OPEN']) { ?> <li><a href="<?php echo spUrl('social', 'go', array('vendor' => $vendor)); ?> "><i class="loginico-<?php echo $lowerkey; ?> "></i></a></li> <?php } ?> <?php } ?> </ul> </div> </div> </div>
"><strong><?php echo $group['tag_group_name_en']; ?> </strong></a></div> <ul class="taglist"> <?php $tags = explode(',', $group['tags']); ?> <?php foreach ($tags as $tag) { ?> <?php if ($tag) { ?> <li><a href="<?php echo spUrl("pin", "index", array("tag" => trim($tag))); ?> "><?php echo trim($tag); ?> </a></li> <?php } ?> <?php } ?> </ul> <?php } ?>
private function output_pin($action, $order, $conditions = array()) { $num_per_page = $this->settings['ui_layout']['pin_pagenum']; $num_per_page = $num_per_page ? $num_per_page : 15; $ptx_share = spClass('ptx_share'); $wf = $this->spArgs("wf"); if ($this->page == 1) { $guide['show'] = true; if ($this->category_id) { $ptx_tag = spClass('ptx_tag'); $guide['tag_group'] = $ptx_tag->get_tag_group(" ptx_tag.category_id = '" . $this->category_id . "'"); } $this->guide = $guide; } $args = array(); if ($conditions['color']) { $args['idx'] = $conditions['color']; } $args['page'] = '2'; $args['wf'] = '1'; if ($this->category_id) { $conditions['category_id'] = $this->category_id; $args['cat'] = $this->category_id; } if ($this->settings['ui_layout']['orgin_post']) { $conditions['orgin_post'] = 1; } $this->nextpage_url = spUrl("pin", $action, $args); $shares = $ptx_share->search($conditions, $this->page, $num_per_page, null, $order); $this->pages = createTPages($ptx_share->spPager()->getPager(), 'pin', $action, $conditions); $shares = $this->add_ads($shares); $this->waterfallView($shares, 'pin'); $need_header_footer = $wf == '1' ? false : true; $this->output("pin/index", $need_header_footer); }
function logout() { unset($_SESSION['userInfo']); $this->jump(spUrl('main', 'index', array('act' => 'logout'))); }
function changeIdentity() { if ($_SESSION['user']['type'] == 0) { $_SESSION['user']['type'] = 1; $this->jump(spUrl('sub', 'sitemanage')); // 跳转到首页 } else { $_SESSION['user']['type'] = 0; $this->jump(spUrl('sub', 'product')); // 跳转到首页 } //$this->jump($_SERVER['HTTP_REFERER']);跳转到之前的页面 }
function delete() { $type = $this->spArgs('type'); $id = $this->spArgs('id'); $res = false; switch ($type) { case 'messages': $res = spClass('messages')->delete($id); if ($res) { $this->success('删除成功!', spUrl('admin', 'talk')); } else { $this->success('操作异常!', spUrl('admin', 'talk')); } return; break; case 'news': $res = spClass('news')->delete($id); break; case 'hirings': $res = spClass('hirings')->delete($id); break; case 'projects': $res = spClass('projects')->delete($id); break; case 'products': $res = spClass('products')->delete($id); break; } if ($res) { $this->success("删除成功!", "/index.php?c=admin&a=manager_content&type={$type}"); } else { $this->success('操作异常!'); } }
public function album_shares() { $num_per_page = 15; $ptx_album = spClass('ptx_album'); $data['album_id'] = $this->album_id; if (!$this->album_id || !($album = $ptx_album->find($data))) { $this->error(T('album_not_existed')); return; } if ($this->page == 1) { if ($this->is_login() && $album['user_id'] == $this->current_user['user_id']) { $this->userControl(); } else { $this->userControlPub($album['user_id']); } } $args = array("page" => "2"); if ($this->category_id) { $conditions['category_id'] = $this->category_id; $args['cat'] = $this->category_id; } if ($this->album_id) { $conditions['album_id'] = $this->album_id; $args['aid'] = $this->album_id; } $this->album = $album; $this->action_title = T('album') . ':' . $album['album_title']; $this->nextpage_url = spUrl($this->current_controller, $this->current_action, $args); $ptx_share = spClass('ptx_share'); $shares = $ptx_share->search($conditions, $this->page, $num_per_page); $this->waterfallView($shares, 'pin'); $this->output("user/pin"); }
?> " data-starcovercrop-url="<?php echo spUrl('staruser', 'crop_staruser_cover'); ?> " data-sendmessage-url="<?php echo spUrl('my', 'sendmessage'); ?> " data-forgetpassword-url="<?php echo spUrl('webuser', 'forget_password'); ?> " data-domaincheck-url="<?php echo spUrl('webuser', 'ajax_domain_valid'); ?> " > </script> <script type="text/template" id="data-tips" data-welcome="{lang welcome_to_pintuxiu}" data-error="{lang error}" data-no-selection="{lang no_selection}" data-confirm-delete-share="{lang confirm_delete_share}" data-confirm-delete-comment="{lang confirm_delete_comment}" data-confirm-delete-album="{lang confirm_delete_album}" data-confirm-banuser="******" data-not-null="{lang not_null}" data-required-field="{lang required_field}"
function new_message_go() { $content = $this->spArgs('content'); $contact = $this->spArgs('contact'); if ($content == '' || $content == null) { $this->error('内容为空,已舍弃。'); } spClass('messages')->add($content, $contact); $this->success("感谢您的留言,我们会及时做出回复,谢谢。", spUrl('main', 'talk')); }