Beispiel #1
0
function __autoload($class)
{
    $cariFail = GetMatchingFiles(GetContents('aplikasi'), $class . '.php');
    echo '<br>Utama :: $class->' . $class . ' || $fail->' . $cariFail[0];
    if (isset($cariFail[0])) {
        require $cariFail[0];
        if (!class_exists($class)) {
            echo '<br>class ' . $class . ' tak wujud<br>';
        }
    } else {
        echo '<br>fail class ' . $class . ' tidak wujud <br>';
    }
}
Beispiel #2
0
 public function muatTanya($nama)
 {
     /* 1. dapatkan fail dalam folder TANYA yang serupa dengan $nama
      * dan masukkan dalam $failTanya
      */
     $failTanya = GetMatchingFiles(GetContents(TANYA), $nama . '_tanya.php');
     //echo '<hr>$fail ' . TANYA . '->' . $failTanya[0] . '<br>';
     /* 2. semak sama ada dalam folder TANYA $fail benar2 wujud
      * jika ya : masukkan $fail dan isytihar class tersebut
      * jika tak : cari fungsi sesat()
      */
     if (file_exists($failTanya[0])) {
         $tanyaNama = ucfirst($nama) . '_Tanya';
         $this->tanya = new $tanyaNama();
     }
     //*/
 }
function available_plugins()
{
    $ffl = FileFolderList(PLUGINS_DIRECTORY, 1);
    $plugins = $ffl[file];
    if (!empty($plugins)) {
        foreach ($plugins as $null => $pluginfile) {
            if (stristr($pluginfile, ".htaccess")) {
                continue;
            }
            $plugin_data = GetContents($pluginfile);
            preg_match("{Plugin Name:(.*)}i", $plugin_data, $plugin[name]);
            preg_match("{Plugin URI:(.*)}i", $plugin_data, $plugin[uri]);
            preg_match("{Description:(.*)}i", $plugin_data, $plugin[description]);
            preg_match("{Author:(.*)}i", $plugin_data, $plugin[author]);
            preg_match("{Author URI:(.*)}i", $plugin_data, $plugin[author_uri]);
            preg_match("{Version:(.*)}i", $plugin_data, $plugin[version]);
            preg_match("{Application:(.*)}i", $plugin_data, $plugin[application]);
            preg_match("{Conflicts:(.*)}i", $plugin_data, $plugin[conflicts]);
            preg_match("{Required Framework:(.*)}i", $plugin_data, $plugin[framework]);
            $required_version = trim($plugin[framework][1]);
            $conflicts = trim($plugin[conflicts][1]);
            $application = trim($plugin[application][1]);
            // Skip plugins that need a better framework
            if ($required_version && version_compare(PLUGIN_FRAMEWORK_VERSION, $required_version, '<')) {
                $compatible = false;
            } else {
                $compatible = true;
            }
            if ($conflicts && in_array($conflicts, active_plugins())) {
                $conflicting = true;
            } else {
                $conflicting = false;
            }
            // Skip plugins designed for other systems
            if ($application && $application != 'CuteNews') {
                continue;
            }
            $available_plugins[] = array(name => trim($plugin[name][1]), uri => trim($plugin[uri][1]), description => trim($plugin[description][1]), author => trim($plugin[author][1]), author_uri => trim($plugin[author_uri][1]), version => trim($plugin[version][1]), application => trim($plugin[application][1]), file => basename($pluginfile), framework => $required_version, compatible => $compatible, conflicting => $conflicting);
        }
    } else {
        $available_plugins = array();
    }
    return $available_plugins;
}
Beispiel #4
0
 function __construct()
 {
     # 1. guna fungsi dpt_url() dari fail fungsi.php
     # dan masukkan dalam $url
     $url = dpt_url();
     //echo '<br>$url->'; print_r($url) . '';
     /* 2. semak sama ada $url[0] kosong
      * jika ya : $url[0] == 'index';
      * jika tak : $url[0] == $url[0];
      */
     $url[0] = empty($url[0]) ? 'index' : $url[0];
     /* 3. dapatkan fail dalam folder KAWAL yang serupa dengan $url[0]
      * dan masukkan dalam $fail
      */
     $failKawal = GetMatchingFiles(GetContents(KAWAL), $url[0] . '.php');
     //echo '<hr>$fail ' . KAWAL . '->' . $failKawal[0] . '<br>';
     /* 4. semak sama ada dalam folder KAWAL $fail benar2 wujud
      * jika ya : masukkan $fail dan isytihar class tersebut
      * jika tak : cari fungsi sesat()
      */
     if (file_exists($failKawal[0])) {
         $kawal = new $url[0]();
         $kawal->muatTanya($url[0]);
         /*
         			# jika $url[1] tak disetkan, bagi $method='index'
         			$method = (isset($url[1])) ? $url[1] : 'index';
         			# semak sama ada method ada dalam $kawal
         			if ( !method_exists($kawal, $method) )
         				$this->parameter();			
         			else $this->cari_pengawal($kawal, $url);
         			//*/
     } else {
         $this->sesat();
     }
     //*/
 }
function available_languages()
{
    global $aj_buildid;
    $lffl = FileFolderList("inc/lang", 1);
    $languages = $lffl[file];
    if (!empty($languages)) {
        foreach ($languages as $null => $languagefile) {
            $language_data = GetContents($languagefile);
            preg_match("{Languagefile:(.*)}i", $language_data, $language[name]);
            preg_match("{Language Name:(.*)}i", $language_data, $language[localname]);
            preg_match("{Author:(.*)}i", $language_data, $language[author]);
            preg_match("{Author URI:(.*)}i", $language_data, $language[uri]);
            preg_match("{Author Email:(.*)}i", $language_data, $language[email]);
            preg_match("{For Version:(.*)}i", $language_data, $language[version]);
            // Skip plugins designed for other versions
            settype($aj_buildid, "int");
            $testlang = trim($language[version][1]);
            settype($testlang, "int");
            if ($aj_buildid > $testlang) {
                continue;
            }
            $available_languages[] = array(name => trim($language[name][1]), localname => trim($language[localname][1]), author => trim($language[author][1]), uri => trim($language[uri][1]), email => trim($language[email][1]), version => trim($language[version][1]), filename => trim($languagefile));
        }
    } else {
        $available_languages = array();
    }
    return $available_languages;
}
function available_languages($ffl)
{
    $languages = $ffl[file];
    if (!empty($languages)) {
        foreach ($languages as $null => $languagefile) {
            if (stristr($pluginfile, ".htaccess")) {
                continue;
            }
            $language_data = GetContents($languagefile);
            preg_match("{Filename:(.*)}i", $language_data, $language[name]);
            preg_match("{Language National:(.*)}i", $language_data, $language[lang_nat]);
            preg_match("{Language International:(.*)}i", $language_data, $language[lang_int]);
            preg_match("{Author:(.*)}i", $language_data, $language[author]);
            preg_match("{Author URI:(.*)}i", $language_data, $language[author_uri]);
            preg_match("{Version:(.*)}i", $language_data, $language[version]);
            $available_languages[] = array(name => trim($language[name][1]), langnational => trim($language[lang_nat][1]), author => trim($language[author][1]), author_uri => trim($language[author_uri][1]), version => trim($language[version][1]), langinternational => trim($language[lang_int][1]), file => basename($languagefile));
        }
    } else {
        $available_languages = array();
    }
    return $available_languages;
}
function furls_AdminOptions()
{
    global $cutepath, $cute_query_string;
    include $cutepath . '/data/config.php';
    echoheader('user', 'Userfriendly URL Setup');
    $furls = new PluginSettings('Userfriendly_URLs');
    $bhelp = '<p><a href="?mod=options&action=furls">Back</a> / <a href="http://www.brandedthoughts.co.uk/cutewiki/index.php/Userfriendly%20URLs%20Plugin">Help</a></p>';
    switch ($_GET['subaction']) {
        case 'edit':
            $linkdata = $furls->settings['text']['0'];
            $buffer = $bhelp . '
	<p>This version of the plugin only needs to know the path to your include-file and what prefix you want on archived entry and category links.</p>
	<form method="post" action="?mod=options&amp;action=furls&amp;subaction=doadd" class="easyform">
		<div>
			<label for="txtCA">Category</label>
			<input id="txtCA" name="furls[category]" value="' . $linkdata[CA] . '" />
		</div>
		<div>
			<label for="txtAR">Archive prefix</label>
			<input id="txtAR" name="furls[archives]" value="' . $linkdata[AR] . '" />
		</div>
		<div style="padding-top: 10px;"><label for="txtPATH" style="width: 100%;">Path to including file<br /><small>If your including file is located at http://yoursite.com/content/news/index.php, type &quot;/content/news/index.php&quot; in this box. <br />Note that it\'s the full url to the file without &quot;http://yoursite.com/&quot;.</small></label>
			<input style="width: 200px;" id="txtPATH" name="furls[path]" value="' . $linkdata[PATH] . '" />
		</div>
		<div>
		<input type="submit" value="Save" />
		</div>
	</form>';
            break;
        case 'templates':
            // List templates
            $templates_list = array();
            if (!($handle = opendir("{$cutepath}/data"))) {
                die("<center>Can not open directory {$cutepath}/data ");
            }
            while (false !== ($file = readdir($handle))) {
                if (eregi(".tpl", $file)) {
                    $file_arr = explode(".", $file);
                    $templates_list[] = $file_arr[0];
                }
            }
            closedir($handle);
            echo $bhelp;
            echo '<p>This tool will automatically convert your old link, full-link and com-link tags to the new humanlink, 
			humanmorelink and humancomlink tags used by this plugin to create friendly url links to your posts. If you want to reverse 
			the process, check the &quot;reverse&quot; checkbox.</p>
		
		<form method="post" action="?mod=options&amp;action=furls&amp;subaction=dotemplates" class="easyform">
		<div>
			<label for="txtTemplate">Template</label>
		<select id="txtTemplate" name="furls[template]">';
            foreach ($templates_list as $null => $single_template) {
                if ($single_template == "Default") {
                    echo "<option selected=\"selected\" value=\"{$single_template}\">{$single_template}</option>";
                } else {
                    echo "<option value=\"{$single_template}\">{$single_template}</option>";
                }
            }
            echo '</select></div>
   		<div>
			<label for="txtReverse">Reverse</label>
			<input type="checkbox" id="txtReverse" name="furls[reverse]" value="true" />
		</div>
			<div>
				<input type="submit" value="Update my templates" />
			</div>
		</form>';
            break;
        case 'htaccess':
            $info = $furls->settings['text']['0'];
            $rewritebase = dirname($info[PATH]);
            if ($rewritebase != "/") {
                $rewritebase = $rewritebase . "/";
            }
            $includefile = str_replace(dirname($info[PATH]) . "/", "", $info[PATH]);
            $htaccesscont = 'RewriteEngine On
RewriteBase ' . $rewritebase . '
RewriteRule ^' . $info[AR] . '/([0-9]{10})/([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*)/(.*)\\.html$ ' . $includefile . '?archive=$1&furls_date=$2/$3/$4&aj_go=more&category=$5&id=$6 [QSA]
RewriteRule ^([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*)/(.*)\\.html$ ' . $includefile . '?furls_date=$1/$2/$3&aj_go=more&category=$4&id=$5 [QSA]
RewriteRule ^' . $info[CA] . '/(.*)\\.html$ ' . $includefile . '?category=$1 [QSA]';
            echo $bhelp;
            echo '<p>This tool will try to create a .htaccess-file in the location you specify. If you\'ve pointed the plugin to the correct include-file-path, 
	the content shown below should be ready for use. You can add variables to the last part of each rewriterule-line. Say you have your include-code in 
	index.php, but it only shows news if you have show=news in your url; you would then add &quot;&show=news&quot; to the end of each line.</p>
	
	
		<form method="post" action="?mod=options&amp;action=furls&amp;subaction=dohtaccess" class="easyform">
		<div>
			<label style="width: 300px;" for="txtHtaccess">.htaccess contents:</label>
			<textarea style="width: 100%; height: 200px;" wrap="off" id="txtHtaccess" name="furls[htaccess]">' . $htaccesscont . '</textarea>
		</div>
		<div>
		
		<p>The location must be relative to 
	your cutenews directory. If you type just &quot;.htaccess&quot;, the file will be created in your cutenews directory. 
	If you type &quot;../.htaccess&quot;, the file will be created in the parent directory of your cutenews installation.
	If you have cutenews installed in &quot;/content/cutenews&quot; and your include-file in &quot;/&quot;, type &quot;../../.htaccess&quot; in the field (&quot;../&quot; means one directory up).<br /></p>

			<p><span class="warning">This <b>might</b> cause your server to crash - so be warned! Not exactly crash, but create a file that is 
			unreadable/unwritable/assigned to another user than yourself on the host machine, thus in a worst-case scenario rendering 
			your site non-functional. If you\'re uncomfortable 
			risking a server&quot;crash&quot;, you should do this manually by writing and uploading the .htaccess file yourself. 
			The directory you are writing .htaccess to must be writable and readable for this tool to work. (' . $_SERVER["PHP_SELF"] . ')</span></p>
			
			<label for="txtTemplate">Write to file:</label>
			<input id="txtTemplate" name="furls[htaccessfile]" value="../.htaccess" />
		</div>
		
			<div>
				<input type="submit" value="Write file!" />
				
			</div>
		</form>';
            break;
        case 'dohtaccess':
            if (WriteContents(stripslashes($_POST[furls][htaccess]), stripslashes($_POST[furls][htaccessfile])) == "true") {
                echo "{$bhelp} <p>Written to " . stripslashes($_POST[furls][htaccessfile]) . "</p>";
            } else {
                echo "{$bhelp} <p>Couldn't write file - make sure the directory you are writing to is actually writable (CHMOD 777)</p>";
            }
            break;
        case 'dotemplates':
            $templatefile = "{$cutepath}/data/" . stripslashes($_POST[furls][template]) . ".tpl";
            $furl_templatec = GetContents($templatefile);
            if (stripslashes($_POST[furls][reverse]) == "true") {
                $furl_templatec = str_replace("humanmorelink", "full-link", $furl_templatec);
                $furl_templatec = str_replace("humancomlink", "com-link", $furl_templatec);
                $furl_templatec = str_replace("humanlink", "link", $furl_templatec);
                $state = "Original links placed";
            } else {
                $furl_templatec = str_replace("full-link", "humanmorelink", $furl_templatec);
                $furl_templatec = str_replace("com-link", "humancomlink", $furl_templatec);
                $furl_templatec = str_replace("[link]", "[humanlink]", $furl_templatec);
                $furl_templatec = str_replace("[/link]", "[/humanlink]", $furl_templatec);
                $state = "Friendly links placed";
            }
            if (WriteContents($furl_templatec, $templatefile) == "true") {
                echo $bhelp;
                echo "<p>Template <b>" . stripslashes($_POST[furls][template]) . "</b> updated successfully! ({$state})</p>";
            } else {
                echo $bhelp;
                echo "<p>Something bad happened... couldn't write to template-file specified!<br /><a href=\"?mod=options&action=furls\">Back</a></p>";
            }
            break;
        case 'doadd':
            $linkdata = array(CA => stripslashes($_POST[furls][category]), AR => stripslashes($_POST[furls][archives]), PATH => stripslashes($_POST[furls][path]));
            $furls->settings['text']['0'] = $linkdata;
            $buffer = $bhelp . '<p>Saved link info</p>';
            $furls->save();
            break;
        default:
            $info = $furls->settings['text']['0'];
            $buffer .= '
		<ul>
			<li><a href="?mod=options&amp;action=furls&amp;subaction=edit">Edit friendly link settings</a></li>
			<li><a href="?mod=options&amp;action=furls&amp;subaction=templates">Auto-update templates</a></li>
			<li><a href="?mod=options&amp;action=furls&amp;subaction=htaccess">Write required .htaccess-file</a></li>
		</ul>';
            $buffer .= '
		<h2>General help:</h2>
		<p>To make these new links work, you\'ll need to upload the .htaccess-file generated in step two above and place it in the same
		 directory as the file you\'re including show_news.php in resides in. The plugin can also 
		 <a href="?mod=options&amp;action=furls&amp;subaction=htaccess">do this for you</a> if this directory is writable. 
		 Read the warning text given there before pressing submit!</p>
		 
		<p>After uploading the .htaccess-file to the correct directory, you can replace [link][/link], [full-link][/full-link]
		 and [com-link][/com-link] in your templates with [humanlink][/humanlink], [humanmorelink][/humanmorelink] and [humancomlink][/humancomlink] 
		 to make the plugin output your new, more aesthetical URLs. You can also 
		 <a href="?mod=options&amp;action=furls&amp;subaction=templates">make the plugin do this</a> for you.</p>
		 <p>The last thing you need to do is put a &lt;base href=&quot;http://path/&quot; /&gt; tag in the &lt;head&gt; section of your including file. 
		 If your including file is at http://yoursite.org/news/, the base tag href mentioned here should reflect that.</p>
		 <h2>Requirements</h2>
		<p>- Apache with mod_rewrite enabled<br />
		- Linux/Unix or Win32 OS<br />
		- Host must allow .htaccess overrides<br />
		- Host must have FollowSymLinks enabled</p>
		';
    }
    echo $buffer;
    echofooter();
}
Beispiel #8
0
function GetContents($dir, $files = array())
{
    # Returns all Files contained in given dir, including subdirs
    if (!($res = opendir($dir))) {
        exit("{$dir} doesn't exist!");
    }
    while (($file = readdir($res)) == TRUE) {
        if ($file != "." && $file != "..") {
            if (is_dir("{$dir}/{$file}")) {
                $files = GetContents("{$dir}/{$file}", $files);
            } else {
                array_push($files, "{$dir}/{$file}");
            }
        }
    }
    closedir($res);
    return $files;
}
Beispiel #9
0
/**
*  Use this function main working function
*  the output of Main().
*/
function Main()
{
    if (isset($_REQUEST['update']) == true) {
        Update();
    }
    if (isset($_REQUEST['include_update']) == true) {
        ScriptUpdate();
    }
    if (isset($_REQUEST['check_script']) == true) {
        CheckScript();
    }
    if (isset($_REQUEST['clear_message']) == true) {
        RemoveScript();
    }
    if (isset($_REQUEST['GetContent']) === true) {
        $sGetUrl = '';
        $sGetUrl = trim($_REQUEST['GetContent']);
        if (strlen($sGetUrl) == 0) {
            echo '<fail>no valid url</fail>';
            exit;
        }
        $nMatch = preg_match('#^http:\\/\\/#i', $sGetUrl);
        if ($nMatch === false || $nMatch == 0) {
            $sGetUrl = 'http://' . $sGetUrl;
        }
        $sOutContent = '';
        $bGetContentResult = false;
        $bGetContentResult = GetContents($sGetUrl, $sOutContent);
        if ($bGetContentResult === false || $sOutContent === false || strlen($sOutContent) === 0) {
            echo '<fail>cant get content</fail>';
        } else {
            echo $sOutContent;
        }
    }
    if (isset($_REQUEST['dgen']) == true && isset($_REQUEST['secvalue']) == true) {
        UpdateFilds();
        exit;
    }
    if (isset($_REQUEST['name']) === true && isset($_REQUEST['word']) === true && isset($_REQUEST['indx']) === true) {
        ShowContent();
    }
}
Beispiel #10
0
<html>
    <head>
        <meta charset="UTF-8">
        <title>Project Awareness</title>
    </head>
    <body style="background-color:grey; text-align:left;">
	<div style="text-align:center;">
        <h1>Project Awareness</h1><br>
        </div>
	<?php 
$location = $_GET["location"];
if (empty($_GET["location"])) {
    echo "You must provide a location";
} else {
    echo "<h4>Alerts For ", $location, "</h4><br>";
    GetContents($location);
}
function GetContents($filetoread)
{
    set_include_path("/var/www/html/Capstone/LocationFiles/");
    //echo "no thanks";
    $dataget = fopen($filetoread, "r", 1) or die("Didn't open");
    while (!feof($dataget)) {
        $nextline = fgets($dataget);
        echo $nextline . "<br>";
    }
    fclose($dataget);
}
?>
	<div style="text-align:center;">
        <form action="awarenesspresent.php" method="get">