Exemple #1
0
 function register()
 {
     $this->load->library('validation');
     $rules = array('first_name' => 'required|alpha_dash', 'last_name' => ($this->settings->item('require_lastname') ? 'required' : '') . 'alpha_dash', 'password' => 'required|min_length[6]|max_length[20]', 'confirm_password' => 'required|matches[password]', 'email' => 'required|valid_email', 'confirm_email' => 'required|valid_email|matches[email]');
     $this->validation->set_rules($rules);
     $this->validation->set_fields();
     $email = $this->input->post('email');
     $password = $this->input->post('password');
     if ($this->validation->run()) {
         // Try and create the user
         if ($id = $this->user_lib->create($email, $password)) {
             // Now they have been created, does the admin want activation emails to be sent out?
             if ($this->settings->item('activation_email') == 1) {
                 // They do? Ok, send out an email to the user
                 if ($this->user_lib->registered_email($this->user_lib->user_data)) {
                     $this->session->set_flashdata(array('notice' => $this->lang->line('user_activation_code_sent_notice')));
                     redirect('users/activate/' . $id);
                 }
                 // or should we let the admin manually activate them?
             } else {
                 $this->session->set_flashdata(array('notice' => $this->lang - line('user_activation_by_admin_notice')));
                 redirect('');
             }
             // Can't create the user, show why
         } else {
             $this->data->error_string = $this->lang->line($this->user_lib->error_code);
         }
     } else {
         // Return the validation error message or user_lib error
         $this->data->error_string = $this->validation->error_string;
     }
     $this->layout->title($this->lang->line('user_register_title'));
     $this->layout->create('register', $this->data);
 }
Exemple #2
0
function debug_lexer($lexer)
{
    $fmt = str_repeat('%-30s', 4);
    line(sprintf($fmt, "In type", "In value", "Out type", "Out value"));
    line(sprintf($fmt, "-------", "--------", "--------", "---------"));
    foreach ($lexer->debug as $row) {
        line(sprintf($fmt, $row['in_type'], str_replace("\n", '\\n', "'" . $row['in_value'] . "'"), $row['out_type'], "'" . $row['out_value'] . "'"));
    }
}
function send_response($d1, $d2)
{
    echo line("{");
    // Start
    echo line(' 	"date1": "' . $d1 . '",');
    echo line(' 	"date2": "' . $d2 . '"');
    echo line("}");
    // end
}
function send_response($temp1, $temp2, $temp3, $temp4)
{
    echo line("{");
    // Start
    echo line(' 	"temp1": "' . $temp1 . '",');
    echo line(' 	"temp2": "' . $temp2 . '",');
    echo line(' 	"temp3": "' . $temp3 . '",');
    echo line(' 	"temp4": "' . $temp4 . '"');
    echo line("}");
    // end
}
Exemple #5
0
function generate_xml($post, $path)
{
    $structure_txt = file_get_contents($path, true);
    if ($structure_txt == False) {
        echo "{$path} is not readable. Try changing the permission of the destination folder and {$path} to 777 if it exists.";
        exit;
    }
    $lines = explode("\n", $structure_txt);
    $i = 0;
    $return_value = "";
    foreach ($lines as $line) {
        if ($line != "" and $line != " " and $line[0] != '#') {
            if (preg_match_all('#\\<[^,]+\\>#', $line, $arr, PREG_PATTERN_ORDER)) {
                $return_value .= line(trim($arr[0][0]));
            } else {
                if (preg_match_all('#([^(), <>]+)\\(([^()]+)\\)#', $line, $arr, PREG_SET_ORDER)) {
                    $tag = sanitize(trim($arr[0][1]));
                    $items = explode_and_trim(',', $arr[0][2]);
                    $i++;
                    $content = line("<{$tag}>");
                    $show = false;
                    foreach ($items as $var) {
                        $var = sanitize($var);
                        $var_name = $tag . "_" . $var;
                        $var_name = preg_replace('/\\./', '_', $var_name);
                        if (isset($post[$var_name]) and $post[$var_name] != "") {
                            $inside = sanitize($post[$var_name]);
                            $content .= line("<{$var}>{$inside}</{$var}>");
                            $show = true;
                        }
                    }
                    $content .= line("</{$tag}>");
                    if ($show == true) {
                        $return_value .= $content;
                    }
                }
            }
        }
    }
    return $return_value;
}
Exemple #6
0
 public function menu()
 {
     $id = $this->uri->segment(3);
     $id = $id !== false ? $id : message($this->lang > line('error'), 'system/menuGroup');
     $this->load->helper(array('form'));
     $data = $this->common->setConfig($this->common->configs, array('global.css'), array($this->common->js, 'validateMyForm/jquery.validateMyForm.1.0.js', 'global.js'));
     $data['form'] = form_open('system/menuSave', array('id' => 'form1'));
     $this->db->where('menu_id', $id);
     $db = clone $this->db;
     $query = $this->db->get('menu_rights');
     $total = $query->num_rows();
     $url = base_url(index_page() . '/system/menu/' . $id . '/');
     $this->load->library('pagination');
     $config = $this->common->pageConfig($url, $total, 14, 4);
     $this->pagination->initialize($config);
     $this->db = $db;
     $this->db->from('menu_rights');
     $this->db->order_by('paixun', 'asc');
     $this->db->limit($config['per_page'], $this->uri->segment($config['uri_segment'], 0));
     $menu = $this->db->get();
     $data['menu'] = $menu->result_array();
     $data['id'] = $id;
     $this->load->view('head', $data);
     $this->load->view('system_menu');
     $this->load->view('foot');
 }
Exemple #7
0
$dir->close();
line("CLEANED TMP DIR");
debug("cleaning", "cacheDir");
$clearTime = time() - 60 * 60;
$dir = dir($config['cacheDir']);
while ($entry = $dir->read()) {
    if ($entry == "." || $entry == "..") {
        continue;
    }
    $file = $config['cacheDir'] . "/{$entry}";
    if (is_dir($file)) {
        continue;
    }
    if (filemtime($file) < $clearTime) {
        if (!unlink($file)) {
            logError("could not delete: {$file}");
        }
    }
}
$dir->close();
line("CLEANED CACHE DIR");
// TODO update subject tree language availability
// TODO remove old sotf_delete objects
// ******** Stop old streams
$playlist = new sotf_Playlist();
$playlist->stopOldStreams();
line("CRON FINISHED");
stopTiming();
$page->logRequest();
debug("--------------- CRON FINISHED -----------------------------------");
//echo "<h4>Cron.php completed</h4>";
   line("Ports will regenerate every",$schedule_info[ticks_full] ." minutes&nbsp;");
   $res=$db->Execute("SELECT ticks_full FROM $dbtables[scheduler] WHERE file = 'sched_tow.php' LIMIT 1");
   $schedule_info = $res->fields;
   line("Ships will be towed from fed sectors every",$schedule_info[ticks_full] ." minutes&nbsp;");
   $res=$db->Execute("SELECT ticks_full FROM $dbtables[scheduler] WHERE file = 'sched_ranking.php' LIMIT 1");
   $schedule_info = $res->fields;
   line("Rankings will be generated every",$schedule_info[ticks_full] ." minutes&nbsp;");
   $res=$db->Execute("SELECT ticks_full FROM $dbtables[scheduler] WHERE file = 'sched_degrade.php' LIMIT 1");
   $schedule_info = $res->fields;
   line("Sector Defences will degrade every",$schedule_info[ticks_full] ." minutes&nbsp;");
   $res=$db->Execute("SELECT ticks_full FROM $dbtables[scheduler] WHERE file = 'sched_apocalypse.php' LIMIT 1");
   $schedule_info = $res->fields;
   line("The planetary apocalypse will occur every&nbsp;",$schedule_info[ticks_full] ." minutes&nbsp;");
   $res=$db->Execute("SELECT ticks_full FROM $dbtables[scheduler] WHERE file = 'sched_mooring.php' LIMIT 1");
   $schedule_info = $res->fields;
   line("Mooring fees will be charged every&nbsp;",$schedule_info[ticks_full] ." minutes&nbsp;");
  echo "</TABLE>";


echo "<BR><BR>";

if(empty($username))
{
  TEXT_GOTOLOGIN();
}
else
{
  TEXT_GOTOMAIN();
}

include("footer.php");
Exemple #9
0
<?
require_once 'library/query/query.php';
function line($lineFeededString)
{
	$el = "</line>"; $sl = "<line>";
	return $sl.implode("$el$sl", explode("\n", $lineFeededString)).$el;
}
$name = Query::getName();
$headline = Query::getGenre();
$presentation = line(Query::getInterests());
$membres = "";
$array = array_reverse(Query::getMembres());
foreach($array as $membre)
	$membres .= "<membre name=\"{$membre[0]}\" image=\"{$membre[1]}\"/>";
?>
Exemple #10
0
        $ftp = "OK";
    }
    line($TEXT['status-ftp'], $ftp);
}
if (file_exists("{$partwampp}\\tomcat\\conf\\server.xml")) {
    if (false === @fsockopen($ip, 8080)) {
        $tomcat = "NOK";
    } else {
        $tomcat = "OK";
    }
    line($TEXT['status-tomcat'], $tomcat);
}
if (file_exists("{$partwampp}\\apache\\bin\\python.exe")) {
    $a = @file("http://{$hostauth}{$host}/xampp/python.py");
    $python = $a[0];
    line($TEXT['status-python'], $python);
}
echo "<tr valign='bottom'>";
echo "<td bgcolor='#fb7922'></td>";
echo "<td bgcolor='#fb7922' colspan='3'><img src='img/blank.gif' alt='' width='1' height='8'></td>";
echo "<td bgcolor='#fb7922'></td>";
echo "</tr>";
echo "</table>";
?>

        <p><?php 
echo $TEXT['status-text2'];
?>
</p>

    </body>
Exemple #11
0
        echo "<tr bgcolor='#ffffff'><td></td><td colspan='1' class='small'>{$info}<br><img src='img/blank.gif' alt='' width='10' height='10' border='0'></td><td></td><td></td></tr>";
    }
    $i++;
}
echo "<table border='0' cellpadding='0' cellspacing='0'>";
echo "<tr valign='top'>";
echo "<td bgcolor='#fb7922' valign='top'><img src='img/blank.gif' alt='' width='10' height='0'></td>";
echo "<td bgcolor='#fb7922' class='tabhead'><img src='img/blank.gif' alt='' width='250' height='6'><br>" . $TEXT['security-tab1'] . "</td>";
echo "<td bgcolor='#fb7922' class='tabhead'><img src='img/blank.gif' alt='' width='100' height='6'><br>" . $TEXT['security-tab2'] . "</td>";
echo "<td bgcolor='#fb7922' valign='top'><br><img src='img/blank.gif' alt='' width='1' height='10'></td>";
echo "</tr>";
line($TEXT['security-checkapache-nok'], $TEXT['security-checkapache-ok'], $TEXT['security-checkapache-text'], "", "", "xampp");
line($TEXT['security-checkmysql-nok'], $TEXT['security-checkmysql-ok'], $TEXT['security-checkmysql-text'], $TEXT['security-checkmysql-out'], "", "mysqlroot");
line($TEXT['security-phpmyadmin-nok'], $TEXT['security-phpmyadmin-ok'], $TEXT['security-phpmyadmin-text'], $TEXT['security-phpmyadmin-out'], "", "phpmyadmin");
// line($TEXT['security-checkphp-nok'], $TEXT['security-checkphp-ok'], $TEXT['security-checkphp-text'], $TEXT['security-checkphp-out'], "", "php");
line($TEXT['security-checktomcat-nok'], $TEXT['security-checktomcat-ok'], $TEXT['security-checktomcat-text'], $TEXT['security-checktomcat-out'], $TEXT['security-checktomcat-notinstalled'], "tomcat");
echo "<tr valign='bottom'>";
echo "<td bgcolor='#fb7922'></td>";
echo "<td bgcolor='#fb7922' colspan='3'><img src='img/blank.gif' alt='' width='1' height='8'></td>";
echo "<td bgcolor='#fb7922'></td>";
echo "</tr>";
echo "</table>";
echo "<p>";
?>
        <?php 
echo $TEXT['security-text2'];
?>
<p>
        <?php 
echo $TEXT['security-text3'];
?>
}
if (file_exists("{$partwampp}\\FileZillaFTP\\FileZilla Server.xml")) {
    if (false === @fsockopen($ip, 21)) {
        $ftp = "NOK";
    } else {
        $ftp = "OK";
    }
    line($TEXT['status-ftp'], $ftp);
}
if (file_exists("{$partwampp}\\tomcat\\conf\\server.xml")) {
    if (false === @fsockopen($ip, 8080)) {
        $tomcat = "NOK";
    } else {
        $tomcat = "OK";
    }
    line($TEXT['status-tomcat'], $tomcat);
}
echo "<tr valign='bottom'>";
echo "<td bgcolor='#fb7922'></td>";
echo "<td bgcolor='#fb7922' colspan='3'><img src='img/blank.gif' alt='' width='1' height='8'></td>";
echo "<td bgcolor='#fb7922'></td>";
echo "</tr>";
echo "</table>";
?>

        <p><?php 
echo $TEXT['status-text2'];
?>
</p>

    </body>
Exemple #13
0
    if (($handle = @fsockopen($host, 8080, $errno, $errstr, $timeout)) == false) {
        $tomcat = "NOK";
    } else {
        $tomcat = "OK";
    }
    @fclose($handle);
    line($TEXT['status-tomcat'], $tomcat);
}
if (file_exists("{$partwampp}\\PosadisDNS\\posadis.exe")) {
    if (($handle = @fsockopen($host, 53, $errno, $errstr, $timeout)) == false) {
        $named = "NOK";
    } else {
        $named = "OK";
    }
    @fclose($handle);
    line($TEXT['status-named'], $named);
}
echo "<tr valign='bottom'>";
echo "<td bgcolor='#fb7922'></td>";
echo "<td bgcolor='#fb7922' colspan='3'><img src='img/blank.gif' alt='' width='1' height='8'></td>";
echo "<td bgcolor='#fb7922'></td>";
echo "</tr>";
echo "</table>";
echo "<p>";
?>

		<?php 
echo $TEXT['status-text2'];
?>
<p>
Exemple #14
0
 /**
  * "Edit" Page
  *
  * Shows a form representing the currently selected DB
  * so that data can be edited
  *
  * @access	public
  * @return	string	the HTML "edit" page
  */
 function edit($id = '')
 {
     if ($id === '') {
         redirect($this->url['view']);
     }
     $this->CI->load->library('form_validation');
     $rules = array();
     foreach ($this->fields as $field) {
         if ($field->primary_key == 1) {
             continue;
         }
         if (!$field->isdisplay) {
             continue;
         }
         $res = array();
         //password confirm
         if ($field->elementType == 'password') {
             $res['field'] = $field->name;
             $res['label'] = line('password_confirm');
             $res['rules'] = 'matches[' . $field->name . ']|' . $field->validation;
         }
         $res['field'] = $field->name;
         $res['label'] = $field->lang;
         $res['rules'] = $field->validation;
         $rules[] = $res;
     }
     $this->CI->form_validation->set_rules($rules);
     if ($this->CI->form_validation->run() == FALSE) {
         $select_str = '';
         foreach ($this->fields as $field) {
             if ($field->isdisplay || $field->primary_key) {
                 $select_str .= $field->name . ',';
             }
         }
         if (!empty($select_str)) {
             $this->CI->db->select(substr($select_str, 0, -1));
         }
         // Run the query
         $query = $this->CI->db->get_where($this->current_table, array($this->key => $id));
         $data = array('title' => $this->title, 'fields' => $this->fields, 'query' => $query->row(), 'url' => $this->url, 'id' => $id);
         lav('lib/dbshortcut/edit', $data);
     } else {
         $this->post_filter();
         $this->CI->db->update($this->current_table, $_POST, array($this->key => $id));
         redirect($this->url['view']);
     }
 }
Exemple #15
0
    $opcache = "NOK";
}
echo '<table border=0 cellpadding=0 cellspacing=0>';
echo "<tr valign=top>";
echo "<td bgcolor=#fb7922 valign=top><img src=img/blank.gif width=10 height=0></td>";
echo "<td bgcolor=#fb7922 class=tabhead><img src=img/blank.gif width=250 height=6><br>" . $TEXT['status-tab1'] . "</td>";
echo "<td bgcolor=#fb7922 class=tabhead><img src=img/blank.gif width=100 height=6><br>" . $TEXT['status-tab2'] . "</td>";
echo "<td bgcolor=#fb7922 class=tabhead><img src=img/blank.gif width=100 height=6><br>" . $TEXT['status-tab3'] . "</td>";
echo "<td bgcolor=#fb7922 valign=top><br><img src=img/blank.gif width=1 height=10></td>";
echo "</tr>";
line($TEXT['status-mysql'], $mysql);
line($TEXT['status-php'], $php);
line($TEXT['status-perl'], $perl);
line($TEXT['status-cgi'], $cgi);
line($TEXT['status-ssi'], $ssi);
line($TEXT['status-opcache'], $opcache, $TEXT['status-opcache-url']);
#line($TEXT['status-mmcache'],$eaccelerator,$TEXT['status-mmcache-url']);
line($TEXT['status-oci8'], $oci8, $TEXT['status-oci8-url']);
echo "<tr valign=bottom>";
echo "<td bgcolor=#fb7922></td>";
echo "<td bgcolor=#fb7922 colspan=3><img src=img/blank.gif width=1 height=8></td>";
echo "<td bgcolor=#fb7922></td>";
echo "</tr>";
echo "</table>";
echo "<p>";
echo $TEXT['status-text2'];
?>
<p>
</body>
</html>
}
//--> Init Markdown
$md = new \PerryFlynn\ParsedownExtraExtensions();
$md->setBreaksEnabled(false)->setMarkupEscaped(true)->setUrlsLinked(true);
//--> Init Twig
$loader = new Twig_Loader_Filesystem(__DIR__);
$twig = new Twig_Environment($loader);
//--> Cleanup
$buildfiles = glob(CFG_BUILD . "*.html");
foreach ($buildfiles as $buildfile) {
    @unlink($buildfile);
}
//--> Get files
$mdfiles = array();
// One file from cmd argument
if (isset($argv[1]) && is_file(CFG_MD . $argv[1])) {
    line("Render only given files");
    $mdfiles[] = CFG_MD . $argv[1];
} else {
    line("Scan for markdown files");
    $mdfiles = glob(CFG_MD . "*.md");
    line("Found " . count($mdfiles) . " files");
}
//--> Build markdown files
foreach ($mdfiles as $mdfile) {
    line("Render " . $mdfile);
    $html = $twig->render('layout.html.twig', array("title" => basename($mdfile), "filename" => $mdfile, "content" => $md->parse(file_get_contents($mdfile))));
    $target = CFG_BUILD . basename($mdfile) . ".html";
    file_put_contents($target, $html);
    line("Saved as " . $target);
}
Exemple #17
0
function captcha()
{
    require_once 'captchaConfig.php';
    $cap = count($captcha);
    $max = strlen($captchaChars) - 1;
    $password = null;
    $password2 = '';
    for ($i = 0; $i < $passwordSize; $i++) {
        $password .= $captchaChars[mt_rand(0, $max)];
    }
    for ($i = 0; $i < $fileNameSize; $i++) {
        $password2 .= $fileNameChars[mt_rand(0, $max)];
    }
    $im = imagecreatefromjpeg($imagesFolder . $captcha[cap($captcha)]);
    /* Attempt to open */
    $black = imagecolorallocate($im, lineColor(), lineColor(), lineColor());
    //echo $black;
    $dir = $fontFolder;
    $dh = opendir($dir);
    while (false !== ($filename = readdir($dh))) {
        if ($filename != '.' && $filename != '..') {
            $fonts[] = $filename;
        }
    }
    $font = array_rand($fonts);
    $font = $fontFolder . $fonts[$font];
    //echo "<h1>$font</h1>";
    $angle = rand(0, 40);
    imagettftext($im, $size, mrn($angle), $lefts, $tops, $black, $font, $password);
    imageline($im, line2(), line2(), line(), line(), imagecolorallocate($im, lineColor(), lineColor(), lineColor()));
    imageline($im, line(), line2(), line2(), line(), imagecolorallocate($im, lineColor(), lineColor(), lineColor()));
    imageline($im, line2(), line2(), line(), line(), imagecolorallocate($im, lineColor(), lineColor(), lineColor()));
    imageline($im, line2(), line2(), line(), line(), imagecolorallocate($im, lineColor(), lineColor(), lineColor()));
    imageline($im, line2(), line2(), line(), line(), imagecolorallocate($im, lineColor(), lineColor(), lineColor()));
    imageline($im, line2(), line2(), line(), line(), imagecolorallocate($im, lineColor(), lineColor(), lineColor()));
    imageline($im, line2(), line2(), line(), line(), imagecolorallocate($im, lineColor(), lineColor(), lineColor()));
    imageline($im, line2(), line2(), line(), line(), imagecolorallocate($im, lineColor(), lineColor(), lineColor()));
    imageline($im, line(), line2(), line2(), line(), imagecolorallocate($im, lineColor(), lineColor(), lineColor()));
    imageline($im, line2(), line2(), line2(), line2(), imagecolorallocate($im, lineColor(), lineColor(), lineColor()));
    imageline($im, line2(), line(), line(), line2(), imagecolorallocate($im, lineColor(), lineColor(), lineColor()));
    imageline($im, line(), line2(), line2(), line(), imagecolorallocate($im, lineColor(), lineColor(), lineColor()));
    imageline($im, line(), line2(), line2(), line(), imagecolorallocate($im, lineColor(), lineColor(), lineColor()));
    imageline($im, line(), line2(), line2(), line(), imagecolorallocate($im, lineColor(), lineColor(), lineColor()));
    imagejpeg($im, $captchasFolder . $password2 . '.jpg', $quality) or die('Is captchasFolder writable?');
    $max = strlen($tmpFileChars) - 1;
    $tmpFile = null;
    for ($i = 0; $i < 16; $i++) {
        $tmpFile .= $tmpFileChars[mt_rand(0, $max)];
    }
    umask(00);
    $tmpFile = $tmpFileLocation . $tmpFile . ".tmp";
    if (!is_file($tmpFile)) {
        touch($tmpFile) or die('Could not create file');
    }
    if (is_writable($tmpFile)) {
        if (!($handle = fopen($tmpFile, 'a'))) {
            echo "Cannot open file ({$tmpFile})";
            exit;
        }
        if (fwrite($handle, $password) === FALSE) {
            echo "Cannot write to file ({$tmpFile})";
            exit;
        }
        fclose($handle);
    } else {
        echo "The file {$tmpFile} is not writable";
    }
    $html = '
                <div style="display:inline-block;width:140px;padding:10px;vertical-align:top;">
                <img src="' . $captchasFolderWeb . $password2 . '.jpg" height="100" width="120" border="1"/>
                </div>
                <div style="display:inline-block;width:140px;padding:10px;">
                <h2>Enter the Captcha Text here:</h2>
                <input type="text" name="' . $passwordName . '" size="6" title="' . CAPTCHA . '" />
                </div>
                <div>
                (Note: all letters are lowercase and there should be ' . $passwordSize . ' characters)
                <br />If the text is illegible, <a href="">click here</a> to reload the captcha.
                <input type="hidden" name="' . $tmpFileName . '" value="' . $tmpFile . '" />
                <input type="hidden" name="capPass" value="' . $password2 . '" />
                </div>';
    return $html;
}
Exemple #18
0
} else {
    $oci8 = "NOK";
}
echo '<table border=0 cellpadding=0 cellspacing=0>';
echo "<tr valign=top>";
echo "<td bgcolor=#fb7922 valign=top><img src=img/blank.gif width=10 height=0></td>";
echo "<td bgcolor=#fb7922 class=tabhead><img src=img/blank.gif width=250 height=6><br>" . $TEXT['status-tab1'] . "</td>";
echo "<td bgcolor=#fb7922 class=tabhead><img src=img/blank.gif width=100 height=6><br>" . $TEXT['status-tab2'] . "</td>";
echo "<td bgcolor=#fb7922 class=tabhead><img src=img/blank.gif width=100 height=6><br>" . $TEXT['status-tab3'] . "</td>";
echo "<td bgcolor=#fb7922 valign=top><br><img src=img/blank.gif width=1 height=10></td>";
echo "</tr>";
line($TEXT['status-mysql'], $mysql);
line($TEXT['status-php'], $php);
line($TEXT['status-perl'], $perl);
line($TEXT['status-cgi'], $cgi);
line($TEXT['status-ssi'], $ssi);
//	line($TEXT['status-mmcache'],$eaccelerator,$TEXT['status-mmcache-url']);
//	line($TEXT['status-oci8'],$oci8,$TEXT['status-oci8-url']);
echo "<tr valign=bottom>";
echo "<td bgcolor=#fb7922></td>";
echo "<td bgcolor=#fb7922 colspan=3><img src=img/blank.gif width=1 height=8></td>";
echo "<td bgcolor=#fb7922></td>";
echo "</tr>";
echo "</table>";
echo "<p>";
echo $TEXT['status-text2'];
?>
<p>
</body>
</html>
/** This page has to be called frequently (e.g. using wget) 
 to clean premium links.
*/
// How many hours we want to keep a temp. playlist or symlink?
$hoursToKeep = 4;
function line($msg)
{
    // just for screen output (testing)
    echo "<br>{$msg}\n";
}
debug("cleaning", "tmpDir");
$clearTime = time() - $hoursToKeep * 60 * 60;
$dir = dir($config['tmpDir']);
while ($entry = $dir->read()) {
    if ($entry == "." || $entry == "..") {
        continue;
    }
    $file = $config['tmpDir'] . "/{$entry}";
    if (is_dir($file)) {
        continue;
    }
    //if (preg_match('/\.png$/', $entry) || preg_match('/\.m3u$/', $entry)) {
    if (is_file($file) && filemtime($file) < $clearTime) {
        if (!unlink($file)) {
            logError("could not delete: {$file}");
        }
    }
}
$dir->close();
line("CLEANED TMP DIR");
Exemple #20
0
                $val_length = strlen($d_val);
                $i = 0;
                while ($i++ < $tr_length) {
                    if ($i == 2) {
                        echo $d_val;
                        $i += $val_length - 1;
                    } else {
                        echo ' ';
                    }
                }
                echo '|';
            }
            echo PHP_EOL;
        }
    }
    echo PHP_EOL;
    ascLogo($table);
    line($table, '--  Exception Start  --');
    printf("\n Line: %s \n File: %s \n\n", $message['line'], $message['file']);
    th($table);
    thead($table);
    th($table);
    if (!empty($trace)) {
        foreach ($trace as $t) {
            tBody($t, $table);
            th($table);
        }
    }
    echo PHP_EOL;
    line($table, sprintf("--  Exception END  %s  --", date('Y-m-d H:i:s', time())));
}
        echo "<tr bgcolor=#ffffff><td></td><td colspan=1 class=small>{$info}<br><img src=img/blank.gif width=1 height=10></td><td></td><td></td></tr>";
    }
    $i++;
}
echo '<table border=0 cellpadding=0 cellspacing=0>';
echo "<tr valign=top>";
echo "<td bgcolor=#fb7922 valign=top><img src=img/blank.gif width=10 height=0></td>";
echo "<td bgcolor=#fb7922 class=tabhead><img src=img/blank.gif width=250 height=6><br>" . $TEXT['security-tab1'] . "</td>";
echo "<td bgcolor=#fb7922 class=tabhead><img src=img/blank.gif width=100 height=6><br>" . $TEXT['security-tab2'] . "</td>";
echo "<td bgcolor=#fb7922 valign=top><br><img src=img/blank.gif width=1 height=10></td>";
echo "</tr>";
line($TEXT['security-checkapache-nok'], $TEXT['security-checkapache-ok'], $TEXT['security-checkapache-text'], "checkapache");
//line($TEXT['security-checkmysqlport-nok'],$TEXT['security-checkmysqlport-ok'],$TEXT['security-checkmysqlport-text'],"checkmysqlport");
line($TEXT['security-checkpmamysqluser-nok'], $TEXT['security-checkpmamysqluser-ok'], $TEXT['security-checkpmamysqluser-text'], "checkpmamysqluser");
line($TEXT['security-checkmysql-nok'], $TEXT['security-checkmysql-ok'], $TEXT['security-checkmysql-text'], "checkmysql");
line($TEXT['security-checkftppassword-nok'], $TEXT['security-checkftppassword-ok'], $TEXT['security-checkftppassword-text'], "checkftppassword");
echo "<tr valign=bottom>";
echo "<td bgcolor=#fb7922></td>";
echo "<td bgcolor=#fb7922 colspan=3><img src=img/blank.gif width=1 height=8></td>";
echo "<td bgcolor=#fb7922></td>";
echo "</tr>";
echo "</table>";
echo "<p>";
echo $TEXT['security-text2'];
?>
<p>

&nbsp;<p>&nbsp;<p>&nbsp;<p>
&nbsp;<p>&nbsp;<p>&nbsp;<p>
</body>
</html>
Exemple #22
0
/**
 * Displays an array of strings as a menu where a user can enter a number to
 * choose an option. The array must be a single dimension with either strings
 * or objects with a `__toString()` method.
 *
 * @param array   $items    The list of items the user can choose from.
 * @param string  $default  The index of the default item.
 * @param string  $title    The message displayed to the user when prompted.
 * @return string  The index of the chosen item.
 * @see cli\line()
 * @see cli\input()
 * @see cli\err()
 */
function menu($items, $default = false, $title = 'Choose an item')
{
    $map = array_values($items);
    if ($default && strpos($title, '[') === false && isset($items[$default])) {
        $title .= ' [' . $items[$default] . ']';
    }
    foreach ($map as $idx => $item) {
        line('  %d. %s', $idx + 1, (string) $item);
    }
    line();
    while (true) {
        fwrite(STDOUT, sprintf('%s: ', $title));
        $line = input();
        if (is_numeric($line)) {
            $line--;
            if (isset($map[$line])) {
                return array_search($map[$line], $items);
            }
            if ($line < 0 || $line >= count($map)) {
                err('Invalid menu selection: out of range');
            }
        } else {
            if (isset($default)) {
                return $default;
            }
        }
    }
}
Exemple #23
0
 /**
  * Run the Validator
  *
  * This function does all the work.
  *
  * @access	public
  * @return	bool
  */
 function run()
 {
     // Do we even have any data to process?  Mm?
     if (count($this->_data) == 0 || count($this->_rules) == 0) {
         return FALSE;
     }
     // Cycle through the rules and test for errors
     foreach ($this->_rules as $field => $rules) {
         //Explode out the rules!
         $ex = explode('|', $rules);
         // Is the field required?  If not, if the field is blank  we'll move on to the next test
         if (!in_array('required', $ex, TRUE)) {
             if (!isset($this->_data[$field])) {
                 continue;
             }
         }
         /*
          * Are we dealing with an "isset" rule?
          *
          * Before going further, we'll see if one of the rules
          * is to check whether the item is set (typically this
          * applies only to checkboxes).  If so, we'll
          * test for it here since there's not reason to go
          * further
          */
         if (!isset($this->_data[$field])) {
             if (in_array('isset', $ex, TRUE) or in_array('required', $ex)) {
                 $line = 'The %s field was not set';
                 // Build the error message
                 $mfield = !isset($this->_fields[$field]) ? $field : $this->_fields[$field];
                 $message = sprintf($line, $mfield);
                 // Set the error variable.  Example: $this->username_error
                 $error = $field . '_error';
                 $this->{$error} = $this->_error_prefix . $message . $this->_error_suffix;
                 $this->_error_array[] = $message;
             }
             continue;
         }
         /*
          * Set the current field
          *
          * The various prepping functions need to know the
          * current field name so they can do this:
          *
          * $_POST[$this->_current_field] == 'bla bla';
          */
         $this->_current_field = $field;
         // Cycle through the rules!
         foreach ($ex as $rule) {
             // Is the rule a callback?
             $callback = FALSE;
             if (substr($rule, 0, 9) == 'callback_') {
                 $rule = substr($rule, 9);
                 $callback = TRUE;
             }
             // Strip the parameter (if exists) from the rule
             // Rules can contain a parameter: max_length[5]
             $param = FALSE;
             if (preg_match("/(.*?)\\[(.*?)\\]/", $rule, $match)) {
                 $rule = $match[1];
                 $param = $match[2];
             }
             // Call the function that corresponds to the rule
             if ($callback === TRUE) {
                 if (!method_exists($this->_object, $rule)) {
                     continue;
                 }
                 $result = $this->_object->{$rule}($this->_data[$field], $param);
                 // If the field isn't required and we just processed a callback we'll move on...
                 if (!in_array('required', $ex, TRUE) and $result !== FALSE) {
                     continue 2;
                 }
             } else {
                 if (!method_exists($this, $rule)) {
                     /*
                      * Run the native PHP function if called for
                      *
                      * If our own wrapper function doesn't exist we see
                      * if a native PHP function does. Users can use
                      * any native PHP function call that has one param.
                      */
                     if (function_exists($rule)) {
                         $this->_data[$field] = $rule($this->_data[$field]);
                         $this->{$field} = $this->_data[$field];
                     }
                     continue;
                 }
                 $result = $this->{$rule}($this->_data[$field], $param);
             }
             // Did the rule test negatively?  If so, grab the error.
             if ($result === FALSE) {
                 if (!isset($this->_error_messages[$rule])) {
                     if (FALSE === ($line = line($rule))) {
                         $line = 'Unable to access an error message corresponding to your field name.';
                     }
                 } else {
                     $line = $this->_error_messages[$rule];
                 }
                 // Build the error message
                 $mfield = !isset($this->_fields[$field]) ? $field : $this->_fields[$field];
                 $mparam = !isset($this->_fields[$param]) ? $param : $this->_fields[$param];
                 $message = sprintf($line, $mfield, $mparam);
                 // Set the error variable.  Example: $this->username_error
                 $error = $field . '_error';
                 $this->{$error} = $this->_error_prefix . $message . $this->_error_suffix;
                 // Add the error to the error array
                 $this->_error_array[] = $message;
                 continue 2;
             }
         }
     }
     $total_errors = count($this->_error_array);
     /*
      * Recompile the class variables
      *
      * If any prepping functions were called the $_POST data
      * might now be different then the corresponding class
      * variables so we'll set them anew.
      */
     if ($total_errors > 0) {
         $this->_safe_form_data = TRUE;
     }
     $this->setFields();
     // Did we end up with any errors?
     if ($total_errors == 0) {
         return TRUE;
     }
     foreach ($this->_error_array as $val) {
         Session::setFlash($val, B_ERROR);
         $this->error_string .= $this->_error_prefix . $val . $this->_error_suffix . "\n";
     }
     // set errors in controller
     return FALSE;
 }
Exemple #24
0
 public static function autoGenerateSql()
 {
     $_config = self::getConfig();
     $_config = self::$_config_example;
     $_keys = [];
     // 		$_sqlCol = ['key','value','info'];
     foreach ($_config as $k => $v) {
         if (is_array($v)) {
             foreach ($v as $k1 => $v1) {
                 if (is_array($v1)) {
                     foreach ($v1 as $k2 => $v2) {
                         $_key = $k . '.' . $k1 . '.' . $k2;
                         $_keys[$_key] = $v2;
                     }
                 } else {
                     $_key = $k . '.' . $k1;
                     $_keys[$_key] = $v1;
                 }
             }
         } else {
             $_key = $k;
             $_keys[$_key] = $v;
         }
     }
     foreach ($_keys as $k => $v) {
         $_sqlCol['key'] = $k;
         $_sqlCol['value'] = $v;
         $_sqlCol['info'] = 'info';
         $sql[] = createInsertSql('gzb_topic_config', $_sqlCol);
         line(createInsertSql('gzb_topic_config', $_sqlCol), ';<br/>');
     }
     dump($sql);
     edump($_keys);
 }
 /**
  * Echo a single phrase
  *
  * @access  public
  * @param   string
  * @param   array
  * @param   string
  * @return  string
  */
 function _e($str, $args = null, $default = false)
 {
     echo line($str, $args, $default);
 }
        }
        state("Bootstrapping SilverSmith...");
        SilverSmith::set_yaml_path($yml_path);
        SilverSmithProject::load($yml_path);
        SilverSmith::load_field_manifest();
        SilverSmith::load_class_manifest();
        SilverSmith::load_interface_manifest();
        // Check for an upgrade every hour
        $time = time();
        $stamp = @file_get_contents($script_dir . "/upgrade");
        if (!$stamp) {
            $stamp = $time;
        }
        $diff = $time - (int) $stamp;
        if ($diff > 3600) {
            say("Checking for upgrade...");
            SilverSmith::upgrade();
        }
        say("done");
    }
}
// if (SilverSmith::is_upgrade_available() && $action != "upgrade") {
//     warn("*** An upgrade is available ***");
//     state(" Run 'silversmith upgrade' to install.\n");
//     sleep(2);
// }
// Hand off execution to the SilverSmith static class
say("Executing CLI command\n\n");
line();
$action = str_replace("-", "_", $action);
call_user_func("SilverSmith::{$action}", $PARAMS);
 /**
  * Creates any templates that do not exist yet, unless the "force" parameter is specified
  *
  * @see "silversmith help"	 
  * @param The parameters, e.g. from the command line
  */
 public static function build_templates($params = array())
 {
     $theme_dir = isset($params['theme']) ? "themes/" . $params['theme'] : false;
     $force = isset($params['force']);
     $specificTemplates = isset($params['list']) ? explode(',', $params['list']) : false;
     if (!$theme_dir) {
         if (self::$project_dir == project()) {
             if (SSViewer::current_theme()) {
                 $theme_dir = "themes/" . SSViewer::current_theme();
             } else {
                 $theme_dir = project();
             }
         } else {
             $theme_dir = self::$project_dir;
         }
     }
     say("Using theme directory {$theme_dir}");
     if (!file_exists($theme_dir)) {
         fail("The theme directory {$theme_dir} does not exist");
     }
     if (!is_dir($theme_dir . "/templates")) {
         mkdir($theme_dir . "/templates");
     }
     $layout_dir = "{$theme_dir}/templates/Layout";
     if (!is_dir($layout_dir)) {
         mkdir($layout_dir);
     }
     $source = "Page.ss";
     if (isset($params['source'])) {
         $source = $params['source'];
     }
     if (!file_exists("{$layout_dir}/{$source}")) {
         fail("Source template {$layout_dir}/{$source} does not exist.");
     }
     if (!file_exists(self::$yaml_path)) {
         fail("File " . self::$yaml_path . " does not exist.");
     }
     SilverSmithProject::load(self::$yaml_path);
     $created = 0;
     say(cell("Status", 11, true, "grey", "on_white") . cell("File", 30, true, "grey", "on_white") . cell("Result", 40, true, "grey", "on_white"));
     line();
     foreach (SilverSmithProject::get_page_types() as $node) {
         if ($node->getKey() == "SiteConfig") {
             continue;
         }
         if ($specificTemplates && !in_array($node->getKey(), $specificTemplates)) {
             continue;
         }
         if (!file_exists("{$layout_dir}/{$node->getKey()}.ss") || $force) {
             $stock = file_get_contents("{$layout_dir}/{$source}");
             $fh = fopen("{$layout_dir}/{$node->getKey()}.ss", "w");
             $created++;
             $notes = "Copied from {$source}";
             if (isset($params['autofill'])) {
                 if (!preg_match('/\\$Content[^A-Za-z0-9_]/', $stock)) {
                     say(cell("Skipped", 2, "white", "on_red") . cell($node->getKey() . ".ss", 30) . cell("Varible \$Content is not in the template.", 40));
                     continue;
                 }
                 $notes .= " [Auto-filled]";
                 $template = new BedrockTemplate(file_get_contents(self::$script_dir . "/code/lib/structures/AutoFill.bedrock"));
                 $template->bind($node);
                 $autofill = $template->render();
                 $filled = preg_replace('/\\$Content([^A-Za-z0-9_])/', "\$Content\n\n{$autofill}\n\n\$1", $stock);
                 fwrite($fh, $filled);
             } else {
                 fwrite($fh, $stock);
             }
             fclose($fh);
             say(cell("Created", 10, true, "white", "on_green") . cell($node->getKey() . ".ss", 30) . cell($notes, 40));
         } else {
             say(cell("Bypassed", 11, true, "grey", "on_yellow") . cell($node->getKey() . ".ss", 30) . cell("File exists. Use --force to override", 40));
         }
     }
     line();
     say("{$created} templates created.");
 }
function l()
{
    $args = func_get_args();
    $t = line($args);
    return empty($t) ? '' : $t . "\n";
}
    $i++;
}
echo "<table border='0' cellpadding='0' cellspacing='0'>";
echo "<tr valign='top'>";
echo "<td bgcolor='#fb7922' valign='top'><img src='img/blank.gif' alt='' width='10' height='0'></td>";
echo "<td bgcolor='#fb7922' class='tabhead'><img src='img/blank.gif' alt='' width='250' height='6'><br>" . $TEXT['security-tab1'] . "</td>";
echo "<td bgcolor='#fb7922' class='tabhead'><img src='img/blank.gif' alt='' width='100' height='6'><br>" . $TEXT['security-tab2'] . "</td>";
echo "<td bgcolor='#fb7922' valign='top'><br><img src='img/blank.gif' alt='' width='1' height='10'></td>";
echo "</tr>";
line($TEXT['security-checkapache-nok'], $TEXT['security-checkapache-ok'], $TEXT['security-checkapache-text'], "", "", "xampp");
line($TEXT['security-checkmysql-nok'], $TEXT['security-checkmysql-ok'], $TEXT['security-checkmysql-text'], $TEXT['security-checkmysql-out'], "", "mysqlroot");
line($TEXT['security-phpmyadmin-nok'], $TEXT['security-phpmyadmin-ok'], $TEXT['security-phpmyadmin-text'], $TEXT['security-phpmyadmin-out'], "", "phpmyadmin");
line($TEXT['security-checkftppassword-nok'], $TEXT['security-checkftppassword-ok'], $TEXT['security-checkftppassword-text'], $TEXT['security-checkftppassword-out'], "", "ftp");
line($TEXT['security-checkphp-nok'], $TEXT['security-checkphp-ok'], $TEXT['security-checkphp-text'], $TEXT['security-checkphp-out'], "", "php");
if (extension_loaded("imap")) {
    line($TEXT['security-pop-nok'], $TEXT['security-pop-ok'], $TEXT['security-pop-text'], $TEXT['security-pop-out'], $TEXT['security-pop-notload'], "pop");
}
echo "<tr valign='bottom'>";
echo "<td bgcolor='#fb7922'></td>";
echo "<td bgcolor='#fb7922' colspan='3'><img src='img/blank.gif' alt='' width='1' height='8'></td>";
echo "<td bgcolor='#fb7922'></td>";
echo "</tr>";
echo "</table>";
echo "<p>";
?>
		<?php 
echo $TEXT['security-text2'];
?>
<p>
		<?php 
echo $TEXT['security-text3'];
Exemple #30
0
 function delete($id = 0)
 {
     // Delete one
     if ($id) {
         $this->navigation_m->deleteLink($id);
     } else {
         foreach (array_keys($this->input->post('delete')) as $id) {
             $this->navigation_m->deleteLink($id);
         }
     }
     $this->cache->delete_all('navigation_m');
     $this->session->set_flashdata('success', $this->lang - line('nav_link_delete_success'));
     redirect('admin/navigation/index');
 }