コード例 #1
0
ファイル: touch.php プロジェクト: voitto/eggs
function mobile_page($id, $options = array())
{
    $options['no-end'] = true;
    if (isset($options['selected'])) {
        $options['class'] = 'current';
    }
    build_page($id, $options);
}
コード例 #2
0
ファイル: 70.pages.php プロジェクト: hxii/bludit
function build_all_pages()
{
    global $pages;
    global $pagesParents;
    global $dbPages;
    $list = $dbPages->getAll();
    unset($list['error']);
    foreach ($list as $key => $db) {
        $Page = build_page($key);
        if ($Page !== false) {
            // --- Order pages by parents ---
            // Generate all posible parents.
            if ($Page->parentKey() === false) {
                // Add the parent key in the dbPages
                $dbPages->addParentKey($Page->key());
                $pagesParents[NO_PARENT_CHAR][$Page->key()] = $Page;
            } else {
                $pagesParents[$Page->parentKey()][$Page->key()] = $Page;
            }
            // --- All pages in 1 array ---
            $pages[$Page->key()] = $Page;
        }
    }
    // ======== Sort pages ========
    $tmpNoParents = $pagesParents[NO_PARENT_CHAR];
    unset($pagesParents[NO_PARENT_CHAR]);
    // Sort children
    $tmpPageWithParent = array();
    foreach ($pagesParents as $parentKey => $childrenPages) {
        $tmpPageWithParent[$parentKey] = $childrenPages;
        uasort($tmpPageWithParent[$parentKey], 'orderChildren');
    }
    // Sort parents
    $tmp = array();
    foreach ($tmpNoParents as $parentKey => $childrenPages) {
        // DEBUG: Workaround, Esto es un bug, cuando se usa el Cli mode
        // DEBUG: Se genera un padre sin index.txt y adentro hay un hijo
        if (isset($pages[$parentKey])) {
            $tmp = orderParent($tmp, array($parentKey => $childrenPages), $pages[$parentKey]->position());
        }
    }
    $pagesParents = array(NO_PARENT_CHAR => $tmp) + $tmpPageWithParent;
}
コード例 #3
0
ファイル: 70.pages.php プロジェクト: CryssDOTnet/bludit
function build_all_pages()
{
    global $pages;
    global $pagesParents;
    global $dbPages;
    $list = $dbPages->getAll();
    unset($list['error']);
    foreach ($list as $key => $db) {
        $Page = build_page($key);
        if ($Page !== false) {
            // --- Order pages by parents ---
            // Generate all posible parents.
            if ($Page->parentKey() === false) {
                // Add the parent key in the dbPages
                $dbPages->addParentKey($Page->key());
                $pagesParents[NO_PARENT_CHAR][$Page->key()] = $Page;
            } else {
                $pagesParents[$Page->parentKey()][$Page->key()] = $Page;
            }
            // --- All pages in 1 array ---
            $pages[$Page->key()] = $Page;
        }
    }
    // --- SORT PAGES ---
    // Sort parents.
    $parents = $pagesParents[NO_PARENT_CHAR];
    uasort($parents, 'sortPages');
    // Sort children.
    unset($pagesParents[NO_PARENT_CHAR]);
    $children = $pagesParents;
    $tmpPageWithParent = array();
    foreach ($children as $parentKey => $childrenPages) {
        // If the child doesn't have a valid parent, then doesn't included them.
        if (isset($pages[$parentKey])) {
            $tmpPageWithParent[$parentKey] = $childrenPages;
            uasort($tmpPageWithParent[$parentKey], 'sortPages');
        }
    }
    $pagesParents = array(NO_PARENT_CHAR => $parents) + $tmpPageWithParent;
}
コード例 #4
0
ファイル: 70.pages.php プロジェクト: roberthchan/bludit
function build_all_pages()
{
    global $pages;
    global $pagesParents;
    global $dbPages;
    $list = $dbPages->getAll();
    unset($list['error']);
    foreach ($list as $key => $db) {
        $Page = build_page($key);
        if ($Page !== false) {
            // Generate all posible parents.
            if ($Page->parentKey() === false) {
                $dbPages->addParentKey($Page->key());
                $pagesParents[NO_PARENT_CHAR][$Page->key()] = $Page;
            } else {
                $pagesParents[$Page->parentKey()][$Page->key()] = $Page;
            }
            // $pages array
            $pages[$Page->key()] = $Page;
        }
    }
    // ======== Order pages ========
    // DEBUG: No me gusta esta forma de ordenar
    // Order children
    $tmp = array();
    foreach ($pagesParents as $parentKey => $childrenPages) {
        $tmp[$parentKey] = $childrenPages;
        uasort($tmp[$parentKey], 'orderChildren');
    }
    if (isset($tmp[NO_PARENT_CHAR])) {
        $tmpNoParents = $tmp[NO_PARENT_CHAR];
        unset($tmp[NO_PARENT_CHAR]);
    }
    $pagesParents = $tmp;
    // Order parents.
    foreach ($pagesParents as $parentKey => $childrenPages) {
        $tmp = orderParent($tmp, array($parentKey => $childrenPages), $pages[$parentKey]->position());
    }
    $pagesParents = array(NO_PARENT_CHAR => $tmpNoParents) + $tmp;
}
コード例 #5
0
ファイル: art_tag.php プロジェクト: laiello/mystep-cms
require "inc.php";
$method = $req->getGet("method");
if (empty($method)) {
    $method = "list";
}
$id = $req->getGet("id");
$log_info = "";
$setting_sub = getSubSetting($web_id);
if ($setting['db']['name'] == $setting_sub['db']['name']) {
    $setting['db']['pre_sub'] = $setting_sub['db']['pre'];
} else {
    $setting['db']['pre_sub'] = $setting_sub['db']['name'] . "." . $setting_sub['db']['pre'];
}
switch ($method) {
    case "list":
        build_page($method);
        break;
    case "delete":
        $log_info = $setting['language']['admin_art_tag_delete'];
        $tag = $db->result($setting['db']['pre_sub'] . "news_tag", "tag", array("id", "n=", $id));
        $db->update($setting['db']['pre_sub'] . "news_show", array("tag" => ''), array("id", "n=", $id));
        $db->update($setting['db']['pre_sub'] . "news_show", array("tag" => "REPLACE(tag, '" . $tag . ",', '')"), array("tag", "like", $tag));
        $db->update($setting['db']['pre_sub'] . "news_show", array("tag" => "REPLACE(tag, '," . $tag . "', '')"), array("tag", "like", $tag));
        $db->delete($setting['db']['pre_sub'] . "news_tag", array("id", "n=", $id));
        break;
    case "rebuild":
        set_time_limit(0);
        $log_info = $setting['language']['admin_art_tag_rebuild'];
        $db_tmp = new MySQL();
        $db_tmp->init($setting['db']['host'], $setting['db']['user'], $setting['db']['pass'], $setting['db']['charset']);
        $db_tmp->Connect(false);
コード例 #6
0
ファイル: user_power.php プロジェクト: laiello/mystep-cms
            if ($method == "add_ok") {
                $db->exec("alter", "table", $setting['db']['pre'] . "user_type", "add", "`" . $_POST['idx'] . "` " . $theFormat);
                $db->update($setting['db']['pre'] . "user_type", array($_POST['idx'] => $_POST['value']));
            } else {
                if ($idx_org != $_POST['idx']) {
                    $db->Query("alter", "table", $setting['db']['pre'] . "user_type", "change", "`" . $idx_org . "` `" . $_POST['idx'] . "` " . $theFormat);
                } elseif ($format_org != $_POST['format']) {
                    $db->Query("alter", "table", $setting['db']['pre'] . "user_type", "modify", "`" . $_POST['idx'] . "` " . $theFormat);
                }
            }
            deleteCache("user_type");
            deleteCache("user_power");
        }
        break;
    default:
        build_page("list");
}
if (!empty($log_info)) {
    write_log($log_info, "power_id=" . $power_id);
    $goto_url = $setting['info']['self'];
}
$mystep->pageEnd(false);
function build_page($method)
{
    global $mystep, $req, $db, $tpl, $power_id, $tpl_info, $setting;
    $tpl_info['idx'] = "user_power_" . ($method == "list" ? "list" : "input");
    $tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info);
    $formatList = array('digital' => $setting['language']['checkform_item_digital'], 'date' => $setting['language']['checkform_item_date'], 'time' => $setting['language']['checkform_item_time']);
    if ($method == "list") {
        $db->select($setting['db']['pre'] . "user_power", "*", "", array("order" => "power_id"));
        while ($record = $db->GetRS()) {
コード例 #7
0
                $output .= '<div id="' . $id . '">' . $values['value'] . '</div>';
                break;
            case 'form':
                $output .= build_form($values['value']);
                break;
        }
    }
    return $output;
}
/**
 * Renders the page content based on a simple template.
 */
function theme_page($output, $title)
{
    return '
    <html>
      <head>
        <title>' . $title . '</title>
      </head>
      <body>
        ' . $output . '
      </body>
    </html>';
}
// Create an array for the contact form.
$contact_form = array('name' => array('title' => 'Name', 'type' => 'text', 'validations' => array('not_empty')), 'email' => array('title' => 'Email', 'type' => 'email', 'validations' => array('not_empty', 'is_valid_email')), 'comment' => array('title' => 'Comments', 'type' => 'textarea', 'validations' => array('not_empty')), 'submit' => array('title' => 'Submit me!', 'type' => 'submit'));
// Create an array for the page.
$page_elements = array('header' => array('type' => 'html', 'value' => '<p>Please submit this form. You will make my day if you do.</p>'), 'contact_form' => array('type' => 'form', 'value' => $contact_form));
// Render the page content.
$page_content = build_page($page_elements);
print theme_page($page_content, 'Contact us');
コード例 #8
0
ファイル: index.php プロジェクト: pixelhulk/LEPTON
                // Try and delete the directory
                if (rm_full_dir($relative_path . '/' . $filename)) {
                    $admin->print_success($MESSAGE['MEDIA_DELETED_DIR'], $backlink);
                } else {
                    $admin->print_error($MESSAGE['MEDIA_CANNOT_DELETE_DIR'], $backlink);
                }
            } elseif ($filetype == 'file') {
                // Try and delete the file
                if (unlink($relative_path . '/' . $filename)) {
                    $admin->print_success($MESSAGE['MEDIA_DELETED_FILE'], $backlink);
                } else {
                    $admin->print_error($MESSAGE['MEDIA_CANNOT_DELETE_FILE'], $backlink);
                }
            } else {
                $admin->print_error($MESSAGE['MEDIA_CANNOT_DELETE_FILE'], $backlink);
            }
            break;
    }
    // Parse template for preferences form
    $tpl->parse('main', 'main_wrapper_block', false);
    $tpl->parse('main', 'main_block', false);
    $output = $tpl->finish($tpl->parse('output', 'page'));
    return $output;
}
// test if valid $admin-object already exists (bit complicated about PHP4 Compatibility)
if (!(isset($admin) && is_object($admin) && get_class($admin) == 'admin')) {
    require_once LEPTON_PATH . '/framework/class.admin.php';
}
$admin = new admin('Media', 'media');
print build_page($admin, $database);
$admin->print_footer();
コード例 #9
0
ファイル: index.php プロジェクト: mlhorizon/collectd
                if (count($tinsts) > 1) {
                    array_unshift($tinsts, '@all');
                }
            }
        }
        return dhtml_response_list($tinsts, 'ListOfTypeInstance');
    case 'list_graphs':
        // Generate list of types for selected hosts, plugin and plugin-instance
        $arg_hosts = read_var('host', $_POST, '');
        if (is_array($arg_hosts)) {
            $arg_hosts = reset($arg_hosts);
        }
        $arg_plugin = read_var('plugin', $_POST, '');
        $arg_pinst = read_var('plugin_instance', $_POST, '');
        $arg_type = read_var('type', $_POST, '');
        $arg_tinst = read_var('type_instance', $_POST, '');
        $arg_log = (int) read_var('logarithmic', $_POST, '0');
        $arg_legend = (int) read_var('tinyLegend', $_POST, '0');
        $arg_period = read_var('timespan', $_POST, '');
        $graphs = collectd_list_graphs($arg_hosts, $arg_plugin, $arg_pinst, $arg_type, $arg_tinst);
        foreach ($graphs as &$graph) {
            $graph['logarithmic'] = $arg_log;
            $graph['tinyLegend'] = $arg_legend;
            $graph['timespan'] = $arg_period;
        }
        return dhtml_response_graphs($graphs, 'ListOfGraph');
    case 'overview':
    default:
        return build_page();
        break;
}
コード例 #10
0
ファイル: web_template.php プロジェクト: laiello/mystep-cms
            $log_info = $setting['language']['admin_web_template_edit'];
            if ($_POST['file_name'] == "style.css") {
                $the_file = ROOT_PATH . "/images/" . $idx . "/style.css";
            } else {
                $ext = GetFileExt($_POST['file_name']);
                if ($ext != "tpl") {
                    $_POST['file_name'] .= ".tpl";
                }
                $the_file = $tpl_path . $idx . "/" . $_POST['file_name'];
            }
            $_POST['file_content'] = str_replace("  ", "\t", $_POST['file_content']);
            WriteFile($the_file, $_POST['file_content'], "wb");
        }
        break;
    default:
        build_page("show");
}
if (!empty($log_info)) {
    write_log($log_info, "idx={$idx}");
    $goto_url = $setting['info']['self'];
    if (!empty($idx)) {
        $goto_url .= "?idx=" . $idx;
    }
}
$mystep->pageEnd(false);
function build_page($method = "")
{
    global $mystep, $req, $tpl, $tpl_info, $setting, $idx, $tpl_path, $method;
    $fso = $mystep->getInstance("MyFSO");
    $tpl_info['idx'] = "web_template";
    if ($method != "show") {
コード例 #11
0
    foreach ($TIME_FORMATS as $format => $title) {
        $format = str_replace('|', ' ', $format);
        // Add's white-spaces (not able to be stored in array key)
        $template->set_var('VALUE', $format != 'system_default' ? $format : 'system_default');
        $template->set_var('NAME', $title);
        if (TIME_FORMAT == $format && !isset($_SESSION['USE_DEFAULT_TIME_FORMAT']) || 'system_default' == $format && isset($_SESSION['USE_DEFAULT_TIME_FORMAT'])) {
            $template->set_var('SELECTED', ' selected="selected"');
        } else {
            $template->set_var('SELECTED', '');
        }
        $template->parse('time_format_list', 'time_format_list_block', true);
    }
    // assign systemvars to template
    $template->set_var(array('ADMIN_URL' => ADMIN_URL, 'WB_URL' => WB_URL, 'THEME_URL' => THEME_URL, 'ACTION_URL' => ADMIN_URL . '/preferences/save.php'));
    $template->set_var('FTAN', $admin->getFTAN());
    $template->set_var('FORM_NAME', 'preferences_save');
    // assign language vars
    $template->set_var(array('HEADING_MY_SETTINGS' => $HEADING['MY_SETTINGS'], 'HEADING_MY_EMAIL' => $HEADING['MY_EMAIL'], 'HEADING_MY_PASSWORD' => $HEADING['MY_PASSWORD'], 'TEXT_SAVE' => $TEXT['SAVE'], 'TEXT_RESET' => $TEXT['RESET'], 'TEXT_DISPLAY_NAME' => $TEXT['DISPLAY_NAME'], 'TEXT_USERNAME' => $TEXT['USERNAME'], 'TEXT_EMAIL' => $TEXT['EMAIL'], 'TEXT_LANGUAGE' => $TEXT['LANGUAGE'], 'TEXT_TIMEZONE' => $TEXT['TIMEZONE'], 'TEXT_DATE_FORMAT' => $TEXT['DATE_FORMAT'], 'TEXT_TIME_FORMAT' => $TEXT['TIME_FORMAT'], 'TEXT_CURRENT_PASSWORD' => $TEXT['CURRENT_PASSWORD'], 'TEXT_NEW_PASSWORD' => $TEXT['NEW_PASSWORD'], 'TEXT_RETYPE_NEW_PASSWORD' => $TEXT['RETYPE_NEW_PASSWORD'], 'TEXT_NEW_PASSWORD' => $TEXT['NEW_PASSWORD'], 'TEXT_RETYPE_NEW_PASSWORD' => $TEXT['RETYPE_NEW_PASSWORD'], 'TEXT_NEED_CURRENT_PASSWORD' => $TEXT['NEED_CURRENT_PASSWORD'], 'EMPTY_STRING' => ''));
    // Parse template for preferences form
    $template->parse('main', 'main_block', false);
    $output = $template->finish($template->parse('output', 'page'));
    return $output;
}
// test if valid $admin-object already exists (bit complicated about PHP4 Compatibility)
if (!(isset($admin) && is_object($admin) && get_class($admin) == 'admin')) {
    require '../../config.php';
    require_once WB_PATH . '/framework/class.admin.php';
    $admin = new admin('Preferences');
}
echo build_page($admin, $database);
$admin->print_footer();
コード例 #12
0
ファイル: attachment.php プロジェクト: laiello/mystep-cms
                } else {
                    $message[] = $upload->upload_result[$i]['name'] . " - " . $setting['language']['plugin_email_upload_failed'] . " - " . $upload->upload_result[$i]['message'];
                }
            }
            $message = implode("\\n", $message);
            if (!empty($message)) {
                $script = '
	alert("' . $message . '");
	setAttachment(' . toJson($files, $setting['gen']['charset']) . ');
';
            }
        }
        break;
    default:
        break;
}
build_page();
$mystep->pageEnd(false);
function build_page()
{
    global $mystep, $setting, $script;
    $tpl_info = array("idx" => "attachment", "style" => "../plugin/" . basename(realpath(dirname(__FILE__))) . "/tpl/", "path" => ROOT_PATH . "/" . $setting['path']['template']);
    $tpl = $mystep->getInstance("MyTpl", $tpl_info);
    $Max_size = ini_get('upload_max_filesize');
    $tpl->Set_Variable('script', $script);
    $tpl->Set_Variable('Max_size', $Max_size);
    $tpl->Set_Variable('MaxSize', GetFileSize($Max_size));
    $tpl->Set_Variable('path_admin', $setting['path']['admin']);
    $mystep->show($tpl);
    return;
}
コード例 #13
0
<?php

// Content
global $files;
function build_page($array)
{
    $count_sections = 0;
    foreach ($array as $item) {
        $count_sections++;
        $image_location = 'images/' . $item;
        list($width, $height, $type, $attr) = getimagesize($image_location);
        echo '<div style="height:' . $height . 'px;background-image:url(' . $image_location . ');" class="screen" id="section-' . $count_sections . '"></div>';
    }
}
?>

<?php 
build_page($files);
?>

コード例 #14
0
ファイル: news_snatch.php プロジェクト: laiello/mystep-cms
         $path_upload = $setting['path']['upload'] . "/tmp/" . date("Ym") . "/";
         $upload = new MyUploader();
         $upload->init(ROOT_PATH . "/" . $path_upload, true);
         $upload->DoIt(false);
         if ($upload->upload_result[0]['error'] == 0) {
             $theFile = ROOT_PATH . "/" . $path_upload . "/" . $upload->upload_result[0]['new_name'];
             $code = toJson(unserialize(base64_decode(file_get_contents($theFile))), $setting['gen']['charset']);
             $script = "\r\n\t\t\t\t\tvar theOLE = null;\r\n\t\t\t\t\ttheOLE = parent.parent || parent.dialogArguments || parent.opener;\r\n\t\t\t\t\ttheOLE.newRule = {$code};\r\n\t\t\t\t\ttheOLE.importRule();\r\n\t\t\t\t\tif(parent.parent==null){parent.close();}else{parent.parent.\$.closePopupLayer();}\r\n\t\t\t\t\t\r\n\t\t\t\t";
             $script = str_replace("<!-- pagebreak -->", "<pagebreak>", $script);
             unlink($theFile);
         } else {
             $script = "\r\n\t\t\t\t\talert('" . $upload->upload_result[0]['message'] . "');\r\n\t\t\t\t\tif(parent.parent==null){parent.close();}else{parent.parent.\$.closePopupLayer();}\r\n\t\t\t\t";
         }
         unset($upload);
     }
     build_page("upload");
     break;
 case "rule_export":
     $log_info = $setting['language']['plugin_news_snatch_export'];
     $cur_rule = $rules[$id];
     $cur_rule['para'] = var_export($cur_rule['para'], true);
     $cur_rule['rule_snatch'] = GetFile("rule/" . $cur_rule['idx'] . "_snatch.php");
     $cur_rule['rule_import'] = GetFile("rule/" . $cur_rule['idx'] . "_import.php");
     $content = chunk_split(base64_encode(serialize($cur_rule)));
     if (ob_get_length()) {
         ob_end_clean();
     }
     header("Content-type: text/plain");
     header("Accept-Ranges: bytes");
     header("Accept-Length: " . strlen($content));
     header("Content-Disposition: attachment; filename=" . $cur_rule['name'] . ".rule");
コード例 #15
0
ファイル: custom_form.php プロジェクト: laiello/mystep-cms
                     $record[$key] = trim($data[$n++]);
                 }
                 if (isset($data[$n])) {
                     $record['mailed'] = trim($data[$n++]);
                 }
                 if (isset($data[$n]) && strlen($data[$n]) > 10) {
                     $record['add_date'] = trim($data[$n]);
                 }
                 $db->replace($setting['db']['pre'] . "custom_form_" . $mid, $record);
                 unset($record);
             }
             fclose($fp);
         }
         unset($upload);
     }
     build_page("list_data");
     break;
 case "add_data_ok":
     if (!empty($_GET['name'])) {
         $log_info = "添加表单数据";
         if (function_exists("ext_func")) {
             ext_func();
         }
         $db->insert($setting['db']['pre'] . "custom_form_" . $mid, array("id" => 0, "name" => $_GET['name'], "add_date" => "curdate()"));
         $id = $db->getInsertID();
         $goto_url = $setting['info']['self'] . "?method=edit&mid={$mid}&id=" . $id;
     }
     break;
 case "edit_data_ok":
     $log_info = "编辑表单数据";
     $keyword = $_POST['keyword'];
コード例 #16
0
ファイル: index.php プロジェクト: Hassanj343/candidats
}
/* Do a handy work hook. This is a good way for plugins to get access to the completed
   data for a page request before the XHTML is built. */
do_work_hook('page_end');
/* Build the XHTML and sent it to the browser 
----------------------------------------------------------------*/
/* Setup template data. The code is broken out into multiple includes to keep
   the application memory footprint smaller. */
if ($user->sub_class_names['url']) {
    $class_name = 'site_page_' . $user->sub_class_names['url'];
    $pd = hm_new($class_name);
} else {
    $pd = hm_new('site_page');
}
/* Build the page XHTML. The resulting page is constructed but not sent to the browser yet */
build_page($pd);
/* Filter the output XHTML for the current display mode, and send it to the browser */
output_filtered_content($hm_tags);
/* IMAP debug. Outputs debug information below the page if the show_imap_debug setting
   is enabled in the hastymail2.conf file. */
if (isset($conf['show_imap_debug']) && $conf['show_imap_debug']) {
    if (isset($conf['show_full_debug']) && $conf['show_full_debug']) {
        $imap->puke(true);
    } else {
        $imap->puke();
    }
}
/* SMTP debug. Outputs debug information about any SMTP operations performed */
if (isset($conf['show_smtp_debug']) && $conf['show_smtp_debug']) {
    if (is_object($smtp)) {
        $smtp->puke();