Пример #1
0
function top($name, $method, $data, $data1)
{
    global $_G;
    if ($_G['TOP'] == NULL) {
        include_once ROOT_PATH . 'top/TopClient.php';
        $c = new TopClient();
        $c->format = 'json';
        $_G['TOP'] = $c;
    }
    //1=百川接口	0=淘客接口
    if ($_G['setting']['api_type'] == 1) {
        if ($_G['setting'][appkey] && $_G['setting'][secretKey]) {
            $c->appkey = trim($_G[setting]['appkey']);
            $c->secretKey = trim($_G[setting]['secretKey']);
        } else {
            msg('百川appkey未配置,无法进行操作');
        }
    } else {
        if ($_G['setting'][taoke_appkey] && $_G['setting'][taoke_secretKey]) {
            $c->appkey = trim($_G[setting]['taoke_appkey']);
            $c->secretKey = trim($_G[setting]['taoke_secretKey']);
        } else {
            msg('淘宝客appkey未配置,无法进行操作');
        }
    }
    if (!$name) {
        return $_G['TOP'];
    }
    if (defined('ERROR') && ERROR === true) {
        return false;
    }
    if (is_array($name)) {
        $arr = $name;
    } else {
        $arr = array('name' => $name, 'method' => $method, 'data' => $data, 'data1' => $data1);
    }
    if (!preg_match("/^[a-zA-Z_]+\$/is", $arr[name])) {
        return false;
    }
    $file_name = 'api/' . $arr[name];
    if ((include_once libfile($file_name)) === false) {
        system_error('system', 'api文件不存在' . $v);
        return false;
    }
    $class = "api_" . $arr[name];
    $res = new $class();
    if ($arr[method] && method_exists($res, $arr[method])) {
        $me = $arr[method];
        return $res->{$me}($arr[data], $arr[data1]);
    }
    return $res;
}
Пример #2
0
/**
 *
 * Returns array of people containing entity, mutuals (friends), groups (shared) and priority
 * @param Int $guid
 * @param Int $friends_limit
 * @param Int $groups_limit
 * @return Array
 */
function get_suggestions($guid, $friends_of_friends_limit = 10, $groups_members_limit = 10)
{
    $dbprefix = elgg_get_config('dbprefix');
    $guid = sanitize_int($guid);
    $suggestions = array();
    if ($friends_of_friends_limit) {
        // get some friends of friends
        $options = array('selects' => array('COUNT(fof.guid_two) as priority'), 'type' => 'user', 'joins' => array("JOIN {$dbprefix}users_entity ue ON ue.guid = e.guid", "JOIN {$dbprefix}entity_relationships fr ON fr.guid_one = {$guid} AND fr.relationship = 'friend'", "JOIN {$dbprefix}entity_relationships fof ON fof.guid_one = fr.guid_two AND fof.relationship = 'friend'"), "wheres" => array("ue.banned = 'no'", "e.guid NOT IN (SELECT f.guid_two FROM {$dbprefix}entity_relationships f WHERE f.guid_one = {$guid} AND f.relationship = 'friend')", "fof.guid_two = e.guid", "e.guid != {$guid}"), 'group_by' => 'e.guid', 'order_by' => 'priority desc, ue.last_action desc', 'limit' => abs((int) $friends_of_friends_limit));
        $fof = elgg_get_entities($options);
        if (!is_array($fof)) {
            system_error("Revisar foreach de lib/functions");
        }
        foreach ($fof as $f) {
            $priority = (int) $f->getVolatileData('select:priority');
            $suggestions[$f->guid] = array('entity' => $f, 'mutuals' => $priority, 'groups' => 0, 'priority' => $priority);
        }
    }
    if ($groups_members_limit) {
        // get some mutual group members
        $options = array('selects' => array('COUNT(mog.guid_two) as priority'), 'type' => 'user', 'joins' => array("JOIN {$dbprefix}users_entity ue ON ue.guid = e.guid", "JOIN {$dbprefix}entity_relationships g ON g.guid_one = {$guid} AND g.relationship = 'member'", "JOIN {$dbprefix}groups_entity ge ON ge.guid = g.guid_two", "JOIN {$dbprefix}entity_relationships mog ON mog.guid_two = g.guid_two AND mog.relationship = 'member'"), "wheres" => array("ue.banned = 'no'", "e.guid NOT IN (SELECT f.guid_two FROM {$dbprefix}entity_relationships f WHERE f.guid_one = {$guid} AND f.relationship = 'friend')", "mog.guid_one = e.guid", "e.guid != {$guid}"), 'group_by' => 'e.guid', 'order_by' => 'priority desc, ue.last_action desc', 'limit' => 3);
        // get members of groups
        $mog = elgg_get_entities($options);
        if (!is_array($mog)) {
            system_error("Revisar foreach de lib/functions2");
        }
        foreach ($mog as $m) {
            if (!isset($suggestions[$m->guid])) {
                $priority = (int) $m->getVolatileData('select:priority');
                $suggestions[$m->guid] = array('entity' => $m, 'mutuals' => 0, 'groups' => $priority, 'priority' => $priority);
            } else {
                $priority = (int) $m->getVolatileData('select:priority');
                $suggestions[$m->guid]['groups'] = $priority;
                $suggestions[$m->guid]['priority'] += $priority;
            }
        }
    }
    // sort by priority
    usort($suggestions, __NAMESPACE__ . '\\trip_companions_sorter');
    return $suggestions;
}
Пример #3
0
function systeminc($file)
{
    if (!(include 'src/' . $file . '.php')) {
        system_error('Could not get system file for ' . $file);
    }
}
Пример #4
0
function delete_trip_assessments($trip_guid)
{
    $list = elgg_get_entities_from_metadata(['type' => 'object', 'subtype' => 'evaluation_content', 'metadata_name_value_pairs' => array(array('name' => 'trip', 'value' => $trip_guid, 'operand' => '='))]);
    if (!$list) {
        //system_message("empty-list");
        return;
    }
    $theTrip = get_entity($trip_guid);
    if (!is_array($list)) {
        system_error("Revisar foreach de lib/TC");
    }
    foreach ($list as $evaluation) {
        if ($evaluation->trip == $trip_guid) {
            //this must be
            delete_assessment($evaluation->guid);
        } else {
            register_error("no-concordance");
        }
    }
    unset($theTrip->grade);
}
Пример #5
0
 public static function checkquery($sql)
 {
     if (self::$config === null) {
         $_config = array();
         $_config['status'] = 1;
         $_config['dfunction']['0'] = 'load_file';
         $_config['dfunction']['1'] = 'hex';
         $_config['dfunction']['2'] = 'substring';
         $_config['dfunction']['3'] = 'if';
         $_config['dfunction']['4'] = 'ord';
         $_config['dfunction']['5'] = 'char';
         $_config['daction']['0'] = 'intooutfile';
         $_config['daction']['1'] = 'intodumpfile';
         $_config['daction']['2'] = 'unionselect';
         $_config['daction']['3'] = '(select';
         $_config['daction']['4'] = 'unionall';
         $_config['daction']['5'] = 'uniondistinct';
         $_config['dnote']['0'] = '/*';
         $_config['dnote']['1'] = '*/';
         $_config['dnote']['2'] = '#';
         $_config['dnote']['3'] = '--';
         $_config['dnote']['4'] = '"';
         $_config['dlikehex'] = 1;
         $_config['afullnote'] = '0';
         self::$config = $_config;
     }
     if (self::$config['status']) {
         $cmd = trim(strtoupper(substr($sql, 0, strpos($sql, ' '))));
         if (in_array($cmd, self::$checkcmd)) {
             $test = self::_do_query_safe($sql);
             if ($test < 1) {
                 //throw new Exception('It is not safe to do this query', 0, $sql);
                 $db = DB::object();
                 $db->currentSql = 'It is not safe to do this query';
                 $db->sqldebug[] = $sql;
                 system_error('db', $sql);
                 return false;
             }
         }
     }
     return true;
 }
Пример #6
0
          </tr>
          <tr>
            <td width="15%">PLZ</td>
            <td width="85%"><input type="text" name="plz" size="30" value="' . $kunde['plz'] . '"/></td>
          </tr>
          <tr>
            <td width="15%">Stadt</td>
            <td width="85%"><input type="text" name="stadt" size="30" value="' . $kunde['stadt'] . '"/></td>
          </tr>
          <tr>
            <td width="15%">Telefon</td>
            <td width="85%"><input type="text" name="telefon" size="30" value="' . $kunde['telefon'] . '"/></td>
          </tr>
          <tr>
            <td width="15%">Sonstiger Wunsch</td>
            <td width="85%"><textarea name="wish" cols="25" rows="5"></textarea></td>
          </tr>   
          <tr>
            <td colspan="2"><input type="submit" name="send" value="Abschicken" /></td>
          </tr>
        </table>
        </form>';
        }
    } else {
        system_error('Bestellsumme zu niedrig');
    }
} else {
    system_error('Bestellsumme nicht gesetzt');
}
?>
<hr>
Пример #7
0
<?php

/*
 * @copyright   Leyun internet Technology(Shanghai)Co.,Ltd
 * @license     http://www.dzzoffice.com/licenses/license.txt
 * @package     DzzOffice
 * @link        http://www.dzzoffice.com
 * @author      zyx(zyx@dzz.cc)
 */
define('APPTYPEID', 0);
define('CURSCRIPT', 'user');
require './core/class/class_core.php';
require libfile('class/user');
require libfile('function/user');
require libfile('function/mail');
require libfile('function/profile');
$dzz = C::app();
$modarray = array('activate', 'clearcookies', 'getpasswd', 'logging', 'lostpasswd', 'seccode', 'secqaa', 'register', 'ajax', 'regverify', 'switchstatus', 'profile', 'password', 'avatar');
$mod = !in_array($dzz->var['mod'], $modarray) && (!preg_match('/^\\w+$/', $dzz->var['mod']) || !file_exists(DZZ_ROOT . './member/member_' . $dzz->var['mod'] . '.php')) ? 'space' : $dzz->var['mod'];
define('CURMODULE', $mod);
$cachelist = array('usergroup', 'fields_register');
$dzz->cachelist = $cachelist;
$dzz->init();
include_once libfile('function/cache');
updatecache('fields_register');
if (@(!file_exists(DZZ_ROOT . './user/user_' . $mod . '.php'))) {
    system_error(lang('message', 'undefined_action'));
}
require DZZ_ROOT . './user/user_' . $mod . '.php';
Пример #8
0
 function _xss_check()
 {
     $temp = strtoupper(urldecode(urldecode($_SERVER['REQUEST_URI'])));
     if (strpos($temp, '<') !== false || strpos($temp, '"') !== false || strpos($temp, 'CONTENT-TRANSFER-ENCODING') !== false) {
         system_error('request_tainting');
     }
     return true;
 }
Пример #9
0
 private function _xss_check()
 {
     static $check = array('"', '>', '<', '\'', 'CONTENT-TRANSFER-ENCODING');
     if ($_SERVER['REQUEST_METHOD'] == 'GET') {
         $temp = $_SERVER['REQUEST_URI'];
     } elseif (empty($_GET['formhash'])) {
         $temp = $_SERVER['REQUEST_URI'] . file_get_contents('php://input');
     } else {
         $temp = '';
     }
     if (!empty($temp)) {
         $temp = strtoupper(urldecode(urldecode($temp)));
         foreach ($check as $str) {
             if (strpos($temp, $str) !== false) {
                 system_error('request_tainting');
             }
         }
     }
     return true;
 }
Пример #10
0
 /**
  * 处理模板文件
  *
  * @access  public
  * @param   string      $filename
  * @param   sting      $cache_id
  *
  * @return  sring
  */
 public function fetch($filename, $cache_id = '')
 {
     if (strpos($filename, '$TPLNAME') !== false) {
         $filename = str_replace('$TPLNAME', TPLDIR, $filename);
         $filename = str_replace('../', '', $filename);
     } else {
         if (strpos($filename, '../common/') !== false) {
             $filename = str_replace('../', '', $filename);
             $filename = str_replace('common/', ROOT_PATH . 'view/common/', $filename);
         } else {
             if (strpos($filename, '../common_admin/') !== false) {
                 $filename = str_replace('../', '', $filename);
                 $filename = str_replace('common_admin/', ROOT_PATH . 'view/admin/common_admin/', $filename);
             } else {
                 if (strpos($filename, '../common_mobile/') !== false) {
                     $filename = str_replace('../common_mobile/', ROOT_PATH . 'view/common_mobile/', $filename);
                 } elseif (strpos($filename, '../') !== false) {
                     $filename = str_replace('../', TPLDIR . '/', $filename);
                 } else {
                     if (strpos($filename, './') !== false) {
                         $current_file = $this->template[0];
                         $filename = dirname($current_file) . '/' . str_replace('./', '', $filename);
                     }
                 }
             }
         }
     }
     if (!is_file($filename)) {
         $filename = str_replace(ROOT_PATH, '', $filename);
         system_error('system', $filename . ' is not extends');
     }
     //dump($filename);
     if (!$this->_seterror) {
         error_reporting(E_ALL ^ E_NOTICE);
     }
     $this->_seterror++;
     if (strncmp($filename, 'str:', 4) == 0) {
         $out = $this->_eval($this->fetch_str(substr($filename, 4)));
     } else {
         if ($this->_checkfile) {
             if (!file_exists($filename)) {
                 $filename = $this->template_dir . '/' . $filename;
             }
         } else {
             $filename = $this->template_dir . $filename;
         }
         if ($this->direct_output) {
             $this->_current_file = $filename;
             $out = $this->_eval($this->fetch_str(file_get_contents($filename)));
         } else {
             if ($cache_id && $this->caching) {
                 $out = $this->template_out;
             } else {
                 if (!in_array($filename, $this->template)) {
                     $this->template[] = $filename;
                 }
                 $out = $this->make_compiled($filename);
                 if ($cache_id) {
                     $cachename = str_replace(array("/", ":"), "_", $filename) . '_' . $cache_id;
                     $data = serialize(array('template' => $this->template, 'expires' => $this->_nowtime + $this->cache_lifetime, 'maketime' => $this->_nowtime));
                     $out = str_replace("\r", '', $out);
                     while (strpos($out, "\n\n") !== false) {
                         $out = str_replace("\n\n", "\n", $out);
                     }
                     $hash_dir = $this->cache_dir . '/' . substr(md5($cachename), 0, 1);
                     if (!is_dir($hash_dir)) {
                         mkdir($hash_dir);
                     }
                     if (file_put_contents($hash_dir . '/' . $cachename . '.php', '<?php exit;?>' . $data . $out, LOCK_EX) === false) {
                         trigger_error('can\'t write:' . $hash_dir . '/' . $cachename . '.php');
                     }
                     $this->template = array();
                 }
             }
         }
     }
     $this->_seterror--;
     if (!$this->_seterror) {
         error_reporting($this->_errorlevel);
     }
     return $out;
     // 返回html数据
 }
Пример #11
0
 static function run()
 {
     global $_G;
     $m = 'index';
     $a = 'main';
     if (CURSCRIPT == 'main') {
         $m = 'index';
     } elseif ($_GET['m']) {
         $m = trim($_GET['m']);
     } elseif (isset($_GET['fid']) && $_GET['fid'] > 0) {
         $m = 'channel';
     } elseif (isset($_GET['aid']) && $_GET['aid'] > 0 || isset($_GET['itemid']) && $_GET['itemid'] > 0) {
         $m = 'goods';
     } else {
         $m = defined('IN_ADMIN') ? 'admin' : 'index';
     }
     $a = $_GET['a'] ? $_GET['a'] : 'main';
     if (!preg_match("/^[a-z_]+\$/is", $m)) {
         system_error('system', 'Module String Error');
         return false;
     }
     if (!preg_match("/^[a-z_]+\$/is", $a)) {
         system_error('system', 'Action String Error');
     }
     if (defined('IN_ADMIN') && !$_G[uid]) {
         login();
     }
     $jump_url = '';
     if (defined('IN_ADMIN')) {
         include libfile('config/admin');
         $group = $_G['group'][$_G['member']['groupid']];
         foreach ($menu as $k => $v) {
             $menu[$k]['select'] = 0;
             if (array_key_exists($k, $group[power]) || $_G['adminid'] == 1) {
                 $menu[$k]['select'] = 1;
             }
             foreach ($v['nav'] as $k1 => $v1) {
                 if (array_key_exists($v1['a'], $group[power][$k]) || $_G['member']['groupid'] == 1) {
                     $menu[$k]['nav'][$k1]['select'] = 1;
                     $menu[$k]['select'] = 1;
                     if (!$jump_url) {
                         $jump_url = 'm=' . $k . '&a=' . $v1['a'];
                     }
                 } else {
                     $menu[$k]['nav'][$k1]['select'] = 0;
                 }
             }
         }
         $_G['menu'] = $menu;
         seo('uz-system 后台管理          power by uz-system.com');
         include_once ROOT_PATH . "inc/admin_action/" . $m . ".action.php";
     } else {
         include_once libfile("action/" . $m);
     }
     if ($m == 'list') {
         $mm = '_' . $m;
         if (!class_exists($mm)) {
             system_error('system', 'Module not exists');
         }
         $class = new $mm();
     } else {
         if (!class_exists($m)) {
             system_error('system', 'Module not exists');
         }
         $class = new $m();
     }
     define('CURMODULE', $m);
     if (defined('IN_ADMIN') && $_G[uid] && $_G[member][groupid] != 1) {
         $group = $_G['group'][$_G['member']['groupid']];
         $gid = $_G['member']['groupid'];
         $power = $_G['group'][$gid]['power'];
         $power['login']['logout'] = 1;
         //验证登录进后入台权限
         if ($_G[group][$gid]['login_admin'] != 1) {
             logout();
             _header("Location:" . CURSCRIPT . ".php");
             //system_error('system','您当前用户组无权进入后台');
         }
         //验证后台模块权限
         if (!$power[$m]) {
             if ($m == 'admin' && $a == 'main' && $_G['member']['groupid'] != 1 && $jump_url) {
                 header("Location:" . URL . $jump_url);
                 echo '<script type="text/javascript">window.location.href = "' . URL . $jump_url . '";</script>';
                 exit;
             } else {
                 cpmsg('当前模块您无法进行操作', 'errr', $jump_url);
             }
         }
         if ($a == 'del' && $power[$m]['post'] == 1) {
         } else {
             if ($power[$m][$a] != 1) {
                 cpmsg('当前模块分类您无法进行操作', 'errr', $jump_url);
             }
         }
     }
     if ($a == 'list') {
         $a = '_list';
     }
     if (method_exists($class, $a)) {
         if ($a == '_list') {
             define('CURACTION', "list");
         } else {
             define('CURACTION', $a);
         }
         $class->{$a}();
         unset($class, $a, $power, $m);
     } elseif ($a == 'pages' && $_GET[show]) {
         $tpl = trim($_GET[show]);
         if (!preg_match("/^[a-z_]+\$/is", $tpl)) {
             system_error('system', 'Action String Error');
         }
         define('CURACTION', $tpl);
         $app = new $app();
         $app->show(CURMODULE . '/' . $tpl);
     } else {
         if (!$_G[uid] && defined('IN_ADMIN')) {
             header("Location:index.php");
             echo '<script type="text/javascript">window.location = "index.php";</script>';
             exit;
         }
         system_error('system', 'Action not exists');
     }
 }
Пример #12
0
// define preset data
// -------------------------------------------------
// preset data path
define('PRESET_PATH', makepath(array(ABS_PATH, 'applications', 'preset')));
// -------------------------------------------------
// connect to database
// -------------------------------------------------
setConnectionName('default');
setConnectionConf(config('mysql'));
// -------------------------------------------------
// run system
// -------------------------------------------------
if (version_compare(PHP_VERSION, '5.3') == -1) {
    $err = 'The current PHP version ' . PHP_VERSION . ' is not supported.' . PHP_EOL;
    $err .= 'Please upgrade your PHP installation to 5.3 or later.';
    system_error($err);
} else {
    // create front controller object
    $FrontController = new FrontController();
    // create registry object as singleton
    $Registry = Singleton::getInstance('Registry');
    $Cookie = Singleton::getInstance('Cookie');
    if (!$Cookie->isCookie('langcode')) {
        $Cookie->set('langcode', tellme('langcode', 'DE'));
    }
    $Request = new HTTP_Request();
    $Response = new HTTP_Response();
    $Registry->set('HttpRequest', $Request);
    $Registry->set('HttpResponse', $Response);
    // handle request
    $obj = $FrontController->handleRequest($Request, $Response);
Пример #13
0
 /**
  * 获取整个数据集
  * @param string $sql SQL语句
  * @param integer $primaryKey 如果有指定$primaryKey的值,则使用该字段的值做为数组的一维的键值
  * @param integer $type 返回值类型,可选为MYSQL_ASSOC|MYSQL_NUM|MYSQL_BOTH|MSSQL_ASSOC|MSSQL_NUM|MSSQL_BOTH
  * @param string $convertInt 表名称,如果不为空,则根据表结构转换相关的整型,否则不处理
  * @return array 二维数组
  */
 public function getAll($sql, $primaryKey = '', $type = MYSQL_ASSOC, $convertInt = '', $isKV = false)
 {
     $this->query($sql);
     if ($this->errorInfo()) {
         system_error('system', $this->errorInfo());
         return false;
     }
     if ($primaryKey == '') {
         $return = $this->queryResult->fetchAll($this->mapType($type));
         return $return;
     }
     $return = array();
     while ($row = $this->fetchRow($type)) {
         if ($convertInt) {
             foreach ($row as $k => &$v) {
                 if ($v == 'null') {
                     $v = '';
                 }
                 if (strpos($fieldList[$k]['Type'], 'int(') !== false) {
                     $v = intval($v);
                 }
             }
         }
         if ($isKV) {
             @($return[$row[$primaryKey]] = $row[0]);
         } else {
             @($return[$row[$primaryKey]] = $row);
         }
     }
     return $return;
 }
Пример #14
0
function error_handler($errorType, $errorMsg, $errorFile, $errorLine)
{
    $error_types = array(1, 4, 16, 64, 256);
    if (in_array($errorType, $error_types)) {
        $msg = "Run Error: " . $errorType . "<br/>MSG: " . $errorMsg . "<br/>File: " . $errorFile . "<br/>Line: " . $errorLine;
        system_error('system', $msg);
        // throw new Exception($errorMsg, 0, $errorType, $errorFile, $errorLine);
    }
}
Пример #15
0
    				
    				*/
    $user->save();
    if ($user->issimpleuser == 'no') {
        $user->name = $title;
    }
    // Notify of profile update
    trigger_elgg_event('profileupdate', $user->type, $user);
    //add to river
    add_to_river('river/user/default/profileupdate', 'update', $_SESSION['user']->guid, $_SESSION['user']->guid);
    //system_message(elgg_echo("profile:saved").$user->guid.$malakia);
    system_message(elgg_echo("profile:saved") . $ur . $user->guid);
    // Forward to the user's profile
    //		forward($user->getUrl());
    //                     print_r(page_owner_entity()->parentdescs);
    //                     print_r(page_owner_entity()->parentits);
    //                    print_r(page_owner_entity()->parentidents);
    //                    print_r(page_owner_entity()->parenttypes);
    //	exit();
    if ($user->issimpleuser == 'no') {
        //{echo "NIKOLAS"; print_r($user->name_meducator20); echo "<br />";print_r($user->affil_meducator20); echo "<br />";print_r($user->foaf_meducator20); exit();}
        // echo "i am here";
        $isAnUpdate = get_input("isAnUpdate");
        forward("http://metamorphosis.med.duth.gr/mod/content_item/createrdf.php?id=" . $user->guid . "&update=" . $isAnUpdate);
    } else {
        forward($user->getUrl());
    }
} else {
    // If we can't, display an error
    system_error(elgg_echo("profile:cantedit"));
}
Пример #16
0
<?php

$guid = get_input('guid');
if ($guid) {
    $entity = get_entity($guid);
}
elgg_push_context('news');
elgg_set_page_owner_guid($entity->guid);
if (!$entity) {
    system_error(elgg_echo('news:could_not_find'));
    forward(REFERER);
}
if ($entity->canEdit()) {
    elgg_register_title_button('news', 'edit');
}
$title = $entity->title;
$body = elgg_view_layout('content', array('title' => '', 'filter' => '', 'content' => elgg_view_entity($entity, array('full_view' => true))));
echo elgg_view_page($title, $body, "default", array('leader' => elgg_view('news/header', array('entity' => $entity))));
Пример #17
0
    //签名验证
    return;
    $getArr = I('get.');
    if (!$getArr) {
        return;
    }
    $sign = isset($getArr['sign']) ? $getArr['sign'] : system_error("not_fonud_sign");
    unset($getArr['sign']);
    ksort($getArr);
    $signstr = "";
    foreach ($getArr as $k => $v) {
        $signstr .= $k . "=" . urlencode($v) . "&";
    }
    $signstr = rtrim($signstr, "&");
    if (md5($signstr) != $sign) {
        system_error("sign_error");
    }
});
\think\Hook::add('action_begin', function () {
    //ssid 认证
    $getArr = I('get.');
    if (!$getArr) {
        return;
    }
    if (isset($getArr['ssid'])) {
        $ssid = $getArr['ssid'];
    } else {
        return;
    }
    if (!S("ssid_" . $ssid)) {
        return;
Пример #18
0
        $user->nValorations = 0;
        $user->expertise = 0;
        //system_message($user->nValorations . " reset " . $user->username);
        $user->karma = elgg_echo('hflts:karma:none');
        /* hard core erasing is plausible too
           $prefix = elgg_get_config('dbprefix');
           delete_data("DELETE from {$prefix}metadata where name_id=" . add_metastring('userpoints_points'));
           */
    }
}
/*
* Borrar evaluaciones
*/
$list = elgg_get_entities_from_metadata(['type' => 'object', 'subtype' => 'evaluation_content', 'order_by_metadata' => ['name' => 'state', 'direction' => 'ASC', 'as' => 'text']]);
if (!is_array($list)) {
    system_error("Revisar foreach de E.C.Reset");
}
foreach ($list as $evaluation) {
    /*
     * se reinician los valores del perfil del usuario evaluado
     * se limpia el viaje de valoraciones
     * se borra la valoración en sí
     */
    $user = get_user($evaluation->user_guid);
    if (!elgg_trigger_plugin_hook('evaluationcontent:delete', 'system', array('evaluation' => $evaluation), true)) {
        register_error(elgg_echo("evaluationcontent:notdeleted"));
    }
    $theTrip = get_entity($evaluation->trip);
    if ($theTrip) {
        //el viaje existe
        unset($theTrip->grade);
Пример #19
0
<?php

/**
 * Claim a question (by e-mail link).
 * 
 * @package Questions
 *
 */
$guid = (int) get_input('guid');
$question = get_entity($guid);
if (!elgg_is_logged_in()) {
    $_SESSION['last_forward_from'] = current_page_url();
    forward('/login');
}
if (!$question instanceof ElggQuestion) {
    register_error(elgg_echo("ClassException:ClassnameNotClass", array($guid, elgg_echo("item:object:question"))));
    forward(REFERER);
}
if (!$question->canEdit()) {
    register_error(elgg_echo("InvalidParameterException:NoEntityFound"));
    forward(REFERER);
}
if (!$question->workflowManager) {
    $question->workflowManager = elgg_get_logged_in_user_guid();
    $question->save();
    system_message(elgg_echo("questions:workflow:claim:success"));
} else {
    system_error(elgg_echo("questions:workflow:claim:failed"));
}
forward($question->getWorkflowURL());
Пример #20
0
*	Licence: 	CC-ByNCSA
*	Reference:	Microproyecto CEI BioTIC Ref. 11-2015
* 	Project coordinator: @rosanamontes
*	Website: http://lsi.ugr.es/rosana
*	
*	File: Save the plugin settings
*/
$fail = function () use($url) {
    register_error(elgg_echo('hflts:settings:fail'));
    forward($url);
};
// clear the method list of previous settings
$list = elgg_get_entities_from_metadata(['type' => 'object', 'subtype' => 'mcdm']);
if ($list) {
    if (!is_array($list)) {
        system_error("Revisar foreach de settings");
    }
    foreach ($list as $old_object) {
        if (!$old_object->delete()) {
            $fail();
        }
    }
}
$simple_settings = ['auto_moderation', 'weight_assessments', 'weight_experts', 'base_expertise', 'allowMany', 'debug', 'profile_display', 'termset', 'classic', 'todim', 'vikor', 'topsis', 'electre', 'promethee', 'aggOperator', 'exportTex'];
foreach ($simple_settings as $setting) {
    elgg_set_plugin_setting($setting, get_input($setting), 'hflts');
}
$aggOperator = elgg_get_plugin_setting('aggOperator', 'hflts');
switch ($aggOperator) {
    case '0':
        $operator = elgg_echo('hflts:aggOperator:minmax');
Пример #21
0
 function halt($message = '', $code = 0, $sql = '')
 {
     //error::db_error($message, $code, $sql);
     //throw new DbException($message, $code, $sql);
     system_error('db', $message);
 }
Пример #22
0
    }
    if (!empty($removeBan)) {
        $where = implode(" OR ", $removeBan);
        safe_query("UPDATE " . PREFIX . "user SET banned=NULL WHERE " . $where);
    }
    safe_query("UPDATE " . PREFIX . "settings SET bancheck='" . time() . "'");
}
$banned = safe_query("SELECT userID, banned, ban_reason FROM " . PREFIX . "user WHERE (userID='" . $userID . "' OR ip='" . $GLOBALS['ip'] . "') AND banned IS NOT NULL");
while ($bq = mysql_fetch_array($banned)) {
    if ($bq['ban_reason']) {
        $reason = "<br />" . $bq['ban_reason'];
    } else {
        $reason = '';
    }
    if ($bq['banned']) {
        system_error('You have been banished.' . $reason, 0);
    }
}
// -- BANNED IPs -- //
safe_query("DELETE FROM " . PREFIX . "banned_ips WHERE deltime < " . time() . "");
// -- WHO IS - WAS ONLINE -- //
$timeout = 5;
// 1 second
$deltime = time() - $timeout * 60;
// IS 1m
$wasdeltime = time() - 60 * 60 * 24;
// WAS 24h
safe_query("DELETE FROM " . PREFIX . "whoisonline WHERE time < '" . $deltime . "'");
// IS online
safe_query("DELETE FROM " . PREFIX . "whowasonline WHERE time < '" . $wasdeltime . "'");
// WAS online
Пример #23
0
	<?php 
// Define list of valid barcodes
// NOTE: This you might want to replace with a database query (or a file lookup) to look up if the given barcode is valid.
//       You might also want to register in your database or a file that the barcode was sent here to the server.
$valid_barcodes = array('8576482874', '2475587348', '4203716559', '9184783714', '1486424882', '2845717594', '2118477499');
// Validate incoming data
if (!$_GET['data']) {
    system_error('No barcode sent to server.');
}
if (!$_GET['id']) {
    system_error('No scanner ID sent to server.');
}
// Check if barcode is valid
if (in_array($_GET['data'], $valid_barcodes)) {
    echo '{"status":"ok","result_msg":"Everything is good! Welcome to the show!"}';
} else {
    system_error('Barcode is invalid.');
}
// --------------------------------------------------------------
// Utility functions
function system_error($err_msg)
{
    echo '{"status":"error","err_msg":"' . str_replace('"', '\\"', $err_msg) . '"}';
    exit;
}
?>

 @stop
@section("footer")
    @parent
 @stop