本文整理汇总了PHP中Phpfox_Validator类的典型用法代码示例。如果您正苦于以下问题:PHP Phpfox_Validator类的具体用法?PHP Phpfox_Validator怎么用?PHP Phpfox_Validator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Phpfox_Validator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
/**
* Controller
*/
public function process()
{
if (Phpfox::getParam('core.phpfox_is_hosted')) {
$this->url()->send('admincp');
}
$bIsEdit = false;
$aValidation = array('product_id' => Phpfox::getPhrase('admincp.select_product'), 'title' => Phpfox::getPhrase('admincp.provide_a_title_for_your_plugin'), 'call_name' => Phpfox::getPhrase('admincp.select_a_hook'), 'php_code' => Phpfox::getPhrase('admincp.provide_php_code_for_your_plugin'));
$oValid = Phpfox_Validator::instance()->set(array('sFormName' => 'js_form', 'aParams' => $aValidation));
if ($iEditId = $this->request()->get('id')) {
$aPlugin = Phpfox::getService('admincp.plugin')->getForEdit($iEditId);
if (isset($aPlugin['plugin_id'])) {
$bIsEdit = true;
$this->template()->assign(array('aForms' => $aPlugin));
}
} else {
}
if ($aVals = $this->request()->getArray('val')) {
if ($bIsEdit) {
if (Phpfox::getService('admincp.plugin.process')->update($aPlugin['plugin_id'], $aVals)) {
$this->url()->send('admincp.plugin.add', array('id' => $aPlugin['plugin_id']), Phpfox::getPhrase('admincp.plugin_successfully_updated'));
}
} else {
if (Phpfox::getService('admincp.plugin.process')->add($aVals)) {
$this->url()->send('admincp.plugin', null, Phpfox::getPhrase('admincp.plugin_successfully_added'));
}
}
}
$this->template()->setTitle(Phpfox::getPhrase('admincp.create_plugin'))->setBreadcrumb(Phpfox::getPhrase('admincp.create_plugin'), $this->url()->current(), true)->assign(array('sCreateJs' => $oValid->createJS(), 'sGetJsForm' => $oValid->getJsForm(), 'aHooks' => Phpfox::getService('admincp.plugin')->getHooks(), 'bIsEdit' => $bIsEdit));
}
示例2: process
/**
* Controller
*/
public function process()
{
if (Phpfox::getParam('core.phpfox_is_hosted')) {
$this->url()->send('admincp');
}
$bIsEdit = false;
if (($iId = $this->request()->getInt('id')) && ($aComponent = Phpfox::getService('admincp.component')->getForEdit($iId))) {
$bIsEdit = true;
$this->template()->assign(array('aForms' => $aComponent));
}
$aValidation = array('product_id' => Phpfox::getPhrase('admincp.select_product'), 'component' => Phpfox::getPhrase('admincp.specify_component'), 'is_active' => Phpfox::getPhrase('admincp.select_component_active'), 'type' => Phpfox::getPhrase('admincp.select_component_type'));
$oValid = Phpfox_Validator::instance()->set(array('sFormName' => 'js_form', 'aParams' => $aValidation));
if ($aVals = $this->request()->getArray('val')) {
if ($oValid->isValid($aVals)) {
if ($bIsEdit) {
if (Phpfox::getService('admincp.component.process')->update($iId, $aVals)) {
$this->url()->send('admincp.component.add', array('id' => $iId), Phpfox::getPhrase('admincp.component_successfully_updated'));
}
} else {
if (Phpfox::getService('admincp.component.process')->add($aVals)) {
$this->url()->send('admincp.component', null, Phpfox::getPhrase('admincp.component_successfully_added'));
}
}
}
}
$this->template()->setTitle($bIsEdit ? Phpfox::getPhrase('admincp.editing_component') : Phpfox::getPhrase('admincp.add_component'))->setBreadcrumb(Phpfox::getPhrase('admincp.manage_components'), $this->url()->makeUrl('admincp.component'))->setBreadCrumb($bIsEdit ? Phpfox::getPhrase('admincp.editing_component') : Phpfox::getPhrase('admincp.add_component'), null, true)->assign(array('aProducts' => Admincp_Service_Product_Product::instance()->get(), 'aModules' => Phpfox::getService('admincp.module')->getModules(), 'sCreateJs' => $oValid->createJS(), 'sGetJsForm' => $oValid->getJsForm(), 'bIsEdit' => $bIsEdit));
}
示例3: process
/**
* Controller
*/
public function process()
{
// assign the categories
$this->template()->assign(array('aCategories' => Phpfox::getService('contact.contact')->getCategories()));
// create the captcha check JS
// they need to input some text always
$aValidation = array('text' => Phpfox::getPhrase('contact.fill_in_some_text_for_your_message'), 'category_id' => Phpfox::getPhrase('contact.you_need_to_choose_a_category'), 'subject' => Phpfox::getPhrase('contact.provide_a_subject'), 'full_name' => Phpfox::getPhrase('contact.provide_your_full_name'));
// do they need to complete a captcha challenge?
if (Phpfox::isModule('captcha') && Phpfox::getParam('contact.contact_enable_captcha')) {
$aValidation['image_verification'] = Phpfox::getPhrase('captcha.complete_captcha_challenge');
}
// They always need to input their email address
$aValidation['email'] = array('def' => 'email', 'title' => Phpfox::getPhrase('contact.provide_a_valid_email'));
$oValid = Phpfox_Validator::instance()->set(array('sFormName' => 'js_contact_form', 'aParams' => $aValidation));
// check if we're getting a request:
if ($aVals = $this->request()->getArray('val')) {
// check the fields are valid
if ($oValid->isValid($aVals)) {
if (Phpfox::getService('contact.contact')->sendContactMessage($aVals)) {
if (!empty($aVals['category_id']) && $aVals['category_id'] == 'phpfox_sales_ticket') {
$this->url()->send('contact', array('sent' => 'true'));
} else {
$this->url()->send('contact', null, Phpfox::getPhrase('contact.your_message_was_successfully_sent'));
}
} else {
$this->template()->assign(array('aContactErrors' => Phpfox_Error::set(Phpfox::getPhrase('error.site_email_not_set'))));
}
}
}
if (Phpfox::isUser()) {
$this->template()->assign(array('sFullName' => Phpfox::getUserBy('full_name'), 'sEmail' => Phpfox::getUserBy('email')));
}
$this->template()->setTitle(Phpfox::getPhrase('contact.contact_us'))->setBreadcrumb(Phpfox::getPhrase('contact.contact_us'))->assign(array('sCreateJs' => $oValid->createJs(), 'sGetJsForm' => $oValid->getJsForm(), 'bIsSent' => $this->request()->get('sent')))->setFullSite();
}
示例4: process
/**
* Controller
*/
public function process()
{
$aValidation = array('name' => Phpfox::getPhrase('forum.provide_a_name_for_your_forum'));
$oValid = Phpfox_Validator::instance()->set(array('sFormName' => 'js_form', 'aParams' => $aValidation));
$bIsEdit = false;
if ($iId = $this->request()->getInt('id')) {
$bIsEdit = true;
Phpfox::getUserParam('forum.can_edit_forum', true);
$aForum = Phpfox::getService('forum')->getForEdit($iId);
$this->template()->assign('aForms', $aForum);
} else {
Phpfox::getUserParam('forum.can_add_new_forum', true);
}
if ($aVals = $this->request()->getArray('val')) {
if ($oValid->isValid($aVals)) {
if ($bIsEdit) {
if (Phpfox::getService('forum.process')->update($aForum['forum_id'], $aVals)) {
$this->url()->send('admincp.forum', null, Phpfox::getPhrase('forum.forum_successfully_updated'));
}
} else {
if (Phpfox::getService('forum.process')->add($aVals)) {
$this->url()->send('admincp.forum.add', null, Phpfox::getPhrase('forum.forum_successfully_added'));
}
}
}
}
$sTitle = $bIsEdit ? Phpfox::getPhrase('forum.editing_forum') . ': ' . $aForum['name'] : Phpfox::getPhrase('forum.create_new_form');
$this->template()->setTitle($sTitle)->setBreadCrumb($sTitle, $this->url()->makeUrl('admincp.forum'))->assign(array('sCreateJs' => $oValid->createJS(), 'sGetJsForm' => $oValid->getJsForm(), 'sForumParents' => Phpfox::getService('forum')->active($bIsEdit ? $aForum['parent_id'] : $this->request()->getInt('child'))->edit($bIsEdit ? $aForum['forum_id'] : 0)->getJumpTool(true, $bIsEdit)));
}
示例5: process
/**
* Controller
*/
public function process()
{
Phpfox::getUserParam('language.can_manage_lang_packs', true);
$bNoJsValidation = $this->getParam('bNoJsValidation');
$aModules = Phpfox::getService('admincp.module')->getModules();
$aLanguages = Phpfox::getService('language')->get();
if ($sPhrase = $this->getParam('sVar')) {
$aParts = explode('.', $sPhrase);
$sPhrase = $aParts[1];
}
/*
$aValidation = array(
'var_name' => array(
'def' => 'required',
'title' => Phpfox::getPhrase('language.select_varname')
)
);
*/
$aValidation = array();
$oValid = Phpfox_Validator::instance()->set(array('sFormName' => 'js_phrase_form', 'aParams' => $aValidation));
if ($aVals = $this->request()->getArray('val')) {
if (empty($aVals['var_name']) && isset($aVals['text']['en'])) {
$aVals['var_name'] = $aVals['text']['en'];
}
if (empty($aVals['var_name'])) {
Phpfox_Error::set('Provide a var name.');
}
// Check that all the fields are valid
if ($oValid->isValid($aVals)) {
// Check to make sure the phrase has not already been added
if ($sIsPhrase = Phpfox::getService('language.phrase')->isPhrase($aVals)) {
Phpfox_Error::set(Phpfox::getPhrase('language.phrase_already_created', array('phrase' => $sIsPhrase)) . ' - ' . Phpfox::getPhrase($sIsPhrase));
$sCachePhrase = $sIsPhrase;
} else {
$sVarName = Phpfox::getService('language.phrase.process')->prepare($aVals['var_name']);
if (isset($aVals['module'])) {
$aParts = explode('|', $aVals['module']);
$sVarName = $aParts[1] . '.' . $sVarName;
}
$sCached = Phpfox::getPhrase('language.phrase_added', array('phrase' => $sVarName));
// Add the new phrase
$sPhrase = Phpfox::getService('language.phrase.process')->add($aVals);
// Verify if we have a return URL, if we do send them there instead
if ($sReturn = $this->request()->get('return')) {
$this->url()->forward($sReturn, $sCached);
} else {
Phpfox::getLib('session')->set('cache_new_phrase', $sVarName);
// Phrase added lets send them back to the same page with a message that the phrase was added
$this->url()->send('admincp.language.phrase.add', array('last-module' => $aParts[1]), $sCached);
}
}
}
}
if (!isset($sCachePhrase) && ($sCachePhrase = Phpfox::getLib('session')->get('cache_new_phrase'))) {
Phpfox::getLib('session')->remove('cache_new_phrase');
}
// Assign needed vars to the template
$this->template()->assign(array('aProducts' => Admincp_Service_Product_Product::instance()->get(), 'aModules' => $aModules, 'aLanguages' => $aLanguages, 'sCreateJs' => $oValid->createJS(), 'sGetJsForm' => $bNoJsValidation ? 'return true;' : $oValid->getJsForm(), 'sReturn' => ($sReturn = $this->request()->get('return')) ? $sReturn : $this->getParam('sReturnUrl'), 'sVar' => $sPhrase, 'sCachePhrase' => isset($sCachePhrase) ? $sCachePhrase : '', 'sLastModuleId' => $this->request()->get('last-module')))->setBreadCrumb(Phpfox::getPhrase('language.add_phrase'), $this->url()->current(), true)->setTitle(Phpfox::getPhrase('language.add_phrase'));
($sPlugin = Phpfox_Plugin::get('language.component_controller_admincp_phrase_add_process')) ? eval($sPlugin) : false;
}
示例6: process
/**
* Controller
*/
public function process()
{
$this->url()->send('music');
Phpfox::isUser(true);
if (Phpfox::getParam('music.music_user_group_id') == Phpfox::getUserBy('user_group_id')) {
$this->url()->send('music');
}
$aUser = array('full_name' => Phpfox::getUserBy('full_name'));
$aSettings = Phpfox::getService('custom')->getForEdit(array('user_main', 'user_panel', 'profile_panel'), Phpfox::getUserId(), Phpfox::getParam('music.music_user_group_id'));
$aParams = array('full_name' => Phpfox::getPhrase('music.provide_a_artist_band_name'), 'agree' => Phpfox::getPhrase('music.tick_the_box_to_agree_to_our_terms_and_privacy_policy'));
foreach ($aSettings as $sKey => $aSetting) {
if ($aSetting['is_required']) {
$aParams['custom_field_' . $aSetting['field_id']] = array('title' => Phpfox::getPhrase('music.provide_a_value_for') . ': ' . Phpfox::getPhrase($aSetting['phrase_var_name']), 'def' => 'required', 'php_id' => 'custom[' . $aSetting['field_id'] . ']');
}
}
$oValid = Phpfox_Validator::instance()->set(array('sFormName' => 'js_form', 'aParams' => $aParams));
if ($aVals = $this->request()->getArray('val')) {
if ($oValid->isValid($aVals)) {
if (Music_Service_Process::instance()->convertMember($aVals, $this->request()->getArray('custom'))) {
$this->url()->send('music', null, Phpfox::getPhrase('music.you_have_successfully_converted_your_account'));
}
}
}
$this->template()->setTitle(Phpfox::getPhrase('music.musician_registration'))->setBreadcrumb(Phpfox::getPhrase('music.music'), $this->url()->makeUrl('music'))->setBreadcrumb(Phpfox::getPhrase('music.registration'), null, true)->setFullSite()->assign(array('aForms' => $aUser, 'sCreateJs' => $oValid->createJS(), 'sGetJsForm' => $oValid->getJsForm(), 'aSettings' => $aSettings));
}
示例7: process
/**
* Controller
*/
public function process()
{
$aValidation = array('message' => Phpfox::getPhrase('mail.add_reply'));
$oValid = Phpfox_Validator::instance()->set(array('sFormName' => 'js_form', 'aParams' => $aValidation));
$aMail = Mail_Service_Mail::instance()->getMail($this->request()->getInt('id'));
if (!isset($aMail['mail_id'])) {
return Phpfox_Error::display(Phpfox::getPhrase('mail.invalid_message'));
}
$bCanView = false;
if ($aMail['viewer_user_id'] == Phpfox::getUserId() || $aMail['owner_user_id'] == Phpfox::getUserId()) {
$bCanView = true;
}
if ($bCanView === false) {
return Phpfox_Error::display(Phpfox::getPhrase('mail.invalid_message'));
}
if ($aVals = $this->request()->getArray('val')) {
if ($oValid->isValid($aVals)) {
$aVals['to'] = $aMail['owner_user_id'];
if ($iNewId = Mail_Service_Process::instance()->add($aVals)) {
$this->url()->send('mail.view', array('id' => $iNewId));
}
}
}
if ($aMail['viewer_user_id'] == Phpfox::getUserId()) {
Mail_Service_Process::instance()->toggleView($aMail['mail_id'], false);
}
$this->template()->assign(array('bMobileInboxIsActive' => true, 'aMail' => $aMail));
}
示例8: process
/**
* Controller
*/
public function process()
{
$aValidation = array('name' => Phpfox::getPhrase('photo.provide_a_name_for_your_photo_category'));
$oValid = Phpfox_Validator::instance()->set(array('sFormName' => 'js_form', 'aParams' => $aValidation));
if (($aOrder = $this->request()->getArray('order')) && Phpfox::getUserParam('photo.can_edit_photo_categories', true) && Phpfox::getService('photo.category.process')->updateOrder($aOrder)) {
$this->url()->send('admincp.photo', null, Phpfox::getPhrase('photo.photo_category_order_successfully_updated'));
}
if (!Phpfox::getUserParam('photo.can_add_public_categories') && !Phpfox::getUserParam('photo.can_edit_photo_categories')) {
return Phpfox_Error::display(Phpfox::getPhrase('photo.invalid_section'));
}
if ($aVals = $this->request()->getArray('val')) {
if ($oValid->isValid($aVals)) {
if (isset($aVals['delete']) && Phpfox::getUserParam('photo.can_edit_photo_categories', true)) {
if (Phpfox::getService('photo.category.process')->delete($aVals['edit_id'])) {
$this->url()->send('admincp.photo', null, Phpfox::getPhrase('photo.photo_category_successfully_deleted'));
}
} else {
if (isset($aVals['edit_id'])) {
Phpfox::getUserParam('photo.can_edit_photo_categories', true);
if (Phpfox::getService('photo.category.process')->update($aVals)) {
$this->url()->send('admincp.photo', null, Phpfox::getPhrase('photo.photo_category_successfully_updated'));
}
} else {
Phpfox::getUserParam('photo.can_add_public_categories', true);
if (Phpfox::getService('photo.category.process')->add($aVals)) {
$this->url()->send('admincp.photo', null, Phpfox::getPhrase('photo.photo_category_successfully_added'));
}
}
}
}
}
$this->template()->setTitle(Phpfox::getPhrase('photo.manage_photo_categories'))->setBreadCrumb(Phpfox::getPhrase('photo.manage_photo_categories'), $this->url()->makeUrl('admincp.photo'))->setHeader('cache', array('admin.js' => 'module_photo', 'jquery/ui.js' => 'static_script', 'sort.js' => 'module_photo'))->assign(array('sCreateJs' => $oValid->createJS(), 'sGetJsForm' => $oValid->getJsForm()));
}
示例9: process
/**
* Controller
*/
public function process()
{
Phpfox::isUser(true);
if (!Phpfox::getParam('mail.threaded_mail_conversation')) {
$this->url()->send('mail');
}
$aVals = $this->request()->get('val');
if ($aVals && ($iNewId = Mail_Service_Process::instance()->add($aVals))) {
list($aCon, $aMessages) = Mail_Service_Mail::instance()->getThreadedMail($iNewId);
$aMessages = array_reverse($aMessages);
Phpfox_Template::instance()->assign(array('aMail' => $aMessages[0], 'aCon' => $aCon, 'bIsLastMessage' => true))->getTemplate('mail.block.entry');
$content = ob_get_contents();
ob_clean();
return ['append' => ['to' => '#mail_threaded_new_message', 'with' => $content]];
}
$iThreadId = $this->request()->getInt('id');
list($aThread, $aMessages) = Mail_Service_Mail::instance()->getThreadedMail($iThreadId);
if ($aThread === false) {
return Phpfox_Error::display(Phpfox::getPhrase('mail.unable_to_find_a_conversation_history_with_this_user'));
}
$aValidation = array('message' => Phpfox::getPhrase('mail.add_reply'));
$oValid = Phpfox_Validator::instance()->set(array('sFormName' => 'js_form', 'aParams' => $aValidation));
if ($aThread['user_is_archive']) {
$this->request()->set('view', 'trash');
}
Mail_Service_Mail::instance()->buildMenu();
Mail_Service_Process::instance()->threadIsRead($aThread['thread_id']);
$iUserCnt = 0;
$sUsers = '';
$bCanViewThread = false;
foreach ($aThread['users'] as $aUser) {
if ($aUser['user_id'] == Phpfox::getUserId()) {
$bCanViewThread = true;
}
if ($aUser['user_id'] == Phpfox::getUserId()) {
continue;
}
$iUserCnt++;
if ($iUserCnt == count($aThread['users']) - 1 && count($aThread['users']) - 1 > 1) {
$sUsers .= ' & ';
} else {
if ($iUserCnt != '1') {
$sUsers .= ', ';
}
}
$sUsers .= $aUser['full_name'];
}
if (!$bCanViewThread) {
return Phpfox_Error::display('Unable to view this thread.');
} else {
$this->template()->setBreadcrumb(Phpfox::getPhrase('mail.mail'), $this->url()->makeUrl('mail'))->setBreadcrumb($sUsers, $this->url()->makeUrl('mail.thread', array('id' => $iThreadId)), true);
}
$this->template()->setTitle($sUsers)->setTitle(Phpfox::getPhrase('mail.mail'))->setHeader('cache', array('mail.js' => 'module_mail', 'jquery/plugin/jquery.scrollTo.js' => 'static_script'))->assign(array('sCreateJs' => $oValid->createJS(), 'sGetJsForm' => $oValid->getJsForm(false), 'aMessages' => $aMessages, 'aThread' => $aThread, 'sCurrentPageCnt' => $this->request()->getInt('page', 0) + 1));
$this->setParam('attachment_share', array('type' => 'mail', 'id' => 'js_form_mail'));
$this->setParam('global_moderation', array('name' => 'mail', 'ajax' => 'mail.mailThreadAction', 'custom_fields' => '<div><input type="hidden" name="forward_thread_id" value="' . $aThread['thread_id'] . '" id="js_forward_thread_id" /></div>', 'menu' => array(array('phrase' => Phpfox::getPhrase('mail.forward'), 'action' => 'forward'))));
}
示例10: process
/**
* Controller
*/
public function process()
{
$oValidator = Phpfox_Validator::instance()->set(array('sFormName' => 'js_genre_add', 'aParams' => array('name' => Phpfox::getPhrase('music.provide_a_genre_name'))));
if ($aVals = $this->request()->getArray('val')) {
if ($oValidator->isValid($aVals)) {
if (Phpfox::getService('music.genre.process')->add($aVals)) {
$this->url()->send('admincp.music.add', null, Phpfox::getPhrase('music.genre_successfully_added'));
}
}
}
$this->template()->setTitle(Phpfox::getPhrase('music.add_genre'))->setBreadcrumb(Phpfox::getPhrase('music.add_genre'), $this->url()->makeUrl('admincp.music'))->assign(array('sCreateJs' => $oValidator->createJS(), 'sGetJsForm' => $oValidator->getJsForm()));
}
示例11: process
/**
* Controller
*/
public function process()
{
$bIsEdit = false;
$oSession = Phpfox::getLib('session');
$aValidation = array('product_id' => Phpfox::getPhrase('page.select_product'), 'title' => Phpfox::getPhrase('page.missing_title'), 'title_url' => Phpfox::getPhrase('page.missing_url_title'), 'is_active' => Phpfox::getPhrase('page.specify_page_active'), 'text' => Phpfox::getPhrase('page.page_missing_data'));
$oValid = Phpfox_Validator::instance()->set(array('sFormName' => 'js_form', 'aParams' => $aValidation));
if (($iPageId = $this->request()->getInt('id')) || ($iPageId = $this->request()->getInt('page_id'))) {
Phpfox::getUserParam('page.can_manage_custom_pages', true);
$aPage = Phpfox::getService('page')->getForEdit($iPageId);
if (isset($aPage['page_id'])) {
$bIsEdit = true;
// $aPage['attachment'] = (Phpfox::isModule('attachment') ? Phpfox::getService('attachment')->getForItemEdit($aPage['page_id'], 'page', Phpfox::getUserId()) : '');
if (Phpfox::isModule('tag')) {
$aTags = Tag_Service_Tag::instance()->getTagsById('page', $aPage['page_id']);
if (isset($aTags[$aPage['page_id']])) {
$aPage['tag_list'] = '';
foreach ($aTags[$aPage['page_id']] as $aTag) {
$aPage['tag_list'] .= ' ' . $aTag['tag_text'] . ',';
}
$aPage['tag_list'] = trim(trim($aPage['tag_list'], ','));
}
}
$this->template()->assign(array('aForms' => $aPage, 'aAccess' => empty($aPage['disallow_access']) ? null : unserialize($aPage['disallow_access'])));
}
}
if ($aVals = $this->request()->getArray('val')) {
Phpfox::getLib('parse.input')->allowTitle(Phpfox::getLib('parse.input')->cleanTitle($aVals['title_url']), Phpfox::getPhrase('page.invalid_title'));
if ($oValid->isValid($aVals)) {
if ($bIsEdit) {
$sMessage = Phpfox::getPhrase('page.page_successfully_updated');
$sReturn = Phpfox::getService('page.process')->update($aPage['page_id'], $aVals, $aPage['user_id']);
$aUrl = null;
} else {
$sMessage = Phpfox::getPhrase('page.successfully_added');
$sReturn = Phpfox::getService('page.process')->add($aVals);
$aUrl = null;
}
if ($sReturn) {
return ['redirect' => $this->url()->makeUrl($sReturn, null, $sMessage)];
}
} else {
$aError = Phpfox_Error::get();
$sError = '';
if (is_array($aError)) {
$sError = implode(' ', $aError);
} else {
$sError = $aError;
}
return ['error' => $sError];
}
}
$this->template()->setSectionTitle('<a href="' . $this->url()->makeUrl('admincp.page') . '">Custom Pages</a>')->setTitle(Phpfox::getPhrase('page.add_new_page'))->setBreadCrumb(Phpfox::getPhrase('page.add_new_page'))->assign(array('aProducts' => Admincp_Service_Product_Product::instance()->get(), 'aUserGroups' => Phpfox::getService('user.group')->get(), 'sCreateJs' => $oValid->createJS(), 'sGetJsForm' => $oValid->getJsForm(), 'bIsEdit' => $bIsEdit, 'aModules' => Phpfox_Module::instance()->getModules(), 'bFormIsPosted' => count($aVals) ? true : false))->setEditor()->setHeader(array('jquery/plugin/jquery.highlightFade.js' => 'static_script', 'switch_menu.js' => 'static_script', '<script type="text/javascript">var Attachment = {sCategory: "page", iItemId: "' . (isset($aPage['page_id']) ? $aPage['page_id'] : '') . '"};</script>'));
}
示例12: process
/**
* Controller
*/
public function process()
{
$aValidation = array('name' => Phpfox::getPhrase('blog.provide_blog_category'));
$oValid = Phpfox_Validator::instance()->set(array('sFormName' => 'js_form', 'aParams' => $aValidation));
if ($aVals = $this->request()->getArray('val')) {
if ($oValid->isValid($aVals)) {
if (Phpfox::getService('blog.category.process')->add($aVals['name'], '0')) {
$this->url()->send('admincp.blog.add', null, Phpfox::getPhrase('blog.category_successfully_added'));
}
}
}
$this->template()->setTitle(Phpfox::getPhrase('blog.add_category'))->setBreadCrumb(Phpfox::getPhrase('blog.add_category'), $this->url()->makeUrl('admincp.blog'))->assign(array('sCreateJs' => $oValid->createJS(), 'sGetJsForm' => $oValid->getJsForm()));
}
示例13: process
/**
* Controller
*/
public function process()
{
if (Phpfox::getParam('core.phpfox_is_hosted')) {
$this->url()->send('admincp');
}
$bIsEdit = false;
$aValidation = array('product_id' => Phpfox::getPhrase('admincp.select_product'), 'hook_type' => Phpfox::getPhrase('admincp.select_what_type_of_a_hook_this_is'));
$oValid = Phpfox_Validator::instance()->set(array('sFormName' => 'js_form', 'aParams' => $aValidation));
if ($aVals = $this->request()->getArray('val')) {
if (Phpfox::getService('admincp.plugin.process')->addHook($aVals)) {
$this->url()->send('admincp.plugin.hook.add', null, Phpfox::getPhrase('admincp.hook_successfully_added'));
}
}
$this->template()->setTitle(Phpfox::getPhrase('admincp.add_hook'))->setBreadCrumb(Phpfox::getPhrase('admincp.add_hook'))->assign(array('aProducts' => Admincp_Service_Product_Product::instance()->get(), 'aModules' => Phpfox::getService('admincp.module')->getModules(), 'sCreateJs' => $oValid->createJS(), 'sGetJsForm' => $oValid->getJsForm(), 'bIsEdit' => $bIsEdit, 'aHookTypes' => array('library', 'service', 'component', 'template')));
}
示例14: process
/**
* Controller
*/
public function process()
{
Phpfox::getUserParam('user.can_add_user_group_setting', true);
$aGroups = Phpfox::getService('user.group')->get('user_group.is_special = 1');
$aForms = array();
if (($iSetting = $this->request()->getInt('id')) && ($aForms = Phpfox::getService('user.group.setting')->getSetting($iSetting)) && isset($aForms['setting_id'])) {
foreach ($aGroups as $iKey => $aGroup) {
if ($aGroup['user_group_id'] == '1') {
$aGroups[$iKey]['value'] = $aForms['default_admin'];
} elseif ($aGroup['user_group_id'] == '3') {
$aGroups[$iKey]['value'] = $aForms['default_guest'];
} elseif ($aGroup['user_group_id'] == '4') {
$aGroups[$iKey]['value'] = $aForms['default_staff'];
} else {
$aGroups[$iKey]['value'] = $aForms['default_user'];
}
}
}
if (!$this->request()->getInt('id')) {
$this->url()->send('admincp');
}
$aValidation = array('name' => Phpfox::getPhrase('user.select_varname'));
$oValid = Phpfox_Validator::instance()->set(array('sFormName' => 'js_form', 'aParams' => $aValidation));
if ($aVals = $this->request()->getArray('val')) {
// Check that all the fields are valid
if ($oValid->isValid($aVals)) {
if (isset($aForms['setting_id'])) {
if (Phpfox::getService('user.group.setting.process')->updateSetting(array_merge($aVals, array('setting_id' => $aForms['setting_id'])))) {
$this->url()->send('admincp', array('user', 'group', 'add', 'id' => $this->request()->getInt('gid'), '#setting' . $aForms['setting_id']), Phpfox::getPhrase('user.setting_successfully_updated'));
}
} else {
if (Phpfox::getService('user.group.setting.process')->addSetting($aVals)) {
$this->url()->send('admincp', array('user', 'group', 'setting'), Phpfox::getPhrase('user.setting_successfully_added'));
}
}
}
}
if ($sCacheSetting = Phpfox::getLib('session')->get('cache_new_user_setting')) {
Phpfox::getLib('session')->remove('cache_new_user_setting');
}
if (isset($aForms['name'])) {
Phpfox_Database::instance()->select('language_phrase.text, ')->leftJoin(Phpfox::getT('language_phrase'), 'language_phrase', "language_phrase.language_id = l.language_id AND language_phrase.var_name = 'user_setting_{$aForms['name']}'");
}
$aLanguages = Phpfox::getService('language')->get();
$this->template()->setBreadcrumb(Phpfox::getPhrase('user.user_groups'), $this->url()->makeUrl('admincp.user.group'))->setBreadcrumb(Phpfox::getPhrase('user.manage_user_groups'), $this->url()->makeUrl('admincp.user.group'))->setBreadcrumb(Phpfox::getPhrase('user.add_user_group_setting'), null, true)->setTitle(Phpfox::getPhrase('user.add_user_group_setting'))->assign(array('aProducts' => Admincp_Service_Product_Product::instance()->get(), 'aModules' => Phpfox::getService('admincp.module')->getModules(), 'aLanguages' => $aLanguages, 'sCreateJs' => $oValid->createJS(), 'sGetJsForm' => $oValid->getJsForm(), 'aTypes' => array('boolean', 'integer', 'string', 'array'), 'aUserGroups' => $aGroups, 'sCacheSetting' => $sCacheSetting, 'aForms' => $aForms, 'iGroupId' => $this->request()->getInt('gid')));
($sPlugin = Phpfox_Plugin::get('user.component_controller_admincp_group_setting_process')) ? eval($sPlugin) : false;
}
示例15: process
/**
* Controller
*/
public function process()
{
if (Phpfox::getParam('core.phpfox_is_hosted')) {
$this->url()->send('admincp');
}
$aValidation = array('var_name' => Phpfox::getPhrase('admincp.add_a_title_for_the_group'), 'info' => Phpfox::getPhrase('admincp.add_information_regarding_group'));
$oValid = Phpfox_Validator::instance()->set(array('sFormName' => 'js_setting_form', 'aParams' => $aValidation));
if ($aVals = $this->request()->getArray('val')) {
if ($oValid->isValid($aVals)) {
if ($sVarName = Phpfox::getService('admincp.setting.group.process')->add($aVals)) {
$this->url()->send('admincp.setting.group.add', null, Phpfox::getPhrase('admincp.added') . ': ' . $sVarName);
}
}
}
$this->template()->setBreadCrumb(Phpfox::getPhrase('admincp.add_setting_group'))->setTitle(Phpfox::getPhrase('admincp.add_setting_group'))->assign(array('aProducts' => Admincp_Service_Product_Product::instance()->get(), 'sCreateJs' => $oValid->createJS(), 'sGetJsForm' => $oValid->getJsForm(), 'aModules' => Phpfox_Module::instance()->getModules()));
($sPlugin = Phpfox_Plugin::get('admincp.component_controller_setting_group_add_process')) ? eval($sPlugin) : false;
}