当前位置: 首页>>代码示例>>PHP>>正文


PHP rmc_server_var函数代码示例

本文整理汇总了PHP中rmc_server_var函数的典型用法代码示例。如果您正苦于以下问题:PHP rmc_server_var函数的具体用法?PHP rmc_server_var怎么用?PHP rmc_server_var使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了rmc_server_var函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: rmmfSave

function rmmfSave()
{
    global $db, $myts;
    $nombre = rmc_server_var($_POST, 'nombre', '');
    $parent = rmc_server_var($_POST, 'parent', 0);
    $desc = rmc_server_var($_POST, 'desc', '');
    $orden = rmc_server_var($_POST, 'orden', 0);
    if ($nombre == '') {
        redirectMsg('categos.php?op=new', __('You must provide a name for this category', 'admin_myfolder'), 1);
        die;
    }
    $tbl = $db->prefix("rmmf_categos");
    list($num) = $db->fetchRow($db->query("SELECT COUNT(*) FROM {$tbl} WHERE nombre='{$nombre}' AND parent='{$parent}'"));
    if ($num > 0) {
        redirectMsg('categos.php?op=new', __('A category with same name already exists!', 'admin_myfolder'), 1);
        die;
    }
    $desc = $myts->makeTareaData4Save($desc);
    $sql = "INSERT INTO {$tbl} (`nombre`,`orden`,`desc`,`parent`) VALUES\n\t\t\t('{$nombre}','{$orden}','{$desc}','{$parent}')";
    $db->query($sql);
    if ($db->error() != '') {
        redirectMsg('categos.php?op=new', __('There was some errors while trying to update database!', 'admin_myfolder') . '<br />' . $db->error());
        die;
    } else {
        redirectMsg('categos.php', __('Database updated successfully!', 'admin_myfolder'));
        die;
    }
}
开发者ID:laiello,项目名称:bitcero-modules,代码行数:28,代码来源:categos.php

示例2: mail_approved

 /**
  * @desc Envía correo de aprobación de publicación
  * @param Object $res Publicación
  **/
 function mail_approved(RDResource &$res)
 {
     global $xoopsModuleConfig, $xoopsConfig;
     $config_handler =& xoops_gethandler('config');
     $mconfig = $config_handler->getConfigsByCat(XOOPS_CONF_MAILER);
     $errors = '';
     $user = new XoopsUser($res->getVar('owner'));
     $member_handler =& xoops_gethandler('member');
     $method = $user->getVar('notify_method');
     $mailer = new RMMailer('text/plain');
     $mailer->add_xoops_users($user);
     $mailer->set_subject(sprintf(__('Publication <%s> approved!', 'docs'), $res->getVar('title')));
     $mailer->assign('dear_user', $user->getVar('name') != '' ? $user->getVar('name') : $user->getVar('uname'));
     $mailer->assign('link_to_resource', $res->permalink());
     $mailer->assign('site_name', $xoopsConfig['sitename']);
     $mailer->assign('resource_name', $res->getVar('title'));
     $mailer->template(RMTemplate::get()->get_template('mail/resource_approved.php', 'module', 'docs'));
     switch ($method) {
         case '1':
             $mailer->set_from_xuser($mconfig['fromuid']);
             $ret = $mailer->send_pm();
             break;
         case '2':
             $ret = $mailer->send();
             break;
     }
     $page = rmc_server_var($_POST, 'page', 1);
     return $ret;
 }
开发者ID:laiello,项目名称:bitcero-modules,代码行数:33,代码来源:rdfunctions.php

示例3: show_rss_content

function show_rss_content()
{
    global $xoopsConfig;
    include_once $GLOBALS['xoops']->path('class/template.php');
    $tpl = new XoopsTpl();
    $module = rmc_server_var($_GET, 'mod', '');
    if ($module == '') {
        redirect_header('backend.php', 1, __('Choose an option to see its feed', 'rmcommon'));
        die;
    }
    if (!file_exists(XOOPS_ROOT_PATH . '/modules/' . $module . '/rss.php')) {
        redirect_header('backend.php', 1, __('This module does not support rss feeds', 'rmcommon'));
        die;
    }
    $GLOBALS['xoopsLogger']->activated = false;
    if (function_exists('mb_http_output')) {
        mb_http_output('pass');
    }
    header('Content-Type:text/xml; charset=utf-8');
    include XOOPS_ROOT_PATH . '/modules/' . $module . '/rss.php';
    if (!isset($rss_channel['image'])) {
        $rmc_config = RMFunctions::configs();
        $rss_channel['image']['url'] = $rmc_config['rssimage'];
        $dimention = getimagesize(XOOPS_ROOT_PATH . '/images/logo.png');
        $rss_channel['image']['width'] = $dimention[0] > 144 ? 144 : $dimention[0];
        $rss_channel['image']['height'] = $dimention[1] > 400 ? 400 : $dimention[1];
    }
    include RMTemplate::get()->get_template('rmc_rss.php', 'module', 'rmcommon');
}
开发者ID:laiello,项目名称:bitcero-modules,代码行数:29,代码来源:rss.php

示例4: search_resources

function search_resources()
{
    global $xoopsConfig, $xoopsUser, $page, $xoopsTpl;
    $keyword = rmc_server_var($_GET, 'keyword', '');
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $sql = "SELECT COUNT(*) FROM " . $db->prefix("rd_resources") . " WHERE (title LIKE '%{$keyword}%' OR description LIKE '%{$keyword}%') AND public=1 AND approved=1";
    list($num) = $db->fetchRow($db->query($sql));
    $page = rmc_server_var($_GET, 'page', 1);
    $limit = 15;
    $tpages = ceil($num / $limit);
    $page = $page > $tpages ? $tpages : $page;
    $start = $num <= 0 ? 0 : ($page - 1) * $limit;
    $nav = new RMPageNav($num, $limit, $page, 5);
    $nav->target_url(RDFunctions::make_link('search') . '?keyword=' . $keyword . '&amp;page={PAGE_NUM}');
    $sql = "SELECT * FROM " . $db->prefix("rd_resources") . " WHERE (title LIKE '%{$keyword}%' OR description LIKE '%{$keyword}%') AND public=1 AND approved=1 LIMIT {$start}, {$limit}";
    $result = $db->query($sql);
    $resources = array();
    while ($row = $db->fetchArray($result)) {
        $res = new RDResource();
        $res->assignVars($row);
        $resources[] = array('id' => $res->id(), 'title' => $res->getVar('title'), 'desc' => TextCleaner::truncate($res->getVar('description'), 100), 'link' => $res->permalink(), 'created' => $res->getVar('created'), 'owner' => $res->getVar('owner'), 'uname' => $res->getVar('owname'), 'reads' => $res->getVar('reads'));
    }
    RDFunctions::breadcrumb();
    RMBreadCrumb::get()->add_crumb(__('Browsing recent Documents', 'docs'));
    RMTemplate::get()->add_style('docs.css', 'docs');
    include 'header.php';
    $xoopsTpl->assign('xoops_pagetitle', sprintf(__('Search results for "%s"', 'docs'), $keyword));
    include RMEvents::get()->run_event('docs.template.search', RMTemplate::get()->get_template('rd_search.php', 'module', 'docs'));
    include 'footer.php';
}
开发者ID:laiello,项目名称:bitcero-modules,代码行数:30,代码来源:search.php

示例5: create_toolbar

 /**
  * Create the module toolbar. This function must be called only from rmcommon module administration
  */
 public static function create_toolbar()
 {
     if (RMCLOCATION == 'users') {
         RMTemplate::get()->add_tool(__('Users', 'rmcommon'), 'users.php', 'icon icon-users', 'allusers', array('class' => 'cu-tool tool-users-list'));
         RMTemplate::get()->add_tool(__('Add', 'rmcommon'), 'users.php?action=new', 'icon icon-plus', 'newuser', array('class' => 'cu-tool tool-user-add'));
     } elseif (RMCLOCATION == 'groups') {
         RMTemplate::get()->add_tool(__('Groups', 'rmcommon'), 'groups.php', 'icon icon-users', 'allgroups', array('class' => 'cu-tool tool-groups'));
         RMTemplate::get()->add_tool(__('Add', 'rmcommon'), '#', 'icon icon-plus', 'newgroup', array('class' => 'cu-tool tool-group-add', 'data-action' => 'load-remote-dialog', 'data-url' => 'groups.php?action=new-group', 'data-parameters' => '{action: \'new-group\'}'));
         /*
          * Next buttons are available only when groups list is shown
          */
         RMTemplate::get()->add_tool(__('Edit', 'rmcommon'), '#', 'icon icon-pencil', 'editgroup', array('class' => 'cu-tool tool-group-edit', 'data-activator' => 'groups-list', 'data-oncount' => '== 1', 'data-action' => 'load-remote-dialog', 'data-retriever' => 'groupsController.retrieveSingle', 'data-url' => 'groups.php?action=new-group', 'disabled' => 'disabled', 'title' => __('Edit Group', 'rmcommon')));
         RMTemplate::get()->add_tool(__('Delete', 'rmcommon'), '#', 'icon icon-bin', 'deletegroup', array('class' => 'cu-tool tool-group-delete', 'data-activator' => 'groups-list', 'data-oncount' => '> 0', 'disabled' => 'disabled', 'title' => __('Delete Groups', 'rmcommon'), 'data-action' => 'groupsController.delete'));
     } elseif (RMCLOCATION == 'imgmanager') {
         RMTemplate::get()->add_tool(__('Categories', 'rmcommon'), 'images.php?action=showcats', '', 'showcategories', array('class' => 'cu-tool tool-categories-images'));
         RMTemplate::get()->add_tool(__('New', 'rmcommon'), 'images.php?action=newcat', '', 'newcategory', array('class' => 'cu-tool tool-category-add'));
         $cat = rmc_server_var($_REQUEST, 'category', 0);
         if ($cat > 0) {
             RMTemplate::get()->add_tool(__('Images', 'rmcommon'), 'images.php?category=' . $cat, '', 'showimages', array('class' => 'cu-tool tool-images'));
         }
         RMTemplate::get()->add_tool(__('Add', 'rmcommon'), 'images.php?action=new' . ($cat > 0 ? "&amp;category={$cat}" : ''), '', 'addimages', array('class' => 'cu-tool tool-images-add'));
     } else {
         RMTemplate::get()->add_tool(__('Dashboard', 'rmcommon'), 'index.php', '', 'dashboard', array('class' => 'cu-tool tool-dashboard'));
         RMTemplate::get()->add_tool(__('Modules', 'rmcommon'), 'modules.php', '', 'modules', array('class' => 'cu-tool tool-modules'));
         RMTemplate::get()->add_tool(__('Blocks', 'rmcommon'), 'blocks.php', '', 'blocks', array('class' => 'cu-tool tool-blocks'));
         RMTemplate::get()->add_tool(__('Groups', 'rmcommon'), 'groups.php', '', 'groups', array('class' => 'cu-tool tool-groups'));
         RMTemplate::get()->add_tool(__('Users', 'rmcommon'), 'users.php', '', 'users', array('class' => 'cu-tool tool-users'));
         RMTemplate::get()->add_tool(__('Images', 'rmcommon'), 'images.php', '', 'imgmanager', array('class' => 'cu-tool tool-images'));
         RMTemplate::get()->add_tool(__('Comments', 'rmcommon'), 'comments.php', '', 'comments', array('class' => 'cu-tool tool-comments'));
         RMTemplate::get()->add_tool(__('Plugins', 'rmcommon'), 'plugins.php', '', 'plugins', array('class' => 'cu-tool tool-plugins'));
         RMTemplate::get()->add_tool(__('Updates', 'rmcommon'), 'updates.php', '', 'updates', array('class' => 'cu-tool tool-updates'));
     }
     RMEvents::get()->run_event('rmcommon.create.toolbar');
 }
开发者ID:JustineBABY,项目名称:rmcommon,代码行数:37,代码来源:functions.php

示例6: mw_widget_image

/**
 * Provides a widget to specify the default image for posts
 */
function mw_widget_image()
{
    global $xoopsSecurity, $xoopsModuleConfig, $xoopsUser, $rm_config;
    $id = rmc_server_var($_REQUEST, 'id', 0);
    $type = rmc_server_var($_REQUEST, 'type', '');
    $op = rmc_server_var($_REQUEST, 'op', '');
    $edit = $op == 'edit' ? 1 : 0;
    $widget = array();
    $widget['title'] = __('Default Image', 'mywords');
    $util = new RMUtilities();
    if ($edit) {
        //Verificamos que el software sea válido
        if ($id <= 0) {
            $params = '';
        }
        $post = new MWPost($id);
        if ($post->isNew()) {
            $params = '';
        } else {
            $params = $post->getVar('image');
        }
    } else {
        $params = '';
    }
    $widget['content'] = '<form name="frmDefimage" id="frm-defimage" method="post">';
    $widget['content'] .= $util->image_manager('image', $params);
    $widget['content'] .= '</form>';
    return $widget;
}
开发者ID:laiello,项目名称:bitcero-modules,代码行数:32,代码来源:widget_image.php

示例7: eventCoreIncludeCommonLanguage

 /**
  * To prevent errors when upload images with closed site
  */
 public function eventCoreIncludeCommonLanguage()
 {
     global $xoopsConfig;
     if ($xoopsConfig['cpanel'] != 'redmexico') {
         $db = XoopsDatabaseFactory::getDatabaseConnection();
         $db->queryF("UPDATE " . $db->prefix("config") . " SET conf_value='redmexico' WHERE conf_modid=0 AND conf_catid=1 AND conf_name='cpanel'");
     }
     /**
      * Check before to a rmcommon native module be installed
      */
     $fct = RMHttpRequest::get('fct', 'string', '');
     $op = RMHttpRequest::get('op', 'string', '');
     if ('modulesadmin' == $fct && 'install' == $op) {
         $dirname = RMHttpRequest::get('module', 'string', '');
         if ('' != $dirname) {
             $module = new XoopsModule();
             $module->loadInfoAsVar($dirname);
             if ($module->getInfo('rmnative')) {
                 RMUris::redirect_with_message(__('Please install %s using the modules manager from Common Utilities to prevent errors during install.', 'rmcommon'), RMCURL . '/modules.php?action=install&amp;dir=' . $dirname, RMMSG_WARN);
             }
         }
     }
     if (RMUris::current_url() == RMCURL . '/include/upload.php' && $xoopsConfig['closesite']) {
         $security = rmc_server_var($_POST, 'rmsecurity', 0);
         $data = TextCleaner::getInstance()->decrypt($security, true);
         $data = explode("|", $data);
         // [0] = referer, [1] = session_id(), [2] = user, [3] = token
         $xoopsUser = new XoopsUser($data[0]);
         if ($xoopsUser->isAdmin()) {
             $xoopsConfig['closesite'] = 0;
         }
     }
     RMEvents::get()->run_event('rmcommon.include.common.language');
 }
开发者ID:txmodxoops,项目名称:rmcommon,代码行数:37,代码来源:core.php

示例8: rd_save_page

function rd_save_page()
{
    $page = rmc_server_var($_POST, 'homepage', '');
    if (file_put_contents(XOOPS_CACHE_PATH . '/rd_homepage.html', $page)) {
        redirectMsg('hpage.php', __('Page saved successfully!', 'docs'), 0);
    } else {
        redirectMsg('hpage.php', __('Page could not be saved!', 'docs'), 1);
    }
}
开发者ID:laiello,项目名称:bitcero-modules,代码行数:9,代码来源:hpage.php

示例9: eventRmcommonLoadRightWidgets

 public function eventRmcommonLoadRightWidgets($widgets)
 {
     if (!defined('RMCLOCATION')) {
         return;
     }
     include_once RMCPATH . '/include/right_widgets.php';
     global $xoopsModule;
     if (RMCLOCATION == 'modules' && $xoopsModule->dirname() == 'rmcommon' && rmc_server_var($_REQUEST, 'action', '') == '') {
         $widgets[] = rmc_available_mods();
     }
     return $widgets;
 }
开发者ID:laiello,项目名称:bitcero-modules,代码行数:12,代码来源:rmcommon.php

示例10: eventRmcommonXoopsCommonEnd

 public function eventRmcommonXoopsCommonEnd()
 {
     global $xoopsConfig;
     $designia = rmc_server_var($_REQUEST, 'designia', '');
     if ($designia == '') {
         return;
     }
     switch ($designia) {
         case 'settings':
             include_once RMCPATH . '/themes/designia/include/settings.php';
             die;
     }
 }
开发者ID:laiello,项目名称:bitcero-modules,代码行数:13,代码来源:rmcommon.php

示例11: eventCoreIncludeCommonLanguage

 /**
  * To prevent errors when upload images with closed site 
  */
 public function eventCoreIncludeCommonLanguage()
 {
     global $xoopsConfig;
     if (RMFunctions::current_url() == RMCURL . '/include/upload.php' && $xoopsConfig['closesite']) {
         $security = rmc_server_var($_POST, 'rmsecurity', 0);
         $data = TextCleaner::getInstance()->decrypt($security, true);
         $data = explode("|", $data);
         // [0] = referer, [1] = session_id(), [2] = user, [3] = token
         $xoopsUser = new XoopsUser($data[0]);
         if ($xoopsUser->isAdmin()) {
             $xoopsConfig['closesite'] = 0;
         }
     }
 }
开发者ID:laiello,项目名称:bitcero-modules,代码行数:17,代码来源:core.php

示例12: mw_post_form

function mw_post_form($edit = 0)
{
    global $xoopsConfig, $xoopsUser, $xoopsSecurity;
    if (!$xoopsUser) {
        redirect_header(MWFunctions::get_url(), 1, __('You are not allowed to do this action!', 'mywords'));
        die;
    }
    // Check if user is a editor
    $author = new MWEditor();
    if (!$author->from_user($xoopsUser->uid()) && !$xoopsUser->isAdmin()) {
        redirect_header(MWFunctions::get_url(), 1, __('You are not allowed to do this action!', 'mywords'));
        die;
    }
    RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.min.js');
    RMTemplate::get()->add_script(RMCURL . '/include/js/jquery-ui.min.js');
    if ($edit) {
        $id = rmc_server_var($_GET, 'id', 0);
        if ($id <= 0) {
            redirect_header(MWFunctions::get_url(), __('Please, specify a valid post ID', 'mywords'), 1);
            die;
        }
        $post = new MWPost($id);
        if ($post->isNew()) {
            redirect_header(MWFunctions::get_url(), __('Specified post does not exists!', 'mywords'), 1);
            die;
        }
        // Check if user is the admin or a editor of this this post
        if ($author->id() != $post->getVar('author') && !$xoopsUser->isAdmin()) {
            redirect_header($post->permalink(), 1, __('You are not allowed to do this action!', 'mywords'));
            die;
        }
    }
    // Read privileges
    $perms = @$author->getVar('privileges');
    $perms = is_array($perms) ? $perms : array();
    $allowed_tracks = in_array("tracks", $perms) || $xoopsUser->isAdmin() ? true : false;
    $allowed_tags = in_array("tags", $perms) || $xoopsUser->isAdmin() ? true : false;
    $allowed_cats = in_array("cats", $perms) || $xoopsUser->isAdmin() ? true : false;
    $allowed_comms = in_array("comms", $perms) || $xoopsUser->isAdmin() ? true : false;
    $xoopsOption['module_subpage'] = 'submit';
    include 'header.php';
    $form = new RMForm('', '', '');
    $editor = new RMFormEditor('', 'content', '99%', '300px', $edit ? $post->getVar('content') : '');
    $meta_names = MWFunctions::get()->get_metas();
    RMTemplate::get()->add_xoops_style('submit.css', 'mywords');
    RMTemplate::get()->add_script(XOOPS_URL . '/modules/mywords/include/js/scripts.php?file=posts.js&front=1');
    include RMTemplate::get()->get_template('mywords_submit_form.php', 'module', 'mywords');
    include 'footer.php';
}
开发者ID:laiello,项目名称:bitcero-modules,代码行数:49,代码来源:submit.php

示例13: dt_form_features

/**
* @desc Formulario de características
**/
function dt_form_features($edit = 0)
{
    global $xoopsModule, $xoopsConfig, $functions, $tpl;
    define('RMCSUBLOCATION', 'newfeature');
    $id = rmc_server_var($_REQUEST, 'id', 0);
    $item = rmc_server_var($_REQUEST, 'item', 0);
    //Verificamos que el software sea válido
    if ($item <= 0) {
        redirectMsg('items.php', __('Download item ID not provided!', 'dtransport'), RMMSG_WARN);
    }
    //Verificamos que el software exista
    $sw = new DTSoftware($item);
    if ($sw->isNew()) {
        redirectMsg('items.php', __('Specified download item does not exists!', 'dtransport'), RMMSG_ERROR);
    }
    if ($edit) {
        if ($id <= 0) {
            redirectMsg('features.php?item=' . $item, __('Feature ID not specified!', 'dtransport'), RMMSG_WARN);
        }
        //Verificamos que la característica exista
        $ft = new DTFeature($id);
        if ($ft->isNew()) {
            redirectMsg('features.php?item=' . $item, __('Specified feature does not exists!', 'dtransport'), RMMSG_ERROR);
        }
    }
    $functions->toolbar();
    //styles
    $tpl->add_style('admin.css', 'dtransport');
    //scripts
    include_once DT_PATH . '/include/js_strings.php';
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; <a href='items.php'>" . __('Downloads', 'dtransport') . "</a> &raquo; " . ($edit ? __('Edit Feature', 'dtransport') : __('New Feature', 'dtransport')));
    xoops_cp_header();
    $form = new RMForm($edit ? sprintf(__('Editing feature of "%s"', 'dtransport'), $sw->getVar('name')) : sprintf(__('New feature for "%s"', 'dtransport'), $sw->getVar('name')), 'frmfeat', 'features.php');
    $form->addElement(new RMFormLabel(__('Download item', 'dtransport'), $sw->getVar('name')));
    $form->addElement(new RMFormText(__('Feature title', 'dtransport'), 'title', 50, 200, $edit ? $ft->title() : ''), true);
    $form->addElement(new RMFormText(__('Short name', 'dtransport'), 'nameid', 50, 200, $edit ? $ft->nameId() : ''));
    $form->addElement(new RMFormEditor(__('Feature content', 'dtransport'), 'content', '90%', '350px', $edit ? $ft->content() : ''), true);
    $functions->meta_form('feat', $edit ? $ft->id() : 0, $form);
    $form->addElement(new RMFormHidden('action', $edit ? 'saveedit' : 'save'));
    $form->addElement(new RMFormHidden('id', $id));
    $form->addElement(new RMFormHidden('item', $item));
    $buttons = new RMFormButtonGroup();
    $buttons->addButton('sbt', _SUBMIT, 'submit');
    $buttons->addButton('cancel', _CANCEL, 'button', 'onclick="window.location=\'features.php?item=' . $item . '\';"');
    $form->addElement($buttons);
    $form->display();
    xoops_cp_footer();
}
开发者ID:laiello,项目名称:bitcero-modules,代码行数:51,代码来源:features.php

示例14: m_categories_form

/**
* Show the form to edit or create a category
* @param int edit
*/
function m_categories_form($edit = 0)
{
    global $mc, $xoopsModule, $db;
    MCHFunctions::toolbar();
    RMTemplate::get()->assign('xoops_pagetitle', $edit ? __('Edit Category', 'match') : __('Add Category', 'match'));
    xoops_cp_location('<a href="./">' . $xoopsModule->name() . "</a> &raquo; \n        <a href='categories.php'>" . __('Categories', 'match') . '</a> &raquo; ' . ($edit ? __('Edit Category', 'match') : __('Add Category', 'match')));
    xoops_cp_header();
    $id = rmc_server_var($_REQUEST, 'id', 0);
    if ($edit) {
        //Verificamos si la categoría es válida
        if ($id <= 0) {
            redirectMsg('./categories.php', __('Provide a category ID!', 'match'), 1);
            die;
        }
        //Verificamos si la categoría existe
        $cat = new MCHCategory($id);
        if ($cat->isNew()) {
            redirectMsg('./categories.php', __('Specified category was not found!', 'match'), 1);
            die;
        }
    }
    $form = new RMForm($edit ? __('Edit Category', 'match') : __('Add Category', 'match'), 'frmNew', 'categories.php');
    $form->addElement(new RMFormText(__('Name', 'match'), 'name', 50, 150, $edit ? $cat->getVar('name') : ''), true);
    if ($edit) {
        $form->addElement(new RMFormText(__('Short name', 'match'), 'nameid', 50, 150, $cat->getVar('nameid')), true);
    }
    $form->addElement(new RMFormEditor(__('Description', 'match'), 'desc', '100%', '250px', $edit ? $cat->getVar('description', 'e') : ''));
    $sel_cats = new RMFormSelect(__('Parent category:', 'match'), 'parent', 0, $edit ? $cat->getVar('parent') : 0);
    $categories = array();
    MCHFunctions::categories_tree($categories, 0, 0, true, $edit ? $cat->id() : 0, '`name` ASC');
    $sel_cats->addOption(0, __('Select category...', 'match'), $edit ? $cat->getVar('parent') == 0 ? 1 : 0 : 1);
    foreach ($categories as $catego) {
        $sel_cats->addOption($catego['id'], str_repeat('&#151;', $catego['indent']) . ' ' . $catego['name']);
    }
    $form->addElement($sel_cats);
    $form->addElement(new RMFormYesNo(__('Enable category', 'match'), 'active', $edit ? $cat->getVar('active') : 1));
    $form->addElement(new RMFormHidden('action', $edit ? 'saveedit' : 'save'));
    if ($edit) {
        $form->addElement(new RMFormHidden('id', $cat->id()));
    }
    $ele = new RMFormButtonGroup();
    $ele->addButton('sbt', $edit ? __('Save Changes!', 'match') : __('Add Now!', 'match'), 'submit');
    $ele->addButton('cancel', _CANCEL, 'button', 'onclick="window.location=\'categos.php\';"');
    $form->addElement($ele);
    $form = RMEvents::get()->run_event('match.form.categories', $form);
    $form->display();
    xoops_cp_footer();
}
开发者ID:laiello,项目名称:bitcero-modules,代码行数:52,代码来源:categories.php

示例15: xt_save_menus

/**
* Save the items of created menus
*/
function xt_save_menus()
{
    global $xtAssembler, $xtFunctions, $xoopsConfig, $xoopsLogger;
    $xoopsLogger->activated = false;
    $xoopsLogger->renderingEnabled = false;
    $params = rmc_server_var($_POST, 'params', '');
    if (get_magic_quotes_gpc() == 1) {
        $params = stripslashes($params);
    }
    $params = json_decode($params, true);
    if (empty($params)) {
        xt_response(__('Menu not found!', 'xthemes'), 1, RMMSG_WARN);
    }
    $theme_menus = $xtAssembler->rootMenus();
    // Errors container
    $errors = array();
    // Menus container
    $menus = array();
    foreach ($params as $menu) {
        $id = $menu['id'];
        if (!isset($theme_menus[$id])) {
            // If menu does not exists in theme then we will return an error
            $errors[] = sprintf(__('Current theme "%s" does not have any menu identified as "%s"', 'xthemes'), $xtAssembler->theme()->getInfo("name"), $id);
        } else {
            $menus[$menu['id']] = $menu['content'];
        }
    }
    if (!empty($errors)) {
        xt_response(__('There was some errors while trying to save menus:', 'xthemes') . '<br />' . implode("<br />", $errors), 1, RMMSG_ERROR);
    }
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    foreach ($menus as $id => $content) {
        if (!$xtAssembler->menu($id)) {
            if (!$db->queryF("INSERT INTO " . $db->prefix("xt_menus") . " (`theme`,`menu`,`content`) VALUES ('" . $xtAssembler->theme()->id() . "','" . $id . "','" . serialize($content) . "')")) {
                $errors[] = $db->error();
            }
        } else {
            if (!$db->queryF("UPDATE " . $db->prefix("xt_menus") . " SET `content`='" . serialize($content) . "' WHERE `theme`='" . $xtAssembler->theme()->id() . "' AND `menu`='" . $id . "'")) {
                $errors[] = $db->error();
            }
        }
    }
    if (!empty($errors)) {
        xt_response(__('There was some errors while trying to save menus:', 'xthemes') . '<br />' . implode("<br />", $errors), 1, RMMSG_ERROR);
    }
    xt_response(__('Menu saved successfully!', 'xthemes'), 0, RMMSG_SAVED);
}
开发者ID:arab4domin,项目名称:xthemes,代码行数:50,代码来源:navigation.php


注:本文中的rmc_server_var函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。