Exemplo n.º 1
0
function file_array($path, $exclude = ".|..", $recursive = false)
{
    $path = rtrim($path, "/") . "/";
    $folder_handle = opendir($path);
    $exclude_array = explode("|", $exclude);
    $result = array();
    while (false !== ($filename = readdir($folder_handle))) {
        if (!in_array(strtolower($filename), $exclude_array)) {
            if (is_dir($path . $filename . "/")) {
                if ($recursive) {
                    $result[] = file_array($path, $exclude, true);
                }
            } else {
                $result[] = $filename;
            }
        }
    }
    return $result;
}
Exemplo n.º 2
0
function file_array($thispath, $exclude, $recurse)
{
    global $files, $paths;
    $thispath = rtrim($thispath, "/") . "/";
    $result = array();
    $folder_handle = opendir($thispath);
    while (false !== ($filename = readdir($folder_handle))) {
        if (!in_array(strtolower($filename), $exclude)) {
            if (is_dir($thispath . $filename . "/")) {
                array_push($paths, array($thispath, $filename));
                if ($recurse) {
                    $result[] = file_array($thispath . $filename . "/", $exclude, $recurse);
                }
            } else {
                if (strpos($filename, '.php', 0) > 0 || strpos($filename, '.inc', 0) > 0 || strpos($filename, '.js', 0) > 0) {
                    array_push($files, $thispath . $filename);
                }
            }
        }
    }
    return $result;
}
Exemplo n.º 3
0
/**
 * event_espresso_count_files, does exactly what the name says
 */
function event_espresso_count_files($path, $exclude = ".|..|.svn", $recursive = false)
{
    $result = array();
    $path = rtrim($path, "/") . "/";
    if (is_dir($path)) {
        $folder_handle = opendir($path);
        $exclude_array = explode("|", $exclude);
        while (false !== ($filename = readdir($folder_handle))) {
            if (!in_array(strtolower($filename), $exclude_array)) {
                if (is_dir($path . $filename . "/")) {
                    if ($recursive) {
                        $result[] = file_array($path, $exclude, true);
                    }
                } else {
                    $result[] = $filename;
                }
            }
        }
    }
    //return $result;
    return count($result);
}
Exemplo n.º 4
0
function library_array($path, $exclude, $recursive = false)
{
    $files = file_array($path, $exclude, $recursive);
    $libs = array();
    foreach ($files as $f) {
        $library_src = preg_replace('/[\\n\\r]+/', "\n", file_get_contents(rtrim($path, "/") . "/" . $f));
        preg_match('/^<' . '\\?php[^\\/]*\\/\\*(.+?)\\*\\//sm', $library_src, $library_header);
        $header_data = array('Library' => $f, 'Author' => 'Unknown', 'Version' => '1.0', 'Date' => '', 'Description' => '', 'Requirements' => array());
        if (strlen($library_header[1])) {
            $header_keys = array('Library', 'Author', 'Version', 'Date', 'Description', 'Requirements');
            $header_lines = explode("\n", $library_header[1]);
            $last_key = false;
            foreach ($header_lines as $ln) {
                $ln_kv = explode(':', substr($ln, 3), 2);
                $key = ucwords(strtolower($ln_kv[0]));
                if (in_array($key, $header_keys)) {
                    $header_data[$ln_kv[0]] = trim($ln_kv[1]);
                    $last_key = $key;
                } else {
                    if ($last_key && strlen(trim($ln)) > 0) {
                        $header_data[$last_key] .= substr($ln, 3) . ' ';
                    }
                }
            }
            if (strlen($header_data['Requirements'])) {
                $reqs = explode(',', $header_data['Requirements']);
                foreach ($reqs as &$req) {
                    $req = trim($req);
                }
                $header_data['Requirements'] = $reqs;
            }
        }
        $libs[$f] = $header_data;
    }
    return $libs;
}
Exemplo n.º 5
0
<?php

include 'functions.php';
$files = array_flatten(file_array());
$s = 0;
$m = count($files);
while ($s < $m) {
    $new_name_ = str_replace('./', '', $files[$s]);
    $new_name_ = substr($new_name_, -(strlen($new_name_) - strrpos($new_name_, '/') - 1));
    $new_name_ = substr($new_name_, 0, 7);
    if ($new_name_ == 'tumblr_') {
        $tumblr_[] = $files[$s];
    }
    $s++;
}
if (!isset($tumblr_)) {
    echo 'No images to move.';
} else {
    $i = 0;
    $k = count($tumblr_);
    while ($i < $k) {
        $old_name = str_replace('./', '', $tumblr_[$i]);
        $new_name = str_replace('./', '', $tumblr_[$i]);
        $new_name = substr($new_name, -(strlen($new_name) - strrpos($new_name, '/') - 1));
        rename('D:/wamp/www/files/' . $old_name, "D:/wamp/www/imgs/" . $new_name);
        $i++;
    }
}
Exemplo n.º 6
0
<?php

include '../include.php';
$result = db_table('SELECT
	u.id link,
	u.firstname,
	u.lastname,
	u.title,
	d.departmentName department,
	o.title organization,
	u.email,
	(SELECT CASE WHEN u.rankID = 9 THEN "No" ELSE "Yes" END) is_staff
	FROM users u
	LEFT JOIN departments d ON u.departmentID = d.departmentID
	JOIN organizations o ON u.organization_id = o.id
	WHERE u.is_active = 1
	ORDER BY u.lastname, u.firstname');
foreach ($result as &$r) {
    $r['link'] = draw_link(url_base() . '/staff/view.php?id=' . $r['link'], $r['link']);
}
file_array($result, 'employees');
Exemplo n.º 7
0
 function file_array($path, $exclude = ".|..", $include = '*.nup')
 {
     $path = rtrim($path, "/") . "/";
     $folder_handle = opendir($path);
     $exclude_array = explode("|", $exclude);
     $result = array();
     while (false !== ($filename = readdir($folder_handle))) {
         if (!in_array(strtolower($filename), $exclude_array)) {
             if (is_dir($path . $filename . "/")) {
                 $result = array_merge($result, file_array($path . $filename, $exclude, $include));
             } else {
                 if (preg_match('`^' . strtr(preg_quote($include, '`'), array('\\*' => '.*?', '\\?' => '.')) . '$`i', $filename)) {
                     $result[] = $path . $filename;
                 }
             }
         }
     }
     return $result;
 }
function simplevisitorcounter_options()
{
    ?>
    <div class="wrap">
        <div id="icon-options-general" class="icon32"><br></div>
    <h2>Visitor Counter Settings</h2>

    <form method="post" action="options.php">
        <?php 
    settings_fields('wp-better-categories-group');
    ?>
        <?php 
    $data = file_array(WP_CONTENT_DIR . '/plugins/wp-better-categories/styles/');
    foreach ($data as $parent_folder => $records) {
        foreach ($records as $style_folder => $style_records) {
            foreach ($style_records as $style => $test) {
                preg_match('/styles\\/(.*?)\\/(.*?)\\//', $test, $match);
                $groups[$match[1]][] = $match[2];
            }
        }
    }
    ?>
        <h3>Basic Settings</h3>
        <table class="form-table">
            <tr valign="top">
            <th scope="row">Set visitor counter to</th>
            <td><input type="text" name="simplevisitorcounter_data" value="<?php 
    echo get_option('simplevisitorcounter_data');
    ?>
" /></td>
            </tr>
            <tr valign="top">
            <th scope="row">Exclude IP addresses from stats (one per line)</th>
            <td><textarea name="simplevisitorcounter_exclude_ips" rows="4" cols="20"><?php 
    echo get_option('simplevisitorcounter_exclude_ips');
    ?>
</textarea></td>
            </tr>
            <tr valign="top">
            <th scope="row">Display Visitor Counter in Footer</th>
            <td><input type="checkbox" name="simplevisitorcounter_display_footer" value="1" <?php 
    echo checked('1', get_option('simplevisitorcounter_display_footer'));
    ?>
 /></td>
            <tr valign="top">
            <th scope="row">Counter Alignment (left, right, center, none)?</th>
            <td>
                <select name="simplevisitorcounter_align">
                    <option value="">None</option>
                    <option <?php 
    if (get_option('simplevisitorcounter_align') === 'left') {
        echo 'selected';
    }
    ?>
>left</option>
                    <option <?php 
    if (get_option('simplevisitorcounter_align') === 'center') {
        echo 'selected';
    }
    ?>
>center</option>
                    <option <?php 
    if (get_option('simplevisitorcounter_align') === 'right') {
        echo 'selected';
    }
    ?>
>right</option>
                </select>
            </td>
            </tr>
            <tr valign="top">
            <th scope="row">Count visits from wp-admin?</th>
            <td><input type="checkbox" name="simplevisitorcounter_count_admin" value="1" <?php 
    echo checked('1', get_option('simplevisitorcounter_count_admin'));
    ?>
 /></td>
            </tr>
            <tr valign="top">
            <th scope="row">Count 404 pages as visits?</th>
            <td><input type="checkbox" name="simplevisitorcounter_count_404" value="1" <?php 
    echo checked('1', get_option('simplevisitorcounter_count_404'));
    ?>
 /></td>
            </tr>
            <tr valign="top">
            <th scope="row">Pad with zeros? ('000281' rather than default '281')</th>
            <td><input type="checkbox" name="simplevisitorcounter_pad_zeros" value="1" <?php 
    echo checked('1', get_option('simplevisitorcounter_pad_zeros'));
    ?>
 /></td>
            </tr>
            <tr valign="top">
            <th scope="row">Count only unique visitors? (resets every 24h)</th>
            <td><input type="checkbox" name="simplevisitorcounter_count_only_unique" value="1" <?php 
    echo checked('1', get_option('simplevisitorcounter_count_only_unique'));
    ?>
 /></td>
            </tr>
        </table>
        <br/><br/>
        <h3>Counter Styles</h3>
        <?php 
    foreach ($groups as $style_name => $style) {
        ?>
<h3>Style: <?php 
        echo $style_name;
        ?>
</h3>
<table class="form-table">
    <?php 
        foreach ($style as $name) {
            ?>
                	<tr>
                		<td>
                		<input type="radio" id="img1" name="simplevisitorcounter_style" value="<?php 
            echo $style_name . '/' . $name;
            ?>
" <?php 
            echo checked($style_name . '/' . $name, get_option('simplevisitorcounter_style'));
            ?>
 />
                		<img src='<?php 
            echo WP_PLUGIN_URL;
            ?>
/wp-better-categories/styles/<?php 
            echo $style_name . '/' . $name . '/';
            ?>
0.gif'>
                		<img src='<?php 
            echo WP_PLUGIN_URL;
            ?>
/wp-better-categories/styles/<?php 
            echo $style_name . '/' . $name . '/';
            ?>
1.gif'>
                		<img src='<?php 
            echo WP_PLUGIN_URL;
            ?>
/wp-better-categories/styles/<?php 
            echo $style_name . '/' . $name . '/';
            ?>
2.gif'>
                		<img src='<?php 
            echo WP_PLUGIN_URL;
            ?>
/wp-better-categories/styles/<?php 
            echo $style_name . '/' . $name . '/';
            ?>
3.gif'>
                		<img src='<?php 
            echo WP_PLUGIN_URL;
            ?>
/wp-better-categories/styles/<?php 
            echo $style_name . '/' . $name . '/';
            ?>
4.gif'>
                		</td>
                	</tr>
                    <?php 
        }
        ?>
</table>
<hr/>
<?php 
    }
    ?>
        <p class="submit">
        <input type="submit" class="button-primary" value="<?php 
    _e('Save Changes');
    ?>
" />
        </p>
    </form>
    </div>
    <?php 
}
Exemplo n.º 9
0
<?php

include "include.php";
$report = array();
$result = db_query("SELECT \n\t\tISNULL(u.nickname, u.firstname) 'Helpdesk Admin',\n\t\t(SELECT COUNT(*) FROM helpdesk_tickets t WHERE t.ownerID = u.id AND " . db_datediff("t.created_date", "t.closed_date") . " <= 1) 'Under Day',\n\t\t(SELECT COUNT(*) FROM helpdesk_tickets t WHERE t.ownerID = u.id AND " . db_datediff("t.created_date", "t.closed_date") . " <= 7 AND " . db_datediff("t.created_date", "t.closed_date") . " > 1) 'Under Week',\n\t\t(SELECT COUNT(*) FROM helpdesk_tickets t WHERE t.ownerID = u.id AND " . db_datediff("t.created_date", "t.closed_date") . " <= 30 AND " . db_datediff("t.created_date", "t.closed_date") . " > 7) 'Under Month',\n\t\t(SELECT COUNT(*) FROM helpdesk_tickets t WHERE t.ownerID = u.id AND " . db_datediff("t.created_date", "t.closed_date") . " > 30) 'Over Month'\n\tFROM users u\n\tWHERE u.departmentid = 8 AND ((SELECT COUNT(*) FROM users_to_modules a WHERE a.module_id = 3 AND a.user_id = u.id) > 0)\n\tORDER BY ISNULL(u.nickname, u.firstname)");
while ($r = db_fetch($result)) {
    $report[] = $r;
}
echo file_array($report, "Admins by Age");
Exemplo n.º 10
0
include "include.php";
//initialize variables
$report = array();
$columns = array();
$break = false;
$thismonth = $total["month"];
$thisyear = $total["year"];
//loop through
while (!$break) {
    $columns[] = "(SELECT COUNT(*) FROM helpdesk_tickets t WHERE t.type_id = y.id AND MONTH(t.created_date) = {$thismonth} AND YEAR(t.created_date) = {$thisyear}) '" . $mos[$thismonth - 1] . " " . $thisyear . "'";
    if ($thismonth == $month && $thisyear == $year) {
        //if we're up to the current month & year, break
        $break = true;
    } else {
        //otherwise increment for next loop
        if ($thismonth == 12) {
            $thismonth = 1;
            $thisyear++;
        } else {
            $thismonth++;
        }
    }
}
//execute query we just built
$result = db_query("SELECT y.description, " . implode(", ", $columns) . " FROM helpdesk_tickets_types y WHERE y.departmentID = {$departmentID} ORDER BY y.description");
while ($r = db_fetch($result)) {
    $report[] = $r;
}
echo file_array($report, "Types Report");
Exemplo n.º 11
0
<?php

session_start();
?>
<html>
<head>
<title><?php 
echo $_SESSION['number'];
?>
</title>
</head>
<?php 
include 'functions.php';
$files = array_flatten(file_array('images'));
$count = count($files);
$i = 1;
while ($i <= $count) {
    rename('D:/wamp/www/idk/' . $files[$i], 'D:/wamp/www/idk/pngs/' . substr($files[$i], 7) . '.png');
    $i++;
}
Exemplo n.º 12
0
include "include.php";
//initialize variables
$report = array();
$columns = array();
$break = false;
$thismonth = $total["month"];
$thisyear = $total["year"];
//loop through
while (!$break) {
    $columns[] = "(SELECT COUNT(*) FROM helpdesk_tickets t WHERE t.ownerID = u.id AND MONTH(t.created_date) = {$thismonth} AND YEAR(t.created_date) = {$thisyear}) '" . $mos[$thismonth - 1] . " " . $thisyear . "'";
    if ($thismonth == $month && $thisyear == $year) {
        //if we're up to the current month & year, break
        $break = true;
    } else {
        //otherwise increment for next loop
        if ($thismonth == 12) {
            $thismonth = 1;
            $thisyear++;
        } else {
            $thismonth++;
        }
    }
}
//execute query we just built
$result = db_query("SELECT ISNULL(u.nickname, u.firstname) 'Helpdesk Admin', " . implode(", ", $columns) . " FROM users u WHERE u.departmentID = {$departmentID} AND (SELECT COUNT(*) FROM users_to_modules a WHERE a.user_id = u.id AND a.module_id = 3) > 0 ORDER BY ISNULL(u.nickname, u.firstname)");
while ($r = db_fetch($result)) {
    $report[] = $r;
}
echo file_array($report, "Admins Report");
Exemplo n.º 13
0
function file_array($path, $exclude)
{
    global $files;
    $path = rtrim($path, "/") . "/";
    $result = array();
    $folder_handle = opendir($path);
    while (false !== ($filename = readdir($folder_handle))) {
        if (!in_array(strtolower($filename), $exclude)) {
            if (is_dir($path . $filename . "/")) {
                $result[] = file_array($path . $filename . "/", $exclude);
            } else {
                array_push($files, $path . $filename);
            }
        }
    }
    return $result;
}