Exemplo n.º 1
0
function convert()
{
    if (Convert::isConverted('wiki')) {
        return dgettext('wiki', 'Wiki pages have already been converted.');
    }
    if (!defined('OLD_WIKI_IMAGES')) {
        return dgettext('wiki', 'OLD_WIKI_IMAGES in Wiki conversion script needs to be set BEFORE continuing.');
    }
    $mod_list = PHPWS_Core::installModList();
    if (!in_array('wiki', $mod_list)) {
        return dgettext('wiki', 'Wiki module is not installed.');
    }
    if (!isset($_SESSION['wiki_convert_step'])) {
        $_SESSION['wiki_convert_step'] = 1;
    }
    switch ($_SESSION['wiki_convert_step']) {
        case 1:
            return step1();
            break;
        case 2:
            return step2();
            break;
        case 3:
            return step3();
            break;
    }
}
Exemplo n.º 2
0
function callstep($step, $data = array())
{
    switch ($step) {
        case 5:
            return step5($data);
        case 4:
            return step4($data);
        case 3:
            return step3($data);
        case 2:
            return step2($data);
        default:
            return step1($data);
    }
}
Exemplo n.º 3
0
function step($step)
{
    switch ($step) {
        case 1:
            step1();
            break;
        case 2:
            step2();
            break;
        case 3:
            step3();
            break;
        default:
            noStep();
    }
}
Exemplo n.º 4
0
if ($user->AsSquidAdministrator == false) {
    $tpl = new templates();
    echo "alert('" . $tpl->javascript_parse_text("{ERROR_NO_PRIVS}") . "');";
    die;
    exit;
}
if (isset($_GET["popup"])) {
    popup();
    exit;
}
if (isset($_GET["step1"])) {
    step1();
    exit;
}
if (isset($_GET["step2"])) {
    step2();
    exit;
}
if (isset($_GET["step3"])) {
    step3();
    exit;
}
js();
function js()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $page = CurrentPageName();
    $title = $tpl->_ENGINE_parse_body("{build_support_package}");
    $html = "RTMMail('550','{$page}?popup=yes','{$title}');";
    echo $html;
     break;
 case "Etape_0":
     // choice ok , go check system
     checkConfigFile();
     //TRANS %s is step number
     header_html(sprintf(__('Step %d'), 0));
     $_SESSION["Test_session_GLPI"] = 1;
     step1($_POST["update"]);
     break;
 case "Etape_1":
     // check ok, go import mysql settings.
     checkConfigFile();
     // check system ok, we can use specific parameters for debug
     Toolbox::setDebugMode(Session::DEBUG_MODE, 0, 0, 1);
     header_html(sprintf(__('Step %d'), 1));
     step2($_POST["update"]);
     break;
 case "Etape_2":
     // mysql settings ok, go test mysql settings and select database.
     checkConfigFile();
     header_html(sprintf(__('Step %d'), 2));
     step3($_POST["db_host"], $_POST["db_user"], $_POST["db_pass"], $_POST["update"]);
     break;
 case "Etape_3":
     // Create and fill database
     checkConfigFile();
     header_html(sprintf(__('Step %d'), 3));
     if (empty($_POST["databasename"])) {
         $_POST["databasename"] = "";
     }
     if (empty($_POST["newdatabasename"])) {
function step1()
{
    global $_CONFIG;
    $ftarget = $_CONFIG[output_path] . "/" . $_REQUEST[ver];
    if ($_REQUEST['refresh'] < 1) {
        if (!is_writable($_CONFIG[output_path])) {
            echo "<span class='error'>Directory " . $_CONFIG[output_path] . " is not writeable or does not exists! Could not continue...</span>";
            return;
        }
    }
    $ftarget = $_REQUEST[ver];
    if (!file_exists($ftarget) and !$_REQUEST['files_skip']) {
        echo "<span class='error'>Could not continue, unable to read the clone backup file! Please make sure you copied the backup in the same directory as XCloner.php </span>";
        return;
    }
    step2($ftarget);
    return;
}
include_once(dirname(__FILE__) . "/ressources/class.sockets.inc");
include_once(dirname(__FILE__) . "/ressources/class.pdns.inc");
include_once(dirname(__FILE__) . '/ressources/class.system.network.inc');
include_once(dirname(__FILE__) . '/ressources/class.squid.inc');


$user=new usersMenus();
if($user->AsSquidAdministrator==false){
	$tpl=new templates();
	echo "alert('".$tpl->javascript_parse_text("{ERROR_NO_PRIVS}")."');";
	die();
}

if(isset($_GET["popup"])){popup();exit;}
if(isset($_GET["step1"])){step1();exit;}
if(isset($_GET["step2"])){step2();exit;}
if(isset($_POST["rulename"])){Save();exit;}
if(isset($_POST["html"])){SaveMysql();exit;}



js();

function js(){
	header("content-type: application/x-javascript");
	$tpl=new templates();
	$page=CurrentPageName();
	$t=time();
	$tpl=new templates();
	$title=$tpl->javascript_parse_text("Hyper Cache: {new_rule}");
	
/**
 * Stems a word. Simple huh?
 *
 * @param  string $word Word to stem
 * @return string       Stemmed word
 */
function stem($word)
{
    if (strlen($word) <= 2) {
        return $word;
    }
    $word = step1ab($word);
    $word = step1c($word);
    $word = step2($word);
    $word = step3($word);
    $word = step4($word);
    $word = step5($word);
    return $word;
}
Exemplo n.º 9
0
$template->set_template_file(VIVVO_FS_ROOT . 'installer/templates/frame.xml');
$installer_lang = $sm->get_lang();
if (isset($_POST['installer_lang'])) {
    setcookie('installer_lang', $_POST['installer_lang']);
    $_COOKIE['installer_lang'] = $_POST['installer_lang'];
}
if (isset($_COOKIE['installer_lang'])) {
    $installer_lang->load_lang($_COOKIE['installer_lang'], 'installer/lang/', 'installer');
} else {
    $installer_lang->load_lang($_COOKIE['installer_lang'] = 'vietnamese', 'installer/lang/', 'installer');
}
define('VIVVO_INSTALLER_LANG', $_COOKIE['installer_lang']);
$um = $sm->get_url_manager();
$lang = $sm->get_lang();
if ($um->get_param('step') == 2) {
    step2($template, $dm, $lang);
} elseif ($um->get_param('step') == 3) {
    step3($template, $dm, $lang);
} elseif ($um->get_param('step') == 4) {
    step4($template, $dm, $lang);
} elseif ($um->get_param('step') == 5) {
    step5($template, $dm, $lang);
} elseif ($um->get_param('step') == 6) {
    step6($template, $dm, $lang);
    vivvo_cache::get_instance()->delete_all();
} else {
    step1($template, $dm, $lang);
}
$template->assign('DUMP_MESSAGES', $dm->_dump_pool);
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' . "\n";
echo $sm->get_output();
Exemplo n.º 10
0
function step3()
{
    $app = $_REQUEST['app'];
    if (strstr($app['domain'], '/')) {
        step2('只能填写域名,不能带有/');
    }
    if (!in_array($app['php_run_type'], array('tcp', 'socket'))) {
        step2('php运行方式只能是tcp或者socket');
    }
    $php_socket_path = trim($app['php_socket_path']);
    if (!$php_socket_path) {
        $php_socket_path = '/dev/shm/php-cgi.sock';
    }
    $app['port'] = 6233;
    $socket = new hgSocket();
    $con = $socket->connect($app['ip'], $app['port']);
    if (!intval($con)) {
        step2('服务器无法连接,请确认服务器ip是否正确或服务程序hogeMonitor.py是否监听在' . $app['ip'] . ':' . $app['port'] . '上');
    }
    $socket->close();
    $app['dir'] = str_replace('//', '/', $app['dir']);
    $app_dir = trim($app['dir'], '/');
    if (count(explode('/', $app_dir)) < 3) {
        step2('安装目录必须达到3级及以上');
    }
    $app['dir'] = '/' . $app_dir . '/';
    //print_r($_SERVER);
    //增加hosts
    ob_start();
    $hostscontent = get_serv_file($app, '/etc/hosts');
    $hosts = hg_get_hosts($hostscontent);
    if (!$hosts[$app['domain']]) {
        hg_flushMsg('开始修改服务器hosts');
        $hostscontent .= "\n" . $app['ip'] . '	' . $app['domain'];
        write_serv_file($app, '/etc/hosts', $hostscontent);
        hg_flushMsg('hosts配置完成');
    }
    //配置nginx
    if ($app['server_software'] == 'nginx') {
        hg_flushMsg('开始修改服务器nginx配置');
        $content = get_serv_file($app, '/usr/local/nginx/conf/nginx.conf');
        if ($app['php_run_type'] == 'socket') {
            $fastcgi_pass = '******' . $php_socket_path . ';';
        } else {
            $fastcgi_pass = '******';
        }
        $runtype = '
			root          $htdocs;' . $fastcgi_pass . '
			fastcgi_index  index.php;
			include        fastcgi_params;
		';
        if (!@preg_match('/server_name\\s+' . $app['domain'] . '/is', $content)) {
            $serv_content = 'server {
				set $htdocs ' . $app['dir'] . ';
				listen       80;
				server_name  ' . $app['domain'] . ';

				#charset koi8-r;

				#access_log  logs/host.access.log  main;

				location / {
					root   $htdocs;
					index  index.html index.htm index.php;
				}
				location ~ .*\\.php?$ {' . $runtype . '}
			}';
            $content = preg_replace("/(http[\\s\n]*\\{.*)\\}/is", '\\1' . $serv_content . '}', $content);
            write_serv_file($app, '/usr/local/nginx/conf/nginx.conf', $content);
            hg_run_cmd($app, 'restart', '/usr/local/nginx/sbin/nginx -s reload');
            hg_flushMsg('nginx配置完成');
        }
    }
    //下载程序
    global $Cfg;
    $curl = new curl($Cfg['upgradeServer']['host'] . ':' . $Cfg['upgradeServer']['port'], '', $Cfg['upgradeServer']['token']);
    $curl->setClient(CUSTOM_APPID, CUSTOM_APPKEY);
    $curl->setSubmitType('get');
    $curl->setReturnFormat('json');
    $curl->initPostData();
    $curl->addRequestData('install', 1);
    $curl->addRequestData('app', 'livworkbench');
    $program_url = $curl->request('check_version.php');
    if (!(strstr($program_url, 'http://') && strstr($program_url, '.zip')) || $program_url == 'NO_VERSION') {
        $message = '获取应用程序失败或程序版本不存在.';
    }
    hg_flushMsg('开始下载程序');
    hg_run_cmd($app, 'mkdirs', $app['dir']);
    hg_run_cmd($app, 'download', $program_url, $app['dir']);
    hg_run_cmd($app, 'mkdirs', $app['dir'] . 'cache');
    file_put_contents(CACHE_DIR . 'app.tmp', json_encode($app));
    hg_flushMsg('程序下载完毕');
    hg_redirect('?action=step4');
}
Exemplo n.º 11
0
 case 'checkZIP':
     $zip = $_REQUEST['zip'];
     checkZIP($zip);
     break;
 case 'step1':
     $gender = $_REQUEST['gender'];
     $birthday = $_REQUEST['birthday'];
     $country = $_REQUEST['country'];
     $zip = $_REQUEST['zip'];
     step1($gender, $birthday, $country, $zip);
     break;
 case 'step2':
     $feet = $_REQUEST['feet'];
     $inches = $_REQUEST['inches'];
     $pounds = $_REQUEST['pounds'];
     step2($feet, $inches, $pounds);
     break;
 case 'imgUpload':
     $imgType = $_REQUEST['imgType'];
     $imgData = $_REQUEST['imgData'];
     imgUpload($imgType, $imgData);
     break;
 case 'startDiet':
     $currentWeight = $_REQUEST['currentWeight'];
     $targetWeight = $_REQUEST['targetWeight'];
     $targetDate = $_REQUEST['targetDate'];
     startDiet($currentWeight, $targetWeight, $targetDate);
     break;
 case 'updateWeight':
     $weight = $_REQUEST['weight'];
     updateWeight($weight);
Exemplo n.º 12
0
function manage_surveys()
{
    global $table_prefix, $wpdb;
    $survey_table = $table_prefix . "surveys";
    if (isset($_REQUEST["wpsurv_submit"])) {
        require_once 'functions.php';
        if ($_POST["wpsurv_submit"] == __('Edit', 'wp-surveys') || $_POST["wpsurv_submit"] == __('Cancel', 'wp-surveys') || $_POST["wpsurv_submit"] == __('Back to Edit Survey', 'wp-surveys')) {
            edit($_POST['survey_id']);
        } elseif ($_POST["wpsurv_submit"] == __('Update', 'wp-surveys')) {
            update($_POST['survey_id']);
        } elseif ($_POST["wpsurv_submit"] == __('Update Options', 'wp-surveys')) {
            update_options($_POST['survey_id'], $_POST['question_id']);
        } elseif ($_POST["wpsurv_submit"] == __('Activate', 'wp-surveys') || $_POST["wpsurv_submit"] == __('Make Active', 'wp-surveys')) {
            activate($_POST['survey_id']);
        } elseif ($_POST["wpsurv_submit"] == __('Retire', 'wp-surveys')) {
            retire($_POST['survey_id']);
        } elseif ($_POST["wpsurv_submit"] == __('Update Leaderboard', 'wp-surveys')) {
            recach_utility($_POST['survey_id']);
        } elseif ($_POST["wpsurv_submit"] == __('Edit Options', 'wp-surveys') || $_POST["wpsurv_submit"] == __('Add Some Options', 'wp-surveys') || $_POST["wpsurv_submit"] == __('Edit or Add more Options', 'wp-surveys')) {
            edit_options($_POST['survey_id'], $_POST['question_id']);
        } elseif ($_POST["wpsurv_submit"] == __('Add More Questions', 'wp-surveys') || $_POST["wpsurv_submit"] == __('Add Some Questions', 'wp-surveys')) {
            add_question($_POST['survey_id']);
        } elseif ($_POST["wpsurv_submit"] == __('Step 2', 'wp-surveys')) {
            step2($_POST['survey_id']);
        } elseif ($_POST["wpsurv_submit"] == __('Create Question', 'wp-surveys')) {
            create_quest($_POST['survey_id']);
        } elseif ($_POST["wpsurv_submit"] == __('Change Survey', 'wp-surveys') || $_POST["wpsurv_submit"] == __('Add Survey', 'wp-surveys')) {
            survey($_POST['survey_id']);
        } elseif ($_POST["wpsurv_submit"] == __('Add This Survey', 'wp-surveys')) {
            add_survey($_POST['survey_id']);
        } elseif ($_POST["wpsurv_submit"] == __('View Survey Results', 'wp-surveys')) {
            results($_POST['survey_id']);
        }
        //elseif($_POST["wpsurv_submit"] == __('View Survey Results in CSV File', 'wp-surveys'))
        //results_CSV($_POST['survey_id']);
        //elseif($_POST["wpsurv_submit"] == __('Delete File', 'wp-surveys'))
        //delete_file($_POST['survey_id']);
    } else {
        $current_plugins = get_option('active_plugins');
        if (file_exists(ABSPATH . PLUGINDIR . '/polyglot.php') && in_array('polyglot.php', $current_plugins)) {
            $polyglot = true;
        }
        echo '<div class="wrap">';
        $open_surveys = $wpdb->get_results("SELECT * FROM `" . $survey_table . "` WHERE `survey_open`='1' LIMIT 1;", ARRAY_A);
        echo '<h2>' . __('Survey Management', 'wp-surveys') . '</h2><h3><u>' . __('Active Survey', 'wp-surveys') . '</u>:</h3>';
        if ($open_surveys) {
            echo '<table class="widefat" width="100%" cellpadding="4" cellspacing="4">';
            echo '<tr><th align="left">' . __('Title', 'wp-surveys') . '</th><th align="left">' . __('Description', 'wp-surveys') . '</th><th></th><th></th><th></th></tr>';
            foreach ($open_surveys as $survey) {
                echo '<tr class="alternate">';
                if ($polyglot) {
                    echo '<td><b>' . polyglot_filter(stripcslashes($survey['survey_name'])) . '</b></td><td>' . polyglot_filter(stripcslashes($survey['survey_describe'])) . '</td>';
                } elseif (!$polyglot) {
                    echo '<td><b>' . stripcslashes($survey['survey_name']) . '</b></td><td>' . stripcslashes($survey['survey_describe']) . '</td>';
                }
                echo '<td class="submit" align="center"><form method="post" action=""><input type="hidden" name="survey_id" value="' . $survey['survey_id'] . '" />';
                echo '<input type="submit" name="wpsurv_submit" value="' . __('Edit', 'wp-surveys') . '" /></form></td>';
                echo '<td class="submit" align="center"><form method="post" action=""><input type="hidden" name="survey_id" value="' . $survey['survey_id'] . '" />';
                echo '<input type="submit" name="wpsurv_submit" value="' . __('Retire', 'wp-surveys') . '" /></form></td>';
                echo '<td class="submit" align="center"><form method="post" action=""><input type="hidden" name="survey_id" value="' . $survey['survey_id'] . '" />';
                echo '<input type="submit" name="wpsurv_submit" value="' . __('View Survey Results', 'wp-surveys') . '" /></form></td>';
                //echo '<td align="center"><form method="post" action=""><input type="hidden" name="survey_id" value="'.$survey['survey_id'].'" />';
                //echo '<input type="submit" name="wpsurv_submit" value="'.__('View Survey Results in CSV File', 'wp-surveys').'" /></form></td>';
                echo '</tr>';
            }
            echo '</table>';
            $next = ++$survey['survey_id'];
            echo '<br /><form method="post" action=""><input type="hidden" name="survey_id" value="' . $next . '" /><input class="button" type="submit" name="wpsurv_submit" value="' . __('Change Survey', 'wp-surveys') . '" title="' . __('Current Survey will be saved as Retired', 'wp-surveys') . '" /></form>';
        } else {
            echo __('There are no open tournaments or contests.', 'wp-surveys') . '.';
            //$last = $wpdb->get_var("SELECT COUNT(`survey_id`) FROM `".$survey_table."`;");
            $last = $wpdb->get_var("SELECT `survey_id` FROM `" . $survey_table . "` ORDER BY `survey_id` DESC LIMIT 1;");
            $next = ++$last;
            echo '<br /><br /><form method="post" action=""><input type="hidden" name="survey_id" value="' . $next . '" /><input class="button" type="submit" name="wpsurv_submit" value="' . __('Add Survey', 'wp-surveys') . '" /></form>';
        }
        $closed_surveys = $wpdb->get_results("SELECT * FROM `" . $survey_table . "` WHERE `survey_open`='0';", ARRAY_A);
        echo '<h3><u>' . __('Retired Surveys', 'wp-surveys') . '</u>:</h3>';
        if ($closed_surveys) {
            echo '<table class="widefat" width="100%" cellpadding="4" cellspacing="4">';
            echo '<tr><th align="left">' . __('Title', 'wp-surveys') . '</th><th align="left">' . __('Description', 'wp-surveys') . '</th><th></th><th></th><th></th></tr>';
            foreach ($closed_surveys as $survey) {
                echo '<tr class="alternate">';
                if ($polyglot) {
                    echo '<td><b>' . polyglot_filter(stripcslashes($survey['survey_name'])) . '</b></td><td>' . polyglot_filter(stripcslashes($survey['survey_describe'])) . '</td>';
                } elseif (!$polyglot) {
                    echo '<td><b>' . stripcslashes($survey['survey_name']) . '</b></td><td>' . stripcslashes($survey['survey_describe']) . '</td>';
                }
                echo '<td class="submit" align="center"><form method="post" action=""><input type="hidden" name="survey_id" value="' . $survey['survey_id'] . '" />';
                echo '<input type="submit" name="wpsurv_submit" value="' . __('Edit', 'wp-surveys') . '" /></form></td>';
                echo '<td class="submit" align="center"><form method="post" action=""><input type="hidden" name="survey_id" value="' . $survey['survey_id'] . '" />';
                echo '<input type="submit" name="wpsurv_submit" value="' . __('Make Active', 'wp-surveys') . '" /></form></td>';
                echo '<td class="submit" align="center"><form method="post" action=""><input type="hidden" name="survey_id" value="' . $survey['survey_id'] . '" />';
                echo '<input type="submit" name="wpsurv_submit" value="' . __('View Survey Results', 'wp-surveys') . '" /></form></td>';
                //echo '<td align="center"><form method="post" action=""><input type="hidden" name="survey_id" value="'.$survey['survey_id'].'" />';
                //echo '<input type="submit" name="wpsurv_submit" value="'.__('View Survey Results in CSV File', 'wp-surveys').'" /></form></td>';
                echo '</tr>';
            }
            echo '</table>';
        } else {
            echo __('There are no retired surveys', 'wp-surveys') . '.';
        }
        echo '</div>';
    }
}