function actionModify() { $id = (int) $this->_context->get('id'); $rs = Account::find('user_id = ?', $id)->getOne(); if (!$rs->id()) { return $this->msg($tip = '参数错误', url('manage::account')); } $form = Form_Common::createForm('', 'manage/profile'); if ($this->_context->isPOST() && $form->validate($_POST)) { $post = $form->values(); $user_mail = $post['user_mail']; $user_pass = $post['user_pass']; $is_locked = $post['is_locked'] ? '1' : '0'; #dump($post); if ($user_pass) { $user_pass = sha1(md5('sike' . $post['user_pass'] . Q::ini('appini/secret_key'))); $rs->user_pass; } $rs->user_mail = $user_mail; $rs->is_locked = $is_locked; $rs->save(); return $this->msg($tip = '修改成功', url('manage::account/modify', array('id' => $id))); } $form->import($rs->toArray()); $form->element('user_pass')->value = ''; $form->element('is_locked')->checked = $rs->is_locked; #dump($form->element('is_locked')); $this->_view['form'] = $form; $this->_view['rs'] = $rs; $order = Order::find('user_id = ?', $id)->order('created DESC')->getAll(); $this->_view['order'] = $order; $this->_view['_UDI'] = 'manage::account/index'; }
/** * Update the specified resource in storage. * * @param Request $request * @return Response * @internal param User $user * @internal param int $id */ public function update(Request $request) { $this->validate($request, ['first_name' => 'required|max:255', 'last_name' => 'required|max:255', 'sex' => 'required', 'date_of_birth' => 'required']); $request['date_of_birth'] = Carbon::parse($request->get('date_of_birth')); Auth::user()->update($request->all()); return redirect(url('/users/show'))->with('message', "Successfully updated Your info."); }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { if ($request->user()->admin) { return $next($request); } return new RedirectResponse(url('post/liste')); }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { if ($this->auth->check()) { return new RedirectResponse(url('/terrain')); } return $next($request); }
/** * Implements EntityReferenceHandler::settingsForm(). */ public static function settingsForm($field, $instance) { $view_settings = empty($field['settings']['handler_settings']['view']) ? '' : $field['settings']['handler_settings']['view']; $displays = views_get_applicable_views('entityreference display'); // Filter views that list the entity type we want, and group the separate // displays by view. $entity_info = entity_get_info($field['settings']['target_type']); $options = array(); foreach ($displays as $data) { list($view, $display_id) = $data; if ($view->base_table == $entity_info['base table']) { $options[$view->name . ':' . $display_id] = $view->name . ' - ' . $view->display[$display_id]->display_title; } } // The value of the 'view_and_display' select below will need to be split // into 'view_name' and 'view_display' in the final submitted values, so // we massage the data at validate time on the wrapping element (not // ideal). $form['view']['#element_validate'] = array('entityreference_view_settings_validate'); if ($options) { $default = !empty($view_settings['view_name']) ? $view_settings['view_name'] . ':' . $view_settings['display_name'] : NULL; $form['view']['view_and_display'] = array('#type' => 'select', '#title' => t('View used to select the entities'), '#required' => TRUE, '#options' => $options, '#default_value' => $default, '#description' => '<p>' . t('Choose the view and display that select the entities that can be referenced.<br />Only views with a display of type "Entity Reference" are eligible.') . '</p>'); $default = !empty($view_settings['args']) ? implode(', ', $view_settings['args']) : ''; $form['view']['args'] = array('#type' => 'textfield', '#title' => t('View arguments'), '#default_value' => $default, '#required' => FALSE, '#description' => t('Provide a comma separated list of arguments to pass to the view.')); } else { $form['view']['no_view_help'] = array('#markup' => '<p>' . t('No eligible views were found. <a href="@create">Create a view</a> with an <em>Entity Reference</em> display, or add such a display to an <a href="@existing">existing view</a>.', array('@create' => url('admin/structure/views/add'), '@existing' => url('admin/structure/views'))) . '</p>'); } return $form; }
/** * @return null|string */ public function getCurrentUrl() { if (is_null($this->currentUrl)) { return url()->current(); } return $this->currentUrl; }
/** * {@inheritdoc} */ public function buildForm(array $form, array &$form_state) { $form['#action'] = url('ajax-test/dialog'); $form['description'] = array('#markup' => '<p>' . t("Ajax Form contents description.") . '</p>'); $form['submit'] = array('#type' => 'submit', '#value' => t('Do it')); return $form; }
/** * Overrides theme_textfield(). */ function bootstrap_sst_textfield($variables) { $element = $variables['element']; $element['#attributes']['type'] = 'text'; element_set_attributes($element, array('id', 'name', 'value', 'size', 'maxlength')); _form_set_class($element, array('form-text')); $output = '<input' . drupal_attributes($element['#attributes']) . ' />'; $extra = ''; if ($element['#autocomplete_path'] && drupal_valid_path($element['#autocomplete_path'])) { drupal_add_library('system', 'drupal.autocomplete'); $element['#attributes']['class'][] = 'form-autocomplete'; $attributes = array(); $attributes['type'] = 'hidden'; $attributes['id'] = $element['#attributes']['id'] . '-autocomplete'; $attributes['value'] = url($element['#autocomplete_path'], array('absolute' => TRUE)); $attributes['disabled'] = 'disabled'; $attributes['class'][] = 'autocomplete'; // Uses icon for autocomplete "throbber". if ($icon = _bootstrap_icon('refresh')) { $output = '<div class="input-group">' . $output . '<span class="input-group-addon">' . $icon . '</span></div>'; } else { $output = '<div class="input-group">' . $output . '<span class="input-group-addon">'; // The throbber's background image must be set here because sites may not // be at the root of the domain (ie: /) and this value cannot be set via // CSS. $output .= '<span class="autocomplete-throbber" style="background-image:url(' . url('misc/throbber.gif') . ')"></span>'; $output .= '</span></div>'; } $extra = '<input' . drupal_attributes($attributes) . ' />'; } return $output . $extra; }
public function index(Request $request) { $menus = app('menu')->where('parentid', '=', 0)->get(); $leftMainUrl = url('/dash/left_main?menuid='); $params = ['menus' => $menus, 'left_main_url' => $leftMainUrl, 'crumb_url' => route('dash.crumbs')]; return view('dash.index', $params); }
public function __construct($meta = array()) { $this->label = t('Create new'); $this->icon = 'glyphicon-new-window'; $this->url = url(current_path(), array('action' => 'add')); parent::__construct($meta); }
/** * $code 消息代码 * $ctl 控制器 * $ac 方法名 * $reftime 跳转时间 */ protected function msg($code, $ctl = '', $ac = '', $params = array(), $reftime = 3) { if (substr($code, 0, 1) == '-') { $this->_V->assign("msgtype", 0); } elseif (intval($code) > 10000 || intval($code) < 1000) { $this->_V->assign("msgtype", -1); } else { $this->_V->assign("msgtype", 1); } //生成导航 $this->setNav(array('操作提示')); // 生成跳转URL if (empty($ctl)) { $goto = 'javascript:history.back();'; } else { $ac = empty($ac) ? "Index" : $ac; $rurl = url($ctl, $ac, $params); $goto = "javascript:document.location.href='" . $rurl . "'"; } $this->_V->assign("rurl", $rurl); $this->_V->assign("goto", $goto); $this->_V->assign("code", $code); $this->_V->assign("reftime", $reftime); $this->_V->display("msg.htm"); exit; }
/** * This returns the form for the collections. * * @return Zend_Form * @author Eric Rochester <*****@*****.**> **/ protected function _collectionsForm() { $ctable = $this->_helper->db->getTable('Collection'); $private = (int) get_option('solr_search_display_private_items'); if ($private) { $collections = $ctable->findAll(); } else { $collections = $ctable->findBy(array('public' => 1)); } $form = new Zend_Form(); $form->setAction(url('solr-search/collections'))->setMethod('post'); $collbox = new Zend_Form_Element_MultiCheckbox('solrexclude'); $form->addElement($collbox); foreach ($collections as $c) { $title = metadata($c, array('Dublin Core', 'Title')); $collbox->addMultiOption("{$c->id}", $title); } $etable = $this->_helper->db->getTable('SolrSearchExclude'); $excludes = array(); foreach ($etable->findAll() as $exclude) { $excludes[] = "{$exclude->collection_id}"; } $collbox->setValue($excludes); $form->addElement('submit', 'Exclude'); return $form; }
/** * Initialize theme settings if needed */ function fusion_core_initialize_theme_settings($theme_name) { $theme_settings = theme_get_settings($theme_name); if (is_null($theme_settings['theme_font_size']) || $theme_settings['rebuild_registry'] == 1) { // Rebuild theme registry & notify user if ($theme_settings['rebuild_registry'] == 1) { drupal_rebuild_theme_registry(); drupal_set_message(t('Theme registry rebuild completed. <a href="!link">Turn off</a> this feature for production websites.', array('!link' => url('admin/build/themes/settings/' . $GLOBALS['theme']))), 'warning'); } // Retrieve saved or site-wide theme settings $theme_setting_name = str_replace('/', '_', 'theme_' . $theme_name . '_settings'); $settings = variable_get($theme_setting_name, FALSE) ? theme_get_settings($theme_name) : theme_get_settings(); // Skip toggle_node_info_ settings if (module_exists('node')) { foreach (node_get_types() as $type => $name) { unset($settings['toggle_node_info_' . $type]); } } // Retrieve default theme settings $defaults = fusion_core_default_theme_settings(); // Set combined default & saved theme settings variable_set($theme_setting_name, array_merge($defaults, $settings)); // Force theme settings refresh theme_get_setting('', TRUE); } }
/** * Initialize theme settings if needed */ function fusion_core_initialize_theme_settings($theme_name) { $theme_settings = theme_get_settings($theme_name); if (!isset($theme_settings['primary_menu_dropdown']) || $theme_settings['rebuild_registry'] == 1) { static $registry_rebuilt = false; // avoid multiple rebuilds per page // Rebuild theme registry & notify user if (isset($theme_settings['rebuild_registry']) && $theme_settings['rebuild_registry'] == 1 && !$registry_rebuilt) { drupal_rebuild_theme_registry(); drupal_set_message(t('Theme registry rebuild completed. <a href="!link">Turn off</a> this feature for production websites.', array('!link' => url('admin/build/themes/settings/' . $GLOBALS['theme']))), 'warning'); $registry_rebuilt = true; } // Retrieve saved or site-wide theme settings $theme_setting_name = str_replace('/', '_', 'theme_' . $theme_name . '_settings'); $settings = variable_get($theme_setting_name, FALSE) ? theme_get_settings($theme_name) : theme_get_settings(); // Skip toggle_node_info_ settings if (module_exists('node')) { foreach (node_get_types() as $type => $name) { unset($settings['toggle_node_info_' . $type]); } } // Combine default theme settings from .info file & theme-settings.php $theme_data = list_themes(); // get theme data for all themes $info_theme_settings = $theme_name ? $theme_data[$theme_name]->info['settings'] : array(); $defaults = array_merge(fusion_core_default_theme_settings(), $info_theme_settings); // Set combined default & saved theme settings variable_set($theme_setting_name, array_merge($defaults, $settings)); // Force theme settings refresh theme_get_setting('', TRUE); } }
public function index(Request $request) { //处理分享次数加1 $this->_shareTimes($request); $key = 'bonus_' . $this->user->getKey() . '_game'; if (!Cache::has($key)) { $times = 1; Cache::forever($key, $times); } else { $times = intval(Cache::get($key, 0)); } $this->_wechat = $this->getJsParameters(); $this->_times = $times; $this->_uid = $this->user->getKey(); $this->_type_id = 3; $this->_data = ['title' => '美猴捞红包', 'imgUrl' => 'plugins/img/m/monkey/monkey_main.jpg', 'desc' => '参加游戏,赢取猴子新年红包。']; $this->_bonus_cnt = ActivityBonus::where('uid', $this->user->getKey())->where('status', 0)->count(); $stores_ids = $this->user->stores->pluck('id')->toArray(); $stores_id = array_pop($stores_ids); $this->_share_url = url('m/home?sid=' . $stores_id . '&redirect_url=' . urlencode(url('m/game/loading') . '?uid=' . $this->_uid)); $this->_save_put_code = str_random(40); $save_code_key = 'save_put_code_' . $this->user->getKey(); session([$save_code_key => $this->_save_put_code]); //查找中奖列表 $this->_bonus_list = ActivityBonus::with(['users'])->orderBy('created_at', 'desc')->take(9)->get(); return $this->view('monkey::m.game'); }
/** * Get the public path to the image * @param string $path * @return string */ public function getPublicUrl($path = '') { if (isset($this->options['public_url'])) { return $this->options['public_url']; } return url() . '/' . $this->addSlashes(self::DEFAULT_PUBLIC_PATH) . $path; }
/** * Build the Site Map */ protected function buildSiteMap() { $postsInfo = $this->getPostsInfo(); $dates = array_values($postsInfo); sort($dates); $lastmod = last($dates); $url = trim(url(), '/') . '/'; $xml = []; $xml[] = '<?xml version="1.0" encoding="UTF-8"?' . '>'; $xml[] = '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; $xml[] = ' <url>'; $xml[] = " <loc>{$url}</loc>"; $xml[] = " <lastmod>{$lastmod}</lastmod>"; $xml[] = ' <changefreq>daily</changefreq>'; $xml[] = ' <priority>0.8</priority>'; $xml[] = ' </url>'; foreach ($postsInfo as $slug => $lastmod) { $xml[] = ' <url>'; $xml[] = " <loc>{$url}home/{$slug}</loc>"; $xml[] = " <lastmod>{$lastmod}</lastmod>"; $xml[] = " </url>"; } $xml[] = '</urlset>'; return join("\n", $xml); }
/** * Get the user avatar. * * @return string */ public function presentAvatarUrl() { if ($this->object->avatar) { return url($this->object->avatar); } return Gravatar::get($this->object->email); }
public function showConnector() { $roots = $this->app->config->get('elfinder.roots', []); if (empty($roots)) { $dirs = (array) $this->app['config']->get('elfinder.dir', []); foreach ($dirs as $dir) { $roots[] = ['driver' => 'LocalFileSystem', 'path' => public_path($dir), 'URL' => url($dir), 'accessControl' => $this->app->config->get('elfinder.access')]; } $disks = (array) $this->app['config']->get('elfinder.disks', []); foreach ($disks as $key => $root) { if (is_string($root)) { $key = $root; $root = []; } $disk = app('filesystem')->disk($key); if ($disk instanceof FilesystemAdapter) { $defaults = ['driver' => 'Flysystem', 'filesystem' => $disk->getDriver(), 'alias' => $key]; $roots[] = array_merge($defaults, $root); } } } $opts = $this->app->config->get('elfinder.options', array()); $opts = array_merge(['roots' => $roots], $opts); // run elFinder $connector = new Connector(new \elFinder($opts)); $connector->run(); return $connector->getResponse(); }
/** * * * @return LightOpenID */ public function getOpenID() { $OpenID = new LightOpenID(); if ($url = Gdn::request()->get('url')) { if (!filter_var($url, FILTER_VALIDATE_URL)) { throw new Gdn_UserException(sprintf(t('ValidateUrl'), 'OpenID'), 400); } // Don't allow open ID on a non-standard scheme. $scheme = parse_url($url, PHP_URL_SCHEME); if (!in_array($scheme, array('http', 'https'))) { throw new Gdn_UserException(sprintf(t('ValidateUrl'), 'OpenID'), 400); } // Don't allow open ID on a non-standard port. $port = parse_url($url, PHP_URL_PORT); if ($port && !in_array($port, array(80, 8080, 443))) { throw new Gdn_UserException(t('OpenID is not allowed on non-standard ports.')); } $OpenID->identity = $url; } $Url = url('/entry/connect/openid', true); $UrlParts = explode('?', $Url); parse_str(val(1, $UrlParts, ''), $Query); $Query = array_merge($Query, arrayTranslate($_GET, array('display', 'Target'))); $OpenID->returnUrl = $UrlParts[0] . '?' . http_build_query($Query); $OpenID->required = array('contact/email', 'namePerson/first', 'namePerson/last', 'pref/language'); $this->EventArguments['OpenID'] = $OpenID; $this->fireEvent('GetOpenID'); return $OpenID; }
public function disconnect() { //S'il n'est meme pas connecter et essaye d'ouvrir l'action disconnect //le redireger ver la page de connexion $this->backupDB(); if (!isset($this->session->user)) { header("Location:" . url("connexion")); } $id = $this->session->idconnexion; $connexion = "Connexion réussie"; /** il a deborder, sa session est expiree */ if ($this->session->timeout <= time()) { $datefin = date("Y-m-d H:i:s", $this->session->timeout); $deconnexion = "Session expriée"; } else { /** Il s'est deconnecter durant sa session normale */ $deconnexion = "Session fermée correctement"; $datefin = date("Y-m-d H:i:s", time()); } //updateConnexion($idconnexion, $connexion, $datefin, $deconnexion) $this->Connexion->updateConnexion($id, $connexion, $datefin, $deconnexion); unset($_SESSION['user']); unset($_SESSION['profile']); unset($_SESSION['droits']); unset($_SESSION['timeout']); unset($_SESSION['idconnexion']); unset($_SESSION['idprofile']); session_destroy(); header("Location:" . Router::url('connexion')); }
public function get_medal() { $user_id = intval($GLOBALS['user_info']['id']); $medal = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "medal where class_name = 'Tencentbind'"); $medal['config'] = unserialize($medal['config']); $user_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $user_id); $data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_medal where medal_id = " . $medal['id'] . " and user_id = " . $user_id); if ($data) { //已经领取 $result['status'] = 2; $result['info'] = "您已经领取过" . $medal['name']; } else { if ($user_info['tencent_id'] != '') { $link_data['user_id'] = $user_id; $link_data['medal_id'] = $medal['id']; $link_data['name'] = $medal['name']; $link_data['icon'] = $medal['icon']; $link_data['create_time'] = get_gmtime(); $GLOBALS['db']->autoExecute(DB_PREFIX . "user_medal", $link_data); $result['status'] = 1; //领取成功 $result['info'] = "您已经成功领取" . $medal['name']; } else { $result['status'] = 0; $result['info'] = "领取该勋章需要绑定腾讯微博帐号"; $result['jump'] = url("shop", "uc_center#setweibo"); } } return $result; }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { if (session('statut') === 'admin') { return $next($request); } return new RedirectResponse(url('/kadmin/login')); }
/** * {@inheritdoc} */ public function buildForm(array $form, array &$form_state) { $form['#attached']['library'][] = 'system/drupal.system'; $config = $this->config('system.performance'); $form['clear_cache'] = array('#type' => 'details', '#title' => t('Clear cache'), '#open' => TRUE); $form['clear_cache']['clear'] = array('#type' => 'submit', '#value' => t('Clear all caches'), '#submit' => array(array($this, 'submitCacheClear'))); $form['caching'] = array('#type' => 'details', '#title' => t('Caching'), '#open' => TRUE); // Identical options to the ones for block caching. // @see \Drupal\block\BlockBase::buildConfigurationForm() $period = array(0, 60, 180, 300, 600, 900, 1800, 2700, 3600, 10800, 21600, 32400, 43200, 86400); $period = array_map(array($this->dateFormatter, 'formatInterval'), array_combine($period, $period)); $period[0] = '<' . t('no caching') . '>'; $form['caching']['page_cache_maximum_age'] = array('#type' => 'select', '#title' => t('Page cache maximum age'), '#default_value' => $config->get('cache.page.max_age'), '#options' => $period, '#description' => t('The maximum time a page can be cached. This is used as the value for max-age in Cache-Control headers.')); $form['caching']['cache'] = array('#type' => 'checkbox', '#title' => t('Use internal page cache'), '#description' => t("If a reverse proxy cache isn't available, use Drupal's internal cache system to store cached pages."), '#default_value' => $config->get('cache.page.use_internal')); $directory = 'public://'; $is_writable = is_dir($directory) && is_writable($directory); $disabled = !$is_writable; $disabled_message = ''; if (!$is_writable) { $disabled_message = ' ' . t('<strong class="error">Set up the <a href="!file-system">public files directory</a> to make these optimizations available.</strong>', array('!file-system' => url('admin/config/media/file-system'))); } $form['bandwidth_optimization'] = array('#type' => 'details', '#title' => t('Bandwidth optimization'), '#open' => TRUE, '#description' => t('External resources can be optimized automatically, which can reduce both the size and number of requests made to your website.') . $disabled_message); $form['bandwidth_optimization']['page_compression'] = array('#type' => 'checkbox', '#title' => t('Compress cached pages.'), '#default_value' => $config->get('response.gzip'), '#states' => array('visible' => array('input[name="cache"]' => array('checked' => TRUE)))); $form['bandwidth_optimization']['preprocess_css'] = array('#type' => 'checkbox', '#title' => t('Aggregate CSS files.'), '#default_value' => $config->get('css.preprocess'), '#disabled' => $disabled); $form['bandwidth_optimization']['preprocess_js'] = array('#type' => 'checkbox', '#title' => t('Aggregate JavaScript files.'), '#default_value' => $config->get('js.preprocess'), '#disabled' => $disabled); return parent::buildForm($form, $form_state); }
/** * Theme a "you can't post comments" notice. * * @param $node * The comment node. * @ingroup themeable */ function city_magazine_comment_post_forbidden($node) { global $user; static $authenticated_post_comments; if (!$user->uid) { if (!isset($authenticated_post_comments)) { // We only output any link if we are certain, that users get permission // to post comments by logging in. We also locally cache this information. $authenticated_post_comments = array_key_exists(DRUPAL_AUTHENTICATED_RID, user_roles(TRUE, 'post comments') + user_roles(TRUE, 'post comments without approval')); } if ($authenticated_post_comments) { // We cannot use drupal_get_destination() because these links // sometimes appear on /node and taxonomy listing pages. if (variable_get('comment_form_location_' . $node->type, COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE) { $destination = 'destination=' . rawurlencode("comment/reply/{$node->nid}#comment-form"); } else { $destination = 'destination=' . rawurlencode("node/{$node->nid}#comment-form"); } if (variable_get('user_register', 1)) { // Users can register themselves. // original //return t('<a href="@login"><span>Login</span></a> <span class="regulat-text">or</span> <a href="@register"><span>register</span></a> <span class="regulat-text">to post comments</span>', array('@login' => url('user/login', array('query' => $destination)), '@register' => url('user/register', array('query' => $destination)))); // no register return t('<a href="@login"><span>Login</span></a> <span class="regulat-text">to post comments</span>', array('@login' => url('user/login', array('query' => $destination)))); } else { // Only admins can add new users, no public registration. return t('<a href="@login"><span>Login</span></a> to post comments', array('@login' => url('user/login', array('query' => $destination)))); } } } }
/** * @return string */ public function run() { $config = CRM_Core_Config::singleton(); switch ($config->userFramework) { case 'Drupal': $this->assign('ufAccessURL', url('admin/people/permissions')); break; case 'Drupal6': $this->assign('ufAccessURL', url('admin/user/permissions')); break; case 'Joomla': //condition based on Joomla version; <= 2.5 uses modal window; >= 3.0 uses full page with return value if (version_compare(JVERSION, '3.0', 'lt')) { JHTML::_('behavior.modal'); $url = $config->userFrameworkBaseURL . 'index.php?option=com_config&view=component&component=com_civicrm&tmpl=component'; $jparams = 'rel="{handler: \'iframe\', size: {x: 875, y: 550}, onClose: function() {}}" class="modal"'; $this->assign('ufAccessURL', $url); $this->assign('jAccessParams', $jparams); } else { $uri = (string) JUri::getInstance(); $return = urlencode(base64_encode($uri)); $url = $config->userFrameworkBaseURL . 'index.php?option=com_config&view=component&component=com_civicrm&return=' . $return; $this->assign('ufAccessURL', $url); $this->assign('jAccessParams', ''); } break; case 'WordPress': $this->assign('ufAccessURL', CRM_Utils_System::url('civicrm/admin/access/wp-permissions', 'reset=1')); break; } return parent::run(); }
private function view() { $id = intval($_REQUEST['id']); if ($id == 0) { app_redirect(url("index", "usagetip")); } $GLOBALS['tmpl']->caching = true; $GLOBALS['tmpl']->cache_lifetime = 6000; //首页缓存10分钟 $cache_id = md5(MODULE_NAME . ACTION_NAME . "view" . $id); if (!$GLOBALS['tmpl']->is_cached("page/usagetip_view.html", $cache_id)) { $article = get_article($id); $GLOBALS['tmpl']->assign("article", $article); $seo_title = $article['seo_title'] != '' ? $article['seo_title'] : $article['title']; $GLOBALS['tmpl']->assign("page_title", $seo_title); $seo_keyword = $article['seo_keyword'] != '' ? $article['seo_keyword'] : $article['title']; $GLOBALS['tmpl']->assign("page_keyword", $seo_keyword . ","); $seo_description = $article['seo_description'] != '' ? $article['seo_description'] : $article['title']; $GLOBALS['tmpl']->assign("page_description", $seo_description . ","); //使用技巧 $use_tech_list = get_article_list(6, 6); $GLOBALS['tmpl']->assign("use_tech_list", $use_tech_list); } $GLOBALS['tmpl']->display("page/usagetip_view.html", $cache_id); }
public function index() { global $tmpl; $rel_table = addslashes(trim($_REQUEST['act'])); $message_type = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "message_type where type_name='" . $rel_table . "' and type_name <> 'supplier'"); if (!$message_type || $message_type['is_fix'] == 0) { app_redirect(APP_ROOT . "/"); } $rel_table = $message_type['type_name']; $condition = ''; $id = intval($_REQUEST['id']); if ($rel_table == 'deal') { $deal = get_deal($id); if ($deal['buy_type'] != 1) { $GLOBALS['tmpl']->assign("deal", $deal); } $id = $deal['id']; } require APP_ROOT_PATH . 'app/Lib/side.php'; if ($id > 0) { $condition = "rel_table = '" . $rel_table . "' and rel_id = " . $id; } else { $condition = "rel_table = '" . $rel_table . "'"; } if (app_conf("USER_MESSAGE_AUTO_EFFECT") == 0) { $condition .= " and user_id = " . intval($GLOBALS['user_info']['id']); } else { if ($message_type['is_effect'] == 0) { $condition .= " and user_id = " . intval($GLOBALS['user_info']['id']); } } $condition .= " and is_buy = " . intval($_REQUEST['is_buy']); //message_form 变量输出 $GLOBALS['tmpl']->assign("post_title", $message_type['show_name']); $GLOBALS['tmpl']->assign("page_title", $message_type['show_name']); $GLOBALS['tmpl']->assign('rel_id', $id); $GLOBALS['tmpl']->assign('rel_table', $rel_table); $GLOBALS['tmpl']->assign('is_buy', intval($_REQUEST['is_buy'])); if (intval($_REQUEST['is_buy']) == 1) { $GLOBALS['tmpl']->assign("post_title", $GLOBALS['lang']['AFTER_BUY']); $GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['AFTER_BUY']); } if (!$GLOBALS['user_info']) { $GLOBALS['tmpl']->assign("message_login_tip", sprintf($GLOBALS['lang']['MESSAGE_LOGIN_TIP'], url("shop", "user#login"), url("shop", "user#register"))); } //分页 $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE"); $message = get_message_list($limit, $condition); $page = new Page($message['count'], app_conf("PAGE_SIZE")); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); $GLOBALS['tmpl']->assign("message_list", $message['list']); $GLOBALS['tmpl']->assign("user_auth", get_user_auth()); $GLOBALS['tmpl']->display("message.html"); }
/** * 删除 */ public function delAction() { $dir = base64_decode($this->get('name')); $name = $this->dir . $dir; $name = substr($name, -1) == '/' ? substr($name, 0, -1) : $name; if ($this->checkFileName($name)) { $this->adminMsg(lang('m-con-20')); } if ($this->dir == $name || $this->dir == $name . '/') { $this->adminMsg(lang('a-att-0')); } if (!file_exists($name)) { $this->adminMsg(lang('a-att-1', array('1' => $name))); } if (is_dir($name)) { //删除目录 $this->delDir($name); $this->adminMsg(lang('a-att-2'), url('admin/attachment/index', array('dir' => base64_encode(str_replace(basename($dir), '', $dir)))), 3, 1, 1); } if (is_file($name)) { //删除文件 unlink($name); $this->adminMsg(lang('a-att-3'), url('admin/attachment/index', array('dir' => base64_encode(str_replace(basename($dir), '', $dir)))), 3, 1, 1); } }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(\App\Http\Requests\StorePageRequest $request, $id) { $page = \App\Page::where(['id' => $id])->first(); $page->fill($request->all()); $page->save(); return redirect(url('admin')); }