Example #1
0
function GetPath($path)
{
    $fullPath = system\Helper::arcGetPath(true) . "assets/" . $path . "/";
    $webPath = system\Helper::arcGetPath() . "assets" . $path;
    $files = scandir($fullPath);
    $html = "";
    foreach ($files as $file) {
        if ($file != "." && $file != "..") {
            $html .= "<tr>" . "<td style=\"width: 10px;\"><input type=\"checkbox\" id=\"{$file}\" onchange=\"mark('{$path}/{$file}')\"><label for=\"{$file}\"></label></td>";
            if (is_dir($fullPath . $file)) {
                // folder
                $fi = new FilesystemIterator($fullPath . $file, FilesystemIterator::SKIP_DOTS);
                $html .= "<td><i class=\"fa fa-folder-o\"></i> <a class=\"clickable\" onclick=\"getFolderPath('{$path}/{$file}')\">{$file}</a></td>" . "<td style=\"width: 10px;\">folder</td>" . "<td style=\"width: 10px;\">-</td>" . "<td style=\"width: 100px;\">" . iterator_count($fi) . ngettext(" item", " items", iterator_count($fi)) . "</td>" . "<td style=\"width: 100px;\">" . date("d M Y", filectime($fullPath . $file)) . "</td>";
            } else {
                // get file type
                $finfo = finfo_open(FILEINFO_MIME_TYPE);
                $filetype = finfo_file($finfo, $fullPath . $file);
                finfo_close($finfo);
                // file
                $html .= "<td><i class=\"" . GetFileTypeIcon($filetype) . "\"></i> <a class=\"clickable\" onclick=\"viewFile('{$webPath}/{$file}', '{$filetype}', '" . FileSizeConvert(filesize($fullPath . $file)) . "', '" . date("d M Y", filectime($fullPath . $file)) . "')\">{$file}<a/></td>" . "<td style=\"width: 10px;\">{$filetype}</td>" . "<td style=\"width: 10px;\"><a alt=\"Copy link to clipboard\" class=\"clickable\" onclick=\"copyToClipboard('{$webPath}/{$file}')\"><i class=\"fa fa-link\"></i></a></td>" . "<td style=\"width: 100px;\">" . FileSizeConvert(filesize($fullPath . $file)) . "</td>" . "<td style=\"width: 100px;\">" . date("d M Y", filectime($fullPath . $file)) . "</td>";
            }
            $html .= "</tr>";
        }
    }
    // no files
    if (count($files) == 2) {
        $html .= "<tr><td colspan=\"4\" class=\"text-center\">Folder is empty.</td></tr>";
    }
    return $html;
}
Example #2
0
?>
</div>
        <div class="error-description">
            <?php 
switch (system\Helper::arcGetPostData("error")) {
    case "404":
        echo "The resource you're looking for cannot be found.<br />\n                <br />Request URL:" . system\Helper::arcGetPostData("path");
        break;
    case "403":
        echo "You do not have permission to access this resource.";
        break;
    case "401":
        echo "Your session has expired. Please login and try again.";
        break;
    case "419":
        echo "Your authentication has expired. Please <a href=\"" . system\Helper::arcGetPath() . "login" . "\">login</a>.";
        break;
    default:
        echo "Unhandled error occured: " . system\Helper::arcGetPostData("error");
        break;
}
?>
        </div>
        <div class="error-goback-text">Would you like to go home?</div>
        <div class="error-goback-button"><a id="btnHome" class="btn btn-xl btn-primary">Let's go home</a></div>
        <div class="footer">{{arc:sitetitle}}</div>
    </div>
</div>


Example #3
0
<?php

$menus = system\Helper::arcGetMenu();
$path = system\Helper::arcGetPath();
$html = "<ul class=\"sidebar-elements\"><li class=\"divider\">Menu</li>";
foreach ($menus as $grandfather => $parent) {
    if (count($parent) == 1) {
        // only one item in this menu.
        foreach ($parent as $child => $data) {
            $html .= "<li><a href=\"" . $path . $data["url"] . "\"><i class=\"{$data["icon"]}\"></i> <span>{$data["name"]}</span></a></li>";
        }
    } else {
        // multi items in this menu.
        $submenu = "";
        $subicon = "";
        foreach ($parent as $child => $data) {
            $submenu .= "<li><a href=\"" . $path . $data["url"] . "\">";
            if ($data["icon"] != "") {
                $submenu .= "<i class=\"{$data["icon"]}\"></i> ";
            }
            $submenu .= "{$data["name"]}</a></li>";
            // use the first icon we have for the parent icon.
            if ($subicon == "" && $data["icon"] != "") {
                $subicon = $data["icon"];
            }
        }
        $html .= "<li class=\"parent\">" . "<a href=\"#\">";
        if ($subicon != "") {
            $html .= "<i class=\"{$subicon}\"></i> ";
        }
        $html .= "{$grandfather}</a>" . "<ul class=\"sub-menu\">{$submenu}</ul>" . "</li>";
     Log::createLog("danger", "user", "File exceeds size limit.");
     return;
 }
 $file_type = $_FILES['file']['type'];
 Log::createLog("info", "user", "Type: " . $_FILES['file']['type']);
 // manage file types not allowed here.
 if ($file_type != "image/jpeg" && $file_type != "image/jpg" && $file_type != "image/gif" && $file_type != "image/png") {
     system\Helper::arcAddMessage("danger", "Invalid image type, requires JPEG, JPG, GIF or PNG");
     Log::createLog("danger", "user", "Invalid image type.");
     return;
 }
 $name = $_FILES["file"]["name"];
 $ext = end(explode(".", $name));
 # extra () to prevent notice
 $filename = uniqid() . "." . $ext;
 $path = system\Helper::arcGetPath(true) . "assets/profile";
 $destination = $path . "/" . $filename;
 if (!file_exists($path)) {
     mkdir($path);
 }
 Log::createLog("info", "user", "Destination: '" . $destination . "'");
 $location = $_FILES["file"]["tmp_name"];
 $size = filesize($location);
 if ($size == 0) {
     system\Helper::arcAddMessage("danger", "Invalid file uploaded");
     Log::createLog("danger", "user", "Invalid file size.");
     return;
 }
 move_uploaded_file($location, $destination);
 $profileImage = SystemSetting::getByKey("ARC_USER_IMAGE", system\Helper::arcGetUser()->id);
 $profileImage->userid = system\Helper::arcGetUser()->id;
Example #5
0
<?php

if (system\Helper::arcIsAjaxRequest()) {
    $folder = strtolower($_POST["name"]);
    $destination = system\Helper::arcGetPath(true) . "assets" . $_POST["path"];
    if (substr($destination, -1) != "/") {
        $destination .= "/";
    }
    $destination .= $folder;
    if (!file_exists($destination)) {
        mkdir($destination);
    }
    system\Helper::arcAddMessage("success", "Folder Created");
}
Example #6
0
?>
            </div>

        </fieldset>        
    </div>
</div>

<div class="text-right">
    <a id="btnSaveSettings" class="btn btn-primary"><i class="fa fa-save"></i> Save</a>
</div>


<div class="modal fade" id="mediaManager" tabindex="-1" role="dialog">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">Media Manager</h4>
            </div>
            <div class="modal-body">
                <iframe style="width: 100%; height: 500px; border: 0;" src="<?php 
echo system\Helper::arcGetPath() . $media->value;
?>
"></iframe>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal" onclick="$('#contentViewer').html('');">Close</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
Example #7
0
<?php

$user = system\Helper::arcGetUser();
$profileImage = SystemSetting::getByKey("ARC_USER_IMAGE", $user->id);
$image = "<i class=\"fa fa-user fa-5x\"></i>";
if (!empty($profileImage->value)) {
    $image = "<img class=\"img-responsive img-thumbnail\" src=\"" . system\Helper::arcGetPath() . "assets/profile/" . $profileImage->value . "\" />";
}
$company = SystemSetting::getByKey("ARC_REQUIRECOMPANY");
?>

<div class="panel panel-default">
    <div class="panel-body">
        <div class="row">
            <div class="col-md-8">
                <form id="detailsForm">
                    <div class="form-group">
                        <label for="firstname">Firstname</label>
                        <input type="firstname" class="form-control" name="firstname" maxlength="50" placeholder="Firstname" value="<?php 
echo $user->firstname;
?>
">
                    </div>
                    <div class="form-group">
                        <label for="lastname">Lastname</label>
                        <input type="lastname" class="form-control" name="lastname" maxlength="50" placeholder="Lastname" value="<?php 
echo $user->lastname;
?>
">
                    </div>
                    <?php 
Example #8
0
            Log::createLog("info", "arc", "Valid image type detected.");
            //$name = md5(uniqid(rand(), true));
            //$ext = explode('.', $_FILES['file']['name']);
            //$filename = $name . '.' . $ext[1];
            $filename = $_FILES['file']['name'];
            // force lowercase names
            $filename = strtolower($filename);
            $destination = system\Helper::arcGetPath(true) . "assets/pagemanager/" . $filename;
            if (!file_exists(system\Helper::arcGetPath(true) . "assets/pagemanager")) {
                mkdir(system\Helper::arcGetPath(true) . "assets/pagemanager");
            }
            Log::createLog("info", "arc", "Destination: '" . $destination . "'");
            $location = $_FILES["file"]["tmp_name"];
            Log::createLog("info", "arc", "Source: '" . $location . "'");
            $size = getimagesize($location);
            Log::createLog("info", "arc", "Size: " . $size[0]);
            if ($size == 0) {
                system\Helper::arcAddMessage("danger", "Invalid image uploaded");
                Log::createLog("danger", "arc", "Invalid image size.");
                return;
            }
            move_uploaded_file($location, $destination);
            Log::createLog("info", "arc", "Image moved to image folder.");
            system\Helper::arcReturnJSON(["path" => system\Helper::arcGetPath() . "assets/pagemanager/" . $filename]);
            Log::createLog("success", "arc", "Upload complete.");
        } else {
            Log::createLog("danger", "arc", "Upload error " . $_FILES['file']['error']);
            system\Helper::arcAddMessage("danger", "Error occured while uploading image");
        }
    }
}
Example #9
0
<?php

system\Helper::arcAddFooter("js", system\Helper::arcGetModulePath() . "js/pagemanager.js");
//summernote
system\Helper::arcAddFooter("js", system\Helper::arcGetPath() . "js/codemirror/codemirror.js");
system\Helper::arcAddFooter("js", system\Helper::arcGetPath() . "js/codemirror/xml.js");
system\Helper::arcAddFooter("js", system\Helper::arcGetPath() . "js/summernote.min.js");
system\Helper::arcAddHeader("css", system\Helper::arcGetPath() . "css/codemirror/codemirror.css");
system\Helper::arcAddHeader("css", system\Helper::arcGetPath() . "css/codemirror/monokai.css");
system\Helper::arcAddHeader("css", system\Helper::arcGetPath() . "css/summernote.css");
Example #10
0
     system\Helper::arcAddMessage("danger", "File size exceeds limit");
     Log::createLog("danger", "mediamanager", "File exceeds size limit.");
     return;
 }
 $file_type = $_FILES['file']['type'];
 Log::createLog("info", "arc", "Type: " . $_FILES['file']['type']);
 // manage file types not allowed here.
 if ($file_type == "application/octet-stream" || $file_type == "text/html" || $file_type == "application/x-msdownload") {
     system\Helper::arcAddMessage("danger", "This type of file is not allowed. ({$file_type})");
     Log::createLog("danger", "mediamanager", "Blocked file type: {$file_type}");
     return;
 }
 $filename = $_FILES['file']['name'];
 // force lowercase names
 $filename = strtolower($filename);
 $path = system\Helper::arcGetPath(true) . "assets" . $_POST["path"];
 $destination = $path . "/" . $filename;
 if (!file_exists($path)) {
     mkdir($path);
 }
 Log::createLog("info", "mediamanager", "Destination: '" . $destination . "'");
 $location = $_FILES["file"]["tmp_name"];
 Log::createLog("info", "mediamanager", "Source: '" . $location . "'");
 $size = filesize($location);
 Log::createLog("info", "mediamanager", "Size: " . $size[0]);
 if ($size == 0) {
     system\Helper::arcAddMessage("danger", "Invalid file uploaded");
     Log::createLog("danger", "mediamanager", "Invalid file size.");
     return;
 }
 move_uploaded_file($location, $destination);
Example #11
0
 /**
  * 
  * @param string $from Sender, left null to use system setting.
  * @param string/array $to To, format as 'Firstname Lastname' <*****@*****.**> or email address only.
  * @param string/array $cc CC, format as 'Firstname Lastname' <*****@*****.**> or email address only.
  * @param string $subject String message subject.
  * @param string $message Message body, html or plain text.
  * @param boolean $html True for html body, false for plain.
  * @return boolean True/False depending is the operation was completed.
  */
 public function Send($to = array(), $subject, $message, $html = true, $from = null, $cc = array())
 {
     if ($html == true) {
         $theme = SystemSetting::getByKey("ARC_THEME");
         if (file_exists(system\Helper::arcGetPath(true) . "themes/" . $theme->value . "/email.php")) {
             $content = file_get_contents(system\Helper::arcGetPath(true) . "themes/" . $theme->value . "/email.php");
             $message = system\Helper::arcParseEmail($content, $message);
         }
     }
     Log::createLog("info", "arcmail", "Send email request, mode: " . $this->mode);
     // Set from details
     if ($from == null) {
         $from = $this->data["sender"];
     }
     // Build to list
     if (!is_array($to)) {
         $list = array();
         $list[] = $to;
         $to = $list;
     }
     // Build to list
     if (!is_array($cc)) {
         $list = array();
         $list[] = $cc;
         $cc = $list;
     }
     // Build Mail Header
     $headers = "MIME-Version: 1.0\r\n";
     if ($html == true) {
         // Html content
         $headers .= "Content-Type: text/html; charset=iso-8859-1\r\n";
     } else {
         // Plain test
         $headers .= "Content-Type: text/plain;\r\n";
     }
     Log::createLog("info", "arcmail", "Mail headers built");
     switch ($this->mode) {
         case "MAIL":
             // Add from header
             $headers .= "From: " . $from . "\r\n";
             // Build recipients list
             $toList = "";
             foreach ($to as $recipient) {
                 $toList .= $recipient . ", ";
             }
             $toList = substr($toList, 0, -2);
             Log::createLog("success", "arcmail", "PHP mail created.");
             // Send mail
             mail($toList, $subject, $message, $headers);
             Log::createLog("success", "arcmail", "PHP mail sent.");
             break;
         case "SMTP":
             include system\Helper::arcGetPath(true) . "app/classes/PHPMailer/PHPMailerAutoload.php";
             $mail = new PHPMailer();
             $mail->isSMTP();
             $mail->Host = $this->data["server"];
             if (empty($this->data["username"]) && empty($this->data["password"])) {
                 $mail->SMTPAuth = false;
             } else {
                 $mail->SMTPAuth = true;
                 $mail->Username = $this->data["username"];
                 $smtp_password = system\Helper::arcDecrypt($this->data["password"]);
                 $mail->Password = $smtp_password;
             }
             $mail->setFrom($from);
             foreach ($to as $email) {
                 $mail->addAddress($email);
             }
             foreach ($cc as $email) {
                 $mail->addCC($email);
             }
             $mail->isHTML($html);
             $mail->Subject = $subject;
             $mail->Body = $message;
             if (!$mail->send()) {
                 Log::createLog("danger", "arcmail", "SMTP: " . $mail->ErrorInfo);
             } else {
                 Log::createLog("success", "arcmail", "SMTP: Message sent");
             }
             break;
     }
 }
Example #12
0
<?php

if (system\Helper::arcIsAjaxRequest()) {
    $marked = json_decode($_POST['items']);
    $path = system\Helper::arcGetPath() . "assets";
    $links = "";
    foreach ($marked as $item) {
        $links .= $path . $item . "\n\r";
    }
    system\Helper::arcReturnJSON(["links" => $links]);
}
Example #13
0
}
?>
                                </select>
                                <span class="input-group-btn"><a class="btn btn-primary btn-block" id="insertModule">Insert</a></span>
                            </div>
                        </div>
                    </div>

                    <div class="col-md-6">
                        <div class="form-group">
                            <div class="input-group">
                                <span class="input-group-addon">Theme</span>
                                <select id="theme" class="form-control">
                                    <option value="none">No Override</option>
                                    <?php 
$themes = scandir(system\Helper::arcGetPath(true) . "themes");
foreach ($themes as $theme) {
    if ($theme != "." && $theme != "..") {
        echo "<option value=\"{$theme}\">{$theme}</option>";
    }
}
?>
                                </select>
                            </div>
                        </div>
                    </div>
                </div>

            </div>
            <!-- Properties Panel /-->
            <div role="tabpanel" class="tab-pane" id="pageproperties">
Example #14
0
        error_reporting(0);
        ini_set('display_errors', 0);
        break;
    default:
        die("Unknown debug setting in Config.php");
        break;
}
// Include and initilise helper class.
require_once "app/system/Initialiser.php";
require_once "app/system/Helper.php";
system\Helper::Init();
// Check the assets directory exists and create it if not.
if (!file_exists(system\Helper::arcGetPath(true) . "assets")) {
    echo "<div class=\"alert alert-warning\">Assets directory not found. Arc will try to create it.</div>";
    try {
        mkdir(system\Helper::arcGetPath(true) . "assets");
        echo "<div class=\"alert alert-success\">Assets directory created.</div>";
    } catch (Exception $ex) {
        echo "<div class=\"alert alert-danger\">Unable to create assets directory. Error: " . $e->getMessage() . "</div>";
    }
}
// Setup autoloader.
spl_autoload_register(function ($class) {
    if (file_exists("app/classes/{$class}.class.php")) {
        require_once "app/classes/{$class}.class.php";
    } elseif (file_exists("app/classes/modules/{$class}.class.php")) {
        require_once "app/classes/modules/{$class}.class.php";
    }
});
// Initialiser
system\Initialiser::Init();
Example #15
0
<?php

if (system\Helper::arcIsAjaxRequest()) {
    // Arc logs
    $logs = Log::getLogs();
    foreach ($logs as $log) {
        $log->delete($log->id);
    }
    //PHP logs
    $path = system\Helper::arcGetPath(true) . ini_get('error_log');
    if (file_exists($path)) {
        unlink($path);
    }
    system\Helper::arcAddMessage("success", "Logs purged");
}
Example #16
0
                <?php 
        break;
    case "403":
        ?>
                You do not have permission to access this resource.<br />
                <?php 
        break;
    case "401":
        ?>
                Your session has expired. Please login and try again.<br />
                <?php 
        break;
    case "419":
        ?>
                Your authentication has expired. Please <a href="<?php 
        echo system\Helper::arcGetPath() . "login";
        ?>
">login</a>.<br />
                <?php 
        break;
    default:
        echo "Unhandled error occured: " . system\Helper::arcGetPostData("error");
        break;
}
?>
    </p>
</div>