public function index()
 {
     //为方便调试, 插件功能模块编译不缓存
     C('TMPL_CACHE_ON', false);
     $name = $this->_get('name', false);
     if (empty($name)) {
         $this->error('参数错误!');
     }
     $method = $this->_get('method', false);
     $method = empty($method) ? 'index' : $method;
     $path = './Public/Plugin/' . $name . '/admin.php';
     if (file_exists($path)) {
         $model = M('plugin');
         $map['title'] = $name;
         $list = $model->where($map)->find();
         if (!$list) {
             $this->error('当前插件没有注册!');
         }
         if ($list['status'] == 1) {
             $this->error('当前插件没有启用!');
         }
     } else {
         $this->error('当前插件无管理功能!');
     }
     echo plugin($name, $method);
 }
Exemple #2
0
 public static function display()
 {
     $messages = "";
     if ($_POST['cc_form'] === 'add-group') {
         $group = $_POST['group'];
         $rows = Database::select('users', 'name', array('name = ? AND type = ?', $group, 'group'), null, 1)->fetch(PDO::FETCH_ASSOC);
         if (!empty($rows)) {
             $messages .= Message::error(__('admin', 'group-in-use'));
         } else {
             $row = DB::select('users', array('data'), array('users_id = ?', $_GET['parent']))->fetch(PDO::FETCH_ASSOC);
             $inheritance = unserialize($row['data']);
             $inheritance = $inheritance['permissions'];
             $result = Database::insert('users', array('name' => filter('admin_add_group_name', $group), 'type' => 'group', 'group' => '-1', 'data' => serialize(filter('admin_add_group_data', array('permissions' => $inheritance)))));
             if ($result === 1) {
                 $messages .= Message::success(__('admin', 'group-added'));
             }
         }
     }
     $form = new Form('self', 'post', 'add-group');
     $form->startFieldset(__("admin", 'group-information'));
     $form->addInput(__('admin', 'group-name'), 'text', 'group', self::get('group'));
     $groups = Users::allGroups();
     foreach ($groups as $key => $value) {
         $groups[$value->getId()] = $value->getName();
     }
     $form->addSelectList(__('admin', 'inherit-permissions'), 'parent', $groups);
     plugin('admin_add_group_custom_fields', array(&$form));
     $form->addSubmit('', 'add-group', __('admin', 'add-group'));
     $form->endFieldset();
     plugin('admin_add_group_custom_fieldset', array(&$form));
     $form = $form->endAndGetHTML();
     return array(__('admin', 'add-group'), $messages . $form);
 }
 /**
  * Main action.
  *
  * @return void
  */
 public function index()
 {
     $this->loadModel('System.Options');
     $languages = LocaleToolbox::languagesList();
     $arrayContext = ['schema' => ['site_title' => 'string', 'site_slogan' => 'string', 'site_description' => 'string', 'site_email' => 'string', 'site_contents_home' => 'integer', 'site_maintenance' => 'boolean', 'site_maintenance_ip' => 'string', 'site_maintenance_message' => 'string', 'default_language' => 'string', 'url_locale_prefix' => 'string'], 'defaults' => [], 'errors' => []];
     $variables = $this->Options->find()->where(['name IN' => array_keys($arrayContext['schema'])])->all();
     foreach ($variables as $var) {
         $arrayContext['defaults'][$var->name] = $var->value;
     }
     if ($this->request->data()) {
         $validator = $this->_mockValidator();
         $errors = $validator->errors($this->request->data());
         if (empty($errors)) {
             foreach ($this->request->data() as $k => $v) {
                 $this->Options->update($k, $v, null, false);
             }
             snapshot();
             $this->Flash->success(__d('system', 'Configuration successfully saved!'));
             $this->redirect($this->referer());
         } else {
             $arrayContext['errors'] = $errors;
             $this->Flash->danger(__d('system', 'Configuration could not be saved, please check your information.'));
         }
     }
     $pluginSettings = plugin()->filter(function ($plugin) {
         return !$plugin->isTheme && $plugin->hasSettings;
     });
     $this->title(__d('system', 'Site’ Configuration'));
     $this->set(compact('arrayContext', 'languages', 'variables', 'pluginSettings'));
     $this->Breadcrumb->push('/admin/system/configuration');
 }
Exemple #4
0
function baz_u($d)
{
    list($ob, $op) = split_right(':', $d);
    list($od, $oq) = split_one('/', $op);
    //echo $ob.'-'.$od.'-'.$oq.br();
    if ($oq) {
        switch ($od) {
            case 'bal':
                return bal($oq, $ob);
                break;
            case 'plug':
                return plugin($oq, $ob);
                break;
        }
    } else {
        switch ($op) {
            case 'br':
                return br();
                break;
            case 'b':
                return bal($op, $ob);
                break;
            case 'u':
                return bal($op, $ob);
                break;
        }
    }
    return '(' . $d . ')';
}
Exemple #5
0
function plug_exsys($p, $o = '')
{
    $rid = 'plg' . $p;
    $ret .= autoclic('param', $p, 10, 244, '', 1) . ' ';
    $ret .= lj('', $rid . '_plug___exsys_sys___param', picto('reload'));
    return $ret . divd($rid, plugin($plg, $p, $o));
}
 /**
  * Class constructor.
  *
  * Reorganizing class members.
  *
  * @param string $prev_version Version they are upgrading from.
  */
 public function __construct($prev_version)
 {
     $this->plugin = plugin();
     $this->prev_version = (string) $prev_version;
     $this->run_handlers();
     // Run upgrade(s).
 }
 /**
  * Gets an instance of the given adapter name (or default adapter if not given).
  *
  * @param string|null $name Name of the adapter, or null to use default adapter
  *  selected in Captcha plugin's setting page. The latest registered adapter
  *  will be used if no default adapter has been selected yet
  * @param array $config Options to be passed to Adapter's `config()` method, if
  *  not given it will try to get such parameters from Captcha plugin's settings
  * @return \Captcha\Adapter\BaseAdapter
  * @throws \Captcha\Error\AdapterNotFoundException When no adapter was found
  */
 public static function adapter($name = null, array $config = [])
 {
     $class = null;
     if ($name === null) {
         $default = (string) plugin('Captcha')->settings('default_adapter');
         if (!empty($default)) {
             return static::adapter($default, $config);
         }
         $class = end(static::$_adapters);
     } elseif (isset(static::$_adapters[$name])) {
         $class = static::$_adapters[$name];
     }
     if (empty($config)) {
         $config = (array) plugin('Captcha')->settings($name);
     }
     if (is_string($class) && class_exists($class)) {
         $class = new $class($config);
         $created = true;
     }
     if ($class instanceof BaseAdapter) {
         if (!isset($created)) {
             $class->config($config);
         }
         return $class;
     }
     throw new AdapterNotFoundException(__d('captcha', 'The captcha adapter "{0}" was not found.'), $name);
 }
Exemple #8
0
function plug_microform($p, $id)
{
    $rid = 'mfr' . randid();
    //echo $p.'-'.$id;
    $nod = ses('mform', ses('qb') . '_microform_' . $id);
    req('pop');
    ses('mformj', $rid . '_plug___microform_plug*microform_' . ajx($p) . '_' . $id);
    reqp('msql');
    $msq = new msql('', $nod);
    //table
    list($p, $tp) = explode('§', $p);
    $rb = mform_mr($p);
    //p($rb);
    $msq->create($rb);
    $ret .= make_form($p, 'mfr' . $id, '_plug___microform_mform*j_' . ajx($p, '') . '_' . $id . '_') . br();
    if (auth(4)) {
        $ret .= msqlink('users', ses('mform')) . ' ' . btn('txtsmall2', $nod) . ' ';
    }
    if ($tp == 1) {
        $ret .= mform_read($id);
    } elseif ($tp) {
        $ret .= plugin('msqtemplate', $nod, $tp);
    }
    return divd($rid, $ret . $bt);
}
 /**
  * {@inheritDoc}
  */
 public function send()
 {
     $this->subject(plugin('User')->settings['message_activation_subject'])->body(plugin('User')->settings['message_activation_body']);
     if (plugin('User')->settings['message_activation']) {
         return parent::send();
     }
     return true;
 }
Exemple #10
0
 /**
  * Class constructor.
  *
  * @since 150218 Refactoring cache clear/purge routines.
  */
 public function __construct()
 {
     $this->plugin = plugin();
     $this->home_url = home_url('/');
     $this->default_feed = get_default_feed();
     $this->seo_friendly_permalinks = (bool) get_option('permalink_structure');
     $this->feed_types = array_unique(array($this->default_feed, 'rdf', 'rss', 'rss2', 'atom'));
 }
Exemple #11
0
/**
 * Includes the theme file for the given theme. (it is pretty important).
 *
 * @param string $theme The name of the theme!
 */
function cc_theme_include($theme)
{
    plugin('core_theme_include', array($theme));
    $file = filter('core_theme_include', TH_ROOT . TH_THEMES . $theme . '/index.tpl.php');
    if (file_exists($file)) {
        require_once $file;
    }
}
Exemple #12
0
 /**
  * Callback function triggered at the beginning of the rendering process of
  * an individual comment.
  *
  * @param   string   $output   Generated output.
  * @param   Comment  $comment  Comment to render.
  * @param   integer  $level    Current level in the hierarchy.
  */
 protected function onCommentStart(&$output, $comment, $level = 0)
 {
     if ($template = plugin('comments')->finder()->locate('comment')) {
         ob_start();
         require $template;
         $output .= ob_get_clean();
     }
 }
Exemple #13
0
 public function enqueue_scripts()
 {
     wp_enqueue_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css');
     wp_enqueue_script('fancybox', '//cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.5/jquery.fancybox.min.js', array('jquery'));
     wp_enqueue_style('fancybox', '//cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.5/jquery.fancybox.min.css');
     wp_enqueue_script('super-redirect-polyfill', plugins_url('', plugin()->file) . '/client-s/custom-element-polyfill.min.js');
     wp_enqueue_script('super-redirect-admin', plugins_url('', plugin()->file) . '/client-s/admin.js', array('jquery', 'jquery-ui-sortable', 'jquery-effects-core', 'jquery-effects-pulsate'));
     wp_enqueue_style('super-redirect-admin', plugins_url('', plugin()->file) . '/client-s/admin.css');
 }
 /**
  * Default validation rules.
  *
  * @param \Cake\Validation\Validator $validator The validator object
  * @return \Cake\Validation\Validator
  */
 public function validationDefault(Validator $validator)
 {
     return $validator->add('theme', 'validTheme', ['rule' => function ($value, $context) {
         $exists = plugin()->filter(function ($plugin) use($value) {
             return $plugin->isTheme && $plugin->name === $value;
         })->first();
         return !empty($exists);
     }, 'message' => __d('block', 'Invalid theme for region.')]);
 }
 /**
  * Main action.
  *
  * Here is where we render all available documents. Plugins are able to define
  * their own `help document` just by creating an view-element named `help.ctp`.
  *
  * Example:
  *
  * Album plugin may create its own `help document` by creating this file:
  *
  *     /plugins/Album/src/Template/Element/Help/help.ctp
  *
  * Optionally, plugins are able to define translated versions of help documents.
  * To do this, you must simply define a view element as `help_[code].ctp`, where
  * `[code]` is a two-character language code. For example:
  *
  *     help_en_US.ctp
  *     help_es.ctp
  *     help_fr.ctp
  *
  * @return void
  */
 public function index()
 {
     $plugins = plugin()->filter(function ($plugin) {
         return $plugin->status && $plugin->hasHelp;
     });
     $this->title(__d('system', 'Help'));
     $this->set('plugins', $plugins);
     $this->Breadcrumb->push('/admin/system/help');
 }
Exemple #16
0
function ifrgz($dr)
{
    $r = explore($dr);
    $f = 'users/public/ifr' . date('ymd') . '.tar';
    if (!is_file($f)) {
        $ret = plugin('tar', $f, $dr);
    }
    rmdir_r($dr);
    return $ret;
}
 /**
  *
  * Adds a shortcut button to Comment's management submenu.
  *
  * @param \Go\Aop\Intercept\MethodInvocation $invocation Invocation
  * @Before("execution(public Menu\View\Helper\MenuHelper->render(*))")
  */
 public function commentsNav(MethodInvocation $invocation)
 {
     $helper = $invocation->getThis();
     $settings = plugin('Disqus')->settings;
     list($items, $options) = $invocation->getArguments();
     if (!empty($settings['disqus_shortname']) && count($items) == 5 && $items[0]['title'] == __d('comment', 'All')) {
         $items[] = ['title' => __d('disqus', 'Go to Disqus Moderation'), 'url' => 'https://' . $settings['disqus_shortname'] . '.disqus.com/admin/moderate/', 'target' => '_blank'];
         $this->setProperty($invocation, 'arguments', [$items, $options]);
     }
 }
Exemple #18
0
 /**
  * Class constructor.
  *
  * @since 141111 First documented version.
  */
 public function __construct()
 {
     $this->plugin = plugin();
     $class = get_called_class();
     if (empty(static::$___static[$class])) {
         static::$___static[$class] = [];
     }
     $this->static =& static::$___static[$class];
     $this->___overload = new \stdClass();
 }
Exemple #19
0
 /**
  * 会员组升级
  */
 protected function groupUpdate()
 {
     if (empty($this->memberinfo)) {
         return false;
     }
     if (empty($this->membergroup)) {
         return false;
     }
     $group = array();
     $update = 0;
     $credit = $this->memberinfo['credits'];
     $groupid = $this->memberinfo['groupid'];
     if (plugin('vip')) {
         //会员组付费插件
         $vip = $this->plugin_model('vip', 'vip');
         $row = $vip->find($this->memberinfo['id']);
         //查询数据
         if ($row) {
             //存在付费组中,判断是否到期
             if ($row['endtime'] - time() > 0) {
                 return false;
                 //未到期直接跳过
             } else {
                 $vip->delete('userid=' . $this->memberinfo['id']);
                 //删除该会员数据
                 $update = 1;
                 //更新标识
             }
         }
     }
     //属于非自动升级会员组直接跳过
     if ($update == 0 && $this->membergroup[$groupid]['auto']) {
         return false;
     }
     foreach ($this->membergroup as $t) {
         $group[$t['id']] = $t['credits'];
     }
     asort($group);
     foreach ($group as $gid => $g) {
         if ($credit >= $g) {
             $groupid = $gid;
         }
     }
     if ($groupid != $this->memberinfo['groupid']) {
         //升级
         $this->member->update(array('groupid' => $groupid), 'id=' . $this->memberinfo['id']);
         if (!isset($this->memberconfig['email']) || $this->memberconfig['email'] == 0) {
             return false;
         }
         mail::set($this->site);
         $content = $this->memberconfig['group_tpl'] ? $this->memberconfig['group_tpl'] : lang('m-com-2');
         $content = str_replace(array('{username}', '{groupname}', '{credit}'), array($this->memberinfo['username'], $this->membergroup[$groupid]['name'], $this->memberinfo['credits']), $content);
         mail::sendmail($this->memberinfo['email'], lang('m-com-3', array('1' => $this->memberinfo['username'])), htmlspecialchars_decode($content));
     }
 }
 public function __construct()
 {
     $this->plugin = plugin();
     if (empty($_REQUEST[__NAMESPACE__])) {
         return;
     }
     foreach ((array) $_REQUEST[__NAMESPACE__] as $action => $args) {
         if (method_exists($this, $action)) {
             $this->{$action}($args);
         }
     }
 }
Exemple #21
0
function plug_plug($plg, $p = '', $o = '', $res = '')
{
    $rid = 'plg' . $plg . $p;
    if ($res) {
        list($plg, $p, $o) = ajxr($res);
    }
    $ret .= lj('', $rid . '_plug__3_plug_plug*call___plugin|plugp|plugo', picto('reload')) . ' ';
    $ret .= select_j('plugin', 'plug', '', '', '', '2');
    $ret .= input(1, 'plugin', $plg ? $plg : 'plugin', '', 1) . ' ';
    $ret .= input(1, 'plugp', $p ? $p : 'param', '', 1) . ' ';
    $ret .= input(1, 'plugo', $o ? $o : 'option', '', 1) . ' ';
    return $ret . divd($rid, plugin($plg, $p, $o));
}
 /**
  * Renders the login form.
  *
  * @return \Cake\Network\Response|null
  */
 public function login()
 {
     $this->loadModel('User.Users');
     $this->viewBuilder()->layout('login');
     if ($this->request->is('post')) {
         $loginBlocking = plugin('User')->settings('failed_login_attempts') && plugin('User')->settings('failed_login_attempts_block_seconds');
         $continue = true;
         if ($loginBlocking) {
             Cache::config('users_login', ['duration' => '+' . plugin('User')->settings('failed_login_attempts_block_seconds') . ' seconds', 'path' => CACHE, 'engine' => 'File', 'prefix' => 'qa_', 'groups' => ['acl']]);
             $cacheName = 'login_failed_' . env('REMOTE_ADDR');
             $cache = Cache::read($cacheName, 'users_login');
             if ($cache && $cache['attempts'] >= plugin('User')->settings('failed_login_attempts')) {
                 $blockTime = (int) plugin('User')->settings('failed_login_attempts_block_seconds');
                 $this->Flash->warning(__d('user', 'You have reached the maximum number of login attempts. Try again in {0} minutes.', $blockTime / 60));
                 $continue = false;
             }
         }
         if ($continue) {
             $user = $this->Auth->identify();
             if ($user) {
                 $this->Auth->setUser($user);
                 if (!empty($user['id'])) {
                     try {
                         $user = $this->Users->get($user['id']);
                         if ($user) {
                             $this->Users->touch($user, 'Users.login');
                             $this->Users->save($user);
                         }
                     } catch (\Exception $e) {
                         // invalid user
                     }
                 }
                 return $this->redirect($this->Auth->redirectUrl());
             } else {
                 if ($loginBlocking && isset($cache) && isset($cacheName)) {
                     $cacheStruct = ['attempts' => 0, 'last_attempt' => 0, 'ip' => '', 'request_log' => []];
                     $cache = array_merge($cacheStruct, $cache);
                     $cache['attempts'] += 1;
                     $cache['last_attempt'] = time();
                     $cache['ip'] = env('REMOTE_ADDR');
                     $cache['request_log'][] = ['data' => $this->request->data, 'time' => time()];
                     Cache::write($cacheName, $cache, 'users_login');
                 }
                 $this->Flash->danger(__d('user', 'Username or password is incorrect.'));
             }
         }
     }
     $user = $this->Users->newEntity();
     $this->title(__d('user', 'Login'));
     $this->set(compact('user'));
 }
Exemple #23
0
function secure_tracks()
{
    $scod = substr(microtime(), 2, 4);
    $im = plugin('imgtxt', $scod, "crackman", "ok");
    $ret = hidden('secur', 'trkscr', captcha($scod));
    if (!rstr(15)) {
        return $ret . hidden('', 'trkscrvrf', $scod);
    }
    if (prms('nogdf') or !$im) {
        $ret .= btn('txtcadr', $scod);
    } else {
        $ret .= $im;
    }
    $ret .= autoclic('secure" id="trkscrvrf', helps('track_captcha'), '14', '5', '') . ' ';
    return $ret;
}
 public function index()
 {
     //为方便调试, 插件功能模块编译不缓存
     C('TMPL_CACHE_ON', false);
     $name = $this->_get('name', false);
     if (empty($name)) {
         $this->error('参数错误!');
     }
     $method = $this->_get('method', false);
     $method = empty($method) ? 'index' : $method;
     $path = './Public/Plugin/' . $name . '/index.php';
     if (!file_exists($path)) {
         $this->error('当前插件不存在!');
     }
     echo plugin($name, $method);
 }
 function formatFinished()
 {
     global $CON, $content, $self, $showsource, $page, $esum, $error, $preview, $action, $html;
     global $T_PASSWORD, $T_EDIT_SUMMARY, $T_PREVIEW, $T_DONE, $T_DISCARD_CHANGES;
     if (!$_REQUEST["ajax"]) {
         return;
     } else {
         if ($action != "edit" && !$preview) {
             $CON = substr($CON, strpos($CON, ">") + 1);
             // $CON contains <div class="pre-div"> ... </div> and we don't want this "wrapper"
             $CON = substr($CON, 0, strlen($CON) - 6);
             die($CON);
         }
     }
     $rows = count(explode("\n", $CON));
     if ($this->rows_min > $rows) {
         $rows = $this->rows_min;
     } else {
         if ($this->rows_max < $rows) {
             $rows = $this->rows_max;
         }
     }
     if (!authentified() && !$showsource) {
         // if not logged on, require password
         $FORM_PASSWORD = $T_PASSWORD;
         $FORM_PASSWORD_INPUT = "<input class=\"ajaxPasswordInput\" type=\"password\" name=\"sc\" />";
     }
     $CON_FORM_BEGIN = "<form action=\"{$self}\" class=\"ajaxForm\" method=\"post\"><input type=\"hidden\" name=\"action\" value=\"save\" /><input class=\"ajaxShowSource\" type=\"hidden\" name=\"showsource\" value=\"{$showsource}\" />";
     $CON_FORM_END = "</form>";
     $CON_TEXTAREA = "<textarea name=\"content\" class=\"ajaxContentTextarea contentTextarea\" cols=\"83\" rows=\"{$rows}\">" . h($content ? $content : $CON) . "</textarea><input type=\"hidden\" id=\"ajaxPage\" name=\"page\" value=\"" . h($page) . "\" />";
     if (!$showsource) {
         $CON_SUBMIT = "<input class=\"submit ajaxContentSubmit\" onclick=\"ajaxAction('save', this);return false;\" type=\"submit\" value=\"{$T_DONE}\" />";
         $EDIT_SUMMARY_TEXT = $T_EDIT_SUMMARY;
         $EDIT_SUMMARY = "<input type=\"text\" name=\"esum\" class=\"ajaxEsum\" value=\"" . h($esum) . "\" />";
     }
     $CON_PREVIEW = "<input class=\"ajaxContentPreview\" class=\"submit\" onclick=\"ajaxAction('save&preview=1', this);return false;\" type=\"submit\" name=\"preview\" value=\"{$T_PREVIEW}\" /> <input type=\"submit\" onclick=\"ajaxAction('', this);return false;\" value=\"{$T_DISCARD_CHANGES}\" />";
     $subs = array(array("CONTENT_FORM", $CON_FORM_BEGIN), array("\\/CONTENT_FORM", $CON_FORM_END), array("CONTENT_TEXTAREA", $CON_TEXTAREA), array("FORM_PASSWORD", $FORM_PASSWORD), array("FORM_PASSWORD_INPUT", $FORM_PASSWORD_INPUT), array("EDIT_SUMMARY_TEXT", $EDIT_SUMMARY_TEXT), array("EDIT_SUMMARY_INPUT", $EDIT_SUMMARY), array("CONTENT_SUBMIT", $CON_SUBMIT), array("CONTENT_PREVIEW", $CON_PREVIEW), array("ERROR", $error));
     $html = @file_get_contents($GLOBALS["PLUGINS_DIR"] . "/AjaxEditing/template.html");
     plugin("template");
     // plugin specific template substitutions
     foreach ($subs as $s) {
         $html = template_replace($s[0], $s[1], $html);
     }
     $html = preg_replace("/\\{([^}]* )?plugin:.+( [^}]*)?\\}/U", "", $html);
     // getting rid of absent plugin tags
     die(($preview ? $CON : "") . $html);
 }
Exemple #26
0
function plug_gallery($q)
{
    if ($q == "gl") {
        $q = "";
    }
    $img_d = sql('img', 'qda', 'v', 'id="' . $_SESSION['read'] . '"');
    $img_d = substr($img_d, 0, 1) == '/' ? substr($img_d, 1) : $img_d;
    $img_d = str_replace("/", ",", $img_d);
    if ($q == "auto") {
        $s = "";
    } elseif ($q == "manual") {
        $s = $q;
        $imgs = str_replace(",", ",\n", $img_d);
    } elseif ($q == "dir") {
        $s = $q;
        $dirs = br() . plugin('dsnav', 'gl', 'users/' . $_SESSION['qb']);
    } else {
        $s = $q;
    }
    $ret .= bal("b", "source:") . ' ';
    if (!$q) {
        //gallerygl
        if ($img_d) {
            $ret .= lj('popbt', 'popup_gallery__x_auto', "auto") . ' ';
            $ret .= lj('popbt', 'popup_gallery__x_manual', "manual") . ' ';
        }
        $ret .= lj('popbt', 'popup_gallery__x_dir', "user/directory");
    } else {
        $ret .= lj("popbt", 'popup_gallery', $q == "dir" ? "user_directory" : $q);
    }
    if ($imgs) {
        $ret .= br() . txarea('dpl', $imgs, 40, 10, atd('source') . atc('popw') . ats('border:1px solid black'));
    }
    //pb name=src
    if ($dirs) {
        $ret .= $dirs;
    }
    if ($q != "dir" && $q) {
        $ret .= br() . bal("b", "type:") . ' ';
        $ret .= ljb("popbt", "insert_photo", $s . '\',\'', "Thumbnails") . ' ';
        $ret .= ljb("popbt", "insert_photo", $s . '\',\'2', "Ajax") . ' ';
        $ret .= ljb("popbt", "insert_photo", $s . '\',\'1', "Flash") . ' ';
        $ret .= lj("popbt", 'popup_slider_' . ($s == 'manual' ? 'source' : '') . '_3x_' . $s . '_' . $_SESSION['read'], "Slider") . ' ';
    }
    return $ret;
}
 /**
  * Task main method.
  *
  * @return bool
  */
 public function main()
 {
     $this->loadModel('System.Plugins');
     try {
         $plugin = plugin($this->params['plugin']);
         $existsInDb = (bool) $this->Plugins->find()->where(['name' => $this->params['plugin']])->count();
     } catch (\Exception $e) {
         $plugin = $existsInDb = false;
     }
     if (!$plugin || !$existsInDb) {
         $this->err(__d('installer', 'Plugin "{0}" was not found.', $this->params['plugin']));
         return false;
     }
     if ($this->params['status'] === 'enable') {
         return $this->_enable($plugin);
     }
     return $this->_disable($plugin);
 }
Exemple #28
0
 public static function doLoad($library, $overload_importance = null)
 {
     if (is_array($library)) {
         foreach ($library as $v) {
             self::doLoad($v);
         }
     } else {
         if (!array_key_exists($library, self::$shelf)) {
             trigger_error("{$library} is not a loaded library.", E_USER_ERROR);
             return;
         }
         plugin('library_load_call', array($library));
         if (!self::isLoaded($library)) {
             // load the dependiences
             $deps = self::$shelf[$library]['depends_on'];
             if (!empty($deps)) {
                 foreach ($deps as $dep) {
                     self::doLoad($dep, self::$shelf[$library]['importance']);
                 }
             }
             plugin('library_load', array($library));
             self::$loadedLibraries[] = $library;
             if (is_array(self::$shelf[$library]['file'])) {
                 foreach (self::$shelf[$library]['file'] as $type => $files) {
                     if (!empty($files)) {
                         foreach ($files as $file) {
                             $importance = self::$shelf[$library]['importance'];
                             if (!is_null($overload_importance) && $overload_importance < $importance) {
                                 $importance = $overload_importance;
                             }
                             Library::queueFile($type, $file, $importance);
                         }
                     }
                 }
             } else {
                 Library::queueFile(self::$shelf[$library]);
             }
         }
     }
 }
Exemple #29
0
 public static function display()
 {
     $messages = "";
     if ($_POST['cc_form'] === 'add-user') {
         $username = $_POST['username'];
         $password = $_POST['password'];
         $cpassword = $_POST['confirm-password'];
         $group = $_POST['group'];
         if ($password != $cpassword) {
             $messages .= Message::error(__('admin', 'passwords-dont-match'));
         } else {
             $rows = Database::select('users', 'name', array('name = ? AND type = ?', $username, 'user'), null, 1)->fetch(PDO::FETCH_ASSOC);
             if (!empty($rows)) {
                 $messages .= Message::error(__('admin', 'username-in-use'));
             } else {
                 $hash = hash('whirlpool', $password);
                 $result = Database::insert('users', array('name' => filter('admin_add_user_username', $username), 'value' => $hash, 'type' => 'user', 'group' => filter('admin_add_group', $group), 'data' => serialize(filter('admin_add_user_data', array()))));
                 if ($result === 1) {
                     $messages .= Message::success(__('admin', 'user-added'));
                 }
             }
         }
     }
     $form = new Form('self', 'post', 'add-user');
     $groups = Users::allGroups();
     foreach ($groups as $key => $value) {
         $groups[$value->getId()] = $value->getName();
     }
     $form->startFieldset(__("admin", 'user-information'));
     $form->addInput(__('admin', 'username'), 'text', 'username', self::get('username'));
     $form->addInput(__('admin', 'password'), 'password', 'password');
     $form->addInput(__('admin', 'confirm-password'), 'password', 'confirm-password');
     $form->addSelectList(__('admin', 'group'), 'group', $groups, true, self::get('group'));
     plugin('admin_add_user_custom_fields', array(&$form));
     $form->addSubmit('', 'add-user', __('admin', 'add-user'));
     $form->endFieldset();
     plugin('admin_add_user_custom_fieldset', array(&$form));
     $form = $form->endAndGetHTML();
     return array(__('admin', 'add-user'), $messages . $form);
 }
Exemple #30
0
 /**
  * Gets a collection of information of every registered field in the system, or
  * information for a particular field.
  *
  * Some fields may register themselves as hidden when they are intended to be
  * used exclusively by plugins. So users can not `attach` them to entities using
  * Field UI.
  *
  * ### Usage:
  *
  * ```php
  * $visibleOnly = fieldsInfo()->filter(function ($info) {
  *     return !$info['hidden'];
  * });
  * ```
  *
  * @param string|null $field Field for which get its information as an array, or
  *  null (default) to get all of them as a collection. e.g.
  *  `Field\Field\TextField`
  * @return \Cake\Collection\Collection|array A collection of fields information
  */
 function fieldsInfo($field = null)
 {
     $fields = [];
     $plugins = plugin()->filter(function ($plugin) {
         return $plugin->status;
     });
     foreach ($plugins as $plugin) {
         foreach ($plugin->fields as $className) {
             if (class_exists($className)) {
                 $handler = new $className();
                 $result = array_merge(['type' => 'varchar', 'name' => null, 'description' => null, 'hidden' => false, 'handler' => $className, 'maxInstances' => 0, 'searchable' => true], (array) $handler->info());
                 $fields[$className] = $result;
             }
         }
     }
     if ($field === null) {
         return collection(array_values($fields));
     }
     if (isset($fields[$field])) {
         return $fields[$field];
     }
     throw new \Exception(__d('field', 'The field handler "{0}" was not found.', $field));
 }