public function __construct() { $this->Files = $this->core("Files"); $this->Applications_Model = $this->model("Applications_Model"); $this->helper(array("alerts", "html", "forms", "router")); $this->application = $this->Applications_Model->getID(whichApplication()); }
public function getApplicationID($application = NULL) { if (is_null($application)) { $application = whichApplication(); } return $this->Applications_Model->getID($application); }
public function __construct() { $this->Db = $this->db(); $this->helpers(); $this->table = "videos"; $this->language = whichLanguage(); $this->application = whichApplication(); $this->YouTube = $this->library("youtube", "Youtube", NULL, "videos"); $this->Data = $this->core("Data"); }
public function __construct() { $this->app("cpanel"); $this->application = whichApplication(); $this->CPanel = $this->classes("CPanel", "cpanel"); $this->isAdmin = $this->CPanel->load(); $this->vars = $this->CPanel->notifications(); $this->CPanel_Model = $this->model("CPanel_Model"); $this->Templates = $this->core("Templates"); $this->Templates->theme("cpanel"); }
public function __construct() { $this->app("cpanel"); $this->application = whichApplication(); $this->CPanel = $this->classes("CPanel", "cpanel"); $this->isAdmin = $this->CPanel->load(); $this->vars = $this->CPanel->notifications(); $this->helper("applications", "applications"); $this->CPanel_Model = $this->model("CPanel_Model"); $this->Categories_Model = $this->model("Categories_Model"); $this->Templates = $this->core("Templates"); $this->Templates->theme("cpanel"); $this->Model = ucfirst($this->application) . "_Model"; $this->{"{$this->Model}"} = $this->model($this->Model); }
function routePath() { $flag = FALSE; $rsaquo = " ›› "; $path = path(whichApplication()); if (segments() > 0) { for ($i = 0; $i <= segments() - 1; $i++) { if (!$flag) { if (segments() === 6) { $flag = TRUE; $HTML = a(__(_("Home")), PATH("cpanel")) . $rsaquo; $HTML .= a(__(_(ucfirst(segment(2)))), $path . segment(2)) . $rsaquo; $HTML .= a(__(_(ucfirst(segment(3)))), $path . segment(2) . _sh . segment(3)) . $rsaquo; $HTML .= a(__(_(ucfirst(segment(4)))), $path . segment(2) . _sh . segment(3) . _sh . segment(4)) . $rsaquo; $HTML .= a(__(_(ucfirst(segment(5)))), $path . segment(2) . _sh . segment(3) . _sh . segment(4) . _sh . segment(5)); } elseif (segments() === 5) { $flag = TRUE; $HTML = a(__(_("Home"), path("cpanel"))) . $rsaquo; $HTML .= a(__(_(ucfirst(segment(2)))), $path . segment(2)) . $rsaquo; $HTML .= a(__(_(ucfirst(segment(3)))), $path . segment(2) . _sh . segment(3)) . $rsaquo; $HTML .= a(__(_(ucfirst(segment(4)))), $path . segment(2) . _sh . segment(3) . _sh . segment(4)); } elseif (segments() === 4) { $flag = TRUE; $HTML = a(__(_("Home")), path("cpanel")) . $rsaquo; $HTML .= a(__(_(ucfirst(segment(1)))), $path . "cpanel") . $rsaquo; $HTML .= a(__(_(ucfirst(segment(3)))), $path . segment(2) . _sh . segment(3)); } elseif (segments() === 3) { $flag = TRUE; $HTML = a(__(_("Home")), path("cpanel")) . $rsaquo; $HTML .= a(__(_(ucfirst(segment(1)))), $path . segment(3)); } elseif (segments() === 2) { $flag = TRUE; $HTML = a(__(_("Home")), path("cpanel")); } else { $HTML = a(__(_("Home")), path("cpanel")); } } } } return $HTML; }
/** * Loads a view * * @param string $name * @param string $application = NULL * @param string $vars = NULL * @return string value / void */ public function view($name, $vars = NULL, $application = NULL, $return = FALSE) { if (is_null($application)) { $application = whichApplication(); } if (!is_null($application)) { $view = "www/applications/{$application}/views/{$name}.php"; if (is_array($vars)) { $key = array_keys($vars); $size = sizeof($key); for ($i = 0; $i < $size; $i++) { ${$key}[$i] = $vars[$key[$i]]; } } elseif ($vars) { return $view; } if (file_exists($view)) { include $view; if ($return) { $output = ob_get_contents(); ob_end_clean(); return $output; } } else { getException("Error 404: {$view} view not found"); } } else { return FALSE; } }
public function total($trash = FALSE, $singular = "record", $plural = "records", $comments = FALSE) { $primaryKey = $this->Db->table($this->application); if (POST("seek")) { if (POST("field") === "ID") { if (SESSION("ZanUserPrivilegeID") === 1) { $total = $this->Db->countBySQL("{$primaryKey} = '" . POST("search") . "'", $this->application); } else { $total = $this->Db->countBySQL("ID_User = '******' AND {$primaryKey} = '" . POST("search") . "'", $this->application); } } else { if (SESSION("ZanUserPrivilegeID") === 1) { $total = $this->Db->countBySQL("" . POST("field") . " LIKE '%" . POST("search") . "%'", $this->application); } else { $total = $this->Db->countBySQL("ID_User = '******' AND " . POST("field") . " LIKE '%" . POST("search") . "%'", $this->application); } } if ($total === 0) { $total = "0 " . __(_("Records founded")); } elseif ($total === 1) { $total = "1 " . __(_("Record found")); } else { $total = $total . " " . __(_("Records founded")); } return $total; } elseif (!$trash) { if (SESSION("ZanUserPrivilegeID") === 1) { $total = $this->Db->countBySQL("Situation != 'Deleted'", $this->application); } else { $total = $this->Db->countBySQL("ID_User = '******' AND Situation != 'Deleted'", $this->application); } } else { if (SESSION("ZanUserPrivilegeID") === 1) { $total = $this->Db->countBySQL("Situation = 'Deleted'", $this->application); } else { $total = $this->Db->countBySQL("ID_User = '******' AND Situation = 'Deleted'", $this->application); } } if ($comments) { if (whichApplication() === "blog") { $total = $this->Db->countBySQL("ID_Application = '3'", "comments"); } } if ($total === 0) { $total = "0 " . __(_($plural)); } elseif ((int) $total === 1) { $total = "1 " . __(_($singular)); } else { $total = $total . " " . __(_($plural)); } return $total; }
} $ID = isset($data) ? recoverPOST("ID", $data[0]["ID_Ad"]) : 0; $title = isset($data) ? recoverPOST("title", $data[0]["Title"]) : recoverPOST("title"); $banner = isset($data) ? recoverPOST("banner", $data[0]["Banner"]) : NULL; $URL = isset($data) ? recoverPOST("URL", $data[0]["URL"]) : "http://"; $position = isset($data) ? recoverPOST("position", $data[0]["Position"]) : recoverPOST("position"); $code = isset($data) ? recoverPOST("code", $data[0]["Code"]) : recoverPOST("code"); $time = isset($data) ? recoverPOST("time", $data[0]["Time"]) : recoverPOST("time"); $situation = isset($data) ? recoverPOST("situation", $data[0]["Situation"]) : recoverPOST("situation"); $principal = isset($data) ? recoverPOST("principal", $data[0]["Principal"]) : recoverPOST("principal"); $edit = isset($data) ? TRUE : FALSE; $action = isset($data) ? "edit" : "save"; $href = isset($data) ? path(whichApplication() . "cpanel/{$action}/{$ID}/") : path(whichApplication() . "cpanel/add/"); print div("add-form", "class"); print formOpen($href, "form-add", "form-add"); print p(__(_(ucfirst(whichApplication()))), "resalt"); print isset($alert) ? $alert : NULL; print formInput(array("name" => "title", "class" => "span10 required", "field" => __(_("Title")), "p" => TRUE, "value" => $title)); if (isset($banner)) { print __(_("If you change the banner image, this image will be deleted")) . "<br />"; print img(path($banner, TRUE), array("alt" => "Banner", "class" => "no-border", "style" => "max-width: 780px;")); print formInput(array("name" => "banner", "type" => "hidden", "value" => $banner)); } print formInput(array("type" => "file", "name" => "image", "class" => "required", "field" => __(_("Image")), "p" => TRUE)); $options = array(0 => array("value" => "Top", "option" => __(_("Top")) . " (960x100px)", "selected" => $position === "Top" ? TRUE : FALSE), 1 => array("value" => "Left", "option" => __(_("Left")) . " (120x600px, 250x250px)", "selected" => $position === "Left" ? TRUE : FALSE), 2 => array("value" => "Right", "option" => __(_("Right")) . " (120x600px, 250x250px)", "selected" => $position === "Right" ? TRUE : FALSE), 3 => array("value" => "Bottom", "option" => __(_("Bottom")) . " (960x100px)", "selected" => $position === "Bottom" ? TRUE : FALSE), 4 => array("value" => "Center", "option" => __(_("Center")) . " (600x100px)", "selected" => $position === "Center" ? TRUE : FALSE)); print formSelect(array("name" => "position", "class" => "required", "p" => TRUE, "field" => __(_("Position"))), $options); print formInput(array("name" => "URL", "class" => "span10 required", "field" => __(_("URL")), "p" => TRUE, "value" => $URL)); print formTextarea(array("name" => "code", "class" => "span10 required", "style" => "height: 150px;", "field" => __(_("Code")), "p" => TRUE, "value" => $code)); $options = array(0 => array("value" => 1, "option" => __(_("Yes")), "selected" => (int) $principal === 1 ? TRUE : FALSE), 1 => array("value" => 0, "option" => __(_("No")), "selected" => (int) $principal === 0 ? TRUE : FALSE)); print formSelect(array("name" => "principal", "class" => "required", "p" => TRUE, "field" => __(_("Principal"))), $options); $options = array(0 => array("value" => "Active", "option" => __(_("Active")), "selected" => $situation === "Active" ? TRUE : FALSE), 1 => array("value" => "Inactive", "option" => __(_("Inactive")), "selected" => $situation === "Inactive" ? TRUE : FALSE));
public function isAllow($permission = "view", $application = NULL) { if (SESSION("ZanUserPrivilegeID") and !SESSION("ZanUserApplication")) { $this->Applications_Model = $this->model("Applications_Model"); if (is_null($application)) { $application = whichApplication(); } $privilegeID = SESSION("ZanUserPrivilegeID"); $applicationID = $this->Applications_Model->getID($application); if ($this->getPermissions($privilegeID, $applicationID, $permission)) { return TRUE; } else { return FALSE; } } else { return TRUE; } }
function getScript($js, $application = NULL, $extra = NULL, $getJs = FALSE, $external = FALSE) { $HTML = NULL; if (file_exists($js) and !$external) { return loadScript($js); } else { if ($external) { return loadScript($js, $application, TRUE); } elseif (isset($application)) { return loadScript($js, $application); } else { if ($js === "jquery") { return loadScript("www/lib/scripts/js/jquery.js"); } elseif ($js === "checkbox") { $HTML = ' <script type="text/javascript"> function checkAll(idForm) { $("form input:checkbox").attr("checked", "checked"); } function unCheckAll(idForm) { $("form input:checkbox").removeAttr("checked"); } </script>'; } elseif ($js === "external") { $HTML = ' <script type="text/javascript"> $(document).ready(function() { $(function() { $(\'a[rel*=external]\').click(function() { window.open(this.href); return false; }); }); }); </script> <noscript><p class="NoDisplay">' . __("Disable Javascript") . '</p></noscript>'; } elseif ($js === "show-element") { $HTML = ' <script type="text/javascript"> function showElement(obj) { if(obj.className == "no-display") { obj.className = "display"; } else { obj.className = "no-display"; } } </script>'; } elseif ($js === "tiny-mce") { $HTML = loadScript("www/lib/scripts/js/tiny_mce/tiny_mce.js"); $HTML .= '<script type="text/javascript">'; if ($extra === "class") { $HTML .= ' tinyMCE.init({ mode : "textareas", editor_selector : "editor", editor_deselector : "noeditor", theme : "simple" }); '; } elseif ($extra !== "basic") { $HTML .= ' tinyMCE.init({ mode : "exact", elements : "editor", theme : "advanced", skin : "o2k7", cleanup: true, plugins : "videos,advcode,safari,pagebreak,style,advhr,advimage,advlink,emotions,preview,media,fullscreen,template,inlinepopups,advimage,media,paste", theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,bullist,numlist,|,outdent,indent,|,link,unlink,|,videos,image,advcode,|,forecolor,|,charmap,|,pastetext,pasteword,pastetext,fullscreen,pagebreak,preview", theme_advanced_buttons2 : "", theme_advanced_buttons3 : "", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : "bottom", theme_advanced_resizing : false, convert_urls : false, content_CSS : "css/content.css", external_link_list_url : "lists/link_list.js", external_image_list_url : "lists/image_list.js", media_external_list_url : "lists/media_list.js" }); '; } else { $HTML .= ' tinyMCE.init({ mode : "exact", elements : "editor", theme : "simple", editor_selector : "mceSimple" }); '; } $HTML .= ' function insertHTML(content) { parent.tinyMCE.execCommand(\'mceInsertContent\', false, content); } </script>'; } elseif ($js === "upload") { $iPx = POST("iPx") ? POST("iPx") : 'i'; $iPath = POST("iPath") ? POST("iPath") : 'www/lib/files/images/uploaded/'; $iPath = POST($iPx . "Dirbase") ? POST($iPx . "Dirbase") : $iPath; $iPath = POST($iPx . "Make") ? POST($iPx . "Dir") . slug(POST($iPx . "Dirname")) . _sh : $iPath; $dPx = POST("dPx") ? POST("dPx") : "d"; $dPath = POST("dPath") ? POST("dPath") : "www/lib/files/documents/uploaded/"; $dPath = POST($dPx . "Dirbase") ? POST($dPx . "Dirbase") : $dPath; $dPath = POST($dPx . "Make") ? POST($dPx . "Dir") . nice(POST($dPx . "Dirname")) . _sh : $dPath; $application = whichApplication(); ?> <script type="text/javascript"> $(document).on("ready", function() { function uploadResponse(state, file) { var path, insert, ok, error, form, message; path = '<?php print path($iPath, TRUE); ?> ' + file; HTML = '\'<img src=\\\'' + path + '\\\' alt=\\\'' + file + '\\\' />\''; insert = '<li><input name="iLibrary[]" type="checkbox" value="' + path + '" /> <span class="small">00<' + '/span>'; insert = insert + '<a href="' + path + '" rel="external" title="<?php print __(_("Preview")); ?> "><span class="tiny-image tiny-search"> </span><' + '/a>'; insert = insert + '<a class="pointer" onclick="javascript:insertHTML(' + HTML + ');" title="<?php print __(_("Insert image")); ?> "><span class="tiny-image tiny-add"> </span> '; insert = insert + '<span class="bold">' + file + '<' + '/span><' + '/a><' + '/li>'; if(state == 1) { message = '<?php print __(_("The file size exceed the permitted limit")); ?> '; } if(state == 2) { message = '<?php print __(_("An error has ocurred")); ?> '; } if(state == 3) { message = '<?php print __(_("The file type is not permitted")); ?> '; } if(state == 4) { message = '<?php print __(_("A problem occurred when trying to upload file")); ?> '; } if(state == 5) { message = '<?php print __(_("The file already exists")); ?> '; } if(state == 6) { message = '<?php print __(_("Successfully uploaded file")); ?> '; $('#i-add-upload').html = insert + $('#i-add-upload').html; } document.getElementById('i-upload-message').innerHTML = message; } function uploadDocumentsResponse(dState, dFile, dIcon, dAlt) { var dPath, dInsert, dOk, dError, dForm, dMessage, dHTML; dPath = '<?php print path($dPath, TRUE); ?> ' + dFile; dHTML = '\'<a href=\\\'' + dPath + '\\\' title=\\\'' + dFile + '\\\'><img src=\\\'' + dIcon + '\\\' alt=\\\'' + dAlt + '\\\' /></a>\''; dInsert = '<li><input name="dLibrary[]" type="checkbox" value="' + dPath + '" />'; dInsert = dInsert + ' <span class="small">00<' + '/span><a href="' + dPath + '" title="<?php print __(_("Download file")); ?> ">'; dInsert = dInsert + '<span class="tiny-image tiny-file"> </span><' + '/a>'; dInsert = dInsert + '<a class="pointer" onclick="javascript:insertHTML(' + dHTML + ');" title="<?php print __(_("Insert file")); ?> ">'; dInsert = dInsert + '<span class="tiny-image tiny-add"> </span>'; dInsert = dInsert + '<span class="bold">' + dFile + '<' + '/span><' + '/a><' + '/li>'; if(dState == 1) { message = '<?php print __(_("The file size exceed the permitted limit")); ?> '; } if(dState == 2) { message = '<?php print __(_("An error has ocurred")); ?> '; } if(dState == 3) { message = '<?php print __(_("The file type is not permitted")); ?> '; } if(dState == 4) { message = '<?php print __(_("A problem occurred when trying to upload file")); ?> '; } if(dState == 5) { message = '<?php print __(_("The file already exists")); ?> '; } if(dState == 6) { message = '<?php print __(_("Successfully uploaded file")); ?> '; document.getElementById('d-add-upload').innerHTML = dInsert + document.getElementById('d-add-upload').innerHTML; } document.getElementById('d-upload-message').innerHTML = message; } }); </script> <noscript><p class="no-display"><?php print __(_("Disable Javascript")); ?> </p></noscript> <?php return NULL; } elseif ($application) { $HTML = '<script type="text/javascript" language="javascript">' . $js . '</script>'; } return $HTML; } } }
?> <div class="add-form"> <form id="form-add" class="form-add" action="<?php print $href; ?> " method="post" enctype="multipart/form-data"> <fieldset> <legend><?php print __(_("Add Video")); ?> </legend> <p class="resalt"> <?php print __(_(ucfirst(whichApplication()))); ?> </p> <?php print isset($alert) ? $alert : NULL; ?> <?php if ($action == "save") { ?> <p class="field"> » <?php print __(_("URL")); ?> <?php
function getSearch() { global $Load; $Load->helper(array("forms", "html")); $application = whichApplication(); if ($application === "users") { $field = "username"; $name = __(_("Username")); } else { $field = "title"; $name = __(_("Title")); } $fields = array(0 => array("field" => "ID", "name" => "ID", "selected" => FALSE), 1 => array("field" => $field, "name" => $name, "selected" => TRUE)); $trash = NULL; if (segment(3, isLang()) === "trash") { $trash = "trash"; } $HTML = formOpen(path($application . "/cpanel/results/{$trash}"), "form-results-search"); $HTML .= br(); $HTML .= bold(" " . __(_("Search")) . ":", FALSE); $attributes = array("p" => FALSE, "name" => "search", "class" => "span 1 required"); $HTML .= formInput($attributes); $HTML .= bold(" " . __(_("Field")) . ":", FALSE); $i = 0; foreach ($fields as $field) { $fields[$i]["value"] = $field["field"]; $fields[$i]["option"] = $field["name"]; $fields[$i]["selected"] = $field["selected"]; $i++; } $HTML .= formSelect(array("name" => "field", "class" => "span2 required"), $fields); $HTML .= bold(__(_("Order")) . ":", FALSE); $options[0]["value"] = "ASC"; $options[0]["option"] = __(_("Ascending")); $options[0]["selected"] = TRUE; $options[1]["value"] = "DESC"; $options[1]["option"] = __(_("Descending")); $options[1]["selected"] = FALSE; $HTML .= formSelect(array("name" => "order", "class" => "span2 required"), $options); $HTML .= formInput(array("name" => "seek", "type" => "submit", "class" => "btn btn-info", "value" => __(_("Seek")))); return $HTML; }
?> <?php if ($data) { $ID = $data[0]["ID_Feedback"]; $name = $data[0]["Name"]; $email = $data[0]["Email"]; $company = $data[0]["Company"]; $phone = $data[0]["Phone"]; $subject = $data[0]["Subject"]; $message = $data[0]["Message"]; $date = $data[0]["Text_Date"]; $state = $data[0]["Situation"]; $back = path(whichApplication() . _sh . "cpanel" . _sh . "results"); } else { redirect(path(whichApplication() . _sh . "cpanel" . _sh . "results")); } ?> <div class="add-form"> <p class="field"> <strong><?php print __(_("Name")); ?> </strong><br /> <?php print $name; ?> </p> <p class="field">
die("Error: You don't have permission to access here..."); } $ID = isset($data) ? recoverPOST("ID", $data[0]["ID_Post"]) : 0; $ID_URL = isset($data) ? recoverPOST("ID_URL", $data[0]["ID_URL"]) : recoverPOST("ID_URL"); $title = isset($data) ? recoverPOST("title", $data[0]["Title"]) : recoverPOST("title"); $content = isset($data) ? recoverPOST("content", $data[0]["Content"]) : recoverPOST("content"); $situation = isset($data) ? recoverPOST("situation", $data[0]["Situation"]) : recoverPOST("situation"); $language = isset($data) ? recoverPOST("language", $data[0]["Language"]) : recoverPOST("language"); $pwd = isset($data) ? recoverPOST("pwd", $data[0]["Pwd"]) : recoverPOST("pwd"); $edit = isset($data) ? TRUE : FALSE; $action = isset($data) ? "edit" : "save"; $href = isset($data) ? path(whichApplication() . "/cpanel/{$action}/{$ID}/") : path(whichApplication() . "/cpanel/add"); print div("add-form", "class"); print formOpen($href, "form-add", "multimedia"); print p(__(_(ucfirst(whichApplication()))), "resalt"); print isset($alert) ? $alert : NULL; print formInput(array("type" => "file", "id" => "fileselect", "name" => "fileselect[]", "multiple" => "multiple", "class" => "required", "field" => __(_("Upload files")), "p" => TRUE)); print div("filedrag"); print __(_("Drag & drop your files here")); print div(FALSE); print div("progress") . div(FALSE); print div("response") . div(FALSE); print '<div class="clear"></div>'; if ($uploaded) { print formSave($action); } print formInput(array("name" => "upload", "type" => "hidden", "value" => path(whichApplication() . "/cpanel/upload"), "id" => "upload")); print formInput(array("name" => "MAX_FILE_SIZE", "type" => "hidden", "value" => "MAX_FILE_SIZE", "id" => "upload")); print formInput(array("name" => "ID", "type" => "hidden", "value" => $ID, "id" => "ID_Post")); print formClose(); print div(FALSE);
public function view($name, $vars = null, $application = null, $return = false) { if (is_null($application)) { $application = whichApplication(); } if (!is_null($application) and is_string($application) and is_string($name)) { $theme = _get("webTheme"); if (file_exists("www/lib/themes/{$theme}/views/{$application}/{$name}.php")) { $view = "www/lib/themes/{$theme}/views/{$application}/{$name}.php"; $minView = "www/lib/themes/{$theme}/views/{$application}/min/{$name}.php"; } else { $view = "www/applications/{$application}/views/{$name}.php"; $minView = "www/applications/{$application}/views/min/{$name}.php"; } if (_get("environment") > 2 and file_exists($minView)) { $view = $minView; } if (is_array($vars)) { $key = array_keys($vars); $size = sizeof($key); for ($i = 0; $i < $size; $i++) { ${$key}[$i] = $vars[$key[$i]]; } } elseif ($vars) { return $view; } if (file_exists($view)) { ob_start(); include $view; if ($return) { $output = ob_get_contents(); ob_clean(); return $output; } } else { getException("Error 404: {$view} view not found"); } } else { return false; } }
public function __construct() { $this->application = whichApplication(); $this->Videos_Model = $this->model("Videos_Model"); }