Пример #1
0
 /**
  * Update product categories
  *
  * @param  FormRequest  $request
  * @return \Illuminate\Http\Response
  */
 public function postCategories(FormRequest $request, $id)
 {
     if ($model = $this->validateEntity('product', $id)) {
         form('edit_product_categories', ['entity' => $model])->handle($request);
     }
     return redirect()->back();
 }
Пример #2
0
 /**
  */
 function supplier_edit()
 {
     $_GET['id'] = intval($_GET['id']);
     if (empty($_GET['id'])) {
         return _e('Empty ID!');
     }
     $supplier_info = db()->query_fetch('SELECT * FROM ' . db('shop_suppliers') . ' WHERE id=' . $_GET['id']);
     if (main()->is_post()) {
         if (!$_POST['name']) {
             _re('Product name must be filled');
         }
         if (!common()->_error_exists()) {
             $sql_array = ['name' => $_POST['name'], 'url' => $_POST['url'] ?: common()->_propose_url_from_name($_POST['name']), 'desc' => $_POST['desc'], 'meta_keywords' => $_POST['meta_keywords'], 'meta_desc' => $_POST['meta_desc'], 'sort_order' => intval($_POST['sort_order'])];
             module('manage_shop_revisions')->check_revision(__FUNCTION__, $_GET['id'], 'shop_suppliers');
             db()->update('shop_suppliers', db()->es($sql_array), 'id=' . $_GET['id']);
             module('manage_shop_revisions')->new_revision(__FUNCTION__, $_GET['id'], 'shop_suppliers');
             common()->admin_wall_add(['shop supplier updated: ' . $_POST['name'], $_GET['id']]);
             if (!empty($_FILES)) {
                 $man_id = $_GET['id'];
                 $this->_upload_image($man_id, $url);
             }
         }
         return js_redirect('./?object=' . main()->_get('object') . '&action=suppliers');
     }
     $thumb_path = module('manage_shop')->supplier_img_dir . $supplier_info['url'] . '_' . $supplier_info['id'] . module('manage_shop')->THUMB_SUFFIX . '.jpg';
     if (!file_exists($thumb_path)) {
         $thumb_path = '';
     } else {
         $thumb_path = module('manage_shop')->supplier_img_webdir . $supplier_info['url'] . '_' . $supplier_info['id'] . module('manage_shop')->THUMB_SUFFIX . '.jpg';
     }
     $replace = ['name' => $supplier_info['name'], 'sort_order' => $supplier_info['sort_order'], 'desc' => $supplier_info['desc'], 'thumb_path' => $thumb_path, 'delete_image_url' => './?object=' . main()->_get('object') . '&action=delete_image&id=' . $supplier_info['id'], 'form_action' => './?object=' . main()->_get('object') . '&action=supplier_edit&id=' . $supplier_info['id'], 'back_url' => './?object=' . main()->_get('object') . '&action=suppliers'];
     return form($replace)->text('name')->textarea('desc', 'Description')->text('url')->text('meta_keywords')->text('meta_desc')->save_and_back();
 }
Пример #3
0
function list_node_image_terms()
{
    global $term_dir;
    $files = file_scan_directory($term_dir, '.*_(full|summ).*');
    if (!count($files)) {
        print 'No node_images for terms; update script does not support node images.';
        return;
    }
    $header = array(t('Term'), t('Image'), t('Migrate'), t('Delete'));
    foreach ($files as $image) {
        $image->tid = migrate_term_image_get_tid($image->name);
        list($image->width, $image->height) = getimagesize($image->filename);
        if ($image->height > 100) {
            $image->height = $image->height / 2;
            $image->width = $image->width / 2;
        }
        $img = "<img src='{$image->filename} ' width='{$image->width}' height='{$image->height}' />";
        $term = taxonomy_get_term($image->tid);
        $t_i_image = db_fetch_object(db_query('SELECT path FROM {term_image} WHERE tid = %d', $image->tid));
        if ($t_i_image) {
            $term->has_image = true;
        }
        unset($t_i_image);
        $item = $term->name . '($image->name)';
        $migrate = form_checkbox(NULL, "migrate][" . $image->name, 1, $term->has_image ? 0 : 1);
        $delete = form_checkbox(NULL, "delete][" . $image->name, 1, $term->has_image ? 1 : 0);
        $rows[] = array('data' => $item, $img, $migrate, $delete);
    }
    $table = theme('table', $header, $rows);
    $table .= '<em>Checked rows do not have an existing taxonomy_image entry</em><br/>';
    $form = form($table . form_submit('Migrate'));
    print $form;
}
Пример #4
0
 /**
  */
 function add()
 {
     return form($a)->validate(['name' => 'trim|required'])->db_insert_if_ok(self::table, ['name', 'web_path', 'real_path'], [])->on_after_update(function () {
         cache_del([self::table]);
         common()->admin_wall_add(['site added: ' . $_POST['name'] . '', db()->insert_id()]);
     })->text('name')->text('web_path')->text('real_path')->active_box()->save_and_back();
 }
Пример #5
0
/**
 * The main Page editor panel.
 *
 * @param string|array $message The activity message
 */
function page_edit($message = '')
{
    global $event, $step;
    pagetop(gTxt('edit_pages'), $message);
    extract(array_map('assert_string', gpsa(array('copy', 'save_error', 'savenew'))));
    $name = sanitizeForPage(assert_string(gps('name')));
    $newname = sanitizeForPage(assert_string(gps('newname')));
    if ($step == 'page_delete' || empty($name) && $step != 'page_new' && !$savenew) {
        $name = safe_field('page', 'txp_section', "name = 'default'");
    } elseif ((($copy || $savenew) && $newname || $newname && $newname != $name) && !$save_error) {
        $name = $newname;
    }
    $buttons = n . tag(gTxt('page_name'), 'label', array('for' => 'new_page')) . br . fInput('text', 'newname', $name, 'input-medium', '', '', INPUT_MEDIUM, '', 'new_page', false, true);
    if ($name) {
        $buttons .= span(href(gTxt('duplicate'), '#', array('id' => 'txp_clone', 'class' => 'clone', 'title' => gTxt('page_clone'))), array('class' => 'txp-actions'));
    } else {
        $buttons .= hInput('savenew', 'savenew');
    }
    $html = !$save_error ? fetch('user_html', 'txp_page', 'name', $name) : gps('html');
    // Format of each entry is popTagLink -> array ( gTxt() string, class/ID).
    $tagbuild_items = array('page_article' => array('page_article_hed', 'article-tags'), 'page_article_nav' => array('page_article_nav_hed', 'article-nav-tags'), 'page_nav' => array('page_nav_hed', 'nav-tags'), 'page_xml' => array('page_xml_hed', 'xml-tags'), 'page_misc' => array('page_misc_hed', 'misc-tags'), 'page_file' => array('page_file_hed', 'file-tags'));
    $tagbuild_links = '';
    foreach ($tagbuild_items as $tb => $item) {
        $tagbuild_links .= wrapRegion($item[1] . '_group', taglinks($tb), $item[1], $item[0], 'page_' . $item[1]);
    }
    echo hed(gTxt('tab_pages'), 1, array('class' => 'txp-heading'));
    echo n . tag(n . tag(hed(gTxt('tagbuilder'), 2) . $tagbuild_links, 'div', array('id' => 'tagbuild_links', 'class' => 'txp-layout-cell txp-layout-1-4')) . n . tag(form(graf($buttons) . graf(tag(gTxt('page_code'), 'label', array('for' => 'html')) . br . '<textarea class="code" id="html" name="html" cols="' . INPUT_LARGE . '" rows="' . TEXTAREA_HEIGHT_LARGE . '" dir="ltr">' . txpspecialchars($html) . '</textarea>') . graf(fInput('submit', '', gTxt('save'), 'publish') . eInput('page') . sInput('page_save') . hInput('name', $name)), '', '', 'post', 'edit-form', '', 'page_form'), 'div', array('id' => 'main_content', 'class' => 'txp-layout-cell txp-layout-2-4')) . n . tag(graf(sLink('page', 'page_new', gTxt('create_new_page')), ' class="action-create"') . page_list($name) . n, 'div', array('id' => 'content_switcher', 'class' => 'txp-layout-cell txp-layout-1-4')) . n, 'div', array('id' => $event . '_container', 'class' => 'txp-layout-grid'));
}
Пример #6
0
function GetAllComplaints($var, $gm)
{
    global $tbl_list_complaint;
    if ($var["serverindex"] == null || $var["serverindex"] == "") {
        echo "<script src='/js/page.js'></script>\n";
        echo "<script src='/js/checkbox.js'></script>\n";
        form($var, $gm);
        checkbox(true, true);
        ReturnAndBack();
        echo "</form>\n";
        return eachServerFrame($var, $gm);
    } else {
        $serv_id = intval($var["serverindex"]);
    }
    global $page_main, $tbl_sys_msg;
    $query_string = "select ua.ua_nMsgType, us.us_sName, c.c_sName, ua.ua_sErrorMsg, ua.ua_dtTime, ua.ua_uErrorCode from tbl_user_advice ua, tbl_char c, tbl_char_static cs, tbl_user_static us where ua.cs_uId = c.cs_uId and c.cs_uId = cs.cs_uId and cs.us_uId = us.us_uId order by ua_dtTime desc";
    page($var, $query_string, 58, "Game", $serv_id, $result, $page, $desc);
    echo "<table class='list_table'>\n";
    echo "<tr><th class='type' style='width:60px;'>" . $page_main["category"] . "</th><th style='width:80px;'>" . $page_main["user_name"] . "</th><th style='width:80px;'>" . $page_main["role_name"] . "</th><th>" . $page_main["content"] . "</th><th style='width:40px;'>" . $tbl_sys_msg["status"] . "</th><th style='width:120px;'>" . $tbl_sys_msg["time"] . "</th></tr>\n";
    while ($row = mysql_fetch_row($result)) {
        printf("<tr><td>%s</td><td><input type='checkbox' flag='user' value='%s' onclick='Checkbox(this)' />%s</td><td><input type='checkbox' flag='role' value='%s' onclick='Checkbox(this)' />%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n", $tbl_list_complaint[$row[0]], $row[1], $row[1], $row[2], $row[2], $row[3], "-", $row[4]);
    }
    echo "</table>\n";
    echo $page;
    return true;
}
Пример #7
0
function clean($message = '')
{
    global $prefs;
    extract($prefs);
    pagetop("Cache Cleaner", ps("txp_token") === md5($lastmod) ? "Successful" : "Token expired. Please try again.");
    if (ps("txp_token") === md5($lastmod)) {
        echo "<div align=\"center\" style=\"margin-top:3em\">";
        printf("Deleted %s files. Cache is clean.", '' . txp_flushdir(true));
        echo "</div>";
    }
    echo "<div align=\"center\" style=\"margin-top:3em\">";
    echo form(tag("Cache-Cleaner", "h3") . graf("Usually you don't need to do that. Cache is <b>automatically</b> cleared <br />1)\n\t\t\t\t  after a certain amount of time <br />2) when a comment is posted, edited or moderated\n\t\t\t      <br />3) after a page-template or form-tag is modified.<br />4) after template import.<br />5) after article update.<br /><br />" . fInput("hidden", "txp_token", md5($lastmod)) . fInput("submit", "clean_cache", "Clean all cached Files", "smallerbox") . eInput("cache") . sInput("clean"), " style=\"text-align:center\""));
    echo tag("Cache Statistics", "h3");
    global $path_to_site;
    $count = array('size' => 0, 'num' => 0);
    $txp_cache_dir = txpath . "/cache";
    if (!empty($txp_cache_dir) and $fp = opendir($txp_cache_dir)) {
        while (false !== ($file = readdir($fp))) {
            if ($file[0] != ".") {
                $count['size'] += filesize("{$txp_cache_dir}/{$file}");
                ++$count['num'];
            }
        }
        closedir($fp);
        printf("There are %d cache files with a total size of %d kb.", $count['num'], floor($count['size'] / 1000));
    } else {
        echo "Cache is empty.";
    }
    include $path_to_site . '/textpattern/lib/txp_cache/cache-config.php';
    echo "</div>";
}
Пример #8
0
/**
 * Renders and outputs a login form.
 *
 * This function outputs a full HTML document,
 * including &lt;head&gt; and footer.
 *
 * @param string|array $message The activity message
 */
function doLoginForm($message)
{
    global $textarray_script, $event, $step;
    include txpath . '/lib/txplib_head.php';
    $event = 'login';
    if (gps('logout')) {
        $step = 'logout';
    } elseif (gps('reset')) {
        $step = 'reset';
    }
    pagetop(gTxt('login'), $message);
    $stay = (cs('txp_login') and !gps('logout') ? 1 : 0);
    $reset = gps('reset');
    $name = join(',', array_slice(explode(',', cs('txp_login')), 0, -1));
    $out = array();
    if ($reset) {
        $out[] = hed(gTxt('password_reset'), 2, array('id' => 'txp-login-heading')) . graf(n . span(tag(gTxt('name'), 'label', array('for' => 'login_name')), array('class' => 'txp-label')) . n . span(fInput('text', 'p_userid', $name, '', '', '', INPUT_REGULAR, '', 'login_name'), array('class' => 'txp-value')), ' class="login-name"') . graf(fInput('submit', '', gTxt('password_reset_button'), 'publish') . n) . graf(href(gTxt('back_to_login'), 'index.php'), array('class' => 'login-return')) . hInput('p_reset', 1);
    } else {
        $out[] = hed(gTxt('login_to_textpattern'), 2, array('id' => 'txp-login-heading')) . graf(n . span(tag(gTxt('name'), 'label', array('for' => 'login_name')), array('class' => 'txp-label')) . n . span(fInput('text', 'p_userid', $name, '', '', '', INPUT_REGULAR, '', 'login_name'), array('class' => 'txp-value')), array('class' => 'login-name')) . graf(n . span(tag(gTxt('password'), 'label', array('for' => 'login_password')), array('class' => 'txp-label')) . n . span(fInput('password', 'p_password', '', '', '', '', INPUT_REGULAR, '', 'login_password'), array('class' => 'txp-value')), array('class' => 'login-password')) . graf(checkbox('stay', 1, $stay, '', 'login_stay') . n . tag(gTxt('stay_logged_in'), 'label', array('for' => 'login_stay')) . popHelp('remember_login') . n, array('class' => 'login-stay')) . graf(fInput('submit', '', gTxt('log_in_button'), 'publish') . n) . graf(href(gTxt('password_forgotten'), '?reset=1'), array('class' => 'login-forgot'));
        if (gps('event')) {
            $out[] = eInput(gps('event'));
        }
    }
    echo form(tag(join('', $out), 'section', array('role' => 'region', 'class' => 'txp-login', 'aria-labelledby' => 'txp-login-heading')), '', '', 'post', '', '', 'login_form') . script_js('textpattern.textarray = ' . json_encode($textarray_script)) . n . '</main><!-- /txp-body -->' . n . '</body>' . n . '</html>';
    exit(0);
}
Пример #9
0
function sec_section_list($message = '')
{
    pagetop(gTxt('sections'), $message);
    global $wlink;
    $pageslist = safe_column("name", "txp_page", "1=1");
    $styleslist = safe_column("name", "txp_css", "1=1");
    $out[] = tr(tdcs(strong(gTxt('section_head')) . popHelp('section_category'), 3));
    $out[] = tr(tdcs(form(fInput('text', 'name', '', 'edit', '', '', 10) . fInput('submit', '', gTxt('Create'), 'smallerbox') . eInput('section') . sInput('section_create')), 3));
    $defrow = safe_row("page, css", "txp_section", "name like 'default'");
    $out[] = form(tr(td(gTxt('default')) . td(startTable('edit', 'left', '') . tr(fLabelCell(gTxt('uses_page') . ':') . td(selectInput('page', $pageslist, $defrow['page']) . popHelp('section_uses_page'), '', 'noline')) . tr(fLabelCell(gTxt('uses_style') . ':') . td(selectInput('css', $styleslist, $defrow['css']) . popHelp('section_uses_css'), '', 'noline')) . tr(tda(fInput('submit', '', gTxt('save_button'), 'smallerbox'), ' colspan="2" style="border:0"')) . endTable()) . td()) . eInput('section') . sInput('section_save') . hInput('name', 'default'));
    $rs = safe_rows_start("*", "txp_section", "name!='' order by name");
    if ($rs) {
        while ($a = nextRow($rs)) {
            extract($a);
            if ($name == 'default') {
                continue;
            }
            $deletelink = dLink('section', 'section_delete', 'name', $name, '', 'type', 'section');
            $form = startTable('edit') . stackRows(fLabelCell(gTxt('section_name') . ':') . fInputCell('name', $name, 1, 20), fLabelCell(gTxt('section_longtitle') . ':') . fInputCell('title', $title, 1, 20), fLabelCell(gTxt('uses_page') . ':') . td(selectInput('page', $pageslist, $page) . popHelp('section_uses_page'), '', 'noline'), fLabelCell(gTxt('uses_style') . ':') . td(selectInput('css', $styleslist, $css) . popHelp('section_uses_css'), '', 'noline'), fLabelCell(gTxt('selected_by_default') . '?') . td(yesnoradio('is_default', $is_default) . popHelp('section_is_default'), '', 'noline'), fLabelCell(gTxt('on_front_page') . '?') . td(yesnoradio('on_frontpage', $on_frontpage) . popHelp('section_on_frontpage'), '', 'noline'), fLabelCell(gTxt('syndicate') . '?') . td(yesnoradio('in_rss', $in_rss) . popHelp('section_syndicate'), '', 'noline'), fLabelCell(gTxt('include_in_search') . '?') . td(yesnoradio('searchable', $searchable) . popHelp('section_searchable'), '', 'noline'), tda(fInput('submit', '', gTxt('save_button'), 'smallerbox'), ' colspan="2" style="border:0"')) . endTable() . eInput('section') . sInput('section_save') . hInput('old_name', $name);
            $form = form($form);
            $out[] = tr(td($name) . td($form) . td($deletelink));
        }
    }
    echo startTable('list') . join('', $out) . endTable();
}
Пример #10
0
 /**
  */
 function edit()
 {
     $replace = _class('admin_methods')->edit($this->_table);
     $data = [];
     if ($replace['linked_data']) {
         $data = main()->get_data($replace['linked_data']);
     } elseif ($replace['linked_table']) {
         $q = db()->query('SELECT id, name FROM `' . db($replace['linked_table']) . '` ORDER BY name ASC');
         while ($a = db()->fetch_assoc($q)) {
             $data[$a['id']] = $a['name'];
         }
     } elseif ($replace['linked_method']) {
         list($module, $method) = explode('.', trim($replace['linked_method']));
         $module_obj = module($module);
         if (method_exists($module_obj, $method)) {
             $data = $module_obj->{$method}();
         }
     }
     $form = form($replace);
     $form->info('name');
     if ($data) {
         $form->select_box('value', $data);
     } else {
         $form->text('value');
     }
     $form->textarea('desc');
     $form->save_and_back();
     return $form;
 }
Пример #11
0
 /**
  * Login form
  */
 function _show_form()
 {
     // Already logged in users not needed to login again
     if (main()->USER_ID) {
         return js_redirect($this->DEF_REDIRECT_URL);
     }
     // Default resirect after login
     $_url_after_login = $this->DEF_REDIRECT_URL;
     // Process special redirect format
     if (!empty($_GET['go_url'])) {
         if (false !== ($pos1 = strpos($_GET['go_url'], ';'))) {
             $_GET['go_url'] = substr($_GET['go_url'], 0, $pos1) . '&action=' . substr($_GET['go_url'], $pos1 + 1);
         }
         $_url_after_login = '******' . str_replace(';', '&', $_GET['go_url']);
     } elseif (conf('_force_login_go_url')) {
         $_url_after_login = conf('_force_login_go_url');
     }
     if (strlen($_url_after_login) > 3 && !$_SESSION['user_go_url']) {
         if (substr($_url_after_login, 0, 3) == './?') {
             $_url_after_login = substr($_url_after_login, 3);
         }
         $_SESSION['user_go_url'] = $_url_after_login;
     }
     // To prevent multiple login forms displayed on one page
     conf('_login_form_displayed', true);
     return form(['form_action' => './?task=login'], ['class' => 'form-horizontal', 'legend' => 'Member Login', 'hide_empty' => 1])->validate(['__form_id__' => 'login_full_form', $this->LOGIN_FIELD => 'trim|required', 'password' => 'trim|required'])->login($this->LOGIN_FIELD, '', ['class' => 'input-medium', 'type' => $this->LOGIN_FIELD != 'login' ? $this->LOGIN_FIELD : 'text'])->password(['class' => 'input-medium'])->check_box('remember_me', '', ['no_label' => 1])->submit(['value' => 'Login', 'link_name' => 'Register', 'link_url' => './?object=register'])->container($this->oauth(['only_icons' => 1]), ['wide' => 0])->link('Retrieve lost password', './?object=get_pswd', ['class' => 'btn btn-mini btn-xs'])->hidden('action', null, ['value' => 'login']);
 }
Пример #12
0
function page_admin_images($act = "", $id = "")
{
    requires_admin();
    use_template("admin");
    if ($act == "add") {
        if (form_file_uploaded("file")) {
            $fname = $_FILES["file"]['name'];
            db_query("INSERT INTO images (link) VALUES ('')");
            $id = db_last_id();
            $fname = $id . "." . fileext($fname);
            form_file_uploaded_move("file", "img/" . $fname);
            db_query("UPDATE images SET link='img/{$fname}' WHERE id=%d", $id);
            redir("admin/images");
        }
        form_start("", "post", " enctype='multipart/form-data' ");
        form_file("Файл", "file");
        form_submit("Загрузить", "submit");
        form_end();
        $o = form();
        return $o;
    }
    if ($act == "del") {
        $im = db_object_get("images", $id);
        @unlink("../{$im->link}");
    }
    $o = table_edit("images", "admin/images", $act, $id, "", "", "", "image_func");
    return $o;
}
Пример #13
0
 function _form($data)
 {
     $data_desc = $data ? 'Результат' : '';
     $replace = [];
     $_form = form($replace)->row_start(['desc' => ''])->submit('import', 'Импорт списка отделений')->check_box('confirm', false, ['desc' => 'подтверждение', 'no_label' => true])->row_end()->container($data, $data_desc);
     return $_form;
 }
Пример #14
0
 public function postAddress($number, FormRequest $request)
 {
     if (!form('shipment_address')->handle($request)) {
         return redirect('cart/shipment/' . $number . '/address');
     }
     return redirect('checkout');
 }
Пример #15
0
function css_edit_raw()
{
    global $event, $step;
    $default_name = safe_field('css', 'txp_section', "name = 'default'");
    extract(gpsa(array('name', 'newname', 'copy', 'savenew')));
    if ($step == 'css_delete' || empty($name) && $step != 'pour' && !$savenew) {
        $name = $default_name;
    } elseif (($copy || $savenew) && trim(preg_replace('/[<>&"\']/', '', $newname))) {
        $name = $newname;
    }
    if (empty($name)) {
        $buttons = '<div class="edit-title">' . gTxt('name_for_this_style') . ': ' . fInput('text', 'newname', '', 'edit', '', '', 20) . hInput('savenew', 'savenew') . '</div>';
        $thecss = gps('css');
    } else {
        $buttons = '<div class="edit-title">' . gTxt('you_are_editing_css') . sp . strong(htmlspecialchars($name)) . '</div>';
        $thecss = fetch("css", 'txp_css', 'name', $name);
    }
    if (!empty($name)) {
        $copy = '<span class="copy-as"><label for="copy-css">' . gTxt('copy_css_as') . '</label>' . sp . fInput('text', 'newname', '', 'edit', '', '', '', '', 'copy-css') . sp . fInput('submit', 'copy', gTxt('copy'), 'smallerbox') . '</span>';
    } else {
        $copy = '';
    }
    $right = '<div id="content_switcher">' . hed(gTxt('all_stylesheets'), 2) . graf(sLink('css', 'pour', gTxt('create_new_css')), ' class="action-create smallerbox"') . css_list($name, $default_name) . '</div>';
    echo '<div id="' . $event . '_container" class="txp-container txp-edit">' . startTable('edit') . tr(td(form('<div id="main_content">' . $buttons . '<textarea id="css" class="code" name="css" cols="78" rows="32">' . htmlspecialchars($thecss) . '</textarea>' . br . fInput('submit', '', gTxt('save'), 'publish') . eInput('css') . sInput('css_save') . hInput('name', $name) . $copy . '</div>', '', '', 'post', 'edit-form', '', 'style_form'), '', 'column') . tdtl($right, ' class="column"')) . endTable() . '</div>';
}
Пример #16
0
/**
 * jmd_img_selector preferences
 *
 * @param string $event
 * @param string $step
 */
function jmd_img_selector($event, $step)
{
    global $jmdImgSel, $path_to_site, $prefs;
    $out = '<div id="jmd_img_selector" style="width: 500px; margin: 0 auto">';
    if ($step === 'update') {
        $settings = array('tbWidth' => gps('tbWidth'), 'tbHeight' => gps('tbHeight'), 'imgWidth' => gps('imgWidth'), 'imgHeight' => gps('imgHeight'));
        foreach ($settings as $key => $value) {
            $jmdImgSel->upsertPref($key, $value);
        }
        $msg = $jmdImgSel->gTxt('prefs_updated');
    }
    if ($step === 'css') {
        $css = <<<CSS
//inc <img_sel.css>
CSS;
        safe_insert("txp_css", "name='jmd_img_selector', css='" . base64_encode($css) . "'");
        $msg = $jmdImgSel->gTxt('css_created');
    }
    pageTop($jmdImgSel->gTxt('prefs'), isset($msg) ? $msg : '');
    // Preferences
    $out .= form(fieldset(fieldset($jmdImgSel->input('pref_width', 'tbWidth') . $jmdImgSel->input('pref_height', 'tbHeight'), $jmdImgSel->gTxt('tb_legend')) . fieldset($jmdImgSel->input('pref_width', 'imgWidth') . $jmdImgSel->input('pref_height', 'imgHeight'), $jmdImgSel->gTxt('img_legend')) . fInput('submit', 'update', $jmdImgSel->gTxt('update')) . eInput('jmd_img_selector') . sInput('update'), $jmdImgSel->gTxt('prefs_legend')));
    // Check if CSS file exists
    $rs = safe_field('name', 'txp_css', 'name="jmd_img_selector"');
    if (empty($rs)) {
        $out .= form(fieldset(fInput('submit', 'submit', $jmdImgSel->gTxt('create_css')) . eInput('jmd_img_selector') . sInput('css'), $jmdImgSel->gTxt('css_legend')));
    }
    echo $out;
}
Пример #17
0
function section_list($message = '')
{
    pagetop(gTxt('sections'), $message);
    global $url_mode, $txpac, $wlink;
    $out[] = tr(tdcs(strong(gTxt('section_head')) . popHelp('section_category'), 3));
    $out[] = tr(tdcs(form(fInput('text', 'name', '', 'edit', '', '', 10) . fInput('submit', '', gTxt('Create'), 'smallerbox') . eInput('section') . sInput('section_create')), 3));
    $pageslist = safe_column("name", "txp_page", "1");
    $styleslist = safe_column("name", "txp_css", "1");
    $rs = safe_rows("*", "txp_section", "name!='' order by name");
    if ($rs) {
        foreach ($rs as $a) {
            extract($a);
            if ($name == 'default') {
                continue;
            }
            if ($url_mode) {
                $wlink = !check_sections($name) ? sp . wLink('section', 'missing_section_file', 'name', $name) : '';
            }
            $deletelink = dLink('section', 'section_delete', 'name', $name, '', 'type', 'section');
            $form = startTable('edit') . stackRows(fLabelCell(gTxt('section_name') . ':') . fInputCell('name', $name, 1, 20), fLabelCell(gTxt('uses_page') . ':') . td(selectInput('page', $pageslist, $page) . popHelp('section_uses_page'), '', 'noline'), fLabelCell(gTxt('uses_style') . ':') . td(selectInput('css', $styleslist, $css) . popHelp('section_uses_css'), '', 'noline'), fLabelCell(gTxt('selected_by_default') . '?') . td(yesnoradio('is_default', $is_default) . popHelp('section_is_default'), '', 'noline'), fLabelCell(gTxt('on_front_page') . '?') . td(yesnoradio('on_frontpage', $on_frontpage) . popHelp('section_on_frontpage'), '', 'noline'), fLabelCell(gTxt('syndicate') . '?') . td(yesnoradio('in_rss', $in_rss) . popHelp('section_syndicate'), '', 'noline'), fLabelCell(gTxt('include_in_search') . '?') . td(yesnoradio('searchable', $searchable) . popHelp('section_searchable'), '', 'noline'), tda(fInput('submit', '', gTxt('save_button'), 'smallerbox'), ' colspan="2" style="border:0"')) . endTable() . eInput('section') . sInput('section_save') . hInput('old_name', $name);
            $form = form($form);
            $out[] = tr(td($name . $wlink) . td($form) . td($deletelink));
        }
    }
    echo startTable('list') . join('', $out) . endTable();
}
Пример #18
0
function form_list($curname)
{
    global $step, $essential_forms;
    $out[] = '<p class="action-create smallerbox">' . sLink('form', 'form_create', gTxt('create_new_form')) . '</p>';
    $methods = array('delete' => gTxt('delete'));
    $rs = safe_rows_start("*", "txp_form", "1 order by type asc, name asc");
    if ($rs) {
        $ctr = 1;
        $prev_type = '';
        while ($a = nextRow($rs)) {
            extract($a);
            $editlink = $curname != $name ? eLink('form', 'form_edit', 'name', $name, $name) : htmlspecialchars($name);
            $modbox = !in_array($name, $essential_forms) ? '<input type="checkbox" name="selected_forms[]" value="' . $name . '" />' : '';
            if ($prev_type != $type) {
                $visipref = 'pane_form_' . $type . '_visible';
                //TODO: Add 'article', 'comment', 'misc' to rpc server for gTxt()
                $group_start = '<div class="form-list-group ' . $type . '"><h3 class="plain lever' . (get_pref($visipref) ? ' expanded' : '') . '"><a href="#' . $type . '">' . ucfirst(gTxt($type)) . '</a></h3>' . n . '<div id="' . $type . '" class="toggle form-list" style="display:' . (get_pref($visipref) ? 'block' : 'none') . '">' . n . '<ul class="plain-list">' . n;
                $group_end = $ctr > 1 ? '</ul></div></div>' . n : '';
            } else {
                $group_start = $group_end = '';
            }
            $out[] = $group_end . $group_start;
            $out[] = '<li class="' . ($ctr % 2 == 0 ? 'even' : 'odd') . '">' . n . '<span class="form-list-action">' . $modbox . '</span><span class="form-list-name">' . $editlink . '</span></li>';
            $prev_type = $type;
            $ctr++;
        }
        $out[] = '</ul></div></div>';
        $out[] = eInput('form') . sInput('form_multi_edit');
        $out[] = graf(selectInput('edit_method', $methods, '', 1) . sp . gTxt('selected') . sp . fInput('submit', 'form_multi_edit', gTxt('go'), 'smallerbox'), ' align="right"');
        return form(join('', $out), '', "verify('" . gTxt('are_you_sure') . "')", 'post', '', '', 'allforms_form');
    }
}
Пример #19
0
function wlist()
{
    $lines = null;
    $args = func_get_args();
    switch ($args[0]) {
        case 'scan':
            if ($elements = scan_dir($args[2]['path'], 'DIR')) {
                foreach ($elements as $value) {
                    if (is_file($args[2]['path'] . $value . $args[2]['find'])) {
                        $about = @parse_ini_file($args[2]['path'] . $value . '/protocol/about.gl.php');
                        $name = $about['product'] ? $about['product'] : $value;
                        $lines[$name] = $args[3] ? href(THIS, $args[3], $value) : href($value);
                        unset($about);
                    }
                }
            }
            break;
        default:
            if (is_array($args[2])) {
                foreach ($args[2] as $link => $name) {
                    $lines[$link] = href(THIS, $args[3], $name);
                }
            }
            break;
    }
    //Выводим массив ссылок ;)
    if ($lines) {
        foreach ($lines as $name => $link) {
            form("label", icon($args[1]) . '<a href="' . $link . '">' . $name . '</a>');
        }
    } else {
        html('<br> Wlist lib. (C) Kazin Fedor, 2010');
    }
}
Пример #20
0
 function generateConfirm($edit)
 {
     $dataInvalid = $this->isDataInvalid($edit);
     if ($this->formbuilder) {
         $this->formbuilder->bulk_set_answers($_POST[$this->event->formkey()]);
         $dataInvalid .= $this->formbuilder->answers_invalid();
     }
     if ($dataInvalid) {
         error_exit($dataInvalid . '<br>Please use your back button to return to the form, fix these errors, and try again.');
     }
     $output = para('Please confirm that this data is correct and click the submit button to proceed to the payment information page.');
     $output .= form_hidden('edit[step]', 'submit');
     $fields = array('Registration Status' => 'payment', 'Notes' => 'notes');
     $rows = array();
     foreach ($fields as $display => $column) {
         array_push($rows, array($display, form_hidden("edit[{$column}]", $edit[$column]) . check_form($edit[$column])));
     }
     $output .= form_group('Registration details', "<div class='pairtable'>" . table(null, $rows) . '</div>');
     if ($this->formbuilder) {
         $form = $this->formbuilder->render_viewable();
         $form .= $this->formbuilder->render_hidden();
         $output .= form_group('Registration answers', $form);
     }
     $output .= para(form_submit('submit'));
     return form($output);
 }
Пример #21
0
function RoleToUser($var, $gm)
{
    global $page_main;
    if ($var["serverindex"] == null || $var["serverindex"] == "") {
        echo "<script src='/js/checkbox.js' type='text/javascript'></script>\n";
        form($var, $gm);
        checkbox(true, false);
        echo "</form>\n";
        ReturnAndBack();
        $ret = eachServerFrame($var, $gm);
        ReturnAndBack();
        return $ret;
    }
    $serverid = $var["serverindex"];
    $role_names = $var["role_name"];
    $role_names = implode("','", explode(",", $role_names));
    $qs = "select distinct us.us_uId, us.us_sName from tbl_char_static cs, tbl_char c, tbl_user_static us where cs.cs_uId = c.cs_uId and cs.us_uId = us.us_uId and c.c_sName in ('" . $role_names . "');";
    $result = MySQLQuery($qs, "Game", $serverid);
    echo "<table class='list_table'>\n";
    echo "<tr><th>" . $page_main["user_id"] . "</th><th>" . $page_main["user_name"] . "</th></tr>\n";
    while ($row = mysql_fetch_row($result)) {
        printf("<tr" . ($i++ % 2 == 0 ? "" : " class='even'") . "><td>%s</td><td><input type='checkbox' flag='user' onclick='Checkbox(this);' value='%s'/>%s</td></tr>\n", $row[0], $row[1], $row[1]);
    }
    echo "</table>\n";
    return true;
}
Пример #22
0
function doLoginForm($message)
{
    include txpath . '/lib/txplib_head.php';
    pagetop(gTxt('login'), $message);
    $stay = (cs('txp_login') and !gps('logout') ? 1 : 0);
    $reset = gps('reset');
    $name = join(',', array_slice(explode(',', cs('txp_login')), 0, -1));
    echo n . '<div id="login_container" class="txp-container">';
    echo form('<div class="txp-login">' . n . hed(gTxt($reset ? 'password_reset' : 'login_to_textpattern'), 2) . n . graf('<span class="login-label"><label for="login_name">' . gTxt('name') . '</label></span>' . n . '<span class="login-value">' . fInput('text', 'p_userid', $name, '', '', '', INPUT_REGULAR, '', 'login_name') . '</span>', ' class="login-name"') . ($reset ? '' : n . graf('<span class="login-label"><label for="login_password">' . gTxt('password') . '</label></span>' . n . '<span class="login-value">' . fInput('password', 'p_password', '', '', '', '', INPUT_REGULAR, '', 'login_password') . '</span>', ' class="login-password"')) . ($reset ? '' : graf(checkbox('stay', 1, $stay, '', 'login_stay') . n . '<label for="login_stay">' . gTxt('stay_logged_in') . '</label>' . sp . popHelp('remember_login'), ' class="login-stay"')) . ($reset ? n . hInput('p_reset', 1) : '') . n . graf(fInput('submit', '', gTxt($reset ? 'password_reset_button' : 'log_in_button'), 'publish')) . n . ($reset ? graf('<a href="index.php">' . gTxt('back_to_login') . '</a>', ' class="login-return"') : graf('<a href="?reset=1">' . gTxt('password_forgotten') . '</a>', ' class="login-forgot"')) . (gps('event') ? eInput(gps('event')) : '') . '</div>', '', '', 'post', '', '', 'login_form') . '</div>' . n . script_js(<<<EOSCR
// Focus on either username or password when empty
\$(document).ready(
\tfunction() {
\t\tvar has_name = \$("#login_name").val().length;
\t\tvar password_box = \$("#login_password").val();
\t\tvar has_password = (password_box) ? password_box.length : 0;
\t\tif (!has_name) {
\t\t\t\$("#login_name").focus();
\t\t} else if (!has_password) {
\t\t \t\$("#login_password").focus();
\t\t}
\t}
);
EOSCR
) . n . '</div><!-- /txp-body -->' . n . '</body>' . n . '</html>';
    exit(0);
}
Пример #23
0
function GetCmpstByGM($var, $gm)
{
    global $tbl_sys_msg, $page_main, $tbl_list_compensate;
    if ($var["serverindex"] == null || $var["serverindex"] == "") {
        $js_src = <<<_js_src
<script type='text/javascript' src='/js/checkbox.js'></script>
<script type='text/javascript' src='/js/page.js'></script>
<script type='text/javascript'>
function cancel(id)
{
\tdocument.form1.target = "_block"
\tdocument.form1.action_name.value='124';
\tdocument.form1.id.value=id;
\tdocument.form1.submit();
}
</script>
_js_src;
        echo $js_src . "\n";
        echo "<script type='text/javascript' src='/js/log_info.js'></script>\n";
        form($var, $gm);
        echo "<input type='hidden' name='flag' />\n";
        echo "<input type='hidden' name='role_name' />\n";
        echo "<input type='hidden' name='str' />\n";
        echo "<input type='hidden' name='urs' />\n";
        echo "<input type='hidden' name='id' />";
        checkbox(false, true);
        ReturnAndBack();
        $ret = eachServerFrame($var, $gm);
        ReturnAndBack();
        echo "</form>\n";
        return $ret;
    }
    $serv_id = intval($var["serverindex"]);
    $gm_name = mysql_escape_string($gm);
    $filter = "";
    if ($var["flag"] != "" || $var["role_name"] != "") {
        $filter = " and";
        if ($var["flag"] != "") {
            $filter .= " reason like '%#[" . $var["flag"] . "[%'";
        }
        if ($var["flag"] != "" && $var["role_name"] != "") {
            $filter .= " and";
        }
        if ($var["role_name"] != "") {
            $k = $var["role_name"];
            $filter .= " (reason like '%[" . $k . ",%' or reason like '%," . $k . "]%' or reason like '%," . $k . ",%' or reason like '%[" . $k . "]%')";
        }
    }
    $query = "select gca_uId, gm, action_id, reason, action_state from tbl_gm_compensate_action where server_id = '{$serv_id}' and gm = '{$gm_name}'" . $filter . " order by gca_uId desc";
    page($var, $query, 123, "GMS", 0, $result, $page, $desc);
    echo "<table class='list_table'>\n";
    echo "<tr><th style='width:60px;'>" . $page_main["user_name"] . "</th><th style='width:160px;'>" . $page_main["event_type"] . "</th><th>" . $tbl_sys_msg["desc"] . "</th><th style='width:60px;'>" . $tbl_sys_msg["act"] . "</th><th style='width:80px;'>" . $tbl_sys_msg["status"] . "</th></tr>\n";
    while ($row = mysql_fetch_row($result)) {
        printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td class='server' title='" . $serv_id . "'>%s</td></tr>", $row[1], GetGMCommandLogAction($row[2]), LogInfo($row[3]), hasAuth(124, $gm) && $row[4] == 1 ? "<input type=button value='" . $tbl_sys_msg["cancel"] . "' onclick='cancel(" . $row[0] . ")'/>" : "", $tbl_list_compensate[$row[4]]);
    }
    echo "</table>\n";
    echo $page;
    return true;
}
Пример #24
0
function generate_profile_image($q)
{
    // Get image file name.
    $black_ribbon = "ribbon.png";
    $white_transparant = "white_transparant.png";
    $profile_image = $q;
    // Get image info.
    $black_ribbon_info = getimagesize($black_ribbon);
    $profile_image_info = getimagesize($profile_image);
    // Define flag image object.
    $black_ribbon_obj = imagecreatefrompng($black_ribbon);
    imagealphablending($black_ribbon_obj, true);
    $white_transparant_obj = imagecreatefrompng($white_transparant);
    // Check valid image or not.
    if ($profile_image_info === FALSE) {
        $content = "<p><span class=\"text text-success\">Your uploaded file is not image file.</span><br />Pleaes try again</p>" . form();
        return page_template($content);
    }
    // Define profile image object.
    switch ($profile_image_info[2]) {
        case IMAGETYPE_GIF:
            $profile_image_obj = imagecreatefromgif($profile_image);
            break;
        case IMAGETYPE_JPEG:
            $profile_image_obj = imagecreatefromjpeg($profile_image);
            break;
        case IMAGETYPE_PNG:
            $profile_image_obj = imagecreatefrompng($profile_image);
            break;
    }
    imagealphablending($profile_image_obj, true);
    // Get new sizes of flag base on profile image.
    list($width, $height) = $black_ribbon_info;
    list($newwidth, $newheight) = $profile_image_info;
    list($profile_image_width, $profile_image_height) = $profile_image_info;
    echo "{$newwidth}||{$newheight}";
    if ($newwidth < $newheight) {
        $newheight = $newwidth / $width * $height;
    } else {
        $newwidth = $newheight / $height * $width;
    }
    // Resizse news flag.
    $new_resize_image = imagecreatetruecolor($newwidth, $newheight);
    imagealphablending($new_resize_image, false);
    imagesavealpha($new_resize_image, true);
    imagecopyresized($new_resize_image, $black_ribbon_obj, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
    imagesavealpha($new_resize_image, true);
    $black_ribbon_obj = $new_resize_image;
    // Combine two image
    $destination_img_obj = $profile_image_obj;
    $source_img_obj = $black_ribbon_obj;
    imagecopy($destination_img_obj, $white_transparant_obj, 0, 0, 0, 0, $profile_image_width, $profile_image_height);
    imagecopy($destination_img_obj, $source_img_obj, 0, 0, 0, 0, $newwidth, $newheight);
    imagesavealpha($destination_img_obj, true);
    $img_name = microtime(true);
    imagepng($destination_img_obj, "./images/{$img_name}.png");
    $content = "\n                    <p>\n                        <img src=\"./images/{$img_name}.png\" class=\"img-responsive\">\n                        <div class=\"clearfix\"></div>\n                        <span class=\"text text-success\">Your image save successfully.</span><br />\n                        Try with new another photo again\n                    </p>" . form();
    return page_template($content);
}
Пример #25
0
function microxform()
{
    $j = 'tickets_plug___tickets_tickets*j_' . ses('qb') . '__tckmsg|tckansw';
    $t .= lj('popbt', $j, nms(28)) . ' ';
    $t .= balise('input', array(1 => 'text', 3 => "tckansw", 23 => nms(91), 6 => 4, 7 => 4), '') . br();
    $t .= balise('textarea', array(3 => "tckmsg", 7 => 1000, 9 => 61, 10 => 7), '');
    return form('', $t);
}
Пример #26
0
 /**
  */
 function add()
 {
     $a = $_POST;
     return form($a)->validate(['ip' => 'trim|required|valid_ip|is_unique[core_servers.ip]'])->db_insert_if_ok(self::table, ['ip', 'role', 'name', 'hostname', 'comment'], [])->on_after_update(function () {
         cache_del(['servers', 'server_roles']);
         common()->admin_wall_add(['server added: ' . $_POST['ip'] . '', db()->insert_id()]);
     })->text('ip')->text('role')->text('name')->text('hostname')->textarea('comment')->active_box()->save_and_back();
 }
Пример #27
0
function page_edit_form($name)
{
    global $step;
    $html = safe_field('user_html', 'txp_page', "name='" . doSlash($name) . "'");
    $out[] = '<p>' . gTxt('you_are_editing_page') . sp . strong($name) . br . '<textarea id="html" class="code" name="html" cols="84" rows="36">' . htmlspecialchars($html) . '</textarea>' . br . n . fInput('submit', 'save', gTxt('save'), 'publish') . n . eInput('page') . n . sInput('page_save') . n . hInput('name', $name);
    $out[] = n . '<label for="copy-page">' . gTxt('copy_page_as') . '</label>' . sp . n . fInput('text', 'newname', '', 'edit', '', '', '', '', 'copy-page') . n . fInput('submit', 'copy', gTxt('copy'), 'smallerbox') . '</p>';
    return form(join('', $out));
}
Пример #28
0
 public function postIndex(FormRequest $request, Cart $cart)
 {
     if (!form('cart_review')->handle($request)) {
         return redirect('checkout');
     }
     Message::addSuccess('Order #' . $cart->id . ' has been received!');
     return redirect('cart/success');
 }
Пример #29
0
 /**
  */
 function show()
 {
     $a = db()->get('SELECT * FROM ' . db('admin') . ' WHERE id=' . (int) main()->ADMIN_ID);
     $a['password'] = '';
     return form($a + (array) $_POST, ['autocomplete' => 'off'])->validate(['__before__' => 'trim', 'email' => 'required|valid_email|is_unique_without[admin.email.' . main()->ADMIN_ID . ']', 'first_name' => 'required|alpha_numeric_spaces', 'last_name' => 'required|alpha_numeric_spaces', 'password' => 'password_update'])->db_update_if_ok('admin', ['email', 'first_name', 'last_name', 'go_after_login', 'password'], 'id=' . (int) main()->ADMIN_ID, ['on_after_update' => function () {
         common()->admin_wall_add(['admin account details updated', main()->ADMIN_ID]);
     }])->info('login')->info('group', ['data' => main()->get_data('admin_groups')])->password(['value' => ''])->email()->text('first_name')->text('last_name')->text('go_after_login', 'Url after login')->save();
 }
Пример #30
0
function UserAngelType_add_view($angeltype, $users_source, $user_id)
{
    $users = array();
    foreach ($users_source as $user_source) {
        $users[$user_source['UID']] = User_Nick_render($user_source);
    }
    return page_with_title(_("Add user to angeltype"), array(msg(), buttons(array(button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'], _("back"), 'back'))), form(array(form_info(_("Angeltype"), $angeltype['name']), form_select('user_id', _("User"), $users, $user_id), form_submit('submit', _("Add"))))));
}