コード例 #1
0
ファイル: cloud.php プロジェクト: omusico/isle-web-framework
 /**
  * Constructor. Load helper plugin
  */
 function syntax_plugin_data_cloud()
 {
     $this->dthlp = plugin_load('helper', 'data');
     if (!$this->dthlp) {
         msg('Loading the data helper failed. Make sure the data plugin is installed.', -1);
     }
 }
コード例 #2
0
ファイル: config.class.php プロジェクト: Kirill/dokuwiki
 /**
  *  constructor
  */
 function configuration($datafile)
 {
     global $conf, $config_cascade;
     if (!@file_exists($datafile)) {
         msg('No configuration metadata found at - ' . htmlspecialchars($datafile), -1);
         return;
     }
     include $datafile;
     if (isset($config['varname'])) {
         $this->_name = $config['varname'];
     }
     if (isset($config['format'])) {
         $this->_format = $config['format'];
     }
     if (isset($config['heading'])) {
         $this->_heading = $config['heading'];
     }
     $this->_default_files = $config_cascade['main']['default'];
     $this->_local_files = $config_cascade['main']['local'];
     $this->_protected_files = $config_cascade['main']['protected'];
     #        if (isset($file['default'])) $this->_default_file = $file['default'];
     #        if (isset($file['local'])) $this->_local_file = $file['local'];
     #        if (isset($file['protected'])) $this->_protected_file = $file['protected'];
     $this->locked = $this->_is_locked();
     $this->_metadata = array_merge($meta, $this->get_plugintpl_metadata($conf['template']));
     $this->retrieve_settings();
 }
コード例 #3
0
ファイル: file_add.php プロジェクト: uralmax89/onxshop
 /**
  * main action
  */
 public function mainAction()
 {
     $relation = $this->GET['relation'];
     $File = $this->initializeFile($relation);
     if (!is_numeric($_POST['file']['link_to_node_id'])) {
         unset($_POST['file']['link_to_node_id']);
     }
     if ($_POST['add'] == 'add') {
         if ($File->insertFile($_POST['file'])) {
             msg('File inserted');
         }
         $this->tpl->assign('FILE', $_POST['file']);
     } else {
         $file_data['src'] = str_replace(ONXSHOP_PROJECT_DIR, "", $File->decode_file_path($this->GET['file_path_encoded']));
         $file_data['node_id'] = $this->GET['node_id'];
         $file_data['relation'] = $this->GET['relation'];
         if (trim($file_data['title']) == '') {
             $file_info = $File->getFileInfo(ONXSHOP_PROJECT_DIR . $file_data['src']);
             $file_data['title'] = $file_info['filename'];
             /**
              * clean
              */
             $file_data['title'] = $this->cleanFileTitle($file_data['title']);
         }
         $this->tpl->assign('FILE', $file_data);
     }
     $this->tpl->assign("SELECTED_{$this->GET['role']}", "selected='selected'");
     return true;
 }
コード例 #4
0
ファイル: db.php プロジェクト: bireme/proethos
function show_logo()
{
    global $http;
    $sx .= '<img src="img/logo_proethos.png" height=18>&nbsp;';
    $sx .= msg('about_print');
    return $sx;
}
コード例 #5
0
 /**
  * main action
  */
 public function mainAction()
 {
     /**
      * initialize
      */
     require_once 'models/client/client_customer.php';
     $Customer = new client_customer();
     $Customer->setCacheable(false);
     if (is_array($_POST['client'])) {
         $this->tpl->assign('CLIENT', $_POST['client']);
     }
     /**
      * save
      */
     if ($_POST['client']['customer']['save_newsletter_signup'] && $_POST['client']['customer']['first_name'] && $_POST['client']['customer']['last_name'] && $_POST['client']['customer']['email']) {
         if ($id = $Customer->newsletterSubscribe($_POST['client']['customer'])) {
             msg("Subscribed {$customer['email']}");
             $this->tpl->parse('content.thank_you');
             // set status cookie
             setcookie("newsletter_status", "1", time() + 3600 * 24 * 1000, "/");
             // set customer status
             if ($_POST['client']['customer']['email'] == $_SESSION['client']['customer']['email']) {
                 $_SESSION['client']['customer']['newsletter'] = 1;
             }
         } else {
             msg("Can't subscribe {$customer['email']}", 'error');
             $this->tpl->parse('content.form');
         }
     } else {
         $this->tpl->parse('content.form');
     }
     return true;
 }
コード例 #6
0
 function main()
 {
     global $_G;
     $id = intval($_GET['id']);
     if ($id < 1) {
         msg('ID不存在');
         return false;
     }
     $cache_name = 'article_' . $id;
     $cache = memory('get', $cache_name);
     if (is_array($cache)) {
         $article = $cache;
     } else {
         $article = D(array('table' => 'article', 'and' => ' id = ' . $id . '  AND `hide`=0 '));
         if (!$article[id]) {
             msg('抱歉,当前文章不存在或未审核');
         }
         $up = D(array('and' => ' AND id <' . $id, 'table' => __CLASS__, 'order' => 'id DESC'));
         $down = D(array('and' => ' AND id >' . $id, 'table' => __CLASS__, 'order' => 'id ASC'));
         $article[up] = $up[id] ? '<a href="' . $up[id_url] . '">' . $up[title] . '</a>' : '没有了';
         $article[down] = $down[id] ? '<a href="' . $down[id_url] . '">' . $down[title] . '</a>' : '没有了';
         save_history(__CLASS__, $article[id]);
         DB::update('article', array('views' => $article[views] + 1), 'id=' . $article[id]);
         memory('set', $cache_name, $article);
     }
     $this->add(array('article' => $article));
     seo($article['title'], $article['keywords'], $article['description']);
     $this->show($article['tpl']);
 }
コード例 #7
0
 function saved(&$event, $param)
 {
     global $ID;
     global $PROJECTS_REMAKE;
     if (auth_quickaclcheck($ID) <= AUTH_READ) {
         return;
     }
     $project = Project::project();
     if ($project == NULL) {
         return;
     }
     $file = $event->data['current']['ProjectFile'];
     $name = noNS($ID);
     if ($file == NULL) {
         // check whether the file is deleted
         if ($project->file($name) == NULL) {
             return;
         }
         // it was int he project
         if (!$project->remove_file($name)) {
             msg('Other users are currently updating the project. Please save this page later.');
             $evemt->data['current']['internal']['cache'] = false;
         }
         return;
     }
     if (!$project->update_file($file)) {
         msg('Other users are currently updating the project. Please save this page later.');
         $evemt->data['current']['internal']['cache'] = false;
     }
 }
コード例 #8
0
ファイル: action.php プロジェクト: sys42562/userfilter
 /**
  * Check if a user is allowed to login into the wiki by using the config values "allowed_usernames" and
  * "allowed_usergroups". If the user has no permission to login, the logout action is triggered and a info message
  * is displayed.
  *
  * @param Doku_Event $event The event object by reference
  * @param mixed      $param The parameters passed to register_hook when this handler was registered
  */
 public function handle_auth_acl_check(Doku_Event &$event, $param)
 {
     $user = $event->data['user'];
     $groups = $event->data['groups'];
     if ($user != '') {
         $isAllowed = false;
         if ($this->getConf('allowed_usernames')) {
             $allowedUserNames = explode(',', $this->getConf('allowed_usernames'));
             $isAllowed = in_array($user, $allowedUserNames);
         }
         if ($this->getConf('allowed_usergroups')) {
             $allowedUserGroups = explode(',', $this->getConf('allowed_usergroups'));
             foreach ($allowedUserGroups as $allowedUserGroup) {
                 if (in_array($allowedUserGroup, $groups)) {
                     $isAllowed = true;
                     break;
                 }
             }
         }
         if (!$isAllowed) {
             msg($this->getLang('nopermission'));
             auth_logoff();
         }
     }
 }
コード例 #9
0
 /**
  * main action
  */
 public function mainAction()
 {
     require_once 'models/ecommerce/ecommerce_product.php';
     require_once 'models/ecommerce/ecommerce_product_variety.php';
     require_once 'models/ecommerce/ecommerce_price.php';
     $Product = new ecommerce_product();
     $Product_variety = new ecommerce_product_variety();
     $Price = new ecommerce_price();
     $this->tpl->assign("VARIETY_CONF", $Product_variety->conf);
     if ($_POST['save']) {
         $product_data = $_POST['product'];
         /**
          * add product
          */
         if ($product_id = $Product->insertFullProduct($product_data)) {
             msg("Product id={$product_id} interted.");
             //TODO: implement two options: 1. save end this, 2. save and add another
             onxshopGoTo("backoffice/products/{$product_id}/edit");
             //empty
             $product_data = array();
         } else {
             msg("Product add has failed.", 'error');
         }
     } else {
         $product_data = array();
         $product_data['variety'] = array();
         $product_data['variety']['price'] = array();
         $product_data['variety']['name'] = 'Item';
         $product_data['variety']['weight_gross'] = 0;
         $product_data['variety']['stock'] = 999;
         $product_data['variety']['price']['value'] = 0;
     }
     $this->tpl->assign('PRODUCT', $product_data);
     return true;
 }
コード例 #10
0
ファイル: helper.php プロジェクト: omusico/isle-web-framework
 function msg($text)
 {
     if (is_array($text)) {
         $text = '<pre>' . print_r($text, true) . '</pre>';
     }
     msg($text, 2);
 }
コード例 #11
0
 /**
  * Prepare
  *
  * @param array $args data plugin related field arguments
  */
 private function prepareColumns($args)
 {
     /** @var helper_plugin_data $dthlp */
     $dthlp = plugin_load('helper', 'data');
     if (!$dthlp) {
         msg('Loading the data helper failed. Make sure the data plugin is installed.', -1);
     }
     foreach ($args as $arg) {
         $arg = $this->replaceTranslation($arg);
         $datatype = $dthlp->_column($arg);
         if (is_array($datatype['type'])) {
             $datatype['basetype'] = $datatype['type']['type'];
             $datatype['enum'] = $datatype['type']['enum'];
             $datatype['type'] = $datatype['origtype'];
         } else {
             $datatype['basetype'] = $datatype['type'];
         }
     }
     $datatype['title'] = '@@DISPLAY@@';
     if (isset($datatype['enum'])) {
         $values = preg_split('/\\s*,\\s*/', $datatype['enum']);
         if (!$datatype['multi'] && $this->opt['optional']) {
             array_unshift($values, '');
         }
         $this->opt['args'] = $values;
         $this->additional = $datatype['multi'] ? array('multiple' => 'multiple') : array();
     } else {
         $classes = 'data_type_' . $datatype['type'] . ($datatype['multi'] ? 's' : '') . ' ' . 'data_type_' . $datatype['basetype'] . ($datatype['multi'] ? 's' : '');
         $content = form_makeTextField('@@NAME@@', '@@VALUE@@', '@@DISPLAY@@', '@@ID@@', '@@CLASS@@ ' . $classes);
         $this->tpl = $content;
     }
     if (!isset($this->opt['display'])) {
         $this->opt['display'] = $this->opt['label'];
     }
 }
コード例 #12
0
 function translateLinksCallback($matches)
 {
     msg("Encoding {$matches[1]}", 'ok', 3);
     $url_encode = base64_encode($matches[1]);
     $url = "href=\"?link={$url_encode}\"";
     return $url;
 }
コード例 #13
0
ファイル: subscription.php プロジェクト: JeromeS/dokuwiki
/**
 * Set subscription information
 *
 * Allows to set subscription informations for permanent storage in meta files.
 * Subscriptions consist of a target object, a subscribing user, a subscribe
 * style and optional data.
 * A subscription may be deleted by specifying an empty subscribe style.
 * Only one subscription per target and user is allowed.
 * The function returns false on error, otherwise true. Note that no error is
 * returned if a subscription should be deleted but the user is not subscribed
 * and the subscription meta file exists.
 *
 * @param string $user      The subscriber or unsubscriber
 * @param string $page      The target object (page or namespace), specified by
 *                          id; Namespaces are identified by a trailing colon.
 * @param string $style     The subscribe style; DokuWiki currently implements
 *                          “every”, “digest”, and “list”.
 * @param string $data      An optional data blob
 * @param bool   $overwrite Whether an existing subscription may be overwritten
 *
 * @author Adrian Lang <*****@*****.**>
 */
function subscription_set($user, $page, $style, $data = null, $overwrite = false)
{
    global $lang;
    if (is_null($style)) {
        // Delete subscription.
        $file = subscription_filename($page);
        if (!@file_exists($file)) {
            msg(sprintf($lang['subscr_not_subscribed'], $user, prettyprint_id($page)), -1);
            return false;
        }
        // io_deleteFromFile does not return false if no line matched.
        return io_deleteFromFile($file, subscription_regex(array('user' => $user)), true);
    }
    // Delete subscription if one exists and $overwrite is true. If $overwrite
    // is false, fail.
    $subs = subscription_find($page, array('user' => $user));
    if (count($subs) > 0 && array_pop(array_keys($subs)) === $page) {
        if (!$overwrite) {
            msg(sprintf($lang['subscr_already_subscribed'], $user, prettyprint_id($page)), -1);
            return false;
        }
        // Fail if deletion failed, else continue.
        if (!subscription_set($user, $page, null)) {
            return false;
        }
    }
    $file = subscription_filename($page);
    $content = auth_nameencode($user) . ' ' . $style;
    if (!is_null($data)) {
        $content .= ' ' . $data;
    }
    return io_saveFile($file, $content . "\n", true);
}
コード例 #14
0
ファイル: action.php プロジェクト: sawachan/abortlogin
 function dw_start(&$event, $param)
 {
     global $ACT, $INFO, $USERINFO;
     $ip = $_SERVER['REMOTE_ADDR'];
     $test = $this->getConf('test');
     $allowed = $this->getConf('allowed');
     if ($test && isset($USERINFO) && in_array('admin', $USERINFO['grps'])) {
         $tests = explode(',', $test);
         foreach ($tests as $test) {
             $test = trim($test);
             if (!$this->is_allowed($allowed, $test)) {
                 msg("{$test} is not a valid IP");
             } else {
                 msg("{$test} is a valid IP");
             }
         }
         return;
     }
     if ($ACT == 'login' && !$this->is_allowed($allowed, $ip)) {
         if ($this->getConf('log')) {
             $this->log($ip);
             header("HTTP/1.0 403 Forbidden");
             exit("<div style='text-align:center; padding-top:2em;'><h1>403: Login Not Available</h1></div>");
         }
     }
 }
コード例 #15
0
 function handle_start(&$event, $param)
 {
     global $ID;
     global $ACT;
     global $INFO;
     if ($ACT != 'show') {
         return;
     }
     if (!$INFO['exists']) {
         return;
     }
     # don't try to read an article that doesn't exist
     $all = rtrim(rawWiki($ID));
     $inner = substr($all, 2, -2);
     if ($all == '[[' . $inner . ']]' and strpos($inner, '[[') === false and strpos($inner, ']]') === false) {
         if (!strpos($inner, '://') === false) {
             $url = $inner;
             # link is URL already
         } else {
             msg(sprintf('From: <a href="' . wl($ID, 'do=edit') . '">' . hsc($ID) . '</a>'));
             $url = html_wikilink($inner, $name = null, $search = '');
             $url = substr($url, strpos($url, '"') + 1);
             $url = substr($url, 0, strpos($url, '"'));
         }
         idx_addPage($ID);
         # ensure fulltext search indexing of referrer article - to put it on the backlink page of target article
         send_redirect($url);
     }
 }
コード例 #16
0
ファイル: default.php プロジェクト: uralmax89/onxshop
 /**
  * save
  *
  */
 function save()
 {
     $node_data = $_POST['node'];
     if ($node_data['publish'] == 'on' || $node_data['publish'] == 1) {
         $node_data['publish'] = 1;
     } else {
         $node_data['publish'] = 0;
     }
     if ($node_data['display_title'] == 'on' || $node_data['display_title'] == 1) {
         $node_data['display_title'] = 1;
     } else {
         $node_data['display_title'] = 0;
     }
     if ($node_data['require_login'] == 'on' || $node_data['require_login'] == 1) {
         $node_data['require_login'] = 1;
     } else {
         $node_data['require_login'] = 0;
     }
     if ($node_data['require_ssl'] == 'on' || $node_data['require_ssl'] == 1) {
         $node_data['require_ssl'] = 1;
     } else {
         $node_data['require_ssl'] = 0;
     }
     if ($this->Node->nodeUpdate($node_data)) {
         msg("{$node_data['node_group']} (id={$node_data['id']}) has been updated");
     } else {
         msg("Cannot update node {$node_data['node_group']} (id={$node_data['id']})", 'error');
     }
     //get whole detail
     $this->detail($_POST['node']['id']);
     //overwrite posted data
     $this->node_data = array_merge($this->node_data, $_POST['node']);
 }
コード例 #17
0
ファイル: stock_edit.php プロジェクト: AppChecker/onxshop
 /**
  * main action
  */
 public function mainAction()
 {
     require_once 'models/ecommerce/ecommerce_product_variety.php';
     require_once 'models/ecommerce/ecommerce_product.php';
     $Product_variety = new ecommerce_product_variety();
     $Product = new ecommerce_product();
     $this->tpl->assign('VARIETY_CONF', $Product_variety->conf);
     $Product_variety->set('id', $this->GET['id']);
     if ($_POST['save'] == 'save') {
         if ($id = $Product_variety->updateVariety($_POST['product']['variety'])) {
             msg("Product variety updated.");
             /*onxshopGoTo($_SESSION['last_diff'], 2);*/
         } else {
             msg("Can't add the product variety, is you product SKU unique?");
         }
     }
     $variety = $Product_variety->getVarietyDetail($this->GET['id']);
     $variety['publish'] = $variety['publish'] == 1 ? 'checked="checked" ' : '';
     $p = $Product->detail($variety['product_id']);
     $p['variety'] = $variety;
     $this->tpl->assign('PRODUCT', $p);
     /**
      * display confirmation if notifications are about to be sent out
      */
     require_once 'models/common/common_watchdog.php';
     $Watchdog = new common_watchdog();
     $this->tpl->assign('NOTIFICATIONS', array('back_in_stock_customer' => $Watchdog->checkWatchdog('back_in_stock_customer', $variety_id, 0, 1, true)));
     return true;
 }
コード例 #18
0
ファイル: news_add.php プロジェクト: AppChecker/onxshop
    /**
     * main action
     */
    public function mainAction()
    {
        require_once 'models/common/common_node.php';
        $Node = new common_node();
        $news_list_detail = $Node->getDetail($this->GET['blog_node_id']);
        $this->tpl->assign("NEWS_LIST", $news_list_detail);
        $node_data = $_POST['node'];
        if ($_POST['save']) {
            /**
             * pre-populate content
             */
            $node_data['description'] = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.';
            $node_data['content'] = '
		<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
		<ul>
		<li>velit esse cillum dolore</li>
		<li>consectetur adipisicing elit</li>
		<li>occaecat cupidatat non proident</li>
		</ul>
		<p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
			';
            /**
             * insert a new node
             */
            if ($id = $Node->nodeInsert($node_data)) {
                msg(ucfirst($node_data['node_group']) . " has been added.");
                //quick pages builder
                //$Page_builder = new Onxshop_Request("bo/page_builder@blank&parent=$id&node_group={$node_data['node_group']}&node_controller={$node_data['node_controller']}");
            }
        }
        $this->tpl->assign('NODE', $node_data);
        return true;
    }
コード例 #19
0
ファイル: plugins.php プロジェクト: pixode/Tieba-Cloud-Sign
/**
 * 安装插件
 * 如果存在,系统会调用 插件名_callback.php 的 callback_install()
 * @return  bool	
 */
function installPlugin($plugin)
{
    global $m, $i;
    if (file_exists(SYSTEM_ROOT . '/plugins/' . $plugin . '/' . $plugin . '.php')) {
        $info = getPluginInfo($plugin);
        //安装前判断版本
        if (isset($info['plugin']['forphp']) && strtolower($info['plugin']['forphp']) != 'all' && defined('PHP_VERSION')) {
            if (substr(PHP_VERSION, 0, 3) < $info['plugin']['forphp']) {
                msg('你的PHP版本过低(' . substr(PHP_VERSION, 0, 3) . '),无法安装该插件');
            }
        }
        if (isset($info['plugin']['version'])) {
            $ver = $info['plugin']['version'];
        } else {
            $ver = '';
        }
        $m->query("INSERT IGNORE INTO `" . DB_PREFIX . "plugins` (`name`,`status`,`ver`,`options`) VALUES ('{$plugin}','0','{$ver}','');");
        $callback_file = SYSTEM_ROOT . '/plugins/' . $plugin . '/' . $plugin . '_callback.php';
        if (file_exists($callback_file)) {
            require_once $callback_file;
            if (function_exists('callback_install')) {
                callback_install();
            }
        }
        return true;
    } else {
        return false;
    }
}
コード例 #20
0
ファイル: price_add.php プロジェクト: AppChecker/onxshop
 /**
  * main action
  */
 public function mainAction()
 {
     require_once 'models/ecommerce/ecommerce_price.php';
     $Price = new ecommerce_price();
     // type
     $types = $Price->getTypes();
     foreach ($types as $type) {
         $this->tpl->assign('TYPE', $type);
         if ($type == $_POST['price']['type'] || $type == $this->GET['type']) {
             $this->tpl->assign('SELECTED', "selected='selected'");
         } else {
             $this->tpl->assign('SELECTED', "");
         }
         $this->tpl->parse('content.type');
     }
     if ($_POST['save']) {
         $price_data = $_POST['price'];
         // FIXME: form_currency_inline hack
         $price_data['currency_code'] = $_POST['client']['customer']['currency_code'];
         if ($id = $Price->priceInsert($price_data)) {
             msg("Price added.");
             require_once 'models/ecommerce/ecommerce_product_variety.php';
             $Product_variety = new ecommerce_product_variety();
             $pd = $Product_variety->detail($price_data['product_variety_id']);
         } else {
             return false;
         }
     }
     $this->tpl->assign('PRICE', $_POST['price']);
     return true;
 }
コード例 #21
0
ファイル: action_base.php プロジェクト: AppChecker/onxshop
 /**
  * Set action status and action result message
  * 
  * @param bool   $status   true/false = completed/failed
  * @param string $message  action result message
  */
 public function setActionStatus($status, $message = null)
 {
     $this->tpl->assign("STATUS", $status ? "true" : "false");
     if ($message) {
         msg($message);
     }
 }
コード例 #22
0
ファイル: code.php プロジェクト: neutrinog/Door43
/**
 * Injects the necessary trackingcodes for piwik tracking (v2.x) into DOM
 * like specified in the plugin manager fields
 */
function piwik_code()
{
	global $conf;

	if (isset($conf['plugin']['piwik2']['js_tracking_code'])
        || (isset($conf['plugin']['piwik2']['img_tracking_code']))
    ) {
		// Config does not contain keys if they are default;
		// so check whether they are set & to non-default value
		
		// default 0, so check if it's not set or 0
		if (!isset($conf['plugin']['piwik2']['track_admin_user']) || $conf['plugin']['piwik2']['track_admin_user'] == 0) {
			if (isset($_SERVER['REMOTE_USER']) && auth_isadmin()) { return; }
		}
		
		// default 1, so check if it's set and 0
		if (isset($conf['plugin']['piwik2']['track_user']) && $conf['plugin']['piwik2']['track_user'] == 0) {
			if (isset($_SERVER['REMOTE_USER'])) { return; }
		}

        //changes made by Marcel Lange (info@bravehartk2.de)
        $trackingCode = (isset($conf['plugin']['piwik2']['js_tracking_code']))? $conf['plugin']['piwik2']['js_tracking_code'] : '';
        if(isset($conf['plugin']['piwik2']['use_img_tracking']) && $conf['plugin']['piwik2']['use_img_tracking'] == 1 && isset($conf['plugin']['piwik2']['img_tracking_code'])){
            $trackingCode = $conf['plugin']['piwik2']['img_tracking_code'];
        }
        ptln($trackingCode);
	} else {
		// Show configuration tip for admin
		if (isset($_SERVER['REMOTE_USER']) && auth_isadmin()) {
			msg('Please configure the piwik2 plugin');
		}
	}
}
コード例 #23
0
ファイル: mok_follow.php プロジェクト: chajianku/mok_follow
function mok_follow_check()
{
    $head = array('User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.99 Safari/537.36', 'Cookie:BDUSS=' . $_GET['bduss']);
    $opt = unserialize(option::get('mok_follow'));
    foreach ($opt['mustTieba'] as $tb => $lv) {
        $c = new wcurl('http://tieba.baidu.com/mo/m?kw=' . urlencode($tb), $head);
        $t = $c->get();
        $c->close();
        if (textMiddle($t, '&#160;(等级', ')') < $lv) {
            msg($opt['error'][0]);
        }
    }
    if (count($opt['optionTieba']) > 0) {
        $check = false;
        foreach ($opt['optionTieba'] as $tb => $lv) {
            $c = new wcurl('http://tieba.baidu.com/mo/m?kw=' . urlencode($tb), $head);
            $t = $c->get();
            $c->close();
            if (textMiddle($t, '&#160;(等级', ')') >= $lv) {
                $check = true;
                break;
            }
        }
        if ($check == false) {
            msg($opt['error'][0]);
        }
    }
}
コード例 #24
0
 /**
  * main action
  */
 public function mainAction()
 {
     /**
      * include variety confg
      */
     require_once 'models/ecommerce/ecommerce_product_variety.php';
     $variety_conf = ecommerce_product_variety::initConfiguration();
     $this->tpl->assign('VARIETY_CONF', $variety_conf);
     /**
      * product
      */
     require_once 'models/ecommerce/ecommerce_product.php';
     $Product = new ecommerce_product();
     $product = $Product->getProductDetail($this->GET['id']);
     if (is_array($product['variety'])) {
         foreach ($product['variety'] as $variety) {
             if ($variety['publish'] == 0) {
                 $this->tpl->assign('DISABLED', 'disabled');
             } else {
                 $this->tpl->assign('DISABLED', '');
             }
             $Image = new Onxshop_Request("component/image&relation=product_variety&node_id={$variety['id']}");
             $this->tpl->assign('IMAGE', $Image->getContent());
             $this->tpl->assign('VARIETY', $variety);
             $this->tpl->parse('content.variety');
         }
     } else {
         msg('This product has no variety.');
     }
     return true;
 }
コード例 #25
0
 /**
  * custom comment action
  */
 public function customCommentAction($data, $options)
 {
     if ($this->checkEditPermission($data)) {
         if (is_numeric($this->GET['comment_id'])) {
             $comment_id = $this->GET['comment_id'];
         } else {
             return false;
         }
         if (is_numeric($this->GET['publish'])) {
             $publish = $this->GET['publish'];
         } else {
             return false;
         }
         $comment_data = $this->Comment->getDetail($comment_id);
         $comment_data['publish'] = $publish;
         if ($this->Comment->updateComment($comment_data)) {
             if ($publish == 1) {
                 msg("Recipe review ID {$comment_id} approved by client ID {$_SESSION['client']['customer']['id']}");
             } else {
                 if ($publish == -1) {
                     msg("Recipe review ID {$comment_id} rejected by client ID {$_SESSION['client']['customer']['id']}");
                 }
             }
             onxshopGoTo($_SESSION['referer'], 2);
         }
     }
     return true;
 }
コード例 #26
0
 /**
  * [Custom event handler which performs action]
  *
  * @param Doku_Event $event event object by reference
  * @param mixed $param [the parameters passed as fifth argument to register_hook() when this
  *                           handler was registered]
  * @return void
  */
 public function handle_auth_user_change(Doku_Event &$event, $param)
 {
     if ($event->data['type'] !== 'create') {
         return;
     }
     $domains = array_map(function ($domain) {
         return trim($domain);
     }, explode(';', $this->getConf('_domainWhiteList')));
     $email = $event->data['params'][3];
     $checks = array(in_array(trim(substr(strrchr($email, "@"), 1)), $domains), (bool) preg_match($this->getConf('_emailRegex', '/@/'), $email));
     if ($this->getConf('checksAnd', true)) {
         $status = array_reduce($checks, function ($a, $b) {
             return $a && $b;
         }, true);
     } else {
         $status = array_reduce($checks, function ($a, $b) {
             return $a || $b;
         }, false);
     }
     if (!$status) {
         $event->preventDefault();
         $event->stopPropagation();
         $event->result = false;
         msg($this->getConf('_domainlistErrorMEssage'), -1);
     }
 }
コード例 #27
0
 /**
  * Load a whole schema as fields
  *
  * @param Doku_Event $event event object by reference
  * @param mixed $param [the parameters passed as fifth argument to register_hook() when this
  *                           handler was registered]
  * @return bool
  */
 public function handle_schema(Doku_Event $event, $param)
 {
     $args = $event->data['args'];
     if ($args[0] != 'struct_schema') {
         return false;
     }
     $event->preventDefault();
     $event->stopPropagation();
     /** @var helper_plugin_bureaucracy_field $helper */
     $helper = plugin_load('helper', 'bureaucracy_field');
     $helper->initialize($args);
     $schema = new Schema($helper->opt['label']);
     if (!$schema->getId()) {
         msg('This schema does not exist', -1);
         return false;
     }
     foreach ($schema->getColumns(false) as $column) {
         /** @var helper_plugin_struct_field $field */
         $field = plugin_load('helper', 'struct_field');
         // we don't initialize the field but set the appropriate values
         $field->opt = $helper->opt;
         // copy all the settings to each field
         $field->opt['label'] = $column->getFullQualifiedLabel();
         $field->column = $column;
         $event->data['fields'][] = $field;
     }
     return true;
 }
コード例 #28
0
ファイル: xfields.php プロジェクト: Hadryan/L2LWEB
 function xfieldssave($data)
 {
     global $lang, $dle_login_hash;
     if ($_REQUEST['user_hash'] == "" or $_REQUEST['user_hash'] != $dle_login_hash) {
         die("Hacking attempt! User not found");
     }
     $data = array_values($data);
     $filecontents = "";
     foreach ($data as $index => $value) {
         $value = array_values($value);
         foreach ($value as $index2 => $value2) {
             $value2 = stripslashes($value2);
             $value2 = str_replace("|", "&#124;", $value2);
             $value2 = str_replace("\r\n", "__NEWL__", $value2);
             $filecontents .= $value2 . ($index2 < count($value) - 1 ? "|" : "");
         }
         $filecontents .= $index < count($data) - 1 ? "\r\n" : "";
     }
     $filehandle = fopen(ENGINE_DIR . '/data/xfields.txt', "w+");
     if (!$filehandle) {
         msg("error", $lang['xfield_error'], "{$lang['xfield_err_1']} \"" . ENGINE_DIR . "/data/xfields.txt\", {$lang['xfield_err_1']}");
     }
     $find = array('/data:/i', '/about:/i', '/vbscript:/i', '/onclick/i', '/onload/i', '/onunload/i', '/onabort/i', '/onerror/i', '/onblur/i', '/onchange/i', '/onfocus/i', '/onreset/i', '/onsubmit/i', '/ondblclick/i', '/onkeydown/i', '/onkeypress/i', '/onkeyup/i', '/onmousedown/i', '/onmouseup/i', '/onmouseover/i', '/onmouseout/i', '/onselect/i', '/javascript/i', '/javascript/i');
     $replace = array("d&#097;ta:", "&#097;bout:", "vbscript<b></b>:", "&#111;nclick", "&#111;nload", "&#111;nunload", "&#111;nabort", "&#111;nerror", "&#111;nblur", "&#111;nchange", "&#111;nfocus", "&#111;nreset", "&#111;nsubmit", "&#111;ndblclick", "&#111;nkeydown", "&#111;nkeypress", "&#111;nkeyup", "&#111;nmousedown", "&#111;nmouseup", "&#111;nmouseover", "&#111;nmouseout", "&#111;nselect", "j&#097;vascript");
     $filecontents = preg_replace($find, $replace, $filecontents);
     $filecontents = preg_replace("#<iframe#i", "&lt;iframe", $filecontents);
     $filecontents = preg_replace("#<script#i", "&lt;script", $filecontents);
     $filecontents = str_replace("<?", "&lt;?", $filecontents);
     $filecontents = str_replace("?>", "?&gt;", $filecontents);
     $filecontents = str_replace("\$", "&#036;", $filecontents);
     fwrite($filehandle, $filecontents);
     fclose($filehandle);
     header("Location: http://" . $_SERVER["HTTP_HOST"] . $_SERVER["PHP_SELF"] . "?mod=xfields&xfieldsaction=configure");
     exit;
 }
コード例 #29
0
ファイル: edit_template.php プロジェクト: AppChecker/onxshop
 /**
  * main action
  */
 public function mainAction()
 {
     $template['file'] = ONXSHOP_DIR . "templates/{$this->GET['template']}";
     $tpl = new XTemplate($template['file']);
     $tpl->parse('title');
     $tpl->parse('description');
     $tpl->parse('keywords');
     $tpl->parse('head');
     $template['title'] = $tpl->text('title');
     $template['description'] = $tpl->text('description');
     $template['keywords'] = $tpl->text('keywords');
     $template['head'] = $tpl->text('head');
     if (file_exists($template['file'])) {
         $file_content = file($template['file']);
         foreach ($file_content as $file_line) {
             $proc = 1;
             if (preg_match('/<\\!-- BEGIN: content -->/', $file_line)) {
                 $add = 1;
                 $proc = 0;
             } else {
                 if (preg_match('/<\\!-- END: content -->/', $file_line)) {
                     $add = 0;
                 }
             }
             if ($add == 1 && $proc == 1) {
                 $template['content'] = $template['content'] . $file_line;
             }
         }
     } else {
         msg("template {$template['file']} does not exists!", 'error', 1);
     }
     $this->tpl->assign('template', $template);
     return true;
 }
コード例 #30
0
 /**
  * Constructor. Load helper plugin
  */
 public function __construct()
 {
     $this->dthlp = plugin_load('helper', 'data');
     if (!$this->dthlp) {
         msg('Loading the data helper failed. Make sure the data plugin is installed.', -1);
     }
 }