public function index($nidtype = 'news', $nid = '') { if (isPost()) { extract($_POST); } if (isGet()) { extract($_GET); } /* ----------------------------------------------------- * Talbe Field * ----------------------------------------------------- */ $param['data'] = array('nidtype' => $nidtype, 'nid' => $nid); /* ----------------------------------------------------- * Page Param * ----------------------------------------------------- */ $param['page'] = isset($page) ? $page : 1; $param['page_size'] = 3; //每页显示条数 $param['show_page'] = 5; //页面banner能显示页数 $param['uri'] = 'news?page='; $datalist = $this->cinode->select($param); $this->put("list", $datalist['data']); debug($datalist['data'], DEBUGPATH, 'news datalist'); $this->put("pagerbar", $datalist['pagebanner']); $this->render('news_list.html'); }
/** * [index 产品列表] * uri domain/nidtype/nid/page * @param string $nidtype [description] * @param integer $page [description] * @param string $nid [description] * @return [type] [description] */ public function index($nidtype = 'article', $nid = '') { if (isPost()) { extract($_POST); } if (isGet()) { extract($_GET); } /* ----------------------------------------------------- * Talbe Field * ----------------------------------------------------- */ $param['data'] = array('nidtype' => $nidtype, 'nid' => $nid); /* ----------------------------------------------------- * Page Param * ----------------------------------------------------- */ $param['page'] = isset($page) ? $page : 1; $param['page_size'] = 1; //当前页数 $param['show_page'] = 5; //页面banner能显示页数 $datalist = $this->cinode->select($param); $this->cismarty->assign("datalist", $datalist['data']); $this->cismarty->assign("pages", $datalist['pagebanner']); //传入菜单按钮active状态 $this->cismarty->assign("active", array(__CLASS__, __FUNCTION__)); $title = t("article_list"); $this->cismarty->assign("title", $title); $this->cismarty->display("nodearticle/nodearticle_index.html"); }
protected function EventIndex() { /** * Обработка удаления плагинов */ if (isPost('submit_plugins_del')) { $this->Security_ValidateSendForm(); $aPluginsDelete = getRequest('plugins_del'); if (is_array($aPluginsDelete)) { $this->Plugin_Delete(array_keys($aPluginsDelete)); } } if ($sPlugin = getRequest('plugin', null, 'get') and $sAction = getRequest('action', null, 'get')) { return $this->SubmitManagePlugin($sPlugin, $sAction); } /** * Передан ли номер страницы */ $iPage = preg_match("/^\\d+\$/i", $this->GetEventMatch(2)) ? $this->GetEventMatch(2) : 1; /** * Получаем список блогов */ $aPlugins = $this->Plugin_GetList(); /** * Загружаем переменные в шаблон */ $this->Viewer_Assign("aPlugins", $aPlugins); $this->Viewer_AddHtmlTitle($this->Lang_Get('plugins_administartion_title')); /** * Устанавливаем шаблон вывода */ $this->SetTemplateAction('index'); }
protected function _EventPluginsList() { // * Обработка удаления плагинов if (isPost('submit_plugins_del')) { $this->EventPluginsDelete(); } elseif (isPost('submit_plugins_save')) { $this->EventPluginsSave(); } else { if ($sPlugin = getRequest('plugin', null, 'get') and $sAction = getRequest('action', null, 'get')) { if ($sAction == 'deactivate') { return $this->_SubmitManagePlugin($sPlugin, $sAction); } else { return $this->EventPluginsActivate($sPlugin); } } } $sMode = $this->GetParam(1); if (!$sMode) { $sMode == 'all'; } $aPlugins = $this->PluginAceadminpanel_Plugin_GetPluginList(); if ($sMode != 'all') { foreach ($aPlugins as $sPlugin => $oPlugin) { if ($sMode == 'active' and !$oPlugin->IsActive() or $sMode == 'inactive' and $oPlugin->IsActive()) { unset($aPlugins[$sPlugin]); } } } $this->Viewer_Assign('aPluginList', $aPlugins); $this->Viewer_AddHtmlTitle($this->Lang_Get('plugins_administartion_title')); $this->Viewer_Assign('sMode', $sMode); $this->SetTemplateAction('plugins_list'); }
/** {@inheritdoc} */ public function showMain() { if (!is_writable($this->app['configPath'])) { $this->addMessage("Configuration file doesn't seem to be writable.", self::MSG_ERROR); } $config = $this->app->openConfiguration(); $pages = PagePeer::getSelect(); $form = new Curry_Form(array('action' => url('', array("module", "view")), 'method' => 'post', 'elements' => array('enabled' => array('checkbox', array('label' => 'Enable domain mapping', 'value' => $config->domainMapping->enabled)), 'default_base_page' => array('select', array('label' => 'Default base page', 'description' => 'The default base page will only be used if there are no other domains matching and domain mapping is enabled', 'value' => $config->domainMapping->default, 'multiOptions' => array('' => '[ None ]') + $pages))))); $domainForm = new Curry_Form_Dynamic(array('legend' => 'Domain', 'elements' => array('domain' => array('text', array('label' => 'Domain', 'description' => 'You can use default as a wildcard to fetch unmatched domains.', 'required' => true)), 'base_page' => array('select', array('label' => 'Base page', 'multiOptions' => array('' => '[ None ]') + $pages, 'required' => true)), 'include_www' => array('checkbox', array('label' => 'Include www'))))); $form->addSubForm(new Curry_Form_MultiForm(array('legend' => '', 'cloneTarget' => $domainForm, 'defaults' => $config->domainMapping->domains ? $config->domainMapping->domains->toArray() : array())), 'domainMapping'); $form->addElement('submit', 'save', array('label' => 'Save')); if (isPost() && $form->isValid($_POST)) { $values = $form->getValues(); if (!$config->domainMapping) { $config->domainMapping = array(); } $config->domainMapping->enabled = count($values['domainMapping']) ? (bool) $values['enabled'] : false; $config->domainMapping->default = $values['default_base_page']; $config->domainMapping->domains = $values['domainMapping']; try { $this->app->writeConfiguration($config); $this->addMessage("Settings saved.", self::MSG_SUCCESS); } catch (Exception $e) { $this->addMessage($e->getMessage(), self::MSG_ERROR); } } $this->addMainContent($form); }
public function Event() { if (isPost('adm_submit')) { $this->Security_ValidateSendForm(); $this->ClearComments(); } }
public function generalAction() { $model = new SettingsModel(); if (isPost()) { $data['realname'] = post('realname'); $data['country'] = post('country'); $data['city'] = post('city'); $data['sex'] = post('sex', 'int'); $data['mm'] = post('mm', 'int'); $data['dd'] = post('dd', 'int'); $data['yyyy'] = post('yyyy', 'int'); $data['about'] = post('about'); $tradelink = urldecode(post('tradelink')); if (preg_match('/' . preg_quote('/?partner=', '/') . '(.*)' . preg_quote('&token=', '/') . '/Us', $tradelink, $match)) { $partner = $match[1]; } if (preg_match('/' . preg_quote('&token=', '/') . '(.*)' . preg_quote('<<<eof', '/') . '/Us', $tradelink . '<<<eof', $match)) { $token = $match[1]; } if ($partner && $token) { $data['partner'] = $partner; $data['token'] = $token; } $model->setSettings(Request::getParam('user')->id, $data); $path = 'public/users/' . Request::getParam('user')->id . '/'; remkdir($path); File::LoadImage($_FILES['file'], $path, 'avatar', 'jpg', null, 0, 2, 184, 184); File::LoadImage($_FILES['file'], $path, 'avatar_m', 'jpg', null, 0, 2, 64, 64); File::LoadImage($_FILES['file'], $path, 'avatar_s', 'jpg', null, 0, 2, 32, 32); redirect(url('settings', 'general')); } $this->view->countrysList = $model->getCountryList(); $this->view->title = Lang::translate('GENERAL_TITLE'); }
protected function EventReport() { /** * Обработка удаления отчетов профайлера */ if (isPost('submit_report_delete')) { $this->Security_ValidateSendForm(); $aReportsId = getRequest('report_del'); if (is_array($aReportsId)) { if ($this->PluginProfiler_Profiler_DeleteEntryByRequestId(array_keys($aReportsId))) { $this->Message_AddNotice($this->Lang_Get('plugin.profiler.report_delete_success'), $this->Lang_Get('attention')); } else { $this->Message_AddError($this->Lang_Get('plugin.profiler.report_delete_error'), $this->Lang_Get('error')); } } } /** * Если вызвана обработка upload`а логов в базу данных */ if (getRequest('submit_profiler_import') and getRequest('profiler_date_import')) { $iCount = @$this->PluginProfiler_Profiler_UploadLog(date('Y-m-d H:i:s', strtotime(getRequest('profiler_date_import')))); if (!is_null($iCount)) { $this->Message_AddNotice($this->Lang_Get('plugin.profiler.import_report_success', array('count' => $iCount)), $this->Lang_Get('attention')); } else { $this->Message_AddError($this->Lang_Get('plugin.profiler.import_report_error'), $this->Lang_Get('error')); } } /** * Составляем фильтр для просмотра отчетов */ $aFilter = $this->BuildFilter(); /** * Передан ли номер страницы */ $iPage = preg_match("/^page(\\d+)\$/i", $this->getParam(0), $aMatch) ? $aMatch[1] : 1; /** * Получаем список отчетов */ $aResult = $this->PluginProfiler_Profiler_GetReportsByFilter($aFilter, $iPage, Config::Get('plugin.profiler.per_page')); $aReports = $aResult['collection']; /** * Если был использован фильтр, выводим количество найденых по фильтру */ if (count($aFilter)) { $this->Message_AddNotice($aResult['count'] ? $this->Lang_Get('plugin.profiler.filter_result_count', array('count' => $aResult['count'])) : $this->Lang_Get('plugin.profiler.filter_result_empty')); } /** * Формируем постраничность */ $aPaging = $this->Viewer_MakePaging($aResult['count'], $iPage, Config::Get('plugin.profiler.per_page'), Config::Get('pagination.pages.count'), Router::GetPath('profiler') . $this->sCurrentEvent, array_intersect_key($_REQUEST, array_fill_keys(array('start', 'end', 'request_id', 'time', 'per_page'), ''))); /** * Загружаем переменные в шаблон */ $this->Viewer_Assign('aPaging', $aPaging); $this->Viewer_Assign('aReports', $aReports); $this->Viewer_Assign('aDatabaseStat', ($aData = $this->PluginProfiler_Profiler_GetDatabaseStat()) ? $aData : array('max_date' => '', 'count' => '')); $this->Viewer_AddBlock('right', 'actions/ActionProfiler/sidebar.tpl', array('plugin' => 'profiler')); $this->Viewer_AddHtmlTitle($this->Lang_Get('plugin.profiler.report_page_title')); }
public function edit() { if (isPost()) { return $this->_edit(); } $row = m('Category')->getRowById(get('id')); $this->view()->assign('title', '编辑分类')->assign('action', url('Category', 'edit'))->assign('row', $row)->display('category_form'); }
public function edit() { if (isPost()) { return $this->_edit(); } $row = m('MemberLevel')->getRowById(get('id')); $this->view()->assign('title', '编辑级别')->assign('action', url('MemberLevel', 'edit'))->assign('row', $row)->display('memberlevel_form'); }
public function edit() { if (isPost()) { return $this->_edit(); } $row = m('Staff')->getRowById(get('id')); $this->view()->assign('title', '编辑员工')->assign('action', url('Staff', 'edit'))->assign('row', $row)->assign('my_shop', getMyShop())->display('staff_form'); }
public function profile() { if (isPost()) { return $this->_profile(); } $row = m('User')->getRowById($_SESSION['user_id']); $this->view()->assign('row', $row); $this->view()->display(); }
public function index() { if (isPost()) { extract($_POST); } if (isGet()) { extract($_GET); } print_r($this->cirbac->index()); }
protected function EventIndex() { if (isPost('submit_book_save')) { $this->Security_ValidateSendForm(); $post = $GLOBALS['_POST']; if ($post['theme']) { $this->Message_AddNotice($post['theme'], 'Выбрана тема'); } } }
public function EventMHB() { $aBlogs = $this->Blog_GetBlogs(); if (isPost('submit_mhb')) { $this->Security_ValidateSendForm(); $this->PluginMHB_ModuleMain_DeleteAllMhb(); foreach ($_REQUEST as $key => $var) { $oMhb = null; if (strpos($key, 'mhb_auto_join_') === 0) { $iBlogId = substr($key, 14); $oMhb = $this->PluginMHB_ModuleMain_GetMhbByBlogId($iBlogId); if (!$oMhb) { $oMhb = Engine::GetEntity('PluginMHB_Main_Mhb'); $oMhb->setBlogId($iBlogId); $oMhb->setAutoJoin(1); $oMhb->setCantLeave(0); $this->PluginMHB_ModuleMain_AddMhb($oMhb); } else { $oMhb->setAutoJoin(1); $this->PluginMHB_ModuleMain_UpdateMhb($oMhb); } } if (strpos($key, 'mhb_cant_leave_') === 0) { $iBlogId = substr($key, 15); $oMhb = $this->PluginMHB_ModuleMain_GetMhbByBlogId($iBlogId); if (!$oMhb) { $oMhb = Engine::GetEntity('PluginMHB_Main_Mhb'); $oMhb->setBlogId($iBlogId); $oMhb->setAutoJoin(0); $oMhb->setCantLeave(1); $this->PluginMHB_ModuleMain_AddMhb($oMhb); } else { $oMhb->setCantLeave(1); $this->PluginMHB_ModuleMain_UpdateMhb($oMhb); } } } } $aMhb = $this->PluginMHB_ModuleMain_GetAllMhb(); $aData = array(); foreach ($aBlogs as $oBlog) { $data['blog_id'] = $oBlog->getId(); $data['title'] = $oBlog->getTitle(); $data['closed'] = $oBlog->getType() == 'close'; $data['auto_join'] = false; $data['cant_leave'] = false; if (isset($aMhb[$oBlog->getId()])) { $data['auto_join'] = $aMhb[$oBlog->getId()]->getAutoJoin(); $data['cant_leave'] = $aMhb[$oBlog->getId()]->getCantLeave(); } $aData[] = $data; } $this->Viewer_AddBlock('right', 'block.info.tpl', array('plugin' => 'mhb'), 100); $this->Viewer_Assign("aData", $aData); }
function remove() { $ret = 0; if (isPost() && post('file')) { $file = $this->temp_imgDir . post('file'); if (file_exists($file)) { $ret = unlink($file); } } echo $ret; }
public function index() { if (isPost()) { return $this->_index(); } $arr = m('Option')->getList(); $opt = array(); foreach ($arr as $val) { $opt[$val['key']] = $val['val']; } $this->view()->assign('title', '其他设置')->assign('opt', $opt)->display('option_form'); }
function param($name, $default = '', $trim = true) { $p = queryParams(); if (!isset($p[$name])) { if (isPost()) { $p = $_POST; } else { return $default; } } return isset($p[$name]) ? $trim ? trim($p[$name]) : $p[name] : $default; }
public function index($nidtype = 'taxonomy', $nid = '') { if (isPost()) { extract($_POST); } if (isGet()) { extract($_GET); } $datalist['data'] = $this->citaxonomy->leaf(0); $this->put("list", $datalist['data']); $this->render('taxo_list.html'); }
public function showSettings() { $form = $this->getSettingsForm(); if (isPost() && $form->isValid($_POST)) { $values = $form->getValues(true); $this->saveSettings($values); $this->addMessage('Settings saved', self::MSG_SUCCESS); return; } $this->addMainContent($form); $this->addMessage('You can also execute project cron tasks from this url: ' . url(Curry_Core::$config->curry->baseUrl . 'CurryCron.php/', array('hash' => self::getCronExecutionHash()))->getAbsolute()); }
function runOnPostWithAllRequiredParametersWithErrorReroute($functionToRun, $listOfRequiredPostParameters = []) { global $serverPath; require_once $serverPath . "utils/redirectUtilities.php"; if (isPost()) { $missingPostParameters = findMissingPostParameters($listOfRequiredPostParameters); if (count($missingPostParameters) == 0) { $functionToRun(); } else { displayErrorNotAllRequiredDataPresentInPost($missingPostParameters); } } }
public function add() { if (isPost()) { return $this->_add(); } $sn = get('sn'); if (empty($sn)) { $row = array('sn' => m('TradeReturn')->getSn(), 'shop_id' => session('shop_id'), 'user_name' => session('user_name'), 'status' => '0'); } else { $row = m('TradeReturn')->getRowBySn($sn); } $this->view()->assign('row', $row)->assign('my_shop', getMyShop())->display(); }
public function edit() { if (isPost()) { return $this->_edit(); } $row = m('Role')->getRowById(get('id')); if ($row['rights']) { $row['rights'] = unserialize($row['rights']); } else { $row['rights'] = array('shops' => array(), 'rights' => array()); } $this->view()->assign('title', '编辑角色')->assign('action', url('Role', 'edit'))->assign('row', $row)->assign('shop', getShop())->display('role_form'); }
public function Event() { $sMode = $this->GetParam(1); if (in_array($sMode, array('base', 'sys'))) { $this->sMenuNavItemSelect = $sMode; } else { $this->sMenuNavItemSelect = $sMode = 'base'; } if (isPost('submit_data_save')) { $this->SaveConfig($sMode); } $this->Viewer_Assign('aFields', $this->aFields[$this->sMenuNavItemSelect]); }
function do_delete($id) { if (isPost()) { $comment = $this->get('Comment', $id); if ($comment && $comment->canEdit($this->currentUser)) { $comment->entry->get(); $comment->delete(); } else { $this->show_error('Permission denied'); } redirect_back(url_to($comment->entry, 'show')); } }
/** * Profile form. * * @param User $user * @return Curry_Form */ private function getForm(User $user) { $form = new Curry_Form(array('action' => url('', array("module", "view")), 'method' => 'post', 'elements' => array('name' => array('text', array('label' => 'Username', 'required' => true, 'value' => $user->getName())), 'old_password' => array('password', array('label' => 'Password', 'description' => 'You can leave this blank if you dont wish to change password.')), 'password' => array('password', array('label' => 'New password')), 'password_confirm' => array('password', array('label' => 'Confirm password')), 'save' => array('submit', array('label' => 'Save'))))); if (isPost() && ($_POST['old_password'] || $_POST['password'] || $_POST['password_confirm'])) { $form->old_password->setRequired(true); $form->password->setRequired(true); $form->password_confirm->setRequired(true); $form->old_password->addValidator(new Curry_Validate_Password($user)); $identical = new Zend_Validate_Identical($_POST['password']); $identical->setMessage('Passwords do not match.'); $form->password_confirm->addValidator($identical); } return $form; }
public function showMain() { $this->flushConfigCache(); $form = new Curry_Form(array('url' => url('', $_GET), 'method' => 'post', 'elements' => array('job_handler' => array('text', array('label' => 'Job handler', 'value' => Curry_Core::$config->modules->contrib->CurryGearman->jobHandler, 'placeholder' => 'Leave empty to use default')), 'token' => array('text', array('label' => 'Token', 'description' => 'To execute the listener from the browser, a hash is required.', 'value' => Curry_Core::$config->modules->contrib->CurryGearman->token, 'required' => true, 'placeholder' => 'Enter a random string')), 'save' => array('submit', array('label' => 'Save'))))); if (isPost() && $form->isValid($_POST)) { $values = $form->getValues(true); $this->saveConfig($values); return; } $webWorkerUrl = url(Curry_Core::$config->curry->baseUrl . 'gearman_listener.php/', array('hash' => Common_Gearman_Listener::getHash()))->getAbsolute(); $html = <<<HTML {$form} <p><a href="{$webWorkerUrl}" target="_blank">Click here to execute Gearman web worker.</a></p> HTML; $this->addMainContent($html); }
protected function EventSiteResetSubmit() { if (isPost('adm_cache_clear_data')) { $this->Cache_Clean(); } if (isPost('adm_cache_clear_headfiles')) { admClearHeadfilesCache(); } if (isPost('adm_cache_clear_smarty')) { admClearSmartyCache(); } if (isPost('adm_reset_config_data')) { $this->ResetCustomConfig(); } $this->Message('notice', $this->Lang_Get('adm_action_ok')); admHeaderLocation(Router::GetPath('admin') . 'site/reset/'); }
function updateAdmin() { $admin = model('admin'); if (isPost()) { $data = $admin->getData(); if ($admin->set($data['id'], $data)) { jsonReturn($this->ajaxFromReturn('修改成功', 200, 'closeCurrent', '', 'admin')); } else { jsonReturn($this->ajaxFromReturn('修改失败', 300)); } } $id = getRequest('id'); $data = $admin->get($id); $this->assign('data', $data); $this->assign('title', '修改'); $this->display("admin/update_admin.php"); }
public function showMain() { $config = $this->getCurryConfigObject(); $form = $this->getConfigForm($config); if (isPost() && $form->isValid($_POST)) { if ($form->save->isChecked()) { $values = $form->getValues(true); $this->saveToCurryConfig($values, $config); } else { if ($form->cleanup->isChecked()) { url('', array('module', 'view' => 'cleanup'))->redirect(); exit; } } } $this->addMainContent($form); }