Пример #1
0
function resetPassword($ticket, $emailAddress, $newPassword)
{
    //Create query
    $databaseQuery = "SELECT * FROM login WHERE emailAddress='{$emailAddress}'";
    //Execute Database query
    $result = executeDatabase($databaseQuery);
    //Fetch array
    while ($row = mysqli_fetch_array($result)) {
        //Create ticket based off database
        $hash = $row['hash'];
        $password = $row['password'];
        $checkTicket = $hash . $password;
        if ($checkTicket == $ticket) {
            //Clean query input
            $con = createInstance();
            $emailAddress = $con->real_escape_string($emailAddress);
            $newPassword = saltPassword($newPassword);
            $databaseQuery = "UPDATE login SET password='******' WHERE emailAddress='{$emailAddress}'";
            executeDatabase($databaseQuery);
            print 'reset';
        } else {
            print 'brequest';
        }
    }
}
Пример #2
0
 private function callController()
 {
     if ($this->controller != null) {
         $controller = $this->controller;
         if (class_exists($controller)) {
             $controller_object = createInstance($controller, $this->params);
             if ($this->middle_ware) {
                 $controller_object->middleware = $this->middle_ware;
             }
             if ($controller_object->controller === null) {
                 $controller_object->controller = $this->controller;
             }
             $controller_object->action = $this->action;
             $controller_object->params = $this->params;
             ob_start();
             call_user_func_array([$controller_object, '_remap'], $controller_object->params);
             if (is_callable([$controller_object, $controller_object->action])) {
                 call_user_func_array([$controller_object, $controller_object->action], $controller_object->params);
             } else {
                 $this->error->throwError('controller method not exist', $controller_object->action, $controller);
             }
             $output = ob_get_clean();
             call_user_func_array([$controller_object, '_output'], array($output));
         } else {
             $this->error->throwError('controller not exist', $controller);
         }
     }
     return $this;
 }
Пример #3
0
 protected final function loadHelper($file)
 {
     if (is_array($file)) {
         foreach ($file as $keyval) {
             $class = "User\\Helpers\\" . $keyval;
             $this->{$keyval} = createInstance($class);
         }
     } else {
         $class = "User\\Helpers\\" . $file;
         $this->{$file} = createInstance($class);
     }
     return $this;
 }
Пример #4
0
 public function __construct()
 {
     $this->router = new \AltoRouter();
     $route_instance = createInstance('App\\Routes');
     $match_types = $route_instance->match_types;
     $routes = $route_instance->routes;
     if ($this->basePath()) {
         $this->router->setBasePath($this->basePath());
     }
     if (count($match_types) > 0) {
         $this->addMatchTypes($match_types);
     }
     if ($routes != null) {
         $this->addRoutes($routes);
     }
     $this->match = $this->router->match();
 }
Пример #5
0
 protected function callController()
 {
     if ($this->controller !== null) {
         $controller = strpos($this->controller, 'App\\Controller') !== false ? $this->controller : 'App\\Controller\\' . $this->controller;
         $action = $this->action;
         if (class_exists($controller)) {
             $controller_object = createInstance($controller, $this->params);
             $controller_callable = array($controller_object, $action);
             if (is_callable($controller_callable)) {
                 ob_start();
                 call_user_func_array([$controller_object, '_remap'], $this->params);
                 $output = ob_get_clean();
                 call_user_func_array([$controller_object, '_output'], array($output));
             } else {
                 $this->error->throwError('controller method not exist', $action, $controller);
             }
         } else {
             $this->error->throwError('controller not exist', $controller);
         }
     }
     return $this;
 }
Пример #6
0
 private function callController()
 {
     if ($this->controller !== null) {
         $controller = 'App\\Controller\\' . $this->controller;
         $action = $this->action;
         if (class_exists($controller)) {
             $controller_object = createInstance($controller, $this->params);
             $controller_callable = array($controller_object, $action);
             if (is_callable($controller_callable)) {
                 ob_start();
                 call_user_func_array([$controller_object, '_remap'], $this->params);
                 $output = ob_get_clean();
                 call_user_func_array([$controller_object, '_output'], array($output));
             } else {
                 trigger_error("Controller: Create '{$action}' function in '{$controller}'.", E_USER_ERROR);
                 throw new \Exception("Controller: Create '{$action}' function in '{$controller}'.");
             }
         } else {
             trigger_error("<b>Controller: '{$controller}' does not Exist.", E_USER_ERROR);
             throw new \Exception("Controller: '{$controller}' does not Exist.");
         }
     }
     return $this;
 }
Пример #7
0
function forgotCredentials($emailAddress)
{
    //Checks if email address exists
    if (!checkIfEmailExists($emailAddress)) {
        print 'enot';
    }
    //Create database query
    $databaseQuery = "SELECT * FROM login WHERE emailAddress='{$emailAddress}'";
    //Execute query
    $result = executeDatabase($databaseQuery);
    //While statement... Get data from database
    while ($row = mysqli_fetch_array($result)) {
        $obj = createInstance();
        //Strings
        $username = $row['username'];
        $password = $row['password'];
        $hash = $row['hash'];
        $confirmHash = $hash . $password;
        $reset_url = $obj->reset_url() . $confirmHash . "&email=" . $emailAddress;
        //Create Email
        $subject = 'Request Login Credentials';
        $message = "Username:{$username}\nPassword:{$reset_url}";
        //Send email
        sendEmail($message, $row['emailAddress'], $subject);
        print 'Correct';
    }
}
Пример #8
0
function copyPage($userId, $pageId, $parentId, $pagetitle, $pagename, $recursive)
{
    if (!getPermissions($userId, $parentId, "settings")) {
        return false;
    }
    $parentInfo = getPageInfo($parentId);
    $parentmoduleType = $parentInfo['page_module'];
    if ($parentmoduleType == "link") {
        return false;
    }
    $pageInfo = getPageInfo($pageId);
    $moduleType = $pageInfo['page_module'];
    if ($moduleType == "link") {
        return false;
    }
    $newmodulecomponentid = 0;
    if ($moduleType != "menu" && $moduleType != "external") {
        global $sourceFolder;
        global $moduleFolder;
        require_once $sourceFolder . "/" . $moduleFolder . "/" . $moduleType . ".lib.php";
        $page = new $moduleType();
        $newmodulecomponentid = createInstance($moduleType);
        copyInstance($moduleType, $pageInfo['page_modulecomponentid'], $newmodulecomponentid);
        $page->copyModule($pageInfo['page_modulecomponentid'], $newId);
    }
    if ($moduleType == "external") {
        $extquery = "SELECT MAX( page_modulecomponentid ) AS MAX FROM " . MYSQL_DATABASE_PREFIX . "external";
        $extqueryresult = mysql_query($extquery);
        $extqueryrow = mysql_fetch_array($extqueryresult);
        $extpageid = $extqueryrow[0] + 1;
        $linkquery = "SELECT page_extlink FROM " . MYSQL_DATABASE_PREFIX . "external WHERE page_modulecomponentid='" . $pageInfo['page_modulecomponentid'] . "'";
        $linkqueryresult = mysql_query($linkquery);
        $linkqueryrow = mysql_fetch_array($linkqueryresult);
        $link = $linkqueryrow[0];
        $query = "INSERT INTO `" . MYSQL_DATABASE_PREFIX . "external` (`page_modulecomponentid`,`page_extlink`) " . "VALUES('{$extpageid}','{$link}')";
        if (!($result = mysql_query($query))) {
            displayerror("Unable to copy the page.");
            return false;
        }
    }
    $maxquery = "SELECT MAX( page_id ) AS MAX FROM " . MYSQL_DATABASE_PREFIX . "pages";
    $maxqueryresult = mysql_query($maxquery);
    $maxqueryrow = mysql_fetch_array($maxqueryresult);
    $maxpageid = $maxqueryrow[0] + 1;
    $query = "INSERT INTO `" . MYSQL_DATABASE_PREFIX . "pages` (`page_id`,`page_name`,`page_title`,`page_parentid`,`page_module`,`page_modulecomponentid`,`page_displayinmenu`, `page_displaymenu`, `page_displaysiblingmenu`,`page_menurank`) " . "VALUES('{$maxpageid}','{$pagename}','{$pagetitle}','{$parentId}','{$pageInfo['page_module']}','{$newmodulecomponentid}','{$pageInfo['page_displayinmenu']}','{$pageInfo['page_displaymenu']}','{$pageInfo['page_displaysiblingmenu']}','{$maxpageid}')";
    if (!($result = mysql_query($query))) {
        displayerror("Unable to copy the page.");
        return false;
    }
    if ($recursive) {
        $childrenquery = "SELECT `page_id`,`page_name`,`page_title` FROM `" . MYSQL_DATABASE_PREFIX . "pages` WHERE `page_parentid`='{$pageId}' ";
        $childrenresult = mysql_query($childrenquery);
        while ($temp = mysql_fetch_assoc($childrenresult)) {
            copyPage($userId, $temp['page_id'], $maxpageid, $temp['page_title'], $temp['page_name'], $recursive);
        }
    }
    return true;
}
Пример #9
0
 public function __construct()
 {
     parent::__construct(new \AltoRouter(), createInstance('App\\Routes'));
     $this->mapController()->callApp();
 }
Пример #10
0
 public function copyModule($moduleComponentId, $newId)
 {
     include "article.lib.php";
     $article = new article();
     $articleId = createInstance('article');
     $article->createModule($articleId);
     $query = "INSERT INTO `scrolltext` (`page_modulecomponentid` ,`article_modulecomponentid`)VALUES ('{$newId}','{$articleId}')";
     $result = mysql_query($query) or die(mysql_error());
     $query = "SELECT article_modulecomponentid FROM scrolltext WHERE page_modulecomponentid='{$moduleComponentId}'";
     $result = mysql_query($query);
     if (!$result) {
         return false;
     }
     $row = mysql_fetch_assoc($result);
     $fromId = $row['article_modulecomponentid'];
     $query = "SELECT * FROM `article_content` WHERE `page_modulecomponentid`='{$fromId}'";
     $result = mysql_query($query);
     if (!$result) {
         return false;
     }
     $content = mysql_fetch_assoc($result);
     $query = "INSERT INTO `article_content` (`page_modulecomponentid` ,`article_content`)VALUES ('{$articleId}', '" . mysql_escape_string($content['article_content']) . "')";
     mysql_query($query) or displayerror(mysql_error() . "scrolltext.lib L:104");
     return true;
 }
Пример #11
0
function callAltoRouter()
{
    return createInstance('MyMvc\\Core\\Routing\\RoutingCore');
}
function initializeTwig()
{
    return createInstance('Hu\\Core\\View\\View');
}
Пример #13
0
function text()
{
    $html = createInstance("htmlElement", func_get_args());
    $html->setTags("<TEXT[attributes]>", "</TEXT>");
    return $html;
}