Beispiel #1
0
 function Save($text, $bStripSlashes = true)
 {
     //remove due to serialize bug $text=stripslashes($text);
     if ($bStripSlashes) {
         $text = stripslashes($text);
     }
     if (is_file($this->path) && !is_writable($this->path)) {
         return setError(sprintf(_("Can not open file %s for writing."), $this->getName()) . ' ' . _("Check file permissisons"));
     }
     if (!is_dir($this->getParentPath())) {
         $oDirParent = $this->getParent();
         if (!$oDirParent->mkdir()) {
             return false;
         }
     }
     $fic = fopen($this->path, "w");
     if (!$fic) {
         return setError(sprintf(_("Can not open file %s for writing."), $this->getName()) . ' ' . _("Check file permissisons"));
     }
     //replace the $text
     if ($this->getExtension() == 'xml') {
         $text = str_replace(array('<textareatag', '</textareatag'), array('<textarea', '</textarea'), $text);
     }
     if (strlen($text) > 0) {
         if (fwrite($fic, $text) == FALSE) {
             setError(_("An error occur while writing text"));
             fclose($fic);
             return false;
         }
     }
     fclose($fic);
     return true;
 }
 public static function getItems($period, $user, $yachs = 'ntime', $sport = '*', $currentpage = 'weekpage')
 {
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('a.method, a.location,a.tdate,s.sport_abbr, a.competition');
     $query->from($db->quoteName('#__htraininglogs_tr_sessions') . ' AS a');
     $query->join('LEFT', $db->quoteName('#__htraininglogs_tr_competitions') . ' AS cc ON a.id = cc.tr_id');
     $query->select('cc.title as comptitle,cc.class_place,cc.is_team,cc.owntime,cc.toptimecat,cc.comp_cat');
     $query->select('s.sport_abbr');
     $query->join('LEFT', $db->quoteName('#__htraininglogs_cfg_sport') . ' AS s ON a.sport_id = s.id');
     $query->select('c1.title as category,c1.keyvalue');
     $query->join('LEFT', $db->quoteName('#__htraininglogs_conf_groups') . ' AS c1 ON (c1.keyvalue = cc.comp_cat) AND c1.ctype =300');
     $query->select('c2.title as type,c1.keyvalue');
     $query->join('LEFT', $db->quoteName('#__htraininglogs_conf_groups') . ' AS c2 ON (c2.keyvalue = cc.is_champ) AND c2.ctype =400');
     $query->select('tt.title as toptime,tt.ordering');
     $query->join('LEFT', $db->quoteName('#__htraininglogs_cfg_toptime') . ' AS tt ON (tt.id = cc.toptimecat)');
     $query->where('(a.competition IN (2, 1))');
     $query->where('a.state =1');
     $query->where('a.tdate BETWEEN "' . $period->anfdat->format('Y-m-d') . ' 0:00:00" AND "' . $period->enddat->format('Y-m-d') . ' 23:59:59"');
     $query->order('a.tdate ASC');
     $db->setQuery($query);
     $items = $db->loadObjectlist();
     if ($db->getErrorNum()) {
         setError(JText::_('COM_HTRAININGLOGS_GET_VALUEBASEDGRAPH_FAIL'));
         return false;
     }
     return $items;
 }
function deleteLayerGroup($xmlDoc, &$rootNode, $paramsNode) {
  $isAdmin = false;
  $user = $GLOBALS['user'];
  $user_roles = $user->roles;
  if($user->uid) {
    if(in_array(SITE_ADMIN_ROLE, $user_roles)) {
      $isAdmin = true;
    }
  }

  if(!$isAdmin) {
    setError($xmlDoc, $rootNode, "You are not authorized.");
    return;
  }

  $groupNode = $paramsNode->getElementsByTagName('group')->item(0);
  $group_id = $groupNode->getAttribute("id");

  if($group_id == NULL || $group_id == '' || $group_id == 0) {
    setError($xmlDoc, $rootNode, "Select a layer group to delete.");
    return;
  }

  $query = 'delete from "Layer_Group" where id = %d';
  $query_args = array($group_id);
  $result = db_query($query, $query_args);
  if(!$result) {
    setError($xmlDoc, $rootNode, "Could not delete the group. Please try after sometime.");
  } else {
    setNoError($xmlDoc, $rootNode, "The group has been deleted successfully.");
  }
}
Beispiel #4
0
function secureArea($group)
{
    global $SETTINGS;
    if (!isUserInRole($group)) {
        setError('Du besitzt nicht die nötigen Rechte!');
        header("location: {$SETTINGS['url']}/");
        exit;
    }
}
 /**
  * Updates an existing StudentPhone model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     $studentId = $model->student_id;
     $student = Student::findOne($studentId);
     if (!user()->can('updateStudent', ['student' => $student])) {
         setError('Access denied.');
         return $this->redirect(['/student/view', 'id' => $studentId], 403);
     }
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('update', ['student' => $student, 'model' => $model]);
     }
 }
/**
 * extrapage_sitemap
 * This is the extrapagesite map event function
 * This function check the name of the page and if it is sitemap.xml, generate the site map.
 *
 * @param unknown_type $strPage
 * @param unknown_type $site
 * @return unknown
 */
function extrapage_sitemap($strPage, &$site)
{
    if ($strPage == 'sitemap.xml') {
        $strTplFile = dirname(__FILE__) . SLASH . 'google_sitemap.tpl';
        if (!$site->template_exists($strTplFile)) {
            setError('Error in plugin google site map. Can not find the google_sitemap.tpl file.');
            printFatalHtmlError();
            die;
        }
        header('Content-Type: text/xml;');
        $site->display($strTplFile);
        return true;
    }
    return false;
}
Beispiel #7
0
 function checkKey()
 {
     if (stristr($_SERVER['SERVER_NAME'], 'localhost') !== FALSE) {
         return true;
     }
     //try to connect to server licence
     if (!isset($_SERVER['HTTP_HOST'])) {
         return setError(__('HTTP_HOST not defined'));
     }
     $strLicenceStatus = file_get_contents(LICENCE_URL . urlencode($_SERVER['HTTP_HOST']));
     if ($strLicenceStatus === 'OK') {
         return true;
     }
     return setError($strLicenceStatus);
 }
Beispiel #8
0
function sendErrorResponse($msg) {
  // create a new XML document
  $doc = new DomDocument('1.0');

  // create root node
  $respNode = $doc->createElement('response');
  $respNode = $doc->appendChild($respNode);

  setError($doc, $respNode, $msg);

  // get completed xml document
  $xml_string = $doc->saveXML();

  return $xml_string;
}
function motopressSetPageTemplate()
{
    require_once 'verifyNonce.php';
    require_once 'access.php';
    require_once 'functions.php';
    require_once 'getLanguageDict.php';
    $pageId = $_POST['pageId'];
    $template = $_POST['template'];
    $lang = getLanguageDict();
    if (!$pageId or !$template) {
        setError($lang->setPageTemplateError);
    }
    if (!update_post_meta($pageId, '_wp_page_template', $template)) {
        setError($lang->setPageTemplateError);
    }
    exit;
}
Beispiel #10
0
function init()
{
    require 'lib.searchengine.php';
    $oPlugin = new PPluginDir(dirname(__FILE__));
    $oConfigFile =& $oPlugin->oConfig;
    $bActivate = $oConfigFile->getDirectParam('ACTIVATE');
    if ($bActivate !== "true") {
        return setError(_('Please check your configuration. You must activate it befor try to index the content'));
    }
    if (!createBase()) {
        return false;
    }
    if (!synchroBase()) {
        return false;
    }
    echo gettext('Data base has been populated successfully');
    return true;
}
Beispiel #11
0
 function setLocalePath($strPath = false, $strDomain = false)
 {
     $strDomain = !$strDomain ? 'messages' : $strDomain;
     $strPath = !$strPath ? SITE_PATH . 'core/locale' : $strPath;
     if (!is_dir($strPath)) {
         return setError(sprintf('Can not change the local path to %s. Directory not exists'), $strPath);
     }
     global $configFile;
     $locale = $configFile->getDirectParam('USER_LANGUAGE');
     T_setlocale(LC_ALL, $locale);
     bindtextdomain($strDomain, $strPath);
     // bind_textdomain_codeset is supported only in PHP 4.2.0+
     if (function_exists('bind_textdomain_codeset')) {
         bind_textdomain_codeset($strDomain, 'utf-8');
     }
     textdomain($strDomain);
     return true;
 }
 public static function getItems($period, $user, $yachs = 'ntime', $sport = '*', $currentpage = 'weekpage')
 {
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('count(ft.id) as days,ft.ft_id, cf.title,avg(ft.fitness_value) as value,cf.unit,cf.color');
     $query->from($db->quoteName('#__htraininglogs_ft_fitness') . ' AS ft');
     $query->leftjoin('#__htraininglogs_cfg_fitness AS cf ON ft.ft_id = cf.id');
     $query->where('cf.user_id = ' . $user->id);
     $query->where('ft.date1 BETWEEN "' . $period->anfdat->format('Y-m-d') . ' 0:00:00" AND "' . $period->enddat->format('Y-m-d') . ' 23:59:59"');
     $query->group('cf.title,unit');
     $query->order('cf.ordering');
     $db->setQuery($query);
     $valuebased = $db->loadObjectlist();
     if ($db->getErrorNum()) {
         setError(JText::_('COM_HTRAININGLOGS_GET_TRSESSION_FAIL'));
         return false;
     }
     return $valuebased;
 }
Beispiel #13
0
 function f($e)
 {
     if ($e instanceof ForbiddenException) {
         return setError(403, 'FORBIDDEN');
     } else {
         if ($e instanceof WrongMethodException) {
             return setError(405, 'WRONG METHOD');
         } else {
             if ($e instanceof BadRequestException) {
                 return setError(400, 'BAD REQUEST');
             } else {
                 if ($e instanceof NotFoundException) {
                     return setError(404, 'NOT FOUND');
                 } else {
                     return setError(500, 'INTERNAL SERVER ERROR');
                 }
             }
         }
     }
 }
Beispiel #14
0
 public static function getGroupparams()
 {
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('*');
     $query->from($db->quoteName('#__htraininglogs_cfg_category') . ' AS ft');
     $query->where('(ctype="b") or (ctype="g")');
     $db->setQuery($query);
     $data = $db->loadObjectlist();
     if ($db->getErrorNum()) {
         setError(JText::_('COM_HTRAININGLOGS_GET_TRSESSION_FAIL'));
         return false;
     }
     $groupparam = array('RECOM', 'GA!', 'KA1', 'GA2', 'KA2', 'WSA', 'ALT', 'STD', 'BELSTD', 'KM', 'CLMB');
     foreach ($data as $sub) {
         $groupparam[$sub->cat_abbr] = new stdClass();
         $groupparam[$sub->cat_abbr]->color = $sub->color;
     }
     return $groupparam;
 }
Beispiel #15
0
function doLogin()
{
    if ($_SERVER['REQUEST_METHOD'] == 'GET') {
        return;
    }
    if (!isset($_POST['username']) || !isset($_POST['login'])) {
        setError('Ungültige Anmeldedaten');
        return;
    }
    $username = trim($_POST['username']);
    $password = trim($_POST['password']);
    if ($username == '' || $password == '') {
        setError('Ungültige Anmeldedaten');
        return;
    }
    if (authenticate($username, $password)) {
        session_start();
        session_unset();
        session_regenerate_id(true);
        $_SESSION['username'] = $_POST['username'];
    }
}
 public static function getItems($period, $user, $yachs = 'ntime', $sport = '*', $currentpage = 'weekpage')
 {
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $data = new stdClass();
     $query->select('sc.sport  ,sc.multiplier, sc.color,' . '(SELECT count(DISTINCT t.id) FROM `#__htraininglogs_tr_sessions` t left join `#__htraininglogs_tr_splittimes` AS ss on (t.id = ss.tr_id) where (ss.state=1) AND(t.state=1) AND (ss.sport_id = i.sport_id) AND tdate BETWEEN "' . $period->anfdat->format('Y-m-d') . ' 0:00:00" AND "' . $period->enddat->format('Y-m-d') . ' 23:59:59" ) AS no_sessions,' . '(SELECT count(DISTINCT (date(w.tdate))) FROM `#__htraininglogs_tr_sessions` w left join `#__htraininglogs_tr_splittimes` AS ss on ( w.id = ss.tr_id ) WHERE (ss.state=1)AND(w.state=1)AND( ss.sport_id = i.sport_id) AND w.tdate BETWEEN "' . $period->anfdat->format('Y-m-d') . ' 0:00:00" AND "' . $period->enddat->format('Y-m-d') . ' 23:59:59") as no_days,' . 'sum( i.km ) AS km, sum( i.climb ) AS climb, sum( i.etime ) AS etime, sum( i.ntime ) AS ntime,' . 'sum(i.' . $yachs . '*(c.group=1)) as RECOM,sum(i.' . $yachs . '*(c.group=2)) as GA1,sum(i.' . $yachs . '*(c.group=3)) as KA1,' . 'sum(i.' . $yachs . '*(c.group=4)) as GA2,sum(i.' . $yachs . '*(c.group=5)) as KA2,sum(i.' . $yachs . '*(c.group=6)) as WSA,' . 'sum(i.' . $yachs . '*(c.group=0)) as Alt');
     $query->from($db->quoteName('#__htraininglogs_cfg_sport') . ' AS sc,' . $db->quoteName('#__htraininglogs_tr_sessions') . ' AS a');
     $query->leftjoin('`#__htraininglogs_tr_intensitylevels` as i on a.id = i.tr_id');
     $query->leftjoin('`#__htraininglogs_cfg_intensity` AS c ON i.int_id = c.id');
     if ($sport != '*') {
         $query->where('sc.id in (' . $sport . ')');
     }
     $query->where('c.sport_id = sc.id');
     $query->where('a.state = 1');
     $query->where('i.state = 1');
     $query->where('a.user_id = ' . $user->id);
     $query->where('a.user_id = ' . $user->id);
     $query->where('a.tdate BETWEEN "' . $period->anfdat->format('Y-m-d') . ' 0:00:00" AND "' . $period->enddat->format('Y-m-d') . ' 23:59:59"');
     $query->group('sport ,multiplier');
     $query->order('sc.ordering');
     $db->setQuery($query);
     $data->sports = $db->loadObjectlist();
     if ($db->getErrorNum()) {
         setError(JText::_('COM_HTRAININGLOGS_GET_TRSESSION_FAIL'));
         return false;
     }
     $query = $db->getQuery(true);
     $query->select('count(DISTINCT (id)) as TE,count(DISTINCT date(tdate)) as TT');
     $query->from($db->quoteName('#__htraininglogs_tr_sessions'));
     if ($sport != '*') {
         $query->where('sport_id in (' . $sport . ')');
     }
     $query->where('tdate BETWEEN "' . $period->anfdat->format('Y-m-d') . ' 0:00:00" AND "' . $period->enddat->format('Y-m-d') . ' 23:59:59"');
     $query->where('state = 1');
     $db->setQuery($query);
     $data->sum = $db->loadObject();
     return $data;
 }
Beispiel #17
0
 public function _Or($conditionData)
 {
     if (!($this->lastShackle == "Where")) {
         return setError(3);
     }
     $this->Where($conditionData, " OR ");
     return $this;
 }
Beispiel #18
0
 function get_option($option)
 {
     //Retrieves various runtime behaviours of the current FTP stream
     $this->_resetError();
     switch ($option) {
         case "FTP_TIMEOUT_SEC":
             return FTP_TIMEOUT;
         case "PHP_FTP_OPT_AUTOSEEK":
             return FALSE;
     }
     setError(-1, "Unknown option: {$option}");
     return false;
 }
Beispiel #19
0
 /**
  * Token Sniffer
  * Checks whether a post contains a valid token
  */
 public function sniff_token()
 {
     $locale = fusion_get_locale();
     $error = FALSE;
     if (!empty($_POST)) {
         // Check if a token is being posted and make sure is a string
         if (!isset($_POST['fusion_token']) || !isset($_POST['form_id']) || !is_string($_POST['fusion_token']) || !is_string($_POST['form_id'])) {
             $error = $locale['token_error_2'];
         } elseif (!isset($_SESSION['csrf_tokens'][self::pageHash()][$_POST['form_id']])) {
             // Require set pageHash.
             $error = $locale['token_error_9'];
             // Check if the token exists in storage
         } elseif (!in_array($_POST['fusion_token'], $_SESSION['csrf_tokens'][self::pageHash()][$_POST['form_id']])) {
             $error = $locale['token_error_10'] . stripinput($_POST['fusion_token']);
         } elseif (!self::verify_token(0)) {
             $error = $locale['token_error_3'] . stripinput($_POST['fusion_token']);
         }
     }
     // Check if any error was set
     if ($error !== FALSE) {
         // Flag the token as invalid
         $this->tokenIsValid = FALSE;
         // Flag that something went wrong
         $this->stop();
         if ($this->debug) {
             // Add Error Notices
             setError(2, $error, FUSION_SELF, FUSION_REQUEST, "");
             addNotice('danger', $error);
         }
     }
 }
function motopressDuplicateTemplate()
{
    require_once 'verifyNonce.php';
    require_once 'settings.php';
    require_once 'access.php';
    require_once ABSPATH . '/wp-admin/includes/theme.php';
    require_once 'InitTemplate.php';
    require_once 'functions.php';
    require_once 'getLanguageDict.php';
    $pageId = $_POST['pageId'];
    $templateToDuplicate = $_POST['templateToDuplicate'];
    $newTemplateName = trim($_POST['newTemplateName']);
    global $motopressSettings;
    $lang = getLanguageDict();
    $errors = array();
    $templateDir = $motopressSettings['theme_root'] . '/' . $motopressSettings['current_theme'] . '/';
    if ($pageId && $templateToDuplicate && $newTemplateName) {
        $newTemplateFile = uniqid('page-') . '.php';
        if (!preg_match('/^[^\\*\\/]{1,30}$/is', $newTemplateName)) {
            setError($lang->validationName);
        }
        // If template with new name already exists
        $pageTemplates = get_page_templates();
        foreach ($pageTemplates as $name => $file) {
            if (strcasecmp($newTemplateName, $name) == 0) {
                setError($lang->duplicateErrorTemplateExists);
                //$errors[] = 'Template `'. $name .'` already exists.';
                break;
            }
        }
        if (file_exists($templateDir . $templateToDuplicate)) {
            $oldTemplateFile = file_get_contents($templateDir . $templateToDuplicate);
            $oldTemplateFile = InitTemplate::removePhpComment($oldTemplateFile);
            $oldTemplateFile = InitTemplate::removeEmptyPhp($oldTemplateFile);
            $oldTemplateFile = InitTemplate::reinit($oldTemplateFile, $newTemplateFile, 'main');
            $oldTemplateFile = InitTemplate::setAnnotations($oldTemplateFile, array('template_name' => 'Template Name: ' . $newTemplateName));
            if (!file_put_contents($templateDir . $newTemplateFile, $oldTemplateFile)) {
                setError($lang->duplicateError);
                //$errors[] = 'Error on: file_put_contents("'.$templateDir . $newTemplateFile.'", $oldTemplateFile)';
            }
            if (!update_post_meta($pageId, '_wp_page_template', $newTemplateFile)) {
                unlink($templateDir . $newTemplateFile);
                setError($lang->duplicateError);
                //$errors[] = 'Error on: update_post_meta('.$pageId.', "_wp_page_template", "'.$newTemplateFile.'")';
            }
            $request = array('value' => $newTemplateFile, 'name' => $newTemplateName);
            echo json_encode($request);
        } else {
            $errors[] = strtr($lang->duplicateErrorTemplateNotExist, array('%template%' => $templateDir . $templateToDuplicate));
        }
    } else {
        $errors[] = $lang->duplicateError;
    }
    if (!empty($errors)) {
        if ($motopressSettings['debug']) {
            setError($errors);
        } else {
            setError($lang->duplicateError);
        }
    }
    exit;
}
 /**
  * Updates an existing Student model.
  * If update is successful, the browser will be redirected to the index page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $student = $this->findModel($id);
     if (!user()->can('updateStudent', ['student' => $student])) {
         setError('You are not authorized to update this student; please go back.');
         return $this->redirect(['index'], 403);
     }
     if ($student->load(Yii::$app->request->post()) && $student->save()) {
         $affiliation = $student->affiliation;
         if ($affiliation->load(Yii::$app->request->post())) {
             if ($affiliation->save()) {
                 $link = Html::a($student->name, ['update', 'id' => $student->id]);
                 $msg = 'Changes to ' . $link . ' saved successfully.';
                 Yii::$app->session->setFlash('success', $msg);
                 return $this->redirect(['index']);
             }
         }
     }
     return $this->render('update', ['student' => $student]);
 }
<?php

// setup includes
require_once 'includes/master.inc.php';
// setup page
define("PAGE_NAME", t("report_abuse_page_name", "Report Abuse"));
define("PAGE_DESCRIPTION", t("report_abuse_meta_description", "Report Abuse or Copyright Infringement"));
define("PAGE_KEYWORDS", t("report_abuse_meta_keywords", "report, abuse, copyright, infringement, file, hosting"));
// send report if submitted
if ((int) $_REQUEST['submitme']) {
    if (!strlen(trim($_REQUEST['fileDetails']))) {
        setError(t("report_abuse_error_no_content", "Please enter the details of the reported file."));
    } else {
        $subject = "New abuse report on " . SITE_CONFIG_SITE_NAME;
        $plainMsg = "There is a new abuse report on " . SITE_CONFIG_SITE_NAME . " with the following details:\n\n";
        $plainMsg .= "***************************************\n";
        $plainMsg .= trim($_REQUEST['fileDetails']) . "\n";
        $plainMsg .= "***************************************\n";
        $plainMsg .= "Submitted IP: " . getUsersIPAddress() . "\n";
        $plainMsg .= "***************************************\n\n";
        $plainMsg .= "Please login via " . WEB_ROOT . "/admin/ to investigate further.";
        send_html_mail(SITE_CONFIG_REPORT_ABUSE_EMAIL, $subject, str_replace("\n", "<br/>", $plainMsg), SITE_CONFIG_REPORT_ABUSE_EMAIL, $plainMsg);
        redirect(WEB_ROOT);
    }
}
require_once '_header.php';
?>

<div class="contentPageWrapper">

    <?php 
Beispiel #23
0
                    }
                } else {
                    if (!addUser($adminusername, $adminpassword1, $lastname)) {
                        setError('Fehler beim Anlegen des Admin-Accounts!');
                        $error = true;
                    }
                }
                if (!$error) {
                    $id = isUserPasswordCorrect($adminusername, $adminpassword1);
                    if (!setUserGroup($id, 'admin')) {
                        setError('Der Admin-Account konnte der Admin-Gruppe nicht zugewiesen werden!');
                        $error = true;
                    }
                }
            } catch (Exception $e) {
                setError('Fehler: ' . $e->getMessage());
                $error = true;
            }
            if (!$error) {
                setInfo('Konfiguration erstellt!');
                header("location: {$SETTINGS['url']}/");
                exit;
            } else {
                if (file_exists('settings.cfg')) {
                    unlink('settings.cfg');
                }
            }
        }
    }
}
$hostname = isset($_POST['hostname']) ? htmlspecialchars($_POST['hostname']) : '';
Beispiel #24
0
 /**
  * _addFilter
  * Add smarty filter to the pollen event manager
  * @param string $strType, type of the filter
  * @param string $strFunctionName
  * @param unknown_type $strTplFctName
  * @return true if succeed
  */
 function _addFilter($strType, $strFunctionName, $strTplFctName = null)
 {
     if (!function_exists($strFunctionName)) {
         return setError(sprintf(_('Try to add event %s but function %s not exists.'), $strType, $strFunctionName));
     }
     if (!in_array($strType, $this->_tabAvailableEvents)) {
         return setError(__('Filter not exists') . ' ' . $strType);
     }
     $this->_events['smarty']['$strEventName'][] = array('TPL_FCT_NAME' => $strTplFctName, 'FUNCTION' => $strFunctionName, 'TYPE' => $strType);
     return true;
 }
        // prepare password
        if (strlen($accessPassword)) {
            $accessPassword = MD5($accessPassword);
        }
        // update folder
        $db = Database::getDatabase(true);
        if (strlen($accessPassword) || $isPublic == 0) {
            $rs = $db->query('UPDATE file_folder SET folderName = :folderName, isPublic = :isPublic, accessPassword = :accessPassword WHERE id = :id', array('folderName' => $folderName, 'isPublic' => $isPublic, 'id' => $fileFolder->id, 'accessPassword' => $accessPassword));
        } else {
            $rs = $db->query('UPDATE file_folder SET folderName = :folderName, isPublic = :isPublic WHERE id = :id', array('folderName' => $folderName, 'isPublic' => $isPublic, 'id' => $fileFolder->id));
        }
        if ($rs) {
            // redirect
            redirect(WEB_ROOT . "/account_folders." . SITE_CONFIG_PAGE_EXTENSION);
        } else {
            setError(t("problem_updating_item", "There was a problem updating the item, please try again later."));
        }
    }
}
require_once '_header.php';
?>

<div class="contentPageWrapper">

<?php 
if (isErrors()) {
    echo outputErrors();
}
?>

    <!-- main section -->
Beispiel #26
0
 /**
  * Token Sniffer
  * Checks whether a post contains a valid token
  */
 public function sniff_token()
 {
     $error = FALSE;
     if (!empty($_POST)) {
         // Check if a token is being posted and make sure is a string
         if (!isset($_POST['fusion_token']) || !isset($_POST['form_id']) || !is_string($_POST['fusion_token']) || !is_string($_POST['form_id'])) {
             $error = "Token was not posted";
         } elseif (!isset($_SESSION['csrf_tokens'][self::pageHash()][$_POST['form_id']])) {
             $error = "Cannot find any token for this form";
             // Check if the token exists in storage
         } elseif (!in_array($_POST['fusion_token'], $_SESSION['csrf_tokens'][self::pageHash()][$_POST['form_id']])) {
             $error = "Cannot find token in storage: " . stripinput($_POST['fusion_token']);
         } elseif (!self::verify_token(0)) {
             $error = "Token is invalid: " . stripinput($_POST['fusion_token']);
         }
     }
     // Check if any error was set
     if ($error !== FALSE) {
         // Flag the token as invalid
         global $defender;
         $defender->tokenIsValid = FALSE;
         // Flag that something went wrong
         $defender->stop();
         // Add Error Notices
         setError(2, $error, FUSION_SELF, FUSION_REQUEST, "");
         if ($this->debug) {
             addNotice('danger', $error);
         }
     }
 }
Beispiel #27
0
    }
    if ($d > 31) {
        $d = 31;
    }
    if ($m > 12) {
        $m = 12;
    }
    $time = sprintf('%04d-%02d-%02d', $y, $m, $d);
}
$voc = getVoc(false, $time, true);
$table = '';
if ($voc === false) {
    setError('Fehler beim Abrufen der Vokabeln');
} else {
    if (count($voc) == 0) {
        setError('Keine Vokabeln vorhanden');
    } else {
        $top = '<tr><th>Englisch</th><th>Deutsch</th></tr>';
        $rows = '';
        foreach ($voc as $v) {
            $id = htmlspecialchars($v->id);
            $german = htmlspecialchars($v->german, 0, 'UTF-8');
            $english = htmlspecialchars($v->english, 0, 'UTF-8');
            $rows .= "<tr><td>{$english}</td><td>{$german}</td></tr>\n";
        }
        $table = <<<EOT
<table class="printable">
<thead>{$top}</thead>
<tbody>{$rows}</tbody>
</table>
EOT;
Beispiel #28
0
function loadhistorypage()
{
    if (!isset($_REQUEST['strPage'])) {
        return setError('Internal error in loadhistorypage');
    }
    // recup content html
    $oPpage = new PPage($_REQUEST['strPage']);
    $fckContent = $oPpage->getEditorFileContent();
    echo $fckContent;
    return true;
}
function motopressGetWrapper()
{
    require_once 'verifyNonce.php';
    require_once 'settings.php';
    require_once 'access.php';
    require_once 'Requirements.php';
    require_once 'SaveTemplate.php';
    require_once 'functions.php';
    require_once 'getLanguageDict.php';
    if (isset($_POST['wrapper']) && !empty($_POST['wrapper'])) {
        $wrapper = $_POST['wrapper'];
        $file = explode('.php', $wrapper);
        $wrapperName = $file[0];
        get_template_part($wrapperName);
    } elseif (isset($_POST['link']) && !empty($_POST['link']) && (isset($_POST['page']) && !empty($_POST['page'])) && (isset($_POST['newWrapper']) && !empty($_POST['newWrapper'])) && (isset($_POST['data']) && !empty($_POST['data']))) {
        $link = $_POST['link'];
        $page = $_POST['page'];
        $newWrapper = $_POST['newWrapper'];
        $data = stripslashes($_POST['data']);
        global $motopressSettings;
        $lang = getLanguageDict();
        $errors = array();
        $pageWithExt = explode('.php', $page);
        $pageName = $pageWithExt[0];
        $copy = copy($motopressSettings['theme_root'] . '/' . $motopressSettings['current_theme'] . '/' . $page, $motopressSettings['theme_root'] . '/' . $motopressSettings['current_theme'] . '/' . $pageName . '-original.php');
        if ($copy) {
            $content = file_get_contents($motopressSettings['theme_root'] . '/' . $motopressSettings['current_theme'] . '/' . $page);
            preg_match_all('/data-motopress-wrapper-file=[\'"]wrapper\\/([^\'"]+)[\'"]/is', $content, $wrapperMatches);
            if (!empty($wrapperMatches[1])) {
                $wrappers = $wrapperMatches[1];
                $newWrapperPath = explode('/', $newWrapper);
                $newWrapperName = $newWrapperPath[1];
                if (!in_array($newWrapperName, $wrappers)) {
                    $wrappers[] = $newWrapperName;
                }
                foreach ($wrappers as $wrapper) {
                    $wrapperWithExt = explode('.php', $wrapper);
                    $wrapperName = $wrapperWithExt[0];
                    $wrapperCopy = copy($motopressSettings['theme_wrapper_root'] . '/' . $wrapper, $motopressSettings['theme_wrapper_root'] . '/' . $wrapperName . '-original.php');
                    if (!$wrapperCopy) {
                        $errors[] = strtr($lang->copyError, array('%source%' => $motopressSettings['theme_wrapper_root'] . '/' . $wrapper, '%dest%' => $motopressSettings['theme_wrapper_root'] . '/' . $wrapperName . '-original.php'));
                    }
                }
                new SaveTemplate($page, $data);
                $newHtml = false;
                $requirements = new Requirements();
                if ($requirements->getCurl()) {
                    $ch = curl_init();
                    $options = array(CURLOPT_URL => $link, CURLOPT_RETURNTRANSFER => true);
                    curl_setopt_array($ch, $options);
                    $newHtml = curl_exec($ch);
                    curl_close($ch);
                } else {
                    $newHtml = file_get_contents($link);
                }
                if (!$newHtml) {
                    $errors[] = strtr($lang->openError, array('%name%' => $link));
                }
                foreach ($wrappers as $wrapper) {
                    if (!unlink($motopressSettings['theme_wrapper_root'] . '/' . $wrapper)) {
                        $errors[] = strtr($lang->removeError, array('%name%' => $motopressSettings['theme_wrapper_root'] . '/' . $wrapper));
                    }
                    $wrapperWithExt = explode('.php', $wrapper);
                    $wrapperName = $wrapperWithExt[0];
                    $wrapperRename = rename($motopressSettings['theme_wrapper_root'] . '/' . $wrapperName . '-original.php', $motopressSettings['theme_wrapper_root'] . '/' . $wrapper);
                    if (!$wrapperRename) {
                        $errors[] = strtr($lang->renameError, array('%source%' => $motopressSettings['theme_wrapper_root'] . '/' . $wrapperName . '-original.php', '%dest%' => $motopressSettings['theme_wrapper_root'] . '/' . $wrapper));
                    }
                }
            }
            if (!unlink($motopressSettings['theme_root'] . '/' . $motopressSettings['current_theme'] . '/' . $page)) {
                $errors[] = strtr($lang->removeError, array('%name%' => $motopressSettings['theme_root'] . '/' . $motopressSettings['current_theme'] . '/' . $page));
            }
            $rename = rename($motopressSettings['theme_root'] . '/' . $motopressSettings['current_theme'] . '/' . $pageName . '-original.php', $motopressSettings['theme_root'] . '/' . $motopressSettings['current_theme'] . '/' . $page);
            if (!$rename) {
                $errors[] = strtr($lang->renameError, array('%source%' => $motopressSettings['theme_root'] . '/' . $motopressSettings['current_theme'] . '/' . $pageName . '-original.php', '%dest%' => $motopressSettings['theme_root'] . '/' . $motopressSettings['current_theme'] . '/' . $page));
            }
        } else {
            $errors[] = strtr($lang->copyError, array('%source%' => $motopressSettings['theme_root'] . '/' . $motopressSettings['current_theme'] . '/' . $page, '%dest%' => $motopressSettings['theme_root'] . '/' . $motopressSettings['current_theme'] . '/' . $pageName . '-original.php'));
        }
        if (empty($errors)) {
            echo $newHtml;
        } else {
            if ($motopressSettings['debug']) {
                print_r($errors);
            } else {
                setError($lang->wrapperError);
            }
        }
    }
    exit;
}
Beispiel #30
0
 function printFatalHtmlError($strMore = '', $iErrorType = 500)
 {
     setError(getError() . $strMore);
     header("HTTP/1.0 {$iErrorType} Server Error");
     printFatalError();
 }